AutoKey User Interactive 
MiniCAD

VectorScript Declaration:

FUNCTION   AutoKey
VAR asciiCode:LONGINT ) :BOOLEAN ;

Python:

def  vs.AutoKey():
   return (BOOLEAN, asciiCode)

Description:

Function AutoKey returns TRUE if a non-modifier keyboard character has been continually depressed for longer than the system defined key repeat rate. If a keyboard character has been continually depressed, then ASCII code of the character is returned in parameter asciiCode.

Modifier keys are defined as the Caps Lock, Command, Control, Option, and Shift keys.

Parameters:

asciiCode The ASCII code of the key depressed.

Example:

WHILE NOT AutoKey(keyHit) DO
BEGIN
     SysBeep;
     SysBeep;
END;
Message('The key pressed was ',keyHit);



  BeginModeButtonsText User Interactive 
Vectorworks 2013

VectorScript Declaration:

PROCEDURE   BeginModeButtonsText
;

Python:

def  vs.BeginModeButtonsText():
   return None

Description:

Creates a mode bar buttons help text.

Example:

BeginModeButtonsText;
SetModeButtonText( 'Mode1', 1 );
SetModeButtonText( 'Mode2', 0 );
EndModeButtonsText;

See Also:

EndModeButtonsText   SetModeButtonText  



  CapsLock User Interactive 
MiniCAD

VectorScript Declaration:

FUNCTION   CapsLock
:BOOLEAN ;

Python:

def  vs.CapsLock():
   return BOOLEAN

Description:

CapsLock returns TRUE if the Caps Lock was depressed during the last user event. This function operates with the MouseDown, KeyDown, AutoKey, GetPt, GetPtL, GetLine, and GetRect calls.



  Command User Interactive 
MiniCAD

VectorScript Declaration:

FUNCTION   Command
:BOOLEAN ;

Python:

def  vs.Command():
   return BOOLEAN

Description:

Command returns TRUE if the Command key (Mac) or Control key (Windows) was depressed during the last user event. This function operates with the MouseDown, KeyDown, AutoKey, GetPt, GetPtL, GetLine, and GetRect calls.



  EndModeButtonsText User Interactive 
Vectorworks 2013

VectorScript Declaration:

PROCEDURE   EndModeButtonsText
;

Python:

def  vs.EndModeButtonsText():
   return None

Description:

Ends the creation of a mode bar buttons help text.

Example:

BeginModeButtonsText;
SetModeButtonText( 'Mode1', 1 );
SetModeButtonText( 'Mode2', 0 );
EndModeButtonsText;

See Also:

BeginModeButtonsText   SetModeButtonText  



  GetKeyDown User Interactive 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetKeyDown
VAR asciiCode:LONGINT ) ;

Python:

def  vs.GetKeyDown():
   return asciiCode

Description:

Procedure GetKeyDown pauses execution of a VectorScript routine until a key is pressed by the user. When the key is pressed, the ASCII code of the key is returned.

Parameters:

asciiCode ASCII code of key pressed.



  GetLine User Interactive 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetLine
( VAR  p1X :REAL;
  VAR  p1Y :REAL;
  VAR  p2X :REAL;
  VAR  p2Y :REAL
) ;

Python:

def  vs.GetLine():
   return (p1, p2)

Description:

Procedure GetLine returns two user selected points, and draws a temporary "rubberband" line when prompting for the second point. This cannot be used if there is a function anywhere in the calling chain.

Parameters:

p1 Returns coordinates of first user click.
p2 Returns coordinates of second user click.



  GetLine3D User Interactive 
Vectorworks 2010

VectorScript Declaration:

PROCEDURE   GetLine3D
( VAR  p1X :REAL;
  VAR  p1Y :REAL;
  VAR  p1Z :REAL;
  VAR  p2X :REAL;
  VAR  p2Y :REAL;
  VAR  p2Z :REAL;
    useWP :BOOLEAN
) ;

Python:

def  vs.GetLine3D(useWP):
   return (p1, p2)

Description:

Procedure GetLine3D returns two user selected points, and draws a temporary "rubberband" 3D line when prompting for the second point. This cannot be used if there is a function anywhere in the calling chain.

