SDK:VectorWorks Foundation Classes

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

What is this?

VectorWorks Foundation Classes (VWFC) is a library that provides set of classes for simplifying the development of VectorWorks plug-ins using the SDK.

VWFC is composed of several namespaces containing classes with different purpose.

Namespace Description
VWFC:Math Contain classes for mathematical operations. A plug-in normally uses those classes to do calculations and prepare the data for creating VectorWorks objects.
VWFC:VWObjects Contain wrapper classes for SDK:MCObjectHandle. The plug-in uses SDK:MCObjectHandle to pass around when created VectorWorks objects. When the plug-in needs to work with the particural object that the SDK:MCObjectHandle identifies, it creates proper wrapper class from that namespace and works with the handle through the wrapper class instance.
VWFC:PluginSupport Provides classes for different type of plug-ins. This namespace provides layer above the main function of the plug-in, wrapping it around abstract class. The plug-in implements the abstract class and receives events through virtual functions.
VWFC:Memory Handles memory manager for the VWFC plug-ins. Enables tracking of memory leaks in the plug-ins.
VWFC:Tools Provides multi purpose tool classes for different solutions.

VWFC provides wrapper classes that works with the SDK anyway. So, if you VWFC plug-in you can still use all the VCOM:VectorWorks:ISDK functions.

The resources of a VWFC plug-in are the same as any normal SDK plug-in. See: SDK:Plug-in Resources.

Settings up for VWFC

Every VectorWorks Plug-in project can use VWFC. The library is provided inside the SDK as set of header files and a library.

Set up compiler

Your project settings has to have search for headers path to the SDKLib\Include\VWFC SDK folder.

Set up linking

Next you should do is to add VWFC.lib file in your windows project, and libVWFC.a library file in your Mac project.

The lib files are located in the SDK along with the rest library files for the VectorWorks SDK.

Set up prefix

In your project's prefix file you have to define the type of the VWFC plug-in that you will use the VWFC frame work.

Then you have to include the VWFC framework main file to include the entire VWFC framework classes.

// -----------------------------------
// VWFC Framework
#define	PLUGIN_NAME		"TestTool Tool"

// Include all VWFC classes
#include "VWFCLibrary.h"

There are four macros to define the type of the plug-in:

VWFC_APPLICATION_MENU_COMMAND Define for Menu Command Plug-in
VWFC_APPLICATION_TOOL Define for Tool Plug-in
VWFC_APPLICATION_LIBRARY Define for Library Plug-in

PLUGIN_NAME is defined to supply the plug-in name for memory leaks reporting and other debug related reasons. This is not used in any UI or end user related reasons. However it is needed to be defined for the successful compilation.

Creating plug-in

VWFC approach to plug-in is by sub classing application class from VWFC:PluginSupport namespace.

Then registering that user application class into VWFC framework.

After that every time VectorWorks needs to call the plug-in with event, instance of that application will be created, and appropriate virtual function will be called to handle the event. The client application class can override that virtual function if it is interested in that particular event.

Depending on the type of the plug-in, you should sub class different application:

See Also