SDK:Parametric Custom Selection Indication

From Vectorworks Developer
Jump to navigation Jump to search

.SDK|SDK ..SDK:Types|SDK Types ..SDK:Using the SDK|Using the SDK ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

By Vladislav Stanev

What's that

When you have a parametric object in the drawing that is selected, the selection indication looks like all the inner objects of the parametric are selected.

From VectorWorks 2009 parametric objects are capable of customizing the selection indication by providing geometry which will be used to present the selection. That geometry will not be rendered, it will just determine the selection and pre-selection indication.

As you can see the image above, when the object has custom selection you can simplify the selection indication for complex geometrical objects.

NOTE! The geometry that determines the selection indication is kept inside each instance.

Creating

The plug-in creates geometry that is to be used as selection indication and puts the geometry into special group with the call VCOM:VectorWorks:ISDK::SetCustomObjectSelectionGroup.

You can pass handle to what ever object or handle to group object that contains geometry.

2D geometry inside the group will be presented as 2D selection indication, and 3D object -- as 3D selection indication.

case kParametricRecalculate : {

  // -------------------------------------------------------
  // prepare selection indication geometry
  MCObjectHandle	hSelGroup	= gSDK->CreateGroup();

  // 2D selectoin
  MCObjectHandle	h2DSel		= gSDK->CreateArcN( WorldRect( -100, 100, 100, -100 ), 0, 360 );
  gSDK->AddObjectToContainer( h2DSel, hSelGroup );

  MCObjectHandle	h3DSel1		= gSDK->DuplicateObject( hExtrude );
  gSDK->AddObjectToContainer( h3DSel1, hSelGroup );

  // set selection geometry for this object
  gSDK->SetCustomObjectSelectionGroup( objHand, hSelGroup );

2014/08/29 SDK 2013: Appareantly when creating other content between "AddObjectToContainer" and "SetCustomObjectSelectionGroup" it will corrupt the group. This will occur mostly on new objects.

See also

SDK:Plug-in Object Events | SDK:Parametric Object Plug-in