SDK:Similar Objects Creation: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
 
Line 8: Line 8:
== What's that ==
== What's that ==


...
Make the menu command 'Create Similar Object' work for any custom parametric.


== Parametric Object Part ==
== Parametric Object Part ==

Latest revision as of 13:43, 25 May 2018

.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

Make the menu command 'Create Similar Object' work for any custom parametric.

Parametric Object Part

The parametric object responds to event with the name of the tool that should be activated. The name of the tool is actually the name of the dynamic library of the tool plug-in.

In your parametric plug-in you should handle kObjOnGetToolName event inside your SDK:Plug-in Object Main Function.

long ParametricMain(long action, MCObjectHandle hParametricObj, long message, long &userData)
{
  // ...
  long	reply = kParametricNoErr;
  switch (action) {

    // ...

    case kObjOnGetToolName: {
      TXString*	pToolName	= (TXString*) message;
      if ( pToolName ) {
         // return the dyn library file name of the tool plug-in
         *pToolName	= "SampleObjectTool";
         reply		= kObjectEventHandled;
      }
      break;

    // ...

  }

  return reply;
}

Tool Part

The tool is notified by VectorWorks for the object that needs to be duplicated.

In your tool plug-in you should handle kToolInitByObject event inside your SDK:Plug-in Tool Main Function.

The tool can setup itself properly by the specified object Handle.

Note VectorWorks have already copied the parametric record data.

long ToolMain(long action, long message1, long message2, long &userData)
{
  // ...

  switch (action) {

    // ...

    case kToolInitByObject: {
      MCObjectHandle hTheObject	= (MCObjectHandle) message1;

      // use hTheObject to set proper default data in your tool.
      // NOTE: VectorWorks have already copied the parametric record data
      // ...

      break;
    }


    // ...
  }
}

See also

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