SDK:Similar Objects Creation

From Vectorworks Developer
Revision as of 14:41, 8 July 2008 by Defelix (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

...

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