@snaptrude/plugin-core 0.3.0 → 0.6.0
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/AGENTS.md +130 -48
- package/CHANGELOG.md +163 -0
- package/api-manifest.full.json +5600 -0
- package/api-manifest.json +5502 -0
- package/dist/api/analysis/heatmaps.d.ts +234 -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 +44 -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/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/core/buildings.d.ts +427 -0
- package/dist/api/core/buildings.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +230 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +247 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +72 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +24 -23
- package/dist/api/core/geom/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +169 -0
- package/dist/api/core/geom/query/arc.d.ts.map +1 -0
- package/dist/api/core/geom/query/brep.d.ts +402 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -0
- package/dist/api/core/geom/query/circle.d.ts +378 -0
- package/dist/api/core/geom/query/circle.d.ts.map +1 -0
- package/dist/api/core/geom/query/contour.d.ts +450 -0
- package/dist/api/core/geom/query/contour.d.ts.map +1 -0
- package/dist/api/core/geom/query/curve.d.ts +918 -0
- package/dist/api/core/geom/query/curve.d.ts.map +1 -0
- package/dist/api/core/geom/query/edge.d.ts +128 -0
- package/dist/api/core/geom/query/edge.d.ts.map +1 -0
- package/dist/api/core/geom/query/face.d.ts +363 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -0
- package/dist/api/core/geom/query/halfedge.d.ts +206 -0
- package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
- package/dist/api/core/geom/query/index.d.ts +61 -0
- package/dist/api/core/geom/query/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/profile.d.ts +410 -0
- package/dist/api/core/geom/query/profile.d.ts.map +1 -0
- package/dist/api/core/geom/query/vertex.d.ts +187 -0
- package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
- package/dist/api/core/geom/update/contour.d.ts +272 -0
- package/dist/api/core/geom/update/contour.d.ts.map +1 -0
- package/dist/api/core/geom/update/curve.d.ts +180 -0
- package/dist/api/core/geom/update/curve.d.ts.map +1 -0
- package/dist/api/core/geom/update/index.d.ts +27 -0
- package/dist/api/core/geom/update/index.d.ts.map +1 -0
- package/dist/api/core/geom/update/profile.d.ts +329 -0
- package/dist/api/core/geom/update/profile.d.ts.map +1 -0
- package/dist/api/core/groups.d.ts +485 -0
- package/dist/api/core/groups.d.ts.map +1 -0
- package/dist/api/core/history/index.d.ts +78 -0
- package/dist/api/core/history/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +51 -1
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/import/index.d.ts +392 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +35 -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 +206 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +286 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +111 -128
- package/dist/api/core/math/quat.d.ts.map +1 -1
- package/dist/api/core/math/vec3.d.ts +120 -102
- package/dist/api/core/math/vec3.d.ts.map +1 -1
- package/dist/api/core/project/index.d.ts +399 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +755 -0
- package/dist/api/core/tags.d.ts.map +1 -0
- package/dist/api/core/units/index.d.ts +175 -0
- package/dist/api/core/units/index.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +45 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +168 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +837 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +63 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +268 -0
- package/dist/api/design/doors/index.d.ts.map +1 -0
- package/dist/api/design/edit/index.d.ts +49 -0
- package/dist/api/design/edit/index.d.ts.map +1 -0
- package/dist/api/design/erase/index.d.ts +160 -0
- package/dist/api/design/erase/index.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +123 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +153 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +41 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +297 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +140 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1011 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +221 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +282 -0
- package/dist/api/design/selection/index.d.ts.map +1 -0
- package/dist/api/design/shared.d.ts +38 -0
- package/dist/api/design/shared.d.ts.map +1 -0
- package/dist/api/design/transform/index.d.ts +87 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +178 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +189 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +261 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
- package/dist/api/entity/department.d.ts +0 -98
- package/dist/api/entity/department.d.ts.map +1 -1
- package/dist/api/entity/index.d.ts +9 -9
- package/dist/api/entity/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +49 -106
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +484 -251
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +49 -39
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +22 -12
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +440 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +81 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +113 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +46 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +176 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +296 -0
- package/dist/api/presentation/views.d.ts.map +1 -0
- package/dist/api/program/adjacency.d.ts +155 -0
- package/dist/api/program/adjacency.d.ts.map +1 -0
- package/dist/api/program/areas.d.ts +360 -0
- package/dist/api/program/areas.d.ts.map +1 -0
- package/dist/api/program/classification.d.ts +135 -0
- package/dist/api/program/classification.d.ts.map +1 -0
- package/dist/api/program/cores.d.ts +174 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +431 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +69 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +63 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metrics.d.ts +108 -0
- package/dist/api/program/metrics.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +451 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2041 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/handles.d.ts +171 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +7 -5
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4344 -899
- 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 +3682 -865
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/scripts/generate-manifest.mjs +193 -0
- package/scripts/generate-manifest.test.mjs +215 -0
- package/src/api/analysis/heatmaps.ts +256 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +46 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/core/buildings.ts +485 -0
- package/src/api/core/comment/index.ts +258 -0
- package/src/api/core/geom/create/index.ts +293 -0
- package/src/api/core/geom/delete/index.ts +78 -0
- package/src/api/core/geom/index.ts +24 -23
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +444 -0
- package/src/api/core/geom/query/circle.ts +404 -0
- package/src/api/core/geom/query/contour.ts +540 -0
- package/src/api/core/geom/query/curve.ts +1078 -0
- package/src/api/core/geom/query/edge.ts +130 -0
- package/src/api/core/geom/query/face.ts +403 -0
- package/src/api/core/geom/query/halfedge.ts +210 -0
- package/src/api/core/geom/query/index.ts +63 -0
- package/src/api/core/geom/query/profile.ts +473 -0
- package/src/api/core/geom/query/vertex.ts +205 -0
- package/src/api/core/geom/update/contour.ts +315 -0
- package/src/api/core/geom/update/curve.ts +209 -0
- package/src/api/core/geom/update/index.ts +29 -0
- package/src/api/core/geom/update/profile.ts +377 -0
- package/src/api/core/groups.ts +521 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +51 -1
- package/src/api/core/io/import/index.ts +432 -0
- package/src/api/core/io/index.ts +37 -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 +214 -0
- package/src/api/core/io/underlay/index.ts +295 -0
- package/src/api/core/layers.ts +333 -0
- package/src/api/core/math/quat.ts +112 -235
- package/src/api/core/math/vec3.ts +124 -159
- package/src/api/core/project/index.ts +418 -0
- package/src/api/core/tags.ts +808 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/zoom/index.ts +47 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/index.ts +895 -0
- package/src/api/design/delete/index.ts +67 -0
- package/src/api/design/doors/index.ts +285 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/furniture/index.ts +130 -0
- package/src/api/design/index.ts +162 -0
- package/src/api/design/lock.ts +42 -0
- package/src/api/design/materials/index.ts +301 -0
- package/src/api/design/query/geometry/index.ts +166 -0
- package/src/api/design/query/index.ts +937 -0
- package/src/api/design/query/spaces.ts +132 -0
- package/src/api/design/selection/index.ts +273 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +93 -0
- package/src/api/design/update/index.ts +117 -0
- package/src/api/design/windows/index.ts +207 -0
- package/src/api/entity/buildableEnvelope.ts +318 -0
- package/src/api/entity/department.ts +0 -113
- package/src/api/entity/index.ts +9 -9
- package/src/api/entity/referenceLine.ts +50 -38
- package/src/api/entity/space.ts +285 -226
- package/src/api/entity/story.ts +53 -42
- package/src/api/index.ts +22 -12
- package/src/api/presentation/aiInspiration.ts +362 -0
- package/src/api/presentation/diagrams.ts +84 -0
- package/src/api/presentation/import.ts +112 -0
- package/src/api/presentation/index.ts +48 -0
- package/src/api/presentation/sheets.ts +198 -0
- package/src/api/presentation/views.ts +303 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +335 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +171 -0
- package/src/api/program/departments.ts +465 -0
- package/src/api/program/index.ts +71 -0
- package/src/api/program/layout.ts +68 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +419 -0
- package/src/api/program/spreadsheet.ts +2075 -0
- package/src/handles.ts +194 -0
- package/src/host-utils.ts +10 -6
- package/src/index.ts +1 -0
- package/dist/api/core/geom/arc.d.ts +0 -81
- package/dist/api/core/geom/arc.d.ts.map +0 -1
- package/dist/api/core/geom/curve.d.ts +0 -70
- package/dist/api/core/geom/curve.d.ts.map +0 -1
- package/dist/api/core/geom/line.d.ts +0 -56
- package/dist/api/core/geom/line.d.ts.map +0 -1
- package/dist/api/core/geom/profile.d.ts +0 -121
- package/dist/api/core/geom/profile.d.ts.map +0 -1
- package/dist/api/tools/copy.d.ts +0 -59
- package/dist/api/tools/copy.d.ts.map +0 -1
- package/dist/api/tools/index.d.ts +0 -33
- package/dist/api/tools/index.d.ts.map +0 -1
- package/dist/api/tools/material.d.ts +0 -51
- package/dist/api/tools/material.d.ts.map +0 -1
- package/dist/api/tools/offset.d.ts +0 -43
- package/dist/api/tools/offset.d.ts.map +0 -1
- package/dist/api/tools/selection.d.ts +0 -48
- package/dist/api/tools/selection.d.ts.map +0 -1
- package/dist/api/tools/transform.d.ts +0 -114
- package/dist/api/tools/transform.d.ts.map +0 -1
- package/dist/api/units/index.d.ts +0 -163
- package/dist/api/units/index.d.ts.map +0 -1
- package/src/api/core/geom/arc.ts +0 -70
- package/src/api/core/geom/curve.ts +0 -41
- package/src/api/core/geom/line.ts +0 -53
- package/src/api/core/geom/profile.ts +0 -94
- package/src/api/tools/copy.ts +0 -55
- package/src/api/tools/index.ts +0 -39
- package/src/api/tools/material.ts +0 -49
- package/src/api/tools/offset.ts +0 -43
- package/src/api/tools/selection.ts +0 -51
- package/src/api/tools/transform.ts +0 -117
- package/src/api/units/index.ts +0 -163
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { Vec3Handle, ComponentHandle } from "../../../handles"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Comments — create, edit, resolve, tag, and list scene/project comments.
|
|
7
|
+
*
|
|
8
|
+
* A comment is an opaque {@link CommentHandle} (its server id). Comments may be
|
|
9
|
+
* anchored to a component at a 3D point, carry @mentions (by email) and emojis,
|
|
10
|
+
* and be resolved / reopened. Accessed via `snaptrude.core.comment`.
|
|
11
|
+
*/
|
|
12
|
+
export abstract class PluginCommentApi {
|
|
13
|
+
constructor() {}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create a comment in the project — optionally pinned to a component at a 3D
|
|
17
|
+
* point — with optional @mentions that notify teammates by email.
|
|
18
|
+
*
|
|
19
|
+
* @param message - Comment text (emojis = plain unicode).
|
|
20
|
+
* @param component - Optional component to anchor the comment to.
|
|
21
|
+
* @param position - Optional pin point; defaults to the component's center.
|
|
22
|
+
* @param mentions - Optional user emails to @mention (appended as real @mention tags).
|
|
23
|
+
* @returns the new {@link CommentHandle}.
|
|
24
|
+
*
|
|
25
|
+
* @examplePrompt Add a comment on this wall saying the height looks wrong
|
|
26
|
+
* @examplePrompt Leave a note on the selected room for the design team
|
|
27
|
+
* @examplePrompt Comment "verify the door swing" and tag alex@acme.com
|
|
28
|
+
* @examplePrompt Pin a review note at this point on the slab
|
|
29
|
+
*
|
|
30
|
+
* # Example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const c = await snaptrude.core.comment.create(
|
|
33
|
+
* "Check this wall 🎉",
|
|
34
|
+
* spaceId,
|
|
35
|
+
* undefined,
|
|
36
|
+
* ["alex@acme.com"],
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
public abstract create(
|
|
41
|
+
message: string,
|
|
42
|
+
component?: ComponentHandle,
|
|
43
|
+
position?: Vec3Handle,
|
|
44
|
+
mentions?: string[],
|
|
45
|
+
): PluginApiReturn<CommentHandle>
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Edit a comment's message (and optional @mentions).
|
|
49
|
+
*
|
|
50
|
+
* @param comment - The comment to edit.
|
|
51
|
+
* @param message - New message text.
|
|
52
|
+
* @param mentions - Optional user emails to @mention.
|
|
53
|
+
*
|
|
54
|
+
* @examplePrompt Edit my comment to say the beam depth is 600mm
|
|
55
|
+
* @examplePrompt Change the text of this comment
|
|
56
|
+
* @examplePrompt Update the note on the wall and mention priya@studio.com
|
|
57
|
+
* @examplePrompt Reword the comment I just added
|
|
58
|
+
*
|
|
59
|
+
* # Example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const c = await snaptrude.core.comment.create("Beam depth TBD")
|
|
62
|
+
* await snaptrude.core.comment.update(c, "Beam depth is 600mm", ["priya@studio.com"])
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
public abstract update(
|
|
66
|
+
comment: CommentHandle,
|
|
67
|
+
message: string,
|
|
68
|
+
mentions?: string[],
|
|
69
|
+
): PluginApiReturn<boolean>
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Mark a comment resolved. Paired with {@link PluginCommentApi.reopen}.
|
|
73
|
+
*
|
|
74
|
+
* @param comment - The target comment.
|
|
75
|
+
*
|
|
76
|
+
* @examplePrompt Mark this comment as resolved
|
|
77
|
+
* @examplePrompt Resolve the comment about the staircase
|
|
78
|
+
* @examplePrompt Close out this review note
|
|
79
|
+
* @examplePrompt Set that comment to done
|
|
80
|
+
*
|
|
81
|
+
* # Example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const c = await snaptrude.core.comment.create("Verify the door swing")
|
|
84
|
+
* await snaptrude.core.comment.resolve(c)
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
public abstract resolve(comment: CommentHandle): PluginApiReturn<boolean>
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Reopen a resolved comment. Paired with {@link PluginCommentApi.resolve}.
|
|
91
|
+
*
|
|
92
|
+
* @param comment - The target comment.
|
|
93
|
+
*
|
|
94
|
+
* @examplePrompt Reopen this resolved comment
|
|
95
|
+
* @examplePrompt Mark the comment as unresolved again
|
|
96
|
+
* @examplePrompt Bring back the closed note about the window heights
|
|
97
|
+
* @examplePrompt Un-resolve that comment so we can keep discussing it
|
|
98
|
+
*
|
|
99
|
+
* # Example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const [comment] = await snaptrude.core.comment.list()
|
|
102
|
+
* await snaptrude.core.comment.reopen(comment)
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
public abstract reopen(comment: CommentHandle): PluginApiReturn<boolean>
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Check whether a comment has been marked resolved.
|
|
109
|
+
*
|
|
110
|
+
* @param comment - The target comment.
|
|
111
|
+
*
|
|
112
|
+
* @examplePrompt Is this comment resolved yet?
|
|
113
|
+
* @examplePrompt Check if the note about the roof has been closed
|
|
114
|
+
* @examplePrompt Has my comment been resolved?
|
|
115
|
+
* @examplePrompt Tell me whether that comment is still open
|
|
116
|
+
*
|
|
117
|
+
* # Example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const [comment] = await snaptrude.core.comment.list()
|
|
120
|
+
* const resolved = await snaptrude.core.comment.isResolved(comment)
|
|
121
|
+
* console.log(resolved ? "resolved" : "still open")
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
public abstract isResolved(comment: CommentHandle): PluginApiReturn<boolean>
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Tag (mention) a user on an existing comment, by email.
|
|
128
|
+
*
|
|
129
|
+
* @param comment - The comment to add a mention to.
|
|
130
|
+
* @param email - The user's email to @mention.
|
|
131
|
+
*
|
|
132
|
+
* @examplePrompt Tag alex@acme.com on this comment
|
|
133
|
+
* @examplePrompt Mention the structural engineer in that note
|
|
134
|
+
* @examplePrompt Add priya@studio.com to the comment about the lobby
|
|
135
|
+
* @examplePrompt Notify a teammate about an existing comment
|
|
136
|
+
*
|
|
137
|
+
* # Example
|
|
138
|
+
* ```ts
|
|
139
|
+
* const [comment] = await snaptrude.core.comment.list()
|
|
140
|
+
* await snaptrude.core.comment.tag(comment, "alex@acme.com")
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
public abstract tag(comment: CommentHandle, email: string): PluginApiReturn<boolean>
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Permanently remove a comment from the project.
|
|
147
|
+
*
|
|
148
|
+
* @param comment - The target comment.
|
|
149
|
+
*
|
|
150
|
+
* @examplePrompt Delete this comment
|
|
151
|
+
* @examplePrompt Remove the note about the old layout
|
|
152
|
+
* @examplePrompt Get rid of my last comment
|
|
153
|
+
* @examplePrompt Clear that resolved comment off the wall
|
|
154
|
+
*
|
|
155
|
+
* # Example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const [comment] = await snaptrude.core.comment.list()
|
|
158
|
+
* await snaptrude.core.comment.delete(comment)
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
public abstract delete(comment: CommentHandle): PluginApiReturn<boolean>
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* List every comment in the project (deleted ones are excluded), returned as
|
|
165
|
+
* comment handles you can pass to the other comment methods.
|
|
166
|
+
*
|
|
167
|
+
* @examplePrompt List all the comments in this project
|
|
168
|
+
* @examplePrompt How many comments are on this model?
|
|
169
|
+
* @examplePrompt Show every note in the file
|
|
170
|
+
* @examplePrompt Get all comments so I can check which are resolved
|
|
171
|
+
*
|
|
172
|
+
* # Example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const comments = await snaptrude.core.comment.list()
|
|
175
|
+
* console.log(`${comments.length} comments in the project`)
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
public abstract list(): PluginApiReturn<CommentHandle[]>
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Opaque handle to a comment — its server-assigned id (entity-style: a raw,
|
|
183
|
+
* persistable string resolved live, not a registry-minted value handle).
|
|
184
|
+
*/
|
|
185
|
+
export type CommentHandle = string & { readonly __handle: "comment" }
|
|
186
|
+
export const CommentHandle = z
|
|
187
|
+
.string()
|
|
188
|
+
.min(1)
|
|
189
|
+
.transform((s) => s as CommentHandle)
|
|
190
|
+
|
|
191
|
+
/** `ComponentHandle` is defined in `handles.ts` (imported above) and exported from the
|
|
192
|
+
* package root via `export * from "./handles"`. Not re-exported here to avoid an
|
|
193
|
+
* ambiguous double `export *` at the barrel. */
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Arguments for {@link PluginCommentApi.create}.
|
|
197
|
+
*
|
|
198
|
+
* | Property | Type | Description |
|
|
199
|
+
* |---|---|---|
|
|
200
|
+
* | `component` | {@link ComponentHandle}? | Component to anchor the comment to |
|
|
201
|
+
* | `position` | {@link Vec3Handle}? | Pin point; defaults to the component's center |
|
|
202
|
+
* | `message` | `string` | Comment text (emojis = unicode) |
|
|
203
|
+
* | `mentions` | `string[]`? | User emails to @mention |
|
|
204
|
+
*/
|
|
205
|
+
export const PluginCommentCreateArgs = z.object({
|
|
206
|
+
component: ComponentHandle.optional(),
|
|
207
|
+
position: Vec3Handle.optional(),
|
|
208
|
+
message: z.string(),
|
|
209
|
+
mentions: z.array(z.string()).optional(),
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
export type PluginCommentCreateArgs = z.infer<typeof PluginCommentCreateArgs>
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Arguments for {@link PluginCommentApi.update}.
|
|
216
|
+
*
|
|
217
|
+
* | Property | Type | Description |
|
|
218
|
+
* |---|---|---|
|
|
219
|
+
* | `comment` | {@link CommentHandle} | The comment to edit |
|
|
220
|
+
* | `message` | `string` | New message text |
|
|
221
|
+
* | `mentions` | `string[]`? | User emails to @mention |
|
|
222
|
+
*/
|
|
223
|
+
export const PluginCommentUpdateArgs = z.object({
|
|
224
|
+
comment: CommentHandle,
|
|
225
|
+
message: z.string(),
|
|
226
|
+
mentions: z.array(z.string()).optional(),
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
export type PluginCommentUpdateArgs = z.infer<typeof PluginCommentUpdateArgs>
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Arguments for {@link PluginCommentApi.resolve} / {@link PluginCommentApi.reopen}
|
|
233
|
+
* / {@link PluginCommentApi.isResolved} / {@link PluginCommentApi.delete}.
|
|
234
|
+
*
|
|
235
|
+
* | Property | Type | Description |
|
|
236
|
+
* |---|---|---|
|
|
237
|
+
* | `comment` | {@link CommentHandle} | The target comment |
|
|
238
|
+
*/
|
|
239
|
+
export const PluginCommentRefArgs = z.object({
|
|
240
|
+
comment: CommentHandle,
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
export type PluginCommentRefArgs = z.infer<typeof PluginCommentRefArgs>
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Arguments for {@link PluginCommentApi.tag}.
|
|
247
|
+
*
|
|
248
|
+
* | Property | Type | Description |
|
|
249
|
+
* |---|---|---|
|
|
250
|
+
* | `comment` | {@link CommentHandle} | The comment to add a mention to |
|
|
251
|
+
* | `email` | `string` | The user's email to @mention |
|
|
252
|
+
*/
|
|
253
|
+
export const PluginCommentTagArgs = z.object({
|
|
254
|
+
comment: CommentHandle,
|
|
255
|
+
email: z.string(),
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
export type PluginCommentTagArgs = z.infer<typeof PluginCommentTagArgs>
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../../types"
|
|
3
|
+
import { Vec3Handle, LineHandle, ArcHandle, CircleHandle, CurveHandle, ProfileHandle, ContourHandle } from "../../../../handles"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Curve creation — construct new geometric curves from point handles (all-handle
|
|
7
|
+
* model, §11).
|
|
8
|
+
*
|
|
9
|
+
* Each method takes point handles ({@linkcode Vec3Handle}) and returns an opaque
|
|
10
|
+
* curve handle ({@linkcode LineHandle} or {@linkcode ArcHandle}) that you pass to
|
|
11
|
+
* query, update, or entity-creation methods. Read geometry back as plain values
|
|
12
|
+
* via the `snaptrude.core.geom.query.*` methods.
|
|
13
|
+
*
|
|
14
|
+
* Accessed via `snaptrude.core.geom.create`.
|
|
15
|
+
*/
|
|
16
|
+
export abstract class PluginGeomCreateApi {
|
|
17
|
+
constructor() {}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a straight line segment between two point handles. Host API call —
|
|
21
|
+
* returns a handle.
|
|
22
|
+
*
|
|
23
|
+
* @param startPoint Start point of the line segment
|
|
24
|
+
* @param endPoint End point of the line segment
|
|
25
|
+
* @returns The new line as a {@linkcode LineHandle}
|
|
26
|
+
*
|
|
27
|
+
* @examplePrompt Draw a line from point A to point B
|
|
28
|
+
* @examplePrompt Draw a straight edge between these two points
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const line = snaptrude.core.geom.create.line(startPoint, endPoint)
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
public abstract line(startPoint: Vec3Handle, endPoint: Vec3Handle): PluginApiReturn<LineHandle>
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create a circular arc from its start, end, centre, and axis point handles.
|
|
39
|
+
* Host API call — returns a handle.
|
|
40
|
+
*
|
|
41
|
+
* @param startPoint Start point of the arc
|
|
42
|
+
* @param endPoint End point of the arc
|
|
43
|
+
* @param centrePoint Centre point of the arc
|
|
44
|
+
* @param axis Axis direction of the arc
|
|
45
|
+
* @returns The new arc as an {@linkcode ArcHandle}
|
|
46
|
+
*
|
|
47
|
+
* @examplePrompt Draw an arc between these two points around a centre
|
|
48
|
+
* @examplePrompt Add a curved segment from A to B
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const arc = snaptrude.core.geom.create.arc(startPoint, endPoint, centrePoint, axis)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
public abstract arc(
|
|
56
|
+
startPoint: Vec3Handle,
|
|
57
|
+
endPoint: Vec3Handle,
|
|
58
|
+
centrePoint: Vec3Handle,
|
|
59
|
+
axis: Vec3Handle,
|
|
60
|
+
): PluginApiReturn<ArcHandle>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Create a circle from a centre point, an axis (plane normal), and a radius.
|
|
64
|
+
* Host API call — returns a handle. A circle is a closed curve; read it back via
|
|
65
|
+
* `snaptrude.core.geom.query.circle.*`.
|
|
66
|
+
*
|
|
67
|
+
* @param centrePoint Centre point of the circle
|
|
68
|
+
* @param axis Axis direction (plane normal) of the circle
|
|
69
|
+
* @param radius Radius of the circle
|
|
70
|
+
* @returns The new circle as a {@linkcode CircleHandle}
|
|
71
|
+
*
|
|
72
|
+
* @examplePrompt Make a circle of radius 2 at this point
|
|
73
|
+
* @examplePrompt Draw a circular outline 5m across
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const circle = snaptrude.core.geom.create.circle(centrePoint, axis, 2)
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
public abstract circle(
|
|
81
|
+
centrePoint: Vec3Handle,
|
|
82
|
+
axis: Vec3Handle,
|
|
83
|
+
radius: number,
|
|
84
|
+
): PluginApiReturn<CircleHandle>
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Create a closed profile from an ordered list of point handles connected by
|
|
88
|
+
* line segments (last auto-connected to first). Host API call — returns a handle.
|
|
89
|
+
*
|
|
90
|
+
* @param points Ordered vertex handles of the profile
|
|
91
|
+
* @returns The new profile as a {@linkcode ProfileHandle}
|
|
92
|
+
*
|
|
93
|
+
* @examplePrompt Draw a closed polygon through these corner points
|
|
94
|
+
* @examplePrompt Create an L-shaped outline from a list of points
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const profile = snaptrude.core.geom.create.profileFromLinePoints(points)
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
public abstract profileFromLinePoints(points: Vec3Handle[]): PluginApiReturn<ProfileHandle>
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Create a profile from an ordered list of curve handles forming a closed loop.
|
|
105
|
+
* Host API call — returns a handle.
|
|
106
|
+
*
|
|
107
|
+
* @param curves Ordered curve handles forming a closed loop
|
|
108
|
+
* @returns The new profile as a {@linkcode ProfileHandle}
|
|
109
|
+
*
|
|
110
|
+
* @examplePrompt Join these lines and arcs into one closed shape
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* const profile = snaptrude.core.geom.create.profileFromCurves([line, arc])
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
public abstract profileFromCurves(curves: CurveHandle[]): PluginApiReturn<ProfileHandle>
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Create an axis-aligned **rectangle** profile (XZ plane) of `width` × `depth`,
|
|
121
|
+
* centred at `center` (defaults to the origin). Host API call — returns a handle.
|
|
122
|
+
*
|
|
123
|
+
* Pair with `design.create.space` / `design.create.spaces` to author a rectangular
|
|
124
|
+
* (box) space — there is no dedicated rectangular-space creator; build the profile
|
|
125
|
+
* here, then extrude it.
|
|
126
|
+
*
|
|
127
|
+
* @param width Extent along X
|
|
128
|
+
* @param depth Extent along Z
|
|
129
|
+
* @param center Optional centre point (default origin)
|
|
130
|
+
* @returns The new rectangle profile as a {@linkcode ProfileHandle}
|
|
131
|
+
*
|
|
132
|
+
* @examplePrompt Draw a 4m by 3m rectangle
|
|
133
|
+
* @examplePrompt Make a rectangular outline for a room footprint
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const rect = snaptrude.core.geom.create.profileRect(4, 3)
|
|
138
|
+
* const contour = snaptrude.core.geom.create.contourFromProfile(rect)
|
|
139
|
+
* const space = snaptrude.design.create.space(contour, 3)
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
public abstract profileRect(
|
|
143
|
+
width: number,
|
|
144
|
+
depth: number,
|
|
145
|
+
center?: Vec3Handle,
|
|
146
|
+
): PluginApiReturn<ProfileHandle>
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Create a contour (an outer profile loop, no holes). Host API call — returns a handle.
|
|
150
|
+
*
|
|
151
|
+
* @param outer The outer boundary loop
|
|
152
|
+
* @returns The new contour as a {@linkcode ContourHandle}
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* const contour = snaptrude.core.geom.create.contourFromProfile(outer)
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
public abstract contourFromProfile(outer: ProfileHandle): PluginApiReturn<ContourHandle>
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Create a contour from an outer profile plus zero or more inner profiles (holes).
|
|
162
|
+
* Host API call — returns a handle.
|
|
163
|
+
*
|
|
164
|
+
* @param outer The outer boundary loop
|
|
165
|
+
* @param holes Optional inner hole loops
|
|
166
|
+
* @returns The new contour as a {@linkcode ContourHandle}
|
|
167
|
+
*
|
|
168
|
+
* @examplePrompt Make a shape with a hole in the middle
|
|
169
|
+
* @examplePrompt Cut a courtyard opening out of this floor outline
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* const contour = snaptrude.core.geom.create.contourFromProfiles(outer, [hole])
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
public abstract contourFromProfiles(
|
|
177
|
+
outer: ProfileHandle,
|
|
178
|
+
holes?: ProfileHandle[],
|
|
179
|
+
): PluginApiReturn<ContourHandle>
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Arguments for {@linkcode PluginGeomCreateApi.line}.
|
|
184
|
+
*
|
|
185
|
+
* | Property | Type | Description |
|
|
186
|
+
* |---|---|---|
|
|
187
|
+
* | `startPoint` | {@linkcode Vec3Handle} | Start point of the line segment |
|
|
188
|
+
* | `endPoint` | {@linkcode Vec3Handle} | End point of the line segment |
|
|
189
|
+
*/
|
|
190
|
+
export const PluginGeomCreateLineArgs = z.object({
|
|
191
|
+
startPoint: Vec3Handle,
|
|
192
|
+
endPoint: Vec3Handle,
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
export type PluginGeomCreateLineArgs = z.infer<typeof PluginGeomCreateLineArgs>
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Arguments for {@linkcode PluginGeomCreateApi.arc}.
|
|
199
|
+
*
|
|
200
|
+
* | Property | Type | Description |
|
|
201
|
+
* |---|---|---|
|
|
202
|
+
* | `startPoint` | {@linkcode Vec3Handle} | Start point of the arc |
|
|
203
|
+
* | `endPoint` | {@linkcode Vec3Handle} | End point of the arc |
|
|
204
|
+
* | `centrePoint` | {@linkcode Vec3Handle} | Centre point of the arc |
|
|
205
|
+
* | `axis` | {@linkcode Vec3Handle} | Axis direction of the arc |
|
|
206
|
+
*/
|
|
207
|
+
export const PluginGeomCreateArcArgs = z.object({
|
|
208
|
+
startPoint: Vec3Handle,
|
|
209
|
+
endPoint: Vec3Handle,
|
|
210
|
+
centrePoint: Vec3Handle,
|
|
211
|
+
axis: Vec3Handle,
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
export type PluginGeomCreateArcArgs = z.infer<typeof PluginGeomCreateArcArgs>
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Arguments for {@linkcode PluginGeomCreateApi.circle}.
|
|
218
|
+
*
|
|
219
|
+
* | Property | Type | Description |
|
|
220
|
+
* |---|---|---|
|
|
221
|
+
* | `centrePoint` | {@linkcode Vec3Handle} | Centre point of the circle |
|
|
222
|
+
* | `axis` | {@linkcode Vec3Handle} | Axis direction (plane normal) of the circle |
|
|
223
|
+
* | `radius` | `number` | Radius of the circle |
|
|
224
|
+
*/
|
|
225
|
+
export const PluginGeomCreateCircleArgs = z.object({
|
|
226
|
+
centrePoint: Vec3Handle,
|
|
227
|
+
axis: Vec3Handle,
|
|
228
|
+
radius: z.number(),
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
export type PluginGeomCreateCircleArgs = z.infer<typeof PluginGeomCreateCircleArgs>
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Arguments for {@linkcode PluginGeomCreateApi.profileFromLinePoints}.
|
|
235
|
+
*
|
|
236
|
+
* | Property | Type | Description |
|
|
237
|
+
* |---|---|---|
|
|
238
|
+
* | `points` | {@linkcode Vec3Handle}`[]` | Ordered vertex handles of the profile |
|
|
239
|
+
*/
|
|
240
|
+
export const PluginGeomCreateProfileFromLinePointsArgs = z.object({
|
|
241
|
+
points: z.array(Vec3Handle),
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
export type PluginGeomCreateProfileFromLinePointsArgs = z.infer<
|
|
245
|
+
typeof PluginGeomCreateProfileFromLinePointsArgs
|
|
246
|
+
>
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Arguments for {@linkcode PluginGeomCreateApi.profileFromCurves}.
|
|
250
|
+
*
|
|
251
|
+
* | Property | Type | Description |
|
|
252
|
+
* |---|---|---|
|
|
253
|
+
* | `curves` | {@linkcode CurveHandle}`[]` | Ordered curve handles forming a closed loop |
|
|
254
|
+
*/
|
|
255
|
+
export const PluginGeomCreateProfileFromCurvesArgs = z.object({
|
|
256
|
+
curves: z.array(CurveHandle),
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
export type PluginGeomCreateProfileFromCurvesArgs = z.infer<
|
|
260
|
+
typeof PluginGeomCreateProfileFromCurvesArgs
|
|
261
|
+
>
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Arguments for {@linkcode PluginGeomCreateApi.contourFromProfile}.
|
|
265
|
+
*
|
|
266
|
+
* | Property | Type | Description |
|
|
267
|
+
* |---|---|---|
|
|
268
|
+
* | `outer` | {@linkcode ProfileHandle} | The outer boundary loop |
|
|
269
|
+
*/
|
|
270
|
+
export const PluginGeomCreateContourFromProfileArgs = z.object({
|
|
271
|
+
outer: ProfileHandle,
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
export type PluginGeomCreateContourFromProfileArgs = z.infer<
|
|
275
|
+
typeof PluginGeomCreateContourFromProfileArgs
|
|
276
|
+
>
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Arguments for {@linkcode PluginGeomCreateApi.contourFromProfiles}.
|
|
280
|
+
*
|
|
281
|
+
* | Property | Type | Description |
|
|
282
|
+
* |---|---|---|
|
|
283
|
+
* | `outer` | {@linkcode ProfileHandle} | The outer boundary loop |
|
|
284
|
+
* | `holes` | {@linkcode ProfileHandle}`[]` | Optional inner hole loops |
|
|
285
|
+
*/
|
|
286
|
+
export const PluginGeomCreateContourFromProfilesArgs = z.object({
|
|
287
|
+
outer: ProfileHandle,
|
|
288
|
+
holes: z.array(ProfileHandle).optional(),
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
export type PluginGeomCreateContourFromProfilesArgs = z.infer<
|
|
292
|
+
typeof PluginGeomCreateContourFromProfilesArgs
|
|
293
|
+
>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../../types"
|
|
3
|
+
import { ProfileHandle, ContourHandle } from "../../../../handles"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Geometry deletion — release transient geometry resource handles (all-handle model, §11).
|
|
7
|
+
*
|
|
8
|
+
* Methods here free a handle's backing registry entry and reclaim its share of the
|
|
9
|
+
* plugin's resource quota. This is purely a handle-lifecycle operation: it does NOT
|
|
10
|
+
* tear down or delete any engine-side geometry. Once released, the handle is no
|
|
11
|
+
* longer resolvable and must not be reused.
|
|
12
|
+
*
|
|
13
|
+
* Accessed via `snaptrude.core.geom.delete`.
|
|
14
|
+
*/
|
|
15
|
+
export abstract class PluginGeomDeleteApi {
|
|
16
|
+
constructor() {}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Free a transient profile resource handle — releases its registry entry and
|
|
20
|
+
* reclaims its share of the plugin's resource quota. This is a handle-lifecycle
|
|
21
|
+
* operation only and does NOT tear down any engine-side geometry.
|
|
22
|
+
*
|
|
23
|
+
* @param profile The transient profile handle to release
|
|
24
|
+
* @returns Nothing
|
|
25
|
+
*
|
|
26
|
+
* # Example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const rect = await snaptrude.core.geom.create.profileRect(4, 3)
|
|
29
|
+
* const area = await snaptrude.core.geom.query.profile.getArea(rect)
|
|
30
|
+
* await snaptrude.core.geom.delete.profile(rect) // rect is no longer resolvable
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
public abstract profile(profile: ProfileHandle): PluginApiReturn<void>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Free a transient contour resource handle — releases its registry entry and
|
|
37
|
+
* reclaims its share of the plugin's resource quota. Handle-lifecycle only; does
|
|
38
|
+
* NOT tear down engine-side geometry, nor the contour's child profile handles.
|
|
39
|
+
*
|
|
40
|
+
* @param contour The transient contour handle to release
|
|
41
|
+
* @returns Nothing
|
|
42
|
+
*
|
|
43
|
+
* # Example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const rect = await snaptrude.core.geom.create.profileRect(4, 3)
|
|
46
|
+
* const contour = await snaptrude.core.geom.create.contourFromProfile(rect)
|
|
47
|
+
* const area = await snaptrude.core.geom.query.contour.getArea(contour)
|
|
48
|
+
* await snaptrude.core.geom.delete.contour(contour) // contour freed; rect still valid
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
public abstract contour(contour: ContourHandle): PluginApiReturn<void>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Arguments for {@linkcode PluginGeomDeleteApi.profile}.
|
|
56
|
+
*
|
|
57
|
+
* | Property | Type | Description |
|
|
58
|
+
* |---|---|---|
|
|
59
|
+
* | `profile` | {@linkcode ProfileHandle} | The transient profile handle to release |
|
|
60
|
+
*/
|
|
61
|
+
export const PluginGeomDeleteProfileArgs = z.object({
|
|
62
|
+
profile: ProfileHandle,
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
export type PluginGeomDeleteProfileArgs = z.infer<typeof PluginGeomDeleteProfileArgs>
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Arguments for {@linkcode PluginGeomDeleteApi.contour}.
|
|
69
|
+
*
|
|
70
|
+
* | Property | Type | Description |
|
|
71
|
+
* |---|---|---|
|
|
72
|
+
* | `contour` | {@linkcode ContourHandle} | The transient contour handle to release |
|
|
73
|
+
*/
|
|
74
|
+
export const PluginGeomDeleteContourArgs = z.object({
|
|
75
|
+
contour: ContourHandle,
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
export type PluginGeomDeleteContourArgs = z.infer<typeof PluginGeomDeleteContourArgs>
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { PluginGeomCreateApi } from "./create"
|
|
2
|
+
import { PluginGeomQueryApi } from "./query"
|
|
3
|
+
import { PluginGeomUpdateApi } from "./update"
|
|
4
|
+
import { PluginGeomDeleteApi } from "./delete"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Geometry
|
|
7
|
+
* Geometry kernel — domain-free construction, query, editing, and disposal of
|
|
8
|
+
* curves (lines / arcs) and profiles. No BIM/AEC knowledge lives here; build
|
|
9
|
+
* geometry bottom-up: points ({@linkcode Vec3Handle}) → curves → profiles → entities.
|
|
10
|
+
*
|
|
11
|
+
* - {@linkcode PluginGeomApi.create} — construct lines, arcs, and profiles
|
|
12
|
+
* - {@linkcode PluginGeomApi.query} — read curve / arc / profile geometry and relationships
|
|
13
|
+
* - {@linkcode PluginGeomApi.update} — derive new curves / profiles (immutable edits)
|
|
14
|
+
* - {@linkcode PluginGeomApi.delete} — free a transient profile resource handle
|
|
8
15
|
*
|
|
9
|
-
* Build geometry bottom-up: points ({@linkcode PVec3}) → lines/arcs → curves → profiles.
|
|
10
16
|
* Profiles can then be used with entity creation methods like
|
|
11
17
|
* {@linkcode PluginSpaceApi.createFromProfile}.
|
|
12
|
-
*
|
|
13
|
-
* - {@linkcode PluginGeomApi.line} — Line segment construction
|
|
14
|
-
* - {@linkcode PluginGeomApi.arc} — Arc construction
|
|
15
|
-
* - {@linkcode PluginGeomApi.curve} — Unified curve wrapper (line or arc)
|
|
16
|
-
* - {@linkcode PluginGeomApi.profile} — Closed loop of curves
|
|
17
18
|
*/
|
|
18
19
|
export abstract class PluginGeomApi {
|
|
19
|
-
/**
|
|
20
|
-
public abstract
|
|
21
|
-
/**
|
|
22
|
-
public abstract
|
|
23
|
-
/**
|
|
24
|
-
public abstract
|
|
25
|
-
/**
|
|
26
|
-
public abstract
|
|
20
|
+
/** Curve and profile construction. See {@linkcode PluginGeomCreateApi}. */
|
|
21
|
+
public abstract create: PluginGeomCreateApi
|
|
22
|
+
/** Curve, arc, and profile queries. See {@linkcode PluginGeomQueryApi}. */
|
|
23
|
+
public abstract query: PluginGeomQueryApi
|
|
24
|
+
/** Curve and profile editing (derive-new). See {@linkcode PluginGeomUpdateApi}. */
|
|
25
|
+
public abstract update: PluginGeomUpdateApi
|
|
26
|
+
/** Resource-handle disposal (profile). See {@linkcode PluginGeomDeleteApi}. */
|
|
27
|
+
public abstract delete: PluginGeomDeleteApi
|
|
27
28
|
|
|
28
29
|
constructor() {}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./
|
|
33
|
-
export * from "./
|
|
34
|
-
export * from "./
|
|
32
|
+
export * from "./create"
|
|
33
|
+
export * from "./query"
|
|
34
|
+
export * from "./update"
|
|
35
|
+
export * from "./delete"
|