Data Formatting with Write and WriteLn
Directives in VectorScript
Table - SetTool/CallTool Identifiers
Table - GetPref/SetPref Constant Values
Table - GetPref/SetPrefInt Constant Values
Table - GetFolderPath Constant Values
Table - Field Data Type Constant Values
Table - Field Display Style Constant Values
Table - Dimension Procedure Parameter Constants
VectorWorks Color Table
VectorWorks Fill Patterns
Table - DoMenuTextByName Constants
Data Formatting with Write and WriteLn
Each parameter in a Write or WriteLn parameter list may be formatted for output as follows :
where the fields MinWidth and DecPlaces are optional.
MinWidth specifies the minimum overall field width, or number of characters, in the data value. Its value must be greater than or equal to zero.
If MinWidth is less than the overall width of the value, VectorWorks overrides the MinWidth so that the entire value is displayed(see also DecPlaces below). If MinWidth is greater than the overall length of the value, blank spaces will be appended to the beginning of the value.
For data of type REAL, DecPlaces allows control over the display of the number of decimal places in the value. DecPlaces works independently of the MinWidth format specifier.
If DecPlaces for a value is set to 2, two decimal places of accuracy will always be shown, overriding the MinWidth specifier if necessary. If the number of decimal places in the value exceeds the number of decimal places specified, the value will be rounded. For values other than REAL, DecPlaces will generate an error.
Example - INTEGER Values
theInt:=23456; Write(theInt:3);will write '23456' to the file.
theInt:=23456; Write(theInt:7);will write ' 23456' to the file.
 
Example - REAL Values
theReal:=789.128; Write(theReal:6:2);will write '789.13' to the file.
theReal:=789.128; Write(theReal:2:6);will write '789.128000' to the file.
theReal:=789.128; Write(theReal:6:4);will write '789.1280' to the file.
 
