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.
- package/AGENTS.md +167 -0
- package/CHANGELOG.md +465 -430
- package/README.md +604 -548
- package/bin/pi-revit.js +9 -9
- package/docs/architecture.md +271 -0
- package/docs/evaluation.md +434 -0
- package/docs/invariants.json +147 -0
- package/extensions/pi-revit/completion-monitor.ts +55 -0
- package/extensions/pi-revit/contracts.ts +146 -0
- package/extensions/pi-revit/discovery.ts +93 -0
- package/extensions/pi-revit/index.ts +342 -255
- package/extensions/pi-revit/instance-router.ts +86 -86
- package/extensions/pi-revit/platform-prompt.ts +40 -0
- package/extensions/pi-revit/scope-monitor.ts +114 -0
- package/extensions/pi-revit/script-library.ts +144 -144
- package/extensions/pi-revit/tool-catalog.ts +113 -14
- package/extensions/pi-revit/tool-documentation.ts +72 -0
- package/extensions/pi-revit/tool-schema.ts +8 -0
- package/package.json +8 -2
- package/scripts/build.ps1 +9 -9
- package/scripts/check-sdk.ps1 +66 -66
- package/scripts/check-tool-documentation.mjs +287 -0
- package/scripts/deploy.ps1 +16 -16
- package/scripts/generate-contracts.mjs +80 -0
- package/scripts/lib/platform.mjs +226 -0
- package/scripts/test-extension.mjs +15 -0
- package/skills/pi-revit/SKILL.md +30 -218
- package/skills/pi-revit/contracts.generated.json +3524 -0
- package/skills/pi-revit/references/execution-rules.md +41 -0
- package/skills/pi-revit/references/model-audit-export.md +38 -27
- package/skills/pi-revit/references/operation-recovery.md +33 -0
- package/skills/pi-revit/references/room-documentation.md +37 -26
- package/skills/pi-revit/references/tool-index.md +89 -0
- package/skills/pi-revit/references/tools/capture_view.md +62 -0
- package/skills/pi-revit/references/tools/change_element_types.md +65 -0
- package/skills/pi-revit/references/tools/create_tags.md +85 -0
- package/skills/pi-revit/references/tools/delete_elements.md +66 -0
- package/skills/pi-revit/references/tools/execute_csharp.md +81 -0
- package/skills/pi-revit/references/tools/export_documents.md +75 -0
- package/skills/pi-revit/references/tools/find_revit_tools.md +96 -0
- package/skills/pi-revit/references/tools/get_element_details.md +66 -0
- package/skills/pi-revit/references/tools/get_element_relationships.md +61 -0
- package/skills/pi-revit/references/tools/get_element_types.md +67 -0
- package/skills/pi-revit/references/tools/get_elements.md +87 -0
- package/skills/pi-revit/references/tools/get_linked_elements.md +79 -0
- package/skills/pi-revit/references/tools/get_linked_models.md +57 -0
- package/skills/pi-revit/references/tools/get_model_coordinates.md +64 -0
- package/skills/pi-revit/references/tools/get_model_health.md +53 -0
- package/skills/pi-revit/references/tools/get_model_overview.md +57 -0
- package/skills/pi-revit/references/tools/get_revit_operation.md +54 -0
- package/skills/pi-revit/references/tools/get_schedule_fields.md +62 -0
- package/skills/pi-revit/references/tools/get_schedules.md +71 -0
- package/skills/pi-revit/references/tools/manage_element_sets.md +92 -0
- package/skills/pi-revit/references/tools/manage_revit_instances.md +63 -0
- package/skills/pi-revit/references/tools/manage_revit_scripts.md +109 -0
- package/skills/pi-revit/references/tools/manage_schedules.md +90 -0
- package/skills/pi-revit/references/tools/manage_selection.md +66 -0
- package/skills/pi-revit/references/tools/manage_sheet_placements.md +82 -0
- package/skills/pi-revit/references/tools/manage_sheets.md +71 -0
- package/skills/pi-revit/references/tools/manage_views.md +95 -0
- package/skills/pi-revit/references/tools/measure_geometry.md +71 -0
- package/skills/pi-revit/references/tools/open_view.md +59 -0
- package/skills/pi-revit/references/tools/ping.md +41 -0
- package/skills/pi-revit/references/tools/query_spatial_elements.md +74 -0
- package/skills/pi-revit/references/tools/read_revit_result.md +53 -0
- package/skills/pi-revit/references/tools/search_api_docs.md +65 -0
- package/skills/pi-revit/references/tools/set_parameters.md +75 -0
- package/skills/pi-revit/references/tools/summarize_elements.md +64 -0
- package/skills/pi-revit/references/tools/transform_elements.md +79 -0
- package/skills/pi-revit/references/visual-verification.md +36 -0
- package/skills/pi-revit/tool-manifest.json +338 -0
- package/src/Revit/BridgeServer.cs +93 -87
- package/src/Revit/OperationStore.cs +178 -178
- package/src/Revit/ToolRegistry.cs +88 -57
- package/src/Revit/Tools/CaptureView.cs +10 -2
- package/src/Revit/Tools/ChangeElementTypes.cs +74 -60
- package/src/Revit/Tools/ChangeSet.cs +39 -0
- package/src/Revit/Tools/CreateTags.cs +107 -95
- package/src/Revit/Tools/DeleteElements.cs +53 -44
- package/src/Revit/Tools/DocumentGuard.cs +74 -64
- package/src/Revit/Tools/ElementNames.cs +103 -0
- package/src/Revit/Tools/ElementQueryScope.cs +27 -27
- package/src/Revit/Tools/ElementTraits.cs +53 -0
- package/src/Revit/Tools/ExecuteCsharp.cs +54 -45
- package/src/Revit/Tools/ExportDocuments.cs +129 -121
- package/src/Revit/Tools/GetElementDetails.cs +37 -41
- package/src/Revit/Tools/GetElementRelationships.cs +82 -76
- package/src/Revit/Tools/GetElementTypes.cs +8 -0
- package/src/Revit/Tools/GetElements.cs +75 -86
- package/src/Revit/Tools/GetLinkedElements.cs +89 -82
- package/src/Revit/Tools/GetLinkedModels.cs +73 -66
- package/src/Revit/Tools/GetModelCoordinates.cs +56 -49
- package/src/Revit/Tools/GetModelHealth.cs +7 -0
- package/src/Revit/Tools/GetModelOverview.cs +185 -158
- package/src/Revit/Tools/GetScheduleFields.cs +44 -37
- package/src/Revit/Tools/GetSchedules.cs +96 -89
- package/src/Revit/Tools/InheritedState.Summary.cs +57 -0
- package/src/Revit/Tools/InheritedState.cs +144 -0
- package/src/Revit/Tools/ManageElementSets.cs +114 -106
- package/src/Revit/Tools/ManageSchedules.cs +174 -164
- package/src/Revit/Tools/ManageSelection.cs +45 -37
- package/src/Revit/Tools/ManageSheetPlacements.cs +113 -97
- package/src/Revit/Tools/ManageSheets.cs +72 -63
- package/src/Revit/Tools/ManageViews.cs +115 -100
- package/src/Revit/Tools/MeasureGeometry.cs +60 -54
- package/src/Revit/Tools/ModelChanges.cs +154 -0
- package/src/Revit/Tools/ModelEditBatch.cs +105 -102
- package/src/Revit/Tools/ModelEditInputs.cs +49 -49
- package/src/Revit/Tools/OpenView.cs +9 -2
- package/src/Revit/Tools/ParameterResolver.cs +94 -0
- package/src/Revit/Tools/QuerySpatialElements.cs +70 -63
- package/src/Revit/Tools/SearchApiDocs.cs +72 -4
- package/src/Revit/Tools/SetParameters.cs +60 -79
- package/src/Revit/Tools/SpatialBounds.cs +30 -30
- package/src/Revit/Tools/SummarizeElements.cs +94 -87
- package/src/Revit/Tools/ToolContract.cs +48 -0
- package/src/Revit/Tools/ToolSupport.cs +5 -1
- package/src/Revit/Tools/TransformElements.cs +72 -57
- package/workspace/AGENTS.md +26 -20
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# manage_revit_instances
|
|
2
|
+
|
|
3
|
+
## Purpose and preconditions
|
|
4
|
+
|
|
5
|
+
List reachable local Revit sessions or select the intended session for this Pi extension instance. No open document is required. Selection chooses a bridge process; it does not activate a document inside it.
|
|
6
|
+
|
|
7
|
+
<!-- generated:contract:start (npm run generate:contracts; do not edit this block) -->
|
|
8
|
+
## Contract (generated)
|
|
9
|
+
|
|
10
|
+
- **Source:** Pi extension utility, always active.
|
|
11
|
+
- **Writes model:** no. **Effects:** session. **Requires an open document:** no.
|
|
12
|
+
- **Verify the outcome:** `reread`: query the changed state again with a read tool.
|
|
13
|
+
- **Contract hash:** `68347717d8c667e6`. `find_revit_tools` compares it with the selected bridge's live contract.
|
|
14
|
+
|
|
15
|
+
| Input | Type | Required | Default | Allowed values |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `action` | string | no | | `list`, `select` |
|
|
18
|
+
| `bridge_id` | string | no | | |
|
|
19
|
+
|
|
20
|
+
| Not covered by this tool | Use instead |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| Activating a document inside a Revit session | User action: Open or activate the document in Revit |
|
|
23
|
+
<!-- generated:contract:end -->
|
|
24
|
+
|
|
25
|
+
## Public inputs and examples
|
|
26
|
+
|
|
27
|
+
| Field | Contract |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `action` | Optional `list` (default) or `select`. |
|
|
30
|
+
| `bridge_id` | Required for `select`; exact opaque 32-character lowercase hexadecimal identity returned by `list`. |
|
|
31
|
+
|
|
32
|
+
List available sessions:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{ "action": "list" }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Select one, replacing the illustrative identity with the actual returned value:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"action": "select",
|
|
43
|
+
"bridge_id": "00000000000000000000000000000001"
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
No document guard or operation-retry field applies to this utility.
|
|
48
|
+
|
|
49
|
+
## Results and effects
|
|
50
|
+
|
|
51
|
+
Listing returns `instances` with `bridge_id`, `pid`, `revit_version`, `addin_version`, `selected`, and `supports_operation_tracking`. Selection returns the selected identity/process/add-in details, instructions, and `tool_catalog_ready`. It refreshes tool discovery for the newly selected session. A false readiness value means selection can have succeeded while discovery is pending; retry [ping](ping.md), then inspect available tools.
|
|
52
|
+
|
|
53
|
+
Before initial binding, a sole reachable session binds automatically; multiple sessions require explicit selection. Once bound, the extension never silently falls back, even if only one different session remains. After closing/restarting the selected session, list again and explicitly select the intended new identity. Read `get_model_overview` afterward for a fresh exact document identity before edits.
|
|
54
|
+
|
|
55
|
+
Current bridges publish separate discovery files in `%APPDATA%\RevitBridge\instances\<bridgeId>.json`; the legacy `bridge.json` is also read. Older bridges without generation IDs receive opaque hash selectors. Copy returned selectors unchanged. One legacy file cannot independently advertise several older bridges; current add-ins are needed in those sessions for independent discovery.
|
|
56
|
+
|
|
57
|
+
## Failures, recovery, and verification
|
|
58
|
+
|
|
59
|
+
An invalid or unreachable `bridge_id` is rejected and selection stays unchanged. No automatic redirect to another model occurs. Verify selected status, `tool_catalog_ready`, and the intended model overview, not just a process title. Operation receipt reads and identical retries route to the original bridge encoded in their operation ID regardless of this selection. Selecting another session cannot recover a lost receipt or establish what happened in the original model.
|
|
60
|
+
|
|
61
|
+
## Compatibility
|
|
62
|
+
|
|
63
|
+
This is a Pi-native session utility, implemented in `extensions/pi-revit/index.ts` and `extensions/pi-revit/instance-router.ts`. Availability/operation tracking depends on the reachable add-in. Tool activation from the previous session should not be mistaken for current bridge support; inspect refreshed discovery. Session selection changes extension routing only and does not modify or save a Revit model.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# manage_revit_scripts
|
|
2
|
+
|
|
3
|
+
## Purpose and preconditions
|
|
4
|
+
|
|
5
|
+
Maintain reusable C# definitions and run an explicitly chosen immutable version. The local library is `%APPDATA%\pi-revit\scripts`, containing versions and run history. `save`, `list`, `read`, and `history` work without Revit or an open model. `run` needs the intended open document, its exact identity, and a bridge with operation receipts.
|
|
6
|
+
|
|
7
|
+
Read the exact saved source before running it. A library run has the same unrestricted model/UI/file/external effects as [execute_csharp](execute_csharp.md), including one backend-owned transaction, synchronous execution, and a 120-second budget. Saving a definition neither executes it nor saves the Revit model. There is no library preview mode or automatic model saving.
|
|
8
|
+
|
|
9
|
+
<!-- generated:contract:start (npm run generate:contracts; do not edit this block) -->
|
|
10
|
+
## Contract (generated)
|
|
11
|
+
|
|
12
|
+
- **Source:** Pi extension utility, always active.
|
|
13
|
+
- **Writes model:** yes. **Effects:** model, ui, files, external. **Requires an open document:** no.
|
|
14
|
+
- **Verify the outcome:** `reread`: query the changed state again with a read tool.
|
|
15
|
+
- **Contract hash:** `3a257b284de8dae5`. `find_revit_tools` compares it with the selected bridge's live contract.
|
|
16
|
+
|
|
17
|
+
| Input | Type | Required | Default | Allowed values |
|
|
18
|
+
| --- | --- | --- | --- | --- |
|
|
19
|
+
| `action` | string | yes | | `list`, `save`, `read`, `run`, `history` |
|
|
20
|
+
| `name` | string | no | | |
|
|
21
|
+
| `version` | string | no | | |
|
|
22
|
+
| `description` | string | no | | |
|
|
23
|
+
| `code` | string | no | | |
|
|
24
|
+
| `input_types` | object | no | | |
|
|
25
|
+
| `inputs` | object | no | | |
|
|
26
|
+
| `expected_document_id` | string | no | | |
|
|
27
|
+
| `_operation_id` | string | no | | |
|
|
28
|
+
| `offset` | integer | no | | |
|
|
29
|
+
| `limit` | integer | no | | |
|
|
30
|
+
|
|
31
|
+
| Not covered by this tool | Use instead |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| Preview or rollback of a script run | Tool: dedicated tools with preview (set_parameters, transform_elements, delete_elements, manage_views, ...) |
|
|
34
|
+
<!-- generated:contract:end -->
|
|
35
|
+
|
|
36
|
+
## Public inputs
|
|
37
|
+
|
|
38
|
+
| Field | Contract |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `action` | Required `list`, `save`, `read`, `run`, or `history`. |
|
|
41
|
+
| `name` | Required for save/read/run; optional exact filter for list/history. 1–64 lowercase letters, digits, underscores or hyphens, beginning with a letter. |
|
|
42
|
+
| `version` | Required for read/run: exact saved 64-character lowercase SHA-256 hash. There is no implicit latest version. |
|
|
43
|
+
| `description` | Required for save; string of at most 2,000 characters. |
|
|
44
|
+
| `code` | Required for save; nonblank source of at most 100,000 characters. |
|
|
45
|
+
| `input_types` | Required for save; object declaring at most 40 named inputs. Kinds: `string`, `number`, `integer`, `boolean`, `object`, `array`. |
|
|
46
|
+
| `inputs` | Object for run, defaults to `{}`; every declared input is required, undeclared inputs are rejected. Maximum 100,000 JSON characters. |
|
|
47
|
+
| `expected_document_id` | Required nonempty exact overview identity for run, even for code that only reads. |
|
|
48
|
+
| `_operation_id` | Optional for an identical retry of run; copy the original ID and preserve version, inputs, and document. Omit for new work. |
|
|
49
|
+
| `offset`, `limit` | List/history pagination: nonnegative offset default `0`; limit `1`–`100`, default `20`. |
|
|
50
|
+
|
|
51
|
+
Input names start with a letter and contain at most 64 letters, digits, or underscores. Validation checks only top-level kinds; scripts must validate nested contents, ranges, units, IDs, and domain rules. `integer` requires a safe integer; `number` requires a finite number. Inputs reach the script as a separate `System.Text.Json.JsonElement`, never as substituted source text.
|
|
52
|
+
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
Save a definition that only echoes a numeric check:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"action": "save",
|
|
60
|
+
"name": "check_number",
|
|
61
|
+
"description": "Echo a supplied number and report whether it is nonnegative.",
|
|
62
|
+
"code": "var value = inputs.GetProperty(\"value\").GetDouble(); return new { value, nonnegative = value >= 0 };",
|
|
63
|
+
"input_types": { "value": "number" }
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Read it before running. Replace the illustrative hash below with the exact `version` returned by save:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"action": "read",
|
|
72
|
+
"name": "check_number",
|
|
73
|
+
"version": "0000000000000000000000000000000000000000000000000000000000000001"
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then run that version, replacing both the hash and document placeholder with actual returned identities:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"action": "run",
|
|
82
|
+
"name": "check_number",
|
|
83
|
+
"version": "0000000000000000000000000000000000000000000000000000000000000001",
|
|
84
|
+
"expected_document_id": "<project.documentId from the intended model overview>",
|
|
85
|
+
"inputs": { "value": 12.5 }
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This source performs no model edit or save; its run still uses the normal script transaction and receipt. Inspect paged local run history:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{ "action": "history", "name": "check_number", "offset": 0, "limit": 20 }
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Results and effects
|
|
96
|
+
|
|
97
|
+
Save returns `name`, `version`, `created_at`, `file_path`, and `executed: false`. The hash covers source, description, and normalized input declarations. Saving identical content returns the same immutable definition; reads integrity-check saved content before use. Read returns the source, input declarations, and metadata. List returns versions with descriptions/input declarations and `next_offset`.
|
|
98
|
+
|
|
99
|
+
Run forwards the saved source and validated inputs to `execute_csharp`; inspect its result and receipt rather than inferring a commit from local history. History returns records newest first, including version, document identity, input hash, timestamps, run ID, and available bridge/operation receipt identifiers. It excludes raw input values/results. `prepared` is not proof of dispatch or execution, `response_received` is not proof of a successful model edit, and `outcome_unconfirmed` requires receipt inspection.
|
|
100
|
+
|
|
101
|
+
## Failures, recovery, and verification
|
|
102
|
+
|
|
103
|
+
Invalid names/hashes, altered saved content, missing inputs, extra inputs, or invalid kinds are rejected. Read and inspect another version explicitly rather than guessing latest. If local history preparation fails, do not assume a dispatch occurred; follow the reported error/receipt. If final history updating fails after a response, the returned result warns about it: use the operation receipt.
|
|
104
|
+
|
|
105
|
+
After interruption, check [get_revit_operation](get_revit_operation.md) before an identical retry with original `_operation_id`, version, document, and inputs. Client cancellation does not stop running C#. Follow [operation recovery](../operation-recovery.md) and inspect actual model/file/UI effects when uncertain. Use [visual verification](../visual-verification.md) for visible results. Library metadata and a returned response do not prove that a requested model outcome is correct.
|
|
106
|
+
|
|
107
|
+
## Compatibility
|
|
108
|
+
|
|
109
|
+
Contract source: `extensions/pi-revit/script-library.ts`, with dispatch through `extensions/pi-revit/index.ts`. Local storage operations depend on the package; run also depends on the bridge's `execute_csharp` contract and operation-tracking support. Check unfamiliar API members using [search_api_docs](search_api_docs.md) for the selected Revit version before saving/running code.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# manage_schedules
|
|
2
|
+
|
|
3
|
+
## Purpose and boundaries
|
|
4
|
+
|
|
5
|
+
Create or configure a regular schedule as one atomic model-edit step. Templates, titleblock revision schedules, embedded schedules, and calculated/combined-field authoring are outside this tool. Use `get_schedules` to inspect definitions and displayed cells, `get_schedule_fields` to discover eligible additions, and `manage_sheet_placements` for sheet layout.
|
|
6
|
+
|
|
7
|
+
Contract: PI-Revit 0.5.0 source, [ManageSchedules.cs](../../../../src/Revit/Tools/ManageSchedules.cs). Activate this advanced tool through `find_revit_tools`. The public schema is authoritative; this page documents source behavior, not a live-model test.
|
|
8
|
+
|
|
9
|
+
<!-- generated:contract:start (npm run generate:contracts; do not edit this block) -->
|
|
10
|
+
## Contract (generated)
|
|
11
|
+
|
|
12
|
+
- **Source:** bridge tool, advanced tier: activate it with `find_revit_tools`.
|
|
13
|
+
- **Writes model:** yes. **Effects:** model. **Requires an open document:** yes.
|
|
14
|
+
- **Works in:** project documents only; the bridge refuses other documents before running, with the route to use instead.
|
|
15
|
+
- **Verify the outcome:** `reread`: query the changed state again with a read tool.
|
|
16
|
+
- **Contract hash:** `d713a59aeac1e65c`. `find_revit_tools` compares it with the selected bridge's live contract.
|
|
17
|
+
|
|
18
|
+
| Input | Type | Required | Default | Allowed values |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| `action` | string | yes | | `create`, `configure` |
|
|
21
|
+
| `schedule_id` | integer | no | | |
|
|
22
|
+
| `category` | string | no | | |
|
|
23
|
+
| `name` | string | no | | |
|
|
24
|
+
| `area_scheme_id` | integer | no | | |
|
|
25
|
+
| `is_itemized` | boolean | no | | |
|
|
26
|
+
| `preview` | boolean | no | | |
|
|
27
|
+
| `add_fields` | array of object | no | | |
|
|
28
|
+
| `update_fields` | array of object | no | | |
|
|
29
|
+
| `sort_fields` | array of object | no | | |
|
|
30
|
+
| `filters` | array of object | no | | |
|
|
31
|
+
| `expected_document_id` | string | yes | | |
|
|
32
|
+
|
|
33
|
+
Bridge calls also accept `_operation_id`, only to retry an identical earlier request (see [operation recovery](../operation-recovery.md)).
|
|
34
|
+
|
|
35
|
+
| Not covered by this tool | Use instead |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| Calculated (formula) fields | Not offered by the Revit API (Revit 2025 API exposes ScheduleFieldType.Formula but no member to author a formula). Report this with the evidence checked. |
|
|
38
|
+
| Combined-parameter fields | Revit API: ScheduleDefinition.InsertCombinedParameterField. Check all its members in one call: `search_api_docs` with query `ScheduleDefinition.InsertCombinedParameterField`, then use `execute_csharp` within the requested scope. |
|
|
39
|
+
| Schedule templates, titleblock revision schedules and embedded schedules | Revit API: ViewSchedule and ScheduleDefinition members; verify with search_api_docs. Check all its members in one call: `search_api_docs` with query `ViewSchedule; ScheduleDefinition`, then use `execute_csharp` within the requested scope. |
|
|
40
|
+
| Placing a schedule on a sheet | Tool: manage_sheet_placements |
|
|
41
|
+
<!-- generated:contract:end -->
|
|
42
|
+
|
|
43
|
+
## Inputs and preconditions
|
|
44
|
+
|
|
45
|
+
Follow [execution rules](../execution-rules.md). There are two different field identities: eligible additions use `parameter_id` plus case-sensitive `field_type`; existing schedule fields use schedule-local `field_id`. Never infer either from a column position.
|
|
46
|
+
|
|
47
|
+
| Input | Meaning |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| `action` | Required: `create` or `configure`. |
|
|
50
|
+
| `category`, `name` | Both required for creation. Category is a supported category name/enum; optional nonempty `name` can rename during configure. A name another schedule already uses is rejected with `name_collision` and that schedule's ID; do not edit or rename the existing schedule unless the user asks. |
|
|
51
|
+
| `area_scheme_id` | Creation-only option for area schedules. Category and area scheme are rejected during configure. |
|
|
52
|
+
| `schedule_id` | Required existing regular schedule ID for configure. |
|
|
53
|
+
| `is_itemized` | Optional boolean controlling whether instances remain separate. |
|
|
54
|
+
| `add_fields` | At most 50 objects with required `field_type`, usually `parameter_id`, and optional `heading`, `hidden`, `width`, `unit`. |
|
|
55
|
+
| `update_fields` | At most 50 objects with required actual `field_id`, and optional `heading`, `hidden`, `width`, `unit`. Duplicate update IDs are rejected. |
|
|
56
|
+
| `sort_fields` | At most 4 objects with `field_id`, optional `descending` and `show_header` (both default false). Replaces the whole sort list when supplied. |
|
|
57
|
+
| `filters` | At most 8 objects, described below. Replaces the whole filter list when supplied. |
|
|
58
|
+
| `preview` | Default `false`; commit-validates then rolls back model changes. |
|
|
59
|
+
| `expected_document_id` | Required for create/configure, including previews; exact current overview identity. |
|
|
60
|
+
| `_operation_id` | Optional extension argument only for an identical retry. Omit for a new operation. |
|
|
61
|
+
|
|
62
|
+
Omit `sort_fields` or `filters` to preserve the existing list; `[]` explicitly clears it. A positive field `width` requires a length `unit` (`millimeters`, `centimeters`, `meters`, `feet`, or `inches`) and updates grid and sheet widths together.
|
|
63
|
+
|
|
64
|
+
For additions, pass a returned eligible `parameter_id`/`field_type` pair unchanged, including negative built-in parameter IDs. Count also supports `{ "field_type": "Count" }` without a parameter ID. If a Count pair is supplied it must be eligible; never guess its ID. Discover on a committed schedule, add fields, then reread the committed fields before writing sort/filter rules. Newly created schedule IDs and added field IDs from previews cannot be reused.
|
|
65
|
+
|
|
66
|
+
Each filter requires `field_id`, `comparison` (`equals`, `not_equals`, `contains`, `greater_than`, `less_than`), `value_type` (`string`, `number`, `integer`, `element_id`), and a matching `value`. Measured `number` filters require an explicit unit compatible with the field specification, such as `meters` or `squareMeters`; omit units for unitless numbers. Use `get_schedules` metadata `spec_type_id`, `can_filter_value`, and `can_filter_substring` to inspect capabilities. Read results express numeric filter values in internal units and comparisons as Revit enum names, not the write strings above.
|
|
67
|
+
|
|
68
|
+
## Example
|
|
69
|
+
|
|
70
|
+
Create a preview with a Count field; this does not guess any parameter ID. Use a valid unique name for the intended document.
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"action": "create",
|
|
75
|
+
"category": "OST_Walls",
|
|
76
|
+
"name": "Wall count review",
|
|
77
|
+
"is_itemized": false,
|
|
78
|
+
"add_fields": [{ "field_type": "Count", "heading": "Count", "width": 25, "unit": "millimeters" }],
|
|
79
|
+
"preview": true,
|
|
80
|
+
"expected_document_id": "<project.documentId>"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Results, recovery and verification
|
|
85
|
+
|
|
86
|
+
Inspect `committed`, `succeeded`, `proposed`, `failed`, `commitWarnings`, and `commit_validation_performed`. The single step returns schedule ID/unique ID/name, `created`, `id_is_temporary`, `added_field_ids`, `added_field_ids_are_temporary`, itemization, and field/filter/sort counts. Any rejected property rolls back this whole step.
|
|
87
|
+
|
|
88
|
+
Read the committed definition and all required body row/column pages through `get_schedules`. Returned grid/sheet widths use feet. Body rows may be headings, groups, or totals; their row indices are not element IDs. To check layout, place the committed schedule on a sheet within the task scope and follow [visual verification](../visual-verification.md); standalone schedules cannot be captured by `capture_view`.
|
|
89
|
+
|
|
90
|
+
Follow [operation recovery](../operation-recovery.md) for uncertain outcomes. A real edit after preview needs a new operation ID. This tool does not save or export the model.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# manage_selection
|
|
2
|
+
|
|
3
|
+
## Purpose and boundaries
|
|
4
|
+
|
|
5
|
+
Read or change Revit's host-element selection, zoom to elements, or apply Temporary Hide/Isolate in the active view. Query with `get_elements` first, then pass returned IDs; selection has no inline element filter. Linked element IDs are not host IDs.
|
|
6
|
+
|
|
7
|
+
Contract: PI-Revit 0.5.0 source, [ManageSelection.cs](../../../../src/Revit/Tools/ManageSelection.cs) and [DocumentGuard.cs](../../../../src/Revit/Tools/DocumentGuard.cs). The current public schema is authoritative. This page documents source behavior, not a live-model test.
|
|
8
|
+
|
|
9
|
+
<!-- generated:contract:start (npm run generate:contracts; do not edit this block) -->
|
|
10
|
+
## Contract (generated)
|
|
11
|
+
|
|
12
|
+
- **Source:** bridge tool, core tier: active by default.
|
|
13
|
+
- **Writes model:** no. **Effects:** ui, model. **Requires an open document:** yes.
|
|
14
|
+
- **Works in:** project and family documents.
|
|
15
|
+
- **Verify the outcome:** `reread`: query the changed state again with a read tool.
|
|
16
|
+
- **Contract hash:** `0108ff205d518aaa`. `find_revit_tools` compares it with the selected bridge's live contract.
|
|
17
|
+
|
|
18
|
+
| Input | Type | Required | Default | Allowed values |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| `action` | string | no | | `get`, `set`, `add`, `remove`, `clear`, `zoom` |
|
|
21
|
+
| `element_ids` | array of integer | no | | |
|
|
22
|
+
| `isolate_in_view` | boolean | no | | |
|
|
23
|
+
| `expected_document_id` | string | no | | |
|
|
24
|
+
|
|
25
|
+
Bridge calls also accept `_operation_id`, only to retry an identical earlier request (see [operation recovery](../operation-recovery.md)).
|
|
26
|
+
|
|
27
|
+
| Not covered by this tool | Use instead |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Permanent hiding or view visibility changes | Revit API: View.HideElements; View.SetCategoryHidden. Check all its members in one call: `search_api_docs` with query `View.HideElements; View.SetCategoryHidden`, then use `execute_csharp` within the requested scope. |
|
|
30
|
+
| Saved selection sets | Revit API: SelectionFilterElement.Create. Check all its members in one call: `search_api_docs` with query `SelectionFilterElement.Create`, then use `execute_csharp` within the requested scope. |
|
|
31
|
+
<!-- generated:contract:end -->
|
|
32
|
+
|
|
33
|
+
## Inputs and preconditions
|
|
34
|
+
|
|
35
|
+
| Input | Meaning |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `action` | `get` (default), `set`, `add`, `remove`, `clear`, or `zoom`. |
|
|
38
|
+
| `element_ids` | Host element IDs. Required and nonempty for `set`/`add`/`remove`. Zoom uses them when supplied; otherwise it uses the current nonempty selection. Use `clear` to empty selection. |
|
|
39
|
+
| `isolate_in_view` | Default `false`. Temporarily isolates the resulting selection or zoom targets. An empty target set resets Temporary Hide/Isolate. Requires an active graphical view. |
|
|
40
|
+
| `expected_document_id` | Optional in the public schema and for plain `get`, but required at execution for every non-`get` action and whenever `isolate_in_view: true`, including with `get`. A supplied identity is always checked. |
|
|
41
|
+
| `_operation_id` | Optional extension argument only for an identical retry. Omit for a new operation. |
|
|
42
|
+
|
|
43
|
+
Read [execution rules](../execution-rules.md) for document targeting. Use `get` when the user refers to the current selection. Invalid IDs are reported in `not_found` if valid IDs remain; a request containing IDs but no valid targets fails. Duplicate IDs are resolved once.
|
|
44
|
+
|
|
45
|
+
## Example
|
|
46
|
+
|
|
47
|
+
Illustrative IDs must be replaced with discovered host IDs. The identity is copied unchanged from the intended model's overview.
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"action": "set",
|
|
52
|
+
"element_ids": [12345, 12346],
|
|
53
|
+
"isolate_in_view": true,
|
|
54
|
+
"expected_document_id": "<project.documentId>"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
To reset isolation explicitly, use `action: "clear"` with `isolate_in_view: true` and the exact identity; this also clears selection.
|
|
59
|
+
|
|
60
|
+
## Results, effects and recovery
|
|
61
|
+
|
|
62
|
+
`get` returns `count` and element identities. Changes return `selectedCount`; zoom returns `shownCount`. Isolation reports `viewId`, `viewName`, `isolatedCount` or `temporaryIsolateReset`, and any `commitWarnings`.
|
|
63
|
+
|
|
64
|
+
Selection and zoom alter UI state. Isolation changes temporary view state through a small internal transaction. The tool is read-classified but declares possible `ui` and `model` effects; classification is not permission to mutate. There is no `preview` or all-or-nothing contract covering selection plus isolation. Selection/zoom may already have completed when isolation fails; those effects are not rolled back.
|
|
65
|
+
|
|
66
|
+
Read selection again or inspect the actual view to verify the requested result; use [visual verification](../visual-verification.md) for visible focus/isolation outcomes. For an uncertain result, follow [operation recovery](../operation-recovery.md) and inspect existing UI state before repeating. This does not save the model.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# manage_sheet_placements
|
|
2
|
+
|
|
3
|
+
## Purpose and boundaries
|
|
4
|
+
|
|
5
|
+
List, place, or move viewports and schedule instances on a drawing sheet. This tool positions existing committed views; it does not create the source view or schedule. Coordinates are paper-space sheet coordinates, never multiplied by view scale.
|
|
6
|
+
|
|
7
|
+
Contract: PI-Revit 0.5.0 source, [ManageSheetPlacements.cs](../../../../src/Revit/Tools/ManageSheetPlacements.cs). Activate this advanced tool through `find_revit_tools`. The public schema is authoritative; this page documents source behavior, not a live-model test.
|
|
8
|
+
|
|
9
|
+
<!-- generated:contract:start (npm run generate:contracts; do not edit this block) -->
|
|
10
|
+
## Contract (generated)
|
|
11
|
+
|
|
12
|
+
- **Source:** bridge tool, advanced tier: activate it with `find_revit_tools`.
|
|
13
|
+
- **Writes model:** yes. **Effects:** model. **Requires an open document:** yes.
|
|
14
|
+
- **Works in:** project documents only; the bridge refuses other documents before running, with the route to use instead.
|
|
15
|
+
- **Verify the outcome:** `capture`: capture the visible result and inspect the image.
|
|
16
|
+
- **Contract hash:** `1d9fd57c25d68159`. `find_revit_tools` compares it with the selected bridge's live contract.
|
|
17
|
+
|
|
18
|
+
| Input | Type | Required | Default | Allowed values |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| `action` | string | yes | | `list`, `place`, `move` |
|
|
21
|
+
| `sheet_id` | integer | no | | |
|
|
22
|
+
| `view_id` | integer | no | | |
|
|
23
|
+
| `placement_id` | integer | no | | |
|
|
24
|
+
| `position` | array of number | no | | |
|
|
25
|
+
| `unit` | string | no | | `millimeters`, `centimeters`, `meters`, `feet`, `inches` |
|
|
26
|
+
| `rotation` | string | no | | `none`, `clockwise`, `counterclockwise` |
|
|
27
|
+
| `offset` | integer | no | | |
|
|
28
|
+
| `limit` | integer | no | | |
|
|
29
|
+
| `preview` | boolean | no | | |
|
|
30
|
+
| `expected_document_id` | string | yes | | |
|
|
31
|
+
|
|
32
|
+
Bridge calls also accept `_operation_id`, only to retry an identical earlier request (see [operation recovery](../operation-recovery.md)).
|
|
33
|
+
|
|
34
|
+
| Not covered by this tool | Use instead |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| Creating the source view or schedule | Tool: manage_views; manage_schedules |
|
|
37
|
+
| Rotating schedule instances | Revit API: ScheduleSheetInstance.Rotation. Check all its members in one call: `search_api_docs` with query `ScheduleSheetInstance.Rotation`, then use `execute_csharp` within the requested scope. |
|
|
38
|
+
| Changing the titleblock | Tool: change_element_types on the titleblock instance |
|
|
39
|
+
<!-- generated:contract:end -->
|
|
40
|
+
|
|
41
|
+
## Inputs and preconditions
|
|
42
|
+
|
|
43
|
+
Follow [execution rules](../execution-rules.md); discover the intended sheet, source view/schedule, and current placements first.
|
|
44
|
+
|
|
45
|
+
| Input | Meaning |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `action` | Required: `list`, `place`, or `move`. |
|
|
48
|
+
| `sheet_id` | Required for list/place. Optional for move as an extra check that the placement belongs to that sheet. |
|
|
49
|
+
| `view_id` | Required for place: committed view or schedule ID. |
|
|
50
|
+
| `placement_id` | Required for move: existing viewport or schedule-instance ID, not its source view ID. |
|
|
51
|
+
| `position`, `unit` | Required for place/move: finite `[x,y,0]` in explicit `millimeters`, `centimeters`, `meters`, `feet`, or `inches`. |
|
|
52
|
+
| `rotation` | Optional viewport-only `none`, `clockwise`, or `counterclockwise`. Omit entirely for schedules, including when no rotation is intended. |
|
|
53
|
+
| `offset`, `limit` | List paging: nonnegative offset; limit default 100, range 1–200. |
|
|
54
|
+
| `preview` | Edit default `false`; commit-validates then rolls back. List does not perform a preview/edit. |
|
|
55
|
+
| `expected_document_id` | Required for every action, including `list`, because the tool is write-capable. Copy the intended model's current overview identity. |
|
|
56
|
+
| `_operation_id` | Optional extension argument only for an identical retry. Omit for a new operation. |
|
|
57
|
+
|
|
58
|
+
A viewport position is its box center excluding the label; a schedule position is its insertion point. Z must be zero. Pinned placements cannot be moved. Placeholder sheets cannot receive content. Revit validates view/schedule eligibility and can reject a view already placed elsewhere.
|
|
59
|
+
|
|
60
|
+
## Example
|
|
61
|
+
|
|
62
|
+
Illustrative sheet and source view IDs must be replaced with actual committed IDs. This previews placement at paper-space coordinates.
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"action": "place",
|
|
67
|
+
"sheet_id": 23456,
|
|
68
|
+
"view_id": 34567,
|
|
69
|
+
"position": [200, 150, 0],
|
|
70
|
+
"unit": "millimeters",
|
|
71
|
+
"preview": true,
|
|
72
|
+
"expected_document_id": "<project.documentId>"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Results, recovery and verification
|
|
77
|
+
|
|
78
|
+
List returns `total_count`, `counts`, `returned_count`, `next_offset`, and `placements`; follow all pages. `counts` covers the whole sheet: `viewports`, `schedules`, and `titleblock_revision_schedules`. A titleblock revision schedule is part of the titleblock family, not content anyone placed, so it has its own `kind: "titleblock_revision_schedule"` and cannot be moved. A sheet with no views or schedules placed has zero `viewports` and `schedules`, even if its titleblock shows a revision schedule. <!-- inv:special-objects-flagged --> Placement descriptions include IDs, `kind`, sheet/source IDs, position, `position_kind`, and `traits` where applicable. Returned positions always use feet; viewport rotation returns Revit enum names.
|
|
79
|
+
|
|
80
|
+
Edits return common transaction fields: `committed`, `succeeded`, `proposed`, `failed`, `commitWarnings`, `commit_validation_performed`. The step contains `before`, `placement`, `created`, and `id_is_temporary`. Each edit is one step; failure rolls it back. New placement IDs from preview are temporary and must not be reused.
|
|
81
|
+
|
|
82
|
+
Reread placements and follow [visual verification](../visual-verification.md): inspect the actual sheet, labels, schedule extents, margins, and overlaps. Position values alone do not establish a readable layout. Follow [operation recovery](../operation-recovery.md) before repeating an uncertain placement. This does not save or export the model.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# manage_sheets
|
|
2
|
+
|
|
3
|
+
## Purpose and boundaries
|
|
4
|
+
|
|
5
|
+
Create a drawing sheet or update its name/number. Use `manage_sheet_placements` to place or move views and schedules; `get_elements` to inspect sheets; `open_view` to activate a committed sheet; and `delete_elements` for removal.
|
|
6
|
+
|
|
7
|
+
Contract: PI-Revit 0.5.0 source, [ManageSheets.cs](../../../../src/Revit/Tools/ManageSheets.cs). Activate this advanced tool through `find_revit_tools`. The public schema is authoritative; this page documents source behavior, not a live-model test.
|
|
8
|
+
|
|
9
|
+
<!-- generated:contract:start (npm run generate:contracts; do not edit this block) -->
|
|
10
|
+
## Contract (generated)
|
|
11
|
+
|
|
12
|
+
- **Source:** bridge tool, advanced tier: activate it with `find_revit_tools`.
|
|
13
|
+
- **Writes model:** yes. **Effects:** model. **Requires an open document:** yes.
|
|
14
|
+
- **Works in:** project documents only; the bridge refuses other documents before running, with the route to use instead.
|
|
15
|
+
- **Verify the outcome:** `reread`: query the changed state again with a read tool.
|
|
16
|
+
- **Contract hash:** `6e201549acd231ea`. `find_revit_tools` compares it with the selected bridge's live contract.
|
|
17
|
+
|
|
18
|
+
| Input | Type | Required | Default | Allowed values |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| `action` | string | yes | | `create`, `update` |
|
|
21
|
+
| `sheet_id` | integer | no | | |
|
|
22
|
+
| `name` | string | no | | |
|
|
23
|
+
| `number` | string | no | | |
|
|
24
|
+
| `titleblock_type_id` | integer | no | | |
|
|
25
|
+
| `preview` | boolean | no | | |
|
|
26
|
+
| `expected_document_id` | string | yes | | |
|
|
27
|
+
|
|
28
|
+
Bridge calls also accept `_operation_id`, only to retry an identical earlier request (see [operation recovery](../operation-recovery.md)).
|
|
29
|
+
|
|
30
|
+
| Not covered by this tool | Use instead |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| Placing views or schedules on a sheet | Tool: manage_sheet_placements |
|
|
33
|
+
| Revisions and revision clouds | Revit API: Revision.Create; RevisionCloud.Create. Check all its members in one call: `search_api_docs` with query `Revision.Create; RevisionCloud.Create`, then use `execute_csharp` within the requested scope. |
|
|
34
|
+
| Deleting sheets | Tool: delete_elements |
|
|
35
|
+
<!-- generated:contract:end -->
|
|
36
|
+
|
|
37
|
+
## Inputs and preconditions
|
|
38
|
+
|
|
39
|
+
| Input | Meaning |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `action` | Required: `create` or `update`. |
|
|
42
|
+
| `name`, `number` | Both required nonempty strings for creation; individually optional for update. Revit validates text; sheet names may repeat. A number another sheet already uses is rejected before Revit is asked: the failed row carries `name_collision` with that sheet's ID. That sheet predates the call; do not renumber or edit it to free the number unless the user asks. |
|
|
43
|
+
| `sheet_id` | Required existing sheet ID for update. |
|
|
44
|
+
| `titleblock_type_id` | Creation only: loaded titleblock `FamilySymbol`. Omission creates a sheet without a titleblock. Rejected for update. |
|
|
45
|
+
| `preview` | Default `false`; commit-validates then rolls back the model changes. |
|
|
46
|
+
| `expected_document_id` | Required for all calls, including previews; exact current `project.documentId`. |
|
|
47
|
+
| `_operation_id` | Optional extension argument only for an identical retry. Omit for a new operation. |
|
|
48
|
+
|
|
49
|
+
Follow [execution rules](../execution-rules.md). Discover loaded titleblock types with `get_element_types`, category `OST_TitleBlocks`. To change an existing titleblock type, identify its instance and call `change_element_types`; do not pass a type override to sheet update.
|
|
50
|
+
|
|
51
|
+
## Example
|
|
52
|
+
|
|
53
|
+
The example intentionally creates a sheet without a titleblock; discover and add `titleblock_type_id` when the task needs one. The number must be available in the intended model.
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"action": "create",
|
|
58
|
+
"name": "Room documentation",
|
|
59
|
+
"number": "A-901",
|
|
60
|
+
"preview": true,
|
|
61
|
+
"expected_document_id": "<project.documentId>"
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Results, recovery and verification
|
|
66
|
+
|
|
67
|
+
Inspect `committed`, `succeeded`, `proposed`, `failed`, `commitWarnings`, and `commit_validation_performed`. One step contains `before` where relevant, `sheet` (ID, unique ID, name, number, placeholder state), `created`, and `id_is_temporary`.
|
|
68
|
+
|
|
69
|
+
All properties are part of the same step, so a rejected number/name/titleblock rolls that step back. Preview-created sheet IDs are temporary and cannot be used for placements. Use the committed ID, verify name/number/titleblock, and follow [visual verification](../visual-verification.md) for the actual sheet layout.
|
|
70
|
+
|
|
71
|
+
Follow [operation recovery](../operation-recovery.md) after an uncertain outcome. A real creation after preview is a new operation. This tool neither saves the model nor exports the sheet; those actions need to be within the user's requested scope.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# manage_views
|
|
2
|
+
|
|
3
|
+
## Purpose and boundaries
|
|
4
|
+
|
|
5
|
+
Create plan, isometric 3D, or section views; duplicate a view; or update its name, scale, and template. Each call is one model-edit step. Use `get_elements` to query views, `open_view` to activate a committed view, and `delete_elements` to remove one.
|
|
6
|
+
|
|
7
|
+
Contract: PI-Revit 0.5.0 source, [ManageViews.cs](../../../../src/Revit/Tools/ManageViews.cs). Activate this advanced tool through `find_revit_tools`. The public schema is authoritative; this page documents source behavior, not a live-model test.
|
|
8
|
+
|
|
9
|
+
<!-- generated:contract:start (npm run generate:contracts; do not edit this block) -->
|
|
10
|
+
## Contract (generated)
|
|
11
|
+
|
|
12
|
+
- **Source:** bridge tool, advanced tier: activate it with `find_revit_tools`.
|
|
13
|
+
- **Writes model:** yes. **Effects:** model. **Requires an open document:** yes.
|
|
14
|
+
- **Works in:** project and family documents.
|
|
15
|
+
- **Verify the outcome:** `capture`: capture the visible result and inspect the image.
|
|
16
|
+
- **Contract hash:** `a8633ed43c6fb869`. `find_revit_tools` compares it with the selected bridge's live contract.
|
|
17
|
+
|
|
18
|
+
| Input | Type | Required | Default | Allowed values |
|
|
19
|
+
| --- | --- | --- | --- | --- |
|
|
20
|
+
| `action` | string | yes | | `create_plan`, `create_3d`, `create_section`, `duplicate`, `update` |
|
|
21
|
+
| `view_id` | integer | no | | |
|
|
22
|
+
| `view_family_type_id` | integer | no | | |
|
|
23
|
+
| `level_id` | integer | no | | |
|
|
24
|
+
| `duplicate_option` | string | no | | `duplicate`, `with_detailing`, `dependent` |
|
|
25
|
+
| `name` | string | no | | |
|
|
26
|
+
| `scale` | integer | no | | |
|
|
27
|
+
| `view_template_id` | integer | no | | |
|
|
28
|
+
| `unit` | string | no | | `millimeters`, `centimeters`, `meters`, `feet`, `inches` |
|
|
29
|
+
| `origin` | array of number | no | | |
|
|
30
|
+
| `viewing_direction` | array of number | no | | |
|
|
31
|
+
| `up` | array of number | no | | |
|
|
32
|
+
| `width` | number | no | | |
|
|
33
|
+
| `height` | number | no | | |
|
|
34
|
+
| `depth` | number | no | | |
|
|
35
|
+
| `preview` | boolean | no | | |
|
|
36
|
+
| `expected_document_id` | string | yes | | |
|
|
37
|
+
|
|
38
|
+
Bridge calls also accept `_operation_id`, only to retry an identical earlier request (see [operation recovery](../operation-recovery.md)).
|
|
39
|
+
|
|
40
|
+
| Not covered by this tool | Use instead |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| Perspective (camera) 3D views | Revit API: View3D.CreatePerspective; ViewOrientation3D. Check all its members in one call: `search_api_docs` with query `View3D.CreatePerspective; ViewOrientation3D`, then use `execute_csharp` within the requested scope. |
|
|
43
|
+
| Elevation, drafting and legend views | Revit API: ElevationMarker.CreateElevationMarker; ViewDrafting.Create. Check all its members in one call: `search_api_docs` with query `ElevationMarker.CreateElevationMarker; ViewDrafting.Create`, then use `execute_csharp` within the requested scope. |
|
|
44
|
+
| View visibility and graphics (hiding, overrides, crop regions) | Revit API: View.SetCategoryHidden; View.HideElements; View.SetElementOverrides; View.CropBox. Check all its members in one call: `search_api_docs` with query `View.SetCategoryHidden; View.HideElements; View.SetElementOverrides; View.CropBox`, then use `execute_csharp` within the requested scope. |
|
|
45
|
+
| Deleting views | Tool: delete_elements |
|
|
46
|
+
<!-- generated:contract:end -->
|
|
47
|
+
|
|
48
|
+
## Inputs and preconditions
|
|
49
|
+
|
|
50
|
+
Follow [execution rules](../execution-rules.md). Discover compatible `ViewFamilyType` IDs using `get_element_types` with `of_class: "ViewFamilyType"`; find level and existing view IDs with `get_elements`.
|
|
51
|
+
|
|
52
|
+
| Input | Meaning |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `action` | Required: `create_plan`, `create_3d`, `create_section`, `duplicate`, or `update`. |
|
|
55
|
+
| `view_family_type_id` | Compatible positive type ID, required for creation actions. A 3D view is isometric. |
|
|
56
|
+
| `level_id` | Required positive level ID for `create_plan`. |
|
|
57
|
+
| `view_id` | Required positive existing view ID for duplicate/update. |
|
|
58
|
+
| `duplicate_option` | `duplicate` (default), `with_detailing`, or `dependent`; the view must support the selected option. |
|
|
59
|
+
| `name` | Optional nonempty view name, applied in the same step. A name another view of the same type already uses is rejected: the failed row carries `name_collision` with the existing view's ID, and nothing is renamed or created. |
|
|
60
|
+
| `scale` | Optional integer 1–24000; rejected when unavailable or controlled by the view template. |
|
|
61
|
+
| `view_template_id` | Optional compatible template ID, or `-1` to intentionally remove a template. The tool does not remove a template implicitly to change scale. |
|
|
62
|
+
| `unit`, `origin`, `viewing_direction`, `up`, `width`, `height`, `depth` | Required for a section; details below. |
|
|
63
|
+
| `preview` | Default `false`; commit-validates then rolls back the model changes. |
|
|
64
|
+
| `expected_document_id` | Required for all calls, including previews; exact current overview identity. |
|
|
65
|
+
| `_operation_id` | Optional extension argument only for an identical retry. Omit for a new operation. |
|
|
66
|
+
|
|
67
|
+
A section uses document internal coordinates. `unit` is `millimeters`, `centimeters`, `meters`, `feet`, or `inches`; it applies to finite `[x,y,z]` `origin` and all dimensions. `viewing_direction` and `up` are nonzero, orthogonal dimensionless vectors. Width/height extend symmetrically around the origin; depth extends along the viewing direction. Dimensions must be positive and exceed 0.000001 feet after conversion. These are model coordinates, not sheet placement coordinates.
|
|
68
|
+
|
|
69
|
+
## Example
|
|
70
|
+
|
|
71
|
+
IDs `34567` and `45678` are illustrative; discover the compatible plan type and level first.
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"action": "create_plan",
|
|
76
|
+
"view_family_type_id": 34567,
|
|
77
|
+
"level_id": 45678,
|
|
78
|
+
"name": "Room review plan",
|
|
79
|
+
"scale": 50,
|
|
80
|
+
"preview": true,
|
|
81
|
+
"expected_document_id": "<project.documentId>"
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Results, recovery and verification
|
|
86
|
+
|
|
87
|
+
Inspect `committed`, `succeeded`, `proposed`, `failed`, `commitWarnings`, and `commit_validation_performed`. The step returns `before` where relevant, a `view` description (ID, unique ID, name, type, template, scale), `created`, and `id_is_temporary`.
|
|
88
|
+
|
|
89
|
+
A duplicate carries its source's visibility and graphics. Its row reports `inherited_state`: `derived_from`, `template`, `hidden_categories` (`OST_` identity and localized name), `hidden_elements` (count, sample IDs, whether the bounded scan completed), `filters` with their visibility, element and category override counts, and display settings. Compare it with the request before reporting: unhide what the request asks to show (View.UnhideElements, View.SetCategoryHidden through the API route), or disclose what stays hidden. The result's `model_changes` lists what the call added and modified.
|
|
90
|
+
|
|
91
|
+
A `name_collision` means the named view existed before this call. Do not edit, rename, reuse or delete it to get past the collision; ask the user, or choose a distinct name and report the collision.
|
|
92
|
+
|
|
93
|
+
Created/duplicated preview IDs are temporary; never use them in a later tag, placement, or capture call. Commit first and use the committed ID. A failure in name, template, scale, or creation rolls back the single step. Read back the committed view settings and use [visual verification](../visual-verification.md) to inspect framing, orientation, crop, and readability.
|
|
94
|
+
|
|
95
|
+
Follow [operation recovery](../operation-recovery.md) for an uncertain outcome. A real creation after a preview uses a new operation ID. Creating a view does not activate it or save the model.
|