pi-revit 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/AGENTS.md +167 -0
  2. package/CHANGELOG.md +465 -430
  3. package/README.md +604 -548
  4. package/bin/pi-revit.js +9 -9
  5. package/docs/architecture.md +271 -0
  6. package/docs/evaluation.md +434 -0
  7. package/docs/invariants.json +147 -0
  8. package/extensions/pi-revit/completion-monitor.ts +55 -0
  9. package/extensions/pi-revit/contracts.ts +146 -0
  10. package/extensions/pi-revit/discovery.ts +93 -0
  11. package/extensions/pi-revit/index.ts +342 -255
  12. package/extensions/pi-revit/instance-router.ts +86 -86
  13. package/extensions/pi-revit/platform-prompt.ts +40 -0
  14. package/extensions/pi-revit/scope-monitor.ts +114 -0
  15. package/extensions/pi-revit/script-library.ts +144 -144
  16. package/extensions/pi-revit/tool-catalog.ts +113 -14
  17. package/extensions/pi-revit/tool-documentation.ts +72 -0
  18. package/extensions/pi-revit/tool-schema.ts +8 -0
  19. package/package.json +8 -2
  20. package/scripts/build.ps1 +9 -9
  21. package/scripts/check-sdk.ps1 +66 -66
  22. package/scripts/check-tool-documentation.mjs +287 -0
  23. package/scripts/deploy.ps1 +16 -16
  24. package/scripts/generate-contracts.mjs +80 -0
  25. package/scripts/lib/platform.mjs +226 -0
  26. package/scripts/test-extension.mjs +15 -0
  27. package/skills/pi-revit/SKILL.md +30 -218
  28. package/skills/pi-revit/contracts.generated.json +3524 -0
  29. package/skills/pi-revit/references/execution-rules.md +41 -0
  30. package/skills/pi-revit/references/model-audit-export.md +38 -27
  31. package/skills/pi-revit/references/operation-recovery.md +33 -0
  32. package/skills/pi-revit/references/room-documentation.md +37 -26
  33. package/skills/pi-revit/references/tool-index.md +89 -0
  34. package/skills/pi-revit/references/tools/capture_view.md +62 -0
  35. package/skills/pi-revit/references/tools/change_element_types.md +65 -0
  36. package/skills/pi-revit/references/tools/create_tags.md +85 -0
  37. package/skills/pi-revit/references/tools/delete_elements.md +66 -0
  38. package/skills/pi-revit/references/tools/execute_csharp.md +81 -0
  39. package/skills/pi-revit/references/tools/export_documents.md +75 -0
  40. package/skills/pi-revit/references/tools/find_revit_tools.md +96 -0
  41. package/skills/pi-revit/references/tools/get_element_details.md +66 -0
  42. package/skills/pi-revit/references/tools/get_element_relationships.md +61 -0
  43. package/skills/pi-revit/references/tools/get_element_types.md +67 -0
  44. package/skills/pi-revit/references/tools/get_elements.md +87 -0
  45. package/skills/pi-revit/references/tools/get_linked_elements.md +79 -0
  46. package/skills/pi-revit/references/tools/get_linked_models.md +57 -0
  47. package/skills/pi-revit/references/tools/get_model_coordinates.md +64 -0
  48. package/skills/pi-revit/references/tools/get_model_health.md +53 -0
  49. package/skills/pi-revit/references/tools/get_model_overview.md +57 -0
  50. package/skills/pi-revit/references/tools/get_revit_operation.md +54 -0
  51. package/skills/pi-revit/references/tools/get_schedule_fields.md +62 -0
  52. package/skills/pi-revit/references/tools/get_schedules.md +71 -0
  53. package/skills/pi-revit/references/tools/manage_element_sets.md +92 -0
  54. package/skills/pi-revit/references/tools/manage_revit_instances.md +63 -0
  55. package/skills/pi-revit/references/tools/manage_revit_scripts.md +109 -0
  56. package/skills/pi-revit/references/tools/manage_schedules.md +90 -0
  57. package/skills/pi-revit/references/tools/manage_selection.md +66 -0
  58. package/skills/pi-revit/references/tools/manage_sheet_placements.md +82 -0
  59. package/skills/pi-revit/references/tools/manage_sheets.md +71 -0
  60. package/skills/pi-revit/references/tools/manage_views.md +95 -0
  61. package/skills/pi-revit/references/tools/measure_geometry.md +71 -0
  62. package/skills/pi-revit/references/tools/open_view.md +59 -0
  63. package/skills/pi-revit/references/tools/ping.md +41 -0
  64. package/skills/pi-revit/references/tools/query_spatial_elements.md +74 -0
  65. package/skills/pi-revit/references/tools/read_revit_result.md +53 -0
  66. package/skills/pi-revit/references/tools/search_api_docs.md +65 -0
  67. package/skills/pi-revit/references/tools/set_parameters.md +75 -0
  68. package/skills/pi-revit/references/tools/summarize_elements.md +64 -0
  69. package/skills/pi-revit/references/tools/transform_elements.md +79 -0
  70. package/skills/pi-revit/references/visual-verification.md +36 -0
  71. package/skills/pi-revit/tool-manifest.json +338 -0
  72. package/src/Revit/BridgeServer.cs +93 -87
  73. package/src/Revit/OperationStore.cs +178 -178
  74. package/src/Revit/ToolRegistry.cs +88 -57
  75. package/src/Revit/Tools/CaptureView.cs +10 -2
  76. package/src/Revit/Tools/ChangeElementTypes.cs +74 -60
  77. package/src/Revit/Tools/ChangeSet.cs +39 -0
  78. package/src/Revit/Tools/CreateTags.cs +107 -95
  79. package/src/Revit/Tools/DeleteElements.cs +53 -44
  80. package/src/Revit/Tools/DocumentGuard.cs +74 -64
  81. package/src/Revit/Tools/ElementNames.cs +103 -0
  82. package/src/Revit/Tools/ElementQueryScope.cs +27 -27
  83. package/src/Revit/Tools/ElementTraits.cs +53 -0
  84. package/src/Revit/Tools/ExecuteCsharp.cs +54 -45
  85. package/src/Revit/Tools/ExportDocuments.cs +129 -121
  86. package/src/Revit/Tools/GetElementDetails.cs +37 -41
  87. package/src/Revit/Tools/GetElementRelationships.cs +82 -76
  88. package/src/Revit/Tools/GetElementTypes.cs +8 -0
  89. package/src/Revit/Tools/GetElements.cs +75 -86
  90. package/src/Revit/Tools/GetLinkedElements.cs +89 -82
  91. package/src/Revit/Tools/GetLinkedModels.cs +73 -66
  92. package/src/Revit/Tools/GetModelCoordinates.cs +56 -49
  93. package/src/Revit/Tools/GetModelHealth.cs +7 -0
  94. package/src/Revit/Tools/GetModelOverview.cs +185 -158
  95. package/src/Revit/Tools/GetScheduleFields.cs +44 -37
  96. package/src/Revit/Tools/GetSchedules.cs +96 -89
  97. package/src/Revit/Tools/InheritedState.Summary.cs +57 -0
  98. package/src/Revit/Tools/InheritedState.cs +144 -0
  99. package/src/Revit/Tools/ManageElementSets.cs +114 -106
  100. package/src/Revit/Tools/ManageSchedules.cs +174 -164
  101. package/src/Revit/Tools/ManageSelection.cs +45 -37
  102. package/src/Revit/Tools/ManageSheetPlacements.cs +113 -97
  103. package/src/Revit/Tools/ManageSheets.cs +72 -63
  104. package/src/Revit/Tools/ManageViews.cs +115 -100
  105. package/src/Revit/Tools/MeasureGeometry.cs +60 -54
  106. package/src/Revit/Tools/ModelChanges.cs +154 -0
  107. package/src/Revit/Tools/ModelEditBatch.cs +105 -102
  108. package/src/Revit/Tools/ModelEditInputs.cs +49 -49
  109. package/src/Revit/Tools/OpenView.cs +9 -2
  110. package/src/Revit/Tools/ParameterResolver.cs +94 -0
  111. package/src/Revit/Tools/QuerySpatialElements.cs +70 -63
  112. package/src/Revit/Tools/SearchApiDocs.cs +72 -4
  113. package/src/Revit/Tools/SetParameters.cs +60 -79
  114. package/src/Revit/Tools/SpatialBounds.cs +30 -30
  115. package/src/Revit/Tools/SummarizeElements.cs +94 -87
  116. package/src/Revit/Tools/ToolContract.cs +48 -0
  117. package/src/Revit/Tools/ToolSupport.cs +5 -1
  118. package/src/Revit/Tools/TransformElements.cs +72 -57
  119. package/workspace/AGENTS.md +26 -20
package/README.md CHANGED
@@ -1,17 +1,17 @@
1
1
  # pi-revit
2
2
 
