BeginContext Utility 

Declaration:

PROCEDURE   BeginContext
;

Description:

Use this function in conjuction with EndContext to starts logging changes that are made until the EndContext is reached.

See Also:

EndContext  



  ClrMessage Utility 

Declaration:

PROCEDURE   ClrMessage
;

Description:

Procedure ClrMessage closes the message palette.




  ColorIndexToRGB Utility 

Declaration:

PROCEDURE   ColorIndexToRGB
(   color :INTEGER;
  VAR  red :LONGINT;
  VAR  green :LONGINT;
  VAR  blue :LONGINT
) ;

Description:

Procedure ColorIndexToRGB converts the Vectorworks palette colors from the colors' palette position index to its red, green, and blue component values. RGB values are in the range of 0~65535.

A color table listing with associated index values can be found in the Appendix.

Parameters:

color Color index.
red RGB color component value.
green RGB color component value.
blue RGB color component value.

Example:

ColorIndexToRGB(45,r,g,b);
{returns the color value components of the color at position 45}



  Date Utility 

Declaration:

FUNCTION   Date
(   dateFormat :INTEGER;
    infoFormat :INTEGER
) :STRING ;

Description:

Function Date returns a formatted date and time string.

Table - Values for dateFormat parameter:

Date Format Constant
Full Date 0
Abbreviated Date 1
Short Date 2


Table - Values for infoFormat parameter:

Date/Time Constant
Date only 0
Date and Time 1
Time only 2


Parameters:

dateFormat Specify how verbose or compact the resulting string is.
infoFormat Specify if result should contain date, time or both.

Example:

{ All examples are for the date Friday,  }
{ Nov. 18, 1988 and the time 10:42:24 AM }

Date(0,1);
{returns Friday, November 18, 1988 10:42:24 AM}

Date(0,0);
{returns Friday, November 18, 1988}

Date(2,2);
{returns 10:42:24 AM}

Date(2,1);
{returns 11/18/88 10:42:24 AM}



  DisableModules Utility 

Declaration:

PROCEDURE   DisableModules
( modules:LONGINT ) ;

Description:

Disables modules. The modules parameter is a bitfield indicating which modules to disable.

Parameters:

modules This modules parameter is a LONGINT value which contains a bit for each possible product module. If a module is enabled, then the corresponding bit is set to 1. If that module is disabled, then its bit is 0. The table below contains selectors that can be used to interpret the results of this function. To determine if a module is enabled, do a bitwise "and" operation with the selector and the value returned by this function. See the usage example below.

Table - GetEnabledModules Selectors

Module
Selector
Description
Foundation
0
 
Vectorworks general purpose CAD.
RenderWorks
1
 
Advanced rendering features, lighting, textures.
Architect
2
Architectural features including advanced window, door, wall framing, HVAC.
Landmark
4
Site modeling and landscape design module.
Spotlight
8
Theater lighting, set, and scenic design features.
Mechanical
16
Mechanical engineering module for designers and fabricators.
Pro
32
Foundation for European market.
     



  DisplayContextHelpOfCurrentPlugin Utility 

Declaration:

PROCEDURE   DisplayContextHelpOfCurrentPlugin
;

Description:

This function will display the context help of the plug-in that is considered 'current'. This could be a command plug-in that has a dialog open, or a tool plug-in that is active.



  DisplayContextualHelp Utility 

Declaration:

FUNCTION   DisplayContextualHelp
( Identifier:STRING ) :BOOLEAN ;

Description:

Using the identifier string for a GUI element given by the Contextual Help Manager displays the associated contextual help. This could be a WebWorks webpage, a Internet webpage or even a local file.



  DisplayContexualHelp Utility 

Declaration:

FUNCTION   DisplayContexualHelp
( helpIdentifier:STRING ) :BOOLEAN ;

Description:

Displays the help associated with the given contextual help identifier.



  DisplayOrganizationDialog Utility 

Declaration:

PROCEDURE   DisplayOrganizationDialog
( tabToSelect:INTEGER ) ;

Description:

Displays the organization dialog with the specified integer as the initially slected tab.
0: The most recently displayed tab is selected
1: The Classes tab is selected .
2: The Design Layers tab is selected.
3: The Sheet Layers tab is selected.
4: The Viewports tab is selected.
5: The Saved Views tab is selected.

Parameters:

tabToSelect The tab to be initially selected.



  EndContext Utility 

