@snaptrude/plugin-core 0.0.0-dev-20260827194031 → 0.0.0-dev-20260907135026
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/api-manifest.json +151 -12
- package/dist/api/core/geom/create/index.d.ts +559 -86
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/brep.d.ts +50 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/curve.d.ts +58 -35
- package/dist/api/core/geom/query/curve.d.ts.map +1 -1
- package/dist/api/core/geom/query/edge.d.ts +2 -2
- package/dist/api/core/geom/query/face.d.ts +45 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -1
- package/dist/api/core/geom/update/curve.d.ts +5 -5
- package/dist/api/core/geom/update/profile.d.ts +1 -1
- package/dist/api/design/query/geometry/index.d.ts +27 -1
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +47 -0
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/spaces.d.ts +5 -5
- package/dist/api/design/update/index.d.ts +87 -0
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +2 -2
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +5 -4
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +4 -4
- package/dist/api/program/spreadsheet.d.ts +4 -4
- package/dist/handles.d.ts +12 -3
- package/dist/handles.d.ts.map +1 -1
- package/dist/index.cjs +3030 -2715
- 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 +2996 -2715
- package/dist/index.js.map +1 -1
- package/dist/massParameters.d.ts +319 -0
- package/dist/massParameters.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/api/core/geom/create/index.ts +588 -84
- package/src/api/core/geom/query/brep.ts +51 -0
- package/src/api/core/geom/query/curve.ts +25 -2
- package/src/api/core/geom/query/edge.ts +2 -2
- package/src/api/core/geom/query/face.ts +49 -0
- package/src/api/design/query/geometry/index.ts +29 -0
- package/src/api/design/query/index.ts +50 -0
- package/src/api/design/update/index.ts +94 -0
- package/src/handles.ts +15 -3
- package/src/index.ts +1 -0
- package/src/massParameters.ts +472 -0
- package/test/massParameters.test.mjs +500 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { PluginApiReturn } from "../../../../types";
|
|
3
|
-
import { Vec3Handle, LineHandle, ArcHandle, CircleHandle, CurveHandle, ProfileHandle, ContourHandle, BrepHandle, FaceHandle, EdgeHandle, Vec3Components } from "../../../../handles";
|
|
3
|
+
import { Vec3Handle, LineHandle, ArcHandle, SplineHandle, CircleHandle, CurveHandle, ProfileHandle, ContourHandle, BrepHandle, FaceHandle, EdgeHandle, Vec3Components } from "../../../../handles";
|
|
4
4
|
/**
|
|
5
5
|
* Curve creation — construct new geometric curves from point handles (all-handle
|
|
6
6
|
* model, §11).
|
|
7
7
|
*
|
|
8
8
|
* Each method takes point handles ({@linkcode Vec3Handle}) and returns an opaque
|
|
9
|
-
* curve handle ({@linkcode LineHandle}
|
|
10
|
-
* query, update, or entity-creation
|
|
11
|
-
* via the
|
|
9
|
+
* curve handle ({@linkcode LineHandle}, {@linkcode ArcHandle}, or
|
|
10
|
+
* {@linkcode SplineHandle}) that you pass to query, update, or entity-creation
|
|
11
|
+
* methods. Read geometry back as plain values via the
|
|
12
|
+
* `snaptrude.core.geom.query.*` methods.
|
|
12
13
|
*
|
|
13
14
|
* Accessed via `snaptrude.core.geom.create`.
|
|
14
15
|
*/
|
|
@@ -69,6 +70,72 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
69
70
|
* ```
|
|
70
71
|
*/
|
|
71
72
|
abstract circle(centrePoint: Vec3Handle, axis: Vec3Handle, radius: number): PluginApiReturn<CircleHandle>;
|
|
73
|
+
/**
|
|
74
|
+
* Create an open NURBS curve passing exactly THROUGH each point, in order
|
|
75
|
+
* (centripetal Catmull-Rom fit → clamped cubic B-spline; C1-smooth, no cusps
|
|
76
|
+
* on uneven spacing). Host API call — returns a handle. The points are
|
|
77
|
+
* interpolated, NOT control points. For a CLOSED smooth loop use
|
|
78
|
+
* {@linkcode PluginGeomCreateApi.profileFromSplinePoints} — closed splines
|
|
79
|
+
* exist only as profiles, never as a single curve handle.
|
|
80
|
+
*
|
|
81
|
+
* Pure host-side math — the geometry kernel is not loaded. The result is a
|
|
82
|
+
* {@linkcode CurveHandle}: pass it to `profileFromCurves` alongside lines and
|
|
83
|
+
* arcs, or read it back via `core.geom.query.curve.*`.
|
|
84
|
+
*
|
|
85
|
+
* @param points 3..256 ordered through-points; consecutive points must be distinct
|
|
86
|
+
* @returns The new open curve as a {@linkcode SplineHandle}
|
|
87
|
+
* @throws VALIDATION if fewer than 3 points (2 points are a straight line —
|
|
88
|
+
* use {@linkcode PluginGeomCreateApi.line}), more than 256 points, or two
|
|
89
|
+
* consecutive points coincide
|
|
90
|
+
*
|
|
91
|
+
* @examplePrompt Draw a smooth curve through these points
|
|
92
|
+
* @examplePrompt Make a wavy edge that passes through A, B, C and D
|
|
93
|
+
* @examplePrompt Freeform curved wall path through these clicks
|
|
94
|
+
*
|
|
95
|
+
* # Example
|
|
96
|
+
* ```ts
|
|
97
|
+
* const spline = await snaptrude.core.geom.create.splineFromPoints([p0, p1, p2, p3])
|
|
98
|
+
* // Mixed profile: smooth top, straight closing base
|
|
99
|
+
* const base = await snaptrude.core.geom.create.line(p3, p0)
|
|
100
|
+
* const profile = await snaptrude.core.geom.create.profileFromCurves([spline, base])
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
abstract splineFromPoints(points: Vec3Handle[]): PluginApiReturn<SplineHandle>;
|
|
104
|
+
/**
|
|
105
|
+
* Create an open NURBS curve DEFINED BY control points — the curve is pulled
|
|
106
|
+
* TOWARD the interior points, not through them; it starts at the first point
|
|
107
|
+
* and ends at the last. Knots are computed for you (clamped, uniform) —
|
|
108
|
+
* there is no knot-vector argument. For a curve that must pass THROUGH given
|
|
109
|
+
* points use {@linkcode PluginGeomCreateApi.splineFromPoints}.
|
|
110
|
+
*
|
|
111
|
+
* A curve made here records as `splinePoles` in a mass recipe and is
|
|
112
|
+
* re-minted verbatim on edit — so an agent that read a `splinePoles` curve
|
|
113
|
+
* back off a mass can move its poles and rebuild the mass with
|
|
114
|
+
* `design.update.parameters`. Pure host-side math — the geometry kernel is
|
|
115
|
+
* not loaded, and nothing is created in the scene.
|
|
116
|
+
*
|
|
117
|
+
* @param controlPoints 3..512 control points ({@linkcode Vec3Handle}s), in order
|
|
118
|
+
* @param options.degree 2 or 3; default `min(3, controlPoints.length - 1)`
|
|
119
|
+
* @returns The new open curve as a {@linkcode SplineHandle}
|
|
120
|
+
* @throws VALIDATION when fewer than `degree + 1` points are given, two
|
|
121
|
+
* consecutive points coincide, or `degree` is not 2 or 3
|
|
122
|
+
*
|
|
123
|
+
* @examplePrompt Draw a smooth curve controlled by these four points
|
|
124
|
+
* @examplePrompt Rebuild this edge from its control polygon
|
|
125
|
+
*
|
|
126
|
+
* # Example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const curve = await snaptrude.core.geom.create.splineFromControlPoints([p0, p1, p2, p3])
|
|
129
|
+
* // Quadratic instead of the default cubic
|
|
130
|
+
* const tighter = await snaptrude.core.geom.create.splineFromControlPoints(
|
|
131
|
+
* [p0, p1, p2, p3],
|
|
132
|
+
* { degree: 2 },
|
|
133
|
+
* )
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
abstract splineFromControlPoints(controlPoints: Vec3Handle[], options?: {
|
|
137
|
+
degree?: number;
|
|
138
|
+
}): PluginApiReturn<SplineHandle>;
|
|
72
139
|
/**
|
|
73
140
|
* Create a closed profile from an ordered list of point handles connected by
|
|
74
141
|
* line segments (last auto-connected to first). Host API call — returns a handle.
|
|
@@ -100,6 +167,38 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
100
167
|
* ```
|
|
101
168
|
*/
|
|
102
169
|
abstract profileFromCurves(curves: CurveHandle[]): PluginApiReturn<ProfileHandle>;
|
|
170
|
+
/**
|
|
171
|
+
* Create a CLOSED smooth profile passing through each point, in order, with
|
|
172
|
+
* the loop closed smoothly back from the last point to the first (do NOT
|
|
173
|
+
* repeat the first point). Host API call — returns a handle. This is the
|
|
174
|
+
* closed counterpart of {@linkcode PluginGeomCreateApi.splineFromPoints} and
|
|
175
|
+
* the one-call route from points to an extrudable outline: wrap in
|
|
176
|
+
* `contourFromProfile` and extrude/loft/sweep as usual.
|
|
177
|
+
*
|
|
178
|
+
* The whole loop is smooth — v1 takes no mixed straight/spline input. For a
|
|
179
|
+
* profile that is part curve and part straight, build the pieces with
|
|
180
|
+
* `splineFromPoints` + `line` and join them with
|
|
181
|
+
* {@linkcode PluginGeomCreateApi.profileFromCurves}.
|
|
182
|
+
*
|
|
183
|
+
* @param points 3..256 ordered through-points of the loop (first point NOT repeated)
|
|
184
|
+
* @returns The new closed profile as a {@linkcode ProfileHandle}
|
|
185
|
+
* @throws VALIDATION if fewer than 3 points, more than 256 points,
|
|
186
|
+
* consecutive points coincide (including last→first), or the loop
|
|
187
|
+
* self-intersects
|
|
188
|
+
*
|
|
189
|
+
* @examplePrompt Make a blob-shaped floor plate through these points
|
|
190
|
+
* @examplePrompt Organic curved outline through these corners
|
|
191
|
+
* @examplePrompt Freeform podium profile
|
|
192
|
+
*
|
|
193
|
+
* # Example
|
|
194
|
+
* ```ts
|
|
195
|
+
* const profile = await snaptrude.core.geom.create.profileFromSplinePoints([p0, p1, p2, p3, p4])
|
|
196
|
+
* const contour = await snaptrude.core.geom.create.contourFromProfile(profile)
|
|
197
|
+
* const brep = await snaptrude.core.geom.create.brepFromExtrusion(contour, { x: 0, y: 1, z: 0 }, 3)
|
|
198
|
+
* const podium = await snaptrude.design.create.massFromBrep(brep, "Podium")
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
abstract profileFromSplinePoints(points: Vec3Handle[]): PluginApiReturn<ProfileHandle>;
|
|
103
202
|
/**
|
|
104
203
|
* Create an axis-aligned **rectangle** profile (XZ plane) of `width` × `depth`,
|
|
105
204
|
* centred at `center` (defaults to the origin). Host API call — returns a handle.
|
|
@@ -257,7 +356,9 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
257
356
|
* bottom — sections are auto-matched)
|
|
258
357
|
* @param intermediateContours Optional in-between cross-sections, ordered
|
|
259
358
|
* bottom to top (hole-free; edge counts may differ — every section is
|
|
260
|
-
* normalized to the largest)
|
|
359
|
+
* normalized to the largest). Any count is accepted; a loft of more
|
|
360
|
+
* than 32 sections counting the bottom and the top still builds but
|
|
361
|
+
* carries no parameter record (records are capped, calls are not)
|
|
261
362
|
* @param options Optional behavior switches. `compatibility` — `"auto"`
|
|
262
363
|
* (default) inserts vertices to match differing edge counts; `"strict"`
|
|
263
364
|
* skips normalization and throws VALIDATION when outer edge counts (or,
|
|
@@ -432,38 +533,66 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
432
533
|
*/
|
|
433
534
|
abstract brepFromIntersection(a: BrepHandle, b: BrepHandle): PluginApiReturn<BrepHandle>;
|
|
434
535
|
/**
|
|
435
|
-
* Rounds the given
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
536
|
+
* Rounds the given edges of a solid with a constant radius. Host API call —
|
|
537
|
+
* returns a new {@linkcode BrepHandle}; the input brep is read-only.
|
|
538
|
+
*
|
|
539
|
+
* Works on curved solids: edges may be straight, circular or spline, and
|
|
540
|
+
* adjacent edges (corner blends) are allowed. To pick a **rim** — the circle
|
|
541
|
+
* where a cylinder meets a flat cap — walk the edges and keep the ones whose
|
|
542
|
+
* two faces are a `cylinder` and a `plane`:
|
|
543
|
+
* `core.geom.query.brep.listEdges(brep)` → per edge
|
|
544
|
+
* `core.geom.query.edge.listFaces(edge)` → `core.geom.query.face.getSurfaceKind`
|
|
545
|
+
* on both faces. (`core.geom.query.brep.listEdgesBetween` takes two VERTEX
|
|
546
|
+
* indices — it is NOT a face-pair lookup.) For one cap's rim only,
|
|
547
|
+
* `core.geom.query.face.listEdges(capFace)` after a `getSurfaceKind` census of
|
|
548
|
+
* `brep.listFaces` is the shorter walk.
|
|
549
|
+
*
|
|
550
|
+
* When the input brep carries a creation recipe, the result carries it too,
|
|
551
|
+
* with this operation appended to `operations`; `design.create.massFromBrep`
|
|
552
|
+
* then keeps the mass editable through `design.update.parameters`.
|
|
553
|
+
*
|
|
554
|
+
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of tens
|
|
555
|
+
* of MB — expect a pause of seconds).
|
|
443
556
|
*
|
|
444
557
|
* Inspect the result via `core.geom.query.brep.*`, or commit it to the scene
|
|
445
558
|
* with `design.create.massFromBrep`.
|
|
446
559
|
*
|
|
447
560
|
* @param brep The solid whose edges to round
|
|
448
|
-
* @param edges The
|
|
561
|
+
* @param edges The edges to fillet (one or more, all on `brep`, no
|
|
562
|
+
* duplicates; more than 64 still fillets but the result carries no
|
|
563
|
+
* parameter record)
|
|
449
564
|
* @param radius Fillet radius (positive, finite)
|
|
450
565
|
* @returns The filleted solid as a new {@linkcode BrepHandle}
|
|
451
|
-
* @throws VALIDATION if `edges` is empty, `radius` is
|
|
452
|
-
* number, an edge is not on `brep`, an edge
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
566
|
+
* @throws VALIDATION if `edges` is empty or holds a duplicate, `radius` is
|
|
567
|
+
* not a positive finite number, an edge is not on `brep`, or an edge has no
|
|
568
|
+
* crease to round — it is a seam of a closed face, or it lies between two
|
|
569
|
+
* patches of one smooth surface
|
|
570
|
+
* @throws PRECONDITION_FAILED if an edge could not be located on the kernel
|
|
571
|
+
* solid after healing (select a different edge, or fillet before the
|
|
572
|
+
* operation that curved the solid), or the kernel could not blend the edge
|
|
573
|
+
* named in the message (reduce the radius or drop that edge)
|
|
574
|
+
* @throws OPERATION_FAILED if the kernel or the translation fails, or the
|
|
575
|
+
* result is non-manifold, splits into several solids, or contains a surface
|
|
576
|
+
* Snaptrude cannot represent
|
|
577
|
+
*
|
|
578
|
+
* @examplePrompt Round the rim of the column with 200 mm
|
|
579
|
+
* @examplePrompt Soften where the dome meets the wall
|
|
459
580
|
* @examplePrompt Fillet the corners of the podium with a 0.5m radius
|
|
460
581
|
* @examplePrompt Soften the vertical edges of this tower
|
|
461
582
|
*
|
|
462
583
|
* # Example
|
|
463
584
|
* ```ts
|
|
464
|
-
*
|
|
465
|
-
* const edges = await snaptrude.core.geom.query.brep.listEdges(
|
|
466
|
-
* const
|
|
585
|
+
* // Rim = every edge between the cylinder side and a plane cap
|
|
586
|
+
* const edges = await snaptrude.core.geom.query.brep.listEdges(column)
|
|
587
|
+
* const rim = []
|
|
588
|
+
* for (const edge of edges) {
|
|
589
|
+
* const faces = await snaptrude.core.geom.query.edge.listFaces(edge)
|
|
590
|
+
* const kinds = await Promise.all(
|
|
591
|
+
* faces.map((f) => snaptrude.core.geom.query.face.getSurfaceKind(f)),
|
|
592
|
+
* )
|
|
593
|
+
* if (kinds.includes("cylinder") && kinds.includes("plane")) rim.push(edge)
|
|
594
|
+
* }
|
|
595
|
+
* const rounded = await snaptrude.core.geom.create.brepFromFillet(column, rim, 0.787) // 200 mm
|
|
467
596
|
* ```
|
|
468
597
|
*/
|
|
469
598
|
abstract brepFromFillet(brep: BrepHandle, edges: EdgeHandle[], radius: number): PluginApiReturn<BrepHandle>;
|
|
@@ -472,6 +601,14 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
472
601
|
* moves faces outward, negative moves them inward. Host API call — returns
|
|
473
602
|
* a new {@linkcode BrepHandle}; the input brep is read-only.
|
|
474
603
|
*
|
|
604
|
+
* Works on curved solids: a sphere offsets to a sphere, a torus to a torus,
|
|
605
|
+
* a cylinder to a cylinder. There is nothing to select — the whole solid is
|
|
606
|
+
* offset.
|
|
607
|
+
*
|
|
608
|
+
* When the input brep carries a creation recipe, the result carries it too,
|
|
609
|
+
* with this operation appended to `operations`; `design.create.massFromBrep`
|
|
610
|
+
* then keeps the mass editable through `design.update.parameters`.
|
|
611
|
+
*
|
|
475
612
|
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of
|
|
476
613
|
* tens of MB — expect a pause of seconds).
|
|
477
614
|
*
|
|
@@ -483,9 +620,15 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
483
620
|
* @returns The offset solid as a new {@linkcode BrepHandle}
|
|
484
621
|
* @throws VALIDATION if `distance` is not finite, is too small to offset
|
|
485
622
|
* anything, or an inward distance consumes the solid entirely
|
|
486
|
-
* @throws OPERATION_FAILED if the kernel
|
|
487
|
-
* result
|
|
488
|
-
*
|
|
623
|
+
* @throws OPERATION_FAILED if the kernel or the translation fails, or the
|
|
624
|
+
* result is non-manifold, splits into several solids, or contains a surface
|
|
625
|
+
* Snaptrude cannot represent (an offset free-form NURBS surface may have no
|
|
626
|
+
* exact representation — the model is left unchanged). A distance the
|
|
627
|
+
* solid cannot carry surfaces here, with a hint asking for a smaller one;
|
|
628
|
+
* there is no per-face refusal — the kernel's per-face history verdict
|
|
629
|
+
* ("this face was not offset") is logged, never raised (P4-D57)
|
|
630
|
+
*
|
|
631
|
+
* @examplePrompt Thicken the torus ring by 100 mm
|
|
489
632
|
* @examplePrompt Grow this solid by 0.5m in every direction
|
|
490
633
|
* @examplePrompt Shrink this mass by 200mm
|
|
491
634
|
* @examplePrompt Offset the building envelope outward by 1m
|
|
@@ -503,6 +646,17 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
503
646
|
* input brep is read-only. The outer surface is kept and the walls grow
|
|
504
647
|
* inward.
|
|
505
648
|
*
|
|
649
|
+
* Works on curved solids: the open faces may be spherical, cylindrical,
|
|
650
|
+
* conical, toroidal or free-form patches, not only flat ones. To open the
|
|
651
|
+
* flat base of a dome, census the faces first — `core.geom.query.brep.listFaces`
|
|
652
|
+
* then `core.geom.query.face.getSurfaceKind` on each — and keep the `"plane"`
|
|
653
|
+
* one. A closed curved surface is stored as several patches (a sphere as
|
|
654
|
+
* lunes), so opening "the sphere" may mean passing several faces.
|
|
655
|
+
*
|
|
656
|
+
* When the input brep carries a creation recipe, the result carries it too,
|
|
657
|
+
* with this operation appended to `operations`; `design.create.massFromBrep`
|
|
658
|
+
* then keeps the mass editable through `design.update.parameters`.
|
|
659
|
+
*
|
|
506
660
|
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of
|
|
507
661
|
* tens of MB — expect a pause of seconds).
|
|
508
662
|
*
|
|
@@ -510,24 +664,36 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
510
664
|
* with `design.create.massFromBrep`.
|
|
511
665
|
*
|
|
512
666
|
* @param brep The solid to hollow
|
|
513
|
-
* @param openFaces The faces to remove as openings (
|
|
667
|
+
* @param openFaces The faces to remove as openings (one or more, all on
|
|
668
|
+
* `brep`, no duplicates; more than 32 still shells but the result carries
|
|
669
|
+
* no parameter record)
|
|
514
670
|
* @param thickness Wall thickness (positive, finite, smaller than half the solid's smallest span)
|
|
515
671
|
* @returns The hollowed solid as a new {@linkcode BrepHandle}
|
|
516
|
-
* @throws VALIDATION if `openFaces` is empty, a face is
|
|
517
|
-
* `thickness` is not a positive finite number, or the
|
|
518
|
-
* large (it must be smaller than half the solid's smallest
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
672
|
+
* @throws VALIDATION if `openFaces` is empty or holds a duplicate, a face is
|
|
673
|
+
* not on `brep`, `thickness` is not a positive finite number, or the
|
|
674
|
+
* thickness is too large (it must be smaller than half the solid's smallest
|
|
675
|
+
* span)
|
|
676
|
+
* @throws OPERATION_FAILED if the kernel or the translation fails, or the
|
|
677
|
+
* result is non-manifold, splits into several solids, or contains a surface
|
|
678
|
+
* Snaptrude cannot represent. A thickness the solid cannot carry surfaces
|
|
679
|
+
* here, with a hint asking for one below half the smallest span; there is
|
|
680
|
+
* no per-face refusal — the kernel's per-face history verdict ("this kept
|
|
681
|
+
* face was not thickened") is logged, never raised (P4-D57)
|
|
682
|
+
*
|
|
683
|
+
* @examplePrompt Hollow the dome into a 300 mm shell, open at the base
|
|
522
684
|
* @examplePrompt Hollow this mass into 200mm walls
|
|
523
685
|
* @examplePrompt Shell this form with the top face open
|
|
524
686
|
* @examplePrompt Turn this solid tower into a tube open at both ends
|
|
525
687
|
*
|
|
526
688
|
* # Example
|
|
527
689
|
* ```ts
|
|
528
|
-
*
|
|
529
|
-
* const faces = await snaptrude.core.geom.query.brep.listFaces(
|
|
530
|
-
* const
|
|
690
|
+
* // Open the dome at its flat base: the one face whose surface is a plane
|
|
691
|
+
* const faces = await snaptrude.core.geom.query.brep.listFaces(dome)
|
|
692
|
+
* const base = []
|
|
693
|
+
* for (const face of faces) {
|
|
694
|
+
* if ((await snaptrude.core.geom.query.face.getSurfaceKind(face)) === "plane") base.push(face)
|
|
695
|
+
* }
|
|
696
|
+
* const hollow = await snaptrude.core.geom.create.brepFromShell(dome, base, 1.181) // 300 mm
|
|
531
697
|
* ```
|
|
532
698
|
*/
|
|
533
699
|
abstract brepFromShell(brep: BrepHandle, openFaces: FaceHandle[], thickness: number): PluginApiReturn<BrepHandle>;
|
|
@@ -567,28 +733,48 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
567
733
|
*/
|
|
568
734
|
abstract brepsFromSplit(brep: BrepHandle, planeOrigin: Vec3Components, planeNormal: Vec3Components): PluginApiReturn<BrepHandle[]>;
|
|
569
735
|
/**
|
|
570
|
-
* Bevels the given
|
|
571
|
-
*
|
|
572
|
-
*
|
|
736
|
+
* Bevels the given edges of a solid with a symmetric planar cut. Host API
|
|
737
|
+
* call — returns a new {@linkcode BrepHandle}; the input brep is read-only.
|
|
738
|
+
*
|
|
739
|
+
* Works on curved solids: edges may be straight, circular or spline, and
|
|
740
|
+
* adjacent edges are allowed. Pick edges the same way as for
|
|
741
|
+
* {@linkcode PluginGeomCreateApi.brepFromFillet} — `brep.listEdges`, then
|
|
742
|
+
* `core.geom.query.edge.listFaces` and `core.geom.query.face.getSurfaceKind`
|
|
743
|
+
* on both faces of each edge. (`core.geom.query.brep.listEdgesBetween` takes
|
|
744
|
+
* two VERTEX indices — it is NOT a face-pair lookup.) Chamfering a cylinder's
|
|
745
|
+
* rim yields a cone patch where a fillet would yield a torus patch.
|
|
746
|
+
*
|
|
747
|
+
* When the input brep carries a creation recipe, the result carries it too,
|
|
748
|
+
* with this operation appended to `operations`; `design.create.massFromBrep`
|
|
749
|
+
* then keeps the mass editable through `design.update.parameters`.
|
|
573
750
|
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
* wasm of tens of MB — expect a pause of seconds).
|
|
751
|
+
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of tens
|
|
752
|
+
* of MB — expect a pause of seconds).
|
|
577
753
|
*
|
|
578
754
|
* Inspect the result via `core.geom.query.brep.*`, or commit it to the scene
|
|
579
755
|
* with `design.create.massFromBrep`.
|
|
580
756
|
*
|
|
581
757
|
* @param brep The solid whose edges to bevel
|
|
582
|
-
* @param edges The
|
|
758
|
+
* @param edges The edges to chamfer (one or more, all on `brep`, no
|
|
759
|
+
* duplicates; more than 64 still chamfers but the result carries no
|
|
760
|
+
* parameter record)
|
|
583
761
|
* @param distance Chamfer distance from the edge on each adjacent face (positive, finite)
|
|
584
762
|
* @returns The chamfered solid as a new {@linkcode BrepHandle}
|
|
585
|
-
* @throws VALIDATION if `edges` is empty, `distance` is
|
|
586
|
-
* finite number, an edge is not on `brep`, an edge
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
* @throws
|
|
590
|
-
*
|
|
591
|
-
*
|
|
763
|
+
* @throws VALIDATION if `edges` is empty or holds a duplicate, `distance` is
|
|
764
|
+
* not a positive finite number, an edge is not on `brep`, or an edge has no
|
|
765
|
+
* crease to cut — it is a seam of a closed face, or it lies between two
|
|
766
|
+
* patches of one smooth surface
|
|
767
|
+
* @throws PRECONDITION_FAILED if an edge could not be located on the kernel
|
|
768
|
+
* solid after healing (select a different edge, or chamfer before the
|
|
769
|
+
* operation that curved the solid)
|
|
770
|
+
* @throws OPERATION_FAILED if the kernel or the translation fails, or the
|
|
771
|
+
* result is non-manifold, splits into several solids, or contains a surface
|
|
772
|
+
* Snaptrude cannot represent. A distance larger than an adjacent face
|
|
773
|
+
* surfaces here, with a hint asking for a smaller one: unlike
|
|
774
|
+
* {@linkcode PluginGeomCreateApi.brepFromFillet}, a chamfer has no
|
|
775
|
+
* per-edge kernel verdict, so the failure names no edge (P4-D59)
|
|
776
|
+
*
|
|
777
|
+
* @examplePrompt Chamfer the top edge of the cylinder
|
|
592
778
|
* @examplePrompt Bevel these edges by 100mm
|
|
593
779
|
* @examplePrompt Chamfer the top edges of the plinth
|
|
594
780
|
* @examplePrompt Cut a 45-degree flat along the corners of this mass
|
|
@@ -619,11 +805,15 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
619
805
|
* tapering across a bend or along an arc edge would create faces Snaptrude
|
|
620
806
|
* cannot represent and throws (sweep each straight run separately and union
|
|
621
807
|
* the results instead). An optional `transition` picks the corner
|
|
622
|
-
* treatment: `"miter"` (default) is today's sharp mitred bend;
|
|
808
|
+
* treatment: `"miter"` (default) is today's sharp mitred bend; `"round"`
|
|
809
|
+
* carries the section around each turning corner on a tangent circular arc,
|
|
810
|
+
* so the corner patch is a real curved (cylindrical) surface rather than a
|
|
811
|
+
* flat cut (open paths only — `"round"` on a closed ring path is refused);
|
|
623
812
|
* `{ bevel: b }` chamfers each turning corner by cutting `b` back along
|
|
624
813
|
* both adjacent legs (works on open and closed paths — each leg must be
|
|
625
|
-
* long enough for its cuts). On a corner-less path `transition` has no
|
|
626
|
-
* varying-scale lane takes straight paths, so it never sees
|
|
814
|
+
* long enough for its cuts). On a corner-less path `transition` has no
|
|
815
|
+
* effect, and the varying-scale lane takes straight paths, so it never sees
|
|
816
|
+
* a corner.
|
|
627
817
|
*
|
|
628
818
|
* Open paths run on the OpenCascade kernel (the first kernel call loads a
|
|
629
819
|
* wasm of tens of MB — expect a pause of seconds); closed paths are
|
|
@@ -633,19 +823,22 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
633
823
|
* with `design.create.massFromBrep`.
|
|
634
824
|
*
|
|
635
825
|
* @param profile The cross-section to sweep (hole-free contour)
|
|
636
|
-
* @param path The polyline path as plain `{x, y, z}` points (
|
|
637
|
-
* first point as the last to close the path into a ring
|
|
826
|
+
* @param path The polyline path as plain `{x, y, z}` points (2 or more;
|
|
827
|
+
* repeat the first point as the last to close the path into a ring; more
|
|
828
|
+
* than 512 points still sweeps but the result carries no parameter record)
|
|
638
829
|
* @param options Optional scale law and corner transition. Scale law:
|
|
639
830
|
* `startScale`/`endScale` (linear taper by arc length) or `scales` (one
|
|
640
831
|
* factor per path point; mutually exclusive with
|
|
641
832
|
* `startScale`/`endScale`); every factor must be finite and within
|
|
642
|
-
* 1e-3..1e3. `transition`: `"miter"` (default, sharp corners)
|
|
643
|
-
* `
|
|
644
|
-
*
|
|
833
|
+
* 1e-3..1e3. `transition`: `"miter"` (default, sharp corners),
|
|
834
|
+
* `"round"` (arc-carried corners — curved corner patches; open paths
|
|
835
|
+
* only) or `{ bevel: b }` (chamfered corners, `b` finite within
|
|
836
|
+
* 1e-3..1e3; open and closed paths)
|
|
645
837
|
* @returns The swept solid as a new {@linkcode BrepHandle}
|
|
646
838
|
* @throws VALIDATION if the profile has holes, the path has fewer than 2
|
|
647
|
-
* points, consecutive path points coincide, a
|
|
648
|
-
* or the profile plane contains the first
|
|
839
|
+
* points, consecutive path points coincide, a
|
|
840
|
+
* coordinate is not finite, or the profile plane contains the first
|
|
841
|
+
* path segment's direction
|
|
649
842
|
* (degenerate sweep); for closed paths, if the ring has fewer than 3
|
|
650
843
|
* distinct corners, the path is non-planar, a corner doubles back, the
|
|
651
844
|
* profile has an arc edge, or the profile is too large for a mitred
|
|
@@ -653,11 +846,14 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
653
846
|
* is combined with `startScale`/`endScale`, `scales` does not match the
|
|
654
847
|
* path length, or a varying scale is used on a bent or closed path or
|
|
655
848
|
* with an arc-edged profile; for `{ bevel }`, if a leg is too short for
|
|
656
|
-
* the cuts its
|
|
657
|
-
* back so its
|
|
849
|
+
* the cuts its bevelled corners take from it or a corner nearly doubles
|
|
850
|
+
* back so its bevel collapses (the errors name the corner)
|
|
851
|
+
* @throws PRECONDITION_FAILED if `transition` is `"round"` and the path is
|
|
852
|
+
* closed — round corners are an open-path lane; use `"miter"` or
|
|
853
|
+
* `{ bevel }` on a ring
|
|
658
854
|
* @throws OPERATION_FAILED if the kernel cannot sweep the profile into a
|
|
659
|
-
* valid solid
|
|
660
|
-
*
|
|
855
|
+
* valid solid — including a `"round"` corner whose arc does not fit its
|
|
856
|
+
* legs, which is not pre-checked and so is not named per corner
|
|
661
857
|
*
|
|
662
858
|
* @examplePrompt Sweep this profile along the corridor path
|
|
663
859
|
* @examplePrompt Extrude the railing section along this route
|
|
@@ -666,6 +862,7 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
666
862
|
* @examplePrompt Taper this duct from 1x1 to 2x2 along its run
|
|
667
863
|
* @examplePrompt Sweep a column section that narrows toward the top
|
|
668
864
|
* @examplePrompt Chamfer the corners of this swept frame by 200mm
|
|
865
|
+
* @examplePrompt Sweep this handrail with rounded corners at the bends
|
|
669
866
|
*
|
|
670
867
|
* # Example
|
|
671
868
|
* ```ts
|
|
@@ -701,7 +898,7 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
701
898
|
startScale?: number;
|
|
702
899
|
endScale?: number;
|
|
703
900
|
scales?: number[];
|
|
704
|
-
transition?: "miter" | {
|
|
901
|
+
transition?: "miter" | "round" | {
|
|
705
902
|
bevel: number;
|
|
706
903
|
};
|
|
707
904
|
}): PluginApiReturn<BrepHandle>;
|
|
@@ -709,9 +906,19 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
709
906
|
* Revolves a planar profile about an axis to make a solid of revolution — a
|
|
710
907
|
* full turn by default. Host API call — returns a new
|
|
711
908
|
* {@linkcode BrepHandle}; the input contour is read-only. Holes in the
|
|
712
|
-
* profile are allowed
|
|
713
|
-
*
|
|
714
|
-
*
|
|
909
|
+
* profile are allowed, and segments may run at any angle to the axis: an
|
|
910
|
+
* inclined segment revolves into a cone, an arc into a sphere or torus
|
|
911
|
+
* section. This is the general route to domes, vases, columns and rotundas.
|
|
912
|
+
*
|
|
913
|
+
* Two rules bind the axis to the profile. First, the axis line must lie IN
|
|
914
|
+
* the profile's plane — a revolution turns a planar section about a line
|
|
915
|
+
* drawn in that same plane. An axis that misses the plane (skew to it, or
|
|
916
|
+
* parallel but offset out of it) is refused: move the axis into the
|
|
917
|
+
* profile's plane, or move the profile onto the axis's plane. Second,
|
|
918
|
+
* within that plane the whole profile stays on ONE side of the axis.
|
|
919
|
+
* Vertices and whole segments may lie ON the axis — that is how a dome's
|
|
920
|
+
* pole and a cylinder's inner edge are authored — but no part of the profile
|
|
921
|
+
* may cross to the other side, which would sweep a self-intersecting solid.
|
|
715
922
|
*
|
|
716
923
|
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of
|
|
717
924
|
* tens of MB — expect a pause of seconds).
|
|
@@ -725,19 +932,25 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
725
932
|
* @param angleInDegrees Optional revolution angle in degrees (0 < angle ≤ 360; default 360)
|
|
726
933
|
* @returns The revolved solid as a new {@linkcode BrepHandle}
|
|
727
934
|
* @throws VALIDATION if `axisDirection` is zero-length, `angleInDegrees` is
|
|
728
|
-
* not in (0, 360],
|
|
729
|
-
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
935
|
+
* not in (0, 360], a coordinate is not finite, or the profile crosses the
|
|
936
|
+
* axis (the message names the offending segment — keep the whole profile
|
|
937
|
+
* on one side; points may touch the axis but not cross it)
|
|
938
|
+
* @throws PRECONDITION_FAILED if the axis does not lie in the profile's
|
|
939
|
+
* plane — skew to it, or parallel but offset out of it (the message asks
|
|
940
|
+
* you to move the axis into that plane)
|
|
941
|
+
* @throws OPERATION_FAILED if the kernel cannot revolve the profile into a
|
|
942
|
+
* valid solid
|
|
733
943
|
*
|
|
734
944
|
* @examplePrompt Create a dome from this section
|
|
735
945
|
* @examplePrompt Revolve this profile 360 degrees around the vertical axis
|
|
736
946
|
* @examplePrompt Build a rotunda by revolving this wall section
|
|
947
|
+
* @examplePrompt Make a dome by revolving a quarter-circle about the vertical axis
|
|
948
|
+
* @examplePrompt Turn this curved outline into a vase
|
|
737
949
|
*
|
|
738
950
|
* # Example
|
|
739
951
|
* ```ts
|
|
740
|
-
* // A cylinder: revolve a 2m-wide, 3m-tall rectangle about the Y axis at
|
|
952
|
+
* // A cylinder: revolve a 2m-wide, 3m-tall rectangle about the Y axis at
|
|
953
|
+
* // its edge — the left edge sits ON the axis, which is legal.
|
|
741
954
|
* const rect = await snaptrude.core.geom.create.profileFromLinePoints([
|
|
742
955
|
* await snaptrude.core.math.vec3.new(0, 0, 0),
|
|
743
956
|
* await snaptrude.core.math.vec3.new(2, 0, 0),
|
|
@@ -753,6 +966,135 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
753
966
|
* ```
|
|
754
967
|
*/
|
|
755
968
|
abstract brepFromRevolution(profile: ContourHandle, axisOrigin: Vec3Components, axisDirection: Vec3Components, angleInDegrees?: number): PluginApiReturn<BrepHandle>;
|
|
969
|
+
/**
|
|
970
|
+
* Create a solid **sphere** B-rep from a centre and radius. Host API call —
|
|
971
|
+
* returns a {@linkcode BrepHandle}; commit it to the scene with
|
|
972
|
+
* `design.create.massFromBrep`. The result carries an exact spherical
|
|
973
|
+
* surface (not a faceted approximation) and a creation recipe — read the
|
|
974
|
+
* committed mass's parameters back with `design.query.getParameters` and edit
|
|
975
|
+
* them with `design.update.parameters`.
|
|
976
|
+
*
|
|
977
|
+
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of tens
|
|
978
|
+
* of MB — expect a pause of seconds).
|
|
979
|
+
*
|
|
980
|
+
* @param centre Sphere centre as plain `{x, y, z}` components (raw Babylon units)
|
|
981
|
+
* @param radius Sphere radius (> 0, raw Babylon units)
|
|
982
|
+
* @returns The new solid as a {@linkcode BrepHandle}
|
|
983
|
+
* @throws VALIDATION if `radius` is not a positive finite number or a
|
|
984
|
+
* coordinate is not finite
|
|
985
|
+
*
|
|
986
|
+
* @examplePrompt Create a sphere of radius 5 at the origin
|
|
987
|
+
* @examplePrompt Add a 3m ball on top of the tower
|
|
988
|
+
*
|
|
989
|
+
* # Example
|
|
990
|
+
* ```ts
|
|
991
|
+
* const brep = await snaptrude.core.geom.create.brepFromSphere({ x: 0, y: 5, z: 0 }, 5)
|
|
992
|
+
* const mass = await snaptrude.design.create.massFromBrep(brep, "Sphere")
|
|
993
|
+
* ```
|
|
994
|
+
*/
|
|
995
|
+
abstract brepFromSphere(centre: Vec3Components, radius: number): PluginApiReturn<BrepHandle>;
|
|
996
|
+
/**
|
|
997
|
+
* Create a solid **cylinder** B-rep from its bottom-cap centre, axis
|
|
998
|
+
* direction, radius and height. Host API call — returns a
|
|
999
|
+
* {@linkcode BrepHandle}; commit with `design.create.massFromBrep`. The
|
|
1000
|
+
* bottom cap sits AT `base` and the solid extends `height` along `axis` —
|
|
1001
|
+
* place `base` on the floor and use axis `{x: 0, y: 1, z: 0}` for an upright
|
|
1002
|
+
* column. Carries a creation recipe (radius, height), editable through
|
|
1003
|
+
* `design.update.parameters`.
|
|
1004
|
+
*
|
|
1005
|
+
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of tens
|
|
1006
|
+
* of MB — expect a pause of seconds).
|
|
1007
|
+
*
|
|
1008
|
+
* @param base Centre of the bottom cap as plain `{x, y, z}` components
|
|
1009
|
+
* @param axis Axis direction as plain `{x, y, z}` components (non-zero, normalised by the host)
|
|
1010
|
+
* @param radius Cylinder radius (> 0)
|
|
1011
|
+
* @param height Cylinder height along `axis` (> 0)
|
|
1012
|
+
* @returns The new solid as a {@linkcode BrepHandle}
|
|
1013
|
+
* @throws VALIDATION if `radius`/`height` are not positive finite numbers or
|
|
1014
|
+
* `axis` is zero-length
|
|
1015
|
+
*
|
|
1016
|
+
* @examplePrompt Create a cylinder 2m across and 4m tall
|
|
1017
|
+
* @examplePrompt Add a circular column here
|
|
1018
|
+
*
|
|
1019
|
+
* # Example
|
|
1020
|
+
* ```ts
|
|
1021
|
+
* const brep = await snaptrude.core.geom.create.brepFromCylinder(
|
|
1022
|
+
* { x: 0, y: 0, z: 0 },
|
|
1023
|
+
* { x: 0, y: 1, z: 0 },
|
|
1024
|
+
* 1,
|
|
1025
|
+
* 4,
|
|
1026
|
+
* )
|
|
1027
|
+
* const column = await snaptrude.design.create.massFromBrep(brep, "Column")
|
|
1028
|
+
* ```
|
|
1029
|
+
*/
|
|
1030
|
+
abstract brepFromCylinder(base: Vec3Components, axis: Vec3Components, radius: number, height: number): PluginApiReturn<BrepHandle>;
|
|
1031
|
+
/**
|
|
1032
|
+
* Create a solid **cone or frustum** B-rep: bottom-cap centre, axis, base
|
|
1033
|
+
* radius, height, and an optional top radius (default 0 — a full cone to a
|
|
1034
|
+
* point; > 0 — a frustum / tapered column). Host API call — returns a
|
|
1035
|
+
* {@linkcode BrepHandle}; commit with `design.create.massFromBrep`. Carries
|
|
1036
|
+
* a creation recipe (radii + height), editable through `design.update.parameters`.
|
|
1037
|
+
*
|
|
1038
|
+
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of tens
|
|
1039
|
+
* of MB — expect a pause of seconds).
|
|
1040
|
+
*
|
|
1041
|
+
* @param base Centre of the bottom cap as plain `{x, y, z}` components
|
|
1042
|
+
* @param axis Axis direction as plain `{x, y, z}` components (non-zero, normalised by the host)
|
|
1043
|
+
* @param baseRadius Radius at the base (> 0)
|
|
1044
|
+
* @param height Height along `axis` (> 0)
|
|
1045
|
+
* @param topRadius Optional radius at the top (≥ 0, ≠ `baseRadius`; default 0 = apex)
|
|
1046
|
+
* @returns The new solid as a {@linkcode BrepHandle}
|
|
1047
|
+
* @throws VALIDATION if radii/height are invalid, `topRadius === baseRadius`
|
|
1048
|
+
* (that is a cylinder — use {@linkcode PluginGeomCreateApi.brepFromCylinder}),
|
|
1049
|
+
* or `axis` is zero-length
|
|
1050
|
+
*
|
|
1051
|
+
* @examplePrompt Create a cone roof 4m wide and 3m tall
|
|
1052
|
+
* @examplePrompt Make a tapered column narrowing from 1m to 0.6m
|
|
1053
|
+
*
|
|
1054
|
+
* # Example
|
|
1055
|
+
* ```ts
|
|
1056
|
+
* const roof = await snaptrude.core.geom.create.brepFromCone(
|
|
1057
|
+
* { x: 0, y: 9, z: 0 },
|
|
1058
|
+
* { x: 0, y: 1, z: 0 },
|
|
1059
|
+
* 2,
|
|
1060
|
+
* 3,
|
|
1061
|
+
* )
|
|
1062
|
+
* ```
|
|
1063
|
+
*/
|
|
1064
|
+
abstract brepFromCone(base: Vec3Components, axis: Vec3Components, baseRadius: number, height: number, topRadius?: number): PluginApiReturn<BrepHandle>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Create a solid **torus** (ring / donut) B-rep from its centre, plane
|
|
1067
|
+
* normal, ring radius and tube radius. Host API call — returns a
|
|
1068
|
+
* {@linkcode BrepHandle}; commit with `design.create.massFromBrep`.
|
|
1069
|
+
* `majorRadius` is centre-to-tube-centre; `minorRadius` is the tube's own
|
|
1070
|
+
* radius and must be strictly smaller. Carries a creation recipe, editable
|
|
1071
|
+
* through `design.update.parameters`.
|
|
1072
|
+
*
|
|
1073
|
+
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of tens
|
|
1074
|
+
* of MB — expect a pause of seconds).
|
|
1075
|
+
*
|
|
1076
|
+
* @param centre Torus centre as plain `{x, y, z}` components
|
|
1077
|
+
* @param axis Plane normal of the ring as plain `{x, y, z}` components (non-zero)
|
|
1078
|
+
* @param majorRadius Ring radius, centre to tube centre (> 0)
|
|
1079
|
+
* @param minorRadius Tube radius (> 0 and < `majorRadius` — a self-intersecting torus is rejected)
|
|
1080
|
+
* @returns The new solid as a {@linkcode BrepHandle}
|
|
1081
|
+
* @throws VALIDATION if a radius is invalid, `minorRadius >= majorRadius`,
|
|
1082
|
+
* or `axis` is zero-length
|
|
1083
|
+
*
|
|
1084
|
+
* @examplePrompt Create a donut-shaped ring 10m across with a 1m tube
|
|
1085
|
+
* @examplePrompt Add a torus canopy around the tower
|
|
1086
|
+
*
|
|
1087
|
+
* # Example
|
|
1088
|
+
* ```ts
|
|
1089
|
+
* const ring = await snaptrude.core.geom.create.brepFromTorus(
|
|
1090
|
+
* { x: 0, y: 6, z: 0 },
|
|
1091
|
+
* { x: 0, y: 1, z: 0 },
|
|
1092
|
+
* 5,
|
|
1093
|
+
* 1,
|
|
1094
|
+
* )
|
|
1095
|
+
* ```
|
|
1096
|
+
*/
|
|
1097
|
+
abstract brepFromTorus(centre: Vec3Components, axis: Vec3Components, majorRadius: number, minorRadius: number): PluginApiReturn<BrepHandle>;
|
|
756
1098
|
}
|
|
757
1099
|
/**
|
|
758
1100
|
* Arguments for {@linkcode PluginGeomCreateApi.line}.
|
|
@@ -799,6 +1141,32 @@ export declare const PluginGeomCreateCircleArgs: z.ZodObject<{
|
|
|
799
1141
|
radius: z.ZodNumber;
|
|
800
1142
|
}, z.core.$strip>;
|
|
801
1143
|
export type PluginGeomCreateCircleArgs = z.infer<typeof PluginGeomCreateCircleArgs>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Arguments for {@linkcode PluginGeomCreateApi.splineFromPoints}.
|
|
1146
|
+
*
|
|
1147
|
+
* | Property | Type | Description |
|
|
1148
|
+
* |---|---|---|
|
|
1149
|
+
* | `points` | {@linkcode Vec3Handle}`[]` | 3..256 ordered through-points of the curve |
|
|
1150
|
+
*/
|
|
1151
|
+
export declare const PluginGeomCreateSplineFromPointsArgs: z.ZodObject<{
|
|
1152
|
+
points: z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>, z.ZodTransform<import("../../../..").Handle<"vec3">, string>>>;
|
|
1153
|
+
}, z.core.$strip>;
|
|
1154
|
+
export type PluginGeomCreateSplineFromPointsArgs = z.infer<typeof PluginGeomCreateSplineFromPointsArgs>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Arguments for {@linkcode PluginGeomCreateApi.splineFromControlPoints}.
|
|
1157
|
+
*
|
|
1158
|
+
* | Property | Type | Description |
|
|
1159
|
+
* |---|---|---|
|
|
1160
|
+
* | `controlPoints` | {@linkcode Vec3Handle}`[]` | 3..512 control points of the curve, in order |
|
|
1161
|
+
* | `options` | `object`? | `degree`: 2 or 3 (default `min(3, controlPoints.length - 1)`) |
|
|
1162
|
+
*/
|
|
1163
|
+
export declare const PluginGeomCreateSplineFromControlPointsArgs: z.ZodObject<{
|
|
1164
|
+
controlPoints: z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>, z.ZodTransform<import("../../../..").Handle<"vec3">, string>>>;
|
|
1165
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
1166
|
+
degree: z.ZodOptional<z.ZodNumber>;
|
|
1167
|
+
}, z.core.$strip>>;
|
|
1168
|
+
}, z.core.$strip>;
|
|
1169
|
+
export type PluginGeomCreateSplineFromControlPointsArgs = z.infer<typeof PluginGeomCreateSplineFromControlPointsArgs>;
|
|
802
1170
|
/**
|
|
803
1171
|
* Arguments for {@linkcode PluginGeomCreateApi.profileFromLinePoints}.
|
|
804
1172
|
*
|
|
@@ -818,9 +1186,20 @@ export type PluginGeomCreateProfileFromLinePointsArgs = z.infer<typeof PluginGeo
|
|
|
818
1186
|
* | `curves` | {@linkcode CurveHandle}`[]` | Ordered curve handles forming a closed loop |
|
|
819
1187
|
*/
|
|
820
1188
|
export declare const PluginGeomCreateProfileFromCurvesArgs: z.ZodObject<{
|
|
821
|
-
curves: z.ZodArray<z.
|
|
1189
|
+
curves: z.ZodArray<z.ZodType<CurveHandle, unknown, z.core.$ZodTypeInternals<CurveHandle, unknown>>>;
|
|
822
1190
|
}, z.core.$strip>;
|
|
823
1191
|
export type PluginGeomCreateProfileFromCurvesArgs = z.infer<typeof PluginGeomCreateProfileFromCurvesArgs>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Arguments for {@linkcode PluginGeomCreateApi.profileFromSplinePoints}.
|
|
1194
|
+
*
|
|
1195
|
+
* | Property | Type | Description |
|
|
1196
|
+
* |---|---|---|
|
|
1197
|
+
* | `points` | {@linkcode Vec3Handle}`[]` | 3..256 ordered through-points of the closed loop (first point NOT repeated) |
|
|
1198
|
+
*/
|
|
1199
|
+
export declare const PluginGeomCreateProfileFromSplinePointsArgs: z.ZodObject<{
|
|
1200
|
+
points: z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>, z.ZodTransform<import("../../../..").Handle<"vec3">, string>>>;
|
|
1201
|
+
}, z.core.$strip>;
|
|
1202
|
+
export type PluginGeomCreateProfileFromSplinePointsArgs = z.infer<typeof PluginGeomCreateProfileFromSplinePointsArgs>;
|
|
824
1203
|
/**
|
|
825
1204
|
* Arguments for {@linkcode PluginGeomCreateApi.contourFromProfile}.
|
|
826
1205
|
*
|
|
@@ -886,7 +1265,7 @@ export type PluginGeomCreateBrepFromExtrusionArgs = z.infer<typeof PluginGeomCre
|
|
|
886
1265
|
* |---|---|---|
|
|
887
1266
|
* | `bottomContour` | {@linkcode ContourHandle} | The bottom cross-section |
|
|
888
1267
|
* | `topContour` | {@linkcode ContourHandle} | The top cross-section |
|
|
889
|
-
* | `intermediateContours` | {@linkcode ContourHandle}`[]`? | Optional in-between cross-sections, ordered bottom to top |
|
|
1268
|
+
* | `intermediateContours` | {@linkcode ContourHandle}`[]`? | Optional in-between cross-sections, ordered bottom to top (any count; more than 32 sections in all builds but carries no parameter record) |
|
|
890
1269
|
* | `options` | `object`? | Optional behavior switches: `compatibility` (`"strict"` throws on mismatched edge counts instead of auto-matching; default `"auto"`) and `seamAlignment` (`"authored"` keeps the authored correspondence instead of searching seam rotations; default `"auto"`) |
|
|
891
1270
|
*/
|
|
892
1271
|
export declare const PluginGeomCreateBrepFromLoftArgs: z.ZodObject<{
|
|
@@ -944,7 +1323,7 @@ export type PluginGeomCreateBrepBooleanArgs = z.infer<typeof PluginGeomCreateBre
|
|
|
944
1323
|
* | Property | Type | Description |
|
|
945
1324
|
* |---|---|---|
|
|
946
1325
|
* | `brep` | {@linkcode BrepHandle} | The solid whose edges to round |
|
|
947
|
-
* | `edges` | {@linkcode EdgeHandle}`[]` | The
|
|
1326
|
+
* | `edges` | {@linkcode EdgeHandle}`[]` | The edges to fillet (one or more; more than 64 builds but carries no parameter record) |
|
|
948
1327
|
* | `radius` | `number` | Fillet radius (positive, finite) |
|
|
949
1328
|
*/
|
|
950
1329
|
export declare const PluginGeomCreateBrepFromFilletArgs: z.ZodObject<{
|
|
@@ -972,7 +1351,7 @@ export type PluginGeomCreateBrepFromOffsetArgs = z.infer<typeof PluginGeomCreate
|
|
|
972
1351
|
* | Property | Type | Description |
|
|
973
1352
|
* |---|---|---|
|
|
974
1353
|
* | `brep` | {@linkcode BrepHandle} | The solid to hollow |
|
|
975
|
-
* | `openFaces` | {@linkcode FaceHandle}`[]` | The faces to remove as openings (
|
|
1354
|
+
* | `openFaces` | {@linkcode FaceHandle}`[]` | The faces to remove as openings (one or more; more than 32 builds but carries no parameter record) |
|
|
976
1355
|
* | `thickness` | `number` | Wall thickness (positive, finite) |
|
|
977
1356
|
*/
|
|
978
1357
|
export declare const PluginGeomCreateBrepFromShellArgs: z.ZodObject<{
|
|
@@ -1010,7 +1389,7 @@ export type PluginGeomCreateBrepsFromSplitArgs = z.infer<typeof PluginGeomCreate
|
|
|
1010
1389
|
* | Property | Type | Description |
|
|
1011
1390
|
* |---|---|---|
|
|
1012
1391
|
* | `brep` | {@linkcode BrepHandle} | The solid whose edges to bevel |
|
|
1013
|
-
* | `edges` | {@linkcode EdgeHandle}`[]` | The
|
|
1392
|
+
* | `edges` | {@linkcode EdgeHandle}`[]` | The edges to chamfer (one or more; more than 64 builds but carries no parameter record) |
|
|
1014
1393
|
* | `distance` | `number` | Chamfer distance from the edge on each adjacent face (positive, finite) |
|
|
1015
1394
|
*/
|
|
1016
1395
|
export declare const PluginGeomCreateBrepFromChamferArgs: z.ZodObject<{
|
|
@@ -1025,8 +1404,8 @@ export type PluginGeomCreateBrepFromChamferArgs = z.infer<typeof PluginGeomCreat
|
|
|
1025
1404
|
* | Property | Type | Description |
|
|
1026
1405
|
* |---|---|---|
|
|
1027
1406
|
* | `profile` | {@linkcode ContourHandle} | The cross-section to sweep (hole-free) |
|
|
1028
|
-
* | `path` | {@linkcode Vec3Components}`[]` | The polyline path (
|
|
1029
|
-
* | `options` | `object`? | Optional scale law: `startScale`/`endScale` (linear taper by arc length) or per-point `scales` (mutually exclusive; factors finite, 1e-3..1e3; `scales.length` must equal `path.length`). Optional corner `transition`: `"miter"` (default) or `{ bevel }` (chamfered corners; finite, 1e-3..1e3) |
|
|
1407
|
+
* | `path` | {@linkcode Vec3Components}`[]` | The polyline path (2 or more points, finite components — more than 512 builds but carries no parameter record; repeating the first point as the last closes it into a ring — closed paths must be flat and straight-segmented and take a straight-edged profile) |
|
|
1408
|
+
* | `options` | `object`? | Optional scale law: `startScale`/`endScale` (linear taper by arc length) or per-point `scales` (mutually exclusive; factors finite, 1e-3..1e3; `scales.length` must equal `path.length`). Optional corner `transition`: `"miter"` (default), `"round"` (arc-carried corners) or `{ bevel }` (chamfered corners; finite, 1e-3..1e3) |
|
|
1030
1409
|
*/
|
|
1031
1410
|
export declare const PluginGeomCreateBrepFromSweepArgs: z.ZodObject<{
|
|
1032
1411
|
profile: z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>, z.ZodTransform<import("../../../..").Handle<"contour">, string>>;
|
|
@@ -1039,7 +1418,7 @@ export declare const PluginGeomCreateBrepFromSweepArgs: z.ZodObject<{
|
|
|
1039
1418
|
startScale: z.ZodOptional<z.ZodNumber>;
|
|
1040
1419
|
endScale: z.ZodOptional<z.ZodNumber>;
|
|
1041
1420
|
scales: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
1042
|
-
transition: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"miter">, z.ZodObject<{
|
|
1421
|
+
transition: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"miter">, z.ZodLiteral<"round">, z.ZodObject<{
|
|
1043
1422
|
bevel: z.ZodNumber;
|
|
1044
1423
|
}, z.core.$strip>]>>;
|
|
1045
1424
|
}, z.core.$strip>>;
|
|
@@ -1051,8 +1430,8 @@ export type PluginGeomCreateBrepFromSweepArgs = z.infer<typeof PluginGeomCreateB
|
|
|
1051
1430
|
* | Property | Type | Description |
|
|
1052
1431
|
* |---|---|---|
|
|
1053
1432
|
* | `profile` | {@linkcode ContourHandle} | The cross-section to revolve (holes allowed) |
|
|
1054
|
-
* | `axisOrigin` | {@linkcode Vec3Components} | A point on the revolution axis (finite components) |
|
|
1055
|
-
* | `axisDirection` | {@linkcode Vec3Components} | The axis direction (non-zero, finite components) |
|
|
1433
|
+
* | `axisOrigin` | {@linkcode Vec3Components} | A point on the revolution axis (finite components; the axis must lie in the profile's plane) |
|
|
1434
|
+
* | `axisDirection` | {@linkcode Vec3Components} | The axis direction (non-zero, finite components; the axis must lie in the profile's plane) |
|
|
1056
1435
|
* | `angleInDegrees` | `number`? | Revolution angle in degrees (0 < angle ≤ 360; default 360) |
|
|
1057
1436
|
*/
|
|
1058
1437
|
export declare const PluginGeomCreateBrepFromRevolutionArgs: z.ZodObject<{
|
|
@@ -1070,4 +1449,98 @@ export declare const PluginGeomCreateBrepFromRevolutionArgs: z.ZodObject<{
|
|
|
1070
1449
|
angleInDegrees: z.ZodOptional<z.ZodNumber>;
|
|
1071
1450
|
}, z.core.$strip>;
|
|
1072
1451
|
export type PluginGeomCreateBrepFromRevolutionArgs = z.infer<typeof PluginGeomCreateBrepFromRevolutionArgs>;
|
|
1452
|
+
/**
|
|
1453
|
+
* Arguments for {@linkcode PluginGeomCreateApi.brepFromSphere}.
|
|
1454
|
+
*
|
|
1455
|
+
* | Property | Type | Description |
|
|
1456
|
+
* |---|---|---|
|
|
1457
|
+
* | `centre` | {@linkcode Vec3Components} | Sphere centre (finite components) |
|
|
1458
|
+
* | `radius` | `number` | Sphere radius (finite; positivity is checked host-side so the error names the parameter) |
|
|
1459
|
+
*/
|
|
1460
|
+
export declare const PluginGeomCreateBrepFromSphereArgs: z.ZodObject<{
|
|
1461
|
+
centre: z.ZodObject<{
|
|
1462
|
+
x: z.ZodNumber;
|
|
1463
|
+
y: z.ZodNumber;
|
|
1464
|
+
z: z.ZodNumber;
|
|
1465
|
+
}, z.core.$strip>;
|
|
1466
|
+
radius: z.ZodNumber;
|
|
1467
|
+
}, z.core.$strip>;
|
|
1468
|
+
export type PluginGeomCreateBrepFromSphereArgs = z.infer<typeof PluginGeomCreateBrepFromSphereArgs>;
|
|
1469
|
+
/**
|
|
1470
|
+
* Arguments for {@linkcode PluginGeomCreateApi.brepFromCylinder}.
|
|
1471
|
+
*
|
|
1472
|
+
* | Property | Type | Description |
|
|
1473
|
+
* |---|---|---|
|
|
1474
|
+
* | `base` | {@linkcode Vec3Components} | Centre of the bottom cap (finite components) |
|
|
1475
|
+
* | `axis` | {@linkcode Vec3Components} | Axis direction (non-zero, finite components) |
|
|
1476
|
+
* | `radius` | `number` | Cylinder radius (finite, positive) |
|
|
1477
|
+
* | `height` | `number` | Height along `axis` (finite, positive) |
|
|
1478
|
+
*/
|
|
1479
|
+
export declare const PluginGeomCreateBrepFromCylinderArgs: z.ZodObject<{
|
|
1480
|
+
base: z.ZodObject<{
|
|
1481
|
+
x: z.ZodNumber;
|
|
1482
|
+
y: z.ZodNumber;
|
|
1483
|
+
z: z.ZodNumber;
|
|
1484
|
+
}, z.core.$strip>;
|
|
1485
|
+
axis: z.ZodObject<{
|
|
1486
|
+
x: z.ZodNumber;
|
|
1487
|
+
y: z.ZodNumber;
|
|
1488
|
+
z: z.ZodNumber;
|
|
1489
|
+
}, z.core.$strip>;
|
|
1490
|
+
radius: z.ZodNumber;
|
|
1491
|
+
height: z.ZodNumber;
|
|
1492
|
+
}, z.core.$strip>;
|
|
1493
|
+
export type PluginGeomCreateBrepFromCylinderArgs = z.infer<typeof PluginGeomCreateBrepFromCylinderArgs>;
|
|
1494
|
+
/**
|
|
1495
|
+
* Arguments for {@linkcode PluginGeomCreateApi.brepFromCone}.
|
|
1496
|
+
*
|
|
1497
|
+
* | Property | Type | Description |
|
|
1498
|
+
* |---|---|---|
|
|
1499
|
+
* | `base` | {@linkcode Vec3Components} | Centre of the bottom cap (finite components) |
|
|
1500
|
+
* | `axis` | {@linkcode Vec3Components} | Axis direction (non-zero, finite components) |
|
|
1501
|
+
* | `baseRadius` | `number` | Radius at the base (finite, positive) |
|
|
1502
|
+
* | `height` | `number` | Height along `axis` (finite, positive) |
|
|
1503
|
+
* | `topRadius` | `number`? | Radius at the top (finite, ≥ 0, ≠ `baseRadius`; default 0 = apex) |
|
|
1504
|
+
*/
|
|
1505
|
+
export declare const PluginGeomCreateBrepFromConeArgs: z.ZodObject<{
|
|
1506
|
+
base: z.ZodObject<{
|
|
1507
|
+
x: z.ZodNumber;
|
|
1508
|
+
y: z.ZodNumber;
|
|
1509
|
+
z: z.ZodNumber;
|
|
1510
|
+
}, z.core.$strip>;
|
|
1511
|
+
axis: z.ZodObject<{
|
|
1512
|
+
x: z.ZodNumber;
|
|
1513
|
+
y: z.ZodNumber;
|
|
1514
|
+
z: z.ZodNumber;
|
|
1515
|
+
}, z.core.$strip>;
|
|
1516
|
+
baseRadius: z.ZodNumber;
|
|
1517
|
+
height: z.ZodNumber;
|
|
1518
|
+
topRadius: z.ZodOptional<z.ZodNumber>;
|
|
1519
|
+
}, z.core.$strip>;
|
|
1520
|
+
export type PluginGeomCreateBrepFromConeArgs = z.infer<typeof PluginGeomCreateBrepFromConeArgs>;
|
|
1521
|
+
/**
|
|
1522
|
+
* Arguments for {@linkcode PluginGeomCreateApi.brepFromTorus}.
|
|
1523
|
+
*
|
|
1524
|
+
* | Property | Type | Description |
|
|
1525
|
+
* |---|---|---|
|
|
1526
|
+
* | `centre` | {@linkcode Vec3Components} | Torus centre (finite components) |
|
|
1527
|
+
* | `axis` | {@linkcode Vec3Components} | Plane normal of the ring (non-zero, finite components) |
|
|
1528
|
+
* | `majorRadius` | `number` | Ring radius, centre to tube centre (finite, positive) |
|
|
1529
|
+
* | `minorRadius` | `number` | Tube radius (finite, positive, strictly less than `majorRadius`) |
|
|
1530
|
+
*/
|
|
1531
|
+
export declare const PluginGeomCreateBrepFromTorusArgs: z.ZodObject<{
|
|
1532
|
+
centre: z.ZodObject<{
|
|
1533
|
+
x: z.ZodNumber;
|
|
1534
|
+
y: z.ZodNumber;
|
|
1535
|
+
z: z.ZodNumber;
|
|
1536
|
+
}, z.core.$strip>;
|
|
1537
|
+
axis: z.ZodObject<{
|
|
1538
|
+
x: z.ZodNumber;
|
|
1539
|
+
y: z.ZodNumber;
|
|
1540
|
+
z: z.ZodNumber;
|
|
1541
|
+
}, z.core.$strip>;
|
|
1542
|
+
majorRadius: z.ZodNumber;
|
|
1543
|
+
minorRadius: z.ZodNumber;
|
|
1544
|
+
}, z.core.$strip>;
|
|
1545
|
+
export type PluginGeomCreateBrepFromTorusArgs = z.infer<typeof PluginGeomCreateBrepFromTorusArgs>;
|
|
1073
1546
|
//# sourceMappingURL=index.d.ts.map
|