@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
package/src/handles.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An opaque, kind-tagged reference to a host-side object that crosses the RPC
|
|
5
|
+
* boundary by IDENTITY rather than by value. See `PLUGIN_API_EXPOSURE_HLD.md` §9.
|
|
6
|
+
*
|
|
7
|
+
* The phantom `__handle` brand makes a `Handle<"profile">` incompatible with a
|
|
8
|
+
* `Handle<"mass">` at compile time. At runtime a handle is just a string of the
|
|
9
|
+
* form `"<kind>_<token>"` (e.g. `"profile_k3f9a2x"`), so it is structured-clone
|
|
10
|
+
* safe and engine-free — plugin-core never imports the engine type it points at.
|
|
11
|
+
*/
|
|
12
|
+
export type Handle<K extends string> = string & { readonly __handle: K }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A scene-entity handle. Backed by the host `Component.id` and resolved live via
|
|
16
|
+
* the host scene index (StructureCollection) — never stored in the resource
|
|
17
|
+
* registry. Stable across undo/redo and persistable across sessions (§9.2).
|
|
18
|
+
*/
|
|
19
|
+
export type EntityId<K extends string = string> = Handle<K>
|
|
20
|
+
|
|
21
|
+
/** Resource handle: a host-resident, session-ephemeral geometry object (§9.2). */
|
|
22
|
+
export type ProfileHandle = Handle<"profile">
|
|
23
|
+
|
|
24
|
+
/** Resource handle: a host-resident contour (outer profile + hole profiles). */
|
|
25
|
+
export type ContourHandle = Handle<"contour">
|
|
26
|
+
|
|
27
|
+
/** Entity-handle example: a Mass / space scene object (Component.id). */
|
|
28
|
+
export type MassHandle = EntityId<"mass">
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A scene BIM entity (wall, space, slab, floor, …). Backed by `Component.id` and
|
|
32
|
+
* resolved live via the host scene index (StructureCollection) — never stored in
|
|
33
|
+
* the resource registry. Stable across undo/redo and persistable (§9.2). This is
|
|
34
|
+
* the canonical return handle for every `design.create.*` creator. The token is
|
|
35
|
+
* the raw `Component.id` — NO `"component_"` prefix, so it round-trips with the
|
|
36
|
+
* ids the host already hands out.
|
|
37
|
+
*/
|
|
38
|
+
export type ComponentHandle = EntityId<"component">
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A material handle. Like {@linkcode ComponentHandle}/`CommentHandle` this is an
|
|
42
|
+
* arena-free **entity-style** handle: the token IS the material's stable engine
|
|
43
|
+
* name (`Material.name`/`.id`), resolved live via `scene.getMaterialByName`
|
|
44
|
+
* host-side — no registry arena, no quota, no dispose, stable across undo/redo.
|
|
45
|
+
* Project-scoped, not a scene entity.
|
|
46
|
+
*/
|
|
47
|
+
export type MaterialHandle = EntityId<"material">
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A placed **scene underlay** — an imported reference plane the user traces over:
|
|
51
|
+
* an image `FloorPlan`, a `PDF` overlay, or a `CAD` sketch. Entity-style: the token
|
|
52
|
+
* IS the raw `Component.id` (`fp_…` / a pdf id / `cad_…`). Resolved live host-side
|
|
53
|
+
* via the import-order layer walk (`collectStoreyImportItems`) — NOT via
|
|
54
|
+
* `ComponentUtility.FindComponentById`, which does not index underlays. No arena, no
|
|
55
|
+
* quota, stable across undo/redo. Returned by `core.io.import.{image,pdf,cadJson}`
|
|
56
|
+
* and consumed by every `core.io.underlay.*` method.
|
|
57
|
+
*/
|
|
58
|
+
export type UnderlayHandle = EntityId<"underlay">
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The project's **site terrain** — a Mapbox-derived topography mesh. Entity-style
|
|
62
|
+
* and a project **singleton** (one terrain per project): the token is the terrain
|
|
63
|
+
* `Component.id` (`terrain-…`), resolved live via `TerrainOperations.getTerrain()`
|
|
64
|
+
* (absent from the level component collections, so NOT `FindComponentById`).
|
|
65
|
+
* Returned by `core.io.import.terrain`.
|
|
66
|
+
*/
|
|
67
|
+
export type TerrainHandle = EntityId<"terrain">
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A handle to an **asynchronous import job** (today: a DWG → Forge conversion, which
|
|
71
|
+
* can take minutes). Returned immediately by `core.io.import.dwg`; poll it via
|
|
72
|
+
* `core.io.job.*` (`getStatus` / `isComplete` / `getResult` / `getError`). The token
|
|
73
|
+
* is the engine's import request id; job state lives in a host-side registry.
|
|
74
|
+
*/
|
|
75
|
+
export type ImportJobHandle = EntityId<"importJob">
|
|
76
|
+
|
|
77
|
+
// ── Value-kind handles (all-handle model, §11) ──────────────────────────────
|
|
78
|
+
// Under the all-handle decision every structured type is a handle. The only
|
|
79
|
+
// non-handles crossing the boundary are JS primitives (number/string/boolean)
|
|
80
|
+
// and enums — the irreducible construction/read leaves. Value handles are
|
|
81
|
+
// immutable; math/geom operate on them via host RPC (no in-worker compute).
|
|
82
|
+
export type Vec3Handle = Handle<"vec3">
|
|
83
|
+
export type QuatHandle = Handle<"quat">
|
|
84
|
+
export type LineHandle = Handle<"line">
|
|
85
|
+
export type ArcHandle = Handle<"arc">
|
|
86
|
+
/** A curve is a line or an arc — its handle is one of those kinds. */
|
|
87
|
+
export type CurveHandle = LineHandle | ArcHandle
|
|
88
|
+
/**
|
|
89
|
+
* A circle value handle. A circle is a CLOSED curve — it deliberately does NOT
|
|
90
|
+
* join {@linkcode CurveHandle} (it has no stable start/end and would break the
|
|
91
|
+
* shared curve read contract), so it carries its own kind and its own
|
|
92
|
+
* `core.geom.query.circle` namespace (mirroring `query.arc`).
|
|
93
|
+
*/
|
|
94
|
+
export type CircleHandle = Handle<"circle">
|
|
95
|
+
|
|
96
|
+
// ── BREP topology handles (geometry-kernel resource family, §2A.2.1) ─────────
|
|
97
|
+
// Session-ephemeral, identity-deduped RESOURCE handles for the boundary-
|
|
98
|
+
// representation topology graph. Read-only via `core.geom.query.{brep,face,edge,
|
|
99
|
+
// halfedge,vertex}`; they go stale on undo/redo/re-topologize. Obtain a brep via
|
|
100
|
+
// `design.query.geometry.getBrep`; every other topology handle is minted by
|
|
101
|
+
// walking from a brep/face/edge/vertex handle already resolved off that brep.
|
|
102
|
+
export type BrepHandle = Handle<"brep">
|
|
103
|
+
export type FaceHandle = Handle<"face">
|
|
104
|
+
export type EdgeHandle = Handle<"edge">
|
|
105
|
+
/** Half-edge kind token is all-lowercase `"halfedge"` per §6.1 (no camelCase namespaces). */
|
|
106
|
+
export type HalfEdgeHandle = Handle<"halfedge">
|
|
107
|
+
export type VertexHandle = Handle<"vertex">
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Bare primitive records — how value-handle reads return their components
|
|
111
|
+
* (§11.4). Curves have **no** by-value record: a curve crosses the boundary as a
|
|
112
|
+
* {@linkcode CurveHandle} (line/arc), and its coordinates are read via the
|
|
113
|
+
* `core.geom.query.curve` API. There is no `CurveData` under the all-handle model.
|
|
114
|
+
*/
|
|
115
|
+
export type Vec3Components = { x: number; y: number; z: number }
|
|
116
|
+
export type QuatComponents = { x: number; y: number; z: number; w: number }
|
|
117
|
+
/** Axis-aligned bounding box, read as two primitive corner records. */
|
|
118
|
+
export type BBoxComponents = { min: Vec3Components; max: Vec3Components }
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Build a Zod schema validating a handle of the given `kind` at the trust
|
|
122
|
+
* boundary. It checks only the `"<kind>_"` prefix shape; existence, kind, and
|
|
123
|
+
* ownership are enforced host-side by the HandleRegistry (§9.7). Keeping it to
|
|
124
|
+
* the prefix is engine-free and avoids an existence oracle.
|
|
125
|
+
*/
|
|
126
|
+
export const handleSchema = <K extends string>(kind: K) =>
|
|
127
|
+
z
|
|
128
|
+
.string()
|
|
129
|
+
.regex(new RegExp(`^${kind}_[A-Za-z0-9_-]+$`), `expected a "${kind}" handle`)
|
|
130
|
+
.transform((s) => s as Handle<K>)
|
|
131
|
+
|
|
132
|
+
export const ProfileHandle = handleSchema("profile")
|
|
133
|
+
export const ContourHandle = handleSchema("contour")
|
|
134
|
+
export const MassHandle = handleSchema("mass")
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Entity handles are raw `Component.id` strings (no `"<kind>_"` prefix) — validated
|
|
138
|
+
* only as a non-empty string, resolved live via the scene index host-side.
|
|
139
|
+
*/
|
|
140
|
+
export const ComponentHandle = z
|
|
141
|
+
.string()
|
|
142
|
+
.min(1)
|
|
143
|
+
.transform((s) => s as ComponentHandle)
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Material handles are the raw `Material.name` string (entity-style, no `"<kind>_"`
|
|
147
|
+
* prefix) — validated only as non-empty, resolved live via `scene.getMaterialByName`.
|
|
148
|
+
*/
|
|
149
|
+
export const MaterialHandle = z
|
|
150
|
+
.string()
|
|
151
|
+
.min(1)
|
|
152
|
+
.transform((s) => s as MaterialHandle)
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* {@linkcode UnderlayHandle} / {@linkcode TerrainHandle} / {@linkcode ImportJobHandle}
|
|
156
|
+
* are entity-style handles — raw host ids, validated only as a non-empty string
|
|
157
|
+
* (no `"<kind>_"` prefix), resolved live host-side (existence enforced there).
|
|
158
|
+
*/
|
|
159
|
+
export const UnderlayHandle = z
|
|
160
|
+
.string()
|
|
161
|
+
.min(1)
|
|
162
|
+
.transform((s) => s as UnderlayHandle)
|
|
163
|
+
export const TerrainHandle = z
|
|
164
|
+
.string()
|
|
165
|
+
.min(1)
|
|
166
|
+
.transform((s) => s as TerrainHandle)
|
|
167
|
+
export const ImportJobHandle = z
|
|
168
|
+
.string()
|
|
169
|
+
.min(1)
|
|
170
|
+
.transform((s) => s as ImportJobHandle)
|
|
171
|
+
|
|
172
|
+
// Value-kind handle schemas (all-handle model, §11).
|
|
173
|
+
export const Vec3Handle = handleSchema("vec3")
|
|
174
|
+
export const QuatHandle = handleSchema("quat")
|
|
175
|
+
export const LineHandle = handleSchema("line")
|
|
176
|
+
export const ArcHandle = handleSchema("arc")
|
|
177
|
+
export const CurveHandle = z.union([LineHandle, ArcHandle])
|
|
178
|
+
export const CircleHandle = handleSchema("circle")
|
|
179
|
+
|
|
180
|
+
// BREP topology handle schemas (§2A.2.1). Prefix-shape validation only; existence,
|
|
181
|
+
// kind, and ownership are enforced host-side by the HandleRegistry topology arena.
|
|
182
|
+
export const BrepHandle = handleSchema("brep")
|
|
183
|
+
export const FaceHandle = handleSchema("face")
|
|
184
|
+
export const EdgeHandle = handleSchema("edge")
|
|
185
|
+
export const HalfEdgeHandle = handleSchema("halfedge")
|
|
186
|
+
export const VertexHandle = handleSchema("vertex")
|
|
187
|
+
export const Vec3Components = z.object({ x: z.number(), y: z.number(), z: z.number() })
|
|
188
|
+
export const QuatComponents = z.object({
|
|
189
|
+
x: z.number(),
|
|
190
|
+
y: z.number(),
|
|
191
|
+
z: z.number(),
|
|
192
|
+
w: z.number(),
|
|
193
|
+
})
|
|
194
|
+
export const BBoxComponents = z.object({ min: Vec3Components, max: Vec3Components })
|
package/src/host-utils.ts
CHANGED
|
@@ -13,8 +13,11 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
|
13
13
|
|
|
14
14
|
type Flatten<T> = { [K in keyof T]: T[K] }
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The full parameter tuple of a method — the positional-args transport forwards
|
|
18
|
+
* the whole argument list (`[]` for no-arg methods).
|
|
19
|
+
*/
|
|
20
|
+
type MethodArgs<F extends (...args: any[]) => any> = Parameters<F>
|
|
18
21
|
|
|
19
22
|
type MethodReturn<F extends (...args: any[]) => any> = Awaited<ReturnType<F>>
|
|
20
23
|
|
|
@@ -45,10 +48,11 @@ export type PluginApiMethodMap = Flatten<
|
|
|
45
48
|
|
|
46
49
|
export type PluginApiMethod = keyof PluginApiMethodMap
|
|
47
50
|
|
|
48
|
-
export type PluginApiCallPayload<M extends PluginApiMethod = PluginApiMethod> =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
export type PluginApiCallPayload<M extends PluginApiMethod = PluginApiMethod> = {
|
|
52
|
+
method: M
|
|
53
|
+
/** Positional argument tuple, spread back into the method host-side. */
|
|
54
|
+
args: PluginApiMethodMap[M]["args"]
|
|
55
|
+
}
|
|
52
56
|
|
|
53
57
|
export type PluginApiCallResult<M extends PluginApiMethod> =
|
|
54
58
|
PluginApiMethodMap[M]["return"]
|
package/src/index.ts
CHANGED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { PVec3 } from "../math/vec3";
|
|
3
|
-
/**
|
|
4
|
-
* Arc construction.
|
|
5
|
-
*
|
|
6
|
-
* A {@linkcode PArc} represents a circular arc in 3D space, defined by
|
|
7
|
-
* start/end points, a centre, and a rotation axis. Arcs can be wrapped
|
|
8
|
-
* as a {@linkcode PCurve} and combined into a {@linkcode PProfile}.
|
|
9
|
-
*
|
|
10
|
-
* Accessed via `snaptrude.core.geom.arc`.
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class PluginArcApi {
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Create a new arc from start, end, centre, and axis.
|
|
16
|
-
*
|
|
17
|
-
* The arc sweeps from {@linkcode startPoint} to {@linkcode endPoint}
|
|
18
|
-
* along the circle centred at {@linkcode centrePoint}, in the
|
|
19
|
-
* direction determined by the right-hand rule around {@linkcode axis}.
|
|
20
|
-
*
|
|
21
|
-
* @param startPoint - The start point as a {@linkcode PVec3}
|
|
22
|
-
* @param endPoint - The end point as a {@linkcode PVec3}
|
|
23
|
-
* @param centrePoint - The centre of the arc's circle as a {@linkcode PVec3}
|
|
24
|
-
* @param axis - The arc's rotation axis as a {@linkcode PVec3}
|
|
25
|
-
* (perpendicular to the arc's plane)
|
|
26
|
-
* @returns A new {@linkcode PArc}
|
|
27
|
-
*
|
|
28
|
-
* # Example
|
|
29
|
-
* ```ts
|
|
30
|
-
* const { vec3 } = snaptrude.core.math
|
|
31
|
-
* const { arc } = snaptrude.core.geom
|
|
32
|
-
*
|
|
33
|
-
* // Quarter-circle arc on the XZ plane
|
|
34
|
-
* const a = arc.new(
|
|
35
|
-
* vec3.new(1, 0, 0), // start
|
|
36
|
-
* vec3.new(0, 0, 1), // end
|
|
37
|
-
* vec3.new(0, 0, 0), // centre
|
|
38
|
-
* vec3.new(0, 1, 0), // Y-up axis
|
|
39
|
-
* )
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
new(startPoint: PVec3, endPoint: PVec3, centrePoint: PVec3, axis: PVec3): PArc;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* A circular arc defined by start, end, centre, and axis.
|
|
46
|
-
*
|
|
47
|
-
* Discriminated by `curveType: "Arc"` within the {@linkcode PCurve} union.
|
|
48
|
-
*
|
|
49
|
-
* | Property | Type | Description |
|
|
50
|
-
* |---|---|---|
|
|
51
|
-
* | `curveType` | `"Arc"` | Discriminator tag |
|
|
52
|
-
* | `startPoint` | {@linkcode PVec3} | Start point of the arc |
|
|
53
|
-
* | `endPoint` | {@linkcode PVec3} | End point of the arc |
|
|
54
|
-
* | `centrePoint` | {@linkcode PVec3} | Centre of the arc's circle |
|
|
55
|
-
* | `axis` | {@linkcode PVec3} | Rotation axis (normal to the arc's plane) |
|
|
56
|
-
*/
|
|
57
|
-
export declare const PArc: z.ZodObject<{
|
|
58
|
-
curveType: z.ZodLiteral<"Arc">;
|
|
59
|
-
startPoint: z.ZodObject<{
|
|
60
|
-
x: z.ZodNumber;
|
|
61
|
-
y: z.ZodNumber;
|
|
62
|
-
z: z.ZodNumber;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
endPoint: z.ZodObject<{
|
|
65
|
-
x: z.ZodNumber;
|
|
66
|
-
y: z.ZodNumber;
|
|
67
|
-
z: z.ZodNumber;
|
|
68
|
-
}, z.core.$strip>;
|
|
69
|
-
centrePoint: z.ZodObject<{
|
|
70
|
-
x: z.ZodNumber;
|
|
71
|
-
y: z.ZodNumber;
|
|
72
|
-
z: z.ZodNumber;
|
|
73
|
-
}, z.core.$strip>;
|
|
74
|
-
axis: z.ZodObject<{
|
|
75
|
-
x: z.ZodNumber;
|
|
76
|
-
y: z.ZodNumber;
|
|
77
|
-
z: z.ZodNumber;
|
|
78
|
-
}, z.core.$strip>;
|
|
79
|
-
}, z.core.$strip>;
|
|
80
|
-
export type PArc = z.infer<typeof PArc>;
|
|
81
|
-
//# sourceMappingURL=arc.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/arc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEpC;;;;;;;;GAQG;AACH,8BAAsB,YAAY;;IAGhC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;CAG/E;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;iBAMf,CAAA;AAEF,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAA"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { PLine } from "./line";
|
|
3
|
-
import { PArc } from "./arc";
|
|
4
|
-
/**
|
|
5
|
-
* Unified curve wrapper — either a {@linkcode PLine} or a {@linkcode PArc}.
|
|
6
|
-
*
|
|
7
|
-
* Use this to build heterogeneous curve lists (mixing lines and arcs)
|
|
8
|
-
* when constructing a {@linkcode PProfile}.
|
|
9
|
-
*
|
|
10
|
-
* Accessed via `snaptrude.core.geom.curve`.
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class PluginCurveApi {
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Wrap a {@linkcode PLine} or {@linkcode PArc} as a {@linkcode PCurve}.
|
|
16
|
-
*
|
|
17
|
-
* This is an identity operation — it simply returns the input unchanged.
|
|
18
|
-
* It exists for type-level clarity when building mixed curve lists.
|
|
19
|
-
*
|
|
20
|
-
* @param curve - A {@linkcode PLine} or {@linkcode PArc} to wrap
|
|
21
|
-
* @returns The same value typed as {@linkcode PCurve}
|
|
22
|
-
*/
|
|
23
|
-
new(curve: PLine | PArc): PCurve;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* A discriminated union of {@linkcode PLine} and {@linkcode PArc}.
|
|
27
|
-
*
|
|
28
|
-
* Discriminated on the `curveType` field:
|
|
29
|
-
* - `"Line"` → {@linkcode PLine}
|
|
30
|
-
* - `"Arc"` → {@linkcode PArc}
|
|
31
|
-
*
|
|
32
|
-
* Use `curve.curveType` to narrow the type in a switch or if-statement.
|
|
33
|
-
*/
|
|
34
|
-
export declare const PCurve: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
35
|
-
curveType: z.ZodLiteral<"Line">;
|
|
36
|
-
startPoint: z.ZodObject<{
|
|
37
|
-
x: z.ZodNumber;
|
|
38
|
-
y: z.ZodNumber;
|
|
39
|
-
z: z.ZodNumber;
|
|
40
|
-
}, z.core.$strip>;
|
|
41
|
-
endPoint: z.ZodObject<{
|
|
42
|
-
x: z.ZodNumber;
|
|
43
|
-
y: z.ZodNumber;
|
|
44
|
-
z: z.ZodNumber;
|
|
45
|
-
}, z.core.$strip>;
|
|
46
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
-
curveType: z.ZodLiteral<"Arc">;
|
|
48
|
-
startPoint: z.ZodObject<{
|
|
49
|
-
x: z.ZodNumber;
|
|
50
|
-
y: z.ZodNumber;
|
|
51
|
-
z: z.ZodNumber;
|
|
52
|
-
}, z.core.$strip>;
|
|
53
|
-
endPoint: z.ZodObject<{
|
|
54
|
-
x: z.ZodNumber;
|
|
55
|
-
y: z.ZodNumber;
|
|
56
|
-
z: z.ZodNumber;
|
|
57
|
-
}, z.core.$strip>;
|
|
58
|
-
centrePoint: z.ZodObject<{
|
|
59
|
-
x: z.ZodNumber;
|
|
60
|
-
y: z.ZodNumber;
|
|
61
|
-
z: z.ZodNumber;
|
|
62
|
-
}, z.core.$strip>;
|
|
63
|
-
axis: z.ZodObject<{
|
|
64
|
-
x: z.ZodNumber;
|
|
65
|
-
y: z.ZodNumber;
|
|
66
|
-
z: z.ZodNumber;
|
|
67
|
-
}, z.core.$strip>;
|
|
68
|
-
}, z.core.$strip>], "curveType">;
|
|
69
|
-
export type PCurve = z.infer<typeof PCurve>;
|
|
70
|
-
//# sourceMappingURL=curve.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"curve.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/curve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAE5B;;;;;;;GAOG;AACH,8BAAsB,cAAc;;IAGlC;;;;;;;;OAQG;IACH,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,MAAM;CAGjC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAmD,CAAA;AAEtE,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAA"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { PVec3 } from "../math/vec3";
|
|
3
|
-
/**
|
|
4
|
-
* Line segment construction.
|
|
5
|
-
*
|
|
6
|
-
* A {@linkcode PLine} is the simplest curve primitive — a straight
|
|
7
|
-
* segment between two 3D points. Lines can be wrapped as a
|
|
8
|
-
* {@linkcode PCurve} and combined into a {@linkcode PProfile}.
|
|
9
|
-
*
|
|
10
|
-
* Accessed via `snaptrude.core.geom.line`.
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class PluginLineApi {
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Create a new line segment between two points.
|
|
16
|
-
*
|
|
17
|
-
* @param startPoint - The start point as a {@linkcode PVec3}
|
|
18
|
-
* @param endPoint - The end point as a {@linkcode PVec3}
|
|
19
|
-
* @returns A new {@linkcode PLine}
|
|
20
|
-
*
|
|
21
|
-
* # Example
|
|
22
|
-
* ```ts
|
|
23
|
-
* const { vec3 } = snaptrude.core.math
|
|
24
|
-
* const { line } = snaptrude.core.geom
|
|
25
|
-
*
|
|
26
|
-
* const edge = line.new(vec3.new(0, 0, 0), vec3.new(5, 0, 0))
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
new(startPoint: PVec3, endPoint: PVec3): PLine;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* A line segment defined by a start and end point.
|
|
33
|
-
*
|
|
34
|
-
* Discriminated by `curveType: "Line"` within the {@linkcode PCurve} union.
|
|
35
|
-
*
|
|
36
|
-
* | Property | Type | Description |
|
|
37
|
-
* |---|---|---|
|
|
38
|
-
* | `curveType` | `"Line"` | Discriminator tag |
|
|
39
|
-
* | `startPoint` | {@linkcode PVec3} | Start point of the segment |
|
|
40
|
-
* | `endPoint` | {@linkcode PVec3} | End point of the segment |
|
|
41
|
-
*/
|
|
42
|
-
export declare const PLine: z.ZodObject<{
|
|
43
|
-
curveType: z.ZodLiteral<"Line">;
|
|
44
|
-
startPoint: z.ZodObject<{
|
|
45
|
-
x: z.ZodNumber;
|
|
46
|
-
y: z.ZodNumber;
|
|
47
|
-
z: z.ZodNumber;
|
|
48
|
-
}, z.core.$strip>;
|
|
49
|
-
endPoint: z.ZodObject<{
|
|
50
|
-
x: z.ZodNumber;
|
|
51
|
-
y: z.ZodNumber;
|
|
52
|
-
z: z.ZodNumber;
|
|
53
|
-
}, z.core.$strip>;
|
|
54
|
-
}, z.core.$strip>;
|
|
55
|
-
export type PLine = z.infer<typeof PLine>;
|
|
56
|
-
//# sourceMappingURL=line.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEpC;;;;;;;;GAQG;AACH,8BAAsB,aAAa;;IAGjC;;;;;;;;;;;;;;OAcG;IACH,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,GAAG,KAAK;CAG/C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;iBAIhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAA"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { PluginApiReturn } from "../../../types";
|
|
3
|
-
import { PCurve } from "./curve";
|
|
4
|
-
/**
|
|
5
|
-
* Profile construction — a closed loop of {@linkcode PCurve}s.
|
|
6
|
-
*
|
|
7
|
-
* Profiles are the primary 2D shape primitive used for creating
|
|
8
|
-
* extruded entities like spaces. Build profiles either from an
|
|
9
|
-
* explicit list of curves or from a list of points (auto-connected
|
|
10
|
-
* with line segments).
|
|
11
|
-
*
|
|
12
|
-
* Accessed via `snaptrude.core.geom.profile`.
|
|
13
|
-
*/
|
|
14
|
-
export declare abstract class PluginProfileApi {
|
|
15
|
-
constructor();
|
|
16
|
-
/**
|
|
17
|
-
* Create a profile from an ordered list of curves.
|
|
18
|
-
*
|
|
19
|
-
* The curves should form a closed loop — the end point of each curve
|
|
20
|
-
* should coincide with the start point of the next.
|
|
21
|
-
*
|
|
22
|
-
* @param curves - An ordered array of {@linkcode PCurve}s forming a closed loop
|
|
23
|
-
* @returns A new {@linkcode PProfile}
|
|
24
|
-
*/
|
|
25
|
-
new(curves: PCurve[]): PProfile;
|
|
26
|
-
/**
|
|
27
|
-
* Create a profile by connecting a list of points with line segments.
|
|
28
|
-
*
|
|
29
|
-
* The points are connected in order, with the last point automatically
|
|
30
|
-
* connected back to the first to close the loop.
|
|
31
|
-
*
|
|
32
|
-
* This is a **host API call** — it returns a `Promise`.
|
|
33
|
-
*
|
|
34
|
-
* @param args - An object containing:
|
|
35
|
-
* - {@linkcode PluginProfileFromLinePointsArgs.points args.points} — An ordered
|
|
36
|
-
* array of {@linkcode PVec3} forming the profile vertices
|
|
37
|
-
* @returns A {@linkcode PProfile} with line-segment curves connecting the points
|
|
38
|
-
*
|
|
39
|
-
* # Example
|
|
40
|
-
* ```ts
|
|
41
|
-
* const { vec3 } = snaptrude.core.math
|
|
42
|
-
*
|
|
43
|
-
* // Create an L-shaped profile
|
|
44
|
-
* const profile = await snaptrude.core.geom.profile.fromLinePoints({
|
|
45
|
-
* points: [
|
|
46
|
-
* vec3.new(0, 0, 0),
|
|
47
|
-
* vec3.new(10, 0, 0),
|
|
48
|
-
* vec3.new(10, 0, 5),
|
|
49
|
-
* vec3.new(5, 0, 5),
|
|
50
|
-
* vec3.new(5, 0, 10),
|
|
51
|
-
* vec3.new(0, 0, 10),
|
|
52
|
-
* ],
|
|
53
|
-
* })
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
abstract fromLinePoints(args: PluginProfileFromLinePointsArgs): PluginApiReturn<PProfile>;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Arguments for {@linkcode PluginProfileApi.fromLinePoints}.
|
|
60
|
-
*
|
|
61
|
-
* | Property | Type | Description |
|
|
62
|
-
* |---|---|---|
|
|
63
|
-
* | `points` | {@linkcode PVec3}`[]` | Ordered vertices of the profile |
|
|
64
|
-
*/
|
|
65
|
-
export declare const PluginProfileFromLinePointsArgs: z.ZodObject<{
|
|
66
|
-
points: z.ZodArray<z.ZodObject<{
|
|
67
|
-
x: z.ZodNumber;
|
|
68
|
-
y: z.ZodNumber;
|
|
69
|
-
z: z.ZodNumber;
|
|
70
|
-
}, z.core.$strip>>;
|
|
71
|
-
}, z.core.$strip>;
|
|
72
|
-
export type PluginProfileFromLinePointsArgs = z.infer<typeof PluginProfileFromLinePointsArgs>;
|
|
73
|
-
/**
|
|
74
|
-
* A closed profile composed of an ordered list of curves.
|
|
75
|
-
*
|
|
76
|
-
* Profiles are used as input to entity creation methods like
|
|
77
|
-
* {@linkcode PluginSpaceApi.createFromProfile}.
|
|
78
|
-
*
|
|
79
|
-
* | Property | Type | Description |
|
|
80
|
-
* |---|---|---|
|
|
81
|
-
* | `curves` | {@linkcode PCurve}`[]` | Ordered curves forming a closed loop |
|
|
82
|
-
*/
|
|
83
|
-
export declare const PProfile: z.ZodObject<{
|
|
84
|
-
curves: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
|
-
curveType: z.ZodLiteral<"Line">;
|
|
86
|
-
startPoint: z.ZodObject<{
|
|
87
|
-
x: z.ZodNumber;
|
|
88
|
-
y: z.ZodNumber;
|
|
89
|
-
z: z.ZodNumber;
|
|
90
|
-
}, z.core.$strip>;
|
|
91
|
-
endPoint: z.ZodObject<{
|
|
92
|
-
x: z.ZodNumber;
|
|
93
|
-
y: z.ZodNumber;
|
|
94
|
-
z: z.ZodNumber;
|
|
95
|
-
}, z.core.$strip>;
|
|
96
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
-
curveType: z.ZodLiteral<"Arc">;
|
|
98
|
-
startPoint: z.ZodObject<{
|
|
99
|
-
x: z.ZodNumber;
|
|
100
|
-
y: z.ZodNumber;
|
|
101
|
-
z: z.ZodNumber;
|
|
102
|
-
}, z.core.$strip>;
|
|
103
|
-
endPoint: z.ZodObject<{
|
|
104
|
-
x: z.ZodNumber;
|
|
105
|
-
y: z.ZodNumber;
|
|
106
|
-
z: z.ZodNumber;
|
|
107
|
-
}, z.core.$strip>;
|
|
108
|
-
centrePoint: z.ZodObject<{
|
|
109
|
-
x: z.ZodNumber;
|
|
110
|
-
y: z.ZodNumber;
|
|
111
|
-
z: z.ZodNumber;
|
|
112
|
-
}, z.core.$strip>;
|
|
113
|
-
axis: z.ZodObject<{
|
|
114
|
-
x: z.ZodNumber;
|
|
115
|
-
y: z.ZodNumber;
|
|
116
|
-
z: z.ZodNumber;
|
|
117
|
-
}, z.core.$strip>;
|
|
118
|
-
}, z.core.$strip>], "curveType">>;
|
|
119
|
-
}, z.core.$strip>;
|
|
120
|
-
export type PProfile = z.infer<typeof PProfile>;
|
|
121
|
-
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/api/core/geom/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC;;;;;;;;;GASG;AACH,8BAAsB,gBAAgB;;IAGpC;;;;;;;;OAQG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ;IAI/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;aACa,cAAc,CAC5B,IAAI,EAAE,+BAA+B,GACpC,eAAe,CAAC,QAAQ,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B;;;;;;iBAE1C,CAAA;AAEF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEnB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAA"}
|
package/dist/api/tools/copy.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import type { ComponentId } from "../../types";
|
|
3
|
-
/**
|
|
4
|
-
* Copy mode for `snaptrude.tools.copy`.
|
|
5
|
-
*
|
|
6
|
-
* | Value | Description |
|
|
7
|
-
* |---|---|
|
|
8
|
-
* | `"instance"` | Create instanced copies where possible |
|
|
9
|
-
* | `"unique"` | Create independent geometry copies |
|
|
10
|
-
*/
|
|
11
|
-
export declare const PluginCopyMode: z.ZodEnum<{
|
|
12
|
-
instance: "instance";
|
|
13
|
-
unique: "unique";
|
|
14
|
-
}>;
|
|
15
|
-
export type PluginCopyMode = z.infer<typeof PluginCopyMode>;
|
|
16
|
-
/**
|
|
17
|
-
* Arguments for `snaptrude.tools.copy`.
|
|
18
|
-
*
|
|
19
|
-
* Creates one or more copies for each component in `componentIds`. Copy `i` is
|
|
20
|
-
* offset by `displacement * i`, where `i` starts at `1`. Source positions are
|
|
21
|
-
* preserved. In `"instance"` mode, a unique source mesh can be replaced by an
|
|
22
|
-
* instance at the same position so the source and copied objects remain in the
|
|
23
|
-
* same instance family. The created copy stack becomes the active editor
|
|
24
|
-
* selection, matching the native paste workflow.
|
|
25
|
-
*
|
|
26
|
-
* | Property | Type | Description |
|
|
27
|
-
* |---|---|---|
|
|
28
|
-
* | `componentIds` | `string[]` | Component IDs to copy |
|
|
29
|
-
* | `displacement` | {@linkcode PVec3} | Offset applied to each copy in Babylon units |
|
|
30
|
-
* | `count` | `number` | Number of copies per component. Defaults to `1` |
|
|
31
|
-
* | `copyMode` | {@linkcode PluginCopyMode} | `"instance"` or `"unique"`. Defaults to `"instance"` |
|
|
32
|
-
*/
|
|
33
|
-
export declare const PluginCopyArgs: z.ZodObject<{
|
|
34
|
-
componentIds: z.ZodArray<z.ZodString>;
|
|
35
|
-
displacement: z.ZodObject<{
|
|
36
|
-
x: z.ZodNumber;
|
|
37
|
-
y: z.ZodNumber;
|
|
38
|
-
z: z.ZodNumber;
|
|
39
|
-
}, z.core.$strip>;
|
|
40
|
-
count: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
copyMode: z.ZodOptional<z.ZodEnum<{
|
|
42
|
-
instance: "instance";
|
|
43
|
-
unique: "unique";
|
|
44
|
-
}>>;
|
|
45
|
-
}, z.core.$strip>;
|
|
46
|
-
export type PluginCopyArgs = z.infer<typeof PluginCopyArgs>;
|
|
47
|
-
/**
|
|
48
|
-
* Result of `snaptrude.tools.copy`.
|
|
49
|
-
*
|
|
50
|
-
* Returned IDs are Snaptrude component IDs for the newly created copies, not
|
|
51
|
-
* Babylon mesh IDs.
|
|
52
|
-
*/
|
|
53
|
-
export declare const PluginCopyResult: z.ZodObject<{
|
|
54
|
-
copiedIds: z.ZodArray<z.ZodString>;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
export type PluginCopyResult = {
|
|
57
|
-
copiedIds: ComponentId[];
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=copy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../src/api/tools/copy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;EAAiC,CAAA;AAE5D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;iBAKzB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,WAAW,EAAE,CAAA;CACzB,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { PluginMaterialApi } from "./material";
|
|
2
|
-
import { PluginSelectionApi } from "./selection";
|
|
3
|
-
import { PluginTransformApi } from "./transform";
|
|
4
|
-
import type { PluginApiReturn } from "../../types";
|
|
5
|
-
import type { PluginCopyArgs, PluginCopyResult } from "./copy";
|
|
6
|
-
import type { PluginOffsetArgs, PluginOffsetResult } from "./offset";
|
|
7
|
-
/**
|
|
8
|
-
* Snaptrude editor tools for querying and manipulating scene components.
|
|
9
|
-
*
|
|
10
|
-
* - {@linkcode PluginToolsApi.selection} — Query the current user selection
|
|
11
|
-
* - {@linkcode PluginToolsApi.transform} — Move and rotate components
|
|
12
|
-
* - {@linkcode PluginToolsApi.copy} — Copy components
|
|
13
|
-
* - {@linkcode PluginToolsApi.offset} — Offset or split component profiles
|
|
14
|
-
*/
|
|
15
|
-
export declare abstract class PluginToolsApi {
|
|
16
|
-
/** Query the current selection. See {@linkcode PluginSelectionApi}. */
|
|
17
|
-
abstract selection: PluginSelectionApi;
|
|
18
|
-
/** Move and rotate components. See {@linkcode PluginTransformApi}. */
|
|
19
|
-
abstract transform: PluginTransformApi;
|
|
20
|
-
/** Apply materials to the current user selection in the Snaptrude editor or passed component ids if any. See {@linkcode PluginMaterialApi}. */
|
|
21
|
-
abstract material: PluginMaterialApi;
|
|
22
|
-
/** Copy components by ID. See {@linkcode PluginCopyArgs}. */
|
|
23
|
-
abstract copy(args: PluginCopyArgs): PluginApiReturn<PluginCopyResult>;
|
|
24
|
-
/** Offset or split a component profile. See {@linkcode PluginOffsetArgs}. */
|
|
25
|
-
abstract offset(args: PluginOffsetArgs): PluginApiReturn<PluginOffsetResult>;
|
|
26
|
-
constructor();
|
|
27
|
-
}
|
|
28
|
-
export * from "./copy";
|
|
29
|
-
export * from "./offset";
|
|
30
|
-
export * from "./selection";
|
|
31
|
-
export * from "./transform";
|
|
32
|
-
export * from "./material";
|
|
33
|
-
//# sourceMappingURL=index.d.ts.map
|