Parameters:

p1 Returns coordinates of first user click.
p2 Returns coordinates of second user click.
useWP TRUE if the returned point have to be on the active Working Plane. Snapping to arbitrary 3D geometry will produce vertical projection result on the WP; FALSE if the point can be arbitrary 3D point (produced, for example, by snapping to a 3D geometry)

See Also:

GetPt   GetPtL   GetLine   GetRect   GetPt3D   GetPtL3D   GetLine3D   GetRect3D  



  GetMouse User Interactive 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetMouse
( VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.GetMouse():
   return p

Description:

Procedure GetMouse tracks and returns the current location of the cursor within the active Vectorworks document, allowing the cursor coordinates to be returned dynamically while moving the cursor onscreen.

Parameters:

p Returns current mouse coordinates.

Example:

BEGIN
     WHILE NOT KeyDown(aCode) DO
     BEGIN
           GetMouse(CursX,CursY);
           Message('X : ',CursX,' Y : ',CursY);
     END;
END;
{displays the cursor coordinates as it is moved around onscreen}



  GetPt User Interactive 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetPt
( VAR  pX :REAL;
  VAR  pY :REAL
) ;

Python:

def  vs.GetPt():
   return p

Description:

Procedure GetPt switches the cursor to selection mode and allows the user to select a point in a Vectorworks document. This cannot be used if there is a function anywhere in the calling chain.

Parameters:

p Returns coordinates of mouse click.

Example:

PROCEDURE Example;
VAR
	pt :POINT;
BEGIN
	GetPt(pt.x, pt.y);
	Message(pt);
END;
RUN(Example);



  GetPt3D User Interactive 
Vectorworks 2010

VectorScript Declaration:

PROCEDURE   GetPt3D
( VAR  pX :REAL;
  VAR  pY :REAL;
  VAR  pZ :REAL;
    useWPOnly :BOOLEAN
) ;

Python:

def  vs.GetPt3D(useWPOnly):
   return p

Description:

Procedure GetPt3D switches the cursor to 3D selection mode and allows the user to select a point in a VectorWorks document. This cannot be used if there is a function anywhere in the calling chain.

Parameters:

p Returns coordinates of mouse click.
useWPOnly TRUE if the returned point have to be on the active Working Plane. Snapping to arbitrary 3D geometry will produce vertical projection result on the WP; FALSE if the point can be arbitrary 3D point (produced, for example, by snapping to a 3D geometry)

See Also:

GetPt   GetPtL   GetLine   GetRect   GetPt3D   GetPtL3D   GetLine3D   GetRect3D  



  GetPtL User Interactive 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetPtL
(   p1X :REAL;
    p1Y :REAL;
  VAR  p2X :REAL;
  VAR  p2Y :REAL
) ;

Python:

def  vs.GetPtL(p1):
   return p2

Description:

Procedure GetPtL creates a temporary "rubberband" line from a specified point to the user selected end point. This cannot be used if there is a function anywhere in the calling chain.

Parameters:

p1 Coordinates of line start point.
p2 Returns coordinates of mouse click.

Example:

PROCEDURE Example;
VAR
	pt1, pt2 :VECTOR;
BEGIN
	GetPt(pt1.x, pt1.y);
	GetPtL(pt1.x, pt1.y, pt2.x, pt2.y);
	MoveTo(pt1.x, pt1.y);
	LineTo(pt2.x, pt2.y);
END;
RUN(Example);



  GetPtL3D User Interactive 
Vectorworks 2010

VectorScript Declaration:

PROCEDURE   GetPtL3D
(   p1X :REAL;
    p1Y :REAL;
    p1Z :REAL;
  VAR  p2X :REAL;
  VAR  p2Y :REAL;
  VAR  p2Z :REAL;
    useWPOnly :BOOLEAN
) ;

Python:

def  vs.GetPtL3D(p1, useWPOnly):
   return p2

Description:

Procedure GetPtL3D creates a temporary "rubberband" 3D line from a specified point to the user selected end point. This cannot be used if there is a function anywhere in the calling chain.

Parameters:

p1 Coordinates of line start point.
p2 Returns coordinates of mouse click.
useWPOnly TRUE if the returned point have to be on the active Working Plane. Snapping to arbitrary 3D geometry will produce vertical projection result on the WP; FALSE if the point can be arbitrary 3D point (produced, for example, by snapping to a 3D geometry)

See Also:

GetPt   GetPtL   GetLine   GetRect   GetPt3D   GetPtL3D   GetLine3D   GetRect3D  



  GetRect User Interactive 
MiniCAD

VectorScript Declaration:

PROCEDURE   GetRect
( VAR  p1X :REAL;
  VAR  p1Y :REAL;
  VAR  p2X :REAL;
  VAR  p2Y :REAL
) ;

Python:

def  vs.GetRect():
   return (p1, p2)

Description:

Procedure GetRect draws a temporary "rubberband" rectangle onscreen, similar to a selection marquee. The user defines the rectangle by selecting two points which define the top left and bottom right of the rectangle. This cannot be used if there is a function anywhere in the calling chain.

Parameters:

p1 Returns coordinates of first user click.
p2 Returns coordinates of second user click.



  GetRect3D User Interactive 
Vectorworks 2010

VectorScript Declaration:

PROCEDURE   GetRect3D
( VAR  p1X :REAL;
  VAR  p1Y :REAL;
  VAR  p1Z :REAL;
  VAR  p2X :REAL;
  VAR  p2Y :REAL;
  VAR  p2Z :REAL;
    useWP :BOOLEAN
) ;

Python:

def  vs.GetRect3D(useWP):
   return (p1, p2)

Description:

Procedure GetRect3D draws a temporary "rubberband" 3D rectangle on the working plane. The user defines the rectangle by selecting two points which define the top left and bottom right of the rectangle. This cannot be used if there is a function anywhere in the calling chain.

Parameters:

p1 Returns coordinates of first user click.
p2 Returns coordinates of second user click.
useWP TRUE if the returned point have to be on the active Working Plane. Snapping to arbitrary 3D geometry will produce vertical projection result on the WP; FALSE if the point can be arbitrary 3D point (produced, for example, by snapping to a 3D geometry)

See Also:

GetPt   GetPtL   GetLine   GetRect   GetPt3D   GetPtL3D   GetLine3D   GetRect3D  



  KeyDown User Interactive 
MiniCAD

VectorScript Declaration:

FUNCTION   KeyDown
VAR asciiCode:LONGINT ) :BOOLEAN ;