Declaration:

PROCEDURE   EndContext
( acceptOrReject:INTEGER ) ;

Description:

Use this function in conjuction with BeginContext to have VW automatically accept or reject any changes that were made during the Begin/End block.

Parameters:

acceptOrReject Specify 0 to reject changes or 1 to accept changes

See Also:

BeginContext  



  FndError Utility 

Declaration:

FUNCTION   FndError
:BOOLEAN ;

Description:

Function FndError returns whether an error has occurred within a VectorScript subroutine. Provided as a debugging tool, FndError receives notification after execution of every line of code whether an error has occurred.



  ForEachObjectAtPoint Utility 

Declaration:

PROCEDURE   ForEachObjectAtPoint
(   actionFunc :PROCEDURE;
    objOptions :INTEGER;
    travOptions :INTEGER;
    locX :REAL;
    locY :REAL;
    pickRadius :REAL
) ;

Description:

Performs an action for each object at the specified point in the drawing. This call was implemented to get past the practical limitations of PickObject, which only finds the topmost object. This call will find all of the objects at a given point.

"actionFunc" should actually be a function, not a procedure as the declaration indicates.

If the callback function returns FALSE, ForEachObjectAtPoint will not process any more objects at the specified point.

Table - ForEachObjectAtPoint Selectors

Object Options
   
Option
Selector
Description
All objects
0
 
Visible Objects only
1
 
Selected Objects only
2
 
Unlocked objects only
4
 
     
Traversal Options
   
Option
Selector
Description
Traverse Shallow
0
 
Traverse Groups
1
Traverse inside groups

Example:

PROCEDURE Example;
VAR
   gx1, gy1 : REAL;

FUNCTION DoIt(h1 :HANDLE) :BOOLEAN;
BEGIN
   DSelectAll;
   SetSelect(h1);
   Redraw;
   Wait(1);
END;

BEGIN
   GetPt(gx1, gy1);
   ForEachObjectAtPoint(DoIt, 0, 0, gx1, gy1, 5);
END;
RUN(Example);

See Also:

PickObject   GetPickObjectInfo  



  ForEachObjectInLayer Utility 

Declaration:

PROCEDURE   ForEachObjectInLayer
(   actionFunc :PROCEDURE;
    objOptions :INTEGER;
    travOptions :INTEGER;
    layerOptions :INTEGER
) ;

Description:

Traverses through all objects according to specified search options and applies the specified action to each object. The 'actionFunc' procedure should return false to continue with next object, or return true to stop the traversal.

Table - ForEachObjectInLayer Selectors

Object Options
   
Option
Selector
Description
All objects
0
 
Visible Objects only
1
 
Selected Objects only
2
 
Unlocked objects only
4
 
     
Traversal Options
   
Option
Selector
Description
Traverse Shallow
0
 
Traverse Groups
1
Traverse inside groups
Traverse Deep
2
Traverse all containers (walls, extrudes, sweeps, etc)
     
Layer Options
   
Option
Selector
Description
Current layer
0
 
All layers
1
 
Visible layers
2
 
Editable layers
4
 
Snappable layers
8
 

Parameters:

actionFunc Subroutine which performs operation on found objects.
objOptions Object selection option index.
travOptions Search options index.
layerOptions Layer selection option index.

Example:

PROCEDURE Example;

FUNCTION MakeItRed(h :HANDLE) :BOOLEAN;
VAR
	r, g, b :LONGINT;
BEGIN
	ColorIndexToRGB(7, r, g, b);
	SetFillBack(h, r, g, b);
END;
	
BEGIN
	ForEachObjectInLayer(MakeItRed, 2, 0, 4);
END;
RUN(Example);



  ForEachObjectInList Utility 

Declaration:

PROCEDURE   ForEachObjectInList
(   actionFunc :PROCEDURE;
    objOptions :INTEGER;
    travOptions :INTEGER;
    list :HANDLE
) ;

Description:

Processes all items in the specified list and and applies the specified action to each item.

Table - ForEachObjectInList Selectors

Object Options    
Option
Selector
Description
All objects
0
 
Visible Objects only
1
 
Selected Objects only
2
 
Locked objects only
4
 
     
Traversal Options
   
Option
Selector
Description
Traverse Shallow
0
 
Traverse Groups
1
Traverse inside groups
Traverse Deep
2
Traverse all containers (walls, extrudes, sweeps, etc)

Parameters:

actionFunc Subroutine which performs operation on found objects.
objOptions Object selection option index.
travOptions Search options index.
list Handle to first item in list.

Example:

PROCEDURE Example;
CONST
   pioName = 'Complex Window 2';
   parameter = 'MeasureHeight';
   value = 'Head of Window';
   
FUNCTION DoIt(h :HANDLE) :BOOLEAN;
BEGIN
   h := FInSymDef(h);
   SetRField(h, pioName, parameter, value);
END;

BEGIN
    ForEachObjectInList(DoIt, 0, 0, FSymDef);
END;
RUN(Example);



  GetActiveSerialNumber Utility 

Declaration:

FUNCTION   GetActiveSerialNumber
:STRING ;

Description:

Gets the currently active serial number.



  GetArrayDimensions Utility 

Declaration:

PROCEDURE   GetArrayDimensions
(   arrayname :ARRAY;
  VAR  rowStart :INTEGER;
  VAR  rowEnd :INTEGER;
  VAR  columnStart :INTEGER;
  VAR  columnEnd :INTEGER
) ;

Description:

Returns the dimensions of the specified array.

Parameters:

arrayname Name of array.
rowStart Start row value.
rowEnd End row value.
columnStart Start column value.
columnEnd End column value.



  GetClosestPt Utility 

Declaration:

PROCEDURE   GetClosestPt
( VAR  obj :HANDLE;
    ptX :REAL;
    ptY :REAL;
  VAR  index :INTEGER;
  VAR  containedObj :LONGINT
) ;

Description:

Returns the index number of the object closest to the specified location.

The index value will return 0 if no vertex can be determined as closest, and will return -1 if the object does not support GetClosestPt.

For container objects, GetClosestPt has distinct behaviors. For walls, if the closest vertex is
is in a subobject, obj will be set to a handle to the subobject. For symbols and plug-in objects, an index to the sub-object will be returned via parameter containedObj.

GetClosestPt supports only 2D objects.

Parameters:

obj Handle to object.
pt Coordinate location of comparison point.
index Index to vertex.
containedObj Index of sub-object.

Example:

PROCEDURE GetClosestPtExample;
VAR
	obj :HANDLE; 
	ptX, ptY :REAL; 
	index :INTEGER; 
	containedObj :LONGINT;
BEGIN
	GetPt(ptX, ptY);
	obj := PickObject(ptX, ptY);
	GetClosestPt(obj, ptX, ptY, index, containedObj);
	SetPenFore(obj, 65535, 0, 0);
END;
RUN(GetClosestPtExample);



  GetClosestSide Utility 

Declaration:

PROCEDURE   GetClosestSide
(   obj :HANDLE;
    ptX :REAL;
    ptY :REAL;
  VAR  index1 :INTEGER;
  VAR  index2 :INTEGER
) ;

Description:

Returns the indices of the vertices that define the side closest to the specified location.

GetClosestSide supports only 2D objects. If the object is unsupported, -1 will be returned as the index values.

Parameters:

obj Handle to object.
pt Coordinates of location.
index1 Index of first vertex of closest side.
index2 Index of second vertex of closest side.



  GetCurrentMode Utility 

Declaration:

FUNCTION   GetCurrentMode
:INTEGER ;

Description:

Returns the current application protection mode.

Return values:
0 - Mode Not Set
1 - Full Mode
2 - Demo Mode
4 - Education Mode
8 - Student Mode
16 - Viewer Mode
32 - Unlicensed Mode
64 - Banner Mode
128 - Watermark New Files Mode
256 - Print Watermark Mode
512 - Save Educational File Format Mode
1024 - Open Educational File Format Mode
2048 - Vector Script Export Mode
4096 - Beta Serial Number Mode



  GetEnabledModules Utility 

Declaration:

FUNCTION   GetEnabledModules
:LONGINT ;

Description:

Determines which combination of product modules are currently enabled.

This function returns a LONGINT value which contains a bit for each possible product module. If a module is enabled, then the corresponding bit will be set to 1. If that module is disabled, then its bit will be 0. The table below contains selectors that can be used to interpret the results of this function. To determine if a module is enabled, do a bitwise "and" operation with the selector and the value returned by this function. See the usage example below.

Table - GetEnabledModules Selectors

Module
Selector
Description
Foundation
0
 
Vectorworks general purpose CAD.
RenderWorks
1
 
Advanced rendering features, lighting, textures.
Architect
2
Architectural features including advanced window, door, wall framing, HVAC.
Landmark
4
Site modeling and landscape design module.
Spotlight
8
Theater lighting, set, and scenic design features.
Mechanical
16
Mechanical engineering module for designers and fabricators.
Pro
32
Foundation for European market.
     


Result:

A LONGINT bitfield value with a bit for each possible product module.

Example:

PROCEDURE testModules;

{----------------------------------------------------------}
FUNCTION bittest(value, mask :LONGINT) :BOOLEAN; 
VAR 
	bit :INTEGER; 
BEGIN 
	bittest := FALSE; 
	bit := 31;    { 2 ^ 31 is high order bit of a LONGINT argument. }
	WHILE ((bit > -1) & (bittest = false)) DO BEGIN 
		IF value >= (2 ^ bit) THEN BEGIN 
			value := value - (2 ^ bit); 
			IF (2 ^ bit) = mask THEN bittest := TRUE; 
		END; 
		bit := bit - 1; 
	END; 
END; 


{----------------------------------------------------------}
FUNCTION IsModuleEnabled(whichModule :LONGINT) :BOOLEAN; 
VAR 
	enabledModules :LONGINT; 
BEGIN 
	enabledModules := GetEnabledModules; 
	IsModuleEnabled := bittest(enabledModules, whichModule)
END; 


BEGIN
	IF IsModuleEnabled(4) & IsModuleEnabled(1)  THEN BEGIN
		{ Landmark and Renderworks are both enabled. } 
		{ ... }
	END;
END;
RUN(testModules);

See Also:

DisableModules  



  GetOSVersion Utility 

Declaration:

PROCEDURE   GetOSVersion
( VAR  major :LONGINT;
  VAR  minor :LONGINT;
  VAR  incr :LONGINT
) ;

Description:

Returns the version of the current operating system.

Parameters:

major Major revision number
minor Minor revision number
incr Increment revision number

Example:

PROCEDURE ShowVersionInfo;
VAR
	osMajor, osMinor, osIncr :LONGINT;
	vwMajor, vwMinor, vwMaint, platform: INTEGER;
	str :STRING;
BEGIN
	str := '';
	GetOSVersion(osMajor, osMinor, osIncr);
	GetVersion(vwMajor, vwMinor, vwMaint, platform);
	If platform = 1 then BEGIN
		str := Concat(str, 'Platform: Macintosh', chr(13));
		IF osMajor = 0 THEN osMajor := 10;
		str := Concat(str, 'OS Version: ', osMajor, '.', osMinor, '.', osIncr, chr(13));
	end else if platform = 2 then BEGIN
		str := Concat(str, 'Platform: Windows', chr(13));
		IF (osMajor = 4) & (osMinor = 10) THEN str := Concat(str, 'OS Version: 98 SE', chr(13)) ELSE 
		IF (osMajor = 5) & (osMinor =  1) THEN str := Concat(str, 'OS Version: XP',    chr(13)) ELSE 
		str := Concat(str, 'OS Version: ', osMajor, '.', osMinor, '.', osIncr, chr(13));
	END;
	str := Concat(str, 'VW Version: ', vwMajor, '.', vwMinor, '.', vwMaint);
	AlrtDialog(str);
END;
RUN(ShowVersionInfo);



  GetPaletteVisibility Utility 

Declaration:

FUNCTION   GetPaletteVisibility
( paletteName:STRING ) :BOOLEAN ;

Description:

Gets the visibility state of a palette.

Parameters:

paletteName Name of the palette

Result:

Returns true if the palette is visible, false otherwise.

See Also:

SetPaletteVisibility  



  GetPickObjectInfo Utility 

Declaration:

FUNCTION   GetPickObjectInfo
(   pX :REAL;
    pY :REAL;
  VAR  h :HANDLE;
  VAR  subH :HANDLE;
  VAR  message :INTEGER
) :BOOLEAN ;

Description:

Function GetPickObjectInfo returns a handle to an object found at a user selected point.

Parameter subH returns a handle to a sub-selectable object (e.g., a symbol in a wall) if such an object exists. Parameter message is currently unused, and always returns 0.

Parameters:

p Coordinate location to test for object.
h Returns handle to object.
subH Returns handle to sub selectable object.
message Resereved for future use. Specify a dummy INTEGER variable.

Example:

WHILE NOT GetPickObjectInfo(pX,pY,hObject,hSymbol,dummyVar) DO BEGIN
    GetPt(pX,pY);
END;

See Also:

PickObject   ForEachObjectAtPoint  



  GetPlantToolInitialized Utility 

Declaration:

FUNCTION   GetPlantToolInitialized
:BOOLEAN ;

Description:

Returns whether or not the plant tool has been initialized or not.



  GetPlantToolPlacementMode Utility 

Declaration:

FUNCTION   GetPlantToolPlacementMode
:INTEGER ;

Description:

This returns the current placement mode stored in the plant tool



  GetPlantToolPlantName Utility 

Declaration:

FUNCTION   GetPlantToolPlantName
:STRING ;

Description:

Returns the name of the current plant that is stored in the plant tool.



  GetPlantToolSpacing Utility 

Declaration:

FUNCTION   GetPlantToolSpacing
:REAL ;

Description:

This returns the spacing that is currently stored in the plant tool.



  GetProduct Utility 

Declaration:

PROCEDURE   GetProduct
( VAR  product :INTEGER;
  VAR  modules :LONGINT
) ;

Description:

Identifies what NNA products and product packages are available in the current product installation.

Obsolete as of 10. Use GetEnabledModules instead.

Parameters:

product Product index.
modules Package index.

See Also:

GetEnabledModules  



  GetSavedSetting Utility 

Declaration:

FUNCTION   GetSavedSetting
(   category :STRING;
    setting :STRING;
  VAR  value :STRING
) :BOOLEAN ;

Description:

Reads a value from the saved settnigs file. This can be used to remember various user settings between running sessions of Vectorworks. For example, a script may want to remember a dialog's position or a font settings. The saved settings should not be used for critical information, but rather for convenience settings.

If the settings file is lost or damaged the script should revert to a reasonable default value, and typically this would not warrant an alert dialog.

Result:

Returns true is the requested setting is found and read from the saved settings file, false otherwise.



  GetScreen Utility 

Declaration:

PROCEDURE   GetScreen
( VAR  x1 :INTEGER;
  VAR  y1 :INTEGER;
  VAR  x2 :INTEGER;
  VAR  y2 :INTEGER
) ;

Description:

Procedure GetScreen returns the top-left and bottom-right corners of the display screen. These values will change as different sized screens are used. This procedure can be utilized to aid in development of dialog boxes, or as a check of screen size for sizing or displaying custom dialogs.

Parameters:

x1 Returns X coordinate of top left of screen.
y1 Returns Y coordinate of top left of screen.
x2 Returns X coordinate of bottom right of screen.
y2 Returns Y coordinate of bottom right of screen.

Example:

PROCEDURE Example;
VAR 
	x1, y1, x2, y2 :INTEGER;
BEGIN
	GetScreen(x1, y1, x2, y2);
	Message(x1,' ',y1,' ',x2,' ',y2);
END;
RUN(Example);



  GetTickCount Utility 

Declaration:

FUNCTION   GetTickCount
:LONGINT ;

Description:

Returns number of ticks (1/60th second) since system startup.

Example:

PROCEDURE Example;
VAR
	tick1, tick2 :LONGINT;
BEGIN
	tick1 := GetTickCount;
	ForEachObject(ResetObject, (T=86));
	tick2 := GetTickCount;
	Message('Seconds elapsed equals: ', (tick2 - tick1) / 60);
END;
Run(Example);



  GetVersion Utility 

Declaration:

PROCEDURE   GetVersion
( VAR  major :INTEGER;
  VAR  minor :INTEGER;
  VAR  maintenance :INTEGER;
  VAR  platform :INTEGER
) ;

Description:

Returns version information about the Vectorworks application. Parameter major returns the major version number of the application. Parameters minor and maintenance return minor version information. Parameter platform returns the OS platform on which Vectorworks is running (1 = Macintosh, 2 = Windows).

For example:

Vectorworks 8.0.1 running on a Macintosh would return:

major: 8
minor: 0
maintenance: 1
platform: 1

Parameters:

major Returns major version number of application.
minor Returns minor version number of application.
maintenance Returns maintenance version number of application.
platform Returns platform of application.

Example:

