@snaptrude/plugin-core 0.2.3 → 0.2.5

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.
@@ -53,18 +53,22 @@ export abstract class PluginSpaceApi {
53
53
  /**
54
54
  * Create a space by extruding a 2D profile.
55
55
  *
56
- * The {@linkcode PluginSpaceCreateFromProfileArgs.profile profile} is extruded
57
- * upward (along the Y axis) by {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight
58
- * extrudeHeight}, then offset by {@linkcode PluginSpaceCreateFromProfileArgs.position
59
- * position}. The created space is automatically assigned to the active story
60
- * and a default department.
56
+ * The {@linkcode PluginSpaceCreateFromProfileArgs.profile profile} is used as
57
+ * the outer boundary and extruded upward (along the Y axis) by
58
+ * {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight extrudeHeight},
59
+ * then offset by {@linkcode PluginSpaceCreateFromProfileArgs.position
60
+ * position}. Optional {@linkcode PluginSpaceCreateFromProfileArgs.innerProfiles
61
+ * innerProfiles} are used as holes inside the outer boundary. The created
62
+ * space is automatically assigned to the active story and a default department.
61
63
  *
62
64
  * Use {@linkcode PluginProfileApi.fromLinePoints} to quickly build a profile
63
65
  * from a list of points.
64
66
  *
65
67
  * @param args - An object containing:
66
68
  * - {@linkcode PluginSpaceCreateFromProfileArgs.profile args.profile} — A closed
67
- * {@linkcode PProfile} defining the floor shape
69
+ * {@linkcode PProfile} defining the outer floor shape
70
+ * - {@linkcode PluginSpaceCreateFromProfileArgs.innerProfiles args.innerProfiles} —
71
+ * Optional closed {@linkcode PProfile}`[]` loops to subtract as holes
68
72
  * - {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight args.extrudeHeight} —
69
73
  * Extrusion height in Babylon units
70
74
  * - {@linkcode PluginSpaceCreateFromProfileArgs.position args.position} — Offset
@@ -77,7 +81,7 @@ export abstract class PluginSpaceApi {
77
81
  * ```ts
78
82
  * const { vec3 } = snaptrude.core.math
79
83
  *
80
- * const profile = await snaptrude.core.geom.profile.fromLinePoints({
84
+ * const outerProfile = await snaptrude.core.geom.profile.fromLinePoints({
81
85
  * points: [
82
86
  * vec3.new(0, 0, 0),
83
87
  * vec3.new(10, 0, 0),
@@ -85,9 +89,18 @@ export abstract class PluginSpaceApi {
85
89
  * vec3.new(0, 0, 8),
86
90
  * ],
87
91
  * })
92
+ * const holeProfile = await snaptrude.core.geom.profile.fromLinePoints({
93
+ * points: [
94
+ * vec3.new(3, 0, 3),
95
+ * vec3.new(7, 0, 3),
96
+ * vec3.new(7, 0, 5),
97
+ * vec3.new(3, 0, 5),
98
+ * ],
99
+ * })
88
100
  *
89
101
  * const { spaceId } = await snaptrude.entity.space.createFromProfile({
90
- * profile,
102
+ * profile: outerProfile,
103
+ * innerProfiles: [holeProfile],
91
104
  * extrudeHeight: 3,
92
105
  * position: vec3.new(0, 0, 0),
93
106
  * })
@@ -95,6 +108,7 @@ export abstract class PluginSpaceApi {
95
108
  */
96
109
  public abstract createFromProfile({
97
110
  profile,
111
+ innerProfiles,
98
112
  extrudeHeight,
99
113
  position,
100
114
  }: PluginSpaceCreateFromProfileArgs): PluginApiReturn<PluginSpaceCreateFromProfileResult>
@@ -152,9 +166,7 @@ export abstract class PluginSpaceApi {
152
166
  spaceId,
153
167
  profile,
154
168
  extrudeHeight,
155
- }: PluginSpaceUpdateGeometryFromProfileArgs): PluginApiReturn<
156
- PluginSpaceUpdateGeometryFromProfileResult
157
- >
169
+ }: PluginSpaceUpdateGeometryFromProfileArgs): PluginApiReturn<PluginSpaceUpdateGeometryFromProfileResult>
158
170
 
159
171
  /**
160
172
  * Get the IDs of all spaces in the current project.
@@ -252,7 +264,7 @@ export abstract class PluginSpaceApi {
252
264
  * ```
253
265
  */
254
266
  public abstract update(
255
- args: PluginSpaceUpdateArgs
267
+ args: PluginSpaceUpdateArgs,
256
268
  ): PluginApiReturn<PluginSpaceUpdateResult>
257
269
  }
258
270
 
@@ -297,12 +309,14 @@ export type PluginSpaceCreateRectangularResult = z.infer<
297
309
  *
298
310
  * | Property | Type | Description |
299
311
  * |---|---|---|
300
- * | `profile` | {@linkcode PProfile} | Closed 2D profile defining the floor shape |
312
+ * | `profile` | {@linkcode PProfile} | Closed 2D profile defining the outer floor shape |
313
+ * | `innerProfiles` | {@linkcode PProfile}`[]` | Optional closed profiles to subtract as holes |
301
314
  * | `extrudeHeight` | `number` | Extrusion height in Babylon units |
302
315
  * | `position` | {@linkcode PVec3} | Offset position in Babylon units |
303
316
  */
304
317
  export const PluginSpaceCreateFromProfileArgs = z.object({
305
318
  profile: PProfile,
319
+ innerProfiles: z.array(PProfile).optional(),
306
320
  extrudeHeight: z.number(),
307
321
  position: PVec3,
308
322
  })
@@ -469,7 +483,7 @@ export const PluginSpaceType = z.enum([
469
483
  "Pool",
470
484
  "Walkway",
471
485
  "Envelope",
472
- "Parking"
486
+ "Parking",
473
487
  ])
474
488
 
475
489
  /**