You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What a run_python script sees, and what it can return.
Globals
Name
vs
The Vectorworks API.
params
The params object passed to run_python, as a dict (empty if none).
vw
vwmcp's helper module (below).
__result__
Assign to return a value. Starts as None.
print() output is returned as stdout, up to 200,000 characters.
Return values
__result__ is converted to JSON:
Python
JSON
None, bool, int, str
as is
float
number; nan and inf become null
dict
object (keys become strings)
list, tuple, set
array
Vectorworks handle
{"handle": "<UUID>"}
anything else
its repr()
Errors
An uncaught exception ends the script. The result reports error (Type: message) and a traceback showing only the script's own frames. Changes made before the exception are not rolled back; use Undo in Vectorworks to remove them.
The vw helpers
Addressing
Function
Returns
vw.uuid(h)
UUID string of a handle, or None.
vw.obj(uuid)
Handle for a UUID, or None.
vw.named(name)
Handle for a named object or resource, or None.
vw.last()
The last object this script created (vs.LNewObj()).
vw.find(criteria, limit=None)
List of handles matching a criteria string. Collected before returning, so it's safe to change them afterwards.