3
3
  Native Revit tools for [Pi](https://pi.dev) — ask about, query, script, and modify the open
4
- Autodesk Revit model from your terminal.
5
-
4
+ Autodesk Revit model from your terminal.
5
+
6
6
  ```text
7
7
  You: how many levels in the model?
8
8
  Pi: calls get_model_overview → "There are 14 levels in the Revit model."
9
9
 
10
10
  You: select all structural columns
11
- Pi: get_model_overview → get_elements → manage_selection → "Selected 222 structural columns."
11
+ Pi: get_model_overview → get_elements → manage_selection → "Selected 222 structural columns."
12
12
 
13
13
  You: rename level 'L1' to 'Ground Floor'
14
- Pi: get_model_overview → set_parameters → "Done — Level 'L1' is now 'Ground Floor'."
14
+ Pi: get_model_overview → set_parameters → "Done — Level 'L1' is now 'Ground Floor'."
15
15
  ```
16
16
 
17
17
  ## How it works
@@ -26,7 +26,7 @@ localhost HTTP bridge ← per-start token; connection info in %APPDATA%
26
26
  headless Revit add-in ← no ribbon, no panels; just a bridge
27
27
  │ ExternalEvent queue (Revit API thread)
28
28
  ▼
29
- Revit API ← tool-owned model transactions; separate UI/file effects
29
+ Revit API ← tool-owned model transactions; separate UI/file effects
30
30
  ```
31
31
 
32
32
  The extension discovers its tools from the bridge at startup (retrying in the background until
@@ -39,58 +39,58 @@ selected LLM provider, like any Pi session.
39
39
  Be deliberate about pointing an LLM at a real project model. The add-in enforces what it can
40
40
  enforce mechanically, and is honest about what it cannot:
41
41
 
42
- - Tool metadata describes its classification; UI actions such as selection and view
43
- activation can change state even when `write` is false. Confirmation policy belongs
44
- to the client. Exact document targeting is enforced separately as described below.
45
- - Parameter writes, C# scripts, temporary isolation, and IFC export own named Revit
46
- transactions. Failure handling is attached after transaction start, and results
47
- check transaction outcomes before claiming commit or rollback. `set_parameters`
48
- defaults to partial success; `atomic: true` rolls back the batch if any update
49
- fails, and `preview: true` rolls back proposed model changes after validation.
50
- Inspect every failed update, the validation status, and `commitWarnings`.
51
- An unconfirmed rollback is reported as such.
42
+ - Tool metadata describes its classification; UI actions such as selection and view
43
+ activation can change state even when `write` is false. Confirmation policy belongs
44
+ to the client. Exact document targeting is enforced separately as described below.
45
+ - Parameter writes, C# scripts, temporary isolation, and IFC export own named Revit
46
+ transactions. Failure handling is attached after transaction start, and results
47
+ check transaction outcomes before claiming commit or rollback. `set_parameters`
48
+ defaults to partial success; `atomic: true` rolls back the batch if any update
49
+ fails, and `preview: true` rolls back proposed model changes after validation.
50
+ Inspect every failed update, the validation status, and `commitWarnings`.
51
+ An unconfirmed rollback is reported as such.
52
52
  - `execute_csharp` is an unrestricted escape hatch by design — scripts have full CLR access.
53
53
  Treat it like giving the agent a macro editor, on a model you have saved or can restore.
54
- - `execute_csharp` has a dialog guard that attempts dismissive responses to dialogs
55
- raised while the script runs. It does not establish that every Revit dialog or
56
- failure mode can be handled automatically.
57
- - A model transaction does not undo filesystem output or earlier selection/zoom
58
- changes. A failed export can leave incomplete files; its error reports the output
59
- location and observed changed files. An isolation failure reports any earlier
60
- selection action that already completed.
61
-
62
- ### Target the exact open document
63
-
64
- Call `get_model_overview` for the intended model and copy `project.documentId`
65
- unchanged into `expected_document_id` on subsequent operations:
66
-
67
- ```json
68
- {
69
- "expected_document_id": "<project.documentId from the current overview>",
70
- "updates": [{ "element_id": 12345, "parameter": "ALL_MODEL_INSTANCE_COMMENTS", "value": "Reviewed" }]
71
- }
72
- ```
73
-
74
- Replace the placeholders with the current document ID and an actual element ID.
75
- The exact ID is required for `set_parameters`, `transform_elements`,
76
- `delete_elements`, `change_element_types`, `manage_views`, `manage_sheets`,
77
- `manage_sheet_placements`, `manage_schedules`, `create_tags`, `execute_csharp`,
78
- `export_documents`, and `open_view`,
79
- including supported previews. `manage_sheet_placements` requires it even for its
80
- read-only `list` action because the tool is classified as write-capable.
81
- It is also required for selection/zoom
82
- changes and any `manage_selection` call with `isolate_in_view: true`, including
83
- action `get`. Pure reads may omit it; a supplied ID is always checked.
84
-
85
- The identity represents one currently open native document in one loaded bridge
86
- session. It is not a persistent project ID, path, export-folder key, or credential.
87
- Closing/reopening the document or restarting the bridge invalidates prior IDs.
88
- Read the intended document's overview again after those transitions. The guard
89
- checks the actual target on Revit's API thread immediately before execution.
90
-
91
- Legacy `expected_document` titles remain an optional additional sanity check.
92
- A title alone no longer satisfies the required guard, even when it matches.
93
- Clients must refresh discovery and supply the new field after upgrading to 0.3.0.
54
+ - `execute_csharp` has a dialog guard that attempts dismissive responses to dialogs
55
+ raised while the script runs. It does not establish that every Revit dialog or
56
+ failure mode can be handled automatically.
57
+ - A model transaction does not undo filesystem output or earlier selection/zoom
58
+ changes. A failed export can leave incomplete files; its error reports the output
59
+ location and observed changed files. An isolation failure reports any earlier
60
+ selection action that already completed.
61
+
62
+ ### Target the exact open document
63
+
64
+ Call `get_model_overview` for the intended model and copy `project.documentId`
65
+ unchanged into `expected_document_id` on subsequent operations:
66
+
67
+ ```json
68
+ {
69
+ "expected_document_id": "<project.documentId from the current overview>",
70
+ "updates": [{ "element_id": 12345, "parameter": "ALL_MODEL_INSTANCE_COMMENTS", "value": "Reviewed" }]
71
+ }
72
+ ```
73
+
74
+ Replace the placeholders with the current document ID and an actual element ID.
75
+ The exact ID is required for `set_parameters`, `transform_elements`,
76
+ `delete_elements`, `change_element_types`, `manage_views`, `manage_sheets`,
77
+ `manage_sheet_placements`, `manage_schedules`, `create_tags`, `execute_csharp`,
78
+ `export_documents`, and `open_view`,
79
+ including supported previews. `manage_sheet_placements` requires it even for its
80
+ read-only `list` action because the tool is classified as write-capable.
81
+ It is also required for selection/zoom
82
+ changes and any `manage_selection` call with `isolate_in_view: true`, including
83
+ action `get`. Pure reads may omit it; a supplied ID is always checked.
84
+
85
+ The identity represents one currently open native document in one loaded bridge
86
+ session. It is not a persistent project ID, path, export-folder key, or credential.
87
+ Closing/reopening the document or restarting the bridge invalidates prior IDs.
88
+ Read the intended document's overview again after those transitions. The guard
89
+ checks the actual target on Revit's API thread immediately before execution.
90
+
91
+ Legacy `expected_document` titles remain an optional additional sanity check.
92
+ A title alone no longer satisfies the required guard, even when it matches.
93
+ Clients must refresh discovery and supply the new field after upgrading to 0.3.0.
94
94
 
95
95
  Practical advice: work on saved models, keep worksharing backups/central protection as usual,
96
96
  and review the agent's summary of what changed after any write session.
@@ -114,18 +114,18 @@ npx.cmd -y pi-revit
114
114
  ```
115
115
 
116
116
  This installs the Pi package, builds and deploys the Revit bridge add-in, creates the
117
- `Documents\pi-revit` workspace, and installs the global `pi-revit` command.
118
-
119
- The installer first checks the selected .NET SDK. If it is missing or too old,
120
- installation stops with the required version, a download link, and retry steps.
121
- Interactive terminals also offer to open the download page. Revit uses a runtime
122
- to run; compiling this add-in also needs the SDK. For Revit 2027, install the
123
- [.NET 10 SDK for Windows x64](https://dotnet.microsoft.com/en-us/download/dotnet/10.0),
124
- reopen PowerShell, and rerun the installer. Existing .NET versions can stay installed.
125
- If an older SDK is still selected, check `dotnet --list-sdks`, your `PATH`, and any
126
- `global.json` in the current directory or its parents.
127
-
128
- Start Revit (click **Always Load** on the unsigned add-in prompt once) and open any
117
+ `Documents\pi-revit` workspace, and installs the global `pi-revit` command.
118
+
119
+ The installer first checks the selected .NET SDK. If it is missing or too old,
120
+ installation stops with the required version, a download link, and retry steps.
121
+ Interactive terminals also offer to open the download page. Revit uses a runtime
122
+ to run; compiling this add-in also needs the SDK. For Revit 2027, install the
123
+ [.NET 10 SDK for Windows x64](https://dotnet.microsoft.com/en-us/download/dotnet/10.0),
124
+ reopen PowerShell, and rerun the installer. Existing .NET versions can stay installed.
125
+ If an older SDK is still selected, check `dotnet --list-sdks`, your `PATH`, and any
126
+ `global.json` in the current directory or its parents.
127
+
128
+ Start Revit (click **Always Load** on the unsigned add-in prompt once) and open any
129
129
  project. No panel or ribbon appears — the add-in is headless.
130
130
 
131
131
  ### Manual npm install
@@ -162,19 +162,25 @@ git clone https://github.com/Triavision-ai/pi-revit.git
162
162
  cd pi-revit
163
163
  powershell -ExecutionPolicy Bypass -File scripts\deploy.ps1
164
164
  pi install ./
165
- powershell -ExecutionPolicy Bypass -File scripts\setup-workspace.ps1
166
- ```
167
-
168
- ### Upgrading to 0.3.0
169
-
170
- **Breaking change:** writes and UI mutations now require `expected_document_id`.
171
- Close Revit, update the Pi package and redeploy the add-in using the installation
172
- steps above, then restart Revit and start a fresh Pi session. Both components must
173
- be updated. Call `get_model_overview` and copy `project.documentId` into subsequent
174
- mutating calls; a legacy `expected_document` title alone is insufficient. Refresh
175
- the ID after closing/reopening a document or restarting Revit.
176
-
177
- ## Use it
165
+ powershell -ExecutionPolicy Bypass -File scripts\setup-workspace.ps1
166
+ ```
167
+
168
+ ### Upgrading from 0.2.x
169
+
170
+ **Breaking change:** writes and UI mutations now require `expected_document_id`.
171
+ Close Revit, update the Pi package and redeploy the add-in using the installation
172
+ steps above, then restart Revit and start a fresh Pi session. Both components must
173
+ be updated. Call `get_model_overview` and copy `project.documentId` into subsequent
174
+ mutating calls; a legacy `expected_document` title alone is insufficient. Refresh
175
+ the ID after closing/reopening a document or restarting Revit.
176
+
177
+ The exact-ID requirement was introduced in 0.3.0 and also applies to later
178
+ releases. `ping` reports package/add-in version mismatches. Setup preserves an
179
+ existing workspace `AGENTS.md`; merge updated identity, saved-result retrieval,
180
+ output-folder guidance and current skill/manual routing from [the workspace template](workspace/AGENTS.md)
181
+ into older workspaces as needed.
182
+
183
+ ## Use it
178
184
 
179
185
  Open **any terminal** — PowerShell, CMD, or Windows Terminal — and type:
180
186
 
@@ -198,489 +204,539 @@ automatically and all Revit session history lives in one predictable place (`pi-
198
204
  continues the last session). The Revit tools themselves are installed globally in Pi, and the
199
205
  extension discovers them live from the bridge inside Revit each time a session starts.
200
206
 
201
- **Per model, automatically:** files sort themselves. Exports land in
202
- `Documents\pi-revit\Models\<model title>--<identity hash>\exports`. The suffix derives
203
- from the normalized saved-file path, cloud region/project/model identity, or Revit
204
- Server path. Distinct saved paths therefore use different destinations even when
205
- their titles or inherited project IDs match. Save As to another path selects a new
206
- destination. Unsaved models or unavailable persistent identities use a token stable
207
- only for that open document; their destination may change after reopening.
208
-
209
- `model.txt` records the identity used. Existing title-only directories remain
210
- untouched; upgrading does not migrate or merge old exports. An explicit
211
- `output_dir` still overrides the default. File attribution uses a directory
212
- snapshot, so avoid unrelated concurrent writers in a shared output directory.
207
+ **Per model, automatically:** files sort themselves. Exports land in
208
+ `Documents\pi-revit\Models\<model title>--<identity hash>\exports`. The suffix derives
209
+ from the normalized saved-file path, cloud region/project/model identity, or Revit
210
+ Server path. Distinct saved paths therefore use different destinations even when
211
+ their titles or inherited project IDs match. Save As to another path selects a new
212
+ destination. Unsaved models or unavailable persistent identities use a token stable
213
+ only for that open document; their destination may change after reopening.
214
+
215
+ `model.txt` records the identity used. Existing title-only directories remain
216
+ untouched; upgrading does not migrate or merge old exports. An explicit
217
+ `output_dir` still overrides the default. File attribution uses a directory
218
+ snapshot, so avoid unrelated concurrent writers in a shared output directory.
213
219
 
214
220
  Plain `pi` from any folder also works; `pi-revit` just adds the right working folder on top.
215
221
 
222
+ ## Guidance and contributor documentation
223
+
224
+ The [PI-Revit skill](skills/pi-revit/SKILL.md) is a short entry point. It links
225
+ shared execution/recovery/visual rules, workflows, and a
226
+ [tool index](skills/pi-revit/references/tool-index.md) with one focused manual
227
+ per public tool. Read only the detail relevant to the current task.
228
+
229
+ `find_revit_tools` now includes the six Pi-side utilities as well as discovered
230
+ bridge tools. Use `scope: "documentation"` to find packaged manuals while Revit
231
+ is closed, without contacting the bridge or activating tools:
232
+
233
+ ```json
234
+ { "scope": "documentation", "names": ["manage_sheets", "manage_sheet_placements"] }
235
+ ```
236
+
237
+ Read a returned `documentation.path` for details. Registration, activation and
238
+ reading a manual are separate actions; a manual is not proof that the selected
239
+ bridge supports the tool. Current input schemas remain authoritative.
240
+
241
+ Every tool declares what it does **not** cover and what to use instead: another
242
+ tool, specific Revit API members, a user action, or "the Revit API does not offer
243
+ this" with the evidence. `find_revit_tools` shows these limits with each result.
244
+ When no tool matches a request, it returns the remaining route (check the API
245
+ documentation, then use custom code) instead of an empty list. Missing a dedicated
246
+ tool is therefore never a reason to call an operation impossible. Search with
247
+ English task words; you can talk to Pi in any language, and it translates its searches.
248
+
249
+ A short PI-Revit protocol is always in Pi's context, whatever the task and whether
250
+ or not the skill is read. It covers:
251
+
252
+ - checking capability before saying no;
253
+ - doing only what was asked, verifying it with the tool's declared method, then
254
+ stopping and reporting;
255
+ - naming evidence;
256
+ - document identity;
257
+ - replying in your language.
258
+
259
+ If Pi keeps re-checking and adjusting something that is already done, the extension
260
+ asks it to compare against your request and report, and to offer extras as suggestions.
261
+
262
+ `ping` also reports what is actually loaded: the extension package, guidance
263
+ revision, source revision and, per tool, whether the manual matches the connected
264
+ bridge's exact contract (`contract_match` / `contract_changed` / `undocumented`).
265
+
266
+ For source changes, start with [AGENTS.md](AGENTS.md) and the
267
+ [architecture guide](docs/architecture.md). They explain where tools, operating
268
+ rules, workflows, future Revit subject skills and API guidance belong. The
269
+ [evaluation guide](docs/evaluation.md) records offline checks and the live
270
+ measurements still needed before claiming a speed or reliability improvement.
271
+
216
272
  ## Tools
217
273
 
218
- | Tool | What it does |
219
- |---|---|
220
- | `find_revit_tools` | Search the native tool catalogue and activate specialist tools for the current Pi session. |
221
- | `ping` | Is the bridge reachable? Revit version |
222
- | `manage_revit_instances` | List reachable local Revit sessions or select the target for this Pi session |
223
- | `get_model_overview` | Project info, units, levels, grids, category counts — call first |
224
- | `get_model_coordinates` | Read base points and site/project locations; map internal points through the active shared coordinates |
225
- | `get_elements` | Query/count elements: parameter filters, optional parameter values, pagination |
226
- | `summarize_elements` | Count all matching elements by category, type, level, or raw parameter value |
227
- | `manage_element_sets` | Create, list, read, or forget temporary snapshots of matching host elements |
274
+ | Tool | What it does |
275
+ |---|---|
276
+ | `find_revit_tools` | Find native/bridge tools and their manuals; activate specialist tools or look up documentation offline. |
277
+ | `ping` | Is the bridge reachable? Revit version |
278
+ | `manage_revit_instances` | List reachable local Revit sessions or select the target for this Pi session |
279
+ | `get_model_overview` | Project info, units, levels, grids, category counts — call first |
280
+ | `get_model_coordinates` | Read base points and site/project locations; map internal points through the active shared coordinates |
281
+ | `get_elements` | Query/count elements: parameter filters, optional parameter values, pagination |
282
+ | `summarize_elements` | Count all matching elements by category, type, level, or raw parameter value |
283
+ | `manage_element_sets` | Create, list, read, or forget temporary snapshots of matching host elements |
228
284
  | `get_element_details` | Parameter values, location, bounding box, materials per element |
229
- | `get_element_types` | Element types / family symbols, optional placed-instance counts |
230
- | `get_linked_models` | Direct Revit link instances, load status, document identities, placement transforms |
231
- | `get_linked_elements` | Query/count one loaded link, with optional bounding boxes in host coordinates |
232
- | `query_spatial_elements` | Find host elements by approximate bounding-box intersection or containment in a region |
233
- | `measure_geometry` | Measure exact point distance or approximate host-element bounding-box separation |
234
- | `get_schedules` | List schedules or read fields, widths, specifications, sort/filter rules, and displayed cells |
235
- | `get_schedule_fields` | Discover eligible field parameter/type pairs for an existing schedule |
236
- | `manage_schedules` | Create or configure regular schedules, including fields, widths, sorting, and filters |
237
- | `create_tags` | Create host element, room, space, or area tags, with partial/atomic batches and preview |
238
- | `get_element_relationships` | Host, type, level, members, joined geometry, and logical dependents of one element |
285
+ | `get_element_types` | Element types / family symbols, optional placed-instance counts |
286
+ | `get_linked_models` | Direct Revit link instances, load status, document identities, placement transforms |
287
+ | `get_linked_elements` | Query/count one loaded link, with optional bounding boxes in host coordinates |
288
+ | `query_spatial_elements` | Find host elements by approximate bounding-box intersection or containment in a region |
289
+ | `measure_geometry` | Measure exact point distance or approximate host-element bounding-box separation |
290
+ | `get_schedules` | List schedules or read fields, widths, specifications, sort/filter rules, and displayed cells |
291
+ | `get_schedule_fields` | Discover eligible field parameter/type pairs for an existing schedule |
292
+ | `manage_schedules` | Create or configure regular schedules, including fields, widths, sorting, and filters |
293
+ | `create_tags` | Create host element, room, space, or area tags, with partial/atomic batches and preview |
294
+ | `get_element_relationships` | Host, type, level, members, joined geometry, and logical dependents of one element |
239
295
  | `manage_selection` | Get/set/clear the selection, zoom, temporary isolate |
240
296
  | `open_view` | Activate a view or sheet in the Revit UI (like double-clicking it in the browser) |
241
- | `set_parameters` | Bulk parameter writes and renames, with previews and optional atomic batches |
242
- | `transform_elements` | Move, copy, or rotate a whole selection, with explicit units and preview |
243
- | `delete_elements` | Preview or delete selected elements and report Revit's full deletion set |
244
- | `change_element_types` | Change types per target, with preview and optional atomic rollback |
245
- | `manage_views` | Create plans, isometric 3D views, or sections; duplicate or update views |
246
- | `manage_sheets` | Create, rename, or renumber sheets, with an optional titleblock at creation |
247
- | `manage_sheet_placements` | List, place, or move viewports and schedule instances in sheet paper space |
297
+ | `set_parameters` | Bulk parameter writes and renames, with previews and optional atomic batches |
298
+ | `transform_elements` | Move, copy, or rotate a whole selection, with explicit units and preview |
299
+ | `delete_elements` | Preview or delete selected elements and report Revit's full deletion set |
300
+ | `change_element_types` | Change types per target, with preview and optional atomic rollback |
301
+ | `manage_views` | Create plans, isometric 3D views, or sections; duplicate or update views |
302
+ | `manage_sheets` | Create, rename, or renumber sheets, with an optional titleblock at creation |
303
+ | `manage_sheet_placements` | List, place, or move viewports and schedule instances in sheet paper space |
248
304
  | `search_api_docs` | Search the offline Revit API docs (works with no document open) |
249
- | `execute_csharp` | Run a C# script with separate JSON inputs in one auto-managed transaction |
250
- | `manage_revit_scripts` | Save immutable local script versions, inspect source, run an exact version, and read history |
305
+ | `execute_csharp` | Run a C# script with separate JSON inputs in one auto-managed transaction |
306
+ | `manage_revit_scripts` | Save immutable local script versions, inspect source, run an exact version, and read history |
251
307
  | `capture_view` | PNG snapshot of a view to a temp file (read the returned path to see it) |
252
- | `export_documents` | PDF/DWG/PNG/IFC export of sheets and views — sorted into `Models\<title>--<identity hash>\exports` |
253
- | `get_model_health` | Warnings grouped + worksets, phases, design options audit |
254
- | `read_revit_result` | Read bounded fragments of a saved large tool result; extension-only, no Revit call |
255
- | `get_revit_operation` | Inspect a bridge operation receipt and its retained result without waiting for the model thread |
256
-
257
- ### Choose a Revit instance
258
-
259
- `manage_revit_instances` defaults to `action: "list"`. It reports reachable
260
- local bridge sessions with an opaque `bridge_id`, process ID, Revit/add-in
261
- versions, selection status, and operation-tracking support. Choose the intended
262
- session with `action: "select"` and the exact returned `bridge_id`. Selection
263
- belongs to the current Pi extension session; it does not activate a document
264
- or change the model.
265
-
266
- When the first connection finds a sole instance, Pi binds to it automatically.
267
- If several instances are available before a target is bound, explicitly select
268
- one before model calls. Once bound, Pi keeps that exact bridge session. If it
269
- closes or restarts, calls fail instead of switching to another instance, even
270
- when only one remains. List again and explicitly select the intended new
271
- identity. Selection refreshes the tool catalogue; check `tool_catalog_ready`,
272
- and retry `ping` if discovery has not completed. Then read `get_model_overview`
273
- for a fresh document identity before continuing work.
274
-
275
- Each current bridge publishes its own discovery file in
276
- `%APPDATA%\RevitBridge\instances\<bridgeId>.json`. The legacy `bridge.json`
277
- discovery file is still supported. Older bridges without a generation ID receive
278
- an opaque hash selector in the instance list; copy it unchanged rather than
279
- constructing one. Legacy discovery can expose only the older instance named by
280
- that shared file, so updating each add-in enables discovery of all instances.
281
-
282
- Operation receipts and identical `_operation_id` retries route to the original
283
- bridge encoded in the operation ID, even after selecting a different instance.
284
- They do not switch the target for new calls. If the original bridge is unavailable,
285
- the request fails without sending the action to another session.
286
-
287
- ### Read project coordinates
288
-
289
- `get_model_coordinates` reads project/survey base points, the active project
290
- location, site data, and paginated project locations. Supply a length `unit`;
291
- optional `points` accepts up to 100 positions along document internal axes.
292
- Revit's active project location maps those points to shared coordinates. Returned
293
- lengths use the requested unit, while angles and latitude/longitude use degrees.
294
- Location pages default to 50 entries (maximum 100); follow `next_offset`.
295
- The tool requires a project document, makes no coordinate changes, and does not
296
- infer a GIS coordinate reference system or datum.
297
-
298
- ### Query regions and measure distances
299
-
300
- `query_spatial_elements` takes a region `min`/`max` in the document's internal
301
- axes and an explicit length `unit`. It compares host-element axis-aligned
302
- bounding boxes with the region, using `intersects` (default) or `inside`.
303
- Containment requires the whole box to fit; touching boundaries are included.
304
- The nested `query` uses whole-scope element filters and must match at most
305
- 10,000 candidates before region testing. Query-level paging and projections
306
- are not accepted. Results sort by element ID with outer paging (default 100,
307
- maximum 200); follow `next_offset`. `without_bounds_count` reports candidates
308
- omitted because they have no model bounding box.
309
-
310
- `measure_geometry` measures exact Euclidean distance between supplied points
311
- with `mode: "point_distance"`, or approximate bounding-box separation between
312
- two host elements with `mode: "bounding_box_gap"`. Point mode returns signed
313
- A-to-B `delta`; box mode returns nonnegative axis gaps. The required `unit`
314
- applies to all inputs and outputs: millimeters, centimeters, meters, feet, or
315
- inches. Both modes use document internal axes; linked contents are not traversed.
316
-
317
- Bounding-box gaps are lower bounds on geometry separation. Boxes can enclose
318
- nonphysical geometry, so touching/overlapping boxes do not establish a clash.
319
- An optional nonnegative `clearance` in box mode flags gaps strictly below that
320
- threshold; it identifies review candidates, not verified clearance failures.
321
- Keep the returned method and approximation status with any reported result.
322
-
323
- Practical workflows are available in the Pi skill references:
324
- [room documentation](skills/pi-revit/references/room-documentation.md) and
325
- [model audit and export](skills/pi-revit/references/model-audit-export.md).
326
-
327
- ### Read parameter values and summarize queries
328
-
329
- Add `parameter_names` to `get_elements` to read up to 20 requested parameters
330
- alongside element identity fields. Names can be display names, built-in parameter
331
- names, or `guid:<GUID>` identities. `include_type_parameters: true` also reads
332
- those parameters from each element's type. Projections expose missing and
333
- ambiguous matches and include every matching parameter. Raw `value` uses Revit
334
- internal units for measurable numbers; `displayValue` uses document formatting.
335
- Bare counts return no parameter projections.
336
-
337
- `summarize_elements` groups a host-element `query` by `category`, `typeName`,
338
- `levelId`, or `parameter`. Parameter grouping uses exact raw values, with a
339
- separate missing-parameter group, and rejects ambiguous display names. Set
340
- `type_parameter: true` to group by a parameter on the type. The outer
341
- `offset`/`limit` pages groups (default 100, maximum 500); counts always cover the
342
- whole matching scope.
343
-
344
- `summarize_elements` and element-set creation accept category, class, level,
345
- type, active-view, and parameter filters inside `query`. They reject query-level
346
- paging, projections, and `count_only`, and require at most 10,000 matching
347
- elements. Narrow larger queries; an omitted query covers all host instances.
348
-
349
- ### Reuse an element set
350
-
351
- Use `manage_element_sets` with `action: "create"` to snapshot query membership,
352
- then `read` its `set_id`, `list` active-document sets, or `forget` a set. This
353
- changes neither the model nor selection. The bridge retains at most 32 sets;
354
- each expires 30 minutes after creation and belongs to the exact open document
355
- and bridge session. Reads do not renew it. Reopening the document or restarting
356
- the bridge requires a fresh set.
357
-
358
- Read pages return current values for the original members, without reapplying
359
- the query. Deleted or identity-changed members appear in `missing`. Check those
360
- entries before passing surviving IDs to other tools. Pages default to 100
361
- members (maximum 1000); follow `next_offset`, which includes missing members in
362
- `visited_count`. Set reads also support `parameter_names` and
363
- `include_type_parameters`.
364
-
365
- ### Preview parameter changes
366
-
367
- `set_parameters` accepts 1–200 updates and defaults to committing successful
368
- updates while reporting failures. Each update has its own subtransaction.
369
- `atomic: true` rolls back the entire batch if any update fails. `preview: true`
370
- performs eligible commit checks inside a transaction group, then rolls the
371
- group back. Both options require the same exact document identity as an ordinary
372
- write and can be combined.
373
-
374
- Read `commit_validation_performed`: an atomic batch rejected before commit, or
375
- a batch with no accepted updates, has not passed commit-time validation.
376
- Successful preview responses confirm model rollback. Errors report the cleanup
377
- outcome instead; inspect it before retrying.
378
-
379
- Only committed updates appear in `succeeded`. Accepted steps from previews or
380
- rolled-back batches appear in `proposed`, with `updated: 0` and
381
- `committed: false`. Their `before`/`after` values describe each step in input
382
- order, identified by its zero-based `index`. Repeated writes can have intermediate
383
- values; reread the element when final values matter. Inspect `failed` and
384
- `commitWarnings` as well. Numeric write inputs use the explicit `unit` or the
385
- document's display units; raw numeric values in the returned snapshots use
386
- Revit internal units.
387
-
388
- ### Transform, delete, and change types
389
-
390
- These advanced tools can be activated with `find_revit_tools`. They operate on
391
- the active host document and require `expected_document_id` for both previews
392
- and writes. Their results use the same `succeeded`, `proposed`, `failed`,
393
- `committed`, and commit-validation fields as parameter batches. `updated` counts
394
- steps: one whole-selection transform or deletion counts as one step.
395
-
396
- `transform_elements` moves, copies, or rotates 1–200 distinct `element_ids`
397
- together. Always supply `unit`: `millimeters`, `centimeters`, `meters`, `feet`,
398
- or `inches`. Move/copy takes a `translation` vector. Rotation takes an
399
- `axis_origin`, a nonzero dimensionless `axis_direction`, and signed right-hand
400
- `angle_degrees`. Coordinates refer to the document's internal origin and axes;
401
- returned location snapshots use feet, regardless of input units. The selection
402
- succeeds or rolls back as one step. Move/rotate rejects pinned requested
403
- elements; the tool never unpins them automatically. Copy previews return
404
- temporary `created_ids`, which must not be reused after rollback.
405
-
406
- `delete_elements` deletes 1–200 distinct requested elements in one step, rejecting
407
- pinned requested elements. Use `preview: true` to inspect Revit's complete
408
- `deleted_ids` set and its `dependent_ids`, with rollback. A cascade exceeding
409
- 10,000 IDs rolls back. To check a later deletion against the preview, optionally
410
- pass the full `deleted_ids` as `expected_deleted_ids`; a changed set causes
411
- rollback before commit. This compares membership only. The actual deletion is
412
- a new request, not an identical retry of the preview, so do not reuse the
413
- preview's `_operation_id` for it.
414
-
415
- `change_element_types` accepts 1–200 `element_id`/`type_id` pairs in `updates`,
416
- with each target appearing once. Invalid types or pinned targets fail individually;
417
- other valid changes can commit by default. `atomic: true` rolls back the complete
418
- batch on any failure. Some type changes replace the original element: use the
419
- committed `resulting_id` and `unique_id` afterward. Replacement IDs reported in
420
- `proposed` are temporary after preview or atomic rollback.
421
-
422
- Transforms and type changes can affect constrained or hosted elements beyond
423
- the target snapshots. Deletion IDs cover elements returned by Revit's deletion
424
- API, not surviving elements Revit may also modify. Review these results as
425
- bounded descriptions of the operation, not a complete audit of every effect.
426
-
427
- ### Create views and arrange sheets
428
-
429
- Activate `manage_views`, `manage_sheets`, and `manage_sheet_placements` through
430
- `find_revit_tools`. Edits support `preview: true` and require the exact document
431
- identity. Each call edits one view, sheet, or placement in one step. Created IDs
432
- in previews are marked `id_is_temporary` and must not be reused after rollback.
433
- Inspect the common transaction outcome and validation fields. Use `open_view`
434
- to display committed views/sheets and `delete_elements` to remove them.
435
-
436
- `manage_views` supports `create_plan`, `create_3d`, `create_section`, `duplicate`,
437
- and `update`. Creation uses a compatible `view_family_type_id`; discover it with
438
- `get_element_types` and `of_class: "ViewFamilyType"`. Plans also need `level_id`;
439
- 3D creation produces an isometric view. Duplicate/update targets `view_id`.
440
- Duplication options are `duplicate`, `with_detailing`, and `dependent` where
441
- supported. Optional name, scale, and template apply in the same step. Template
442
- ID `-1` removes a template explicitly; incompatible templates or controlled
443
- scale changes fail without automatically removing the template.
444
-
445
- Sections use the document's internal coordinate frame. Supply `origin`, explicit
446
- length `unit`, orthogonal nonzero `viewing_direction` and `up`, and positive
447
- width/height/depth. Width and height center on the origin; depth extends in the
448
- viewing direction. Direction vectors are dimensionless.
449
-
450
- `manage_sheets` creates a sheet from `name` and `number`, optionally using a loaded
451
- titleblock `FamilySymbol` specified by `titleblock_type_id`. Omitting it creates
452
- a sheet without a titleblock. Updates use `sheet_id` and name/number; changing
453
- an existing titleblock type uses `change_element_types` on its instance instead.
454
-
455
- `manage_sheet_placements` lists both viewports and schedule instances for a
456
- `sheet_id` (default 100 per page, maximum 200). Follow `next_offset`. Although
457
- listing changes no model state, the tool's write-capable metadata means
458
- `expected_document_id` is required for this action too.
459
-
460
- To place content, supply `sheet_id`, `view_id`, explicit `unit`, and
461
- `position: [x,y,0]`; to move it, supply `placement_id`, unit, and position.
462
- Positions are paper-space sheet coordinates and must never be multiplied by
463
- view scale. Viewports use their box center excluding the label; schedules use
464
- their insertion point. Returned positions use feet and state `position_kind`.
465
- Viewports support rotation `none`, `clockwise`, or `counterclockwise`; omit
466
- rotation for schedules. Pinned placements cannot be moved, placeholder sheets
467
- cannot receive content, and Revit checks whether a view can be placed.
468
-
469
- ### Configure schedules and create tags
470
-
471
- `manage_schedules` creates a regular schedule from `category` and `name`, with
472
- an optional `area_scheme_id` for area schedules. Configure an existing schedule
473
- with `schedule_id`. Each call is one atomic step, requires `expected_document_id`,
474
- and supports preview rollback. Revision schedules, templates, embedded schedules,
475
- and calculated/combined-field authoring are outside this tool.
476
-
477
- Use `get_schedule_fields` to discover eligible fields for an existing schedule.
478
- It supports localized name filtering and paging (default 100, maximum 200).
479
- `add_fields` identifies each field by its `parameter_id` plus `field_type` pair;
480
- negative built-in parameter IDs are valid. When Count appears in discovery,
481
- pass its returned pair unchanged, just like other fields. Count can also be
482
- added as `{ "field_type": "Count" }` without a parameter ID. A supplied pair
483
- must be eligible for the target schedule; do not guess its parameter ID.
484
- `included` marks pairs already present.
485
-
486
- In contrast, `update_fields`, `sort_fields`, and `filters` use the schedule-local
487
- `field_id` returned by `get_schedules`. These IDs are neither parameter IDs nor
488
- column indices. Read newly committed fields before assigning their sort/filter
489
- rules. New schedule and field IDs returned by previews are temporary.
490
-
491
- Field additions and updates support heading, hidden state, and width, with up
492
- to 50 entries each. Widths require explicit length units and apply to both grid
493
- and sheet columns. `sort_fields` allows four rules; `filters` allows eight.
494
- Supplying either array replaces its entire list, including clearing it with
495
- `[]`; omitting the property preserves it. `is_itemized` controls itemization.
496
-
497
- Filter comparisons are `equals`, `not_equals`, `contains`, `greater_than`, or
498
- `less_than`. Supply a matching `value_type` and value. Measured numeric filters
499
- require an explicit compatible `unit`; unitless numbers must omit it.
500
- `get_schedules` exposes each field's specification, filtering capabilities,
501
- grid/sheet widths in feet, and current sort/filter rules. Returned numeric filter
502
- values use internal units; returned comparison names use Revit enums rather
503
- than the write schema's comparison strings.
504
-
505
- `create_tags` accepts 1–100 host-document targets in one explicit view, using a
506
- loaded tag `FamilySymbol`. Choose `kind` as `element`, `room`, `space`, or `area`.
507
- Each target has `element_id` and `head_position: [x,y,z]` in document internal
508
- coordinates, using the required length `unit`. The position always means the
509
- tag head, including when `leader: true`; returned positions use feet. Linked
510
- targets and face/subelement references are unsupported.
511
-
512
- Element tags support horizontal/vertical orientation. Spatial tags require a
513
- compatible plan view and positions at the spatial element's level; omit their
514
- orientation property. Independent tags cannot use templates, perspective views,
515
- or unlocked 3D views. Creation requires exact document targeting, defaults to
516
- partial success, and supports `atomic: true` and `preview: true`. IDs in
517
- `proposed` are temporary after preview or atomic rollback; use only committed
518
- tag IDs for subsequent calls.
519
-
520
- ### Inspect links, schedules, and relationships
521
-
522
- Call `get_linked_models` before querying a link. Pass its `link_instance_id` and
523
- `linked_document_id` to `get_linked_elements` as `link_instance_id` and
524
- `expected_linked_document_id`. The optional `expected_document_id` still identifies
525
- the active host model. Refresh discovery after unloading or reloading a link.
526
- Queries support `get_elements` filters and pagination, except active-view scoping.
527
- Unloaded links cannot be queried, and nested links are not traversed.
528
-
529
- Keep the full `reference` returned for each linked element: its numeric ID belongs
530
- to the linked document and must not be used with host selection or write tools.
531
- Different placements of one linked model can produce different host coordinates.
532
- Optional `host_bounds` use internal feet and enclose all eight transformed box
533
- corners; they are axis-aligned bounds, not exact geometry. A missing box is null.
534
-
535
- Use `get_schedules` without an ID to list schedules, or with `schedule_id` to read
536
- field definitions, width/specification metadata, sort/filter rules, and displayed
537
- body cells. Text follows Revit's formatting and
538
- can include grouped entries, headings, and totals; rows are not element IDs.
539
- Hidden field definitions need not correspond to displayed columns. Follow both
540
- `next_offset` and `next_column_offset`: finish the column pages for a row page
541
- before moving to the next rows. List/body pages default to 50 entries (maximum
542
- 200); column pages default to 50 (maximum 50).
543
-
544
- `get_element_relationships` reports each requested relationship separately, with
545
- its own count and continuation offset. It reads host-document relationships only;
546
- logical dependents are not a complete deletion-impact prediction. In family
547
- documents, request relationship kinds that exclude `joined`. Relationship pages
548
- default to 100 entries (maximum 200). Link-instance pages default to 100 (maximum
549
- 1000), and linked-element pages default to 200 (maximum 1000).
550
-
551
- ### Reuse a script with structured inputs
552
-
553
- `execute_csharp` accepts an optional `inputs` JSON object separately from its
554
- source code. The script reads it through the `inputs` `JsonElement` global,
555
- for example `inputs.GetProperty("value").GetDouble()`. Inputs default to an
556
- empty object and are not interpolated into source text. Scripts validate their
557
- contents; the serialized object is limited to 100,000 characters.
558
-
559
- `manage_revit_scripts` stores reusable definitions under
560
- `%APPDATA%\pi-revit\scripts`. Its actions are `save`, `list`, `read`, `run`, and
561
- `history`. Saving requires a name, description, code, and `input_types`; it never
562
- executes the script. Versions are immutable 64-character SHA-256 hashes of the
563
- saved definition. Read a version to inspect its source, then explicitly run that
564
- exact name/hash with current `expected_document_id` and inputs. Runs verify
565
- saved content integrity and require a bridge with operation receipts.
566
-
567
- Up to 40 named `input_types` can be declared as string, number, integer, boolean,
568
- object, or array. Every declared input is required and extra inputs are rejected.
569
- Validation covers top-level kinds only: scripts still validate nested objects,
570
- array contents, ranges, units, and model-specific rules. The Pi skill includes
571
- a short save/read/run example using a numeric input.
572
-
573
- Library runs use unrestricted `execute_csharp`, with the same model, UI, file,
574
- and external effects, synchronous execution, transaction, and timeout behavior.
575
- There is no preview mode, scheduled execution, or automatic model saving. A saved
576
- script is not a saved Revit model.
577
-
578
- List/history pages default to 20 entries (maximum 100), with optional exact-name
579
- filtering. Local history stores version, document identity, input hash,
580
- timestamps, and receipt IDs, rather than raw inputs or results. History states
581
- record dispatch/response progress, not a model transaction outcome. After a
582
- timeout or interruption, inspect `get_revit_operation`; an identical retry uses
583
- the original `_operation_id`, script version, inputs, and document identity.
584
-
585
- ### Check an operation after a timeout
586
-
587
- With a bridge that supports operation tracking, Pi automatically assigns an
588
- operation ID to each bridge tool call and includes it in responses or request
589
- errors. Call the native `get_revit_operation` tool with that `operation_id` to
590
- check progress or recover the original result. This extension tool contacts the
591
- operation's original local bridge directly, even when another instance is selected,
592
- so it works while Revit's model thread is busy or no
593
- document is open; the bridge must still be running.
594
-
595
- | Receipt state | Meaning |
596
- |---|---|
597
- | `queued` | Waiting to begin; no tool execution has started. |
598
- | `running` | Execution started; a client timeout or cancellation does not stop it. |
599
- | `succeeded` | The tool returned successfully; inspect its payload for the actual model outcome. |
600
- | `failed` | The call returned an error; this alone does not confirm rollback or absence of effects. |
601
- | `expired_before_start` | Its queue deadline passed before execution; no tool action was performed. |
602
- | `result_unavailable` | The tool finished, but a response could not be retained correctly; effects may already exist. |
603
- | `unknown` | This bridge session has no receipt; the outcome is unknown. |
604
-
605
- A successful receipt is not proof of a committed edit. For example, a completed
606
- parameter preview can have receipt state `succeeded` while its payload reports
607
- `preview: true`, `committed: false`, and proposed changes that were rolled back.
608
- Inspect `committed`, validation flags, failures, and warnings in the retained
609
- tool result.
610
-
611
- To retry the same request, pass its exact ID as `_operation_id` on the original
612
- tool call and preserve all original arguments. Within the same bridge session,
613
- this waits for the existing operation or returns its cached response; it never
614
- executes that ID a second time. Reusing the ID with a different tool or arguments
615
- is rejected. Omitting `_operation_id` creates a new operation, so establish the
616
- previous outcome before retrying an edit that way.
617
-
618
- The bridge retains at most 128 completed full results, with a combined 32 MiB
619
- limit. Older or oversized results can be evicted, but their receipt records
620
- remain reserved for the session and report `result_available: false`. Replaying
621
- an evicted result returns an error without repeating the action. At 10,000
622
- receipt records, new tracked calls are rejected; existing receipts remain
623
- queryable. A bridge restart clears all receipts and changes its identity. Old
624
- IDs cannot be replayed in the new session. An unavailable original bridge or an
625
- `unknown` receipt does not prove that an earlier edit never ran. Changing the
626
- selected instance does not redirect old receipts or retries. Inspect the original
627
- model before deciding on a new operation.
628
-
629
- ### Read complete results
630
-
631
- Requested rows and parameter values are included in model-visible tool content.
632
- Results up to 12,000 characters are complete inline. For a larger result, the Pi
633
- extension saves the complete tool payload as UTF-8 JSON and returns `result_id`,
634
- `file_path`, `total_chars`, `complete_inline: false`, and retrieval instructions.
635
-
636
- Call `read_revit_result` with the returned ID and `offset: 0`, then follow each
637
- `next_offset` until `has_more` is false. A requested fragment is at most 8,000
638
- UTF-16 code units; it may be smaller so the escaped response stays within the
639
- message limit. Concatenate each page's `text` in order. Individual fragments are
640
- not standalone JSON objects from the original result. Use the returned offsets,
641
- not byte counts or a guessed increment.
642
-
643
- Result IDs are registered in memory by the current extension instance. After an
644
- extension reload or new Pi process, an old ID may no longer resolve; use the
645
- original absolute `file_path` with Pi's normal `read` tool while that file remains
646
- available. Saved results live in a unique OS temporary directory, can contain
647
- model data, and are subject to eventual OS/user cleanup. If saving fails after
648
- Revit completed an operation, inspect actual model state before retrying a write.
649
-
650
- Complete payload retrieval does not expand a tool's own query page or declared
651
- limits. Continue `get_elements`/`get_element_types` pagination separately, and
652
- check warning-group or projection truncation indicators. A bridge-only client
653
- must consume `details.payload` for oversized results; `read_revit_result` belongs
654
- to the Pi extension.
655
-
656
- Display-name parameter filters now resolve on every element, including inside a
657
- category/class scope. Explicit built-in IDs and shared GUIDs can retain collector
658
- optimization. In `get_element_details`, `include.parameters` and
659
- `include.type_parameters` are independent; disabling instance parameters still
660
- allows a type-only result.
308
+ | `export_documents` | PDF/DWG/PNG/IFC export of sheets and views — sorted into `Models\<title>--<identity hash>\exports` |
309
+ | `get_model_health` | Warnings grouped + worksets, phases, design options audit |
310
+ | `read_revit_result` | Read bounded fragments of a saved large tool result; extension-only, no Revit call |
311
+ | `get_revit_operation` | Inspect a bridge operation receipt and its retained result without waiting for the model thread |
312
+
313
+ ### Choose a Revit instance
314
+
315
+ `manage_revit_instances` defaults to `action: "list"`. It reports reachable
316
+ local bridge sessions with an opaque `bridge_id`, process ID, Revit/add-in
317
+ versions, selection status, and operation-tracking support. Choose the intended
318
+ session with `action: "select"` and the exact returned `bridge_id`. Selection
319
+ belongs to the current Pi extension session; it does not activate a document
320
+ or change the model.
321
+
322
+ When the first connection finds a sole instance, Pi binds to it automatically.
323
+ If several instances are available before a target is bound, explicitly select
324
+ one before model calls. Once bound, Pi keeps that exact bridge session. If it
325
+ closes or restarts, calls fail instead of switching to another instance, even
326
+ when only one remains. List again and explicitly select the intended new
327
+ identity. Selection refreshes the tool catalogue; check `tool_catalog_ready`,
328
+ and retry `ping` if discovery has not completed. Then read `get_model_overview`
329
+ for a fresh document identity before continuing work.
330
+
331
+ Each current bridge publishes its own discovery file in
332
+ `%APPDATA%\RevitBridge\instances\<bridgeId>.json`. The legacy `bridge.json`
333
+ discovery file is still supported. Older bridges without a generation ID receive
334
+ an opaque hash selector in the instance list; copy it unchanged rather than
335
+ constructing one. Legacy discovery can expose only the older instance named by
336
+ that shared file, so updating each add-in enables discovery of all instances.
337
+
338
+ Operation receipts and identical `_operation_id` retries route to the original
339
+ bridge encoded in the operation ID, even after selecting a different instance.
340
+ They do not switch the target for new calls. If the original bridge is unavailable,
341
+ the request fails without sending the action to another session.
342
+
343
+ ### Read project coordinates
344
+
345
+ `get_model_coordinates` reads project/survey base points, the active project
346
+ location, site data, and paginated project locations. Supply a length `unit`;
347
+ optional `points` accepts up to 100 positions along document internal axes.
348
+ Revit's active project location maps those points to shared coordinates. Returned
349
+ lengths use the requested unit, while angles and latitude/longitude use degrees.
350
+ Location pages default to 50 entries (maximum 100); follow `next_offset`.
351
+ The tool requires a project document, makes no coordinate changes, and does not
352
+ infer a GIS coordinate reference system or datum.
353
+
354
+ ### Query regions and measure distances
355
+
356
+ `query_spatial_elements` takes a region `min`/`max` in the document's internal
357
+ axes and an explicit length `unit`. It compares host-element axis-aligned
358
+ bounding boxes with the region, using `intersects` (default) or `inside`.
359
+ Containment requires the whole box to fit; touching boundaries are included.
360
+ The nested `query` uses whole-scope element filters and must match at most
361
+ 10,000 candidates before region testing. Query-level paging and projections
362
+ are not accepted. Results sort by element ID with outer paging (default 100,
363
+ maximum 200); follow `next_offset`. `without_bounds_count` reports candidates
364
+ omitted because they have no model bounding box.
365
+
366
+ `measure_geometry` measures exact Euclidean distance between supplied points
367
+ with `mode: "point_distance"`, or approximate bounding-box separation between
368
+ two host elements with `mode: "bounding_box_gap"`. Point mode returns signed
369
+ A-to-B `delta`; box mode returns nonnegative axis gaps. The required `unit`
370
+ applies to all inputs and outputs: millimeters, centimeters, meters, feet, or
371
+ inches. Both modes use document internal axes; linked contents are not traversed.
372
+
373
+ Bounding-box gaps are lower bounds on geometry separation. Boxes can enclose
374
+ nonphysical geometry, so touching/overlapping boxes do not establish a clash.
375
+ An optional nonnegative `clearance` in box mode flags gaps strictly below that
376
+ threshold; it identifies review candidates, not verified clearance failures.
377
+ Keep the returned method and approximation status with any reported result.
378
+
379
+ Practical workflows are available in the Pi skill references:
380
+ [room documentation](skills/pi-revit/references/room-documentation.md) and
381
+ [model audit and export](skills/pi-revit/references/model-audit-export.md).
382
+
383
+ ### Read parameter values and summarize queries
384
+
385
+ Add `parameter_names` to `get_elements` to read up to 20 requested parameters
386
+ alongside element identity fields. Names can be display names, built-in parameter
387
+ names, or `guid:<GUID>` identities. `include_type_parameters: true` also reads
388
+ those parameters from each element's type. Projections expose missing and
389
+ ambiguous matches and include every matching parameter. Raw `value` uses Revit
390
+ internal units for measurable numbers; `displayValue` uses document formatting.
391
+ Bare counts return no parameter projections.
392
+
393
+ `summarize_elements` groups a host-element `query` by `category`, `typeName`,
394
+ `levelId`, or `parameter`. Parameter grouping uses exact raw values, with a
395
+ separate missing-parameter group, and rejects ambiguous display names. Set
396
+ `type_parameter: true` to group by a parameter on the type. The outer
397
+ `offset`/`limit` pages groups (default 100, maximum 500); counts always cover the
398
+ whole matching scope.
399
+
400
+ `summarize_elements` and element-set creation accept category, class, level,
401
+ type, active-view, and parameter filters inside `query`. They reject query-level
402
+ paging, projections, and `count_only`, and require at most 10,000 matching
403
+ elements. Narrow larger queries; an omitted query covers all host instances.
404
+
405
+ ### Reuse an element set
406
+
407
+ Use `manage_element_sets` with `action: "create"` to snapshot query membership,
408
+ then `read` its `set_id`, `list` active-document sets, or `forget` a set. This
409
+ changes neither the model nor selection. The bridge retains at most 32 sets;
410
+ each expires 30 minutes after creation and belongs to the exact open document
411
+ and bridge session. Reads do not renew it. Reopening the document or restarting
412
+ the bridge requires a fresh set.
413
+
414
+ Read pages return current values for the original members, without reapplying
415
+ the query. Deleted or identity-changed members appear in `missing`. Check those
416
+ entries before passing surviving IDs to other tools. Pages default to 100
417
+ members (maximum 1000); follow `next_offset`, which includes missing members in
418
+ `visited_count`. Set reads also support `parameter_names` and
419
+ `include_type_parameters`.
420
+
421
+ ### Preview parameter changes
422
+
423
+ `set_parameters` accepts 1–200 updates and defaults to committing successful
424
+ updates while reporting failures. Each update has its own subtransaction.
425
+ `atomic: true` rolls back the entire batch if any update fails. `preview: true`
426
+ performs eligible commit checks inside a transaction group, then rolls the
427
+ group back. Both options require the same exact document identity as an ordinary
428
+ write and can be combined.
429
+
430
+ Read `commit_validation_performed`: an atomic batch rejected before commit, or
431
+ a batch with no accepted updates, has not passed commit-time validation.
432
+ Successful preview responses confirm model rollback. Errors report the cleanup
433
+ outcome instead; inspect it before retrying.
434
+
435
+ Only committed updates appear in `succeeded`. Accepted steps from previews or
436
+ rolled-back batches appear in `proposed`, with `updated: 0` and
437
+ `committed: false`. Their `before`/`after` values describe each step in input
438
+ order, identified by its zero-based `index`. Repeated writes can have intermediate
439
+ values; reread the element when final values matter. Inspect `failed` and
440
+ `commitWarnings` as well. Numeric write inputs use the explicit `unit` or the
441
+ document's display units; raw numeric values in the returned snapshots use
442
+ Revit internal units.
443
+
444
+ ### Transform, delete, and change types
445
+
446
+ These advanced tools can be activated with `find_revit_tools`. They operate on
447
+ the active host document and require `expected_document_id` for both previews
448
+ and writes. Their results use the same `succeeded`, `proposed`, `failed`,
449
+ `committed`, and commit-validation fields as parameter batches. `updated` counts
450
+ steps: one whole-selection transform or deletion counts as one step.
451
+
452
+ `transform_elements` moves, copies, or rotates 1–200 distinct `element_ids`
453
+ together. Always supply `unit`: `millimeters`, `centimeters`, `meters`, `feet`,
454
+ or `inches`. Move/copy takes a `translation` vector. Rotation takes an
455
+ `axis_origin`, a nonzero dimensionless `axis_direction`, and signed right-hand
456
+ `angle_degrees`. Coordinates refer to the document's internal origin and axes;
457
+ returned location snapshots use feet, regardless of input units. The selection
458
+ succeeds or rolls back as one step. Move/rotate rejects pinned requested
459
+ elements; the tool never unpins them automatically. Copy previews return
460
+ temporary `created_ids`, which must not be reused after rollback.
461
+
462
+ `delete_elements` deletes 1–200 distinct requested elements in one step, rejecting
463
+ pinned requested elements. Use `preview: true` to inspect Revit's complete
464
+ `deleted_ids` set and its `dependent_ids`, with rollback. A cascade exceeding
465
+ 10,000 IDs rolls back. To check a later deletion against the preview, optionally
466
+ pass the full `deleted_ids` as `expected_deleted_ids`; a changed set causes
467
+ rollback before commit. This compares membership only. The actual deletion is
468
+ a new request, not an identical retry of the preview, so do not reuse the
469
+ preview's `_operation_id` for it.
470
+
471
+ `change_element_types` accepts 1–200 `element_id`/`type_id` pairs in `updates`,
472
+ with each target appearing once. Invalid types or pinned targets fail individually;
473
+ other valid changes can commit by default. `atomic: true` rolls back the complete
474
+ batch on any failure. Some type changes replace the original element: use the
475
+ committed `resulting_id` and `unique_id` afterward. Replacement IDs reported in
476
+ `proposed` are temporary after preview or atomic rollback.
477
+
478
+ Transforms and type changes can affect constrained or hosted elements beyond
479
+ the target snapshots. Deletion IDs cover elements returned by Revit's deletion
480
+ API, not surviving elements Revit may also modify. Review these results as
481
+ bounded descriptions of the operation, not a complete audit of every effect.
482
+
483
+ ### Create views and arrange sheets
484
+
485
+ Activate `manage_views`, `manage_sheets`, and `manage_sheet_placements` through
486
+ `find_revit_tools`. Edits support `preview: true` and require the exact document
487
+ identity. Each call edits one view, sheet, or placement in one step. Created IDs
488
+ in previews are marked `id_is_temporary` and must not be reused after rollback.
489
+ Inspect the common transaction outcome and validation fields. Use `open_view`
490
+ to display committed views/sheets and `delete_elements` to remove them.
491
+
492
+ `manage_views` supports `create_plan`, `create_3d`, `create_section`, `duplicate`,
493
+ and `update`. Creation uses a compatible `view_family_type_id`; discover it with
494
+ `get_element_types` and `of_class: "ViewFamilyType"`. Plans also need `level_id`;
495
+ 3D creation produces an isometric view. Duplicate/update targets `view_id`.
496
+ Duplication options are `duplicate`, `with_detailing`, and `dependent` where
497
+ supported. Optional name, scale, and template apply in the same step. Template
498
+ ID `-1` removes a template explicitly; incompatible templates or controlled
499
+ scale changes fail without automatically removing the template.
500
+
501
+ Sections use the document's internal coordinate frame. Supply `origin`, explicit
502
+ length `unit`, orthogonal nonzero `viewing_direction` and `up`, and positive
503
+ width/height/depth. Width and height center on the origin; depth extends in the
504
+ viewing direction. Direction vectors are dimensionless.
505
+
506
+ `manage_sheets` creates a sheet from `name` and `number`, optionally using a loaded
507
+ titleblock `FamilySymbol` specified by `titleblock_type_id`. Omitting it creates
508
+ a sheet without a titleblock. Updates use `sheet_id` and name/number; changing
509
+ an existing titleblock type uses `change_element_types` on its instance instead.
510
+
511
+ `manage_sheet_placements` lists both viewports and schedule instances for a
512
+ `sheet_id` (default 100 per page, maximum 200). Follow `next_offset`. Although
513
+ listing changes no model state, the tool's write-capable metadata means
514
+ `expected_document_id` is required for this action too.
515
+
516
+ To place content, supply `sheet_id`, `view_id`, explicit `unit`, and
517
+ `position: [x,y,0]`; to move it, supply `placement_id`, unit, and position.
518
+ Positions are paper-space sheet coordinates and must never be multiplied by
519
+ view scale. Viewports use their box center excluding the label; schedules use
520
+ their insertion point. Returned positions use feet and state `position_kind`.
521
+ Viewports support rotation `none`, `clockwise`, or `counterclockwise`; omit
522
+ rotation for schedules. Pinned placements cannot be moved, placeholder sheets
523
+ cannot receive content, and Revit checks whether a view can be placed.
524
+
525
+ ### Configure schedules and create tags
526
+
527
+ `manage_schedules` creates a regular schedule from `category` and `name`, with
528
+ an optional `area_scheme_id` for area schedules. Configure an existing schedule
529
+ with `schedule_id`. Each call is one atomic step, requires `expected_document_id`,
530
+ and supports preview rollback. Revision schedules, templates, embedded schedules,
531
+ and calculated/combined-field authoring are outside this tool.
532
+
533
+ Use `get_schedule_fields` to discover eligible fields for an existing schedule.
534
+ It supports localized name filtering and paging (default 100, maximum 200).
535
+ `add_fields` identifies each field by its `parameter_id` plus `field_type` pair;
536
+ negative built-in parameter IDs are valid. When Count appears in discovery,
537
+ pass its returned pair unchanged, just like other fields. Count can also be
538
+ added as `{ "field_type": "Count" }` without a parameter ID. A supplied pair
539
+ must be eligible for the target schedule; do not guess its parameter ID.
540
+ `included` marks pairs already present.
541
+
542
+ In contrast, `update_fields`, `sort_fields`, and `filters` use the schedule-local
543
+ `field_id` returned by `get_schedules`. These IDs are neither parameter IDs nor
544
+ column indices. Read newly committed fields before assigning their sort/filter
545
+ rules. New schedule and field IDs returned by previews are temporary.
546
+
547
+ Field additions and updates support heading, hidden state, and width, with up
548
+ to 50 entries each. Widths require explicit length units and apply to both grid
549
+ and sheet columns. `sort_fields` allows four rules; `filters` allows eight.
550
+ Supplying either array replaces its entire list, including clearing it with
551
+ `[]`; omitting the property preserves it. `is_itemized` controls itemization.
552
+
553
+ Filter comparisons are `equals`, `not_equals`, `contains`, `greater_than`, or
554
+ `less_than`. Supply a matching `value_type` and value. Measured numeric filters
555
+ require an explicit compatible `unit`; unitless numbers must omit it.
556
+ `get_schedules` exposes each field's specification, filtering capabilities,
557
+ grid/sheet widths in feet, and current sort/filter rules. Returned numeric filter
558
+ values use internal units; returned comparison names use Revit enums rather
559
+ than the write schema's comparison strings.
560
+
561
+ `create_tags` accepts 1–100 host-document targets in one explicit view, using a
562
+ loaded tag `FamilySymbol`. Choose `kind` as `element`, `room`, `space`, or `area`.
563
+ Each target has `element_id` and `head_position: [x,y,z]` in document internal
564
+ coordinates, using the required length `unit`. The position always means the
565
+ tag head, including when `leader: true`; returned positions use feet. Linked
566
+ targets and face/subelement references are unsupported.
567
+
568
+ Element tags support horizontal/vertical orientation. Spatial tags require a
569
+ compatible plan view and positions at the spatial element's level; omit their
570
+ orientation property. Independent tags cannot use templates, perspective views,
571
+ or unlocked 3D views. Creation requires exact document targeting, defaults to
572
+ partial success, and supports `atomic: true` and `preview: true`. IDs in
573
+ `proposed` are temporary after preview or atomic rollback; use only committed
574
+ tag IDs for subsequent calls.
575
+
576
+ ### Inspect links, schedules, and relationships
577
+
578
+ Call `get_linked_models` before querying a link. Pass its `link_instance_id` and
579
+ `linked_document_id` to `get_linked_elements` as `link_instance_id` and
580
+ `expected_linked_document_id`. The optional `expected_document_id` still identifies
581
+ the active host model. Refresh discovery after unloading or reloading a link.
582
+ Queries support `get_elements` filters and pagination, except active-view scoping.
583
+ Unloaded links cannot be queried, and nested links are not traversed.
584
+
585
+ Keep the full `reference` returned for each linked element: its numeric ID belongs
586
+ to the linked document and must not be used with host selection or write tools.
587
+ Different placements of one linked model can produce different host coordinates.
588
+ Optional `host_bounds` use internal feet and enclose all eight transformed box
589
+ corners; they are axis-aligned bounds, not exact geometry. A missing box is null.
590
+
591
+ Use `get_schedules` without an ID to list schedules, or with `schedule_id` to read
592
+ field definitions, width/specification metadata, sort/filter rules, and displayed
593
+ body cells. Text follows Revit's formatting and
594
+ can include grouped entries, headings, and totals; rows are not element IDs.
595
+ Hidden field definitions need not correspond to displayed columns. Follow both
596
+ `next_offset` and `next_column_offset`: finish the column pages for a row page
597
+ before moving to the next rows. List/body pages default to 50 entries (maximum
598
+ 200); column pages default to 50 (maximum 50).
599
+
600
+ `get_element_relationships` reports each requested relationship separately, with
601
+ its own count and continuation offset. It reads host-document relationships only;
602
+ logical dependents are not a complete deletion-impact prediction. In family
603
+ documents, request relationship kinds that exclude `joined`. Relationship pages
604
+ default to 100 entries (maximum 200). Link-instance pages default to 100 (maximum
605
+ 1000), and linked-element pages default to 200 (maximum 1000).
606
+
607
+ ### Reuse a script with structured inputs
608
+
609
+ `execute_csharp` accepts an optional `inputs` JSON object separately from its
610
+ source code. The script reads it through the `inputs` `JsonElement` global,
611
+ for example `inputs.GetProperty("value").GetDouble()`. Inputs default to an
612
+ empty object and are not interpolated into source text. Scripts validate their
613
+ contents; the serialized object is limited to 100,000 characters.
614
+
615
+ `manage_revit_scripts` stores reusable definitions under
616
+ `%APPDATA%\pi-revit\scripts`. Its actions are `save`, `list`, `read`, `run`, and
617
+ `history`. Saving requires a name, description, code, and `input_types`; it never
618
+ executes the script. Versions are immutable 64-character SHA-256 hashes of the
619
+ saved definition. Read a version to inspect its source, then explicitly run that
620
+ exact name/hash with current `expected_document_id` and inputs. Runs verify
621
+ saved content integrity and require a bridge with operation receipts.
622
+
623
+ Up to 40 named `input_types` can be declared as string, number, integer, boolean,
624
+ object, or array. Every declared input is required and extra inputs are rejected.
625
+ Validation covers top-level kinds only: scripts still validate nested objects,
626
+ array contents, ranges, units, and model-specific rules. The Pi skill includes
627
+ a short save/read/run example using a numeric input.
628
+
629
+ Library runs use unrestricted `execute_csharp`, with the same model, UI, file,
630
+ and external effects, synchronous execution, transaction, and timeout behavior.
631
+ There is no preview mode, scheduled execution, or automatic model saving. A saved
632
+ script is not a saved Revit model.
633
+
634
+ List/history pages default to 20 entries (maximum 100), with optional exact-name
635
+ filtering. Local history stores version, document identity, input hash,
636
+ timestamps, and receipt IDs, rather than raw inputs or results. History states
637
+ record dispatch/response progress, not a model transaction outcome. After a
638
+ timeout or interruption, inspect `get_revit_operation`; an identical retry uses
639
+ the original `_operation_id`, script version, inputs, and document identity.
640
+
641
+ ### Check an operation after a timeout
642
+
643
+ With a bridge that supports operation tracking, Pi automatically assigns an
644
+ operation ID to each bridge tool call and includes it in responses or request
645
+ errors. Call the native `get_revit_operation` tool with that `operation_id` to
646
+ check progress or recover the original result. This extension tool contacts the
647
+ operation's original local bridge directly, even when another instance is selected,
648
+ so it works while Revit's model thread is busy or no
649
+ document is open; the bridge must still be running.
650
+
651
+ | Receipt state | Meaning |
652
+ |---|---|
653
+ | `queued` | Waiting to begin; no tool execution has started. |
654
+ | `running` | Execution started; a client timeout or cancellation does not stop it. |
655
+ | `succeeded` | The tool returned successfully; inspect its payload for the actual model outcome. |
656
+ | `failed` | The call returned an error; this alone does not confirm rollback or absence of effects. |
657
+ | `expired_before_start` | Its queue deadline passed before execution; no tool action was performed. |
658
+ | `result_unavailable` | The tool finished, but a response could not be retained correctly; effects may already exist. |
659
+ | `unknown` | This bridge session has no receipt; the outcome is unknown. |
660
+
661
+ A successful receipt is not proof of a committed edit. For example, a completed
662
+ parameter preview can have receipt state `succeeded` while its payload reports
663
+ `preview: true`, `committed: false`, and proposed changes that were rolled back.
664
+ Inspect `committed`, validation flags, failures, and warnings in the retained
665
+ tool result.
666
+
667
+ To retry the same request, pass its exact ID as `_operation_id` on the original
668
+ tool call and preserve all original arguments. Within the same bridge session,
669
+ this waits for the existing operation or returns its cached response; it never
670
+ executes that ID a second time. Reusing the ID with a different tool or arguments
671
+ is rejected. Omitting `_operation_id` creates a new operation, so establish the
672
+ previous outcome before retrying an edit that way.
673
+
674
+ The bridge retains at most 128 completed full results, with a combined 32 MiB
675
+ limit. Older or oversized results can be evicted, but their receipt records
676
+ remain reserved for the session and report `result_available: false`. Replaying
677
+ an evicted result returns an error without repeating the action. At 10,000
678
+ receipt records, new tracked calls are rejected; existing receipts remain
679
+ queryable. A bridge restart clears all receipts and changes its identity. Old
680
+ IDs cannot be replayed in the new session. An unavailable original bridge or an
681
+ `unknown` receipt does not prove that an earlier edit never ran. Changing the
682
+ selected instance does not redirect old receipts or retries. Inspect the original
683
+ model before deciding on a new operation.
684
+
685
+ ### Read complete results
686
+
687
+ Requested rows and parameter values are included in model-visible tool content.
688
+ Results up to 12,000 characters are complete inline. For a larger result, the Pi
689
+ extension saves the complete tool payload as UTF-8 JSON and returns `result_id`,
690
+ `file_path`, `total_chars`, `complete_inline: false`, and retrieval instructions.
691
+
692
+ Call `read_revit_result` with the returned ID and `offset: 0`, then follow each
693
+ `next_offset` until `has_more` is false. A requested fragment is at most 8,000
694
+ UTF-16 code units; it may be smaller so the escaped response stays within the
695
+ message limit. Concatenate each page's `text` in order. Individual fragments are
696
+ not standalone JSON objects from the original result. Use the returned offsets,
697
+ not byte counts or a guessed increment.
698
+
699
+ Result IDs are registered in memory by the current extension instance. After an
700
+ extension reload or new Pi process, an old ID may no longer resolve; use the
701
+ original absolute `file_path` with Pi's normal `read` tool while that file remains
702
+ available. Saved results live in a unique OS temporary directory, can contain
703
+ model data, and are subject to eventual OS/user cleanup. If saving fails after
704
+ Revit completed an operation, inspect actual model state before retrying a write.
705
+
706
+ Complete payload retrieval does not expand a tool's own query page or declared
707
+ limits. Continue `get_elements`/`get_element_types` pagination separately, and
708
+ check warning-group or projection truncation indicators. A bridge-only client
709
+ must consume `details.payload` for oversized results; `read_revit_result` belongs
710
+ to the Pi extension.
711
+
712
+ Display-name parameter filters now resolve on every element, including inside a
713
+ category/class scope. Explicit built-in IDs and shared GUIDs can retain collector
714
+ optimization. In `get_element_details`, `include.parameters` and
715
+ `include.type_parameters` are independent; disabling instance parameters still
716
+ allows a type-only result.
661
717
 
662
718
  ## Limitations — read before using on real projects
663
719
 
664
- - **Writes change the open model directly.** There is no confirmation prompt.
665
- Typed editing tools provide preview and transaction outcomes; `execute_csharp`
666
- remains unrestricted and attempts rollback after script failure. Parameter
667
- and type-change batches default to partial success, with optional atomic rollback.
668
- Transforms and deletions apply the whole selection in one step. Read the
669
- actual transaction outcome and failed lists. Script result-projection failure
670
- can leave a successful edit committed with a `returnValueError`; filesystem and
671
- UI effects are separate from model rollback.
720
+ - **Writes change the open model directly.** There is no confirmation prompt.
721
+ Typed editing tools provide preview and transaction outcomes; `execute_csharp`
722
+ remains unrestricted and attempts rollback after script failure. Parameter
723
+ and type-change batches default to partial success, with optional atomic rollback.
724
+ Transforms and deletions apply the whole selection in one step. Read the
725
+ actual transaction outcome and failed lists. Script result-projection failure
726
+ can leave a successful edit committed with a `returnValueError`; filesystem and
727
+ UI effects are separate from model rollback.
672
728
  - The add-in multi-targets .NET 8 (Revit 2025/2026) and .NET 10 (Revit 2027); `deploy.ps1`
673
729
  auto-detects the Revit versions you have installed and builds only the matching framework(s),
674
- so you only need the SDK for the Revit you run. The 0.4.0 tools were tested in bounded live
675
- workflows on Revit 2025. Revit 2026/2027 and large-model
676
- performance were not tested for this release. Export API/file checks do not
677
- establish full DWG drawing or IFC schema/geometry validation.
678
- - Pi targets one bridge session at a time. Use `manage_revit_instances` to select
679
- among reachable instances. Closing or restarting the selected bridge requires
680
- explicit selection of an available identity; model calls never fall back to another.
681
- - A tool call that outlives its timeout is abandoned client-side but may still complete inside
682
- Revit. Check its receipt with `get_revit_operation`; when retrying the identical request,
683
- reuse `_operation_id`. If its outcome remains unknown, inspect the model before a new write.
730
+ so you only need the SDK for the Revit you run. The 0.4.0 tools were tested in bounded live
731
+ workflows on Revit 2025. Revit 2026/2027 and large-model
732
+ performance were not tested for this release. Export API/file checks do not
733
+ establish full DWG drawing or IFC schema/geometry validation.
734
+ - Pi targets one bridge session at a time. Use `manage_revit_instances` to select
735
+ among reachable instances. Closing or restarting the selected bridge requires
736
+ explicit selection of an available identity; model calls never fall back to another.
737
+ - A tool call that outlives its timeout is abandoned client-side but may still complete inside
738
+ Revit. Check its receipt with `get_revit_operation`; when retrying the identical request,
739
+ reuse `_operation_id`. If its outcome remains unknown, inspect the model before a new write.
684
740
  - Long-running scripts cannot be interrupted mid-execution (Revit's API is single-threaded);
685
741
  the `execute_csharp` budget is 120s.
686
742