Python:

def  vs.KeyDown():
   return (BOOLEAN, asciiCode)

Description:

Function KeyDown returns TRUE if a non-modifier keyboard character has been depressed. When TRUE is returned, the ASCII code of the character is returned.

Modifier keys are the Caps Lock, Command, Control, Option, and Shift keys.

Parameters:

asciiCode ASCII code of key pressed.

Example:

WHILE NOT KeyDown(keyHit) DO
BEGIN
     SysBeep;
     SysBeep;
END;
Message('The key pressed was ',keyHit);
{an annoying example of one use of the KeyDown function}



  MouseDown User Interactive 
MiniCAD

VectorScript Declaration:

FUNCTION   MouseDown
( VAR  pX :REAL;
  VAR  pY :REAL
) :BOOLEAN ;

Python:

def  vs.MouseDown():
   return (BOOLEAN, p)

Description:

Function MouseDown returns TRUE if a mouse down event has occurred within the active document window.

Parameters:

p Returns coordinates of mouse click.

Example:

REPEAT
UNTIL MouseDown(x1,y1);
REPEAT
UNTIL MouseDown(x2,y2);
MoveTo(x1,y1);
LineTo(x2,y2);



  Option User Interactive 
MiniCAD

VectorScript Declaration:

FUNCTION   Option
:BOOLEAN ;

Python:

def  vs.Option():
   return BOOLEAN

Description:

Option return TRUE if the Option key (Mac) or Alt key (Windows) was depressed during the last user event. This function operates with the MouseDown, KeyDown, AutoKey, GetPt, GetPtL, GetLine, and GetRect calls.

See Also:

MouseDown   KeyDown   AutoKey  



  RunTempTool User Interactive 
