Developing with the Vectorworks SDK #3

Using SDK wrapper classes

While we can use any ISDK function using the gSDK-> pointer, the Vectorworks SDK also provides a lot of class wrappers offering advanced control. There is no manual of what is available, I find the best way is to spend a day reading through every header file.

Creating the VWGuidelineObj class

Since we are creating a parametric object, we will extend that class as it already contains most if not all functionality we require to generate the geometry for this plugin.

The constructor loads private data which defines the object. The advantage is that a public function could retrieve this data if you ever need to traverse a list of those object types.
For this simple plug-in this isn't required, but I still create the code the same way as I do for all of my objects.

How and where you define the files is up to you. I follow the structure from the VWFC folder in the library include files and have one file including all of my object files. Eventually you need to make this file to be included in our object files we created earlier so the classes are referenced correctly.

VWGuidelineObj.h
VWGuidelineObj.cpp

Make sure you include these file in our earlier object files to make the recalculate event recognise this class.

Registering our custom object

The last step is to tell Vectorworks to load your plug-ins on startup. Since in the SDK a tool is a separate definition from an object we need to register both:


REGISTER_Extension( GROUPID_ExtensionTool, action, moduleInfo, iid, inOutInterface, cbp, reply );
REGISTER_Extension( GROUPID_ExtensionParametric, action, moduleInfo, iid, inOutInterface, cbp, reply );

That's it. Compile and run.
Your tool will be available when editing your workspace. When using it, it will create your custom object.