@snaptrude/plugin-core 0.10.0 → 1.0.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 +4 -0
- package/CHANGELOG.md +187 -3
- package/api-manifest.json +929 -25
- package/dist/api/analysis/daylight.d.ts +5 -5
- package/dist/api/analysis/solar.d.ts +2 -2
- package/dist/api/core/camera/index.d.ts +463 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +942 -101
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/brep.d.ts +59 -2
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/curve.d.ts +59 -35
- package/dist/api/core/geom/query/curve.d.ts.map +1 -1
- package/dist/api/core/geom/query/edge.d.ts +2 -2
- package/dist/api/core/geom/query/face.d.ts +105 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -1
- package/dist/api/core/geom/update/contour.d.ts +10 -2
- package/dist/api/core/geom/update/contour.d.ts.map +1 -1
- package/dist/api/core/geom/update/curve.d.ts +5 -5
- package/dist/api/core/geom/update/profile.d.ts +3 -1
- package/dist/api/core/geom/update/profile.d.ts.map +1 -1
- package/dist/api/core/handles/index.d.ts +4 -2
- package/dist/api/core/handles/index.d.ts.map +1 -1
- package/dist/api/core/index.d.ts +4 -4
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/import/index.d.ts +3 -1
- package/dist/api/core/io/import/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +377 -255
- package/dist/api/core/layers.d.ts.map +1 -1
- package/dist/api/core/mode/index.d.ts +19 -7
- package/dist/api/core/mode/index.d.ts.map +1 -1
- package/dist/api/core/project/index.d.ts +68 -1
- package/dist/api/core/project/index.d.ts.map +1 -1
- package/dist/api/core/proposals/index.d.ts +4 -3
- package/dist/api/core/proposals/index.d.ts.map +1 -1
- package/dist/api/core/storeys/index.d.ts +31 -2
- package/dist/api/core/storeys/index.d.ts.map +1 -1
- package/dist/api/core/storeys/layers.d.ts +408 -0
- package/dist/api/core/storeys/layers.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +84 -3
- package/dist/api/core/tags.d.ts.map +1 -1
- package/dist/api/core/zoom/index.d.ts +13 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/bim.d.ts +299 -0
- package/dist/api/design/bim.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +2 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -1
- package/dist/api/design/catalog.d.ts +320 -0
- package/dist/api/design/catalog.d.ts.map +1 -0
- package/dist/api/design/create/bulk-items.d.ts +269 -0
- package/dist/api/design/create/bulk-items.d.ts.map +1 -0
- package/dist/api/design/create/grids.d.ts +132 -0
- package/dist/api/design/create/grids.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +752 -78
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +38 -0
- package/dist/api/design/create/opening-fields.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +5 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/dimensions.d.ts +427 -0
- package/dist/api/design/dimensions.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +24 -23
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +1446 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +33 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/grids.d.ts +237 -0
- package/dist/api/design/grids.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +30 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/networks.d.ts +1703 -0
- package/dist/api/design/networks.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +33 -5
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/grids.d.ts +287 -0
- package/dist/api/design/query/grids.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +143 -34
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/spaces.d.ts +5 -5
- package/dist/api/design/selection/index.d.ts +12 -12
- package/dist/api/design/types/index.d.ts +40 -24
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +412 -8
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/visibility.d.ts +28 -0
- package/dist/api/design/visibility.d.ts.map +1 -1
- package/dist/api/design/windows/index.d.ts +8 -8
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/buildableEnvelope.d.ts +84 -2
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +13 -1
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +12 -12
- package/dist/api/entity/story.d.ts +4 -4
- package/dist/api/presentation/aiInspiration.d.ts +24 -24
- package/dist/api/presentation/annotate.d.ts +38 -22
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/camera.d.ts +265 -0
- package/dist/api/presentation/camera.d.ts.map +1 -0
- package/dist/api/presentation/drawingContract.d.ts +32 -0
- package/dist/api/presentation/drawingContract.d.ts.map +1 -0
- package/dist/api/presentation/drawings.d.ts +3523 -0
- package/dist/api/presentation/drawings.d.ts.map +1 -0
- package/dist/api/presentation/export.d.ts +23 -5
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/graphics.d.ts +419 -0
- package/dist/api/presentation/graphics.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +66 -12
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +116 -16
- package/dist/api/presentation/placedViews.d.ts.map +1 -1
- package/dist/api/presentation/sections.d.ts +461 -0
- package/dist/api/presentation/sections.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +2 -2
- package/dist/api/presentation/sheets.d.ts +175 -19
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/standards.d.ts +590 -0
- package/dist/api/presentation/standards.d.ts.map +1 -0
- package/dist/api/presentation/viewPresets.d.ts +222 -0
- package/dist/api/presentation/viewPresets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +144 -9
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +1350 -0
- package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +58 -2
- package/dist/api/program/departments.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +16 -6
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/labels.d.ts +355 -0
- package/dist/api/program/labels.d.ts.map +1 -0
- package/dist/api/program/metadata.d.ts +328 -0
- package/dist/api/program/metadata.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +4 -4
- package/dist/api/program/spreadsheet.d.ts +267 -4
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +49 -2
- package/dist/api/workspace/index.d.ts.map +1 -1
- package/dist/errors/codes.d.ts +3 -1
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/handles.d.ts +32 -3
- package/dist/handles.d.ts.map +1 -1
- package/dist/index.cjs +6539 -2804
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6121 -2801
- package/dist/index.js.map +1 -1
- package/dist/massParameters.d.ts +287 -0
- package/dist/massParameters.d.ts.map +1 -0
- package/dist/massParameters.ops.d.ts +138 -0
- package/dist/massParameters.ops.d.ts.map +1 -0
- package/package.json +14 -13
- package/scripts/check-dist-fresh.mjs +22 -0
- package/scripts/generate-manifest.mjs +5 -0
- package/scripts/generate-manifest.test.mjs +14 -3
- package/src/api/core/camera/index.ts +446 -1
- package/src/api/core/geom/create/index.ts +1037 -102
- package/src/api/core/geom/query/brep.ts +60 -2
- package/src/api/core/geom/query/curve.ts +26 -2
- package/src/api/core/geom/query/edge.ts +2 -2
- package/src/api/core/geom/query/face.ts +109 -4
- package/src/api/core/geom/update/contour.ts +10 -2
- package/src/api/core/geom/update/profile.ts +2 -0
- package/src/api/core/handles/index.ts +3 -2
- package/src/api/core/index.ts +4 -4
- package/src/api/core/io/import/index.ts +11 -3
- package/src/api/core/layers.ts +380 -173
- package/src/api/core/mode/index.ts +19 -7
- package/src/api/core/project/index.ts +62 -1
- package/src/api/core/proposals/index.ts +4 -3
- package/src/api/core/storeys/index.ts +34 -2
- package/src/api/core/storeys/layers.ts +339 -0
- package/src/api/core/tags.ts +76 -0
- package/src/api/core/zoom/index.ts +13 -0
- package/src/api/design/bim.ts +210 -0
- package/src/api/design/boolean/index.ts +2 -0
- package/src/api/design/catalog.ts +203 -0
- package/src/api/design/create/bulk-items.ts +294 -0
- package/src/api/design/create/grids.ts +137 -0
- package/src/api/design/create/index.ts +823 -114
- package/src/api/design/create/opening-fields.ts +40 -0
- package/src/api/design/delete/index.ts +5 -0
- package/src/api/design/dimensions.ts +453 -0
- package/src/api/design/doors/index.ts +64 -41
- package/src/api/design/family.ts +1342 -0
- package/src/api/design/furniture/index.ts +34 -0
- package/src/api/design/grids.ts +237 -0
- package/src/api/design/index.ts +49 -4
- package/src/api/design/networks.ts +607 -0
- package/src/api/design/query/geometry/index.ts +35 -4
- package/src/api/design/query/grids.ts +197 -0
- package/src/api/design/query/index.ts +105 -3
- package/src/api/design/types/index.ts +31 -24
- package/src/api/design/update/index.ts +398 -4
- package/src/api/design/visibility.ts +34 -0
- package/src/api/design/windows/index.ts +40 -22
- package/src/api/entity/buildableEnvelope.ts +77 -2
- package/src/api/entity/referenceLine.ts +25 -12
- package/src/api/presentation/annotate.ts +90 -58
- package/src/api/presentation/camera.ts +289 -0
- package/src/api/presentation/drawingContract.ts +70 -0
- package/src/api/presentation/drawings.ts +1179 -0
- package/src/api/presentation/export.ts +32 -6
- package/src/api/presentation/graphics.ts +324 -0
- package/src/api/presentation/index.ts +73 -14
- package/src/api/presentation/placedViews.ts +119 -28
- package/src/api/presentation/sections.ts +420 -0
- package/src/api/presentation/sheets.ts +181 -20
- package/src/api/presentation/standards.ts +445 -0
- package/src/api/presentation/viewPresets.ts +241 -0
- package/src/api/presentation/views.ts +81 -10
- package/src/api/presentation/walkthroughs.ts +1201 -0
- package/src/api/program/departments.ts +54 -2
- package/src/api/program/index.ts +16 -6
- package/src/api/program/labels.ts +332 -0
- package/src/api/program/metadata.ts +364 -0
- package/src/api/program/spreadsheet.ts +282 -0
- package/src/api/workspace/index.ts +51 -2
- package/src/errors/codes.ts +7 -0
- package/src/handles.ts +42 -3
- package/src/index.ts +2 -0
- package/src/massParameters.ops.ts +246 -0
- package/src/massParameters.ts +427 -0
- package/test/drawingContract.test.mjs +288 -0
- package/test/errors.test.mjs +1 -0
- package/test/massParameters.test.mjs +952 -0
- package/test/paperPensContract.test.mjs +75 -0
- package/test/presentationViewSettings.test.mjs +85 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { CurveHandle, BBoxComponents } from "../../../handles"
|
|
4
|
+
import { PluginReferenceLineStyle } from "../create"
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Records
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Visual properties of grid lines — the group's defaults and any per-line
|
|
12
|
+
* overrides share this shape (values mirror the engine's `GridLineProps`).
|
|
13
|
+
*
|
|
14
|
+
* | Property | Type | Description |
|
|
15
|
+
* |---|---|---|
|
|
16
|
+
* | `style` | {@linkcode PluginReferenceLineStyle} | Line style (`"SOLID"` \| `"DASHED"` \| `"DOT_DASH"`) |
|
|
17
|
+
* | `weight` | `number` | Line weight |
|
|
18
|
+
* | `color` | `string` | Line color as a `#rrggbb` hex string |
|
|
19
|
+
* | `showStart` | `boolean` | Whether the start-end tag bubble is shown |
|
|
20
|
+
* | `showEnd` | `boolean` | Whether the end-end tag bubble is shown |
|
|
21
|
+
*/
|
|
22
|
+
export const PluginGridLineProps = z.object({
|
|
23
|
+
style: PluginReferenceLineStyle,
|
|
24
|
+
weight: z.number(),
|
|
25
|
+
color: z.string(),
|
|
26
|
+
showStart: z.boolean(),
|
|
27
|
+
showEnd: z.boolean(),
|
|
28
|
+
})
|
|
29
|
+
export type PluginGridLineProps = z.infer<typeof PluginGridLineProps>
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* One grid line within a wing.
|
|
33
|
+
*
|
|
34
|
+
* | Property | Type | Description |
|
|
35
|
+
* |---|---|---|
|
|
36
|
+
* | `curve` | {@linkcode CurveHandle} | The line's geometry in **world space** (a line or arc; read coordinates via `core.geom.curve`) |
|
|
37
|
+
* | `tag` | `string` | The line's grid tag (e.g. `"A"`, `"3"`) |
|
|
38
|
+
* | `visible` | `boolean` | Persisted per-line visibility |
|
|
39
|
+
* | `props` | {@linkcode PluginGridLineProps} | **Effective** visual properties (group defaults merged with this line's overrides) |
|
|
40
|
+
* | `overrides` | `Partial<`{@linkcode PluginGridLineProps}`>`? | This line's raw overrides, when any exist |
|
|
41
|
+
*/
|
|
42
|
+
export const PluginGridLineRecord = z.object({
|
|
43
|
+
curve: CurveHandle,
|
|
44
|
+
tag: z.string(),
|
|
45
|
+
visible: z.boolean(),
|
|
46
|
+
props: PluginGridLineProps,
|
|
47
|
+
overrides: PluginGridLineProps.partial().optional(),
|
|
48
|
+
})
|
|
49
|
+
export type PluginGridLineRecord = z.infer<typeof PluginGridLineRecord>
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* One wing of a grid — a family of parallel lines sharing a local frame.
|
|
53
|
+
* `spacing` and `span` are measured along the wing's local axes in
|
|
54
|
+
* Snaptrude units; line addresses used by mutating APIs are
|
|
55
|
+
* `{ wing, line }` index pairs into these arrays.
|
|
56
|
+
*
|
|
57
|
+
* | Property | Type | Description |
|
|
58
|
+
* |---|---|---|
|
|
59
|
+
* | `spacing` | `number` | Nominal spacing between adjacent lines (Snaptrude units) |
|
|
60
|
+
* | `tagStart` | `string` | First tag of the wing's deterministic tag sequence |
|
|
61
|
+
* | `span` | `{ min: number; max: number }`? | Explicit family length along the wing's line axis, when baked |
|
|
62
|
+
* | `lines` | {@linkcode PluginGridLineRecord}`[]` | The wing's lines, in wing order (index = the `line` address) |
|
|
63
|
+
*/
|
|
64
|
+
export const PluginGridWingRecord = z.object({
|
|
65
|
+
spacing: z.number(),
|
|
66
|
+
tagStart: z.string(),
|
|
67
|
+
span: z.object({ min: z.number(), max: z.number() }).optional(),
|
|
68
|
+
lines: z.array(PluginGridLineRecord),
|
|
69
|
+
})
|
|
70
|
+
export type PluginGridWingRecord = z.infer<typeof PluginGridWingRecord>
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Per-storey 2D-plan visibility of a grid.
|
|
74
|
+
*
|
|
75
|
+
* | Property | Type | Description |
|
|
76
|
+
* |---|---|---|
|
|
77
|
+
* | `activeStorey` | `number` | The storey the grid belongs to |
|
|
78
|
+
* | `disabledOnStoreys` | `number[]` | Storeys on whose 2D plan the grid is hidden |
|
|
79
|
+
*/
|
|
80
|
+
export const PluginGridStoreyVisibility = z.object({
|
|
81
|
+
activeStorey: z.number(),
|
|
82
|
+
disabledOnStoreys: z.array(z.number()),
|
|
83
|
+
})
|
|
84
|
+
export type PluginGridStoreyVisibility = z.infer<typeof PluginGridStoreyVisibility>
|
|
85
|
+
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// get — args & result
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Property names readable via {@linkcode PluginDesignQueryGridsApi.get}.
|
|
92
|
+
*
|
|
93
|
+
* | Value | Description |
|
|
94
|
+
* |---|---|
|
|
95
|
+
* | `"angle"` | World rotation about +Y, in **degrees** |
|
|
96
|
+
* | `"props"` | Group-level default line properties |
|
|
97
|
+
* | `"storeyVisibility"` | Active storey + storeys where the grid is hidden in 2D |
|
|
98
|
+
* | `"wings"` | Full wing/line structure with world-space curve handles |
|
|
99
|
+
* | `"bounds"` | World-space axis-aligned bounding box of the grid geometry |
|
|
100
|
+
*/
|
|
101
|
+
export const PluginGridGetProperty = z.enum([
|
|
102
|
+
"angle",
|
|
103
|
+
"props",
|
|
104
|
+
"storeyVisibility",
|
|
105
|
+
"wings",
|
|
106
|
+
"bounds",
|
|
107
|
+
])
|
|
108
|
+
export type PluginGridGetProperty = z.infer<typeof PluginGridGetProperty>
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Arguments for {@linkcode PluginDesignQueryGridsApi.get}.
|
|
112
|
+
*
|
|
113
|
+
* | Property | Type | Description |
|
|
114
|
+
* |---|---|---|
|
|
115
|
+
* | `gridId` | `string` | The grid group ID to query |
|
|
116
|
+
* | `properties` | {@linkcode PluginGridGetProperty}`[]` | Properties to retrieve |
|
|
117
|
+
*/
|
|
118
|
+
export const PluginGridGetArgs = z.object({
|
|
119
|
+
gridId: z.string(),
|
|
120
|
+
properties: z.array(PluginGridGetProperty),
|
|
121
|
+
})
|
|
122
|
+
export type PluginGridGetArgs = z.infer<typeof PluginGridGetArgs>
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Result of {@linkcode PluginDesignQueryGridsApi.get} — only the requested
|
|
126
|
+
* properties are present.
|
|
127
|
+
*/
|
|
128
|
+
export const PluginGridGetResult = z
|
|
129
|
+
.object({
|
|
130
|
+
angle: z.number(),
|
|
131
|
+
props: PluginGridLineProps,
|
|
132
|
+
storeyVisibility: PluginGridStoreyVisibility,
|
|
133
|
+
wings: z.array(PluginGridWingRecord),
|
|
134
|
+
bounds: BBoxComponents,
|
|
135
|
+
})
|
|
136
|
+
.partial()
|
|
137
|
+
export type PluginGridGetResult = z.infer<typeof PluginGridGetResult>
|
|
138
|
+
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
// Abstract API
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* `design.query.grids.*` — structural-grid-specific reads.
|
|
145
|
+
*
|
|
146
|
+
* A **grid** (grid group) is a structural/documentation grid: one or more
|
|
147
|
+
* *wings* (families of parallel lines with a shared local frame), each holding
|
|
148
|
+
* tagged grid *lines* (straight lines, or a lone arc). Enumerate grids with
|
|
149
|
+
* `design.query.listGrids`; read an individual grid's structure here.
|
|
150
|
+
*
|
|
151
|
+
* Lines have no stable identity of their own — mutating APIs address them
|
|
152
|
+
* positionally as `{ wing, line }` index pairs into the `wings` arrays
|
|
153
|
+
* returned by {@linkcode get}. Structural edits (adding/removing lines,
|
|
154
|
+
* count changes) re-index lines; re-query after mutating.
|
|
155
|
+
*
|
|
156
|
+
* Accessed via `snaptrude.design.query.grids`.
|
|
157
|
+
*/
|
|
158
|
+
export abstract class PluginDesignQueryGridsApi {
|
|
159
|
+
constructor() {}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get properties of a grid by its ID.
|
|
163
|
+
*
|
|
164
|
+
* Only the properties listed in `properties` are returned — unlisted
|
|
165
|
+
* properties will be `undefined` in the result. `wings` is the heavy
|
|
166
|
+
* read (it registers a world-space {@linkcode CurveHandle} per line);
|
|
167
|
+
* request it only when the geometry is needed.
|
|
168
|
+
*
|
|
169
|
+
* Units: `angle` is in **degrees** (positive = CCW about +Y); `spacing`,
|
|
170
|
+
* `span`, `bounds`, and curve coordinates are in **Snaptrude units**,
|
|
171
|
+
* world space.
|
|
172
|
+
*
|
|
173
|
+
* @param gridId - The unique grid group ID
|
|
174
|
+
* @param properties - Array of property names to retrieve. See
|
|
175
|
+
* {@linkcode PluginGridGetProperty}.
|
|
176
|
+
* @returns A partial {@linkcode PluginGridGetResult} containing only the
|
|
177
|
+
* requested properties
|
|
178
|
+
* @throws If the grid does not exist
|
|
179
|
+
*
|
|
180
|
+
* @examplePrompt What is the spacing of this grid?
|
|
181
|
+
* @examplePrompt Read the grid line tags on this structural grid
|
|
182
|
+
* @examplePrompt Get the geometry of every line in this grid
|
|
183
|
+
* @examplePrompt Which storeys is this grid hidden on?
|
|
184
|
+
*
|
|
185
|
+
* # Example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const [grid] = await snaptrude.design.query.listGrids()
|
|
188
|
+
* const { wings } = await snaptrude.design.query.grids.get(grid, ["wings"])
|
|
189
|
+
* // wings[0].lines[0].curve is an opaque CurveHandle in world space;
|
|
190
|
+
* // read its coordinates via `snaptrude.core.geom.curve`.
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
public abstract get(
|
|
194
|
+
gridId: string,
|
|
195
|
+
properties: z.infer<typeof PluginGridGetProperty>[],
|
|
196
|
+
): PluginApiReturn<PluginGridGetResult>
|
|
197
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { PluginApiReturn } from "../../../types"
|
|
3
3
|
import { ComponentHandle, BBoxComponents } from "../../../handles"
|
|
4
|
+
import type { MassParametersRecord } from "../../../massParameters"
|
|
4
5
|
import {
|
|
5
6
|
PluginSpaceType,
|
|
6
7
|
PluginMassType,
|
|
@@ -11,6 +12,7 @@ import { PluginStaircasePreset } from "../create"
|
|
|
11
12
|
import { PluginDesignQueryGeometryApi } from "./geometry"
|
|
12
13
|
import { PluginDesignQuerySpacesApi } from "./spaces"
|
|
13
14
|
import { PluginDesignQueryReferenceLinesApi } from "./referenceLines"
|
|
15
|
+
import { PluginDesignQueryGridsApi } from "./grids"
|
|
14
16
|
|
|
15
17
|
// ---------------------------------------------------------------------------
|
|
16
18
|
// Entity type vocabulary
|
|
@@ -27,6 +29,7 @@ import { PluginDesignQueryReferenceLinesApi } from "./referenceLines"
|
|
|
27
29
|
* | `"wall"` | Wall |
|
|
28
30
|
* | `"space"` | Space (a room mass) |
|
|
29
31
|
* | `"mass"` | Generic mass (non-room) |
|
|
32
|
+
* | `"void"` | A hosted cutting solid, separate from spaces and masses |
|
|
30
33
|
* | `"door"` | Door |
|
|
31
34
|
* | `"window"` | Window |
|
|
32
35
|
* | `"floor"` | Floor |
|
|
@@ -41,11 +44,14 @@ import { PluginDesignQueryReferenceLinesApi } from "./referenceLines"
|
|
|
41
44
|
* | `"curtainWall"` | Parametric curtain wall |
|
|
42
45
|
* | `"mullion"` | Curtain-wall mullion |
|
|
43
46
|
* | `"panel"` | Curtain-wall panel |
|
|
47
|
+
* | `"parametricComponent"` | A placed parametric family instance (native or Revit-imported). Its geometry is rebuilt from `design.family` parameters, so read and drive it through `design.family.getParameters` / `setParameters` rather than editing its meshes. |
|
|
48
|
+
* | `"grid"` | Structural grid group |
|
|
44
49
|
*/
|
|
45
50
|
export const PluginEntityType = z.enum([
|
|
46
51
|
"wall",
|
|
47
52
|
"space",
|
|
48
53
|
"mass",
|
|
54
|
+
"void",
|
|
49
55
|
"door",
|
|
50
56
|
"window",
|
|
51
57
|
"floor",
|
|
@@ -60,6 +66,8 @@ export const PluginEntityType = z.enum([
|
|
|
60
66
|
"curtainWall",
|
|
61
67
|
"mullion",
|
|
62
68
|
"panel",
|
|
69
|
+
"parametricComponent",
|
|
70
|
+
"grid",
|
|
63
71
|
])
|
|
64
72
|
export type PluginEntityType = z.infer<typeof PluginEntityType>
|
|
65
73
|
|
|
@@ -304,6 +312,8 @@ export abstract class PluginDesignQueryApi {
|
|
|
304
312
|
public abstract spaces: PluginDesignQuerySpacesApi
|
|
305
313
|
/** Reference-line-specific reads. See {@linkcode PluginDesignQueryReferenceLinesApi}. */
|
|
306
314
|
public abstract referenceLines: PluginDesignQueryReferenceLinesApi
|
|
315
|
+
/** Structural-grid-specific reads. See {@linkcode PluginDesignQueryGridsApi}. */
|
|
316
|
+
public abstract grids: PluginDesignQueryGridsApi
|
|
307
317
|
|
|
308
318
|
constructor() {}
|
|
309
319
|
|
|
@@ -346,6 +356,9 @@ export abstract class PluginDesignQueryApi {
|
|
|
346
356
|
* List all entities of one BIM object type — wall, door, slab, panel, and so
|
|
347
357
|
* on — optionally narrowed by the shared filter.
|
|
348
358
|
*
|
|
359
|
+
* `"void"` lists native Void components (made by `design.create.void`),
|
|
360
|
+
* as does `design.query.listVoids`. `"mass"` excludes voids.
|
|
361
|
+
*
|
|
349
362
|
* @param type - the {@linkcode PluginEntityType} to list
|
|
350
363
|
* @param filter - an optional {@linkcode PluginEntityFilter}
|
|
351
364
|
* @returns matching entities as {@linkcode ComponentHandle}`[]`
|
|
@@ -437,6 +450,8 @@ export abstract class PluginDesignQueryApi {
|
|
|
437
450
|
* List all the generic masses (non-room massing volumes) in the project,
|
|
438
451
|
* optionally filtered by storey, building, label, mass type, or region.
|
|
439
452
|
*
|
|
453
|
+
* Excludes Void components. Use `design.query.listVoids` for hosted cutters.
|
|
454
|
+
*
|
|
440
455
|
* @param filter - an optional {@linkcode PluginEntityFilter}
|
|
441
456
|
* @returns mass {@linkcode ComponentHandle}`[]`
|
|
442
457
|
*
|
|
@@ -457,6 +472,19 @@ export abstract class PluginDesignQueryApi {
|
|
|
457
472
|
filter?: PluginEntityFilter,
|
|
458
473
|
): PluginApiReturn<ComponentHandle[]>
|
|
459
474
|
|
|
475
|
+
/**
|
|
476
|
+
* List Void components, excluding masses and spaces. Voids cut their hosts.
|
|
477
|
+
* Use family queries for authored parametric families with a cut relationship.
|
|
478
|
+
*
|
|
479
|
+
* @param filter - Optional storey, building, selection, or region filter.
|
|
480
|
+
* @returns Void component handles, or an empty array when none match.
|
|
481
|
+
* @example
|
|
482
|
+
* const voids = await snaptrude.design.query.listVoids({ storeys: [1] })
|
|
483
|
+
*/
|
|
484
|
+
public abstract listVoids(
|
|
485
|
+
filter?: PluginEntityFilter,
|
|
486
|
+
): PluginApiReturn<ComponentHandle[]>
|
|
487
|
+
|
|
460
488
|
/**
|
|
461
489
|
* List all the doors in the project, optionally filtered by storey, building,
|
|
462
490
|
* selection state, or region.
|
|
@@ -721,6 +749,27 @@ export abstract class PluginDesignQueryApi {
|
|
|
721
749
|
filter?: PluginEntityFilter,
|
|
722
750
|
): PluginApiReturn<ComponentHandle[]>
|
|
723
751
|
|
|
752
|
+
/**
|
|
753
|
+
* List all the structural grids (grid groups) in the project, optionally
|
|
754
|
+
* filtered by storey, building, selection state, or region.
|
|
755
|
+
*
|
|
756
|
+
* @param filter - an optional {@linkcode PluginEntityFilter}
|
|
757
|
+
* @returns grid-group {@linkcode ComponentHandle}`[]`
|
|
758
|
+
*
|
|
759
|
+
* @examplePrompt List all the structural grids in the model
|
|
760
|
+
* @examplePrompt How many grids are on the ground floor?
|
|
761
|
+
* @examplePrompt Show the grids on this storey
|
|
762
|
+
* @examplePrompt Which grids are currently selected?
|
|
763
|
+
*
|
|
764
|
+
* # Example
|
|
765
|
+
* ```ts
|
|
766
|
+
* const groundFloorGrids = await snaptrude.design.query.listGrids({ storeys: [1] })
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
public abstract listGrids(
|
|
770
|
+
filter?: PluginEntityFilter,
|
|
771
|
+
): PluginApiReturn<ComponentHandle[]>
|
|
772
|
+
|
|
724
773
|
// ── single-entity access & identity ─────────────────────────────────────────
|
|
725
774
|
|
|
726
775
|
/**
|
|
@@ -852,7 +901,8 @@ export abstract class PluginDesignQueryApi {
|
|
|
852
901
|
|
|
853
902
|
/**
|
|
854
903
|
* List an entity's direct child entities — for example the doors and windows
|
|
855
|
-
* hosted in a wall
|
|
904
|
+
* hosted in a wall, or the voids (holes, shafts, openings) cut in a slab,
|
|
905
|
+
* floor, roof or ceiling by `design.create.void`.
|
|
856
906
|
* @param component - the entity's {@linkcode ComponentHandle}
|
|
857
907
|
* @returns child {@linkcode ComponentHandle}`[]` (`[]` if none)
|
|
858
908
|
*
|
|
@@ -860,6 +910,7 @@ export abstract class PluginDesignQueryApi {
|
|
|
860
910
|
* @examplePrompt Show the child elements of the selected object
|
|
861
911
|
* @examplePrompt Which openings belong to this wall?
|
|
862
912
|
* @examplePrompt List everything nested under this mass
|
|
913
|
+
* @examplePrompt List all holes in this slab
|
|
863
914
|
*
|
|
864
915
|
* # Example
|
|
865
916
|
* ```ts
|
|
@@ -879,7 +930,8 @@ export abstract class PluginDesignQueryApi {
|
|
|
879
930
|
): PluginApiReturn<ComponentHandle[]>
|
|
880
931
|
|
|
881
932
|
/**
|
|
882
|
-
* Get an entity's host/parent entity (e.g. the wall a door is cut into
|
|
933
|
+
* Get an entity's host/parent entity (e.g. the wall a door is cut into, or
|
|
934
|
+
* the slab, floor, roof or ceiling a void is cut through).
|
|
883
935
|
* @param component - the entity's {@linkcode ComponentHandle}
|
|
884
936
|
* @returns the host {@linkcode ComponentHandle}, or `null` if top-level
|
|
885
937
|
*
|
|
@@ -887,6 +939,7 @@ export abstract class PluginDesignQueryApi {
|
|
|
887
939
|
* @examplePrompt Find the parent of the selected window
|
|
888
940
|
* @examplePrompt What is this element attached to?
|
|
889
941
|
* @examplePrompt Which wall hosts this window?
|
|
942
|
+
* @examplePrompt Which slab is this shaft in?
|
|
890
943
|
*
|
|
891
944
|
* # Example
|
|
892
945
|
* ```ts
|
|
@@ -1012,6 +1065,55 @@ export abstract class PluginDesignQueryApi {
|
|
|
1012
1065
|
staircase: ComponentHandle,
|
|
1013
1066
|
): PluginApiReturn<PluginStaircaseParams | null>
|
|
1014
1067
|
|
|
1068
|
+
/**
|
|
1069
|
+
* Read a mass's creation-parameter record — the recipe it was built from
|
|
1070
|
+
* (`kind` plus the values that constructor was called with). Present on
|
|
1071
|
+
* masses committed from a `core.geom.create` brep constructor that carries a
|
|
1072
|
+
* recipe: {@linkcode MassParametersRecord} covers the four primitives
|
|
1073
|
+
* (sphere, cylinder, cone, torus), extrusions, revolutions, lofts and sweeps.
|
|
1074
|
+
*
|
|
1075
|
+
* A fillet, chamfer, shell or offset of a recorded solid keeps the record
|
|
1076
|
+
* too: `kind` stays the base constructor and the operation is appended to the
|
|
1077
|
+
* record's `operations` list. Edit any of it with `design.update.parameters`.
|
|
1078
|
+
*
|
|
1079
|
+
* `null` for everything else — drawn masses, imported geometry, booleans,
|
|
1080
|
+
* split parts, `brepFromFaces` / `brepFromMesh`, and results built on a
|
|
1081
|
+
* source that carried no record — and for a mass whose record no longer
|
|
1082
|
+
* matches what is on
|
|
1083
|
+
* screen (a later free-form edit dropped the recipe, or the mass carries a
|
|
1084
|
+
* baked scale). `null` too when the recipe was not recordable: the record
|
|
1085
|
+
* schema has its own caps (a sweep path of at most 512 points, a loft of at
|
|
1086
|
+
* most 32 sections, at most 8 chained `operations`, at most 256 curves in one
|
|
1087
|
+
* profile loop and 64 holes in one contour), and a mass built past one of
|
|
1088
|
+
* them — through a route that does not enforce the matching creator cap —
|
|
1089
|
+
* commits as ordinary geometry carrying no record. The `operations` cap is
|
|
1090
|
+
* the one an agent can walk into by accident: a 9th chained
|
|
1091
|
+
* fillet/chamfer/shell/offset drops the record silently, so the result
|
|
1092
|
+
* commits as ordinary geometry and reads back `null` here. A record is never
|
|
1093
|
+
* reported unless it is still the truth.
|
|
1094
|
+
*
|
|
1095
|
+
* Points and axes come back in **world** coordinates. Pure read — nothing is
|
|
1096
|
+
* created or modified.
|
|
1097
|
+
*
|
|
1098
|
+
* @param component - the mass's {@linkcode ComponentHandle}
|
|
1099
|
+
* @returns the {@linkcode MassParametersRecord}, or `null`
|
|
1100
|
+
*
|
|
1101
|
+
* @examplePrompt What radius is this sphere?
|
|
1102
|
+
* @examplePrompt Is this mass parametric?
|
|
1103
|
+
* @examplePrompt Read back the dome's creation parameters
|
|
1104
|
+
* @examplePrompt How tall was this cylinder made?
|
|
1105
|
+
*
|
|
1106
|
+
* # Example
|
|
1107
|
+
* ```ts
|
|
1108
|
+
* const [mass] = await snaptrude.design.query.listMasses({ isSelected: true })
|
|
1109
|
+
* const params = await snaptrude.design.query.getParameters(mass)
|
|
1110
|
+
* if (params?.kind === "sphere") console.log("radius:", params.values.radius)
|
|
1111
|
+
* ```
|
|
1112
|
+
*/
|
|
1113
|
+
public abstract getParameters(
|
|
1114
|
+
component: ComponentHandle,
|
|
1115
|
+
): PluginApiReturn<MassParametersRecord | null>
|
|
1116
|
+
|
|
1015
1117
|
/**
|
|
1016
1118
|
* Get the **union** axis-aligned bounding box enclosing a set of entities.
|
|
1017
1119
|
*
|
|
@@ -1088,7 +1190,6 @@ export abstract class PluginDesignQueryApi {
|
|
|
1088
1190
|
): PluginApiReturn<PluginStoreyOutlineResult>
|
|
1089
1191
|
}
|
|
1090
1192
|
|
|
1091
|
-
|
|
1092
1193
|
/** A point in the world-space plan (x, z) projection, Snaptrude internal units. */
|
|
1093
1194
|
export const PluginOutlinePlanPoint = z.object({ x: z.number(), z: z.number() })
|
|
1094
1195
|
export type PluginOutlinePlanPoint = z.infer<typeof PluginOutlinePlanPoint>
|
|
@@ -1145,3 +1246,4 @@ export type PluginStoreyOutlineResult = z.infer<
|
|
|
1145
1246
|
export * from "./geometry"
|
|
1146
1247
|
export * from "./spaces"
|
|
1147
1248
|
export * from "./referenceLines"
|
|
1249
|
+
export * from "./grids"
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { PluginApiReturn } from "../../../types"
|
|
3
3
|
|
|
4
|
+
/** An exact saved native wall family. Access is checked on every use; Draw selection is not registration. */
|
|
5
|
+
export const PluginNativeWallType = z.object({
|
|
6
|
+
id: z.string().min(1),
|
|
7
|
+
version: z.number().int().positive(),
|
|
8
|
+
})
|
|
9
|
+
export type PluginNativeWallType = z.infer<typeof PluginNativeWallType>
|
|
10
|
+
|
|
11
|
+
/** Legacy project type name/id, or an exact authorized native wall family pin. */
|
|
12
|
+
export const PluginWallType = z.union([z.string().trim().min(1), PluginNativeWallType])
|
|
13
|
+
export type PluginWallType = z.infer<typeof PluginWallType>
|
|
14
|
+
|
|
4
15
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Types are plain value records ({@linkcode PluginBuildingType}) — NOT scene
|
|
13
|
-
* entities/handles. A type's `id` is a stable `"<kind>:<name>"` token
|
|
14
|
-
* (e.g. `"wall:brickWithPlasterAndPaint"`) returned by
|
|
15
|
-
* {@linkcode PluginDesignTypesApi.list} and consumed by
|
|
16
|
-
* {@linkcode PluginDesignTypesApi.get}. Reads never throw — an unknown id yields
|
|
17
|
-
* `null`; a kind with no types yields `[]`.
|
|
18
|
-
*
|
|
19
|
-
* These are reads only: there is no engine seam to author a type from a plugin
|
|
20
|
-
* (types are created through the construction/project-properties UI).
|
|
16
|
+
* Read-only project assemblies and authorized saved native wall families.
|
|
17
|
+
* Legacy ids use `"<kind>:<name>"`. Native wall records carry `nativeFamily`:
|
|
18
|
+
* pass that exact `{ id, version }` pin to get, create.walls, create.wallRuns,
|
|
19
|
+
* or update.wall. Labels and bare definition ids do not select native families.
|
|
20
|
+
* Native lengths use Snaptrude units (1 SU = 254 mm).
|
|
21
|
+
* Missing ids return null; catalog/network failures reject rather than return
|
|
22
|
+
* an incomplete catalog. Author native families with design.family.
|
|
21
23
|
*/
|
|
22
24
|
export abstract class PluginDesignTypesApi {
|
|
23
25
|
constructor() {}
|
|
@@ -46,10 +48,10 @@ export abstract class PluginDesignTypesApi {
|
|
|
46
48
|
): PluginApiReturn<PluginBuildingTypeSummary[]>
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
|
-
* Get one building type by its
|
|
51
|
+
* Get one building type by its legacy id or exact native wall pin — its labelled layer stack
|
|
50
52
|
* (each layer's role, thickness and material) plus the summed total thickness.
|
|
51
53
|
*
|
|
52
|
-
* @param typeId The
|
|
54
|
+
* @param typeId The legacy id or nativeFamily pin from {@linkcode PluginDesignTypesApi.list}
|
|
53
55
|
* @returns The full type, or `null` if no type matches
|
|
54
56
|
*
|
|
55
57
|
* @examplePrompt What layers make up this wall type?
|
|
@@ -60,11 +62,11 @@ export abstract class PluginDesignTypesApi {
|
|
|
60
62
|
* # Example
|
|
61
63
|
* ```ts
|
|
62
64
|
* const [first] = await snaptrude.design.types.list("wall")
|
|
63
|
-
* const type = await snaptrude.design.types.get(first.id)
|
|
65
|
+
* const type = await snaptrude.design.types.get(first.nativeFamily ?? first.id)
|
|
64
66
|
* if (type) for (const layer of type.layers) console.log(layer.name, layer.thickness)
|
|
65
67
|
* ```
|
|
66
68
|
*/
|
|
67
|
-
public abstract get(typeId:
|
|
69
|
+
public abstract get(typeId: PluginWallType): PluginApiReturn<PluginBuildingType | null>
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
/** The building-type families exposed by {@linkcode PluginDesignTypesApi}. */
|
|
@@ -85,6 +87,8 @@ export const PluginTypeLayer = z.object({
|
|
|
85
87
|
name: z.string(),
|
|
86
88
|
role: z.string(),
|
|
87
89
|
thickness: z.number(),
|
|
90
|
+
/** Native authored core membership. Never inferred from material or layer name. */
|
|
91
|
+
isCore: z.boolean().optional(),
|
|
88
92
|
material: z
|
|
89
93
|
.object({
|
|
90
94
|
name: z.string(),
|
|
@@ -99,7 +103,7 @@ export type PluginTypeLayer = z.infer<typeof PluginTypeLayer>
|
|
|
99
103
|
*
|
|
100
104
|
* | Property | Type | Description |
|
|
101
105
|
* |---|---|---|
|
|
102
|
-
* | `id` | `string` |
|
|
106
|
+
* | `id` | `string` | Legacy `"<kind>:<name>"` token or native definition id; native lookups use `nativeFamily` |
|
|
103
107
|
* | `kind` | {@linkcode PluginBuildingTypeKind} | Which family it belongs to |
|
|
104
108
|
* | `label` | `string` | Human-readable label |
|
|
105
109
|
* | `isDefault` | `boolean` | `true` for a built-in type, `false` for a team/user type |
|
|
@@ -111,6 +115,8 @@ export const PluginBuildingTypeSummary = z.object({
|
|
|
111
115
|
label: z.string(),
|
|
112
116
|
isDefault: z.boolean(),
|
|
113
117
|
thickness: z.number(),
|
|
118
|
+
/** Present for native walls. Pass the whole pin to get/create/update, not its label or bare id. */
|
|
119
|
+
nativeFamily: PluginNativeWallType.optional(),
|
|
114
120
|
})
|
|
115
121
|
export type PluginBuildingTypeSummary = z.infer<typeof PluginBuildingTypeSummary>
|
|
116
122
|
|
|
@@ -119,7 +125,7 @@ export type PluginBuildingTypeSummary = z.infer<typeof PluginBuildingTypeSummary
|
|
|
119
125
|
*
|
|
120
126
|
* | Property | Type | Description |
|
|
121
127
|
* |---|---|---|
|
|
122
|
-
* | `id` | `string` |
|
|
128
|
+
* | `id` | `string` | Legacy type token or native definition id |
|
|
123
129
|
* | `kind` | {@linkcode PluginBuildingTypeKind} | Which family it belongs to |
|
|
124
130
|
* | `label` | `string` | Human-readable label |
|
|
125
131
|
* | `isDefault` | `boolean` | `true` for a built-in type |
|
|
@@ -148,9 +154,10 @@ export type PluginDesignTypesListArgs = z.infer<typeof PluginDesignTypesListArgs
|
|
|
148
154
|
*
|
|
149
155
|
* | Property | Type | Description |
|
|
150
156
|
* |---|---|---|
|
|
151
|
-
* | `typeId` |
|
|
157
|
+
* | `typeId` | {@linkcode PluginWallType} | A legacy `"<kind>:<name>"` id or exact `nativeFamily` pin from `design.types.list` |
|
|
152
158
|
*/
|
|
153
159
|
export const PluginDesignTypesGetArgs = z.object({
|
|
154
|
-
|
|
160
|
+
// Preserve legacy lookup behavior: malformed string ids return null in the host.
|
|
161
|
+
typeId: z.union([z.string(), PluginNativeWallType]),
|
|
155
162
|
})
|
|
156
163
|
export type PluginDesignTypesGetArgs = z.infer<typeof PluginDesignTypesGetArgs>
|