Advanced Marionette scripting

Advanced Marionette developers can create custom nodes for use in their own work or to distribute to others. Consult the Developer wiki main page: developer.vectorworks.net for additional information about creating Marionette nodes.

Advanced developers can make use of a variety of Python libraries. During development, you can test various Python library packages to be sure you are using the best one for your script. Available packages are listed on the Developer wiki (for quick access, click Python Library Repository from the Content section of the Marionette preferences); furthermore, you can request specific packages to be uploaded there by Vectorworks.

In your Marionette nodes, you can reference the Python library packages included on the Vectorworks developer page. The proper package for the platform and version you specified is automatically downloaded at the execution of your script by your script users.

Referencing a Python library

To reference a Python library package in your custom Marionette node, the following Marionette.Node constructor syntax specifies the version and package dependencies for the node:

this.CustomNode("CustomNodeName", "OptionalLocalizedName", "OptionalNodeVersionNumber", [('Geopy', '2.2.0'), ('scipy', '1.7.3')])

The bracketed section of the example syntax illustrates how to specify two different Python packages that the node depends upon, along with an optional version number for each. 

If the Python library you need is not included on the Vectorworks server, use the Developer wiki web page described above to email Vectorworks about the package you require. The Marionette team will make the package available from the server. Since the Python dependencies are always present and installed on demand, you can feel confident that your custom node will function properly across releases.

Python library installation

During script execution, if the referenced Python package is already installed, the script executes.

If the Python library package has not already been installed, the script user is given the opportunity to install the package automatically from the Vectorworks servers.

To install required Python library files:

If Marionette detects that a library file needs to be installed from the Vectorworks servers, the Install Python Packages dialog box opens.

The required packages are listed, along with their details. Click Yes to install the packages in a separate PythonExternals folder within the user folder; if the folder does not exist, it is created automatically.

When the installation completes, the Install Details dialog box opens. Click Details to view a text file with the installation results; it shows which packages were installed, where they were installed, and the success of the installation.

Once the required Python library packages have been successfully installed, the script executes.

Manually installing Python libraries

Mode

Tool

Tool set

Preferences

Marionette

Basic

During development, you can manually install certain Python libraries to be sure you're using the best one for the custom node you're writing.

To install a Python library:

Click the tool and mode.

The Marionette Preferences dialog box opens.

Click Python Library Repository from the Content section to see which Python libraries are available from the Vectorworks server.

Click Install Python Library.

The Python Library Location dialog box opens.

Enter the URL for the Python library file to install the library file that is present at that location.

Test the script; if the library file is useful to you and you require it for your custom Marionette development, request it to be added to the Vectorworks server by sending an email to Vectorworks from the Developer wiki site.

To see which library files and packages you have installed, consult the InstallOutput.txt file located within the Python Externals folder in your user folder.

Debugging a Marionette script

Visual scripting with Marionette

 

Was this page helpful?