Difference between revisions of "VS:vsoStateGetParamChng"

From Vectorworks Developer
Jump to: navigation, search
(behaviour using worksheets)
(analyse the values returned in different conditions)
Line 55: Line 55:
 
-----------------------------------------------------------------------------------------------------------
 
-----------------------------------------------------------------------------------------------------------
 
<remark>
 
<remark>
([[User:Orso.b.schmid|Orso]], 2015.06.07): In VW 2013 and perhaps before this won't be triggered by edits performed through worksheets. Otherwise in later versions it sets:
+
([[User:Orso.b.schmid|Orso]], 2016.05.08):  
* outWidgID = -1: on edit control pt
+
vsoStateGetParamChng returns false under following modifications:
* outWidgID = 0: on edit through WS <--- DON'T USE outWidgID!!!
+
* on PIO rec set up
 +
* on move, rot, path reshape
 +
* layer scale, height, thickness
 +
* outWidgID, outPrmIdx return 0 on move, rot, new obj, alt-drag copy!
  
 +
As a consequence the state parameter change won't be triggered on move, rot or on copy. Below a list of observations:
 +
* outWidgID:
 +
** returns -1 on editing on drawing a control point
 +
** returns outPrmIdx on any edit in the OIP (including ctrl pt fields)
 +
** returns 0 on edit through a worksheet <--- DON'T USE outWidgID!!!
 +
* outPrmIdx:
 +
** returns outPrmIdx after moving a ctrl pt
 +
** returns outPrmIdx after edit in the OIP
 +
* outOldVal:
 +
** editing dimension or control point parameters: returns a string with the value in mm
 +
** edit after moving a ctrl pt on drawing: returns a string with the values pair in mm
 +
** edit in the OIP: returns a singular value in mm
 
</remark>
 
</remark>
  

Revision as of 01:37, 8 May 2016

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

Description

Used to determine if the object parameter has changed. See VS:Parametric State Notifications#vsoStateGetParamChng

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

FUNCTION vsoStateGetParamChng(
hObj  : HANDLE;
VAR outWidgID  : LONGINT;
VAR outPrmIdx  : INTEGER;
VAR outOldVal  : STRING) : BOOLEAN;
def vs.vsoStateGetParamChng(hObj):
    return (BOOLEAN, outWidgID, outPrmIdx, outOldVal)

Parameters

hObj HANDLE Handle to the parametric object. Obtained by call to VS:GetCustomObjectInfo
outWidgID LONGINT Output parameter. Widget ID of the changed parameter.
outPrmIdx INTEGER Output parameter. Parameter index.
outOldVal STRING Output parameter. String representation of the old value.

Remarks

(Orso, 2016.05.08):

vsoStateGetParamChng returns false under following modifications:

  • on PIO rec set up
  • on move, rot, path reshape
  • layer scale, height, thickness
  • outWidgID, outPrmIdx return 0 on move, rot, new obj, alt-drag copy!

As a consequence the state parameter change won't be triggered on move, rot or on copy. Below a list of observations:

  • outWidgID:
    • returns -1 on editing on drawing a control point
    • returns outPrmIdx on any edit in the OIP (including ctrl pt fields)
    • returns 0 on edit through a worksheet <--- DON'T USE outWidgID!!!
  • outPrmIdx:
    • returns outPrmIdx after moving a ctrl pt
    • returns outPrmIdx after edit in the OIP
  • outOldVal:
    • editing dimension or control point parameters: returns a string with the value in mm
    • edit after moving a ctrl pt on drawing: returns a string with the values pair in mm
    • edit in the OIP: returns a singular value 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 vsoStateGetParamChng( objectHand, widgID, prmIndex, oldValue ) THEN BEGIN
        MoveTo( 0,-30mm );
        CreateText( Concat( 'Object parameter just changed! widgetID=', widgID, ' paramIndex=', prmIndex,' OldValue=', oldValue ) );
      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]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox