Getting started with the Vectorworks SDK

I’m not a fan of the stock text note tool in Vectorworks. The best I’ve yet used shipped with PowerCADD 2000. We’re going to make a PowerCADD-inspired Vectorworks text note tool to explore how to develop a simple Vectorworks C++ plug-in.

All source code is MIT-licensed and can be downloaded from Github.

To follow along at home, you will need…

Our project

The PowerCADD text note tool required three clicks to place: first (x,y) is the arrowhead, second gives the (x,y) of the shoulder, and the third gives the (x) of the text point. The (y) of the text point is always the same as the shoulder. Click-click-click-type-done.

Reshaping the note happens by clicking on those same points. Dragging the arrow does what you’d expect. Dragging the shoulder will drag the text along with it, keeping the same relative distance between shoulder and text. Dragging the text is constrained to stay on the same (y) as the shoulder.

As the CAD guy for a mid-sized firm, my preference is to hard-code our tools to work with our own drawing standards. I’d rather make it easy to do the right thing instead of being ‘that guy,’ beating on our drafters about arrowhead styles so that they start to roll their eyes at my approach. Thus, the code here reflects my personal taste in classes, arrowheads and type. While my taste is in fact correct, it also isn’t shared by everyone. Feel free to change these little details.

Why not just use Vectorscript?

You can cobble together something that kinda works for most things using Vectorworks’s other customisation system: Vectorscript. I’ve coded in it for years, and it can get most jobs done more safely.

However, my tastes, skills and ambitions around what I want our CAD system to do have grown. There are a bunch of limitations to Vectorscript that now bug me:

There are some elements to the text note project that do benefit from the greater control over UI that the SDK offers. You could make something similar with Vectorscript, but it would have irritating little warts.


Browsing through Nemetschek’s docs can be confusing. There’s a major conceptual transition going on in how one structures plugins, the deprecated way hasn’t been excised from the docs, and the new one isn’t yet explained clearly.

Some history: the original incarnation of the SDK was procedural (notwithstanding that it’s all C++). Calls into the Vectorworks app were of the form GS_GetOpacity(gCBP,...): the first parameter was always a global callback pointer gCBP providing a hook back into Vectorworks’ guts at runtime.

The procedural form is deprecated as of Vectorworks 2010. Nemetschek is now pushing an object-oriented form. Calls to the SDK are now method calls of the form gSDK->GetOpacity() on a runtime-defined global C++ object. (Admittedly, it’s a bit tomayto-tomahto. gSDK—an instance of VectorWorks::ISDK—seems to be just a thin God Class wrapper around the old functions).

The new form is an improvement once we start to get into using files, dialogs, and the like. More broadly, the plugin architecture is now being revised to something called Vectorworks Component Object Model (VCOM). I’m probably oversimplifying, but I understand VCOM as just meaning a switch to object-orientation. It replaces the old-style big spaghetti switch statement at the heart of old plugins with hook methods on a supplied object. This pattern is definitely more comfortable to me, since I’m used to seeing it in iOS and Mac OS X code, and encourages the other good things that come from object-orientation: maintainability, reusability, scalability.

In Part 2, we will go over the basic object architecture for our text note plugin, and get set up to start coding.

Fri 18 Feb 2011