VS:vsoStateGet: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
m (1 revision)
 
(No difference)

Latest revision as of 14:39, 12 August 2013

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

Description

Checks if the passed parametric object have received specific 'state' event before this reset event. VS:Parametric State Notifications#vsoStateGet

This function should be called during the parametric reset event: 3: {kParametricRecalculate}

FUNCTION vsoStateGet(
hObj  : HANDLE;
state  : INTEGER) : BOOLEAN;
def vs.vsoStateGet(hObj, state):
    return BOOLEAN

Parameters

hObj HANDLE Handle to the parametric object. Obtained by call to VS:GetCustomObjectInfo
state INTEGER State Identifier which you want to check.

Return Value

Returns TRUE if the passed 'state' has been received. FALSE otherwise.

Remarks

State constants are:

kCreatedReset = 0;
kMovedReset = 1;
kRotatedReset = 2;
kParameterChangedReset = 3;
kObjectChangedReset = 4;
kLayerChangedReset = 5;
kExitFromEditGroup = 6;
kObjectNameChanged = 7;

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 vsoStateGet( objectHand, 0 {ObjectState::kCreatedReset} ) THEN BEGIN
        MoveTo( 0, 0 );
        CreateText( 'Object just created!' );
      END;
    END;

Python


Version

Availability: from Vectorworks 2009

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

[[VS:Parametric State Notifications]] | [[VS:vsoStateAddCurrent]] [[VS:vsoStateGetPos]] | [[VS:vsoStateGetRot]] | [[VS:vsoStateGetParamChng]] | [[VS:vsoStateGetObjChng]] | [[VS:vsoStateGetLayrChng]] | [[VS:vsoStateGetExitGroup]] | [[VS:vsoStateGetNameChng]]