VS:Installing Thirdparty into Vectorworks Workspace

From Vectorworks Developer
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

What's that

Script developers area able to create installation scripts of their menus and tools. These installation scripts will use API to allow menu and tool insertion into the current workspace. The location will be predetermined and the user will not be able to change it.

Menu Commands

New menu commands will be installed under Tools -> Third-party menu popup inside popup with the name of the company name. The user can add menus in the company menu, or specify menu popup structure under it. The company name and the menu path will be expected as parameters of the API.

An example of third-party menus installed under company name 'vstanev':

Here is the code of the example menu commands displayed on figure above:

vs.wsEditBegin('vstanev')
vs.wsEditAddMenu('VS_Linear_Calc')
vs.wsEditAddMenu('VS_Setup')
vs.wsEditEnd(False);

Note: The parameter with the menu command name can contain /-delimited path to place the menu command inside popup. E.g. 'SubMenu/VS_Linear Calc'

Note: The Third-party menu command will not be available until at least one menu is registered there.

Tools

New tools will be installed inside Third-party palette. The company name will be used to create tool sets.

Example third-party tool set:

API

{
  Define a block for current workspace edit.
  The corresponding wsEditAdd* functions can be used inside this block.
  The workspace edit begin function specifies the company name that will be used to label all third-party menus and tools added in this block.
  The workspace edit end function will offer restart of Vectorworks (TRUE) or reload of the workspace (FALSE). Note, the user must organize alert dialog to notify the user. The return value is whether the workspace has been modified.
}
PROCEDURE wsEditBegin(companyName : STRING);
FUNCTION  wsEditEnd(restart : BOOLEAN);

{
  Add a new menu command.
  'menuPath' specifies the universal menu name. It can also contain a /-delimited string with menu popup names, ending with the universal menu name.
}
PROCEDURE wsEditAddMenu(menuPath : STRING) : BOOLEAN;

{
  Add a new tool to the third-party palette.
  'toolType' identifies the type of tool being added. Possible values:
       1 - a normal SDK implemented tool (SToolDef::fToolType == eExtensionToolType_Normal);
       2 - a VectorScript implemented tool;
       3 - a VectorScript parametric object;
       4 - an SDK implemented default tool. see SToolDef::fToolType
  'insideToolName' can be used to insert the new tool behind an existing tool.
}

PROCEDURE wsEditAddTool(toolName : STRING; toolType : INTEGER) : BOOLEAN;
PROCEDURE wsEditAddTool2(toolName : STRING; toolType : INTEGER; insideToolName : STRING) : BOOLEAN;

See also

VS:wsEditBegin | VS:wsEditEnd | VS:wsEditAddMenu | VS:wsEditAddTool | VS:wsEditAddTool2

Practical with: VS:Implementing Installation Script