pi-revit 0.2.16 → 0.2.17

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/CHANGELOG.md CHANGED
@@ -7,6 +7,24 @@ Format follows [Keep a Changelog](https://keepachangelog.com/); version headers
7
7
  Every published version gets an entry with **Added** / **Changed** / **Fixed** sections
8
8
  describing what the user will notice — not internal refactors.
9
9
 
10
+ ## [0.2.17] - 2026-08-21
11
+
12
+ ### Fixed
13
+ - The bridge's no-document check no longer counts linked documents. With only links
14
+ loaded, Revit does not pump the bridge's work queue, so a call could wait out its full
15
+ timeout instead of failing immediately with the clean "no active document" answer.
16
+
17
+ ### Changed
18
+ - Docs and tool descriptions describe localized parameter names generically instead of
19
+ quoting specific languages.
20
+ - The full search_api_docs benchmark (641 live queries against RevitAPI.xml ground truth)
21
+ was re-run on Revit 2025 at 0.2.16: 100% recall, 98.75% top-1 on exact names, 100%
22
+ spacing-variant agreement, 0 false positives across 99 adversarial mutations, 50/50
23
+ parameter docs, p50 10 ms -- no regression across the 0.2.13-0.2.16 search changes.
24
+
25
+ Requires redeploying the Revit add-in (`scripts\deploy.ps1` with Revit closed, then
26
+ restart Revit).
27
+
10
28
  ## [0.2.16] - 2026-08-21
11
29
 
12
30
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-revit",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "Native Pi connector for Autodesk Revit. Run npx.cmd -y pi-revit for the full Windows install.",
5
5
  "author": "Ahmad Altahlawi",
6
6
  "license": "MIT",
@@ -26,7 +26,8 @@
26
26
  "scripts": {
27
27
  "deploy": "powershell -ExecutionPolicy Bypass -File scripts/deploy.ps1",
28
28
  "setup": "powershell -ExecutionPolicy Bypass -File scripts/setup-workspace.ps1",
29
- "uninstall:revit": "powershell -ExecutionPolicy Bypass -File scripts/uninstall.ps1"
29
+ "uninstall:revit": "powershell -ExecutionPolicy Bypass -File scripts/uninstall.ps1",
30
+ "test:search": "dotnet run --project tests/search-engine"
30
31
  },
31
32
  "files": [
32
33
  "bin/",
@@ -31,7 +31,7 @@ Workflow guidance:
31
31
  - `get_elements` is the listing/counting primitive (`count_only: true` for bare counts). It returns identity fields only (id, name, category, typeName, levelId); read parameter values with `get_element_details`. Prefer a `category` or `of_class` scope when filtering by a parameter's display name.
32
32
  - The selection pipeline is `get_elements` -> ids -> `manage_selection` (action `set`); there is no inline filter on selection.
33
33
  - `set_parameters` is the home for bulk parameter writes AND renames (the `Name` parameter covers levels, views, sheets, types). One transaction per batch; per-element failures are reported. Pass `expected_document` (the model title) when several models are open or the session is long — it makes the write fail cleanly instead of landing in a different active document.
34
- - Parameter display names are LOCALIZED: in a non-English Revit UI, `Mark` is `Kennzeichen` (German), `マーク` (Japanese), etc. When a display-name lookup or `parameter_names` filter finds nothing, or the document may be non-English, use the language-independent `BuiltInParameter` enum name instead (e.g. `ALL_MODEL_MARK` for Mark, `ALL_MODEL_INSTANCE_COMMENTS` for Comments) — `set_parameters`, `get_element_details.parameter_names`, and `get_elements` filter rules all accept them, and `get_element_details` reports each parameter's `builtInParameter` name for discovery.
34
+ - Parameter display names are LOCALIZED: in a non-English Revit UI, `Mark`, `Comments`, and every other display name appear under their translated names. When a display-name lookup or `parameter_names` filter finds nothing, or the document may be non-English, use the language-independent `BuiltInParameter` enum name instead (e.g. `ALL_MODEL_MARK` for Mark, `ALL_MODEL_INSTANCE_COMMENTS` for Comments) — `set_parameters`, `get_element_details.parameter_names`, and `get_elements` filter rules all accept them, and `get_element_details` reports each parameter's `builtInParameter` name for discovery.
35
35
  - Before writing `execute_csharp` code, verify unfamiliar classes/members with `search_api_docs` (works with no document open; first query builds the index and takes a few seconds). The top match carries its remarks, parameter docs, and returns inline, and every public API enum value is searchable — trust the result over guessing or web search; narrow the query to promote a different match into the top slot.
36
36
  - `export_documents` files its output under `Documents\pi-revit\Models\<model title>\exports` automatically when `output_dir` is omitted — keyed to the exported document, so it lands right even across many models. Pass `output_dir` only when the user names a different target.
37
37
 
@@ -1,3 +1,4 @@
1
+ using Autodesk.Revit.DB;
1
2
  using Autodesk.Revit.UI;
2
3
  using RevitApplication = Autodesk.Revit.ApplicationServices.Application;
3
4
 
@@ -67,7 +68,32 @@ namespace RevitBridge
67
68
  {
68
69
  if (sender is RevitApplication app)
69
70
  _application = app;
70
- _hasOpenDocument = (_application?.Documents?.Size ?? 0) > 0;
71
+ try
72
+ {
73
+ // Linked documents count in Documents but are never the active UI
74
+ // document -- with only links loaded, ExternalEvents still are not
75
+ // pumped, so counting them would let a queued call hang for its full
76
+ // timeout instead of failing fast with the 409.
77
+ bool any = false;
78
+ var documents = _application?.Documents;
79
+ if (documents != null)
80
+ {
81
+ foreach (Document document in documents)
82
+ {
83
+ if (!document.IsLinked)
84
+ {
85
+ any = true;
86
+ break;
87
+ }
88
+ }
89
+ }
90
+ _hasOpenDocument = any;
91
+ }
92
+ catch
93
+ {
94
+ // Transitional states (mid-close) can make the iteration throw; keep
95
+ // the last known value -- the in-queue backstop still catches a miss.
96
+ }
71
97
  }
72
98
 
73
99
  private static string StartupErrorPath() =>
@@ -27,7 +27,7 @@ namespace RevitBridge.Tools
27
27
  {
28
28
  type = "array",
29
29
  items = new { type = "string" },
30
- description = "Only return these parameters. Matches the display name OR the BuiltInParameter enum name (case-insensitive exact). Display names are localized (e.g. 'Mark' is 'Kennzeichen' in a German UI) — prefer enum names like ALL_MODEL_MARK for language-independent filtering. Default: all.",
30
+ description = "Only return these parameters. Matches the display name OR the BuiltInParameter enum name (case-insensitive exact). Display names are localized in non-English Revit UIs — prefer enum names like ALL_MODEL_MARK for language-independent filtering. Default: all.",
31
31
  },
32
32
  include = new
33
33
  {