VS:IFC CopyIFCData: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
No edit summary
Line 24: Line 24:
hSource
hSource
HANDLE
HANDLE
Handle source to object.


</line>
</line>
Line 29: Line 30:
hDestination
hDestination
HANDLE
HANDLE
Handle to destination object.


</line>
</line>
Line 34: Line 36:
inMode
inMode
INTEGER
INTEGER
Options for copying. Possible values are 0 (copy always, new UUID); 1 (copy always, keep the old UUID); 2(copy, if same type, new UUID) and 3(copy, if same type, keep the old UUID).


</line>
</line>
Line 40: Line 43:


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark></remark>
<remark>
===== Return Values =====
TRUE on success.
FALSE indicates failure. Possible reasons:
 
- incorrect handles
 
- no IFC data attached to the source
 
- different entity types when in mode 2/3.
 
 
Note that, in order to copy IFC Data to the destination handle, the source handle needs to have IFC entity attached.
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample></sample>
<sample>
Assume we want to copy IFC data from a Space object to a Table object.
 
==== VectorScript ====
<code lang="pas">
PROCEDURE CopyIFCData;
VAR
hSource : HANDLE;
hDestination : HANDLE;
ok : BOOLEAN;
BEGIN
hSource        := GetObject('Dining Room'); {Space Object}
hDestination    := GetObject('Dining Table'); {Table Object}
ok              := IFC_CopyIFCData(hSource, hDestination, 0); {ok returns TRUE, IFC data copied, new UUID created}
ok              := IFC_CopyIFCData(hSource, hDestination, 1); {ok returns TRUE, IFC data copied, old UUID kept}
ok              := IFC_CopyIFCData(hSource, hDestination, 2); {ok returns FALSE, IFC data not copied, different entity types}
ok              := IFC_CopyIFCData(hSource, hDestination, 3); {ok returns FALSE, IFC data not copied, different entity types}
END;
 
RUN(CopyIFCData);
 
</code>
==== Python ====
<code lang="py">
hSource = vs.GetObject("Dining Room"); #Space Object}
hDestination = vs.GetObject("Dining Table"); #Table Object}
ok = vs.IFC_CopyIFCData(hSource, hDestination, 0); #ok returns TRUE, IFC data copied, new UUID created
ok = vs.IFC_CopyIFCData(hSource, hDestination, 1); #ok returns TRUE, IFC data copied, old UUID kept
ok = vs.IFC_CopyIFCData(hSource, hDestination, 2); #ok returns FALSE, IFC data not copied, different entity types
ok = vs.IFC_CopyIFCData(hSource, hDestination, 3); #ok returns FALSE, IFC data not copied, different entity types
 
</code>
</sample>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Line 50: Line 98:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<version>
<version>
Availability: from Vectorworks 2014
Available from: Vectorworks 2011.


</version>
</version>

Revision as of 14:04, 19 October 2018

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Copies IFC data from one object to another

FUNCTION IFC_CopyIFCData(
hSource :HANDLE;
hDestination :HANDLE;
inMode :INTEGER) : BOOLEAN;
def vs.IFC_CopyIFCData(hSource, hDestination, inMode):
    return BOOLEAN

Parameters

hSource HANDLE Handle source to object.
hDestination HANDLE Handle to destination object.
inMode INTEGER Options for copying. Possible values are 0 (copy always, new UUID); 1 (copy always, keep the old UUID); 2(copy, if same type, new UUID) and 3(copy, if same type, keep the old UUID).

Remarks

Return Values

TRUE on success. FALSE indicates failure. Possible reasons:

- incorrect handles

- no IFC data attached to the source

- different entity types when in mode 2/3.


Note that, in order to copy IFC Data to the destination handle, the source handle needs to have IFC entity attached.

Example

Assume we want to copy IFC data from a Space object to a Table object.

VectorScript

PROCEDURE CopyIFCData;
VAR
	hSource 	: HANDLE;
	hDestination 	: HANDLE;
	ok 		: BOOLEAN;
BEGIN
	hSource         := GetObject('Dining Room'); {Space Object}
	hDestination    := GetObject('Dining Table'); {Table Object}
	ok              := IFC_CopyIFCData(hSource, hDestination, 0); {ok returns TRUE, IFC data copied, new UUID created}
	ok              := IFC_CopyIFCData(hSource, hDestination, 1); {ok returns TRUE, IFC data copied, old UUID kept}
	ok              := IFC_CopyIFCData(hSource, hDestination, 2); {ok returns FALSE, IFC data not copied, different entity types}
	ok              := IFC_CopyIFCData(hSource, hDestination, 3); {ok returns FALSE, IFC data not copied, different entity types}
END;

RUN(CopyIFCData);

Python

hSource = vs.GetObject("Dining Room"); #Space Object}
hDestination = vs.GetObject("Dining Table"); #Table Object}
ok = vs.IFC_CopyIFCData(hSource, hDestination, 0); #ok returns TRUE, IFC data copied, new UUID created
ok = vs.IFC_CopyIFCData(hSource, hDestination, 1); #ok returns TRUE, IFC data copied, old UUID kept
ok = vs.IFC_CopyIFCData(hSource, hDestination, 2); #ok returns FALSE, IFC data not copied, different entity types
ok = vs.IFC_CopyIFCData(hSource, hDestination, 3); #ok returns FALSE, IFC data not copied, different entity types

Version

Available from: Vectorworks 2011.