VS:Parametric Custom Shape Pane

From Vectorworks Developer
Jump to: navigation, search

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

By Vladislav Stanev

What's that

Parametric Objects can customize the "Object Info - Shape Pane" palette in VectorWorks.


By default the "Object Info - Shape Pane" palette shows the parameters of the parametric object as they are defined by the VectorScript plug-in editor. The types of the widgets that appear in the palette are determined by the types of the parameters.

The Problem

A parametric plug-in is able to override that standard behavior and customize the appearance of the "Object Info - Shape Pane" Palette.

This approach allows a complex plug-in parametric to make good distinction between data and UI of the parameters.

  • Data is the internal record that holds the parameters of the object; Data is defined with the Plug-in Object Parameters. This represents one format with the name of the object which is created when object of this type is created. Each instance of that object contains record instance in its AUX list holding the parameters for that particular parametric object instance.
  • UI is the custom defined widgets that appear in the Shape pane. The plug-in can define the widgets that appear in the shape pane and can bind them to the parameter's data. This will make VectorWorks automatically transfer data between the widgets and the parameters record.

The sample demonstrated in this article will create a custom shape pane adding one additional button.



If you want your plug-in to control the widgets that appear in the "Object Info - Shape Pane" Palette, you must have event-enabled VectorScript plug-in.

Then you have to handle the extended properties event, and set up the widgets for your plug-in:

  result := GetCustomObjectInfo(objectName, objectHand, recordHand, wallHand);
  vsoGetEventInfo(theEvent, message );

  CASE theEvent OF
    5: {kObjOnInitXProperties}
      result := SetObjPropVS(8, TRUE); {kObjXPropHasUIOverride}
      result := SetObjPropVS(12, TRUE); {kObjXHasCustomWidgetVisibilities}
      result := vsoInsertAllParams;
      result := vsoInsertWidget (3, 12 {kWidgetButton}, 100, 'Edit List...', 0);
  • kObjXPropHasUIOverride (8) -- set to TRUE to enable customization of the widgets. Setting this to TRUE puts in hands of the plug-in creating of the widgets. This means that if the plug-in doesn't put widgets the info palette will contain no widgets;
  • kObjXHasCustomWidgetVisibilities (12) -- set to TRUE to enable custom widget visibility event. This allows the plug-in to control the widget state in the info palette.
  • VS:vsoInsertAllParams will add all parameters as widgets. Each widget will have it's ID from the index of the parameter.
  • VS:vsoInsertWidget will insert a button widget after the thrird existing widget, and the new button widget will be with ID=100.

Updating widget state

  41: {kObjOnWidgetPrep}
    vsoWidgetSetVisible( 1, PUseCustomText );
    vsoWidgetSetEnable( 3, PUseCustomText );
    vsoWidgetSetEnable( 100, PUseCustomText );

    {it is very important the script to notify back
     that the event is handled}
    vsoSetEventResult( -8 {kObjectEventHandled} );

By referencing the widgets by their IDs, during this event the plug-in object can control the state of the widgets.

At the end of the event 41, don't forget to call

vsoSetEventResult( -8 {kObjectEventHandled} );

See the example below for more detailed example of how to achieve this.

See also

Personal tools

Advanced Search
See Also