Execute C# Code
revit_execute_codeCompile and run C# against the live Revit API on Revit's thread to automate model queries or changes, with one undo entry and optional dry-run/confirmation.
Instructions
Compile and run C# against the live Revit API on the Revit thread. Accepts a method body or a public static Script class with Execute(ScriptContext ctx). Auto mode owns one transaction and undo entry; transaction="none" is refused by default. Needs confirm_token from a first call, which runs nothing; dry_run needs none. A long action can return status=running and jobId when the wait budget expires; it may already have changed the model, and revit_jobs returns its result. Resubmitting repeats the action.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| dry_run | No | ||
| document | No | Title or file name substring of the target open document; needed when several are open. | |
| transaction | No | auto | |
| confirm_token | No | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||