@snaptrude/plugin-core 0.2.9 → 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 +128 -50
- package/CHANGELOG.md +52 -6
- package/api-manifest.full.json +3999 -0
- package/api-manifest.json +3845 -0
- package/dist/api/core/buildings.d.ts +427 -0
- package/dist/api/core/buildings.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +230 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +247 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +72 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +24 -23
- package/dist/api/core/geom/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +169 -0
- package/dist/api/core/geom/query/arc.d.ts.map +1 -0
- package/dist/api/core/geom/query/brep.d.ts +402 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -0
- package/dist/api/core/geom/query/circle.d.ts +378 -0
- package/dist/api/core/geom/query/circle.d.ts.map +1 -0
- package/dist/api/core/geom/query/contour.d.ts +450 -0
- package/dist/api/core/geom/query/contour.d.ts.map +1 -0
- package/dist/api/core/geom/query/curve.d.ts +918 -0
- package/dist/api/core/geom/query/curve.d.ts.map +1 -0
- package/dist/api/core/geom/query/edge.d.ts +128 -0
- package/dist/api/core/geom/query/edge.d.ts.map +1 -0
- package/dist/api/core/geom/query/face.d.ts +363 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -0
- package/dist/api/core/geom/query/halfedge.d.ts +206 -0
- package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
- package/dist/api/core/geom/query/index.d.ts +61 -0
- package/dist/api/core/geom/query/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/profile.d.ts +410 -0
- package/dist/api/core/geom/query/profile.d.ts.map +1 -0
- package/dist/api/core/geom/query/vertex.d.ts +187 -0
- package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
- package/dist/api/core/geom/update/contour.d.ts +272 -0
- package/dist/api/core/geom/update/contour.d.ts.map +1 -0
- package/dist/api/core/geom/update/curve.d.ts +180 -0
- package/dist/api/core/geom/update/curve.d.ts.map +1 -0
- package/dist/api/core/geom/update/index.d.ts +27 -0
- package/dist/api/core/geom/update/index.d.ts.map +1 -0
- package/dist/api/core/geom/update/profile.d.ts +329 -0
- package/dist/api/core/geom/update/profile.d.ts.map +1 -0
- package/dist/api/core/groups.d.ts +485 -0
- package/dist/api/core/groups.d.ts.map +1 -0
- package/dist/api/core/history/index.d.ts +78 -0
- package/dist/api/core/history/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +46 -1
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +111 -128
- package/dist/api/core/math/quat.d.ts.map +1 -1
- package/dist/api/core/math/vec3.d.ts +120 -102
- package/dist/api/core/math/vec3.d.ts.map +1 -1
- package/dist/api/core/project/index.d.ts +399 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +755 -0
- package/dist/api/core/tags.d.ts.map +1 -0
- package/dist/api/core/units/index.d.ts +175 -0
- package/dist/api/core/units/index.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +45 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +168 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +828 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +63 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +268 -0
- package/dist/api/design/doors/index.d.ts.map +1 -0
- package/dist/api/design/edit/index.d.ts +49 -0
- package/dist/api/design/edit/index.d.ts.map +1 -0
- package/dist/api/design/erase/index.d.ts +160 -0
- package/dist/api/design/erase/index.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +123 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +153 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +41 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +297 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +140 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1011 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +221 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +138 -0
- package/dist/api/design/selection/index.d.ts.map +1 -0
- package/dist/api/design/shared.d.ts +38 -0
- package/dist/api/design/shared.d.ts.map +1 -0
- package/dist/api/design/transform/index.d.ts +87 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +178 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +189 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +51 -23
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/department.d.ts +0 -98
- package/dist/api/entity/department.d.ts.map +1 -1
- package/dist/api/entity/index.d.ts +4 -9
- package/dist/api/entity/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +49 -106
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +76 -828
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +47 -37
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +17 -17
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +440 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +81 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +113 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +46 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +176 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +296 -0
- package/dist/api/presentation/views.d.ts.map +1 -0
- package/dist/api/program/adjacency.d.ts +155 -0
- package/dist/api/program/adjacency.d.ts.map +1 -0
- package/dist/api/program/areas.d.ts +360 -0
- package/dist/api/program/areas.d.ts.map +1 -0
- package/dist/api/program/classification.d.ts +135 -0
- package/dist/api/program/classification.d.ts.map +1 -0
- package/dist/api/program/cores.d.ts +174 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +431 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +69 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +63 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metrics.d.ts +108 -0
- package/dist/api/program/metrics.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +367 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2041 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/handles.d.ts +138 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +7 -5
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +3897 -1542
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3326 -1462
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/scripts/generate-manifest.mjs +193 -0
- package/scripts/generate-manifest.test.mjs +193 -0
- package/src/api/core/buildings.ts +485 -0
- package/src/api/core/comment/index.ts +258 -0
- package/src/api/core/geom/create/index.ts +293 -0
- package/src/api/core/geom/delete/index.ts +78 -0
- package/src/api/core/geom/index.ts +24 -23
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +444 -0
- package/src/api/core/geom/query/circle.ts +404 -0
- package/src/api/core/geom/query/contour.ts +540 -0
- package/src/api/core/geom/query/curve.ts +1078 -0
- package/src/api/core/geom/query/edge.ts +130 -0
- package/src/api/core/geom/query/face.ts +403 -0
- package/src/api/core/geom/query/halfedge.ts +210 -0
- package/src/api/core/geom/query/index.ts +63 -0
- package/src/api/core/geom/query/profile.ts +473 -0
- package/src/api/core/geom/query/vertex.ts +205 -0
- package/src/api/core/geom/update/contour.ts +315 -0
- package/src/api/core/geom/update/curve.ts +209 -0
- package/src/api/core/geom/update/index.ts +29 -0
- package/src/api/core/geom/update/profile.ts +377 -0
- package/src/api/core/groups.ts +521 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +46 -1
- package/src/api/core/layers.ts +333 -0
- package/src/api/core/math/quat.ts +112 -235
- package/src/api/core/math/vec3.ts +124 -159
- package/src/api/core/project/index.ts +418 -0
- package/src/api/core/tags.ts +808 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/zoom/index.ts +47 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/index.ts +886 -0
- package/src/api/design/delete/index.ts +67 -0
- package/src/api/design/doors/index.ts +285 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/furniture/index.ts +130 -0
- package/src/api/design/index.ts +162 -0
- package/src/api/design/lock.ts +42 -0
- package/src/api/design/materials/index.ts +301 -0
- package/src/api/design/query/geometry/index.ts +166 -0
- package/src/api/design/query/index.ts +937 -0
- package/src/api/design/query/spaces.ts +132 -0
- package/src/api/design/selection/index.ts +144 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +93 -0
- package/src/api/design/update/index.ts +117 -0
- package/src/api/design/windows/index.ts +207 -0
- package/src/api/entity/buildableEnvelope.ts +64 -23
- package/src/api/entity/department.ts +0 -113
- package/src/api/entity/index.ts +4 -9
- package/src/api/entity/referenceLine.ts +50 -38
- package/src/api/entity/space.ts +84 -440
- package/src/api/entity/story.ts +53 -42
- package/src/api/index.ts +17 -17
- package/src/api/presentation/aiInspiration.ts +362 -0
- package/src/api/presentation/diagrams.ts +84 -0
- package/src/api/presentation/import.ts +112 -0
- package/src/api/presentation/index.ts +48 -0
- package/src/api/presentation/sheets.ts +198 -0
- package/src/api/presentation/views.ts +303 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +335 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +171 -0
- package/src/api/program/departments.ts +465 -0
- package/src/api/program/index.ts +71 -0
- package/src/api/program/layout.ts +68 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +326 -0
- package/src/api/program/spreadsheet.ts +2075 -0
- package/src/handles.ts +148 -0
- package/src/host-utils.ts +10 -6
- package/src/index.ts +1 -0
- package/dist/api/core/geom/arc.d.ts +0 -81
- package/dist/api/core/geom/arc.d.ts.map +0 -1
- package/dist/api/core/geom/curve.d.ts +0 -70
- package/dist/api/core/geom/curve.d.ts.map +0 -1
- package/dist/api/core/geom/line.d.ts +0 -56
- package/dist/api/core/geom/line.d.ts.map +0 -1
- package/dist/api/core/geom/profile.d.ts +0 -121
- package/dist/api/core/geom/profile.d.ts.map +0 -1
- package/dist/api/documentation/aiInspiration.d.ts +0 -2155
- package/dist/api/documentation/aiInspiration.d.ts.map +0 -1
- package/dist/api/documentation/index.d.ts +0 -13
- package/dist/api/documentation/index.d.ts.map +0 -1
- package/dist/api/tools/copy.d.ts +0 -59
- package/dist/api/tools/copy.d.ts.map +0 -1
- package/dist/api/tools/index.d.ts +0 -29
- package/dist/api/tools/index.d.ts.map +0 -1
- package/dist/api/tools/offset.d.ts +0 -43
- package/dist/api/tools/offset.d.ts.map +0 -1
- package/dist/api/tools/selection.d.ts +0 -48
- package/dist/api/tools/selection.d.ts.map +0 -1
- package/dist/api/tools/transform.d.ts +0 -114
- package/dist/api/tools/transform.d.ts.map +0 -1
- package/dist/api/units/index.d.ts +0 -163
- package/dist/api/units/index.d.ts.map +0 -1
- package/src/api/core/geom/arc.ts +0 -70
- package/src/api/core/geom/curve.ts +0 -41
- package/src/api/core/geom/line.ts +0 -53
- package/src/api/core/geom/profile.ts +0 -94
- package/src/api/documentation/aiInspiration.ts +0 -871
- package/src/api/documentation/index.ts +0 -15
- package/src/api/tools/copy.ts +0 -55
- package/src/api/tools/index.ts +0 -35
- package/src/api/tools/offset.ts +0 -43
- package/src/api/tools/selection.ts +0 -51
- package/src/api/tools/transform.ts +0 -117
- package/src/api/units/index.ts +0 -163
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { ComponentHandle } from "../../../handles"
|
|
4
|
+
import { PluginDesignChangeResult } from "../lock"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `snaptrude.design.windows` — window-specific reads. Creation lives at
|
|
8
|
+
* `design.create.window`; generic reads (`listWindows`/`getHost`/`getProperties`) live
|
|
9
|
+
* at `design.query.*`. Window targets are {@linkcode ComponentHandle}s.
|
|
10
|
+
*
|
|
11
|
+
* `listTypes` (UI-const catalog), `getSillHeight` (bounds-derived), and the
|
|
12
|
+
* command-wired `mirror` land in a later pass.
|
|
13
|
+
*/
|
|
14
|
+
export abstract class PluginDesignWindowsApi {
|
|
15
|
+
constructor() {}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get the type name of a window — the label that identifies which kind of
|
|
19
|
+
* window the instance is, as shown in its properties.
|
|
20
|
+
*
|
|
21
|
+
* @param window The window to query
|
|
22
|
+
* @returns The type as a `string`, or `null`
|
|
23
|
+
*
|
|
24
|
+
* @examplePrompt What type of window is this?
|
|
25
|
+
* @examplePrompt Is the selected window a casement or a slider?
|
|
26
|
+
* @examplePrompt Tell me the window type used on this wall
|
|
27
|
+
* @examplePrompt Check what kind of window the living room has
|
|
28
|
+
*
|
|
29
|
+
* # Example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const [win] = await snaptrude.design.query.listWindows({ isSelected: true })
|
|
32
|
+
* const type = await snaptrude.design.windows.getType(win)
|
|
33
|
+
* if (type) console.log("window type:", type)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
public abstract getType(window: ComponentHandle): PluginApiReturn<string | null>
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get the width of a window — how wide its opening is along the host wall.
|
|
40
|
+
*
|
|
41
|
+
* @param window The window to query
|
|
42
|
+
* @returns The width as a `number`, or `null`
|
|
43
|
+
*
|
|
44
|
+
* @examplePrompt How wide is this window?
|
|
45
|
+
* @examplePrompt What's the width of the selected window?
|
|
46
|
+
* @examplePrompt Measure the width of the kitchen window
|
|
47
|
+
* @examplePrompt Check whether this window is 1200mm wide
|
|
48
|
+
*
|
|
49
|
+
* # Example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const [win] = await snaptrude.design.query.listWindows()
|
|
52
|
+
* const width = await snaptrude.design.windows.getWidth(win)
|
|
53
|
+
* if (width !== null) console.log("window width:", width)
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
public abstract getWidth(window: ComponentHandle): PluginApiReturn<number | null>
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get the height of a window — how tall its opening is on the host wall.
|
|
60
|
+
*
|
|
61
|
+
* @param window The window to query
|
|
62
|
+
* @returns The height as a `number`, or `null`
|
|
63
|
+
*
|
|
64
|
+
* @examplePrompt How tall is this window?
|
|
65
|
+
* @examplePrompt What's the height of the selected window?
|
|
66
|
+
* @examplePrompt Check the window height on this wall
|
|
67
|
+
* @examplePrompt Is the bedroom window 1.5m high?
|
|
68
|
+
*
|
|
69
|
+
* # Example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const [win] = await snaptrude.design.query.listWindows()
|
|
72
|
+
* const height = await snaptrude.design.windows.getHeight(win)
|
|
73
|
+
* if (height !== null) console.log("window height:", height)
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
public abstract getHeight(window: ComponentHandle): PluginApiReturn<number | null>
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get a window's full dimensions in one call — width along the wall, vertical
|
|
80
|
+
* height, and thickness through the wall — measured in the window's local
|
|
81
|
+
* oriented space.
|
|
82
|
+
*
|
|
83
|
+
* @param window The window to query
|
|
84
|
+
* @returns The dimensions, or `null`
|
|
85
|
+
*
|
|
86
|
+
* @examplePrompt What are the dimensions of this window?
|
|
87
|
+
* @examplePrompt How big is the selected window?
|
|
88
|
+
* @examplePrompt Give me the width, height and depth of this window
|
|
89
|
+
* @examplePrompt Measure the living room window
|
|
90
|
+
* @examplePrompt Get the window size including its thickness through the wall
|
|
91
|
+
*
|
|
92
|
+
* # Example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const [win] = await snaptrude.design.query.listWindows({ isSelected: true })
|
|
95
|
+
* const dims = await snaptrude.design.windows.getDimensions(win)
|
|
96
|
+
* if (dims) console.log(dims.width, dims.height, dims.thickness)
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
public abstract getDimensions(
|
|
100
|
+
window: ComponentHandle
|
|
101
|
+
): PluginApiReturn<PluginWindowDimensions | null>
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Set the width of a window, resizing its opening and re-cutting the host
|
|
105
|
+
* wall. Width is in engine units; the change is undoable.
|
|
106
|
+
*
|
|
107
|
+
* @param window The window to resize
|
|
108
|
+
* @param width New width (engine units)
|
|
109
|
+
* @returns The affected window
|
|
110
|
+
*
|
|
111
|
+
* @examplePrompt Make this window 1200mm wide
|
|
112
|
+
* @examplePrompt Widen the selected window to 4 feet
|
|
113
|
+
* @examplePrompt Change the window width to 1.5m
|
|
114
|
+
* @examplePrompt Resize the kitchen window to 900 wide
|
|
115
|
+
*
|
|
116
|
+
* # Example
|
|
117
|
+
* ```ts
|
|
118
|
+
* // Takes a single window (unlike design.doors.setWidth, which takes an array)
|
|
119
|
+
* const [win] = await snaptrude.design.query.listWindows({ isSelected: true })
|
|
120
|
+
* const { affected } = await snaptrude.design.windows.setWidth(win, 1200)
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
public abstract setWidth(
|
|
124
|
+
window: ComponentHandle,
|
|
125
|
+
width: number
|
|
126
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Set the height of a window, resizing its opening and re-cutting the host
|
|
130
|
+
* wall. Height is in engine units; the change is undoable.
|
|
131
|
+
*
|
|
132
|
+
* @param window The window to resize
|
|
133
|
+
* @param height New height (engine units)
|
|
134
|
+
* @returns The affected window
|
|
135
|
+
*
|
|
136
|
+
* @examplePrompt Make this window 1.5m tall
|
|
137
|
+
* @examplePrompt Change the window height to 4 feet
|
|
138
|
+
* @examplePrompt Shorten the selected window to 900mm high
|
|
139
|
+
* @examplePrompt Set the bedroom window height to 1200
|
|
140
|
+
*
|
|
141
|
+
* # Example
|
|
142
|
+
* ```ts
|
|
143
|
+
* const [win] = await snaptrude.design.query.listWindows({ isSelected: true })
|
|
144
|
+
* await snaptrude.design.windows.setHeight(win, 1500)
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
public abstract setHeight(
|
|
148
|
+
window: ComponentHandle,
|
|
149
|
+
height: number
|
|
150
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Arguments for the single-window read methods.
|
|
155
|
+
*
|
|
156
|
+
* | Property | Type | Description |
|
|
157
|
+
* |---|---|---|
|
|
158
|
+
* | `window` | {@linkcode ComponentHandle} | The window to query |
|
|
159
|
+
*/
|
|
160
|
+
export const PluginDesignWindowArgs = z.object({
|
|
161
|
+
window: ComponentHandle,
|
|
162
|
+
})
|
|
163
|
+
export type PluginDesignWindowArgs = z.infer<typeof PluginDesignWindowArgs>
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* A window's dimensions.
|
|
167
|
+
*
|
|
168
|
+
* | Property | Type | Description |
|
|
169
|
+
* |---|---|---|
|
|
170
|
+
* | `width` | `number` | Along the wall |
|
|
171
|
+
* | `height` | `number` | Vertical |
|
|
172
|
+
* | `thickness` | `number` | Through the wall (engine `length` axis) |
|
|
173
|
+
*/
|
|
174
|
+
export const PluginWindowDimensions = z.object({
|
|
175
|
+
width: z.number(),
|
|
176
|
+
height: z.number(),
|
|
177
|
+
thickness: z.number(),
|
|
178
|
+
})
|
|
179
|
+
export type PluginWindowDimensions = z.infer<typeof PluginWindowDimensions>
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Arguments for {@linkcode PluginDesignWindowsApi.setWidth}.
|
|
183
|
+
*
|
|
184
|
+
* | Property | Type | Description |
|
|
185
|
+
* |---|---|---|
|
|
186
|
+
* | `window` | {@linkcode ComponentHandle} | The window to resize |
|
|
187
|
+
* | `width` | `number` | New width (engine units) |
|
|
188
|
+
*/
|
|
189
|
+
export const PluginDesignWindowSetWidthArgs = z.object({
|
|
190
|
+
window: ComponentHandle,
|
|
191
|
+
width: z.number(),
|
|
192
|
+
})
|
|
193
|
+
export type PluginDesignWindowSetWidthArgs = z.infer<typeof PluginDesignWindowSetWidthArgs>
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Arguments for {@linkcode PluginDesignWindowsApi.setHeight}.
|
|
197
|
+
*
|
|
198
|
+
* | Property | Type | Description |
|
|
199
|
+
* |---|---|---|
|
|
200
|
+
* | `window` | {@linkcode ComponentHandle} | The window to resize |
|
|
201
|
+
* | `height` | `number` | New height (engine units) |
|
|
202
|
+
*/
|
|
203
|
+
export const PluginDesignWindowSetHeightArgs = z.object({
|
|
204
|
+
window: ComponentHandle,
|
|
205
|
+
height: z.number(),
|
|
206
|
+
})
|
|
207
|
+
export type PluginDesignWindowSetHeightArgs = z.infer<typeof PluginDesignWindowSetHeightArgs>
|
|
@@ -15,66 +15,107 @@ export abstract class PluginBuildableEnvelopeApi {
|
|
|
15
15
|
constructor() {}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Create a new parametric buildable envelope
|
|
18
|
+
* Create a new parametric buildable envelope — the zoning-regulated volume a
|
|
19
|
+
* building may occupy — generated from a site polygon, tiered setbacks, a
|
|
20
|
+
* height or floor-count cap, and optional FAR and lot-coverage limits.
|
|
19
21
|
*
|
|
20
|
-
* @param
|
|
22
|
+
* @param sitePolygon - Site polygon vertices in `lengthUnit`; minimum 3 vertices.
|
|
23
|
+
* @param lengthUnit - Unit used by all length fields (`"ft" | "m"`).
|
|
24
|
+
* @param setbacks - Setback profile, ground tier first; minimum 1 tier.
|
|
25
|
+
* @param verticalCap - Maximum height or floor count.
|
|
26
|
+
* @param floorToFloor - Required floor-to-floor height in `lengthUnit`.
|
|
27
|
+
* @param farRatio - Optional FAR value, positive when provided.
|
|
28
|
+
* @param lotCoverageMaxPct - Optional lot coverage cap, `0..100`.
|
|
21
29
|
* @returns A {@linkcode PluginBuildableEnvelopeCreateResult} with the
|
|
22
30
|
* `buildableEnvelopeId` of the created envelope.
|
|
23
31
|
* @throws If validation fails or generation produces no renderable geometry.
|
|
24
32
|
*
|
|
33
|
+
* @examplePrompt Create a buildable envelope for my site
|
|
34
|
+
* @examplePrompt Generate the zoning envelope with 10ft front setbacks
|
|
35
|
+
* @examplePrompt Show the maximum buildable volume with a 150ft height limit
|
|
36
|
+
* @examplePrompt Model the allowable massing from the setback rules
|
|
37
|
+
* @examplePrompt Create a zoning envelope capped at 12 floors with FAR 3
|
|
38
|
+
*
|
|
25
39
|
* # Example
|
|
26
40
|
* ```ts
|
|
27
|
-
* const { buildableEnvelopeId } = await snaptrude.entity.buildableEnvelope.create(
|
|
28
|
-
*
|
|
41
|
+
* const { buildableEnvelopeId } = await snaptrude.entity.buildableEnvelope.create(
|
|
42
|
+
* [
|
|
29
43
|
* { x: 0, z: 0 },
|
|
30
44
|
* { x: 100, z: 0 },
|
|
31
45
|
* { x: 100, z: 80 },
|
|
32
46
|
* { x: 0, z: 80 },
|
|
33
47
|
* ],
|
|
34
|
-
*
|
|
35
|
-
*
|
|
48
|
+
* "ft",
|
|
49
|
+
* [
|
|
36
50
|
* { aboveHeight: 0, front: 10, side: 5, rear: 10 },
|
|
37
51
|
* { aboveHeight: 100, front: 20, side: 10, rear: 20 },
|
|
38
52
|
* ],
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
53
|
+
* { kind: "max_height", maxHeight: 150 },
|
|
54
|
+
* 12,
|
|
55
|
+
* )
|
|
42
56
|
* ```
|
|
43
57
|
*/
|
|
44
58
|
public abstract create(
|
|
45
|
-
|
|
59
|
+
sitePolygon: PluginBuildableEnvelopePolygonVertex[],
|
|
60
|
+
lengthUnit: "ft" | "m",
|
|
61
|
+
setbacks: PluginBuildableEnvelopeSetbackTier[],
|
|
62
|
+
verticalCap: PluginBuildableEnvelopeVerticalCap,
|
|
63
|
+
floorToFloor: number,
|
|
64
|
+
farRatio?: number,
|
|
65
|
+
lotCoverageMaxPct?: number
|
|
46
66
|
): PluginApiReturn<PluginBuildableEnvelopeCreateResult>
|
|
47
67
|
|
|
48
68
|
/**
|
|
49
|
-
* Update an existing parametric buildable envelope
|
|
69
|
+
* Update an existing parametric buildable envelope — regenerate the zoning
|
|
70
|
+
* volume from a revised site polygon, setbacks, vertical cap, or FAR and
|
|
71
|
+
* lot-coverage limits, keeping the same envelope id.
|
|
50
72
|
*
|
|
51
|
-
* @param
|
|
52
|
-
*
|
|
53
|
-
*
|
|
73
|
+
* @param buildableEnvelopeId - Existing envelope ID to update; non-empty and
|
|
74
|
+
* must match an existing envelope on the canvas.
|
|
75
|
+
* @param sitePolygon - Site polygon vertices in `lengthUnit`; minimum 3 vertices.
|
|
76
|
+
* @param lengthUnit - Unit used by all length fields (`"ft" | "m"`).
|
|
77
|
+
* @param setbacks - Setback profile, ground tier first; minimum 1 tier.
|
|
78
|
+
* @param verticalCap - Maximum height or floor count.
|
|
79
|
+
* @param floorToFloor - Required floor-to-floor height in `lengthUnit`.
|
|
80
|
+
* @param farRatio - Optional FAR value, positive when provided.
|
|
81
|
+
* @param lotCoverageMaxPct - Optional lot coverage cap, `0..100`.
|
|
54
82
|
* @returns A {@linkcode PluginBuildableEnvelopeUpdateResult} with the
|
|
55
83
|
* `buildableEnvelopeId` of the updated envelope.
|
|
56
84
|
* @throws If validation fails, the envelope does not exist, or generation
|
|
57
85
|
* produces no renderable geometry.
|
|
58
86
|
*
|
|
87
|
+
* @examplePrompt Change the envelope's height limit to 175 feet
|
|
88
|
+
* @examplePrompt Update the setbacks on the buildable envelope
|
|
89
|
+
* @examplePrompt Regenerate the zoning envelope with a new site boundary
|
|
90
|
+
* @examplePrompt Increase the FAR on the buildable volume
|
|
91
|
+
* @examplePrompt Modify the envelope to allow 15 storeys instead
|
|
92
|
+
*
|
|
59
93
|
* # Example
|
|
60
94
|
* ```ts
|
|
61
|
-
* const { buildableEnvelopeId } = await snaptrude.entity.buildableEnvelope.update(
|
|
62
|
-
*
|
|
63
|
-
*
|
|
95
|
+
* const { buildableEnvelopeId } = await snaptrude.entity.buildableEnvelope.update(
|
|
96
|
+
* existingId,
|
|
97
|
+
* [
|
|
64
98
|
* { x: 0, z: 0 },
|
|
65
99
|
* { x: 100, z: 0 },
|
|
66
100
|
* { x: 100, z: 80 },
|
|
67
101
|
* { x: 0, z: 80 },
|
|
68
102
|
* ],
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
103
|
+
* "ft",
|
|
104
|
+
* [{ aboveHeight: 0, front: 10, side: 5, rear: 10 }],
|
|
105
|
+
* { kind: "max_height", maxHeight: 175 },
|
|
106
|
+
* 12,
|
|
107
|
+
* )
|
|
74
108
|
* ```
|
|
75
109
|
*/
|
|
76
110
|
public abstract update(
|
|
77
|
-
|
|
111
|
+
buildableEnvelopeId: string,
|
|
112
|
+
sitePolygon: PluginBuildableEnvelopePolygonVertex[],
|
|
113
|
+
lengthUnit: "ft" | "m",
|
|
114
|
+
setbacks: PluginBuildableEnvelopeSetbackTier[],
|
|
115
|
+
verticalCap: PluginBuildableEnvelopeVerticalCap,
|
|
116
|
+
floorToFloor: number,
|
|
117
|
+
farRatio?: number,
|
|
118
|
+
lotCoverageMaxPct?: number
|
|
78
119
|
): PluginApiReturn<PluginBuildableEnvelopeUpdateResult>
|
|
79
120
|
}
|
|
80
121
|
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import * as z from "zod"
|
|
2
|
-
import { PluginApiReturn } from "../../types"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Department management — create and query departments.
|
|
6
|
-
*
|
|
7
|
-
* A **department** is a named, colored grouping applied to spaces.
|
|
8
|
-
* Departments are used to categorize spaces by function (e.g. "FOH",
|
|
9
|
-
* "Emergency", "Residential") and control their visual appearance.
|
|
10
|
-
*
|
|
11
|
-
* Accessed via `snaptrude.entity.department`.
|
|
12
|
-
*/
|
|
13
|
-
export abstract class PluginDepartmentApi {
|
|
14
|
-
constructor() {}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Create a new department.
|
|
18
|
-
*
|
|
19
|
-
* @param args - An object containing:
|
|
20
|
-
* - {@linkcode PluginDepartmentCreateArgs.name args.name} — Display name
|
|
21
|
-
* - {@linkcode PluginDepartmentCreateArgs.color args.color} — CSS hex color string (e.g. `"#b5e1dc"`)
|
|
22
|
-
* @returns A {@linkcode PluginDepartmentCreateResult} with the `departmentId`
|
|
23
|
-
* of the created department
|
|
24
|
-
* @throws If department creation fails
|
|
25
|
-
*
|
|
26
|
-
* # Example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const { departmentId } = await snaptrude.entity.department.create({
|
|
29
|
-
* name: "Emergency",
|
|
30
|
-
* color: "#f5e68b",
|
|
31
|
-
* })
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
public abstract create(
|
|
35
|
-
args: PluginDepartmentCreateArgs
|
|
36
|
-
): PluginApiReturn<PluginDepartmentCreateResult>
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get all departments in the current project.
|
|
40
|
-
*
|
|
41
|
-
* Returns every department including well-known ones (Default, Site, etc.)
|
|
42
|
-
* and user-created departments.
|
|
43
|
-
*
|
|
44
|
-
* @returns A {@linkcode PluginDepartmentGetAllResult} with a `departments` array
|
|
45
|
-
*
|
|
46
|
-
* # Example
|
|
47
|
-
* ```ts
|
|
48
|
-
* const { departments } = await snaptrude.entity.department.getAll()
|
|
49
|
-
* for (const dept of departments) {
|
|
50
|
-
* console.log(dept.id, dept.name, dept.color)
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
public abstract getAll(): PluginApiReturn<PluginDepartmentGetAllResult>
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Arguments for {@linkcode PluginDepartmentApi.create}.
|
|
59
|
-
*
|
|
60
|
-
* | Property | Type | Description |
|
|
61
|
-
* |---|---|---|
|
|
62
|
-
* | `name` | `string` | Display name of the department |
|
|
63
|
-
* | `color` | `string` | CSS hex color string (e.g. `"#b5e1dc"`) |
|
|
64
|
-
*/
|
|
65
|
-
export const PluginDepartmentCreateArgs = z.object({
|
|
66
|
-
name: z.string(),
|
|
67
|
-
color: z.string(),
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
export type PluginDepartmentCreateArgs = z.infer<
|
|
71
|
-
typeof PluginDepartmentCreateArgs
|
|
72
|
-
>
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Result of {@linkcode PluginDepartmentApi.create}.
|
|
76
|
-
*
|
|
77
|
-
* | Property | Type | Description |
|
|
78
|
-
* |---|---|---|
|
|
79
|
-
* | `departmentId` | `string` | Unique ID of the created department |
|
|
80
|
-
*/
|
|
81
|
-
export const PluginDepartmentCreateResult = z.object({
|
|
82
|
-
departmentId: z.string(),
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
export type PluginDepartmentCreateResult = z.infer<
|
|
86
|
-
typeof PluginDepartmentCreateResult
|
|
87
|
-
>
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* A single department entry returned by {@linkcode PluginDepartmentApi.getAll}.
|
|
91
|
-
*/
|
|
92
|
-
export const PluginDepartmentEntry = z.object({
|
|
93
|
-
id: z.string(),
|
|
94
|
-
name: z.string(),
|
|
95
|
-
color: z.string(),
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
export type PluginDepartmentEntry = z.infer<typeof PluginDepartmentEntry>
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Result of {@linkcode PluginDepartmentApi.getAll}.
|
|
102
|
-
*
|
|
103
|
-
* | Property | Type | Description |
|
|
104
|
-
* |---|---|---|
|
|
105
|
-
* | `departments` | {@linkcode PluginDepartmentEntry}`[]` | All departments in the project |
|
|
106
|
-
*/
|
|
107
|
-
export const PluginDepartmentGetAllResult = z.object({
|
|
108
|
-
departments: z.array(PluginDepartmentEntry),
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
export type PluginDepartmentGetAllResult = z.infer<
|
|
112
|
-
typeof PluginDepartmentGetAllResult
|
|
113
|
-
>
|
package/src/api/entity/index.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import { PluginBuildableEnvelopeApi } from "./buildableEnvelope"
|
|
2
|
-
import { PluginDepartmentApi } from "./department"
|
|
3
2
|
import { PluginReferenceLineApi } from "./referenceLine"
|
|
4
|
-
import { PluginSpaceApi } from "./space"
|
|
5
3
|
import { PluginStoryApi } from "./story"
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* CRUD operations on Snaptrude building entities.
|
|
9
7
|
*
|
|
10
|
-
* - {@linkcode PluginEntityApi.space} — Create, query, and delete spaces (rooms/masses)
|
|
11
8
|
* - {@linkcode PluginEntityApi.story} — Create, query, and update stories (floors)
|
|
12
9
|
* - {@linkcode PluginEntityApi.referenceLine} — Create, query, and delete reference lines
|
|
13
|
-
* - {@linkcode PluginEntityApi.department} — Create and query departments
|
|
14
10
|
* - {@linkcode PluginEntityApi.buildableEnvelope} — Create or update parametric buildable envelopes
|
|
11
|
+
*
|
|
12
|
+
* Space operations moved to `design.create.spaces` / `design.update.*` /
|
|
13
|
+
* `design.query.*` / `design.delete.entities` (the `entity.space` API was removed);
|
|
14
|
+
* `./space` still exports the shared space value types.
|
|
15
15
|
*/
|
|
16
16
|
export abstract class PluginEntityApi {
|
|
17
|
-
/** Space (room/mass) operations. See {@linkcode PluginSpaceApi}. */
|
|
18
|
-
public abstract space: PluginSpaceApi
|
|
19
17
|
/** Story (floor/storey) operations. See {@linkcode PluginStoryApi}. */
|
|
20
18
|
public abstract story: PluginStoryApi
|
|
21
19
|
/** Reference line operations. See {@linkcode PluginReferenceLineApi}. */
|
|
22
20
|
public abstract referenceLine: PluginReferenceLineApi
|
|
23
|
-
/** Department operations. See {@linkcode PluginDepartmentApi}. */
|
|
24
|
-
public abstract department: PluginDepartmentApi
|
|
25
21
|
/** Buildable Envelope operations. See {@linkcode PluginBuildableEnvelopeApi}. */
|
|
26
22
|
public abstract buildableEnvelope: PluginBuildableEnvelopeApi
|
|
27
23
|
|
|
@@ -29,7 +25,6 @@ export abstract class PluginEntityApi {
|
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
export * from "./buildableEnvelope"
|
|
32
|
-
export * from "./department"
|
|
33
28
|
export * from "./referenceLine"
|
|
34
29
|
export * from "./space"
|
|
35
30
|
export * from "./story"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { PluginApiReturn } from "../../types"
|
|
3
|
-
import {
|
|
4
|
-
import { PCurve } from "../core/geom/curve"
|
|
3
|
+
import { ProfileHandle, CurveHandle } from "../../handles"
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Reference line management — create, query, and delete reference lines.
|
|
@@ -21,61 +20,68 @@ export abstract class PluginReferenceLineApi {
|
|
|
21
20
|
/**
|
|
22
21
|
* Create multiple reference lines from a profile.
|
|
23
22
|
*
|
|
24
|
-
* Each
|
|
23
|
+
* Each curve in the given {@linkcode ProfileHandle} becomes
|
|
25
24
|
* a separate reference line. Uses `ReferenceLineConstructor.createFromProfile`
|
|
26
25
|
* internally.
|
|
27
26
|
*
|
|
28
|
-
* @param
|
|
29
|
-
*
|
|
30
|
-
* {@linkcode PProfile} whose curves define the reference lines to create
|
|
27
|
+
* @param profile - A {@linkcode ProfileHandle} whose curves define the
|
|
28
|
+
* reference lines to create
|
|
31
29
|
* @returns A {@linkcode PluginReferenceLineCreateMultiResult} with the
|
|
32
30
|
* `referenceLineIds` of the created reference lines
|
|
33
31
|
* @throws If reference line creation fails
|
|
34
32
|
*
|
|
33
|
+
* @examplePrompt Draw grid lines across the site
|
|
34
|
+
* @examplePrompt Create reference lines from these curves
|
|
35
|
+
* @examplePrompt Add alignment guides along the building edge
|
|
36
|
+
* @examplePrompt Set up a structural grid using guide lines
|
|
37
|
+
* @examplePrompt Turn this profile into reference lines
|
|
38
|
+
*
|
|
35
39
|
* # Example
|
|
36
40
|
* ```ts
|
|
37
41
|
* const { vec3 } = snaptrude.core.math
|
|
38
42
|
*
|
|
39
|
-
* const
|
|
40
|
-
* const
|
|
41
|
-
* const
|
|
43
|
+
* const start = await vec3.new(0, 0, 0)
|
|
44
|
+
* const mid = await vec3.new(10, 0, 0)
|
|
45
|
+
* const end = await vec3.new(10, 0, 10)
|
|
46
|
+
* const l1 = await snaptrude.core.geom.create.line(start, mid)
|
|
47
|
+
* const l2 = await snaptrude.core.geom.create.line(mid, end)
|
|
48
|
+
* const profile = await snaptrude.core.geom.create.profileFromCurves([l1, l2])
|
|
42
49
|
*
|
|
43
|
-
* const { referenceLineIds } = await snaptrude.entity.referenceLine.createMulti(
|
|
44
|
-
* profile,
|
|
45
|
-
* })
|
|
50
|
+
* const { referenceLineIds } = await snaptrude.entity.referenceLine.createMulti(profile)
|
|
46
51
|
* ```
|
|
47
52
|
*/
|
|
48
53
|
public abstract createMulti(
|
|
49
|
-
|
|
54
|
+
profile: ProfileHandle
|
|
50
55
|
): PluginApiReturn<PluginReferenceLineCreateMultiResult>
|
|
51
56
|
|
|
52
57
|
/**
|
|
53
58
|
* Get properties of a reference line by its ID.
|
|
54
59
|
*
|
|
55
|
-
* Only the properties listed in
|
|
56
|
-
*
|
|
57
|
-
* in the result.
|
|
60
|
+
* Only the properties listed in `properties` are returned — unlisted
|
|
61
|
+
* properties will be `undefined` in the result.
|
|
58
62
|
*
|
|
59
|
-
* @param
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* - {@linkcode PluginReferenceLineGetArgs.properties args.properties} — Array of
|
|
63
|
-
* property names to retrieve. See {@linkcode PluginReferenceLineGetProperty}.
|
|
63
|
+
* @param referenceLineId - The unique reference line ID
|
|
64
|
+
* @param properties - Array of property names to retrieve. See
|
|
65
|
+
* {@linkcode PluginReferenceLineGetProperty}.
|
|
64
66
|
* @returns A partial {@linkcode PluginReferenceLineGetResult} containing only the
|
|
65
67
|
* requested properties
|
|
66
68
|
* @throws If the reference line does not exist
|
|
67
69
|
*
|
|
70
|
+
* @examplePrompt Get the curve geometry of this reference line
|
|
71
|
+
* @examplePrompt Where does this grid line run?
|
|
72
|
+
* @examplePrompt Read the geometry of a guide line by its id
|
|
73
|
+
* @examplePrompt Look up the curve of the selected reference line
|
|
74
|
+
*
|
|
68
75
|
* # Example
|
|
69
76
|
* ```ts
|
|
70
|
-
* const result = await snaptrude.entity.referenceLine.get(
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* })
|
|
74
|
-
* console.log(result.curve) // PCurve
|
|
77
|
+
* const result = await snaptrude.entity.referenceLine.get("some-ref-line-id", ["curve"])
|
|
78
|
+
* // result.curve is an opaque CurveHandle; a dedicated curve read API for its
|
|
79
|
+
* // coordinates is exposed separately via `snaptrude.core.geom.curve`.
|
|
75
80
|
* ```
|
|
76
81
|
*/
|
|
77
82
|
public abstract get(
|
|
78
|
-
|
|
83
|
+
referenceLineId: string,
|
|
84
|
+
properties: z.infer<typeof PluginReferenceLineGetProperty>[]
|
|
79
85
|
): PluginApiReturn<PluginReferenceLineGetResult>
|
|
80
86
|
|
|
81
87
|
/**
|
|
@@ -88,6 +94,11 @@ export abstract class PluginReferenceLineApi {
|
|
|
88
94
|
* @returns A {@linkcode PluginReferenceLineGetAllResult} with a
|
|
89
95
|
* `referenceLineIds` array
|
|
90
96
|
*
|
|
97
|
+
* @examplePrompt How many grid lines are in the project?
|
|
98
|
+
* @examplePrompt List all the reference lines in my model
|
|
99
|
+
* @examplePrompt Show every guide line in the file
|
|
100
|
+
* @examplePrompt Do I have any reference lines in this project?
|
|
101
|
+
*
|
|
91
102
|
* # Example
|
|
92
103
|
* ```ts
|
|
93
104
|
* const { referenceLineIds } = await snaptrude.entity.referenceLine.getAll()
|
|
@@ -102,20 +113,21 @@ export abstract class PluginReferenceLineApi {
|
|
|
102
113
|
* Permanently removes the reference line and its associated mesh from
|
|
103
114
|
* the scene. This operation is undoable via Snaptrude's command system.
|
|
104
115
|
*
|
|
105
|
-
* @param
|
|
106
|
-
* - {@linkcode PluginReferenceLineDeleteArgs.referenceLineId args.referenceLineId} —
|
|
107
|
-
* The unique reference line ID to delete
|
|
116
|
+
* @param referenceLineId - The unique reference line ID to delete
|
|
108
117
|
* @throws If the reference line does not exist
|
|
109
118
|
*
|
|
119
|
+
* @examplePrompt Delete this reference line
|
|
120
|
+
* @examplePrompt Remove the grid line I just drew
|
|
121
|
+
* @examplePrompt Get rid of the alignment guide on the left
|
|
122
|
+
* @examplePrompt Erase a reference line by its id
|
|
123
|
+
*
|
|
110
124
|
* # Example
|
|
111
125
|
* ```ts
|
|
112
|
-
* await snaptrude.entity.referenceLine.delete(
|
|
113
|
-
* referenceLineId: "some-ref-line-id",
|
|
114
|
-
* })
|
|
126
|
+
* await snaptrude.entity.referenceLine.delete("some-ref-line-id")
|
|
115
127
|
* ```
|
|
116
128
|
*/
|
|
117
129
|
public abstract delete(
|
|
118
|
-
|
|
130
|
+
referenceLineId: string
|
|
119
131
|
): PluginApiReturn<PluginReferenceLineDeleteResult>
|
|
120
132
|
}
|
|
121
133
|
|
|
@@ -124,10 +136,10 @@ export abstract class PluginReferenceLineApi {
|
|
|
124
136
|
*
|
|
125
137
|
* | Property | Type | Description |
|
|
126
138
|
* |---|---|---|
|
|
127
|
-
* | `profile` | {@linkcode
|
|
139
|
+
* | `profile` | {@linkcode ProfileHandle} | Profile handle whose curves define reference lines |
|
|
128
140
|
*/
|
|
129
141
|
export const PluginReferenceLineCreateMultiArgs = z.object({
|
|
130
|
-
profile:
|
|
142
|
+
profile: ProfileHandle,
|
|
131
143
|
})
|
|
132
144
|
|
|
133
145
|
export type PluginReferenceLineCreateMultiArgs = z.infer<typeof PluginReferenceLineCreateMultiArgs>
|
|
@@ -150,7 +162,7 @@ export type PluginReferenceLineCreateMultiResult = z.infer<typeof PluginReferenc
|
|
|
150
162
|
*
|
|
151
163
|
* | Value | Return Type | Description |
|
|
152
164
|
* |---|---|---|
|
|
153
|
-
* | `"curve"` | {@linkcode
|
|
165
|
+
* | `"curve"` | {@linkcode CurveHandle} | The curve geometry of the reference line, as an opaque handle |
|
|
154
166
|
*/
|
|
155
167
|
export const PluginReferenceLineGetProperty = z.enum([
|
|
156
168
|
"curve",
|
|
@@ -179,7 +191,7 @@ export type PluginReferenceLineGetArgs = z.infer<typeof PluginReferenceLineGetAr
|
|
|
179
191
|
*/
|
|
180
192
|
export const PluginReferenceLineGetResult = z
|
|
181
193
|
.object({
|
|
182
|
-
curve:
|
|
194
|
+
curve: CurveHandle,
|
|
183
195
|
})
|
|
184
196
|
.partial()
|
|
185
197
|
|