@snaptrude/plugin-core 0.0.5 → 0.0.6
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/dist/api/core/geom/arc.d.ts +50 -1
- package/dist/api/core/geom/arc.d.ts.map +1 -1
- package/dist/api/core/geom/curve.d.ts +26 -1
- package/dist/api/core/geom/curve.d.ts.map +1 -1
- package/dist/api/core/geom/index.d.ts +16 -0
- package/dist/api/core/geom/index.d.ts.map +1 -1
- package/dist/api/core/geom/line.d.ts +35 -1
- package/dist/api/core/geom/line.d.ts.map +1 -1
- package/dist/api/core/geom/profile.d.ts +66 -2
- package/dist/api/core/geom/profile.d.ts.map +1 -1
- package/dist/api/core/index.d.ts +8 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/math/index.d.ts +8 -0
- package/dist/api/core/math/index.d.ts.map +1 -1
- package/dist/api/core/math/quat.d.ts +156 -15
- package/dist/api/core/math/quat.d.ts.map +1 -1
- package/dist/api/core/math/vec3.d.ts +131 -14
- package/dist/api/core/math/vec3.d.ts.map +1 -1
- package/dist/api/entity/index.d.ts +8 -0
- package/dist/api/entity/index.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +217 -4
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +166 -0
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +14 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/tools/index.d.ts +8 -0
- package/dist/api/tools/index.d.ts.map +1 -1
- package/dist/api/tools/selection.d.ts +37 -0
- package/dist/api/tools/selection.d.ts.map +1 -1
- package/dist/api/tools/transform.d.ts +82 -0
- package/dist/api/tools/transform.d.ts.map +1 -1
- package/dist/api/units/index.d.ts +72 -13
- package/dist/api/units/index.d.ts.map +1 -1
- package/dist/index.cjs +322 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +321 -35
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/core/geom/arc.ts +50 -1
- package/src/api/core/geom/curve.ts +26 -1
- package/src/api/core/geom/index.ts +16 -0
- package/src/api/core/geom/line.ts +35 -1
- package/src/api/core/geom/profile.ts +66 -2
- package/src/api/core/index.ts +8 -0
- package/src/api/core/math/index.ts +8 -0
- package/src/api/core/math/quat.ts +156 -15
- package/src/api/core/math/vec3.ts +131 -14
- package/src/api/entity/index.ts +8 -0
- package/src/api/entity/space.ts +218 -5
- package/src/api/entity/story.ts +166 -0
- package/src/api/index.ts +14 -0
- package/src/api/tools/index.ts +8 -0
- package/src/api/tools/selection.ts +37 -0
- package/src/api/tools/transform.ts +82 -0
- package/src/api/units/index.ts +72 -13
- package/src/types.ts +8 -1
|
@@ -1,35 +1,152 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* 3D vector operations for positions, directions, and displacements.
|
|
4
|
+
*
|
|
5
|
+
* All methods are **pure** — they return new {@linkcode PVec3} values
|
|
6
|
+
* without mutating the inputs.
|
|
7
|
+
*
|
|
8
|
+
* Accessed via `snaptrude.core.math.vec3`.
|
|
9
|
+
*/
|
|
2
10
|
export declare abstract class PluginVec3Api {
|
|
3
11
|
constructor();
|
|
4
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Create a new 3D vector.
|
|
14
|
+
*
|
|
15
|
+
* @param x - The X component
|
|
16
|
+
* @param y - The Y component
|
|
17
|
+
* @param z - The Z component
|
|
18
|
+
* @returns A new {@linkcode PVec3}
|
|
19
|
+
*
|
|
20
|
+
* # Example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const position = snaptrude.core.math.vec3.new(1, 2, 3)
|
|
23
|
+
* // { x: 1, y: 2, z: 3 }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
5
26
|
new(x: number, y: number, z: number): PVec3;
|
|
6
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Add two vectors component-wise.
|
|
29
|
+
*
|
|
30
|
+
* @param a - First vector
|
|
31
|
+
* @param b - Second vector
|
|
32
|
+
* @returns A new {@linkcode PVec3} where each component is `a[i] + b[i]`
|
|
33
|
+
*/
|
|
7
34
|
add(a: PVec3, b: PVec3): PVec3;
|
|
8
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Subtract vector {@linkcode b} from vector {@linkcode a} component-wise.
|
|
37
|
+
*
|
|
38
|
+
* @param a - Vector to subtract from
|
|
39
|
+
* @param b - Vector to subtract
|
|
40
|
+
* @returns A new {@linkcode PVec3} where each component is `a[i] - b[i]`
|
|
41
|
+
*/
|
|
9
42
|
subtract(a: PVec3, b: PVec3): PVec3;
|
|
10
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Scale a vector by a scalar value.
|
|
45
|
+
*
|
|
46
|
+
* @param v - The vector to scale
|
|
47
|
+
* @param scalar - The scalar multiplier
|
|
48
|
+
* @returns A new {@linkcode PVec3} where each component is `v[i] * scalar`
|
|
49
|
+
*/
|
|
11
50
|
scale(v: PVec3, scalar: number): PVec3;
|
|
12
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Compute the dot product of two vectors.
|
|
53
|
+
*
|
|
54
|
+
* The dot product equals `|a| * |b| * cos(θ)` where `θ` is the angle
|
|
55
|
+
* between the vectors. Useful for checking orthogonality (result = 0)
|
|
56
|
+
* or projection.
|
|
57
|
+
*
|
|
58
|
+
* @param a - First vector
|
|
59
|
+
* @param b - Second vector
|
|
60
|
+
* @returns The scalar dot product
|
|
61
|
+
*/
|
|
13
62
|
dot(a: PVec3, b: PVec3): number;
|
|
14
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Compute the cross product of two vectors.
|
|
65
|
+
*
|
|
66
|
+
* The result is a vector perpendicular to both inputs, with magnitude
|
|
67
|
+
* equal to the area of the parallelogram they span. Useful for computing
|
|
68
|
+
* surface normals.
|
|
69
|
+
*
|
|
70
|
+
* @param a - First vector
|
|
71
|
+
* @param b - Second vector
|
|
72
|
+
* @returns A new {@linkcode PVec3} perpendicular to both {@linkcode a} and {@linkcode b}
|
|
73
|
+
*/
|
|
15
74
|
cross(a: PVec3, b: PVec3): PVec3;
|
|
16
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* Compute the length (magnitude) of a vector.
|
|
77
|
+
*
|
|
78
|
+
* @param v - The vector
|
|
79
|
+
* @returns The Euclidean length `√(x² + y² + z²)`
|
|
80
|
+
*/
|
|
17
81
|
length(v: PVec3): number;
|
|
18
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Compute the squared length of a vector.
|
|
84
|
+
*
|
|
85
|
+
* Avoids the `sqrt` call — prefer this over {@linkcode PluginVec3Api.length}
|
|
86
|
+
* when comparing relative magnitudes.
|
|
87
|
+
*
|
|
88
|
+
* @param v - The vector
|
|
89
|
+
* @returns The squared length `x² + y² + z²`
|
|
90
|
+
*/
|
|
19
91
|
lengthSquared(v: PVec3): number;
|
|
20
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Normalize a vector to unit length.
|
|
94
|
+
*
|
|
95
|
+
* @param v - The vector to normalize
|
|
96
|
+
* @returns A new unit-length {@linkcode PVec3} in the same direction,
|
|
97
|
+
* or a zero vector `(0, 0, 0)` if the input has zero length
|
|
98
|
+
*/
|
|
21
99
|
normalize(v: PVec3): PVec3;
|
|
22
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Compute the Euclidean distance between two points.
|
|
102
|
+
*
|
|
103
|
+
* @param a - First point
|
|
104
|
+
* @param b - Second point
|
|
105
|
+
* @returns The distance `|a - b|`
|
|
106
|
+
*/
|
|
23
107
|
distance(a: PVec3, b: PVec3): number;
|
|
24
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Linearly interpolate between two vectors.
|
|
110
|
+
*
|
|
111
|
+
* @param a - Start vector (returned when `t = 0`)
|
|
112
|
+
* @param b - End vector (returned when `t = 1`)
|
|
113
|
+
* @param t - Interpolation factor, typically in `[0, 1]`
|
|
114
|
+
* @returns A new {@linkcode PVec3} at `a + (b - a) * t`
|
|
115
|
+
*/
|
|
25
116
|
lerp(a: PVec3, b: PVec3, t: number): PVec3;
|
|
26
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Negate a vector (reverse its direction).
|
|
119
|
+
*
|
|
120
|
+
* @param v - The vector to negate
|
|
121
|
+
* @returns A new {@linkcode PVec3} with all components negated
|
|
122
|
+
*/
|
|
27
123
|
negate(v: PVec3): PVec3;
|
|
28
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Check if two vectors are exactly equal (strict equality per component).
|
|
126
|
+
*
|
|
127
|
+
* For floating-point comparisons, prefer {@linkcode PluginVec3Api.equalsApprox}.
|
|
128
|
+
*
|
|
129
|
+
* @param a - First vector
|
|
130
|
+
* @param b - Second vector
|
|
131
|
+
* @returns `true` if all components match exactly
|
|
132
|
+
*/
|
|
29
133
|
equals(a: PVec3, b: PVec3): boolean;
|
|
30
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* Check if two vectors are approximately equal within a tolerance.
|
|
136
|
+
*
|
|
137
|
+
* @param a - First vector
|
|
138
|
+
* @param b - Second vector
|
|
139
|
+
* @param epsilon - Maximum allowed difference per component (default `1e-6`)
|
|
140
|
+
* @returns `true` if `|a[i] - b[i]| < epsilon` for all components
|
|
141
|
+
*/
|
|
31
142
|
equalsApprox(a: PVec3, b: PVec3, epsilon?: number): boolean;
|
|
32
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* A 3D vector with `x`, `y`, and `z` components.
|
|
146
|
+
*
|
|
147
|
+
* Used throughout the plugin API for positions, directions, displacements,
|
|
148
|
+
* and Euler rotation angles. Equivalent to `BABYLON.Vector3`.
|
|
149
|
+
*/
|
|
33
150
|
export declare const PVec3: z.ZodObject<{
|
|
34
151
|
x: z.ZodNumber;
|
|
35
152
|
y: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vec3.d.ts","sourceRoot":"","sources":["../../../../src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AAC,EAAE,MAAM,GAAG,KAAK;IAQ1C;;;;;OAKG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK;IAIvB;;;;;;;;OAQG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,OAAO;IAInC;;;;;;;OAOG;IACH,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAE,MAAa,GAAG,OAAO;CAOlE;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;iBAIhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAA"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { PluginSpaceApi } from "./space";
|
|
2
2
|
import { PluginStoryApi } from "./story";
|
|
3
|
+
/**
|
|
4
|
+
* CRUD operations on Snaptrude building entities.
|
|
5
|
+
*
|
|
6
|
+
* - {@linkcode PluginEntityApi.space} — Create, query, and delete spaces (rooms/masses)
|
|
7
|
+
* - {@linkcode PluginEntityApi.story} — Create, query, and update stories (floors)
|
|
8
|
+
*/
|
|
3
9
|
export declare abstract class PluginEntityApi {
|
|
10
|
+
/** Space (room/mass) operations. See {@linkcode PluginSpaceApi}. */
|
|
4
11
|
abstract space: PluginSpaceApi;
|
|
12
|
+
/** Story (floor/storey) operations. See {@linkcode PluginStoryApi}. */
|
|
5
13
|
abstract story: PluginStoryApi;
|
|
6
14
|
constructor();
|
|
7
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/entity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC,8BAAsB,eAAe;IACnC,SAAgB,KAAK,EAAE,cAAc,CAAA;IACrC,SAAgB,KAAK,EAAE,cAAc,CAAA;;CAGtC;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/entity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;GAKG;AACH,8BAAsB,eAAe;IACnC,oEAAoE;IACpE,SAAgB,KAAK,EAAE,cAAc,CAAA;IACrC,uEAAuE;IACvE,SAAgB,KAAK,EAAE,cAAc,CAAA;;CAGtC;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
|
@@ -1,13 +1,158 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { PluginApiReturn } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Space (room/mass) management — create, query, and delete spaces.
|
|
5
|
+
*
|
|
6
|
+
* A **space** is a 3D volume representing a room or mass in the
|
|
7
|
+
* Snaptrude scene. Spaces live on a particular story and carry
|
|
8
|
+
* properties such as name, area, department, and room type.
|
|
9
|
+
*
|
|
10
|
+
* All methods are **host API calls** that return Promises and support
|
|
11
|
+
* undo/redo via Snaptrude's command system.
|
|
12
|
+
*
|
|
13
|
+
* Accessed via `snaptrude.entity.space`.
|
|
14
|
+
*/
|
|
3
15
|
export declare abstract class PluginSpaceApi {
|
|
4
16
|
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Create a rectangular (box) space.
|
|
19
|
+
*
|
|
20
|
+
* Generates an axis-aligned box with the given dimensions at the
|
|
21
|
+
* specified position. The created space is automatically assigned
|
|
22
|
+
* to the active story and a default department.
|
|
23
|
+
*
|
|
24
|
+
* @param args - An object containing:
|
|
25
|
+
* - {@linkcode PluginSpaceCreateRectangularArgs.position args.position} — Origin
|
|
26
|
+
* position as a {@linkcode PVec3} in Babylon units
|
|
27
|
+
* - {@linkcode PluginSpaceCreateRectangularArgs.dimensions args.dimensions} — Box
|
|
28
|
+
* dimensions `{ width, height, depth }` in Babylon units
|
|
29
|
+
* @returns A {@linkcode PluginSpaceCreateRectangularResult} with the `spaceId`
|
|
30
|
+
* of the created space
|
|
31
|
+
* @throws If space creation fails
|
|
32
|
+
*
|
|
33
|
+
* # Example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const { vec3 } = snaptrude.core.math
|
|
36
|
+
*
|
|
37
|
+
* const { spaceId } = await snaptrude.entity.space.createRectangular({
|
|
38
|
+
* position: vec3.new(0, 0, 0),
|
|
39
|
+
* dimensions: { width: 5, height: 3, depth: 4 },
|
|
40
|
+
* })
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
5
43
|
abstract createRectangular({ position, dimensions, }: PluginSpaceCreateRectangularArgs): PluginApiReturn<PluginSpaceCreateRectangularResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Create a space by extruding a 2D profile.
|
|
46
|
+
*
|
|
47
|
+
* The {@linkcode PluginSpaceCreateFromProfileArgs.profile profile} is extruded
|
|
48
|
+
* upward (along the Y axis) by {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight
|
|
49
|
+
* extrudeHeight}, then offset by {@linkcode PluginSpaceCreateFromProfileArgs.position
|
|
50
|
+
* position}. The created space is automatically assigned to the active story
|
|
51
|
+
* and a default department.
|
|
52
|
+
*
|
|
53
|
+
* Use {@linkcode PluginProfileApi.fromLinePoints} to quickly build a profile
|
|
54
|
+
* from a list of points.
|
|
55
|
+
*
|
|
56
|
+
* @param args - An object containing:
|
|
57
|
+
* - {@linkcode PluginSpaceCreateFromProfileArgs.profile args.profile} — A closed
|
|
58
|
+
* {@linkcode PProfile} defining the floor shape
|
|
59
|
+
* - {@linkcode PluginSpaceCreateFromProfileArgs.extrudeHeight args.extrudeHeight} —
|
|
60
|
+
* Extrusion height in Babylon units
|
|
61
|
+
* - {@linkcode PluginSpaceCreateFromProfileArgs.position args.position} — Offset
|
|
62
|
+
* position as a {@linkcode PVec3} in Babylon units
|
|
63
|
+
* @returns A {@linkcode PluginSpaceCreateFromProfileResult} with the `spaceId`
|
|
64
|
+
* of the created space
|
|
65
|
+
* @throws If the profile is invalid or mesh creation fails
|
|
66
|
+
*
|
|
67
|
+
* # Example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const { vec3 } = snaptrude.core.math
|
|
70
|
+
*
|
|
71
|
+
* const profile = await snaptrude.core.geom.profile.fromLinePoints({
|
|
72
|
+
* points: [
|
|
73
|
+
* vec3.new(0, 0, 0),
|
|
74
|
+
* vec3.new(10, 0, 0),
|
|
75
|
+
* vec3.new(10, 0, 8),
|
|
76
|
+
* vec3.new(0, 0, 8),
|
|
77
|
+
* ],
|
|
78
|
+
* })
|
|
79
|
+
*
|
|
80
|
+
* const { spaceId } = await snaptrude.entity.space.createFromProfile({
|
|
81
|
+
* profile,
|
|
82
|
+
* extrudeHeight: 3,
|
|
83
|
+
* position: vec3.new(0, 0, 0),
|
|
84
|
+
* })
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
6
87
|
abstract createFromProfile({ profile, extrudeHeight, position, }: PluginSpaceCreateFromProfileArgs): PluginApiReturn<PluginSpaceCreateFromProfileResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Get the IDs of all spaces in the current project.
|
|
90
|
+
*
|
|
91
|
+
* Returns every space (mass that is not a building) across all stories.
|
|
92
|
+
* Use the returned IDs with {@linkcode PluginSpaceApi.get} to query
|
|
93
|
+
* individual space properties.
|
|
94
|
+
*
|
|
95
|
+
* @returns A {@linkcode PluginSpaceGetAllResult} with a `spacesIds` array
|
|
96
|
+
*
|
|
97
|
+
* # Example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const { spacesIds } = await snaptrude.entity.space.getAll()
|
|
100
|
+
* console.log(`Project has ${spacesIds.length} spaces`)
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
7
103
|
abstract getAll(): PluginApiReturn<PluginSpaceGetAllResult>;
|
|
104
|
+
/**
|
|
105
|
+
* Get properties of a space by its ID.
|
|
106
|
+
*
|
|
107
|
+
* Only the properties listed in {@linkcode PluginSpaceGetArgs.properties
|
|
108
|
+
* args.properties} are returned — unlisted properties will be `undefined`
|
|
109
|
+
* in the result.
|
|
110
|
+
*
|
|
111
|
+
* @param args - An object containing:
|
|
112
|
+
* - {@linkcode PluginSpaceGetArgs.spaceId args.spaceId} — The unique space ID
|
|
113
|
+
* (as returned by creation methods or {@linkcode PluginSpaceApi.getAll})
|
|
114
|
+
* - {@linkcode PluginSpaceGetArgs.properties args.properties} — Array of property
|
|
115
|
+
* names to retrieve. See {@linkcode PluginSpaceGetProperty} for available values.
|
|
116
|
+
* @returns A partial {@linkcode PluginSpaceGetResult} containing only the requested
|
|
117
|
+
* properties
|
|
118
|
+
* @throws If the space does not exist or the component is not a space/mass
|
|
119
|
+
*
|
|
120
|
+
* # Example
|
|
121
|
+
* ```ts
|
|
122
|
+
* const info = await snaptrude.entity.space.get({
|
|
123
|
+
* spaceId: "some-space-id",
|
|
124
|
+
* properties: ["name", "area", "position"],
|
|
125
|
+
* })
|
|
126
|
+
* console.log(info.name, info.area, info.position)
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
8
129
|
abstract get({ spaceId, properties, }: PluginSpaceGetArgs): PluginApiReturn<PluginSpaceGetResult>;
|
|
9
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Delete a space by its ID.
|
|
132
|
+
*
|
|
133
|
+
* Permanently removes the space and its associated mesh from the scene.
|
|
134
|
+
* This operation is undoable via Snaptrude's command system.
|
|
135
|
+
*
|
|
136
|
+
* @param args - An object containing:
|
|
137
|
+
* - {@linkcode PluginSpaceDeleteArgs.spaceId args.spaceId} — The unique space ID
|
|
138
|
+
* to delete
|
|
139
|
+
* @throws If the space does not exist or the component is not a space/mass
|
|
140
|
+
*
|
|
141
|
+
* # Example
|
|
142
|
+
* ```ts
|
|
143
|
+
* await snaptrude.entity.space.delete({ spaceId: "some-space-id" })
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
abstract delete({ spaceId, }: PluginSpaceDeleteArgs): PluginApiReturn<PluginSpaceDeleteResult>;
|
|
10
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Arguments for {@linkcode PluginSpaceApi.createRectangular}.
|
|
150
|
+
*
|
|
151
|
+
* | Property | Type | Description |
|
|
152
|
+
* |---|---|---|
|
|
153
|
+
* | `position` | {@linkcode PVec3} | Origin position in Babylon units |
|
|
154
|
+
* | `dimensions` | `{ width, height, depth }` | Box dimensions in Babylon units |
|
|
155
|
+
*/
|
|
11
156
|
export declare const PluginSpaceCreateRectangularArgs: z.ZodObject<{
|
|
12
157
|
position: z.ZodObject<{
|
|
13
158
|
x: z.ZodNumber;
|
|
@@ -21,10 +166,26 @@ export declare const PluginSpaceCreateRectangularArgs: z.ZodObject<{
|
|
|
21
166
|
}, z.core.$strip>;
|
|
22
167
|
}, z.core.$strip>;
|
|
23
168
|
export type PluginSpaceCreateRectangularArgs = z.infer<typeof PluginSpaceCreateRectangularArgs>;
|
|
169
|
+
/**
|
|
170
|
+
* Result of {@linkcode PluginSpaceApi.createRectangular}.
|
|
171
|
+
*
|
|
172
|
+
* | Property | Type | Description |
|
|
173
|
+
* |---|---|---|
|
|
174
|
+
* | `spaceId` | `string` | Unique ID of the created space |
|
|
175
|
+
*/
|
|
24
176
|
export declare const PluginSpaceCreateRectangularResult: z.ZodObject<{
|
|
25
177
|
spaceId: z.ZodString;
|
|
26
178
|
}, z.core.$strip>;
|
|
27
179
|
export type PluginSpaceCreateRectangularResult = z.infer<typeof PluginSpaceCreateRectangularResult>;
|
|
180
|
+
/**
|
|
181
|
+
* Arguments for {@linkcode PluginSpaceApi.createFromProfile}.
|
|
182
|
+
*
|
|
183
|
+
* | Property | Type | Description |
|
|
184
|
+
* |---|---|---|
|
|
185
|
+
* | `profile` | {@linkcode PProfile} | Closed 2D profile defining the floor shape |
|
|
186
|
+
* | `extrudeHeight` | `number` | Extrusion height in Babylon units |
|
|
187
|
+
* | `position` | {@linkcode PVec3} | Offset position in Babylon units |
|
|
188
|
+
*/
|
|
28
189
|
export declare const PluginSpaceCreateFromProfileArgs: z.ZodObject<{
|
|
29
190
|
profile: z.ZodObject<{
|
|
30
191
|
curves: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -71,10 +232,33 @@ export declare const PluginSpaceCreateFromProfileArgs: z.ZodObject<{
|
|
|
71
232
|
}, z.core.$strip>;
|
|
72
233
|
}, z.core.$strip>;
|
|
73
234
|
export type PluginSpaceCreateFromProfileArgs = z.infer<typeof PluginSpaceCreateFromProfileArgs>;
|
|
235
|
+
/**
|
|
236
|
+
* Result of {@linkcode PluginSpaceApi.createFromProfile}.
|
|
237
|
+
*
|
|
238
|
+
* | Property | Type | Description |
|
|
239
|
+
* |---|---|---|
|
|
240
|
+
* | `spaceId` | `string` | Unique ID of the created space |
|
|
241
|
+
*/
|
|
74
242
|
export declare const PluginSpaceCreateFromProfileResult: z.ZodObject<{
|
|
75
243
|
spaceId: z.ZodString;
|
|
76
244
|
}, z.core.$strip>;
|
|
77
245
|
export type PluginSpaceCreateFromProfileResult = z.infer<typeof PluginSpaceCreateFromProfileResult>;
|
|
246
|
+
/**
|
|
247
|
+
* Available properties that can be queried on a space.
|
|
248
|
+
*
|
|
249
|
+
* | Value | Return Type | Description |
|
|
250
|
+
* |---|---|---|
|
|
251
|
+
* | `"id"` | `string` | Unique space identifier |
|
|
252
|
+
* | `"type"` | `string` | Component type |
|
|
253
|
+
* | `"room_type"` | `string` | Room type classification |
|
|
254
|
+
* | `"name"` | `string` | Display name of the space |
|
|
255
|
+
* | `"area"` | `number` | Bottom (floor) area |
|
|
256
|
+
* | `"department"` | `string` | Assigned department name |
|
|
257
|
+
* | `"position"` | {@linkcode PVec3} | Local position relative to parent |
|
|
258
|
+
* | `"absolutePosition"` | {@linkcode PVec3} | Absolute position in the scene |
|
|
259
|
+
* | `"rotation"` | {@linkcode PVec3} | Euler rotation angles (radians) |
|
|
260
|
+
* | `"rotationQuaternion"` | {@linkcode PQuat} \| `null` | Quaternion rotation, or `null` if unset |
|
|
261
|
+
*/
|
|
78
262
|
export declare const PluginSpaceGetProperty: z.ZodEnum<{
|
|
79
263
|
position: "position";
|
|
80
264
|
id: "id";
|
|
@@ -87,6 +271,14 @@ export declare const PluginSpaceGetProperty: z.ZodEnum<{
|
|
|
87
271
|
rotation: "rotation";
|
|
88
272
|
rotationQuaternion: "rotationQuaternion";
|
|
89
273
|
}>;
|
|
274
|
+
/**
|
|
275
|
+
* Arguments for {@linkcode PluginSpaceApi.get}.
|
|
276
|
+
*
|
|
277
|
+
* | Property | Type | Description |
|
|
278
|
+
* |---|---|---|
|
|
279
|
+
* | `spaceId` | `string` | The space ID to query |
|
|
280
|
+
* | `properties` | {@linkcode PluginSpaceGetProperty}`[]` | Properties to retrieve |
|
|
281
|
+
*/
|
|
90
282
|
export declare const PluginSpaceGetArgs: z.ZodObject<{
|
|
91
283
|
spaceId: z.ZodString;
|
|
92
284
|
properties: z.ZodArray<z.ZodEnum<{
|
|
@@ -103,6 +295,12 @@ export declare const PluginSpaceGetArgs: z.ZodObject<{
|
|
|
103
295
|
}>>;
|
|
104
296
|
}, z.core.$strip>;
|
|
105
297
|
export type PluginSpaceGetArgs = z.infer<typeof PluginSpaceGetArgs>;
|
|
298
|
+
/**
|
|
299
|
+
* Result of {@linkcode PluginSpaceApi.get}.
|
|
300
|
+
*
|
|
301
|
+
* A partial object — only the properties that were requested in
|
|
302
|
+
* {@linkcode PluginSpaceGetArgs.properties} will be present.
|
|
303
|
+
*/
|
|
106
304
|
export declare const PluginSpaceGetResult: z.ZodObject<{
|
|
107
305
|
id: z.ZodOptional<z.ZodString>;
|
|
108
306
|
type: z.ZodOptional<z.ZodString>;
|
|
@@ -133,13 +331,28 @@ export declare const PluginSpaceGetResult: z.ZodObject<{
|
|
|
133
331
|
}, z.core.$strip>>>;
|
|
134
332
|
}, z.core.$strip>;
|
|
135
333
|
export type PluginSpaceGetResult = z.infer<typeof PluginSpaceGetResult>;
|
|
334
|
+
/**
|
|
335
|
+
* Result of {@linkcode PluginSpaceApi.getAll}.
|
|
336
|
+
*
|
|
337
|
+
* | Property | Type | Description |
|
|
338
|
+
* |---|---|---|
|
|
339
|
+
* | `spacesIds` | `string[]` | IDs of all spaces in the project |
|
|
340
|
+
*/
|
|
136
341
|
export declare const PluginSpaceGetAllResult: z.ZodObject<{
|
|
137
342
|
spacesIds: z.ZodArray<z.ZodString>;
|
|
138
343
|
}, z.core.$strip>;
|
|
139
344
|
export type PluginSpaceGetAllResult = z.infer<typeof PluginSpaceGetAllResult>;
|
|
140
|
-
|
|
345
|
+
/**
|
|
346
|
+
* Arguments for {@linkcode PluginSpaceApi.delete}.
|
|
347
|
+
*
|
|
348
|
+
* | Property | Type | Description |
|
|
349
|
+
* |---|---|---|
|
|
350
|
+
* | `spaceId` | `string` | The space ID to delete |
|
|
351
|
+
*/
|
|
352
|
+
export declare const PluginSpaceDeleteArgs: z.ZodObject<{
|
|
141
353
|
spaceId: z.ZodString;
|
|
142
354
|
}, z.core.$strip>;
|
|
143
|
-
export type
|
|
144
|
-
|
|
355
|
+
export type PluginSpaceDeleteArgs = z.infer<typeof PluginSpaceDeleteArgs>;
|
|
356
|
+
/** Result type for {@linkcode PluginSpaceApi.delete} — returns nothing on success. */
|
|
357
|
+
export type PluginSpaceDeleteResult = void;
|
|
145
358
|
//# sourceMappingURL=space.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../src/api/entity/space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAK7C,8BAAsB,cAAc;;
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../src/api/entity/space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,M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