@snaptrude/plugin-core 0.0.0-dev-20260708130115 → 0.0.0-dev-20260827194031
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 +3643 -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 +493 -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 +289 -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 +4605 -1423
- 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 +4191 -1412
- 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 +544 -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 +219 -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
|
@@ -1,38 +1,156 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { ComponentHandle } from "../../../handles"
|
|
4
|
+
import { PluginDesignChangeResult } from "../lock"
|
|
5
|
+
import { PluginObjectCatalogGroup } from "../doors"
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* `snaptrude.design.furniture` — the placeable furniture **catalog** (a library of
|
|
6
|
-
* source items, NOT scene entities)
|
|
7
|
-
* (returns a {@linkcode ComponentHandle});
|
|
8
|
-
* `design.query.listFurniture`/`getProperties`.
|
|
9
|
+
* source items, NOT scene entities) plus dimension reads/edits of PLACED furniture.
|
|
10
|
+
* Placement lives at `design.create.furniture` (returns a {@linkcode ComponentHandle});
|
|
11
|
+
* generic reads of placed furniture live at `design.query.listFurniture`/`getProperties`.
|
|
9
12
|
*
|
|
10
13
|
* Catalog items are plain value records ({@linkcode PluginFurnitureCatalogItem}) keyed
|
|
11
14
|
* by a library id (team `_id` or general `fullName`) — not handles. Reads are async
|
|
12
15
|
* (network-backed) but carry no `Async` suffix (§6.6).
|
|
16
|
+
*
|
|
17
|
+
* {@linkcode PluginDesignFurnitureApi.getDimensions} / {@linkcode PluginDesignFurnitureApi.setDimensions}
|
|
18
|
+
* target a PLACED furniture {@linkcode ComponentHandle} (not a catalog id) — `length`
|
|
19
|
+
* along the object, `width` across it, `height` up. Values are engine units, matching
|
|
20
|
+
* the length/width/height fields the furniture properties panel shows.
|
|
13
21
|
*/
|
|
14
22
|
export abstract class PluginDesignFurnitureApi {
|
|
15
23
|
constructor() {}
|
|
16
24
|
|
|
17
25
|
/**
|
|
18
|
-
*
|
|
26
|
+
* Get the dimensions of a PLACED furniture item — `length` (along the object),
|
|
27
|
+
* `width` (across it) and `height` (vertical), in engine units. Mirrors the
|
|
28
|
+
* Length/Width/Height fields of the furniture properties panel.
|
|
29
|
+
*
|
|
30
|
+
* @param item The placed furniture to query
|
|
31
|
+
* @returns The dimensions, or `null` if the geometry is degenerate
|
|
32
|
+
*
|
|
33
|
+
* @examplePrompt How big is this sofa?
|
|
34
|
+
* @examplePrompt What are the dimensions of the selected furniture?
|
|
35
|
+
* @examplePrompt Measure the length, width and height of this table
|
|
36
|
+
* @examplePrompt Get the size of the chair I just placed
|
|
37
|
+
*
|
|
38
|
+
* # Example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const [item] = await snaptrude.design.query.listFurniture({ isSelected: true })
|
|
41
|
+
* const dims = await snaptrude.design.furniture.getDimensions(item)
|
|
42
|
+
* if (dims) console.log(dims.length, dims.width, dims.height)
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
public abstract getDimensions(
|
|
46
|
+
item: ComponentHandle
|
|
47
|
+
): PluginApiReturn<PluginFurnitureDimensions | null>
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Resize a PLACED furniture item along one or more axes — `length`, `width`
|
|
51
|
+
* and/or `height` (engine units). Omitted axes are left unchanged. Each supplied
|
|
52
|
+
* axis is an undoable command, mirroring editing the furniture properties panel.
|
|
53
|
+
*
|
|
54
|
+
* @param item The placed furniture to resize
|
|
55
|
+
* @param dimensions New `length` / `width` / `height` (each optional, engine units)
|
|
56
|
+
* @returns The affected furniture
|
|
57
|
+
*
|
|
58
|
+
* @examplePrompt Make this table 1.8m long
|
|
59
|
+
* @examplePrompt Resize the selected sofa to 2000 wide
|
|
60
|
+
* @examplePrompt Set this furniture to 800mm tall
|
|
61
|
+
* @examplePrompt Change the desk to 1500 long and 700 deep
|
|
62
|
+
*
|
|
63
|
+
* # Example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const [item] = await snaptrude.design.query.listFurniture({ isSelected: true })
|
|
66
|
+
* const { affected } = await snaptrude.design.furniture.setDimensions(item, {
|
|
67
|
+
* length: 1800,
|
|
68
|
+
* height: 750
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
public abstract setDimensions(
|
|
73
|
+
item: ComponentHandle,
|
|
74
|
+
dimensions: PluginFurnitureDimensionUpdates
|
|
75
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* List the categories (Living, Bedroom, Kitchen, …) that organize the
|
|
79
|
+
* furniture catalog — the picker taxonomy, merged from built-in categories,
|
|
80
|
+
* team types, and backend user types. Pass a value to
|
|
81
|
+
* {@linkcode PluginDesignFurnitureApi.listCatalog}'s `category` filter.
|
|
82
|
+
* @returns The category names (`[]` when empty)
|
|
83
|
+
*
|
|
84
|
+
* @examplePrompt What furniture categories are available?
|
|
85
|
+
* @examplePrompt List the furniture categories
|
|
86
|
+
* @examplePrompt Show me the furniture groups like living and bedroom
|
|
87
|
+
* @examplePrompt Which furniture categories can I filter by?
|
|
88
|
+
*
|
|
89
|
+
* # Example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const categories = await snaptrude.design.furniture.listCategories()
|
|
92
|
+
* const [first] = categories
|
|
93
|
+
* const items = await snaptrude.design.furniture.listCatalog(undefined, first)
|
|
94
|
+
* console.log(first, "→", items.length, "items")
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @deprecated Use `design.furniture.listCatalogGroups` — the same name
|
|
98
|
+
* `design.doors` and `design.windows` use. Still supported.
|
|
99
|
+
*/
|
|
100
|
+
public abstract listCategories(): PluginApiReturn<string[]>
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* List the furniture catalog's groups. Matches
|
|
104
|
+
* {@linkcode PluginDesignDoorsApi.listCatalogGroups} and
|
|
105
|
+
* {@linkcode PluginDesignWindowsApi.listCatalogGroups}, so all three catalog
|
|
106
|
+
* surfaces are named alike.
|
|
107
|
+
*
|
|
108
|
+
* `source` is `"default"` for the built-in picker groups and `"team"` for the
|
|
109
|
+
* sub-types of THIS project's team library — exactly the split
|
|
110
|
+
* {@linkcode PluginDesignFurnitureApi.listCatalog}'s `source` filter uses, so
|
|
111
|
+
* every `"team"` group is guaranteed to match at least one team item here.
|
|
112
|
+
* For furniture the group token and its label are the same string (the
|
|
113
|
+
* category), so `dbType === label`; `design.doors`/`design.windows` have a
|
|
114
|
+
* distinct engine `dbType`.
|
|
115
|
+
*
|
|
116
|
+
* @returns The catalog groups as {@linkcode PluginObjectCatalogGroup}`[]`
|
|
117
|
+
* (`[]` when empty). Pass a group's `dbType` (=== `label`) to
|
|
118
|
+
* {@linkcode PluginDesignFurnitureApi.listCatalog}'s `category` filter to
|
|
119
|
+
* list its items.
|
|
120
|
+
*
|
|
121
|
+
* @examplePrompt What furniture groups are available?
|
|
122
|
+
* @examplePrompt List the furniture categories in this project
|
|
123
|
+
*
|
|
124
|
+
* # Example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const groups = await snaptrude.design.furniture.listCatalogGroups()
|
|
127
|
+
* for (const g of groups) console.log(g.dbType, g.label, g.source)
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
public abstract listCatalogGroups(): PluginApiReturn<PluginObjectCatalogGroup[]>
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* List the placeable furniture catalog (team + general libraries),
|
|
134
|
+
* optionally filtered by library `source` and/or `category`.
|
|
19
135
|
* @param source Restrict to one library (optional)
|
|
136
|
+
* @param category Restrict to one category (optional; see {@linkcode PluginDesignFurnitureApi.listCategories})
|
|
20
137
|
* @returns The catalog as {@linkcode PluginFurnitureCatalogItem}`[]` (`[]` when empty)
|
|
21
138
|
*
|
|
22
139
|
* @examplePrompt What furniture can I place in this project?
|
|
23
140
|
* @examplePrompt Show me all the furniture available in the library
|
|
24
141
|
* @examplePrompt List the chairs and tables I can add to the model
|
|
25
142
|
* @examplePrompt Which furniture items are in my team's library?
|
|
26
|
-
* @examplePrompt
|
|
143
|
+
* @examplePrompt Show me the bedroom furniture I can place
|
|
27
144
|
*
|
|
28
145
|
* # Example
|
|
29
146
|
* ```ts
|
|
30
|
-
* const
|
|
31
|
-
* for (const item of
|
|
147
|
+
* const bedroom = await snaptrude.design.furniture.listCatalog("team", "bedroom")
|
|
148
|
+
* for (const item of bedroom) console.log(item.id, item.name, item.thumbnailUrl)
|
|
32
149
|
* ```
|
|
33
150
|
*/
|
|
34
151
|
public abstract listCatalog(
|
|
35
|
-
source?: "team" | "general"
|
|
152
|
+
source?: "team" | "general",
|
|
153
|
+
category?: string
|
|
36
154
|
): PluginApiReturn<PluginFurnitureCatalogItem[]>
|
|
37
155
|
|
|
38
156
|
/**
|
|
@@ -85,6 +203,8 @@ export abstract class PluginDesignFurnitureApi {
|
|
|
85
203
|
* | `name` | `string` | Display name |
|
|
86
204
|
* | `source` | `'team' \| 'general'` | Which library it came from |
|
|
87
205
|
* | `subType` | `string` | Sub-type (optional) |
|
|
206
|
+
* | `category` | `string` | Category the item belongs to (optional) |
|
|
207
|
+
* | `thumbnailUrl` | `string` | Preview thumbnail URL (optional; never the mesh URL) |
|
|
88
208
|
* | `cost` | `number` | Cost (optional; team items) |
|
|
89
209
|
* | `familyName` | `string` | Family name (optional) |
|
|
90
210
|
*/
|
|
@@ -93,6 +213,8 @@ export const PluginFurnitureCatalogItem = z.object({
|
|
|
93
213
|
name: z.string(),
|
|
94
214
|
source: z.enum(["team", "general"]),
|
|
95
215
|
subType: z.string().optional(),
|
|
216
|
+
category: z.string().optional(),
|
|
217
|
+
thumbnailUrl: z.string().optional(),
|
|
96
218
|
cost: z.number().optional(),
|
|
97
219
|
familyName: z.string().optional(),
|
|
98
220
|
})
|
|
@@ -104,9 +226,11 @@ export type PluginFurnitureCatalogItem = z.infer<typeof PluginFurnitureCatalogIt
|
|
|
104
226
|
* | Property | Type | Description |
|
|
105
227
|
* |---|---|---|
|
|
106
228
|
* | `source` | `'team' \| 'general'` | Restrict to one library (optional) |
|
|
229
|
+
* | `category` | `string` | Restrict to one category (optional) |
|
|
107
230
|
*/
|
|
108
231
|
export const PluginDesignFurnitureListCatalogArgs = z.object({
|
|
109
232
|
source: z.enum(["team", "general"]).optional(),
|
|
233
|
+
category: z.string().optional(),
|
|
110
234
|
})
|
|
111
235
|
export type PluginDesignFurnitureListCatalogArgs = z.infer<
|
|
112
236
|
typeof PluginDesignFurnitureListCatalogArgs
|
|
@@ -128,3 +252,68 @@ export type PluginDesignFurnitureGetCatalogItemArgs = z.infer<
|
|
|
128
252
|
|
|
129
253
|
export const PluginDesignFurnitureExistsArgs = PluginDesignFurnitureGetCatalogItemArgs
|
|
130
254
|
export type PluginDesignFurnitureExistsArgs = z.infer<typeof PluginDesignFurnitureExistsArgs>
|
|
255
|
+
|
|
256
|
+
// ---------------------------------------------------------------------------
|
|
257
|
+
// placed-furniture dimensions
|
|
258
|
+
// ---------------------------------------------------------------------------
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* A placed furniture item's dimensions (engine units).
|
|
262
|
+
*
|
|
263
|
+
* | Property | Type | Description |
|
|
264
|
+
* |---|---|---|
|
|
265
|
+
* | `length` | `number` | Along the object (panel "Length") |
|
|
266
|
+
* | `width` | `number` | Across the object (panel "Width") |
|
|
267
|
+
* | `height` | `number` | Vertical (panel "Height") |
|
|
268
|
+
*/
|
|
269
|
+
export const PluginFurnitureDimensions = z.object({
|
|
270
|
+
length: z.number(),
|
|
271
|
+
width: z.number(),
|
|
272
|
+
height: z.number(),
|
|
273
|
+
})
|
|
274
|
+
export type PluginFurnitureDimensions = z.infer<typeof PluginFurnitureDimensions>
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Arguments for {@linkcode PluginDesignFurnitureApi.getDimensions}.
|
|
278
|
+
*
|
|
279
|
+
* | Property | Type | Description |
|
|
280
|
+
* |---|---|---|
|
|
281
|
+
* | `item` | {@linkcode ComponentHandle} | The placed furniture to query |
|
|
282
|
+
*/
|
|
283
|
+
export const PluginDesignFurnitureItemArgs = z.object({
|
|
284
|
+
item: ComponentHandle,
|
|
285
|
+
})
|
|
286
|
+
export type PluginDesignFurnitureItemArgs = z.infer<typeof PluginDesignFurnitureItemArgs>
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* A partial dimension patch — each axis is optional; omitted axes are unchanged.
|
|
290
|
+
* Every supplied axis must be a positive engine-unit length.
|
|
291
|
+
*
|
|
292
|
+
* | Property | Type | Description |
|
|
293
|
+
* |---|---|---|
|
|
294
|
+
* | `length` | `number`? | New length along the object (engine units, > 0) |
|
|
295
|
+
* | `width` | `number`? | New width across the object (engine units, > 0) |
|
|
296
|
+
* | `height` | `number`? | New height (engine units, > 0) |
|
|
297
|
+
*/
|
|
298
|
+
export const PluginFurnitureDimensionUpdates = z.object({
|
|
299
|
+
length: z.number().positive().optional(),
|
|
300
|
+
width: z.number().positive().optional(),
|
|
301
|
+
height: z.number().positive().optional(),
|
|
302
|
+
})
|
|
303
|
+
export type PluginFurnitureDimensionUpdates = z.infer<typeof PluginFurnitureDimensionUpdates>
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Arguments for {@linkcode PluginDesignFurnitureApi.setDimensions}.
|
|
307
|
+
*
|
|
308
|
+
* | Property | Type | Description |
|
|
309
|
+
* |---|---|---|
|
|
310
|
+
* | `item` | {@linkcode ComponentHandle} | The placed furniture to resize |
|
|
311
|
+
* | `dimensions` | {@linkcode PluginFurnitureDimensionUpdates} | The axes to change (each optional) |
|
|
312
|
+
*/
|
|
313
|
+
export const PluginDesignFurnitureSetDimensionsArgs = z.object({
|
|
314
|
+
item: ComponentHandle,
|
|
315
|
+
dimensions: PluginFurnitureDimensionUpdates,
|
|
316
|
+
})
|
|
317
|
+
export type PluginDesignFurnitureSetDimensionsArgs = z.infer<
|
|
318
|
+
typeof PluginDesignFurnitureSetDimensionsArgs
|
|
319
|
+
>
|
package/src/api/design/index.ts
CHANGED
|
@@ -13,6 +13,9 @@ import { PluginDesignBooleanApi } from "./boolean"
|
|
|
13
13
|
import { PluginDesignTransformApi } from "./transform"
|
|
14
14
|
import { PluginDesignEditApi } from "./edit"
|
|
15
15
|
import { PluginDesignUpdateApi } from "./update"
|
|
16
|
+
import { PluginDesignVisibilityApi } from "./visibility"
|
|
17
|
+
import { PluginDesignTypesApi } from "./types"
|
|
18
|
+
import { PluginDesignFamilyApi } from "./family"
|
|
16
19
|
import { PluginDesignChangeResult } from "./lock"
|
|
17
20
|
|
|
18
21
|
/**
|
|
@@ -27,7 +30,11 @@ import { PluginDesignChangeResult } from "./lock"
|
|
|
27
30
|
* - {@linkcode PluginDesignApi.boolean} — CSG boolean ops (union / subtract / intersect)
|
|
28
31
|
* - {@linkcode PluginDesignApi.erase} — plan-level adjacency-edge erase (NOT hard delete)
|
|
29
32
|
* - {@linkcode PluginDesignApi.delete} — hard entity removal
|
|
33
|
+
* - {@linkcode PluginDesignApi.visibility} — hide / isolate / reveal entities
|
|
34
|
+
* - {@linkcode PluginDesignApi.types} — read-only building type / assembly reference
|
|
35
|
+
* - {@linkcode PluginDesignApi.family} — author parametric families from a JSON spec
|
|
30
36
|
* - {@linkcode PluginDesignApi.lock} / {@linkcode PluginDesignApi.unlock} / {@linkcode PluginDesignApi.isLocked} / {@linkcode PluginDesignApi.listLocked} — lock state (top-level design verbs, §2A.1)
|
|
37
|
+
* - {@linkcode PluginDesignApi.lockArea} / {@linkcode PluginDesignApi.unlockArea} / {@linkcode PluginDesignApi.isAreaLocked} / {@linkcode PluginDesignApi.listAreaLocked} — footprint-area lock for Room/Department spaces
|
|
31
38
|
*
|
|
32
39
|
* Transform and edit operation namespaces land here in later waves.
|
|
33
40
|
*/
|
|
@@ -58,6 +65,12 @@ export abstract class PluginDesignApi {
|
|
|
58
65
|
public abstract edit: PluginDesignEditApi
|
|
59
66
|
/** Update existing entities — properties + geometry. See {@linkcode PluginDesignUpdateApi}. */
|
|
60
67
|
public abstract update: PluginDesignUpdateApi
|
|
68
|
+
/** Hide / isolate / reveal entities. See {@linkcode PluginDesignVisibilityApi}. */
|
|
69
|
+
public abstract visibility: PluginDesignVisibilityApi
|
|
70
|
+
/** Read-only building type / assembly reference. See {@linkcode PluginDesignTypesApi}. */
|
|
71
|
+
public abstract types: PluginDesignTypesApi
|
|
72
|
+
/** Author parametric families from a JSON spec. See {@linkcode PluginDesignFamilyApi}. */
|
|
73
|
+
public abstract family: PluginDesignFamilyApi
|
|
61
74
|
|
|
62
75
|
/**
|
|
63
76
|
* Lock entities so they cannot be edited. Undoable. Cascades to void/door/window
|
|
@@ -142,6 +155,92 @@ export abstract class PluginDesignApi {
|
|
|
142
155
|
*/
|
|
143
156
|
public abstract listLocked(): PluginApiReturn<ComponentHandle[]>
|
|
144
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Lock the **footprint area** of one or more Room / Department mass spaces —
|
|
160
|
+
* geometry edits that would change the bottom-face area are then refused or
|
|
161
|
+
* auto-resized to preserve it. Distinct from {@linkcode PluginDesignApi.lock}
|
|
162
|
+
* (which freezes the whole object): this locks only the area. Cascades to the
|
|
163
|
+
* space's instances and its source mass. Undoable.
|
|
164
|
+
*
|
|
165
|
+
* Only Room / Department masses are area-lockable; any other handle throws.
|
|
166
|
+
* Requires the `area_lock` feature to be enabled — when it is off this throws.
|
|
167
|
+
*
|
|
168
|
+
* @param spaces Room / Department mass spaces to area-lock
|
|
169
|
+
* @returns The affected spaces (post-cascade, echoing the input handles)
|
|
170
|
+
*
|
|
171
|
+
* @examplePrompt Lock the floor area of the selected rooms
|
|
172
|
+
* @examplePrompt Freeze the footprint area of this department so its size can't drift
|
|
173
|
+
* @examplePrompt Area-lock every room on this storey
|
|
174
|
+
* @examplePrompt Pin the area of this space while I edit its walls
|
|
175
|
+
*
|
|
176
|
+
* # Example
|
|
177
|
+
* ```ts
|
|
178
|
+
* const rooms = await snaptrude.design.selection.get()
|
|
179
|
+
* const { affected } = await snaptrude.design.lockArea(rooms)
|
|
180
|
+
* console.log("area-locked", affected.length, "spaces")
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
public abstract lockArea(spaces: ComponentHandle[]): PluginApiReturn<PluginDesignChangeResult>
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Unlock the footprint area of previously area-locked spaces so their area can
|
|
187
|
+
* change again. Paired with {@linkcode PluginDesignApi.lockArea}; cascades to
|
|
188
|
+
* instances + source; undoable. Requires the `area_lock` feature (throws if off).
|
|
189
|
+
*
|
|
190
|
+
* @param spaces Room / Department mass spaces to area-unlock
|
|
191
|
+
* @returns The affected spaces (post-cascade)
|
|
192
|
+
*
|
|
193
|
+
* @examplePrompt Unlock the area of the selected rooms
|
|
194
|
+
* @examplePrompt Remove the footprint-area lock from this department
|
|
195
|
+
* @examplePrompt Let me resize this space again by unlocking its area
|
|
196
|
+
* @examplePrompt Area-unlock everything I locked earlier
|
|
197
|
+
*
|
|
198
|
+
* # Example
|
|
199
|
+
* ```ts
|
|
200
|
+
* const locked = await snaptrude.design.listAreaLocked()
|
|
201
|
+
* const { affected } = await snaptrude.design.unlockArea(locked)
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
public abstract unlockArea(spaces: ComponentHandle[]): PluginApiReturn<PluginDesignChangeResult>
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Test whether a space's footprint area is locked. A read — never throws;
|
|
208
|
+
* returns `false` for non-space handles and when the `area_lock` feature is off.
|
|
209
|
+
*
|
|
210
|
+
* @param space The space to test
|
|
211
|
+
* @returns `true` if the space's area is locked, otherwise `false`
|
|
212
|
+
*
|
|
213
|
+
* @examplePrompt Is the area of this room locked?
|
|
214
|
+
* @examplePrompt Check whether this department's footprint is pinned
|
|
215
|
+
* @examplePrompt Tell me if the selected space has its area locked
|
|
216
|
+
*
|
|
217
|
+
* # Example
|
|
218
|
+
* ```ts
|
|
219
|
+
* const [room] = await snaptrude.design.selection.get()
|
|
220
|
+
* const locked = await snaptrude.design.isAreaLocked(room)
|
|
221
|
+
* console.log(locked ? "area is locked" : "area is free")
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
public abstract isAreaLocked(space: ComponentHandle): PluginApiReturn<boolean>
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* List the spaces whose footprint area is locked. A read — never throws; returns
|
|
228
|
+
* `[]` when the `area_lock` feature is off.
|
|
229
|
+
*
|
|
230
|
+
* @returns The area-locked spaces as {@linkcode ComponentHandle}`[]`
|
|
231
|
+
*
|
|
232
|
+
* @examplePrompt Which spaces have their area locked?
|
|
233
|
+
* @examplePrompt List every room with a locked footprint
|
|
234
|
+
* @examplePrompt Show me all the area-locked departments
|
|
235
|
+
*
|
|
236
|
+
* # Example
|
|
237
|
+
* ```ts
|
|
238
|
+
* const locked = await snaptrude.design.listAreaLocked()
|
|
239
|
+
* console.log(locked.length, "area-locked spaces")
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
public abstract listAreaLocked(): PluginApiReturn<ComponentHandle[]>
|
|
243
|
+
|
|
145
244
|
constructor() {}
|
|
146
245
|
}
|
|
147
246
|
|
|
@@ -160,3 +259,6 @@ export * from "./boolean"
|
|
|
160
259
|
export * from "./transform"
|
|
161
260
|
export * from "./edit"
|
|
162
261
|
export * from "./update"
|
|
262
|
+
export * from "./visibility"
|
|
263
|
+
export * from "./types"
|
|
264
|
+
export * from "./family"
|
package/src/api/design/lock.ts
CHANGED
|
@@ -40,3 +40,30 @@ export const PluginDesignIsLockedArgs = z.object({
|
|
|
40
40
|
includeInherited: z.boolean().optional(),
|
|
41
41
|
})
|
|
42
42
|
export type PluginDesignIsLockedArgs = z.infer<typeof PluginDesignIsLockedArgs>
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Arguments for {@linkcode PluginDesignApi.lockArea} / {@linkcode PluginDesignApi.unlockArea}.
|
|
46
|
+
*
|
|
47
|
+
* | Property | Type | Description |
|
|
48
|
+
* |---|---|---|
|
|
49
|
+
* | `spaces` | {@linkcode ComponentHandle}`[]` | Room / Department mass spaces to area-lock / unlock |
|
|
50
|
+
*/
|
|
51
|
+
export const PluginDesignLockAreaArgs = z.object({
|
|
52
|
+
spaces: z.array(ComponentHandle),
|
|
53
|
+
})
|
|
54
|
+
export type PluginDesignLockAreaArgs = z.infer<typeof PluginDesignLockAreaArgs>
|
|
55
|
+
|
|
56
|
+
export const PluginDesignUnlockAreaArgs = PluginDesignLockAreaArgs
|
|
57
|
+
export type PluginDesignUnlockAreaArgs = z.infer<typeof PluginDesignUnlockAreaArgs>
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Arguments for {@linkcode PluginDesignApi.isAreaLocked}.
|
|
61
|
+
*
|
|
62
|
+
* | Property | Type | Description |
|
|
63
|
+
* |---|---|---|
|
|
64
|
+
* | `space` | {@linkcode ComponentHandle} | The space to test |
|
|
65
|
+
*/
|
|
66
|
+
export const PluginDesignIsAreaLockedArgs = z.object({
|
|
67
|
+
space: ComponentHandle,
|
|
68
|
+
})
|
|
69
|
+
export type PluginDesignIsAreaLockedArgs = z.infer<typeof PluginDesignIsAreaLockedArgs>
|