Vectorworks 2010

VectorScript Declaration:

PROCEDURE   RunTempTool
(   toolCallback :PROCEDURE;
    initialScroll :BOOLEAN
) ;

Python:

def  vs.RunTempTool(toolCallback, initialScroll):
   return None

Description:

Runs a temp tool. The call waits until the tool has finished. The callback function is notified for the tool events.

Parameters:

toolCallback Procedure that will be called with the tool events.
FUNCTION ToolCallback(action, msg1, msg2 : INTEGER) : INTEGER;
initialScroll For experts. Pass FALSE if you want a simple temp tool. Setting it to TRUE will add one extra point (0,0) before the tool runs. This will make the tool scroll before the first click. This means that your tool handler must recognize and skip that extra fir

Example:

PROCEDURE Test;
VAR
    pt1, pt2 : POINT;

    FUNCTION TempToolCallback(action, msg1, msg2 : LONGINT) : LONGINT;
    VAR pt : POINT;
    BEGIN
         TempToolCallback := 0;
         CASE action OF
             3: BEGIN {kOnToolDoSetupEventID}
		             vstSetHelpString ( 'Just click once.' );
             END;

             103 : BEGIN {kToolDrawEventID}
                 vstGetCurrPt2D( pt.x, pt.y );
                 vstDrawCoordLine( pt.x, pt.y, pt1.x, pt1.y );
                 vstDrawCoordLine( pt.x, pt.y, pt2.x, pt2.y );
             END;
         END;
    END;

BEGIN
    pt1.x := 0; pt1.y := 0;
    pt2.x := 100mm; pt2.y := 100mm;
    RunTempTool( TempToolCallback, FALSE );
END;
RUN( Test );



  SetCursor User Interactive 
MiniCAD

VectorScript Declaration:

PROCEDURE   SetCursor
( cursor:INTEGER ) ;

Python:

def  vs.SetCursor(cursor):
   return None

Description:

Procedure SetCursor changes the appearance of the screen cursor.

Table - Cursor Styles

Cursor Style Style Flag
Large Cross LgCrossC
Small Cross SmCrossC
Watch WatchC
Text Bar TextBarC
Arrow ArrowC
Hand HandC

Parameters:

cursor Cursor style setting.

Example:

SetCursor(LgCrossC);



  SetModeButtonText User Interactive 
Vectorworks 2013

VectorScript Declaration:

PROCEDURE   SetModeButtonText
(   modeName :STRING;
    modeType :INTEGER
) ;

Python:

def  vs.SetModeButtonText(modeName, modeType):
   return None

Description:

Sets a mode bar button help text.

Parameters:

modeName The name of the mode.
modeType The type of the mode. Types: RadioMode = 0, ButtonMode = 1, PrefButtonMode = 2, CheckMode = 3, EditTextMode = 4, PullDownMode = 5

Example:

BeginModeButtonsText;
SetModeButtonText( 'Mode1', 1 );
SetModeButtonText( 'Mode2', 0 );
EndModeButtonsText;

See Also:

BeginModeButtonsText   EndModeButtonsText  



  SetTempToolHelpStr User Interactive 
Vectorworks 2010

VectorScript Declaration:

PROCEDURE   SetTempToolHelpStr
( helpString:STRING ) ;

Python:

def  vs.SetTempToolHelpStr(helpString):
   return None

Description:

Sets a text to be used as help string for temp tool calls: RunTempTool, TrackObject, GetPt, GetPtL, GetPt3D, and GetPtL3D.

This function should be called prior to calling the tool.

The help string will be used for subsequent temp tool runs until changed.

Parameters:

helpString The help string for the next temp tool.

Example:

PROCEDURE Test;
VAR h : HANDLE;
  
  FUNCTION CheckObjCallback(h : HANDLE) : BOOLEAN;
  BEGIN
     {any object is ok}
     CheckObjCallback := true;
  END;

BEGIN
SetTempToolHelpStr( 'Select any object' );
TrackObject( CheckObjCallback, h );
SetSelect( h );
END;
RUN( Test );



  SetToolHelpMessage User Interactive 
Vectorworks 2013

VectorScript Declaration:

