Running Scripts

Document scripts can be executed in a variety of ways.

Running Scripts from the Resource Manager

From the Resource Manager, right-click (Windows) or Ctrl-click (Mac) 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:

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

  2.     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 (Windows) or Ctrl-click (Mac) on the palette in the resource viewer pane, and select Open from the context menu.

    The script palette opens.

  3. 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.

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

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

  3. 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 RunScript function. When the function is used in a database header cell, the script returns values for each object that meets the specified criteria.

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 > Choose Schedule, 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:

  1. From the alert dialog box, click View Error Output.

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

  3. 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?

vectorworks.net