PROCEDURE Example;
VAR 
	osMajor, osMinor, osIncr :LONGINT; 
	appMajor, appMinor, appMaint, platform :INTEGER;
	platformStr :STRING;
BEGIN
	GetVersion(appMajor, appMinor, appMaint, platform);
	GetOSVersion(osMajor, osMinor, osIncr);
	IF (platform = 1) 
		THEN platformStr := 'MacOS'
		ELSE platformStr := 'Windows';
	Message('Vectorworks ', appMajor, '.', appMinor, '.', appMaint, ' running on ', platformStr, ' ', osMajor, '.', osMinor, '.', osIncr);
END;
RUN(Example);



  GetWorkingPlane Utility 

Declaration:

PROCEDURE   GetWorkingPlane
( VAR  x :REAL;
  VAR  y :REAL;
  VAR  z :REAL;
  VAR  xRotation :REAL;
  VAR  yRotation :REAL;
  VAR  zRotation :REAL
) ;

Description:

Retrieves the location and orientation of the working plane.

Parameters:

x X-coordinate of the working plane
y Y-coordinate of the working plane
z Z-coordinate of the working plane
xRotation X-coordinate value of the rotation
yRotation Y-coordinate value of the rotation
zRotation Z-coordinate value of the rotation

See Also:

SetWorkingPlane  



  Message Utility 

Declaration:

PROCEDURE   Message
(   z :ANY
) ;

Description:

Procedure Message displays a floating message palette onscreen. Parameters z1 thru zN specify the values to be displayed in the palette. Parameters can be any supported data type or variables.

If Message is called and the palette is already displayed, the value in the palette will be replaced by the new information.

Example:

Message('Hello, world');

Message('The Number of objects was :',theNumber);
{displays a string using the variable value}



  NameUndoEvent Utility 

Declaration:

PROCEDURE   NameUndoEvent
( eventName:STRING ) ;

Description:

Procedure NameUndoEvent names the undo event that is currently being built by VectorScript execution. Parameter eventName is the name of the undo event.

Parameters:

eventName Name of undo event.



  OpenURL Utility 

Declaration:

FUNCTION   OpenURL
( URLname:DYNARRAY[] of CHAR ) :BOOLEAN ;

Description:

Opens a web page or file using the default browser or appropriate application (e.g. Adobe Acrobat). Returns a boolean indicating the success of the operation.

The URL (Uniform Resource Locator) is a pointer to a resource on the World Wide Web. It specifies both the protocol and location of the document to open. For files on the local computer, the URL should begin with file:// protocol specifier. For web pages, the URL should begin with http://. The URL should use forward slashes / to separate parts of the path.

There are some platform differences to be aware of. Windows will accept either \ or / as the path separators. MacOS X requires that file:// URLs begin with /Volumes/ before the drive name. Also, currently the MacOS X implementation of OpenURL does not accept spaces in the URL. Spaces should be replaced with the escape code %20 before calling this function.

Note: The function GetFolderPath returns a string with separators specific for the platform it is running on (: on Mac and \ on Windows). If your script calls this function to assemble a local file:// URL then you will have to replace the : separators with / characters.

Parameters:

URLname The Uniform Resource Locator for the web page or file to open.

Example:

