@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,162 @@
|
|
|
1
|
+
import { PluginApiReturn } from "../../types"
|
|
2
|
+
import { ComponentHandle } from "../../handles"
|
|
3
|
+
import { PluginDesignCreateApi } from "./create"
|
|
4
|
+
import { PluginDesignQueryApi } from "./query"
|
|
5
|
+
import { PluginDesignSelectionApi } from "./selection"
|
|
6
|
+
import { PluginDesignDoorsApi } from "./doors"
|
|
7
|
+
import { PluginDesignWindowsApi } from "./windows"
|
|
8
|
+
import { PluginDesignFurnitureApi } from "./furniture"
|
|
9
|
+
import { PluginDesignMaterialsApi } from "./materials"
|
|
10
|
+
import { PluginDesignEraseApi } from "./erase"
|
|
11
|
+
import { PluginDesignDeleteApi } from "./delete"
|
|
12
|
+
import { PluginDesignBooleanApi } from "./boolean"
|
|
13
|
+
import { PluginDesignTransformApi } from "./transform"
|
|
14
|
+
import { PluginDesignEditApi } from "./edit"
|
|
15
|
+
import { PluginDesignUpdateApi } from "./update"
|
|
16
|
+
import { PluginDesignChangeResult } from "./lock"
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `snaptrude.design.*` — author, query & edit BIM geometry.
|
|
20
|
+
*
|
|
21
|
+
* - {@linkcode PluginDesignApi.create} — new BIM entities
|
|
22
|
+
* - {@linkcode PluginDesignApi.query} — read entities + their geometry
|
|
23
|
+
* - {@linkcode PluginDesignApi.selection} — read/mutate the scene selection
|
|
24
|
+
* - {@linkcode PluginDesignApi.doors} / {@linkcode PluginDesignApi.windows} — fenestration reads + edits
|
|
25
|
+
* - {@linkcode PluginDesignApi.furniture} — furniture catalog reads
|
|
26
|
+
* - {@linkcode PluginDesignApi.materials} — material library + assignment
|
|
27
|
+
* - {@linkcode PluginDesignApi.boolean} — CSG boolean ops (union / subtract / intersect)
|
|
28
|
+
* - {@linkcode PluginDesignApi.erase} — plan-level adjacency-edge erase (NOT hard delete)
|
|
29
|
+
* - {@linkcode PluginDesignApi.delete} — hard entity removal
|
|
30
|
+
* - {@linkcode PluginDesignApi.lock} / {@linkcode PluginDesignApi.unlock} / {@linkcode PluginDesignApi.isLocked} / {@linkcode PluginDesignApi.listLocked} — lock state (top-level design verbs, §2A.1)
|
|
31
|
+
*
|
|
32
|
+
* Transform and edit operation namespaces land here in later waves.
|
|
33
|
+
*/
|
|
34
|
+
export abstract class PluginDesignApi {
|
|
35
|
+
/** Author new scene-committed BIM entities. See {@linkcode PluginDesignCreateApi}. */
|
|
36
|
+
public abstract create: PluginDesignCreateApi
|
|
37
|
+
/** Read scene entities and their geometry. See {@linkcode PluginDesignQueryApi}. */
|
|
38
|
+
public abstract query: PluginDesignQueryApi
|
|
39
|
+
/** Read/mutate the current selection. See {@linkcode PluginDesignSelectionApi}. */
|
|
40
|
+
public abstract selection: PluginDesignSelectionApi
|
|
41
|
+
/** Door-specific reads + edits. See {@linkcode PluginDesignDoorsApi}. */
|
|
42
|
+
public abstract doors: PluginDesignDoorsApi
|
|
43
|
+
/** Window-specific reads. See {@linkcode PluginDesignWindowsApi}. */
|
|
44
|
+
public abstract windows: PluginDesignWindowsApi
|
|
45
|
+
/** Furniture catalog reads. See {@linkcode PluginDesignFurnitureApi}. */
|
|
46
|
+
public abstract furniture: PluginDesignFurnitureApi
|
|
47
|
+
/** Material library + assignment. See {@linkcode PluginDesignMaterialsApi}. */
|
|
48
|
+
public abstract materials: PluginDesignMaterialsApi
|
|
49
|
+
/** Plan-level adjacency-edge erase (NOT hard delete). See {@linkcode PluginDesignEraseApi}. */
|
|
50
|
+
public abstract erase: PluginDesignEraseApi
|
|
51
|
+
/** Hard entity removal. See {@linkcode PluginDesignDeleteApi}. */
|
|
52
|
+
public abstract delete: PluginDesignDeleteApi
|
|
53
|
+
/** CSG boolean ops (union / subtract / intersect). See {@linkcode PluginDesignBooleanApi}. */
|
|
54
|
+
public abstract boolean: PluginDesignBooleanApi
|
|
55
|
+
/** Rigid transforms — move / rotate. See {@linkcode PluginDesignTransformApi}. */
|
|
56
|
+
public abstract transform: PluginDesignTransformApi
|
|
57
|
+
/** Non-create geometry edits — offset-split. See {@linkcode PluginDesignEditApi}. */
|
|
58
|
+
public abstract edit: PluginDesignEditApi
|
|
59
|
+
/** Update existing entities — properties + geometry. See {@linkcode PluginDesignUpdateApi}. */
|
|
60
|
+
public abstract update: PluginDesignUpdateApi
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Lock entities so they cannot be edited. Undoable. Cascades to void/door/window
|
|
64
|
+
* children, stacked-wall companions, and terrain neighborhood; skips
|
|
65
|
+
* active-group members.
|
|
66
|
+
* @param components Entities to lock
|
|
67
|
+
* @returns The affected entities (post-cascade)
|
|
68
|
+
*
|
|
69
|
+
* @examplePrompt Lock the selected walls so they can't be edited
|
|
70
|
+
* @examplePrompt Freeze these masses so nobody moves them by accident
|
|
71
|
+
* @examplePrompt Lock everything on the ground floor
|
|
72
|
+
* @examplePrompt Protect this room from further changes
|
|
73
|
+
*
|
|
74
|
+
* # Example
|
|
75
|
+
* ```ts
|
|
76
|
+
* // Lock every wall on the ground storey
|
|
77
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
78
|
+
* const { affected } = await snaptrude.design.lock(walls)
|
|
79
|
+
* // affected is post-cascade: hosted doors/windows are included
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
public abstract lock(components: ComponentHandle[]): PluginApiReturn<PluginDesignChangeResult>
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Unlock previously locked entities so they can be edited again. Undoable.
|
|
86
|
+
* Paired with {@linkcode PluginDesignApi.lock}.
|
|
87
|
+
* @param components Entities to unlock
|
|
88
|
+
* @returns The affected entities
|
|
89
|
+
*
|
|
90
|
+
* @examplePrompt Unlock the selected objects
|
|
91
|
+
* @examplePrompt Make this locked wall editable again
|
|
92
|
+
* @examplePrompt Unfreeze the masses I locked earlier
|
|
93
|
+
* @examplePrompt Remove the lock from these doors
|
|
94
|
+
*
|
|
95
|
+
* # Example
|
|
96
|
+
* ```ts
|
|
97
|
+
* // Unlock everything that is explicitly locked
|
|
98
|
+
* const locked = await snaptrude.design.listLocked()
|
|
99
|
+
* const { affected } = await snaptrude.design.unlock(locked)
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
public abstract unlock(components: ComponentHandle[]): PluginApiReturn<PluginDesignChangeResult>
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Test whether an entity is locked (folds group + bucket lock unless `includeInherited: false`).
|
|
106
|
+
* @param component The entity to test
|
|
107
|
+
* @param includeInherited Fold group + bucket lock (default `true`); `false` reads the own flag only
|
|
108
|
+
* @returns `true` if locked, otherwise `false`
|
|
109
|
+
*
|
|
110
|
+
* @examplePrompt Is this wall locked?
|
|
111
|
+
* @examplePrompt Check whether the selected mass is locked or editable
|
|
112
|
+
* @examplePrompt Why can't I move this object? Check if it is locked
|
|
113
|
+
* @examplePrompt Tell me if this room is locked, counting locks inherited from its group
|
|
114
|
+
*
|
|
115
|
+
* # Example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
118
|
+
* const locked = await snaptrude.design.isLocked(wall)
|
|
119
|
+
* // Own flag only — ignore locks inherited from the group / bucket
|
|
120
|
+
* const ownLock = await snaptrude.design.isLocked(wall, false)
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
public abstract isLocked(
|
|
124
|
+
component: ComponentHandle,
|
|
125
|
+
includeInherited?: boolean,
|
|
126
|
+
): PluginApiReturn<boolean>
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* List the explicitly-locked entities (excludes purely group/bucket-inherited locks).
|
|
130
|
+
* @returns The locked entities as {@linkcode ComponentHandle}`[]`
|
|
131
|
+
*
|
|
132
|
+
* @examplePrompt Which objects in the model are locked?
|
|
133
|
+
* @examplePrompt List all the locked entities in this project
|
|
134
|
+
* @examplePrompt Show everything that has been locked
|
|
135
|
+
* @examplePrompt Are there any locked walls or masses in the scene?
|
|
136
|
+
*
|
|
137
|
+
* # Example
|
|
138
|
+
* ```ts
|
|
139
|
+
* const locked = await snaptrude.design.listLocked()
|
|
140
|
+
* console.log(locked.length, "explicitly locked entities")
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
public abstract listLocked(): PluginApiReturn<ComponentHandle[]>
|
|
144
|
+
|
|
145
|
+
constructor() {}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export * from "./create"
|
|
149
|
+
export * from "./query"
|
|
150
|
+
export * from "./selection"
|
|
151
|
+
export * from "./doors"
|
|
152
|
+
export * from "./windows"
|
|
153
|
+
export * from "./furniture"
|
|
154
|
+
export * from "./materials"
|
|
155
|
+
export * from "./lock"
|
|
156
|
+
export * from "./erase"
|
|
157
|
+
export * from "./delete"
|
|
158
|
+
export * from "./shared"
|
|
159
|
+
export * from "./boolean"
|
|
160
|
+
export * from "./transform"
|
|
161
|
+
export * from "./edit"
|
|
162
|
+
export * from "./update"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { ComponentHandle } from "../../handles"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared result for scene-state change mutations (lock/unlock, selection, visibility)
|
|
6
|
+
* — echoes the handles actually affected (post-cascade for lock). Errors throw
|
|
7
|
+
* (RPC rejects); there is no `Result<>` monad in the SDK (consistent with
|
|
8
|
+
* `design.create.*` returning a handle directly).
|
|
9
|
+
*/
|
|
10
|
+
export const PluginDesignChangeResult = z.object({
|
|
11
|
+
affected: z.array(ComponentHandle),
|
|
12
|
+
})
|
|
13
|
+
export type PluginDesignChangeResult = z.infer<typeof PluginDesignChangeResult>
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Arguments for {@linkcode PluginDesignApi.lock} / {@linkcode PluginDesignApi.unlock}.
|
|
17
|
+
*
|
|
18
|
+
* | Property | Type | Description |
|
|
19
|
+
* |---|---|---|
|
|
20
|
+
* | `components` | {@linkcode ComponentHandle}`[]` | Entities to lock / unlock |
|
|
21
|
+
*/
|
|
22
|
+
export const PluginDesignLockArgs = z.object({
|
|
23
|
+
components: z.array(ComponentHandle),
|
|
24
|
+
})
|
|
25
|
+
export type PluginDesignLockArgs = z.infer<typeof PluginDesignLockArgs>
|
|
26
|
+
|
|
27
|
+
export const PluginDesignUnlockArgs = PluginDesignLockArgs
|
|
28
|
+
export type PluginDesignUnlockArgs = z.infer<typeof PluginDesignUnlockArgs>
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Arguments for {@linkcode PluginDesignApi.isLocked}.
|
|
32
|
+
*
|
|
33
|
+
* | Property | Type | Description |
|
|
34
|
+
* |---|---|---|
|
|
35
|
+
* | `component` | {@linkcode ComponentHandle} | The entity to test |
|
|
36
|
+
* | `includeInherited` | `boolean` | Fold group + bucket lock (default `true`); `false` reads the own flag only |
|
|
37
|
+
*/
|
|
38
|
+
export const PluginDesignIsLockedArgs = z.object({
|
|
39
|
+
component: ComponentHandle,
|
|
40
|
+
includeInherited: z.boolean().optional(),
|
|
41
|
+
})
|
|
42
|
+
export type PluginDesignIsLockedArgs = z.infer<typeof PluginDesignIsLockedArgs>
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { ComponentHandle, MaterialHandle } from "../../../handles"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `snaptrude.design.materials` — the project material library + material assignment.
|
|
7
|
+
*
|
|
8
|
+
* Materials are {@linkcode MaterialHandle}s (entity-style, name-addressed). Reads return
|
|
9
|
+
* a {@linkcode MaterialHandle}/{@linkcode PluginMaterialInfo}; `apply`/`reset` mutate the
|
|
10
|
+
* scene (undoable via `save`, default `true`). `create` mints a material from a
|
|
11
|
+
* {@linkcode PluginMaterialSpec} (idempotent by name).
|
|
12
|
+
*
|
|
13
|
+
* Face-targeted apply, per-face reads (`listByFace`), and `copy` (needs an undo
|
|
14
|
+
* wrapper) land in a later pass.
|
|
15
|
+
*/
|
|
16
|
+
export abstract class PluginDesignMaterialsApi {
|
|
17
|
+
constructor() {}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* List the project materials.
|
|
21
|
+
* @param scope Which library to list (optional)
|
|
22
|
+
* @returns The materials as {@linkcode MaterialHandle}`[]`
|
|
23
|
+
*
|
|
24
|
+
* @examplePrompt List all the materials in this project
|
|
25
|
+
* @examplePrompt What materials do I have available to apply?
|
|
26
|
+
* @examplePrompt Show me the preset materials library
|
|
27
|
+
* @examplePrompt Which finishes exist in this model?
|
|
28
|
+
* @examplePrompt Get every material in the project palette
|
|
29
|
+
*
|
|
30
|
+
* # Example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const presets = await snaptrude.design.materials.list("preset")
|
|
33
|
+
* console.log(presets.length, "preset materials")
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
public abstract list(scope?: "project" | "preset"): PluginApiReturn<MaterialHandle[]>
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Read a material's descriptor — its name, color, opacity, and texture
|
|
40
|
+
* (when it has one).
|
|
41
|
+
*
|
|
42
|
+
* @param material The material to read
|
|
43
|
+
* @returns The {@linkcode PluginMaterialInfo}, or `null` if the material is gone
|
|
44
|
+
*
|
|
45
|
+
* @examplePrompt What colour is the Brick material?
|
|
46
|
+
* @examplePrompt Show me the details of this material
|
|
47
|
+
* @examplePrompt Get the opacity of the glass finish
|
|
48
|
+
* @examplePrompt Which texture image does the wood material use?
|
|
49
|
+
*
|
|
50
|
+
* # Example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const [material] = await snaptrude.design.materials.list()
|
|
53
|
+
* const info = await snaptrude.design.materials.getInfo(material)
|
|
54
|
+
* if (info) console.log(info.name, info.colorHex, info.alpha)
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
public abstract getInfo(material: MaterialHandle): PluginApiReturn<PluginMaterialInfo | null>
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Apply a material to one or more components — an existing project material by
|
|
61
|
+
* handle, or a new one described inline as a {@linkcode PluginMaterialSpec}.
|
|
62
|
+
* Undoable when `save` is true (the default).
|
|
63
|
+
*
|
|
64
|
+
* @param targets Components to paint
|
|
65
|
+
* @param material Material handle, or an inline {@linkcode PluginMaterialSpec}
|
|
66
|
+
* @param save Commit as an undoable command (default `true`)
|
|
67
|
+
* @returns The number of targets the material was applied to
|
|
68
|
+
*
|
|
69
|
+
* @examplePrompt Paint the selected walls red
|
|
70
|
+
* @examplePrompt Apply the brick material to these walls
|
|
71
|
+
* @examplePrompt Put a wood finish on the floor
|
|
72
|
+
* @examplePrompt Change the colour of this room's walls to #ff8800
|
|
73
|
+
* @examplePrompt Add a concrete texture to the facade
|
|
74
|
+
*
|
|
75
|
+
* # Example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
78
|
+
* // inline spec — creates (or reuses by name) a project material, then applies it
|
|
79
|
+
* const { count } = await snaptrude.design.materials.apply(walls, { name: "Accent Red", color: "#b04a3a" })
|
|
80
|
+
* console.log("painted", count, "walls")
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
public abstract apply(
|
|
84
|
+
targets: ComponentHandle[],
|
|
85
|
+
material: MaterialHandle | PluginMaterialSpec,
|
|
86
|
+
save?: boolean
|
|
87
|
+
): PluginApiReturn<PluginMaterialResult>
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Reset one or more components back to the default material for their type,
|
|
91
|
+
* removing any applied finish. The inverse of `apply`; undoable when `save`
|
|
92
|
+
* is true (the default).
|
|
93
|
+
*
|
|
94
|
+
* @param components Components to reset
|
|
95
|
+
* @param save Commit as an undoable command (default `true`)
|
|
96
|
+
* @returns The number of components reset
|
|
97
|
+
*
|
|
98
|
+
* @examplePrompt Remove the paint from these walls
|
|
99
|
+
* @examplePrompt Reset the selected objects to their default material
|
|
100
|
+
* @examplePrompt Clear the custom finish on the floor
|
|
101
|
+
* @examplePrompt Restore the original colour of this roof
|
|
102
|
+
*
|
|
103
|
+
* # Example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const selected = await snaptrude.design.selection.get()
|
|
106
|
+
* const { count } = await snaptrude.design.materials.reset(selected)
|
|
107
|
+
* console.log("reset", count, "components to their default material")
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
public abstract reset(
|
|
111
|
+
components: ComponentHandle[],
|
|
112
|
+
save?: boolean
|
|
113
|
+
): PluginApiReturn<PluginMaterialResult>
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Create a new material in the project from a spec — a color, texture URL,
|
|
117
|
+
* opacity, and/or name. Idempotent by name: creating with the name of an
|
|
118
|
+
* existing material returns that material instead of duplicating it.
|
|
119
|
+
*
|
|
120
|
+
* @param spec The material construction spec
|
|
121
|
+
* @returns The new material as a {@linkcode MaterialHandle}
|
|
122
|
+
*
|
|
123
|
+
* @examplePrompt Create a new red material called Accent
|
|
124
|
+
* @examplePrompt Make a material from this texture image URL
|
|
125
|
+
* @examplePrompt Add a semi-transparent glass material to the project
|
|
126
|
+
* @examplePrompt Define a dark grey concrete finish I can reuse
|
|
127
|
+
*
|
|
128
|
+
* # Example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const glass = await snaptrude.design.materials.create({ name: "Frosted Glass", color: "#cfe4e8", alpha: 0.4 })
|
|
131
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
132
|
+
* await snaptrude.design.materials.apply(walls, glass)
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
public abstract create(spec: PluginMaterialSpec): PluginApiReturn<MaterialHandle>
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get the default material for a component's type.
|
|
139
|
+
* @param component The component to look up
|
|
140
|
+
* @returns The default material as a {@linkcode MaterialHandle}, or `null`
|
|
141
|
+
*
|
|
142
|
+
* @examplePrompt What is the default material for walls?
|
|
143
|
+
* @examplePrompt Get the standard material this floor type uses
|
|
144
|
+
* @examplePrompt Which material would this roof have out of the box?
|
|
145
|
+
* @examplePrompt Find the default finish for the selected column
|
|
146
|
+
*
|
|
147
|
+
* # Example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
150
|
+
* const defaultMaterial = await snaptrude.design.materials.getDefault(wall)
|
|
151
|
+
* if (defaultMaterial) console.log(await snaptrude.design.materials.getInfo(defaultMaterial))
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
public abstract getDefault(component: ComponentHandle): PluginApiReturn<MaterialHandle | null>
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Test whether a component carries its (type) default material.
|
|
158
|
+
* @param component The component to test
|
|
159
|
+
* @returns `true` if default, otherwise `false`
|
|
160
|
+
*
|
|
161
|
+
* @examplePrompt Is this wall still using its default material?
|
|
162
|
+
* @examplePrompt Has the material on this floor been changed?
|
|
163
|
+
* @examplePrompt Check if the selected object still has its original finish
|
|
164
|
+
* @examplePrompt Tell me whether this roof has been painted or is still standard
|
|
165
|
+
*
|
|
166
|
+
* # Example
|
|
167
|
+
* ```ts
|
|
168
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
169
|
+
* const untouched = await snaptrude.design.materials.isDefault(wall)
|
|
170
|
+
* console.log(untouched ? "still default" : "has been painted")
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
public abstract isDefault(component: ComponentHandle): PluginApiReturn<boolean>
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Test whether a component has a single (uniform) material across all faces.
|
|
177
|
+
* @param component The component to test
|
|
178
|
+
* @returns `true` if uniform, otherwise `false`
|
|
179
|
+
*
|
|
180
|
+
* @examplePrompt Does this wall have the same material on every face?
|
|
181
|
+
* @examplePrompt Is the floor finished uniformly or face by face?
|
|
182
|
+
* @examplePrompt Check if this column is a single material all over
|
|
183
|
+
* @examplePrompt Are any faces of the selected object painted differently?
|
|
184
|
+
*
|
|
185
|
+
* # Example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const [selected] = await snaptrude.design.selection.get()
|
|
188
|
+
* const uniform = await snaptrude.design.materials.isUniform(selected)
|
|
189
|
+
* console.log(uniform ? "one material all over" : "painted per face")
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
public abstract isUniform(component: ComponentHandle): PluginApiReturn<boolean>
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Test whether a material has a texture.
|
|
196
|
+
* @param material The material to test
|
|
197
|
+
* @returns `true` if it has a diffuse texture, otherwise `false`
|
|
198
|
+
*
|
|
199
|
+
* @examplePrompt Does this material have a texture image?
|
|
200
|
+
* @examplePrompt Is the brick material textured or just a flat colour?
|
|
201
|
+
* @examplePrompt Check whether the wood finish uses an image map
|
|
202
|
+
* @examplePrompt Tell me if this material is image-based or a plain colour
|
|
203
|
+
*
|
|
204
|
+
* # Example
|
|
205
|
+
* ```ts
|
|
206
|
+
* const [material] = await snaptrude.design.materials.list()
|
|
207
|
+
* const textured = await snaptrude.design.materials.hasTexture(material)
|
|
208
|
+
* console.log(textured ? "image-based" : "flat colour")
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
public abstract hasTexture(material: MaterialHandle): PluginApiReturn<boolean>
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* A material's descriptor.
|
|
216
|
+
*
|
|
217
|
+
* | Property | Type | Description |
|
|
218
|
+
* |---|---|---|
|
|
219
|
+
* | `name` | `string` | Material name (== the handle token) |
|
|
220
|
+
* | `id` | `string` | Engine material id |
|
|
221
|
+
* | `colorHex` | `string` | Diffuse color as `#rrggbb` |
|
|
222
|
+
* | `alpha` | `number` | Opacity `0..1` |
|
|
223
|
+
* | `materialType` | `string` | Material type tag (optional) |
|
|
224
|
+
* | `textureUrl` | `string` | Diffuse texture URL (optional) |
|
|
225
|
+
*/
|
|
226
|
+
export const PluginMaterialInfo = z.object({
|
|
227
|
+
name: z.string(),
|
|
228
|
+
id: z.string(),
|
|
229
|
+
colorHex: z.string(),
|
|
230
|
+
alpha: z.number(),
|
|
231
|
+
materialType: z.string().optional(),
|
|
232
|
+
textureUrl: z.string().optional(),
|
|
233
|
+
})
|
|
234
|
+
export type PluginMaterialInfo = z.infer<typeof PluginMaterialInfo>
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* A material construction spec (input DTO — NOT a handle).
|
|
238
|
+
*
|
|
239
|
+
* | Property | Type | Description |
|
|
240
|
+
* |---|---|---|
|
|
241
|
+
* | `name` | `string` | Name (optional; generated if omitted) |
|
|
242
|
+
* | `color` | `string` | Diffuse color `#rrggbb` (optional) |
|
|
243
|
+
* | `textureUrl` | `string` | Diffuse texture URL (optional; wins over color) |
|
|
244
|
+
* | `alpha` | `number` | Opacity `0..1` (optional) |
|
|
245
|
+
* | `materialType` | `string` | Material type tag (optional) |
|
|
246
|
+
*/
|
|
247
|
+
export const PluginMaterialSpec = z.object({
|
|
248
|
+
name: z.string().optional(),
|
|
249
|
+
color: z.string().optional(),
|
|
250
|
+
textureUrl: z.string().optional(),
|
|
251
|
+
alpha: z.number().optional(),
|
|
252
|
+
materialType: z.string().optional(),
|
|
253
|
+
})
|
|
254
|
+
export type PluginMaterialSpec = z.infer<typeof PluginMaterialSpec>
|
|
255
|
+
|
|
256
|
+
/** Result of a material mutation — the count of targets affected. */
|
|
257
|
+
export const PluginMaterialResult = z.object({ count: z.number() })
|
|
258
|
+
export type PluginMaterialResult = z.infer<typeof PluginMaterialResult>
|
|
259
|
+
|
|
260
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.list}. */
|
|
261
|
+
export const PluginDesignMaterialsListArgs = z.object({
|
|
262
|
+
scope: z.enum(["project", "preset"]).optional(),
|
|
263
|
+
})
|
|
264
|
+
export type PluginDesignMaterialsListArgs = z.infer<typeof PluginDesignMaterialsListArgs>
|
|
265
|
+
|
|
266
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.getInfo} / `hasTexture`. */
|
|
267
|
+
export const PluginDesignMaterialsGetInfoArgs = z.object({ material: MaterialHandle })
|
|
268
|
+
export type PluginDesignMaterialsGetInfoArgs = z.infer<typeof PluginDesignMaterialsGetInfoArgs>
|
|
269
|
+
|
|
270
|
+
/** Arguments for component-scoped predicates (`getDefault`/`isDefault`/`isUniform`). */
|
|
271
|
+
export const PluginDesignMaterialsComponentArgs = z.object({ component: ComponentHandle })
|
|
272
|
+
export type PluginDesignMaterialsComponentArgs = z.infer<
|
|
273
|
+
typeof PluginDesignMaterialsComponentArgs
|
|
274
|
+
>
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Arguments for {@linkcode PluginDesignMaterialsApi.apply}.
|
|
278
|
+
*
|
|
279
|
+
* | Property | Type | Description |
|
|
280
|
+
* |---|---|---|
|
|
281
|
+
* | `targets` | {@linkcode ComponentHandle}`[]` | Components to paint |
|
|
282
|
+
* | `material` | {@linkcode MaterialHandle} \| {@linkcode PluginMaterialSpec} | Material handle, or an inline spec |
|
|
283
|
+
* | `save` | `boolean` | Commit as an undoable command (default `true`) |
|
|
284
|
+
*/
|
|
285
|
+
export const PluginDesignMaterialsApplyArgs = z.object({
|
|
286
|
+
targets: z.array(ComponentHandle),
|
|
287
|
+
material: z.union([MaterialHandle, PluginMaterialSpec]),
|
|
288
|
+
save: z.boolean().optional(),
|
|
289
|
+
})
|
|
290
|
+
export type PluginDesignMaterialsApplyArgs = z.infer<typeof PluginDesignMaterialsApplyArgs>
|
|
291
|
+
|
|
292
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.reset}. */
|
|
293
|
+
export const PluginDesignMaterialsResetArgs = z.object({
|
|
294
|
+
components: z.array(ComponentHandle),
|
|
295
|
+
save: z.boolean().optional(),
|
|
296
|
+
})
|
|
297
|
+
export type PluginDesignMaterialsResetArgs = z.infer<typeof PluginDesignMaterialsResetArgs>
|
|
298
|
+
|
|
299
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.create}. */
|
|
300
|
+
export const PluginDesignMaterialsCreateArgs = z.object({ spec: PluginMaterialSpec })
|
|
301
|
+
export type PluginDesignMaterialsCreateArgs = z.infer<typeof PluginDesignMaterialsCreateArgs>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../../types"
|
|
3
|
+
import {
|
|
4
|
+
ComponentHandle,
|
|
5
|
+
BrepHandle,
|
|
6
|
+
ContourHandle,
|
|
7
|
+
CurveHandle,
|
|
8
|
+
} from "../../../../handles"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* `snaptrude.design.query.geometry` — read the geometry of scene BIM entities.
|
|
12
|
+
*
|
|
13
|
+
* This is the bridge from the BIM/scene layer (`design.*`, keyed by
|
|
14
|
+
* {@linkcode ComponentHandle}) into the geometry kernel (`core.geom.query.*`,
|
|
15
|
+
* keyed by value/topology handles). {@linkcode PluginDesignQueryGeometryApi.getBrep}
|
|
16
|
+
* mints a {@linkcode BrepHandle} for a component's boundary-representation mesh;
|
|
17
|
+
* {@linkcode PluginDesignQueryGeometryApi.getBottomContour} mints a
|
|
18
|
+
* {@linkcode ContourHandle} for its footprint outline;
|
|
19
|
+
* {@linkcode PluginDesignQueryGeometryApi.getCenterline} mints a
|
|
20
|
+
* {@linkcode CurveHandle} for a wall's core curve.
|
|
21
|
+
*
|
|
22
|
+
* Returned handles are session-ephemeral and go stale on undo/redo/re-topologize
|
|
23
|
+
* — re-fetch a fresh one after edits.
|
|
24
|
+
*/
|
|
25
|
+
export abstract class PluginDesignQueryGeometryApi {
|
|
26
|
+
constructor() {}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the boundary representation (B-rep) of a scene component — the solid
|
|
30
|
+
* geometry (faces, edges, vertices) behind a wall, slab, room or any other
|
|
31
|
+
* scene entity, as a reusable {@linkcode BrepHandle} for the
|
|
32
|
+
* `core.geom.query.brep.*` reads.
|
|
33
|
+
*
|
|
34
|
+
* @param component - The scene component to read
|
|
35
|
+
* @returns The brep as a {@linkcode BrepHandle}, or `null` if the component has no brep geometry
|
|
36
|
+
*
|
|
37
|
+
* @examplePrompt Get the 3D solid geometry of the selected wall
|
|
38
|
+
* @examplePrompt How many faces does this mass have?
|
|
39
|
+
* @examplePrompt Inspect the mesh of this slab so I can look at its faces and edges
|
|
40
|
+
* @examplePrompt Read the vertices of the selected column's geometry
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const brep = await snaptrude.design.query.geometry.getBrep(component)
|
|
45
|
+
* if (brep) {
|
|
46
|
+
* const faces = await snaptrude.core.geom.query.brep.listFaces(brep)
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
public abstract getBrep(
|
|
51
|
+
component: ComponentHandle
|
|
52
|
+
): PluginApiReturn<BrepHandle | null>
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get the **bottom-face contour** of a component — the footprint outline (outer
|
|
56
|
+
* profile + holes) of its lowest horizontal face, as a reusable
|
|
57
|
+
* {@linkcode ContourHandle}.
|
|
58
|
+
*
|
|
59
|
+
* Extracted from the component's B-rep; robust to inverted face normals. Read
|
|
60
|
+
* its geometry via `snaptrude.core.geom.query.contour.*`, or feed it back into
|
|
61
|
+
* `design.create.*` / `core.geom.*`.
|
|
62
|
+
*
|
|
63
|
+
* @param component - The scene component to read
|
|
64
|
+
* @returns the footprint {@linkcode ContourHandle}, or `null` if the component
|
|
65
|
+
* has no extractable bottom face (e.g. it carries no B-rep)
|
|
66
|
+
*
|
|
67
|
+
* @examplePrompt Get the footprint of the selected mass
|
|
68
|
+
* @examplePrompt What is the plan outline of this building volume?
|
|
69
|
+
* @examplePrompt Trace the base profile of this wall
|
|
70
|
+
* @examplePrompt Find the ground-level outline of the slab, including any openings
|
|
71
|
+
* @examplePrompt Work out the footprint area of the selected component
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
76
|
+
* const contour = await snaptrude.design.query.geometry.getBottomContour(wall)
|
|
77
|
+
* if (contour) {
|
|
78
|
+
* const area = await snaptrude.core.geom.query.contour.getArea(contour)
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
public abstract getBottomContour(
|
|
83
|
+
component: ComponentHandle
|
|
84
|
+
): PluginApiReturn<ContourHandle | null>
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get the **centerline** (core curve) of a wall — the single curve running
|
|
88
|
+
* down the middle of the wall, as a reusable {@linkcode CurveHandle}
|
|
89
|
+
* (a `Line` for a straight wall, an `Arc` for a curved wall).
|
|
90
|
+
*
|
|
91
|
+
* For a parametric wall this is its stored core curve; otherwise it is
|
|
92
|
+
* derived from the wall's B-rep bottom face. Read its geometry via
|
|
93
|
+
* `snaptrude.core.geom.query.curve.*`, or feed it into `design.create.*`.
|
|
94
|
+
*
|
|
95
|
+
* Only walls have a centerline. As with all `get*` reads it never throws:
|
|
96
|
+
* a non-wall component, or a wall with no derivable centerline, yields `null`.
|
|
97
|
+
*
|
|
98
|
+
* @param component - The scene component to read (only walls yield a centerline)
|
|
99
|
+
* @returns the centerline {@linkcode CurveHandle}, or `null` if the component
|
|
100
|
+
* is not a wall or the wall has no derivable centerline (e.g. it carries no
|
|
101
|
+
* B-rep or has an unsupported profile)
|
|
102
|
+
*
|
|
103
|
+
* @examplePrompt Get the centerline of the selected wall
|
|
104
|
+
* @examplePrompt How long is this wall along its centre line?
|
|
105
|
+
* @examplePrompt Find the axis running down the middle of this wall
|
|
106
|
+
* @examplePrompt Give me the core curve of that curved wall
|
|
107
|
+
* @examplePrompt Where does the wall's centreline start and end?
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
112
|
+
* const centerline = await snaptrude.design.query.geometry.getCenterline(wall)
|
|
113
|
+
* if (centerline) {
|
|
114
|
+
* const length = await snaptrude.core.geom.query.curve.getLength(centerline)
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
public abstract getCenterline(
|
|
119
|
+
component: ComponentHandle
|
|
120
|
+
): PluginApiReturn<CurveHandle | null>
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Arguments for {@linkcode PluginDesignQueryGeometryApi.getBrep}.
|
|
125
|
+
*
|
|
126
|
+
* | Property | Type | Description |
|
|
127
|
+
* |---|---|---|
|
|
128
|
+
* | `component` | {@linkcode ComponentHandle} | The scene component to read |
|
|
129
|
+
*/
|
|
130
|
+
export const PluginDesignQueryGeometryGetBrepArgs = z.object({
|
|
131
|
+
component: ComponentHandle,
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
export type PluginDesignQueryGeometryGetBrepArgs = z.infer<
|
|
135
|
+
typeof PluginDesignQueryGeometryGetBrepArgs
|
|
136
|
+
>
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Arguments for {@linkcode PluginDesignQueryGeometryApi.getBottomContour}.
|
|
140
|
+
*
|
|
141
|
+
* | Property | Type | Description |
|
|
142
|
+
* |---|---|---|
|
|
143
|
+
* | `component` | {@linkcode ComponentHandle} | The scene component to read |
|
|
144
|
+
*/
|
|
145
|
+
export const PluginDesignQueryGeometryGetBottomContourArgs = z.object({
|
|
146
|
+
component: ComponentHandle,
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
export type PluginDesignQueryGeometryGetBottomContourArgs = z.infer<
|
|
150
|
+
typeof PluginDesignQueryGeometryGetBottomContourArgs
|
|
151
|
+
>
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Arguments for {@linkcode PluginDesignQueryGeometryApi.getCenterline}.
|
|
155
|
+
*
|
|
156
|
+
* | Property | Type | Description |
|
|
157
|
+
* |---|---|---|
|
|
158
|
+
* | `component` | {@linkcode ComponentHandle} | The scene component to read |
|
|
159
|
+
*/
|
|
160
|
+
export const PluginDesignQueryGeometryGetCenterlineArgs = z.object({
|
|
161
|
+
component: ComponentHandle,
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
export type PluginDesignQueryGeometryGetCenterlineArgs = z.infer<
|
|
165
|
+
typeof PluginDesignQueryGeometryGetCenterlineArgs
|
|
166
|
+
>
|