Example - STRING Values
theString:='This is a sample string'; Write(theString:7);will write 'This is' to the file.
theString:='This is a sample string'; Write(theString:25);will write ' This is a sample string' to the file.
Write('Blah,blah,blah':9);will write 'Blah,blah' to the file.
Write('Blah,blah,blah':16);will write ' Blah,blah,blah' to the file.
VectorWorks now includes a new directives capability allowing developers to control and test the syntax level of their code.
As VectorScript is improved and adds new functionality, retiring obsolete behavior and features becomes difficult due to the impact on existing scripts. This makes it very difficult to modernize the language.
VectorWorks 8 adds two directives which allow the VectorScript developer to specify the syntax level of their scripts. These directives provide a stricter interpretation of allowable syntax and available functionality when included in your scripts, as they specifically ask the VectorScript compiler to disallow obsolete syntax.
The two new directives are:
{$NAMES versionnumber} {$STRICT versionnumber}The $NAMES directive specifies which identifier names are to be supported by VectorScript. Identifier names include procedure, function, and variable names.
The $STRICT directive specifies the version of syntax and semantic rules which will be supported by VectorScript.
For example:
{$NAMES 8} - Allow only preferred identifier names for VectorWorks 8 {$NAMES 9} - Allow only preferred identifier names for VectorWorks 9 {$STRICT 8} - Allow only preferred syntactic & semantic rules for VectorWorks 8 {$STRICT 9} - Allow only preferred syntactic & semantic rules for VectorWorks 9The absence of any directive means compile anything which worked in the previous MiniPascal/VectorScript implementation (aside from bug fixes). If you wish to modernize scripts when using VectorWorks 8, you can activate VectorScript 8 only support by using the following directives at the top of your scripts:
{$STRICT 8} {$NAMES 8}The compiler will then force you to correct any use of outdated or obsolete syntax or functionality.
Example - Usage of Directives
In future versions of VectorWorks, DoMenuText will be obsolete, and will be replaced by DoMenuTextByName, which eliminates menu name conflicts and supports international localization. To provide a smooth transition, VectorWorks 8 continues to support both calls. Using directives, you can isolate instances where DoMenuText occurs, and may break your scripts in future releases. You can then revise your scripts accordingly, and ensure their continued functionality in future releases.
The following example illustrates the effect of directives on your scripts. Create a VectorScript command using the following code:
Procedure DirectiveExampleTest; BEGIN DoMenuText('Classes...'); END; Run(DirectiveExampleTest);
When this command is executed, the Classes dialog will be invoked. Now, add directives to the command, as shown:
{$NAMES 8} {$STRICT 8} Procedure DirectiveExampleTest; BEGIN DoMenuText('Classes...'); END; Run(DirectiveExampleTest);
Re-execute the command with the new directives calls. VectorScript now generates an error indicating that DoMenuText is an invalid identifier name.
In advance of the introduction of future versions of VectorWorks, Diehl Graphsoft now has the option of allowing only support VectorScript scripts which comply with a specific version level, giving you an orderly way to keep your scripts in compliance with changes in VectorScript. This also allows Diehl Graphsoft to provide a smooth transition to new function names and features without being bound to support backward compatibility of obsolete features.
Table - SetTool/CallTool Constants
Zoom/Select Tools | 2D Tools | 3D Tools | |||
Tool | Tool ID | Tool | Tool ID | Tool | Tool ID |
2D Select Cursor | -128 | Text | -200 | View Translate | -300 |
3D Select Cursor | -129 | Line | -201 | 3D View Rotate | -301 |
Pan | -130 | Arc | -200 | Walkthrough | -302 |
Zoom In | -131 | Rectangle | -200 | Flyover | -300 |
Zoom Out | -132 | Polyline | -204 | Translate Working Plane | -304 |
  |   | Oval | -205 | Rotate Working Plane | -305 |
  |   | Fillet | -206 | Set Working Plane | -306 |
  |   | 2D Polygon | -207 | Move Working Plane | -307 |
  |   | Wall | -208 | 3D Reshape | -308 |
  |   | 2D Symbol | -209 | 3D Symbol | -309 |
  |   | Constrained Dims | -210 | Extrude | -310 |
  |   | Unconstrained Dims | -211 | Slab | -311 |
  |   | Radial/Diam Dims | -212 | Align Plane | -312 |
  |   | Angular Dims | -213 | 3D Polygon | -313 |
  |   | 2D Reshape | -214 | 3D Mirror | -314 |
  |   | 2D Rotate | -215 | 3D Rotate | -315 |
  |   | Double Line | -216 | 3D Locus | -316 |
  |   | Round Rectangle | -217 | Create Light | -317 |
  |   | Double Line Polygon | -218 | Round Wall | -318 |
  |   | Chamfer | -219 | Create Sphere | -319 |
  |   | Freehand | -220 | Create Hemisphere | -320 |
  |   | 2D Locus | -221 | Create Cone | -321 |
  |   | 2D Mirror | -222 | Wall Join | -322 |
  |   | Leader Line | -223 | Wall Heal | -323 |
  |   | Rotated Rectangle | -224 | Render Bitmap | -324 |
  |   | Regular Polygon | -225 | Create Cone | -325 |
  |   | Clipping | -226 |   |   |
  |   | Quarter Arc | -227 |   |   |
  |   | Center Mark | -228 |   |   |
  |   | Number Stamp | -229 |   |   |
Table - GetPref/SetPref Constant Values
Preference Item | Constant |
---|---|
Click-Drag Drawing | 0 |
Offset Duplications | 1 |
Full Screen Cursor | 2 |
SmartCursor Cues | 3 |
Floating Datum | 4 |
Snap To Loci | 5 |
Show Rulers | 6 |
Show Scroll Bars | 7 |
No Fill Behind Text | 8 |
Zoom Line Thickness | 9 |
Black and White Only | 10 |
Use Layer Colors | 11 |
Log Time In Program | 12 |
Adjust Flipped Text | 13 |
Show Other Objects While In Groups | 14 |
Adjust Flipped Text | 15 |
Black Background | 16 |
Eight Selection Handles | 17 |
Use Sound | 18 |
Issue Undo Warnings | 19 |
Opaque SmartCursor | 20 |
Stop VectorScript On Warnings | 21 |
Use Left Palette Margin | 22 |
Use Right Palette Margin | 23 |
Save Reminder | 24 |
Table - GetPrefInt/SetPrefInt Constant Values
Preference Item | Constant | Setting | ||||||||
Dimension Slash Units | 50 |
|
||||||||
3D Rotation | 52 | |||||||||
Constrain Angle | 53 | |||||||||
Snap Radius | 54 | in pixels | ||||||||
2D Conversion Resolution | 55 | |||||||||
3D Conversion Resolution | 56 | |||||||||
Maximum Number of Undos | 59 | 0-100 | ||||||||
Save Interval | 60 | in minutes | ||||||||
Display Light Objects | 61 |
|
||||||||
Retain QD3D Model | 62 | 1(never) - 5(always) | ||||||||
Rotated Text Display | 63 |
|
||||||||
Bitmap Display | 64 |
|
||||||||
Dimension Slash Thickness | 65 | 0 - 255 mils | ||||||||
Hidden Line Dash Style | 66 | use dash style index | ||||||||
Hidden Line Shading | 67 | 1(darkest) - 4(lightest) |
Table - GetFolderPath Constant Values
Folder Path | Constant |
---|---|
Application folder | 1 |
Plug-Ins folder | 2 |
Plug-Ins Data folder | 3 |
Workspaces folder | 4 |
Templates folder | 7 |
Standards folder | 8 |
Table - Field Data Type Constant Values
Field Data Type | Constant Flag |
---|---|
Integer | 1 |
Boolean | 2 |
Number-general | 3 |
Text | 4 |
Number-decimal | 5 |
Number-decimal w/ commas | 6 |
Number-scientific | 7 |
Number-fractional | 8 |
Number-dimension | 9 |
Number-angle | 10 |
Number-date/time | 11 |
Table - Field Display Style Constants
Field Data Type | Display Style | Constant |
---|---|---|
Boolean | TRUE | 1 |
  | FALSE | 2 |
Number-decimal | no. decimal places | 0 to 9 |
Number-decimal w/ commas | no. decimal places | 0 to 9 |
Number-scientific | no. decimal places | 0 to 9 |
Number-fractional | rounding value | 2,4,8,16,32, etc. |
Number-angle | degrees | 1 |
  | deg-minutes | 2 |
  | deg-min-seconds | 3 |
Number-date/time | mdy | 1 |
  | mdy hmm | 2 |
  | dmy | 3 |
  | ymd | 4 |
  | ymd hmm | 5 |
  | d-mmm-y | 6 |
  | d-mmm | 7 |
  | mmm-y | 8 |
  | h mm | 9 |
  | h mm s | 10 |
  | h mm(AM/PM) | 11 |
  | h mm s(AM/PM) | 12 |