{ Open a webpage. }
	status := OpenURL('http://www.nemetschek.net');

	{ Open an HTML file on MacOS X. }
	status := OpenURL('file:///Volumes/MyMacXHD/Documents/My%20Files/Test.html');
	
	{ Open a PDF file in Acrobat on MacOS X. }
	status := OpenURL('file:///Volumes/MyMacXHD/Documents/My%20Files/VSLG11.pdf');

	{ Open a PDF file in Acrobat on MacOS 9. }
	status := OpenURL('file:///MyMac9HD/My Files/VSLG11.pdf');
	
	{ Open a PDF file in Acrobat on Windows. }
	status := OpenURL('file:///C:/My Files/VSLG11.pdf';
	



  PickObject Utility 

Declaration:

FUNCTION   PickObject
(   pX :REAL;
    pY :REAL
) :HANDLE ;

Description:

Function PickObject returns a handle to an object in the document. The function receives a coordinate location, specified by parameter p, and checks this location for the presence of an object. If an object exists at the location, the function returns a handle to the object.

Parameters:

p Coordinate location to test for object.

Example:

FUNCTION UserObjectPick :HANDLE;
VAR 
	x, y :REAL;
BEGIN
	GetPt(x, y);
	UserObjectPick := PickObject(x, y);
END;

See Also:

GetPickObjectInfo   ForEachObjectAtPoint  



  PrepRelatedObjectForChange Utility 

Declaration:

PROCEDURE   PrepRelatedObjectForChange
( objectAboutToBeChange:HANDLE ) ;

Description:

Prepares some other related object for a change thats about to occur.

Parameters:

objectAboutToBeChange The object to be prepared for a change



  ReDraw Utility 

Declaration:

PROCEDURE   ReDraw
;

Description:

Procedure ReDraw invokes a screen redraw of newly created objects in the active Vectorworks document. If new objects are to be manipulated using procedures which operate on selected objects, a call to ReDraw should precede the selected object routines to ensure that all new objects are correctly identified.




  ReDrawAll Utility 

Declaration:

PROCEDURE   ReDrawAll
;

Description:

Procedure ReDrawAll invokes a full screen redraw of the active Vectorworks document. ReDrawAll is used when the document view needs to be refreshed prior to additional operation being performed in the document.




  ResetObject Utility 

Declaration:

PROCEDURE   ResetObject
( objectHandle:HANDLE ) ;

Description:

Update the specified object using the current settings and parameter values. This will reset the bounding box of the object. If the object is in a wall, then the wall is reset also.

An object of any type may be passed to this function to have its boundary reset. The following object types will be reset in a way that is appropriate for each type: Plug-in Object, Symbol Definition, Wall, Roof Container, Bitmap, Picture, Dimension, Extrude, Multiple Extrude, Sweep, Polygon, Polyline, Worksheet.

Parameters:

objectHandle Handle to the object to be reset.



  RGBToColorIndex Utility 

Declaration:

PROCEDURE   RGBToColorIndex
(   red :LONGINT;
    green :LONGINT;
    blue :LONGINT;
  VAR  color :INTEGER
) ;

Description:

Procedure RGBToColorIndex converts the Vectorworks palette colors from its' red, green, and blue component values to the colors' palette position index. Parameters red, green, and blue return the color components of the swatch, and parameter color is the palette position ID of the color swatch. RGB values are in the range of 0~65535.

A color table listing with associated index values can be found in the Appendix.

Parameters:

red RGB color component value.
green RGB color component value.
blue RGB color component value.
color Color index.

Example:

PROCEDURE Example;
VAR
	red, green, blue :LONGINT;
	colorIndex :INTEGER;
BEGIN
	GetPenFore(FSActLayer, red, green, blue);
	RGBToColorIndex(red, green, blue, colorIndex);
	Message(colorIndex);
END;
RUN(Example);



  SetCurrentObject Utility 

Declaration:

PROCEDURE   SetCurrentObject
( h:HANDLE ) ;

Description:

Procedure SetCurrentObject sets the referenced object to be the current object of the document. The current object is defined as the last object created, and can be referenced by LNewObj.

Parameters:

h Handle to object.



  SetDrawingRect Utility 

Declaration:

PROCEDURE   SetDrawingRect
(   paperWidth :REAL;
    paperHeight :REAL
) ;

Description:

Sets the size of the drawing rectangle.

Parameters:

paperWidth The width of the drawing rectangle
paperHeight The height of the drawing rectangle



  SetMaximumUndoEvents Utility 

Declaration:

PROCEDURE   SetMaximumUndoEvents
( events:INTEGER ) ;

Description:

Procedure SetMaximumUndoEvents sets the maximum number of undo events that can be stored in the undo table. Parameter events specifies the number of undos. Setting this value to zero effectively turns off undo.

Parameters:

events Number of undo events to store.



  SetPaletteVisibility Utility 

Declaration:

PROCEDURE   SetPaletteVisibility
(   paletteName :STRING;
    vis :BOOLEAN
) ;

Description:

Sets the visibility state of a palette.

Parameters:

paletteName Name of the palette
vis True if the palette should be visible, false otherwise

See Also:

GetPaletteVisibility  



  SetSavedSetting Utility 

Declaration:

PROCEDURE   SetSavedSetting
(   category :STRING;
    setting :STRING;
    value :STRING
) ;

Description:

Writes a value to the saved settings file. This can be used to remember various user settings between running sessions of Vectorworks. For example, a script may want to remember a dialog's position or a font settings. The saved settings should not be used for critical information, but rather for convenience settings.



  SetWorkingPlane Utility 

Declaration:

PROCEDURE   SetWorkingPlane
(   x :REAL;
    y :REAL;
    z :REAL;
    xRotation :REAL;
    yRotation :REAL;
    zRotation :REAL
) ;

Description:

Sets the x, y, and z offset of the working plane as well as the x-, y-, and z-plane rotational values.

Parameters:

x X-coordinate of the working plane
y Y-coordinate of the working plane
z Z-coordinate of the working plane
xRotation X-coordinate of the rotation
yRotation Y-coordinate of the rotation
zRotation Z-coordinate of the rotation

See Also:

GetWorkingPlane  



  SortArray Utility 

Declaration:

PROCEDURE   SortArray
( VAR  arraytosort :ARRAY;
    numtosort :INTEGER;
    fieldnumber :INTEGER
) ;

Description:

Sorts a 1-dimension array into ascending order. If the array contains handles to records, the array can be sorted by the specified field number index. If the array is an array of structures, the fieldnumber argument denotes the element in the structure on which to sort.



  SysBeep Utility 

Declaration:

PROCEDURE   SysBeep
;

Description:

Procedure SysBeep uses the current system prompt sound to alert the user.




  UndoOff Utility 

Declaration:

PROCEDURE   UndoOff
;

Description:

Procedure UndoOff clears the undo table and suspends undo for the remainder of the VectorScript procedure. The undo system resumes after the procedure is completed.



  ValidAngStr Utility 

Declaration:

FUNCTION   ValidAngStr
(   str :STRING;
  VAR  value :REAL
) :BOOLEAN ;

Description:

Function ValidAngStr returns TRUE if the specified value can be converted into a numeric angle value. If TRUE, the value (in decimal degrees) of the string is returned.

Parameters:

str String value to be checked for angle validity.
value Returns numeric angle value converted from input string.

Result:

Returns TRUE if the specified string can be converted into a angle value.

Example:

PROCEDURE Example;
VAR
	str :STRING;
	value :REAL;
BEGIN
	str := StrDialog('Enter the angle:', 'N10E');
	IF ValidAngStr(str, value) THEN Message(value);
END;
RUN(Example);



  ValidNumStr Utility 

Declaration:

FUNCTION   ValidNumStr
(   str :STRING;
  VAR  value :REAL
) :BOOLEAN ;

Description:

Function ValidNumStr returns TRUE if the specified string can be converted into a numeric value. If TRUE, the numeric value is returned.

Parameters:

str String value to be checked for numeric validity.
value Numeric value converted from input string.

Result:

Returns TRUE if specified string can be converted into a numeric value.

Example:

CASE Item OF
{// OK Button //}
1:BEGIN
  IF ValidNumStr(GetField(4),value) THEN BEGIN
    Done:=TRUE;
    replaceValue:= GetField(6);
					
    IF ItemSel(9) THEN textMode:=2;
    IF ItemSel(10) THEN textMode:=4;
    IF ItemSel(11) THEN textMode:=8;
    IF ItemSel(12) THEN layerMode:=16;
    IF ItemSel(13) THEN layerMode:=32;
    IF ItemSel(14) THEN caseMode:=1;
  END
  ELSE SysBeep;
END;



  VerifyLibraryRoutine Utility 

Declaration:

FUNCTION   VerifyLibraryRoutine
( routineName:STRING ) :BOOLEAN ;

Description:

Verifies that a procedure or function call located in a VectorScript extension is registered and available for use in scripts.

Call this function prior to using any call located in a VectorScript extension to ensure successful use of the call in a script.

(A VectorScript extension is also known as an SDK Plug-in Library. It is a plug-in that is developed using the Vectorworks SDK and the C++ language. When installed in the Plug-ins folder it provides functions that may be called from VectorScript. The VerifyLibraryRoutine function allows the script to determine if the function is available.)

Parameters:

routineName Name of function call to be verified.

Result:

Returns TRUE if the call is available, otherwise returns FALSE.



  Wait Utility 

Declaration:

PROCEDURE   Wait
( seconds:INTEGER ) ;

Description:

Procedure Wait delays execution in VectorScript for a specified number of seconds.

When paused, a VectorScript routine stops at the point where Wait is encountered.

Parameters:

seconds Number of seconds to pause script execution.

Example:

Wait(3);
{pauses execution for 3 seconds}