@snaptrude/plugin-core 0.0.0-dev-20260907135026 → 0.0.0-dev-20260911064951
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 +25 -0
- package/api-manifest.json +12 -151
- package/dist/api/core/geom/create/index.d.ts +86 -559
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/brep.d.ts +0 -50
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/curve.d.ts +35 -58
- package/dist/api/core/geom/query/curve.d.ts.map +1 -1
- package/dist/api/core/geom/query/edge.d.ts +2 -2
- package/dist/api/core/geom/query/face.d.ts +0 -45
- package/dist/api/core/geom/query/face.d.ts.map +1 -1
- package/dist/api/core/geom/update/curve.d.ts +5 -5
- package/dist/api/core/geom/update/profile.d.ts +1 -1
- package/dist/api/core/io/import/index.d.ts +3 -1
- package/dist/api/core/io/import/index.d.ts.map +1 -1
- package/dist/api/design/create/bulk-items.d.ts +185 -0
- package/dist/api/design/create/bulk-items.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +310 -22
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +37 -0
- package/dist/api/design/create/opening-fields.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +4 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/dimensions.d.ts +427 -0
- package/dist/api/design/dimensions.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +20 -13
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +5 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/query/geometry/index.d.ts +1 -27
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +0 -47
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/spaces.d.ts +5 -5
- package/dist/api/design/update/index.d.ts +0 -87
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +2 -2
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +4 -5
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +4 -4
- package/dist/api/presentation/annotate.d.ts +2 -2
- package/dist/api/presentation/shapes.d.ts +2 -2
- package/dist/api/program/spreadsheet.d.ts +4 -4
- package/dist/handles.d.ts +22 -12
- package/dist/handles.d.ts.map +1 -1
- package/dist/index.cjs +2867 -3040
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2844 -3006
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/core/geom/create/index.ts +84 -588
- package/src/api/core/geom/query/brep.ts +0 -51
- package/src/api/core/geom/query/curve.ts +2 -25
- package/src/api/core/geom/query/edge.ts +2 -2
- package/src/api/core/geom/query/face.ts +0 -49
- package/src/api/core/io/import/index.ts +11 -3
- package/src/api/design/create/bulk-items.ts +186 -0
- package/src/api/design/create/index.ts +335 -38
- package/src/api/design/create/opening-fields.ts +37 -0
- package/src/api/design/delete/index.ts +4 -0
- package/src/api/design/dimensions.ts +453 -0
- package/src/api/design/doors/index.ts +20 -13
- package/src/api/design/index.ts +5 -0
- package/src/api/design/query/geometry/index.ts +0 -29
- package/src/api/design/query/index.ts +0 -50
- package/src/api/design/update/index.ts +0 -94
- package/src/handles.ts +27 -15
- package/src/index.ts +0 -1
- package/dist/massParameters.d.ts +0 -319
- package/dist/massParameters.d.ts.map +0 -1
- package/src/massParameters.ts +0 -472
- package/test/massParameters.test.mjs +0 -500
|
@@ -174,11 +174,6 @@ export abstract class PluginGeomQueryBrepApi {
|
|
|
174
174
|
* | `"line"` | `startPoint`, `endPoint`, `length` |
|
|
175
175
|
* | `"arc"` | `startPoint`, `endPoint`, `centre`, `axis`, `radius`, `length` |
|
|
176
176
|
* | `"circle"` | `centre`, `axis`, `radius`, `length` — a full-circle edge (e.g. a cylinder cap rim) |
|
|
177
|
-
* | `"spline"` | `startPoint`, `endPoint`, `degree`, `controlPoints`, `knots`, `length` — a free-form NURBS edge |
|
|
178
|
-
*
|
|
179
|
-
* For a `"spline"` edge, `knots` is the **expanded** knot vector — each knot
|
|
180
|
-
* repeated by its multiplicity, the textbook NURBS form — so
|
|
181
|
-
* `knots.length === controlPoints.length + degree + 1`.
|
|
182
177
|
*
|
|
183
178
|
* @param brep The brep the edge belongs to
|
|
184
179
|
* @param edge The edge whose curve to read
|
|
@@ -189,7 +184,6 @@ export abstract class PluginGeomQueryBrepApi {
|
|
|
189
184
|
* @examplePrompt Is this edge straight or an arc?
|
|
190
185
|
* @examplePrompt Get the exact start and end points of this edge
|
|
191
186
|
* @examplePrompt Measure the length of each edge of this mass
|
|
192
|
-
* @examplePrompt Read the control points of this curved edge
|
|
193
187
|
*
|
|
194
188
|
* # Example
|
|
195
189
|
* ```ts
|
|
@@ -225,16 +219,6 @@ export abstract class PluginGeomQueryBrepApi {
|
|
|
225
219
|
radius: number
|
|
226
220
|
length: number
|
|
227
221
|
}
|
|
228
|
-
| {
|
|
229
|
-
type: "spline"
|
|
230
|
-
startPoint: Vec3Components
|
|
231
|
-
endPoint: Vec3Components
|
|
232
|
-
degree: number
|
|
233
|
-
controlPoints: Vec3Components[]
|
|
234
|
-
/** Expanded by multiplicity: `controlPoints.length + degree + 1` entries. */
|
|
235
|
-
knots: number[]
|
|
236
|
-
length: number
|
|
237
|
-
}
|
|
238
222
|
>
|
|
239
223
|
|
|
240
224
|
/**
|
|
@@ -382,37 +366,6 @@ export abstract class PluginGeomQueryBrepApi {
|
|
|
382
366
|
*/
|
|
383
367
|
public abstract getBoundingBox(brep: BrepHandle): PluginApiReturn<BBoxComponents>
|
|
384
368
|
|
|
385
|
-
/**
|
|
386
|
-
* Get the enclosed **volume** of a closed solid, integrated from its exact
|
|
387
|
-
* surfaces. Curved faces are measured analytically, not from their
|
|
388
|
-
* tessellation — a real sphere of radius 5 reports 523.6, whatever its
|
|
389
|
-
* triangle count. That makes this the reliable way to confirm a solid is the
|
|
390
|
-
* shape you intended (a torus should measure 2·π²·R·r²).
|
|
391
|
-
*
|
|
392
|
-
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of tens
|
|
393
|
-
* of MB — expect a pause of seconds).
|
|
394
|
-
*
|
|
395
|
-
* @param brep The solid to measure
|
|
396
|
-
* @returns The enclosed volume in cubic raw Babylon units
|
|
397
|
-
* @throws OPERATION_FAILED if the kernel cannot compute the volume (the brep
|
|
398
|
-
* is not a closed solid)
|
|
399
|
-
*
|
|
400
|
-
* @examplePrompt What is the volume of this mass?
|
|
401
|
-
* @examplePrompt How much concrete is in this shape?
|
|
402
|
-
* @examplePrompt Check the volume of the dome I just made
|
|
403
|
-
*
|
|
404
|
-
* # Example
|
|
405
|
-
* ```ts
|
|
406
|
-
* const [mass] = await snaptrude.design.query.listMasses()
|
|
407
|
-
* const brep = await snaptrude.design.query.geometry.getBrep(mass)
|
|
408
|
-
* if (brep) {
|
|
409
|
-
* const volume = await snaptrude.core.geom.query.brep.getVolume(brep)
|
|
410
|
-
* console.log("volume:", volume)
|
|
411
|
-
* }
|
|
412
|
-
* ```
|
|
413
|
-
*/
|
|
414
|
-
public abstract getVolume(brep: BrepHandle): PluginApiReturn<number>
|
|
415
|
-
|
|
416
369
|
/**
|
|
417
370
|
* Test whether two breps are geometrically equal.
|
|
418
371
|
* @param brepA First brep
|
|
@@ -581,10 +534,6 @@ export type PluginGeomQueryBrepGetBoundingBoxArgs = z.infer<
|
|
|
581
534
|
typeof PluginGeomQueryBrepGetBoundingBoxArgs
|
|
582
535
|
>
|
|
583
536
|
|
|
584
|
-
/** Arguments for {@linkcode PluginGeomQueryBrepApi.getVolume}. `{ brep: BrepHandle }` */
|
|
585
|
-
export const PluginGeomQueryBrepGetVolumeArgs = brepArg
|
|
586
|
-
export type PluginGeomQueryBrepGetVolumeArgs = z.infer<typeof PluginGeomQueryBrepGetVolumeArgs>
|
|
587
|
-
|
|
588
537
|
/**
|
|
589
538
|
* Arguments for {@linkcode PluginGeomQueryBrepApi.isEqual}.
|
|
590
539
|
*
|
|
@@ -3,8 +3,8 @@ import { PluginApiReturn } from "../../../../types"
|
|
|
3
3
|
import { Vec3Handle, CurveHandle, LineHandle, Vec3Components } from "../../../../handles"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Curve queries — read-only geometric questions about curves (lines
|
|
7
|
-
*
|
|
6
|
+
* Curve queries — read-only geometric questions about curves (lines and arcs)
|
|
7
|
+
* and the relationships between two curves (all-handle model, §11).
|
|
8
8
|
*
|
|
9
9
|
* Every method takes opaque curve handles ({@linkcode CurveHandle}/{@linkcode LineHandle})
|
|
10
10
|
* and point handles ({@linkcode Vec3Handle}) and returns plain values — points as
|
|
@@ -13,29 +13,6 @@ import { Vec3Handle, CurveHandle, LineHandle, Vec3Components } from "../../../..
|
|
|
13
13
|
* {@linkcode CurveHandle} (or `null` when there is no result). No query mutates its
|
|
14
14
|
* inputs.
|
|
15
15
|
*
|
|
16
|
-
* ## Splines
|
|
17
|
-
*
|
|
18
|
-
* A {@linkcode CurveHandle} is a line, an arc, or a NURBS spline (minted by
|
|
19
|
-
* `core.geom.create.splineFromPoints`). Every method here accepts a spline at
|
|
20
|
-
* compile time, but only the reads backed by the engine's spline math answer
|
|
21
|
-
* for one today. The rest throw `PRECONDITION_FAILED` ("not supported for
|
|
22
|
-
* splines yet") — a typed refusal, never a quietly wrong answer.
|
|
23
|
-
*
|
|
24
|
-
* | Splines | Members |
|
|
25
|
-
* |---|---|
|
|
26
|
-
* | **supported** | {@linkcode PluginGeomQueryCurveApi.getStartPoint}, {@linkcode PluginGeomQueryCurveApi.getEndPoint}, {@linkcode PluginGeomQueryCurveApi.getLength}, {@linkcode PluginGeomQueryCurveApi.getTangent}, {@linkcode PluginGeomQueryCurveApi.listPoints}, {@linkcode PluginGeomQueryCurveApi.getNearestPoint} |
|
|
27
|
-
* | **not yet** | `getMidPoint`, `getChordLength`, `getNormal`, `getProjection`, `getPointAtDistance`, `getParameterAtPoint`, `getCurvature`, `getDistanceToPoint`, `getDistanceAlong`, `listSubdivisions`, `isLinear`, `isOnCurve`, `hasPoint`, `isEqual`, `isOverlapping`, `getCommonPart`, `listIntersections`, `getMergedCurve`, `isContinuous`, `isParallel`, `getShortestGap`, `getDistanceBetween` |
|
|
28
|
-
*
|
|
29
|
-
* {@linkcode PluginGeomQueryCurveApi.isOverlapping} is deliberately in the
|
|
30
|
-
* second row: its line/arc path falls back to structural equality, which would
|
|
31
|
-
* answer a spline pair wrongly rather than not at all.
|
|
32
|
-
*
|
|
33
|
-
* To work around the second row, sample the curve —
|
|
34
|
-
* {@linkcode PluginGeomQueryCurveApi.listPoints} then the ordinary
|
|
35
|
-
* `core.math.vec3` operations — or read a spline brep edge exactly with
|
|
36
|
-
* `core.geom.query.brep.getEdgeCurve`, which returns its degree, control points
|
|
37
|
-
* and knots.
|
|
38
|
-
*
|
|
39
16
|
* Accessed via `snaptrude.core.geom.query.curve`.
|
|
40
17
|
*/
|
|
41
18
|
export abstract class PluginGeomQueryCurveApi {
|
|
@@ -69,9 +69,9 @@ export abstract class PluginGeomQueryEdgeApi {
|
|
|
69
69
|
public abstract listVertices(edge: EdgeHandle): PluginApiReturn<VertexHandle[]>
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* Get the underlying curve geometry of an edge (a line
|
|
72
|
+
* Get the underlying curve geometry of an edge (a line or arc).
|
|
73
73
|
* @param edge The edge to query
|
|
74
|
-
* @returns The curve as a {@linkcode CurveHandle}
|
|
74
|
+
* @returns The curve as a {@linkcode CurveHandle}, or `null` if it is a circle or unset
|
|
75
75
|
*
|
|
76
76
|
* # Example
|
|
77
77
|
* ```ts
|
|
@@ -59,49 +59,6 @@ export abstract class PluginGeomQueryFaceApi {
|
|
|
59
59
|
*/
|
|
60
60
|
public abstract getMaterialIndex(face: FaceHandle): PluginApiReturn<number>
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Read what KIND of surface a face lies on. This is the one read that tells a
|
|
64
|
-
* genuinely curved face from a faceted approximation of one: every face of a
|
|
65
|
-
* 200-triangle "dome" answers `"plane"`, while a real dome has faces
|
|
66
|
-
* answering `"sphere"`. Use it to confirm a curved solid actually came out
|
|
67
|
-
* curved.
|
|
68
|
-
*
|
|
69
|
-
* | Value | Surface |
|
|
70
|
-
* |---|---|
|
|
71
|
-
* | `"plane"` | Flat face |
|
|
72
|
-
* | `"cylinder"` | Cylindrical face — constant radius about an axis |
|
|
73
|
-
* | `"cone"` | Conical face — a tapered ring (a cone or frustum side) |
|
|
74
|
-
* | `"sphere"` | Spherical face |
|
|
75
|
-
* | `"torus"` | Toroidal face — the ring surface of a donut |
|
|
76
|
-
* | `"spline"` | Free-form NURBS face |
|
|
77
|
-
*
|
|
78
|
-
* Pure read: no geometry kernel is loaded.
|
|
79
|
-
*
|
|
80
|
-
* @param face The face to query
|
|
81
|
-
* @returns The surface kind (see the table), or `null` when the face carries
|
|
82
|
-
* no surface classification
|
|
83
|
-
*
|
|
84
|
-
* @examplePrompt Is this face flat or curved?
|
|
85
|
-
* @examplePrompt Check that this dome is a real sphere, not a faceted approximation
|
|
86
|
-
* @examplePrompt What kind of surface is this face?
|
|
87
|
-
* @examplePrompt How many curved faces does this mass have?
|
|
88
|
-
*
|
|
89
|
-
* # Example
|
|
90
|
-
* ```ts
|
|
91
|
-
* const [mass] = await snaptrude.design.query.listMasses()
|
|
92
|
-
* const brep = await snaptrude.design.query.geometry.getBrep(mass)
|
|
93
|
-
* if (brep) {
|
|
94
|
-
* const faces = await snaptrude.core.geom.query.brep.listFaces(brep)
|
|
95
|
-
* const kinds = []
|
|
96
|
-
* for (const face of faces) kinds.push(await snaptrude.core.geom.query.face.getSurfaceKind(face))
|
|
97
|
-
* console.log("spherical faces:", kinds.filter((k) => k === "sphere").length)
|
|
98
|
-
* }
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
public abstract getSurfaceKind(
|
|
102
|
-
face: FaceHandle,
|
|
103
|
-
): PluginApiReturn<"plane" | "cylinder" | "cone" | "sphere" | "torus" | "spline" | null>
|
|
104
|
-
|
|
105
62
|
/**
|
|
106
63
|
* Get a seed half-edge of a face's outer loop.
|
|
107
64
|
* @param face The face to query
|
|
@@ -355,12 +312,6 @@ export type PluginGeomQueryFaceGetMaterialIndexArgs = z.infer<
|
|
|
355
312
|
typeof PluginGeomQueryFaceGetMaterialIndexArgs
|
|
356
313
|
>
|
|
357
314
|
|
|
358
|
-
/** Arguments for {@linkcode PluginGeomQueryFaceApi.getSurfaceKind}. `{ face: FaceHandle }` */
|
|
359
|
-
export const PluginGeomQueryFaceGetSurfaceKindArgs = faceArg
|
|
360
|
-
export type PluginGeomQueryFaceGetSurfaceKindArgs = z.infer<
|
|
361
|
-
typeof PluginGeomQueryFaceGetSurfaceKindArgs
|
|
362
|
-
>
|
|
363
|
-
|
|
364
315
|
/** Arguments for {@linkcode PluginGeomQueryFaceApi.getHalfEdge}. `{ face: FaceHandle }` */
|
|
365
316
|
export const PluginGeomQueryFaceGetHalfEdgeArgs = faceArg
|
|
366
317
|
export type PluginGeomQueryFaceGetHalfEdgeArgs = z.infer<typeof PluginGeomQueryFaceGetHalfEdgeArgs>
|
|
@@ -183,7 +183,10 @@ export abstract class PluginCoreIoImportApi {
|
|
|
183
183
|
* if (cad) console.log("DWG imported as CAD underlay:", cad)
|
|
184
184
|
* ```
|
|
185
185
|
*/
|
|
186
|
-
public abstract dwg(
|
|
186
|
+
public abstract dwg(
|
|
187
|
+
source: string,
|
|
188
|
+
storey?: number,
|
|
189
|
+
): PluginApiReturn<ImportJobHandle>
|
|
187
190
|
|
|
188
191
|
/**
|
|
189
192
|
* Sketch a CAD underlay from **already-parsed CAD JSON** — synchronous, with no
|
|
@@ -214,7 +217,10 @@ export abstract class PluginCoreIoImportApi {
|
|
|
214
217
|
* )
|
|
215
218
|
* ```
|
|
216
219
|
*/
|
|
217
|
-
public abstract cadJson(
|
|
220
|
+
public abstract cadJson(
|
|
221
|
+
cad: CadJsonInput,
|
|
222
|
+
storey?: number,
|
|
223
|
+
): PluginApiReturn<UnderlayHandle>
|
|
218
224
|
|
|
219
225
|
/**
|
|
220
226
|
* Import a **3D model** file and place it in the scene as a component.
|
|
@@ -239,7 +245,9 @@ export abstract class PluginCoreIoImportApi {
|
|
|
239
245
|
* @returns the placed {@linkcode ComponentHandle}.
|
|
240
246
|
* @throws if writes are disabled, the source can't be loaded, the format is
|
|
241
247
|
* unsupported, conversion/placement fails, or the converted model cannot be
|
|
242
|
-
* found in the library after upload
|
|
248
|
+
* found in the library after upload; `PRECONDITION_FAILED`
|
|
249
|
+
* (`details.engineCode: "TOOL_ACTIVE"`) while the interactive furniture tool is
|
|
250
|
+
* active — finish or cancel it first.
|
|
243
251
|
*
|
|
244
252
|
* @examplePrompt Import this SketchUp model onto storey 1
|
|
245
253
|
* @examplePrompt Bring in this OBJ file and place it at the origin
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { ContourHandle, ProfileHandle, Vec3Handle } from "../../../handles"
|
|
3
|
+
import { PluginOpeningBaseOptions } from "./opening-fields"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Maximum items per bulk `design.create.*` call. A bounded request keeps
|
|
7
|
+
* validation, command capture and rollback work finite; split a larger import
|
|
8
|
+
* into separate awaited batches, each with its own undo entry.
|
|
9
|
+
*/
|
|
10
|
+
export const PLUGIN_CREATE_BATCH_LIMIT = 1000
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// wallRuns
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* One wall run to create via {@linkcode PluginDesignCreateApi.wallRuns} — the
|
|
18
|
+
* same inputs as {@linkcode PluginDesignCreateApi.walls}, one run per item.
|
|
19
|
+
*
|
|
20
|
+
* | Property | Type | Description |
|
|
21
|
+
* |---|---|---|
|
|
22
|
+
* | `profile` | {@linkcode ProfileHandle} | Ordered curve chain (wall centerlines) |
|
|
23
|
+
* | `height` | `number`? | Wall height (Snaptrude units, > 0; default engine default) |
|
|
24
|
+
* | `thickness` | `number`? | Wall thickness (Snaptrude units, > 0; default: `wallType`'s total layer thickness when given, else engine default) |
|
|
25
|
+
* | `wallType` | `string`? | Wall type name from `design.types.list("wall")` — layers/material/thickness defaults (default generic) |
|
|
26
|
+
* | `storey` | `number`? (int) | Target storey (must exist) — the run's walls are assigned + lifted to its base in the same undo entry (default: geometry-derived) |
|
|
27
|
+
*/
|
|
28
|
+
export const PluginCreateWallRunItem = z.object({
|
|
29
|
+
profile: ProfileHandle,
|
|
30
|
+
height: z.number().optional(),
|
|
31
|
+
thickness: z.number().optional(),
|
|
32
|
+
wallType: z.string().min(1).optional(),
|
|
33
|
+
storey: z.number().int().optional(),
|
|
34
|
+
})
|
|
35
|
+
export type PluginCreateWallRunItem = z.infer<typeof PluginCreateWallRunItem>
|
|
36
|
+
|
|
37
|
+
/** The `items` array of {@linkcode PluginDesignCreateApi.wallRuns} (1…1000). */
|
|
38
|
+
export const PluginCreateWallRunItems = z
|
|
39
|
+
.array(PluginCreateWallRunItem)
|
|
40
|
+
.min(1)
|
|
41
|
+
.max(PLUGIN_CREATE_BATCH_LIMIT)
|
|
42
|
+
export type PluginCreateWallRunItems = z.infer<typeof PluginCreateWallRunItems>
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// floors
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* One floor to create via {@linkcode PluginDesignCreateApi.floors} — the same
|
|
50
|
+
* footprint-extrude inputs as {@linkcode PluginDesignCreateApi.floor}.
|
|
51
|
+
*
|
|
52
|
+
* | Property | Type | Description |
|
|
53
|
+
* |---|---|---|
|
|
54
|
+
* | `contour` | {@linkcode ContourHandle} | Footprint (outer profile + holes) |
|
|
55
|
+
* | `thickness` | `number` | Floor thickness (Snaptrude units, > 0) |
|
|
56
|
+
* | `position` | {@linkcode Vec3Handle}? | Offset from origin (default origin) |
|
|
57
|
+
*/
|
|
58
|
+
export const PluginCreateFloorItem = z.object({
|
|
59
|
+
contour: ContourHandle,
|
|
60
|
+
thickness: z.number(),
|
|
61
|
+
position: Vec3Handle.optional(),
|
|
62
|
+
})
|
|
63
|
+
export type PluginCreateFloorItem = z.infer<typeof PluginCreateFloorItem>
|
|
64
|
+
|
|
65
|
+
/** The `items` array of {@linkcode PluginDesignCreateApi.floors} (1…1000). */
|
|
66
|
+
export const PluginCreateFloorItems = z
|
|
67
|
+
.array(PluginCreateFloorItem)
|
|
68
|
+
.min(1)
|
|
69
|
+
.max(PLUGIN_CREATE_BATCH_LIMIT)
|
|
70
|
+
export type PluginCreateFloorItems = z.infer<typeof PluginCreateFloorItems>
|
|
71
|
+
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// doors / windows
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* One door to place via {@linkcode PluginDesignCreateApi.doors} — the same
|
|
78
|
+
* fields as a `"door"` {@linkcode PluginDesignCreateOpeningOptions}, so the
|
|
79
|
+
* size overrides singular {@linkcode PluginDesignCreateApi.door} lacks are
|
|
80
|
+
* available per item. `facing` and `hinge` are WORLD POINTS, not directions:
|
|
81
|
+
* `facing` on the side of the wall the door swings open to, `hinge` near the
|
|
82
|
+
* jamb it is hinged on. Rejects unknown fields.
|
|
83
|
+
*
|
|
84
|
+
* | Property | Type | Description |
|
|
85
|
+
* |---|---|---|
|
|
86
|
+
* | `catalogId` | `string` | Library id: team `_id` or general `fullName` |
|
|
87
|
+
* | `hostWall` | {@linkcode ComponentHandle} | The wall to host the door |
|
|
88
|
+
* | `position` | {@linkcode Vec3Handle} | World point projected onto the wall |
|
|
89
|
+
* | `facing` | {@linkcode Vec3Handle}? | World point on the side the door swings open to (default engine-chosen) |
|
|
90
|
+
* | `hinge` | {@linkcode Vec3Handle}? | World point near the jamb the door is hinged on (default the catalog item's authored side) |
|
|
91
|
+
* | `label` | `string`? | Instance name (optional) |
|
|
92
|
+
* | `width` | `number`? | Width override (Snaptrude units, > 0; default the catalog item's) |
|
|
93
|
+
* | `height` | `number`? | Height override (Snaptrude units, > 0; default the catalog item's) |
|
|
94
|
+
*/
|
|
95
|
+
export const PluginCreateDoorItem = z
|
|
96
|
+
.object({ ...PluginOpeningBaseOptions })
|
|
97
|
+
.strict()
|
|
98
|
+
export type PluginCreateDoorItem = z.infer<typeof PluginCreateDoorItem>
|
|
99
|
+
|
|
100
|
+
/** The `items` array of {@linkcode PluginDesignCreateApi.doors} (1…1000). */
|
|
101
|
+
export const PluginCreateDoorItems = z
|
|
102
|
+
.array(PluginCreateDoorItem)
|
|
103
|
+
.min(1)
|
|
104
|
+
.max(PLUGIN_CREATE_BATCH_LIMIT)
|
|
105
|
+
export type PluginCreateDoorItems = z.infer<typeof PluginCreateDoorItems>
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* One window to place via {@linkcode PluginDesignCreateApi.windows} — the same
|
|
109
|
+
* fields as a `"window"` {@linkcode PluginDesignCreateOpeningOptions}.
|
|
110
|
+
* `sillHeight` is a nonnegative Snaptrude-unit distance from the host wall's
|
|
111
|
+
* base to the BOTTOM of the window, not to its center. `facing` and `hinge`
|
|
112
|
+
* are WORLD POINTS, not directions: `facing` on the side of the wall the
|
|
113
|
+
* window opens to, `hinge` near the jamb it is hinged on. Rejects unknown
|
|
114
|
+
* fields.
|
|
115
|
+
*
|
|
116
|
+
* | Property | Type | Description |
|
|
117
|
+
* |---|---|---|
|
|
118
|
+
* | `catalogId` | `string` | Library id: team `_id` or general `fullName` |
|
|
119
|
+
* | `hostWall` | {@linkcode ComponentHandle} | The wall to host the window |
|
|
120
|
+
* | `position` | {@linkcode Vec3Handle} | World point projected onto the wall |
|
|
121
|
+
* | `facing` | {@linkcode Vec3Handle}? | World point on the side the window opens to (default engine-chosen) |
|
|
122
|
+
* | `hinge` | {@linkcode Vec3Handle}? | World point near the jamb the window is hinged on (default the catalog item's authored side) |
|
|
123
|
+
* | `label` | `string`? | Instance name (optional) |
|
|
124
|
+
* | `width` | `number`? | Width override (Snaptrude units, > 0; default the catalog item's) |
|
|
125
|
+
* | `height` | `number`? | Height override (Snaptrude units, > 0; default the catalog item's) |
|
|
126
|
+
* | `sillHeight` | `number`? | Wall base to window bottom (Snaptrude units, ≥ 0; default the catalog item's) |
|
|
127
|
+
*/
|
|
128
|
+
export const PluginCreateWindowItem = z
|
|
129
|
+
.object({
|
|
130
|
+
...PluginOpeningBaseOptions,
|
|
131
|
+
sillHeight: z.number().finite().nonnegative().optional(),
|
|
132
|
+
})
|
|
133
|
+
.strict()
|
|
134
|
+
export type PluginCreateWindowItem = z.infer<typeof PluginCreateWindowItem>
|
|
135
|
+
|
|
136
|
+
/** The `items` array of {@linkcode PluginDesignCreateApi.windows} (1…1000). */
|
|
137
|
+
export const PluginCreateWindowItems = z
|
|
138
|
+
.array(PluginCreateWindowItem)
|
|
139
|
+
.min(1)
|
|
140
|
+
.max(PLUGIN_CREATE_BATCH_LIMIT)
|
|
141
|
+
export type PluginCreateWindowItems = z.infer<typeof PluginCreateWindowItems>
|
|
142
|
+
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// furnitureItems
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* One furniture instance to place via
|
|
149
|
+
* {@linkcode PluginDesignCreateApi.furnitureItems} — the same inputs as
|
|
150
|
+
* {@linkcode PluginDesignCreateApi.furniture} minus `createNewSourceMesh`: in a
|
|
151
|
+
* batch the host owns source-mesh persistence (a source is recorded once per
|
|
152
|
+
* call, however many items reuse it).
|
|
153
|
+
*
|
|
154
|
+
* `position.y` is the REST elevation: the item is grounded so its bounding-box
|
|
155
|
+
* base sits exactly at `position.y` (the same surface-flush contract as
|
|
156
|
+
* interactive drag-drop) — pass the floor/storey elevation to stand furniture
|
|
157
|
+
* on it; never add half the item's height yourself.
|
|
158
|
+
*
|
|
159
|
+
* | Property | Type | Description |
|
|
160
|
+
* |---|---|---|
|
|
161
|
+
* | `catalogId` | `string` | Library id: team `_id` or general `fullName` |
|
|
162
|
+
* | `position` | {@linkcode Vec3Handle} | Absolute world placement point (`y` = rest elevation) |
|
|
163
|
+
* | `label` | `string`? | Instance name and readable label (default auto `${name}Ins${n}`) |
|
|
164
|
+
* | `angleInDegrees` | `number`? | Rotation about the vertical axis, in degrees (default unrotated) |
|
|
165
|
+
*/
|
|
166
|
+
export const PluginCreateFurnitureItem = z.object({
|
|
167
|
+
catalogId: z.string().min(1),
|
|
168
|
+
position: Vec3Handle,
|
|
169
|
+
label: z.string().optional(),
|
|
170
|
+
angleInDegrees: z.number().optional(),
|
|
171
|
+
})
|
|
172
|
+
export type PluginCreateFurnitureItem = z.infer<
|
|
173
|
+
typeof PluginCreateFurnitureItem
|
|
174
|
+
>
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The `items` array of {@linkcode PluginDesignCreateApi.furnitureItems}
|
|
178
|
+
* (1…1000).
|
|
179
|
+
*/
|
|
180
|
+
export const PluginCreateFurnitureItems = z
|
|
181
|
+
.array(PluginCreateFurnitureItem)
|
|
182
|
+
.min(1)
|
|
183
|
+
.max(PLUGIN_CREATE_BATCH_LIMIT)
|
|
184
|
+
export type PluginCreateFurnitureItems = z.infer<
|
|
185
|
+
typeof PluginCreateFurnitureItems
|
|
186
|
+
>
|