civil3d_execute
Execute custom C# code inside Civil 3D with write access. Run automation scripts to create, modify, or query Civil 3D objects within a committed transaction.
Instructions
Execute C# code in Civil 3D with write access. The code runs inside a committed transaction. Available globals: Document/Doc, CivilDoc/Civil, Database, Transaction/Tr, Editor. Helpers: GetSurfaceByName, GetAlignmentByName, ListSurfaces, ListAlignments, ToRef, ToPoint. All Civil 3D namespaces are auto-imported. Return a value to get results back as JSON. Use civil3d_session for multi-step workflows. Use civil3d_command for native C3D commands.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | C# code to execute. Has access to Document, CivilDoc, Database, Transaction, Editor. Example: var id = TinSurface.Create(Database, "MySurface"); return new { success = true }; | |
| confirmed | No | Set true to confirm destructive operations (erase, delete, purge). Required when policy demands it. | |
| timeoutMs | No | Max execution time in ms (default: 120000). Increase for heavy operations. | |
| description | No | Brief description of what this code does (for logging/audit trail). |