Table - Dimension Procedure Parameter Constants
LinearDim | ||
---|---|---|
DimType | Description | Constant Value |
Constrained Horizontal | 0 | |
Constrained Vertical | 1 | |
Horizontal Ordinate | 2 | |
Vertical Ordinate | 3 | |
Unconstrained | 4 | |
arroFlag | Description | Constant Value |
Used calculated position | 1 | |
Dim line inside-outside | 2 | |
Start witness ON-OFF | 256 | |
End witness ON-OFF | 512 | |
textFlag | Description | Constant Value |
Used calculated position | 1 | |
Text inside-outside | 2 | |
Text above dim line | 256 | |
Text aligned to dim line | 512 | |
Force text horizontal | 1024 |
CircularDim | ||
---|---|---|
DimType | Description | Constant Value |
Diameter dimension | 0 | |
Other circular dimensions | 1 | |
arroFlag | Description | Constant Value |
Used calculated position | 1 | |
Dim line inside-outside | 2 | |
Start witness ON-OFF | 256 | |
End witness ON-OFF | 512 | |
textFlag | Description | Constant Value |
Used calculated position | 1 | |
Text inside-outside | 2 | |
Text above dim line | 256 | |
Text aligned to dim line | 512 | |
Force text horizontal | 1024 |
AngularDim | ||
---|---|---|
arroFlag | Description | Constant Value |
Used calculated position | 1 | |
Dim line inside-outside | 2 | |
Start witness ON-OFF | 256 | |
End witness ON-OFF | 512 | |
Reference angle | 1024 | |
textFlag | Description | Constant Value |
Used calculated position | 1 | |
Text inside-outside | 2 | |
Text above dim line | 256 | |
Text aligned to dim line | 512 | |
Force text horizontal | 1024 |
The items listed under Menu Items are commands which are internal to the VectorWorks application.
To specify a menu item which is a plug-in, use the name of the item as found in the Plug-ins folder.
For example, to call 'Trim' from the Standard Views chunk, you would use 'Trim Tool'.
Pass 0 as the second parameter when making calls to standard menu items using DoMenuTextByName. Note: At this time, VectorWorks does not support calling of VectorScript plug-ins. Do not use DoMenuTextByName to call .vsm,.vst, or .vso plug-ins. |
Standard Menu Items |
|
Menu Item | DoMenuTextByName Constant |
About VectorWorks... | About Box |
Add Surface | Add Surface |
Align Objects | Align Objects |
Align to Grid | Align to Grid |
VectorWorks Preferences | Application Preferences |
Arc Smoothing | Arc Smoothing |
Arrow Heads... | Arrow Heads |
Bezier Spline Smoothing | Bezier Spline Smoothing |
Classes... | Classes |
Clear | Clear |
Clip Surface | Clip Surface |
Close | Close |
Color Palette... | Color Palette |
Column... | Column |
Combine Into Surface | Combine Into Surface |
Convert Copy to Lines | Convert Copy to Lines |
Convert Copy to Polygons | Convert Copy to Polygons |
Convert to 3D Polys | Convert to 3D Polys |
Convert to Lines | Convert to Lines |
Convert to Mesh | Convert to Mesh |
Convert to Polygons | Convert to Polygons |
Copy | Copy |
Create Layer Link... | Create Layer Link |
Create Plug-in... | Create Plug-in |
Create Report... | Create Report |
Create Symbol... | Create Symbol |
Cubic Spline Smoothing | Cubic Spline Smoothing |
Custom Selection... | Custom Selection |
Custom Tool/Attribute... | Custom Tool/Attribute |
Custom Visibility... | Custom Visibility |
Cut | Cut |
Cut 2D Section | Cut 2D Section |
Cut 3D Section | Cut 3D Section |
Dash Styles... | Dash Styles |
Deselect All | Deselect All |
Document Preferences... | Document Preferences |
Duplicate | Duplicate |
Duplicate Array... | Duplicate Array |
Export Database... | Export Database |
Export DXF/DWG... | Export DXF/DWG |
Export EPSF... | Export EPSF |
Export Image File... | Export Image File |
Export PICT... | Export PICT |
Export QuickDraw 3D... | Export QuickDraw 3D |
Export RenderMan... | Export RenderMan |
Export StrataVision... | Export StrataVision |
Export Text Format... | Export Text Format |
Export WMF... | Export WMF |
Export Worksheet... | Export Worksheet |
Extrude | Extrude |
Extrude... | Extrude And Edit |
Fit to Window | Fit to Window |
Flip Horizontal | Flip Horizontal |
Flip Vertical | Flip Vertical |
Floor... | Floor |
Hatch... | Hatch |
Import DXF/DWG... | Import DXF/DWG |
Import EPSF... | Import EPSF |
Import Image File... | Import Image File |
Import PICT... | Import PICT |
Import PICT as Picture... | Import PICT as Picture |
Import Text Format... | Import Text Format |
Import WMF... | Import WMF |
Import WMF as Picture... | Import WMF as Picture |
Import Worksheet... | Import Worksheet |
Intersect Surface | Intersect Surface |
Layer Scale... | Layer Scale |
Layers... | Layers |
Line Thickness... | Line Thickness |
Link Text to Record | Link Text to Record |
Lock | Lock |
lower case | lower case |
Move 3D... | Move 3D |
Move Working Plane... | Move Working Plane |
Move... | Move |
Multiple Extrude | Multiple Extrude |
Multiple Extrude... | Multiple Extrude And Edit |
New... | New |
Next View | Next View |
No Smoothing | No Smoothing |
Normal Scale | Normal Scale |
Open... | Open |
Page Setup... | Page Setup |
Paste | Paste |
Paste As Picture | Paste As Picture |
Paste In Place | Paste In Place |
Patterns... | Patterns |
Pick Up Attributes | Pick Up Attributes |
Previous View | Previous View |
Print... | |
Properties... | Properties |
Put Down Attributes | Put Down Attributes |
Quit | Quit |
Redo | Redo |
Revert To Saved | Revert To Saved |
Roof Face... | Roof Face |
Rotate 3D View... | Rotate 3D View |
Rotate 3D... | Rotate 3D |
Rotate Left 90 | Rotate Left 90 |
Rotate Right 90 | Rotate Right 90 |
Rotate Working Plane... | Rotate Working Plane |
Rotate... | Rotate |
Save | Save |
Save As Template... | Save As Template |
Save As... | Save As |
Save View... | Save View |
Scale Objects... | Scale Objects |
Select All | Select All |
Send Backward | Send Backward |
Send Forward | Send Forward |
Send to Back | Send to Back |
Send to Front | Send to Front |
Set 3D View... | Set 3D View |
Set Grid... | Set Grid |
Set Layer Ambient... | Set Layer Ambient |
Set Origin... | Set Origin |
Set Print Area... | Set Print Area |
Set Size... | Set Size |
Shallow Symbol to Group | Shallow Symbol to Group |
Sweep | Sweep |
Sweep... | Sweep And Edit |
Symbol to Group | Symbol to Group |
Title Caps | Title Caps |
Trace Bitmap... | Trace Bitmap |
Trim | Trim |
Undo | Undo |
Units... | Units |
Unlock | Unlock |
Unrotate 3D Objects | Unrotate 3D Objects |
UPPER CASE | UPPER CASE |
Wall Framer... | Wall Framer |
Workgroup References... | Workgroup References |
Menu chunks are items which group common functionality or display dynamic
information in a menu. To call a menu chunk item, specify the menu chunk constant
and the index number of the item you wish to call. The index is the position of
the item in the displayed menu chunk listing, in a range of 1 to n.
For example, to call 'Right Isometric' from the Standard Views chunk, you would use an index value of 8. |
Menu Chunks |
|
Menu Chunk | DoMenuTextByName Constant |
Class Options | Class Options |
Windows | Document Windows |
Export As MiniCAD6/7... | Export Previous File Version |
Text font options | Font |
Text size options | Font Size |
Text style options | Font Style |
Group/Ungroup | Group Chunk |
Edit/Exit Group, Top Level | Group Navigation Chunk |
Join | Join Chunk |
Layer Options | Layer Options |
Recent Files | Most Recent Docs Chunk |
Perspective | Perspective Chunk |
Projection | Projection |
Rendering | Render Chunk |
Add/Subtract/Intersect Solids | Solid Operations |
Standard VectorWorks palettes | Standard Palettes Chunk |
Standard Views | Standard Views |
Tablet | Tablet Chunk |
Text alignment options | Text Horizontal Alignment |
Text spacing options | Text Spacing |
Text vertical alignment options | Text Vertical Alignment |
VectorWorks tool palettes | Tool Palettes |
Use Full Screen | Use Full Screen Chunk |
Workspaces | Workspaces |