PROCEDURE   SetToolHelpMessage
(   modeText :STRING;
    descriptionText :STRING
) ;

Python:

def  vs.SetToolHelpMessage(modeText, descriptionText):
   return None

Description:

Sets the Tool Bar Help Text by new standard - Tool Name[: Tool Mode][. Brief usage advice.].

Parameters:

modeText The text that will be showed like as a name of the mode.
descriptionText The text that will be showed like as an advice text.



  Shift User Interactive 
MiniCAD

VectorScript Declaration:

FUNCTION   Shift
:BOOLEAN ;

Python:

def  vs.Shift():
   return BOOLEAN

Description:

Shift returns TRUE if the Shift key was depressed during the last user event. This function operates with the MouseDown, KeyDown, AutoKey, GetPt, GetPtL, GetLine, and GetRect calls.



  TrackObject User Interactive 
Vectorworks 2010

VectorScript Declaration:

PROCEDURE   TrackObject
(   callback :PROCEDURE;
  VAR  outObj :HANDLE;
  VAR  pX :REAL;
  VAR  pY :REAL;
  VAR  pZ :REAL
) ;

Python:

def  vs.TrackObject(callback):
   return (outObj, p)

Description:

Interactively, including highlighting, allows the user to select one object meeting the specified criteria.

The callback function (any of these depending on what info is needed):

FUNCTION Callback(h : HANDLE): BOOLEAN;
FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;
FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;

is used to let the user filter the object that can be returned from the function.

The parameteri px,py,pz pass into the function information about current cursor position in document units.

This callback function is called when tracking over an object; also when click happens over an object.

The callback function return true if the passed handle can be returned.

Parameters:

callback The callback that will be called to check if an object meets the requrements to be tracked. See remarks.
outObj Returns handle of the object for which the callback returned TRUE.
p Returns coordinates of mouse click.

Example:

PROCEDURE Test;
VAR
  h : HANDLE;
  x, y, z : REAL;
  
  FUNCTION CheckObjCallback(h : HANDLE) : BOOLEAN;
  {or FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;}
  {or FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;}
  BEGIN
     {any object is ok}
     CheckObjCallback := true;
  END;

BEGIN
	TrackObject( CheckObjCallback, h, x, y, z );
	SetSelect( h );
END;
RUN( Test );



  TrackObjectN User Interactive 
Vectorworks 2014

VectorScript Declaration:

PROCEDURE   TrackObjectN
(   traverseType :INTEGER;
    callback :PROCEDURE;
  VAR  outObj :HANDLE;
  VAR  pX :REAL;
  VAR  pY :REAL;
  VAR  pZ :REAL
) ;

Python:

def  vs.TrackObjectN(traverseType, callback):
   return (outObj, p)

Description:

Interactively, including highlighting, allows the user to select one object meeting the specified criteria.

The callback function (any of these depending on what info is needed):

FUNCTION Callback(h : HANDLE): BOOLEAN;
FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;
FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;

is used to let the user filter the object that can be returned from the function.

The parameteri px,py,pz pass into the function information about current cursor position in document units.

This callback function is called when tracking over an object; also when click happens over an object.

The callback function return true if the passed handle can be returned.

Parameters:

traverseType Specify how to traverse the drawing. 0 - traverses only the high-level objects (the same as the TrakcObject function); 1 - traverses the objects deep (uses GetPickObjectInfo, the 'subH' parameter). 2 - traverses the objects shallow (uses GetPickObjectInfo
callback The callback that will be called to check if an object meets the requrements to be tracked. See remarks.
outObj Returns handle of the object for which the callback returned TRUE.
p Returns coordinates of mouse click.

Example:

PROCEDURE Test;
VAR
  h : HANDLE;
  x, y, z : REAL;
  
  FUNCTION CheckObjCallback(h : HANDLE) : BOOLEAN;
  {or FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;}
  {or FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;}
  BEGIN
     {any object is ok}
     CheckObjCallback := true;
  END;

BEGIN
	TrackObjectN( 0, CheckObjCallback, h, x, y, z );
	SetSelect( h );
END;
RUN( Test );

See Also:

TrackObject   GetPickObjectInfo