SDK:Plug-in Module

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

Vectorworks (http://www.vectorworks.net) provides an open architecture that allows developers to supplement or replace existing Vectorworks functionality. From the user’s perspective, these new tools, menu commands, and objects are indistinguishable from those built into Vectorworks. As such, they are first class solutions for the user. See the SDK article for more general information.

The Plug-in Module Environment

A plug-in module is a VCOM (Vectorworks Component Object Model) provider.

The plug-in module has a single entry point:

Provider of interfaces can be only Vectorworks module plug-ins. A module plug-in defines interface implementation using the template function REGISTER_Interface:

extern "C" long GS_EXTERNAL_ENTRY plugin_main(long action, void* pInfo, long& ioData, CallBackPtr cbp)
{
    // initialize VCOM mechanizm
    ::GS_InitializeVCOM( cbp );

    long  reply = 0L;

    // register interface implementations using REGISTER_Interface
    // ...
    // register extension implementations using REGISTER_Extension
    // ...

    return reply;
}

Extensions

The main function initializes VCOM (and the old GS_* function callback 'gCBP) and registers VCOM interface implementations or extension implementations.

An extension is a VCOM implementation of the interface VCOM:VectorWorks:Extension:IExtension and it provides defining information back to the Vectorworks. The extension also provides sink implementation (VCOM:VectorWorks:Extension:IEventSink) that will receive the events sent from Vectorworks to the extension.

There are four types of extensions currently supported by Vectorworks plug-in modules:

Extension VCOM Interface SDK Base Class SDK Main Event Sink
Menu Extension IExtensionMenu VWExtensionMenu VWMenu_EventSink
Parametric Extension IExtensionParametric VWExtensionParametric VWParametric_EventSink
Tool Extension IExtensionTool VWExtensionTool VWTool_EventSink
VectorScript functions extension IExtensionVSFunctions VWExtensionVSFunctions VWVSFunctions_EventSink

Resources

Every Vectorworks SDK plug-in has a resource file that provides localizable contents.

On Mac the resource file is built-in the executable bundle.

On Windows the resource file is a separate file located in the same place where the plug-in module file is. The resource file has the same name as the plug-in module file only with extension 'vwr'

See SDK:Plug-in Resources for more detailed information.

Using Module Plug-ins

More detailed information on using module plug-ins can be found on page SDK:Using the SDK.

See also

SDK Obsolete Function Reference | VCOM (VectorWorks Component Object Model) | SDK Sample Code