VS:vsoStateGetPos
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Used to determine if an object has been moved. Returns True if the object was moved and the distance the object was moved in mm. See VS:Parametric State Notifications#vsoStateGetPos
This function should be called during the parametric reset event: 3: {kParametricRecalculate}
FUNCTION vsoStateGetPos(
hObj : HANDLE;
VAR outX : REAL;
VAR outY : REAL;
VAR outZ : REAL;
VAR outIs3D : BOOLEAN) : BOOLEAN;
def vs.vsoStateGetPos(hObj): return (BOOLEAN, outX, outY, outZ, outIs3D)
Parameters
hObj HANDLE Handle to the parametric object. Obtained by call to VS:GetCustomObjectInfo outX REAL Output parameter. Moved distance in mm. outY REAL Output parameter. Moved distance in mm. outZ REAL Output parameter. Moved distance in mm. outIs3D BOOLEAN Output parameter. Is 3D operation.
Return Value
Returns True if the object was moved.
Remarks
Returns the distance moved (NOT the previous x,y,z location) in mm.
Example
VectorScript
BEGIN result := GetCustomObjectInfo(objectName, objectHand, recordHand, wallHand); vsoGetEventInfo(theEvent, message ); CASE theEvent OF 5: {kObjOnInitXProperties} BEGIN {enable eventing for this plug-in} SetPrefInt( 590, 1 ); {varParametricEnableStateEventing, kParametricStateEvent_ResetStatesEvent} result := SetObjPropVS(18, TRUE); {kObjXPropAcceptStates} END; 44: {kObjOnAddState} BEGIN message := vsoStateAddCurrent( objectHand, message ); END; 3: {kParametricRecalculate} BEGIN MoveTo( 5mm, 8mm ); CreateText( 'State events received after the last kParametricRecalculate:' ); IF vsoStateGetPos( objectHand, x, y, z, is3D ) THEN BEGIN MoveTo( 0,-10mm ); CreateText( Concat( 'Object just moved! offset=(', x, ' ,', y, ' ,', y, ' z', z, ') is3DMove=', is3D ) ); END; END;
Python
Version
Availability: from Vectorworks2009
This is drop-in function.
See Also
VS:Parametric State Notifications | VS:vsoStateAddCurrent
VS:vsoStateGetPos | VS:vsoStateGetRot | VS:vsoStateGetParamChng | VS:vsoStateGetObjChng | VS:vsoStateGetLayrChng | VS:vsoStateGetExitGroup | VS:vsoStateGetNameChng