revit_execute_python
Run Python code inside Autodesk Revit on the UI thread to automate model tasks, query documents, and store results. Wrap modifications in a Transaction.
Instructions
Executes arbitrary Python code inside Autodesk Revit on the main UI thread.
Provides:
doc: Active Revit Document
uidoc: Active UIDocument
uiapp: UIApplication
app: Application
response_data: Dict to store return values (e.g. response_data['my_key'] = ...)
Always wrap model modifications in a Transaction: t = Transaction(doc, 'Action Name') t.Start() ... t.Commit()
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| port | No | ||
| doc_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |