Running scripts

Document scripts can be executed in a variety of ways.

Running scripts from the Resource Manager

From the Resource Manager, right-click on the script resource, and select Run from the context menu.

Alternatively, double-click on the script resource or drag the script resource into the drawing area.

Running scripts from the script palette

To run a script from a script palette:

Open the script palette that contains the script to run. Do one of the following:

Select Window > Script Palettes and select the script palette containing the desired script.

From the Resource Manager, select Scripts from the list of resource types on the tool bar. Right-click on the palette in the resource viewer pane, and select Open from the context menu.

The script palette opens.

From the script palette, double-click the script to run it.

Running scripts from files

Some scripts may exist as text files only, if they were created in a separate text editor program or exported from the Vectorworks program. These scripts are not available from the Resource Manager.

Select Tools > Plug-ins > Run Script (or File > Import > Import Script).

The Choose Script File (or Import Script Drawing Document) dialog box opens.

Select the desired script file and click Open to run the script.

Running scripts from worksheets

Often data for objects that you might want to report in a worksheet is not accessible with a worksheet formula. For example, landscape area objects contain planting rates and percentages for multiple plant types, but the information is stored internally. You could create a script to extract the planting rates for each plant type in an area, and then run the script from a worksheet using the DataBaseByScript (or the RunScript) function. When the function is used in a database header cell, the script returns values for each object that meets the specified criteria.

When running a script from a worksheet, you are prompted to confirm that you wish to run the script.

If the Vectorworks Landmark product is installed, several Python scripts are provided in the default content:

[Vectorworks]\Libraries\Defaults\Reports_Schedules\Landmark Schedules

Use these scripts as they are, or use them as samples to create your own scripts. To see examples of these scripts in a worksheet, select Tools > Reports > Create Report, and open the preformatted schedule Landscape Area-Mass Planting.

For more information about extracting data from drawing objects, see Worksheet functions.

If the Vectorworks Landmark product is not installed, samples and an article on this topic are provided in the developer-oriented documentation here:

developer.vectorworks.net 

Script errors

If an error occurs during script execution, an alert dialog box opens.

To handle script errors:

From the alert dialog box, click View Error Output.

The Script Errors dialog box opens, displaying the nature of the error and the line where the error occurred.

To edit the script, click Edit Script, or double-click a script line to edit that line. The Script Editor opens for making corrections to the script.

Creating and editing script palettes and scripts

Resource Manager

Using scripts

 

Was this page helpful?