@snaptrude/plugin-core 0.0.0-dev-20260708130115 → 0.0.0-dev-20260827135706
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +152 -1
- package/api-manifest.json +3620 -276
- package/dist/api/analysis/daylight.d.ts +603 -0
- package/dist/api/analysis/daylight.d.ts.map +1 -0
- package/dist/api/analysis/heatmaps.d.ts +658 -0
- package/dist/api/analysis/heatmaps.d.ts.map +1 -0
- package/dist/api/analysis/illuminance.d.ts +145 -0
- package/dist/api/analysis/illuminance.d.ts.map +1 -0
- package/dist/api/analysis/index.d.ts +59 -0
- package/dist/api/analysis/index.d.ts.map +1 -0
- package/dist/api/analysis/shadows.d.ts +165 -0
- package/dist/api/analysis/shadows.d.ts.map +1 -0
- package/dist/api/analysis/solar.d.ts +249 -0
- package/dist/api/analysis/solar.d.ts.map +1 -0
- package/dist/api/analysis/sunlightHours.d.ts +208 -0
- package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
- package/dist/api/analysis/sunpath.d.ts +80 -0
- package/dist/api/analysis/sunpath.d.ts.map +1 -0
- package/dist/api/analysis/weather.d.ts +193 -0
- package/dist/api/analysis/weather.d.ts.map +1 -0
- package/dist/api/core/camera/index.d.ts +261 -0
- package/dist/api/core/camera/index.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +105 -2
- package/dist/api/core/comment/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +840 -14
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/delete/index.d.ts +8 -2
- package/dist/api/core/geom/delete/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +5 -5
- package/dist/api/core/geom/query/brep.d.ts +130 -18
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/circle.d.ts +18 -18
- package/dist/api/core/geom/query/contour.d.ts +20 -20
- package/dist/api/core/geom/query/curve.d.ts +49 -49
- package/dist/api/core/geom/query/edge.d.ts +5 -5
- package/dist/api/core/geom/query/face.d.ts +16 -16
- package/dist/api/core/geom/query/halfedge.d.ts +8 -8
- package/dist/api/core/geom/query/profile.d.ts +19 -19
- package/dist/api/core/geom/query/vertex.d.ts +8 -8
- package/dist/api/core/geom/update/contour.d.ts +14 -14
- package/dist/api/core/geom/update/curve.d.ts +7 -7
- package/dist/api/core/geom/update/profile.d.ts +16 -16
- package/dist/api/core/handles/index.d.ts +210 -0
- package/dist/api/core/handles/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +34 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/export/index.d.ts +134 -0
- package/dist/api/core/io/export/index.d.ts.map +1 -0
- package/dist/api/core/io/import/index.d.ts +453 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +40 -0
- package/dist/api/core/io/index.d.ts.map +1 -0
- package/dist/api/core/io/job/index.d.ts +139 -0
- package/dist/api/core/io/job/index.d.ts.map +1 -0
- package/dist/api/core/io/query/index.d.ts +74 -0
- package/dist/api/core/io/query/index.d.ts.map +1 -0
- package/dist/api/core/io/terrain/index.d.ts +341 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +805 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +7 -7
- package/dist/api/core/mode/index.d.ts +99 -0
- package/dist/api/core/mode/index.d.ts.map +1 -0
- 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 +531 -0
- package/dist/api/core/proposals/index.d.ts.map +1 -0
- package/dist/api/core/storeys/index.d.ts +265 -0
- package/dist/api/core/storeys/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +24 -0
- package/dist/api/core/tags.d.ts.map +1 -1
- package/dist/api/core/user.d.ts +44 -0
- package/dist/api/core/user.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +4 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/boolean/index.d.ts +4 -4
- package/dist/api/design/create/index.d.ts +568 -45
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +3 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +195 -0
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/edit/index.d.ts +1 -1
- package/dist/api/design/erase/index.d.ts +2 -2
- package/dist/api/design/family.d.ts +349 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +181 -8
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +98 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/lock.d.ts +26 -0
- package/dist/api/design/lock.d.ts.map +1 -1
- package/dist/api/design/materials/index.d.ts +270 -16
- package/dist/api/design/materials/index.d.ts.map +1 -1
- package/dist/api/design/query/geometry/index.d.ts +112 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +282 -11
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/referenceLines.d.ts +45 -0
- package/dist/api/design/query/referenceLines.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +181 -8
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +144 -0
- package/dist/api/design/selection/index.d.ts.map +1 -1
- package/dist/api/design/transform/index.d.ts +172 -10
- package/dist/api/design/transform/index.d.ts.map +1 -1
- package/dist/api/design/types/index.d.ts +181 -0
- package/dist/api/design/types/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +553 -2
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/visibility.d.ts +126 -0
- package/dist/api/design/visibility.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +113 -2
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/buildableEnvelope.d.ts +4 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +10 -2
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +21 -21
- package/dist/api/entity/story.d.ts +242 -15
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +25 -25
- package/dist/api/presentation/annotate.d.ts +467 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +111 -8
- package/dist/api/presentation/diagrams.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +108 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +55 -4
- package/dist/api/presentation/import.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +58 -1
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +1139 -0
- package/dist/api/presentation/placedViews.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +481 -0
- package/dist/api/presentation/shapes.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +452 -13
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/slideshow.d.ts +125 -0
- package/dist/api/presentation/slideshow.d.ts.map +1 -0
- package/dist/api/presentation/tables.d.ts +81 -0
- package/dist/api/presentation/tables.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +367 -7
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/program/areas.d.ts +102 -12
- package/dist/api/program/areas.d.ts.map +1 -1
- package/dist/api/program/cores.d.ts +3 -99
- package/dist/api/program/cores.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +7 -15
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/layout.d.ts +346 -11
- package/dist/api/program/layout.d.ts.map +1 -1
- package/dist/api/program/site.d.ts +469 -13
- package/dist/api/program/site.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +365 -41
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +505 -0
- package/dist/api/workspace/index.d.ts.map +1 -0
- package/dist/errors/codes.d.ts +34 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/envelope.d.ts +56 -0
- package/dist/errors/envelope.d.ts.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/plugin-error.d.ts +69 -0
- package/dist/errors/plugin-error.d.ts.map +1 -0
- package/dist/handles.d.ts +97 -25
- package/dist/handles.d.ts.map +1 -1
- package/dist/host-utils.d.ts +4 -0
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4582 -1422
- 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 +4171 -1411
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/scripts/generate-manifest.mjs +45 -0
- package/scripts/generate-manifest.test.mjs +103 -4
- package/src/api/analysis/daylight.ts +470 -0
- package/src/api/analysis/heatmaps.ts +683 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +61 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/solar.ts +237 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/analysis/weather.ts +179 -0
- package/src/api/core/camera/index.ts +268 -0
- package/src/api/core/comment/index.ts +120 -2
- package/src/api/core/geom/create/index.ts +912 -1
- package/src/api/core/geom/delete/index.ts +6 -0
- package/src/api/core/geom/query/brep.ts +119 -0
- package/src/api/core/handles/index.ts +233 -0
- package/src/api/core/index.ts +34 -0
- package/src/api/core/io/export/index.ts +126 -0
- package/src/api/core/io/import/index.ts +496 -0
- package/src/api/core/io/index.ts +42 -0
- package/src/api/core/io/job/index.ts +140 -0
- package/src/api/core/io/query/index.ts +71 -0
- package/src/api/core/io/terrain/index.ts +360 -0
- package/src/api/core/io/underlay/index.ts +705 -0
- package/src/api/core/mode/index.ts +96 -0
- package/src/api/core/project/index.ts +62 -1
- package/src/api/core/proposals/index.ts +569 -0
- package/src/api/core/storeys/index.ts +294 -0
- package/src/api/core/tags.ts +27 -0
- package/src/api/core/user.ts +46 -0
- package/src/api/core/zoom/index.ts +4 -0
- package/src/api/design/create/index.ts +670 -30
- package/src/api/design/delete/index.ts +3 -0
- package/src/api/design/doors/index.ts +208 -0
- package/src/api/design/erase/index.ts +1 -1
- package/src/api/design/family.ts +388 -0
- package/src/api/design/furniture/index.ts +197 -8
- package/src/api/design/index.ts +102 -0
- package/src/api/design/lock.ts +27 -0
- package/src/api/design/materials/index.ts +334 -27
- package/src/api/design/query/geometry/index.ts +125 -3
- package/src/api/design/query/index.ts +217 -7
- package/src/api/design/query/referenceLines.ts +52 -0
- package/src/api/design/query/spaces.ts +143 -0
- package/src/api/design/selection/index.ts +129 -0
- package/src/api/design/transform/index.ts +170 -9
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +631 -3
- package/src/api/design/visibility.ts +143 -0
- package/src/api/design/windows/index.ts +128 -2
- package/src/api/entity/buildableEnvelope.ts +4 -0
- package/src/api/entity/referenceLine.ts +8 -0
- package/src/api/entity/story.ts +259 -15
- package/src/api/index.ts +10 -0
- package/src/api/presentation/annotate.ts +385 -0
- package/src/api/presentation/diagrams.ts +118 -8
- package/src/api/presentation/export.ts +108 -0
- package/src/api/presentation/import.ts +51 -4
- package/src/api/presentation/index.ts +66 -1
- package/src/api/presentation/placedViews.ts +1120 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +400 -13
- package/src/api/presentation/slideshow.ts +134 -0
- package/src/api/presentation/tables.ts +84 -0
- package/src/api/presentation/views.ts +376 -8
- package/src/api/program/areas.ts +88 -15
- package/src/api/program/cores.ts +3 -91
- package/src/api/program/index.ts +7 -15
- package/src/api/program/layout.ts +365 -11
- package/src/api/program/site.ts +435 -13
- package/src/api/program/spreadsheet.ts +376 -35
- package/src/api/workspace/index.ts +563 -0
- package/src/errors/codes.ts +136 -0
- package/src/errors/envelope.ts +75 -0
- package/src/errors/index.ts +21 -0
- package/src/errors/plugin-error.ts +134 -0
- package/src/handles.ts +123 -13
- package/src/host-utils.ts +4 -0
- package/src/index.ts +1 -0
- package/test/errors.test.mjs +184 -0
- package/tsconfig.json +7 -2
|
@@ -8,6 +8,13 @@ import {
|
|
|
8
8
|
PluginAreaClass,
|
|
9
9
|
PluginSpaceUpdateResult,
|
|
10
10
|
} from "../../entity/space"
|
|
11
|
+
import { PluginDesignChangeResult } from "../lock"
|
|
12
|
+
import {
|
|
13
|
+
PluginBuildableEnvelopePolygonVertex,
|
|
14
|
+
PluginBuildableEnvelopeSetbackTier,
|
|
15
|
+
PluginBuildableEnvelopeVerticalCap,
|
|
16
|
+
PluginBuildableEnvelopeUpdateResult,
|
|
17
|
+
} from "../../entity/buildableEnvelope"
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Sparse property updates for a space. Only provided fields change.
|
|
@@ -27,14 +34,18 @@ export const PluginSpacePropertyUpdates = z.object({
|
|
|
27
34
|
areaClass: PluginAreaClass.optional(),
|
|
28
35
|
departmentId: PluginDepartmentId.optional(),
|
|
29
36
|
})
|
|
30
|
-
export type PluginSpacePropertyUpdates = z.infer<
|
|
37
|
+
export type PluginSpacePropertyUpdates = z.infer<
|
|
38
|
+
typeof PluginSpacePropertyUpdates
|
|
39
|
+
>
|
|
31
40
|
|
|
32
41
|
/** Geometry replacement for a space — re-extrude a profile. */
|
|
33
42
|
export const PluginSpaceGeometryUpdate = z.object({
|
|
34
43
|
profile: ProfileHandle,
|
|
35
44
|
extrudeHeight: z.number(),
|
|
36
45
|
})
|
|
37
|
-
export type PluginSpaceGeometryUpdate = z.infer<
|
|
46
|
+
export type PluginSpaceGeometryUpdate = z.infer<
|
|
47
|
+
typeof PluginSpaceGeometryUpdate
|
|
48
|
+
>
|
|
38
49
|
|
|
39
50
|
/** One space to update via {@linkcode PluginDesignUpdateApi.spaces}. */
|
|
40
51
|
export const PluginUpdateSpaceItem = z.object({
|
|
@@ -44,6 +55,189 @@ export const PluginUpdateSpaceItem = z.object({
|
|
|
44
55
|
})
|
|
45
56
|
export type PluginUpdateSpaceItem = z.infer<typeof PluginUpdateSpaceItem>
|
|
46
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Wire schema for {@linkcode PluginDesignUpdateApi.setLabel}.
|
|
60
|
+
*
|
|
61
|
+
* | Property | Type | Description |
|
|
62
|
+
* |---|---|---|
|
|
63
|
+
* | `component` | `ComponentHandle` | The component to relabel |
|
|
64
|
+
* | `label` | `string` | New label (non-empty after trimming) |
|
|
65
|
+
*/
|
|
66
|
+
export const PluginDesignSetLabelArgs = z.object({
|
|
67
|
+
component: ComponentHandle,
|
|
68
|
+
label: z.string().trim().min(1),
|
|
69
|
+
})
|
|
70
|
+
export type PluginDesignSetLabelArgs = z.infer<typeof PluginDesignSetLabelArgs>
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Sparse parametric updates for a staircase (all fields optional; at least one
|
|
74
|
+
* required). Only the fields you provide change. Consumed by
|
|
75
|
+
* {@linkcode PluginDesignUpdateApi.staircase}; the paired read is
|
|
76
|
+
* `design.query.getStaircaseParams`.
|
|
77
|
+
*
|
|
78
|
+
* All dimensions are in **engine units** (the same convention as
|
|
79
|
+
* `design.doors.setWidth`); `steps` is a unitless integer count. Height, riser,
|
|
80
|
+
* and step count are **coupled** (`staircaseHeight = steps × riser`); the two
|
|
81
|
+
* lock booleans govern which value recomputes — see the method JSDoc.
|
|
82
|
+
*
|
|
83
|
+
* | Property | Type | Description |
|
|
84
|
+
* |---|---|---|
|
|
85
|
+
* | `isStoreyHeightUnlocked` | `boolean`? | Unlock the staircase height from the storey height |
|
|
86
|
+
* | `isStaircaseHeightUnlocked` | `boolean`? | Unlock the height from `steps × riser` |
|
|
87
|
+
* | `storeyHeight` | `number`? | Storey height the stair sits within (engine units) |
|
|
88
|
+
* | `staircaseHeight` | `number`? | Total rise (engine units) |
|
|
89
|
+
* | `steps` | `number`? | Step count (unitless integer) |
|
|
90
|
+
* | `riser` | `number`? | Riser height (engine units) |
|
|
91
|
+
* | `tread` | `number`? | Tread depth (engine units) |
|
|
92
|
+
* | `width` | `number`? | Flight width (engine units) |
|
|
93
|
+
* | `depth` | `number`? | Slab/waist thickness (engine units) |
|
|
94
|
+
* | `wellSize` | `number`? | Stairwell gap (dogLegged / openWell / square) |
|
|
95
|
+
* | `flightStartDistAfterTurn` | `number`? | Flight offset after a turn (dogLegged / lShaped / square) |
|
|
96
|
+
* | `landingWidth` | `number`? | Landing depth (straight / dogLegged) |
|
|
97
|
+
* | `baseOffset` | `number`? | Vertical offset from the storey base (engine units) |
|
|
98
|
+
*/
|
|
99
|
+
export const PluginStaircaseParamUpdates = z
|
|
100
|
+
.object({
|
|
101
|
+
isStoreyHeightUnlocked: z.boolean().optional(),
|
|
102
|
+
isStaircaseHeightUnlocked: z.boolean().optional(),
|
|
103
|
+
storeyHeight: z.number().optional(),
|
|
104
|
+
staircaseHeight: z.number().optional(),
|
|
105
|
+
steps: z.number().int().optional(),
|
|
106
|
+
riser: z.number().optional(),
|
|
107
|
+
tread: z.number().optional(),
|
|
108
|
+
width: z.number().optional(),
|
|
109
|
+
depth: z.number().optional(),
|
|
110
|
+
wellSize: z.number().optional(),
|
|
111
|
+
flightStartDistAfterTurn: z.number().optional(),
|
|
112
|
+
landingWidth: z.number().optional(),
|
|
113
|
+
baseOffset: z.number().optional(),
|
|
114
|
+
})
|
|
115
|
+
.refine((p) => Object.keys(p).length > 0, {
|
|
116
|
+
message:
|
|
117
|
+
"PluginStaircaseParamUpdates requires at least one field to change",
|
|
118
|
+
})
|
|
119
|
+
export type PluginStaircaseParamUpdates = z.infer<
|
|
120
|
+
typeof PluginStaircaseParamUpdates
|
|
121
|
+
>
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Arguments for {@linkcode PluginDesignUpdateApi.staircase}.
|
|
125
|
+
*
|
|
126
|
+
* | Property | Type | Description |
|
|
127
|
+
* |---|---|---|
|
|
128
|
+
* | `staircases` | {@linkcode ComponentHandle}`[]` | The staircases to update |
|
|
129
|
+
* | `params` | {@linkcode PluginStaircaseParamUpdates} | Sparse parametric changes (≥ 1 field) |
|
|
130
|
+
*/
|
|
131
|
+
export const PluginDesignUpdateStaircaseArgs = z.object({
|
|
132
|
+
staircases: z.array(ComponentHandle),
|
|
133
|
+
params: PluginStaircaseParamUpdates,
|
|
134
|
+
})
|
|
135
|
+
export type PluginDesignUpdateStaircaseArgs = z.infer<
|
|
136
|
+
typeof PluginDesignUpdateStaircaseArgs
|
|
137
|
+
>
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Sparse edits for a wall (all optional; at least one required). Only the
|
|
141
|
+
* fields you provide change. Dimensions are in **engine units** (the same
|
|
142
|
+
* convention as `design.doors.setWidth`). Consumed by
|
|
143
|
+
* {@linkcode PluginDesignUpdateApi.wall}.
|
|
144
|
+
*
|
|
145
|
+
* | Property | Type | Description |
|
|
146
|
+
* |---|---|---|
|
|
147
|
+
* | `thickness` | `number`? | Wall thickness, engine units (> 0) |
|
|
148
|
+
* | `height` | `number`? | Wall height, engine units (> 0) |
|
|
149
|
+
* | `type` | `string`? | Convert the wall to another wall type — a name (or `wall:`-prefixed id) from `design.types.list("wall")` |
|
|
150
|
+
*/
|
|
151
|
+
export const PluginWallUpdates = z
|
|
152
|
+
.object({
|
|
153
|
+
thickness: z.number().positive().optional(),
|
|
154
|
+
height: z.number().positive().optional(),
|
|
155
|
+
type: z.string().trim().min(1).optional(),
|
|
156
|
+
})
|
|
157
|
+
.refine((p) => Object.keys(p).length > 0, {
|
|
158
|
+
message: "PluginWallUpdates requires at least one field to change",
|
|
159
|
+
})
|
|
160
|
+
export type PluginWallUpdates = z.infer<typeof PluginWallUpdates>
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Sparse dimension edits for a slab-family element (slab / floor / roof /
|
|
164
|
+
* ceiling). All values are engine units, the same convention as
|
|
165
|
+
* `design.doors.setWidth`. Consumed by {@linkcode PluginDesignUpdateApi.slab},
|
|
166
|
+
* `floor`, `roof`, and `ceiling`.
|
|
167
|
+
*
|
|
168
|
+
* `overhang` is only available on **slabs and roofs** (the panel's Overhang
|
|
169
|
+
* slider) — floors and ceilings reject it with `PRECONDITION_FAILED`.
|
|
170
|
+
*
|
|
171
|
+
* | Property | Type | Description |
|
|
172
|
+
* |---|---|---|
|
|
173
|
+
* | `thickness` | `number`? | Element thickness, engine units (> 0) |
|
|
174
|
+
* | `overhang` | `number`? | Absolute overhang offset, engine units (slab / roof only) |
|
|
175
|
+
*/
|
|
176
|
+
export const PluginSlabUpdates = z
|
|
177
|
+
.object({
|
|
178
|
+
thickness: z.number().positive().optional(),
|
|
179
|
+
overhang: z.number().optional(),
|
|
180
|
+
})
|
|
181
|
+
.refine((p) => Object.keys(p).length > 0, {
|
|
182
|
+
message: "PluginSlabUpdates requires at least one field to change",
|
|
183
|
+
})
|
|
184
|
+
export type PluginSlabUpdates = z.infer<typeof PluginSlabUpdates>
|
|
185
|
+
|
|
186
|
+
/** Arguments for {@linkcode PluginDesignUpdateApi.wall}. */
|
|
187
|
+
export const PluginDesignUpdateWallArgs = z.object({
|
|
188
|
+
component: ComponentHandle,
|
|
189
|
+
updates: PluginWallUpdates,
|
|
190
|
+
})
|
|
191
|
+
export type PluginDesignUpdateWallArgs = z.infer<
|
|
192
|
+
typeof PluginDesignUpdateWallArgs
|
|
193
|
+
>
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Arguments for the slab-family updaters —
|
|
197
|
+
* {@linkcode PluginDesignUpdateApi.slab}, `floor`, `roof`, `ceiling`.
|
|
198
|
+
*/
|
|
199
|
+
export const PluginDesignUpdateSlabArgs = z.object({
|
|
200
|
+
component: ComponentHandle,
|
|
201
|
+
updates: PluginSlabUpdates,
|
|
202
|
+
})
|
|
203
|
+
export type PluginDesignUpdateSlabArgs = z.infer<
|
|
204
|
+
typeof PluginDesignUpdateSlabArgs
|
|
205
|
+
>
|
|
206
|
+
|
|
207
|
+
/** Arguments for {@linkcode PluginDesignUpdateApi.setElevation}. */
|
|
208
|
+
export const PluginDesignSetElevationArgs = z.object({
|
|
209
|
+
component: ComponentHandle,
|
|
210
|
+
elevation: z.number(),
|
|
211
|
+
})
|
|
212
|
+
export type PluginDesignSetElevationArgs = z.infer<
|
|
213
|
+
typeof PluginDesignSetElevationArgs
|
|
214
|
+
>
|
|
215
|
+
|
|
216
|
+
/** Arguments for {@linkcode PluginDesignUpdateApi.setBaseOffset}. */
|
|
217
|
+
export const PluginDesignSetBaseOffsetArgs = z.object({
|
|
218
|
+
component: ComponentHandle,
|
|
219
|
+
offset: z.number(),
|
|
220
|
+
})
|
|
221
|
+
export type PluginDesignSetBaseOffsetArgs = z.infer<
|
|
222
|
+
typeof PluginDesignSetBaseOffsetArgs
|
|
223
|
+
>
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Arguments for {@linkcode PluginDesignUpdateApi.setStorey}.
|
|
227
|
+
*
|
|
228
|
+
* | Property | Type | Description |
|
|
229
|
+
* |---|---|---|
|
|
230
|
+
* | `components` | {@linkcode ComponentHandle}`[]` | The components to reassign |
|
|
231
|
+
* | `storey` | `number` | Target integer storey number (`entity.story` convention; must exist) |
|
|
232
|
+
*/
|
|
233
|
+
export const PluginDesignSetStoreyArgs = z.object({
|
|
234
|
+
components: z.array(ComponentHandle),
|
|
235
|
+
storey: z.number().int(),
|
|
236
|
+
})
|
|
237
|
+
export type PluginDesignSetStoreyArgs = z.infer<
|
|
238
|
+
typeof PluginDesignSetStoreyArgs
|
|
239
|
+
>
|
|
240
|
+
|
|
47
241
|
/**
|
|
48
242
|
* `snaptrude.design.update` — edit existing scene entities (properties + geometry).
|
|
49
243
|
*
|
|
@@ -53,6 +247,49 @@ export type PluginUpdateSpaceItem = z.infer<typeof PluginUpdateSpaceItem>
|
|
|
53
247
|
export abstract class PluginDesignUpdateApi {
|
|
54
248
|
constructor() {}
|
|
55
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Set a component's **Label** — the same editable Label field the properties
|
|
252
|
+
* panel shows (doors, windows, furniture, spaces, and every other labelled
|
|
253
|
+
* component). The paired read is `design.query.getLabel`. Undoable; the
|
|
254
|
+
* canvas label text updates immediately.
|
|
255
|
+
*
|
|
256
|
+
* Strictly **per component**: labelling one door of a placed family never
|
|
257
|
+
* touches its sibling doors (the panel's Label edit, by contrast, applies to
|
|
258
|
+
* the whole family). On **legacy masses** without a space type, panel parity
|
|
259
|
+
* applies — a label matching a room-type preset with a height can also
|
|
260
|
+
* adjust the mass's height and material, exactly like typing it in the panel.
|
|
261
|
+
*
|
|
262
|
+
* Throws when the component is locked, the handle is gone/forged, the label
|
|
263
|
+
* is empty, or the component has no mesh to label. Re-applying the current
|
|
264
|
+
* label is a no-op that returns `true` without touching the undo stack.
|
|
265
|
+
*
|
|
266
|
+
* @param component - The component to relabel
|
|
267
|
+
* @param label - New label text (non-empty; leading/trailing whitespace trimmed)
|
|
268
|
+
* @returns `true` once the label is applied
|
|
269
|
+
*
|
|
270
|
+
* @examplePrompt Rename this door to D-101
|
|
271
|
+
* @examplePrompt Number all doors on storey 2 with a D-2-XX tag
|
|
272
|
+
* @examplePrompt Set the selected window's label to W-04
|
|
273
|
+
* @examplePrompt Tag every door with its fire rating
|
|
274
|
+
*
|
|
275
|
+
* # Example
|
|
276
|
+
* ```ts
|
|
277
|
+
* // Door tag numbering: label every door as D-<storey>-<n>, numbered per storey
|
|
278
|
+
* await snaptrude.design.selection.setByFilter({ types: ["door"] })
|
|
279
|
+
* const doors = await snaptrude.design.selection.get()
|
|
280
|
+
* const counts = {}
|
|
281
|
+
* for (const door of doors) {
|
|
282
|
+
* const { storey = 0 } = await snaptrude.design.query.getProperties(door)
|
|
283
|
+
* counts[storey] = (counts[storey] ?? 0) + 1
|
|
284
|
+
* await snaptrude.design.update.setLabel(door, `D-${storey}-${String(counts[storey]).padStart(2, "0")}`)
|
|
285
|
+
* }
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
public abstract setLabel(
|
|
289
|
+
component: ComponentHandle,
|
|
290
|
+
label: string,
|
|
291
|
+
): PluginApiReturn<boolean>
|
|
292
|
+
|
|
56
293
|
/**
|
|
57
294
|
* Update a single space (room) — change its properties (room label, space
|
|
58
295
|
* type, mass type, area class, department) and/or replace its geometry by
|
|
@@ -69,6 +306,9 @@ export abstract class PluginDesignUpdateApi {
|
|
|
69
306
|
* @examplePrompt Move this space into the Circulation department
|
|
70
307
|
* @examplePrompt Exclude this room from the area calculations
|
|
71
308
|
*
|
|
309
|
+
* @performance For MORE THAN ONE space, call `design.update.spaces(items[])` — the whole
|
|
310
|
+
* batch is one host round-trip. Looping this single-space updater is N round-trips.
|
|
311
|
+
*
|
|
72
312
|
* # Example
|
|
73
313
|
* ```ts
|
|
74
314
|
* await snaptrude.design.update.space("space-id", { properties: { room_type: "Office" } })
|
|
@@ -99,6 +339,9 @@ export abstract class PluginDesignUpdateApi {
|
|
|
99
339
|
* @examplePrompt Bulk-assign these spaces to the Service department
|
|
100
340
|
* @examplePrompt Mark all of these rooms as excluded from area in one update
|
|
101
341
|
*
|
|
342
|
+
* @performance Bulk update — the whole batch is ONE host round-trip. Prefer over looping
|
|
343
|
+
* `design.update.space`: build the `items[]` array first, then make one call.
|
|
344
|
+
*
|
|
102
345
|
* # Example
|
|
103
346
|
* ```ts
|
|
104
347
|
* // Re-label every selected room and mark it NET area — one undoable bulk update
|
|
@@ -113,5 +356,390 @@ export abstract class PluginDesignUpdateApi {
|
|
|
113
356
|
* console.log(results.map((r) => r.spaceId))
|
|
114
357
|
* ```
|
|
115
358
|
*/
|
|
116
|
-
public abstract spaces(
|
|
359
|
+
public abstract spaces(
|
|
360
|
+
items: PluginUpdateSpaceItem[],
|
|
361
|
+
): PluginApiReturn<PluginSpaceUpdateResult[]>
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Update the parameters of one or more staircases — riser, tread, width,
|
|
365
|
+
* depth, step count, total height, well size, landing depth, base offset,
|
|
366
|
+
* and the two height locks — in one undoable operation. Sparse: only the
|
|
367
|
+
* fields you provide change. The paired read is
|
|
368
|
+
* `design.query.getStaircaseParams`.
|
|
369
|
+
*
|
|
370
|
+
* All dimensions are in **engine units** (the same convention as
|
|
371
|
+
* `design.doors.setWidth`); `steps` is a unitless integer count. The height,
|
|
372
|
+
* riser, and step count are **coupled** — `staircaseHeight = steps × riser` —
|
|
373
|
+
* and the two lock booleans govern which value recomputes when another
|
|
374
|
+
* changes. With `isStoreyHeightUnlocked` false the staircase height follows
|
|
375
|
+
* the storey height; unlocking it also unlocks the staircase height. Setting
|
|
376
|
+
* `steps` recomputes `riser` (or the height, once the height is unlocked),
|
|
377
|
+
* and setting `riser` recomputes `steps`/height in turn.
|
|
378
|
+
*
|
|
379
|
+
* Presets-only: this edits the parametric fields of a preset staircase; it
|
|
380
|
+
* does not change the staircase's type/preset (there is no in-place re-type).
|
|
381
|
+
* Every edit rebuilds the staircase geometry, so the call is async.
|
|
382
|
+
*
|
|
383
|
+
* Throws when a handle is not a staircase, when a staircase is locked, or
|
|
384
|
+
* when a value falls outside the engine's accepted range (RPC rejects).
|
|
385
|
+
*
|
|
386
|
+
* @param staircases - the staircases to update
|
|
387
|
+
* @param params - sparse {@linkcode PluginStaircaseParamUpdates} (at least one field)
|
|
388
|
+
* @returns the affected staircases
|
|
389
|
+
*
|
|
390
|
+
* @examplePrompt Set the riser of this staircase to 165mm
|
|
391
|
+
* @examplePrompt Change all the stairs to 14 steps
|
|
392
|
+
* @examplePrompt Make the selected staircase 1200 wide with a 280 tread
|
|
393
|
+
* @examplePrompt Widen every staircase on level 1 to 1 metre
|
|
394
|
+
* @examplePrompt Unlock the height and set this stair to 3200 tall
|
|
395
|
+
*
|
|
396
|
+
* # Example
|
|
397
|
+
* ```ts
|
|
398
|
+
* // Give every ground-floor staircase a common riser + tread (engine units)
|
|
399
|
+
* const stairs = await snaptrude.design.query.listStaircases({ storeys: [1] })
|
|
400
|
+
* const { affected } = await snaptrude.design.update.staircase(stairs, {
|
|
401
|
+
* riser: 165,
|
|
402
|
+
* tread: 280,
|
|
403
|
+
* })
|
|
404
|
+
* console.log("updated", affected.length, "staircases")
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
public abstract staircase(
|
|
408
|
+
staircases: ComponentHandle[],
|
|
409
|
+
params: PluginStaircaseParamUpdates,
|
|
410
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Edit a **wall** — its thickness and/or height (the same command the
|
|
414
|
+
* properties panel's Thickness/Height fields drive) and/or its **wall type**
|
|
415
|
+
* (the panel's Wall Types dropdown: converts the wall to another type,
|
|
416
|
+
* rebuilding its layer stack and materials). Sparse: only the fields you
|
|
417
|
+
* provide change. Undoable; the geometry rebuilds and any dimension lines
|
|
418
|
+
* refresh. Stacked-wall companions and hosted fenestration are handled
|
|
419
|
+
* exactly as the panel does.
|
|
420
|
+
*
|
|
421
|
+
* Thickness/height are in **engine units** (the same convention as
|
|
422
|
+
* `design.doors.setWidth`) and must be `> 0`. Shrinking a wall past its
|
|
423
|
+
* openings is rejected by the engine (the wall is skipped with no change).
|
|
424
|
+
* `type` accepts a type name from `design.types.list("wall")` (or its
|
|
425
|
+
* `wall:`-prefixed id); when combined with dimensions, the type conversion
|
|
426
|
+
* is applied first so an explicit thickness/height wins over the type's
|
|
427
|
+
* defaults. Re-applying the wall's current type is a no-op.
|
|
428
|
+
*
|
|
429
|
+
* Throws when the handle is not a wall, when the wall is locked, when the
|
|
430
|
+
* handle is gone/forged, when `type` names an unknown wall type, when the
|
|
431
|
+
* engine rejects the conversion (e.g. a curved wall thinner than the new
|
|
432
|
+
* type's minimum thickness), or when no field is provided.
|
|
433
|
+
*
|
|
434
|
+
* A type conversion (and a thickness edit on a parametric wall) REBUILDS the
|
|
435
|
+
* wall, replacing it with a new component: the input handle is then dead
|
|
436
|
+
* (further calls throw HANDLE_INVALID) and `affected[0]` carries the
|
|
437
|
+
* replacement's handle — use it for any follow-up calls.
|
|
438
|
+
*
|
|
439
|
+
* @param component - The wall to edit
|
|
440
|
+
* @param updates - Sparse {@linkcode PluginWallUpdates} (at least one field)
|
|
441
|
+
* @returns the affected wall — after a rebuild, the REPLACEMENT wall's handle
|
|
442
|
+
*
|
|
443
|
+
* @examplePrompt Make this wall 230mm thick
|
|
444
|
+
* @examplePrompt Set the selected wall's height to 3 metres
|
|
445
|
+
* @examplePrompt Thicken every exterior wall to 300
|
|
446
|
+
* @examplePrompt Change this wall to a Glass Wall
|
|
447
|
+
* @examplePrompt Convert all the partitions on this floor to Brick Wall
|
|
448
|
+
*
|
|
449
|
+
* # Example
|
|
450
|
+
* ```ts
|
|
451
|
+
* // Convert every wall on storey 1 to the first listed wall type
|
|
452
|
+
* const [wallType] = await snaptrude.design.types.list("wall")
|
|
453
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
454
|
+
* for (const wall of walls) {
|
|
455
|
+
* await snaptrude.design.update.wall(wall, { type: wallType.id })
|
|
456
|
+
* }
|
|
457
|
+
* ```
|
|
458
|
+
*/
|
|
459
|
+
public abstract wall(
|
|
460
|
+
component: ComponentHandle,
|
|
461
|
+
updates: PluginWallUpdates,
|
|
462
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Edit a **slab's** thickness and/or overhang — the same commands the
|
|
466
|
+
* properties panel's Thickness field and Overhang slider drive. Sparse: only
|
|
467
|
+
* the fields you provide change. Undoable; the slab rebuilds and dimension
|
|
468
|
+
* lines refresh. Both values are in **engine units** (the same convention as
|
|
469
|
+
* `design.doors.setWidth`); thickness must be `> 0`, overhang is an absolute
|
|
470
|
+
* offset (negative insets the slab) and re-applying the current overhang is
|
|
471
|
+
* a no-op.
|
|
472
|
+
*
|
|
473
|
+
* Throws when the handle is not a slab, when it is locked, when the handle is
|
|
474
|
+
* gone/forged, when `overhang` is set on a slab that has no overhang (plinth /
|
|
475
|
+
* basement slabs, or overhang disabled), or when no field is provided.
|
|
476
|
+
*
|
|
477
|
+
* @param component - The slab to edit
|
|
478
|
+
* @param updates - Sparse {@linkcode PluginSlabUpdates} (at least one field)
|
|
479
|
+
* @returns the affected slab
|
|
480
|
+
*
|
|
481
|
+
* @examplePrompt Set this slab's thickness to 250mm
|
|
482
|
+
* @examplePrompt Make the floor slab 300 thick
|
|
483
|
+
* @examplePrompt Give this slab a 200 overhang
|
|
484
|
+
* @examplePrompt Remove the overhang on every slab on level 2
|
|
485
|
+
*
|
|
486
|
+
* # Example
|
|
487
|
+
* ```ts
|
|
488
|
+
* const [slab] = await snaptrude.design.query.listSlabs()
|
|
489
|
+
* await snaptrude.design.update.slab(slab, { thickness: 250, overhang: 200 })
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
public abstract slab(
|
|
493
|
+
component: ComponentHandle,
|
|
494
|
+
updates: PluginSlabUpdates,
|
|
495
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Edit a **floor's** thickness — the slab-family updater for floors (shares
|
|
499
|
+
* the slab thickness command). Undoable. Thickness is in **engine units**
|
|
500
|
+
* (the `design.doors.setWidth` convention) and must be `> 0`. Floors have no
|
|
501
|
+
* Overhang control, so `overhang` is rejected with `PRECONDITION_FAILED`.
|
|
502
|
+
*
|
|
503
|
+
* Throws when the handle is not a floor, when it is locked, when the handle
|
|
504
|
+
* is gone/forged, when `overhang` is provided, or when no field is provided.
|
|
505
|
+
*
|
|
506
|
+
* @param component - The floor to edit
|
|
507
|
+
* @param updates - {@linkcode PluginSlabUpdates} (a `thickness`)
|
|
508
|
+
* @returns the affected floor
|
|
509
|
+
*
|
|
510
|
+
* @examplePrompt Make this floor 200mm thick
|
|
511
|
+
* @examplePrompt Set every floor to a 250 thickness
|
|
512
|
+
* @examplePrompt Thicken the ground floor slab to 300
|
|
513
|
+
*
|
|
514
|
+
* # Example
|
|
515
|
+
* ```ts
|
|
516
|
+
* const [floor] = await snaptrude.design.query.listFloors()
|
|
517
|
+
* await snaptrude.design.update.floor(floor, { thickness: 200 })
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
public abstract floor(
|
|
521
|
+
component: ComponentHandle,
|
|
522
|
+
updates: PluginSlabUpdates,
|
|
523
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Edit a **roof's** thickness and/or overhang — the same commands the roof
|
|
527
|
+
* panel's Thickness field and Overhang slider drive (shares the slab-family
|
|
528
|
+
* machinery). Sparse: only the fields you provide change. Undoable. Both
|
|
529
|
+
* values are in **engine units** (the `design.doors.setWidth` convention);
|
|
530
|
+
* thickness must be `> 0`, overhang is an absolute offset (negative insets
|
|
531
|
+
* the roof) and re-applying the current overhang is a no-op.
|
|
532
|
+
*
|
|
533
|
+
* Throws when the handle is not a roof, when it is locked, when the handle is
|
|
534
|
+
* gone/forged, when `overhang` is set on a roof whose overhang is disabled,
|
|
535
|
+
* or when no field is provided.
|
|
536
|
+
*
|
|
537
|
+
* @param component - The roof to edit
|
|
538
|
+
* @param updates - Sparse {@linkcode PluginSlabUpdates} (at least one field)
|
|
539
|
+
* @returns the affected roof
|
|
540
|
+
*
|
|
541
|
+
* @examplePrompt Make this roof 300mm thick
|
|
542
|
+
* @examplePrompt Set the roof slab thickness to 250
|
|
543
|
+
* @examplePrompt Give the roof a 600 overhang
|
|
544
|
+
* @examplePrompt Pull the roof overhang back to 0
|
|
545
|
+
*
|
|
546
|
+
* # Example
|
|
547
|
+
* ```ts
|
|
548
|
+
* const [roof] = await snaptrude.design.query.listRoofs()
|
|
549
|
+
* await snaptrude.design.update.roof(roof, { overhang: 600 })
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
public abstract roof(
|
|
553
|
+
component: ComponentHandle,
|
|
554
|
+
updates: PluginSlabUpdates,
|
|
555
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Edit a **ceiling's** thickness — the slab-family updater for ceilings
|
|
559
|
+
* (shares the slab thickness command). Undoable. Thickness is in **engine
|
|
560
|
+
* units** (the `design.doors.setWidth` convention) and must be `> 0`.
|
|
561
|
+
* Ceilings have no Overhang control, so `overhang` is rejected with
|
|
562
|
+
* `PRECONDITION_FAILED`.
|
|
563
|
+
*
|
|
564
|
+
* Throws when the handle is not a ceiling, when it is locked, when the handle
|
|
565
|
+
* is gone/forged, when `overhang` is provided, or when no field is provided.
|
|
566
|
+
*
|
|
567
|
+
* @param component - The ceiling to edit
|
|
568
|
+
* @param updates - {@linkcode PluginSlabUpdates} (a `thickness`)
|
|
569
|
+
* @returns the affected ceiling
|
|
570
|
+
*
|
|
571
|
+
* @examplePrompt Make this ceiling 150mm thick
|
|
572
|
+
* @examplePrompt Set every ceiling to a 100 thickness
|
|
573
|
+
* @examplePrompt Thicken the ceiling to 200
|
|
574
|
+
*
|
|
575
|
+
* # Example
|
|
576
|
+
* ```ts
|
|
577
|
+
* const [ceiling] = await snaptrude.design.query.listCeilings()
|
|
578
|
+
* await snaptrude.design.update.ceiling(ceiling, { thickness: 150 })
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
581
|
+
public abstract ceiling(
|
|
582
|
+
component: ComponentHandle,
|
|
583
|
+
updates: PluginSlabUpdates,
|
|
584
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Set a component's **absolute world elevation** — moves it vertically so its
|
|
588
|
+
* base (the bounding-box bottom, world Y) lands at `elevation`. Composed over
|
|
589
|
+
* the canonical command-backed move machinery, so it is undoable and persisted
|
|
590
|
+
* exactly like dragging the element up or down; per-type invariants (e.g. a
|
|
591
|
+
* staircase's base offset) stay in sync. `elevation` is in **engine units**
|
|
592
|
+
* (the `design.doors.setWidth` convention). Re-applying the current elevation
|
|
593
|
+
* is a no-op.
|
|
594
|
+
*
|
|
595
|
+
* Throws when the component is locked or the handle is gone/forged.
|
|
596
|
+
*
|
|
597
|
+
* @param component - The component to move vertically
|
|
598
|
+
* @param elevation - Target world elevation of the component's base (engine units)
|
|
599
|
+
* @returns the affected component
|
|
600
|
+
*
|
|
601
|
+
* @examplePrompt Set this element's elevation to 3000
|
|
602
|
+
* @examplePrompt Raise this mass so its base sits at 3 metres
|
|
603
|
+
* @examplePrompt Drop the selected slab to elevation 0
|
|
604
|
+
* @examplePrompt Put this staircase's base at 3200
|
|
605
|
+
*
|
|
606
|
+
* # Example
|
|
607
|
+
* ```ts
|
|
608
|
+
* // Sit the roof slab exactly at the top of a 3m storey
|
|
609
|
+
* const [roof] = await snaptrude.design.query.listRoofs()
|
|
610
|
+
* await snaptrude.design.update.setElevation(roof, 3000)
|
|
611
|
+
* ```
|
|
612
|
+
*/
|
|
613
|
+
public abstract setElevation(
|
|
614
|
+
component: ComponentHandle,
|
|
615
|
+
elevation: number,
|
|
616
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Set a component's **base offset** — its vertical distance above its own
|
|
620
|
+
* storey's base level. Moves the component so its base lands at
|
|
621
|
+
* `storeyBase + offset`, composed over the same command-backed move machinery
|
|
622
|
+
* as {@linkcode setElevation} (undoable, persisted, per-type invariants kept
|
|
623
|
+
* in sync). Use this instead of {@linkcode setElevation} when you want an
|
|
624
|
+
* offset relative to the storey rather than an absolute world height.
|
|
625
|
+
* `offset` is in **engine units** (the `design.doors.setWidth` convention);
|
|
626
|
+
* `0` sits the base flush with the storey base. Re-applying the current
|
|
627
|
+
* offset is a no-op.
|
|
628
|
+
*
|
|
629
|
+
* Throws when the component is locked, when it has no storey to offset from,
|
|
630
|
+
* or when the handle is gone/forged.
|
|
631
|
+
*
|
|
632
|
+
* @param component - The component to offset
|
|
633
|
+
* @param offset - Distance of the component's base above its storey base (engine units)
|
|
634
|
+
* @returns the affected component
|
|
635
|
+
*
|
|
636
|
+
* @examplePrompt Lift this element 300 above its floor
|
|
637
|
+
* @examplePrompt Set this staircase's base offset to 0
|
|
638
|
+
* @examplePrompt Raise the selected mass 500 off the storey base
|
|
639
|
+
* @examplePrompt Offset this slab 150 above the floor level
|
|
640
|
+
*
|
|
641
|
+
* # Example
|
|
642
|
+
* ```ts
|
|
643
|
+
* const [stair] = await snaptrude.design.query.listStaircases()
|
|
644
|
+
* await snaptrude.design.update.setBaseOffset(stair, 0)
|
|
645
|
+
* ```
|
|
646
|
+
*/
|
|
647
|
+
public abstract setBaseOffset(
|
|
648
|
+
component: ComponentHandle,
|
|
649
|
+
offset: number,
|
|
650
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Reassign one or more components to another **storey** — the same operation
|
|
654
|
+
* as the properties panel's Story dropdown, and it works across element kinds
|
|
655
|
+
* exactly like the panel (walls, slabs, masses, furniture, staircases, ...).
|
|
656
|
+
* Each component is moved vertically to the target storey's level (per-kind
|
|
657
|
+
* placement rules — e.g. a slab sits at the storey base, a wall on it) and
|
|
658
|
+
* its storey assignment, children, and dimension lines update together as
|
|
659
|
+
* **one undoable operation**.
|
|
660
|
+
*
|
|
661
|
+
* `storey` is an integer storey number in the `entity.story` convention
|
|
662
|
+
* (`1` is the ground storey, `-1` the first basement; `0` does not exist)
|
|
663
|
+
* and **must already exist** in each component's building — this call never
|
|
664
|
+
* creates storeys (use `core.storeys.create` first). Components already on
|
|
665
|
+
* the target storey are skipped (no-op) and are not echoed in `affected`.
|
|
666
|
+
*
|
|
667
|
+
* Throws when the target storey does not exist, when any component is
|
|
668
|
+
* locked, or when a handle is gone/forged — all before anything moves
|
|
669
|
+
* (all-or-nothing).
|
|
670
|
+
*
|
|
671
|
+
* @param components - The components to reassign
|
|
672
|
+
* @param storey - Target storey number (integer, `entity.story` convention)
|
|
673
|
+
* @returns the components actually reassigned
|
|
674
|
+
*
|
|
675
|
+
* @examplePrompt Move this sofa to storey 2
|
|
676
|
+
* @examplePrompt Put the selected walls on the first basement level
|
|
677
|
+
* @examplePrompt Send everything on this storey up one level
|
|
678
|
+
* @examplePrompt Reassign these slabs to storey 3
|
|
679
|
+
*
|
|
680
|
+
* # Example
|
|
681
|
+
* ```ts
|
|
682
|
+
* // Move the current selection up to storey 2
|
|
683
|
+
* const selection = await snaptrude.design.selection.get()
|
|
684
|
+
* const { affected } = await snaptrude.design.update.setStorey(selection, 2)
|
|
685
|
+
* console.log("moved", affected.length, "components")
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
688
|
+
public abstract setStorey(
|
|
689
|
+
components: ComponentHandle[],
|
|
690
|
+
storey: number,
|
|
691
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Update an existing parametric buildable envelope — regenerate the zoning
|
|
695
|
+
* volume from a revised site polygon, setbacks, vertical cap, or FAR and
|
|
696
|
+
* lot-coverage limits, keeping the same envelope id. Canonical home of the
|
|
697
|
+
* update formerly at `entity.buildableEnvelope.update` (now deprecated).
|
|
698
|
+
*
|
|
699
|
+
* @param buildableEnvelopeId - Existing envelope ID to update; non-empty and
|
|
700
|
+
* must match an existing envelope on the canvas.
|
|
701
|
+
* @param sitePolygon - Site polygon vertices in `lengthUnit`; minimum 3 vertices.
|
|
702
|
+
* @param lengthUnit - Unit used by all length fields (`"ft" | "m"`).
|
|
703
|
+
* @param setbacks - Setback profile, ground tier first; minimum 1 tier.
|
|
704
|
+
* @param verticalCap - Maximum height or floor count.
|
|
705
|
+
* @param floorToFloor - Required floor-to-floor height in `lengthUnit`.
|
|
706
|
+
* @param farRatio - Optional FAR value, positive when provided.
|
|
707
|
+
* @param lotCoverageMaxPct - Optional lot coverage cap, `0..100`.
|
|
708
|
+
* @returns A {@linkcode PluginBuildableEnvelopeUpdateResult} with the
|
|
709
|
+
* `buildableEnvelopeId` of the updated envelope.
|
|
710
|
+
* @throws If validation fails, the envelope does not exist, or generation
|
|
711
|
+
* produces no renderable geometry.
|
|
712
|
+
*
|
|
713
|
+
* @examplePrompt Change the envelope's height limit to 175 feet
|
|
714
|
+
* @examplePrompt Update the setbacks on the buildable envelope
|
|
715
|
+
* @examplePrompt Regenerate the zoning envelope with a new site boundary
|
|
716
|
+
* @examplePrompt Increase the FAR on the buildable volume
|
|
717
|
+
*
|
|
718
|
+
* # Example
|
|
719
|
+
* ```ts
|
|
720
|
+
* const { buildableEnvelopeId } = await snaptrude.design.update.buildableEnvelope(
|
|
721
|
+
* existingId,
|
|
722
|
+
* [
|
|
723
|
+
* { x: 0, z: 0 },
|
|
724
|
+
* { x: 100, z: 0 },
|
|
725
|
+
* { x: 100, z: 80 },
|
|
726
|
+
* { x: 0, z: 80 },
|
|
727
|
+
* ],
|
|
728
|
+
* "ft",
|
|
729
|
+
* [{ aboveHeight: 0, front: 10, side: 5, rear: 10 }],
|
|
730
|
+
* { kind: "max_height", maxHeight: 175 },
|
|
731
|
+
* 12,
|
|
732
|
+
* )
|
|
733
|
+
* ```
|
|
734
|
+
*/
|
|
735
|
+
public abstract buildableEnvelope(
|
|
736
|
+
buildableEnvelopeId: string,
|
|
737
|
+
sitePolygon: PluginBuildableEnvelopePolygonVertex[],
|
|
738
|
+
lengthUnit: "ft" | "m",
|
|
739
|
+
setbacks: PluginBuildableEnvelopeSetbackTier[],
|
|
740
|
+
verticalCap: PluginBuildableEnvelopeVerticalCap,
|
|
741
|
+
floorToFloor: number,
|
|
742
|
+
farRatio?: number,
|
|
743
|
+
lotCoverageMaxPct?: number,
|
|
744
|
+
): PluginApiReturn<PluginBuildableEnvelopeUpdateResult>
|
|
117
745
|
}
|