@snaptrude/plugin-core 0.0.0-dev-20260907135026 → 0.0.0-dev-20260908074328
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/CHANGELOG.md +23 -0
- package/api-manifest.json +12 -151
- package/dist/api/core/geom/create/index.d.ts +86 -559
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/brep.d.ts +0 -50
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/curve.d.ts +35 -58
- 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 +0 -45
- 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/create/index.d.ts +29 -6
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +20 -2
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/query/geometry/index.d.ts +1 -27
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +2 -47
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/spaces.d.ts +66 -5
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +0 -87
- 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 +7 -5
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +4 -4
- package/dist/api/presentation/placedViews.d.ts +35 -1
- package/dist/api/presentation/placedViews.d.ts.map +1 -1
- package/dist/api/presentation/sheets.d.ts +20 -2
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +4 -4
- package/dist/errors/codes.d.ts +8 -3
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/handles.d.ts +3 -12
- package/dist/handles.d.ts.map +1 -1
- package/dist/index.cjs +2766 -3030
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2761 -2996
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/snaptrude-plugin-core-0.11.0.tgz +0 -0
- package/src/api/core/geom/create/index.ts +84 -588
- package/src/api/core/geom/query/brep.ts +0 -51
- package/src/api/core/geom/query/curve.ts +2 -25
- package/src/api/core/geom/query/edge.ts +2 -2
- package/src/api/core/geom/query/face.ts +0 -49
- package/src/api/design/create/index.ts +34 -8
- package/src/api/design/delete/index.ts +20 -1
- package/src/api/design/query/geometry/index.ts +0 -29
- package/src/api/design/query/index.ts +2 -50
- package/src/api/design/query/spaces.ts +68 -0
- package/src/api/design/update/index.ts +0 -94
- package/src/api/entity/space.ts +2 -0
- package/src/api/presentation/placedViews.ts +29 -1
- package/src/api/presentation/sheets.ts +19 -3
- package/src/errors/codes.ts +30 -2
- package/src/handles.ts +3 -15
- package/src/index.ts +0 -1
- package/test/errors.test.mjs +4 -0
- package/dist/massParameters.d.ts +0 -319
- package/dist/massParameters.d.ts.map +0 -1
- package/src/massParameters.ts +0 -472
- package/test/massParameters.test.mjs +0 -500
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { PluginApiReturn } from "../../../../types";
|
|
3
|
-
import { Vec3Handle, LineHandle, ArcHandle,
|
|
3
|
+
import { Vec3Handle, LineHandle, ArcHandle, 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
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `snaptrude.core.geom.query.*` methods.
|
|
9
|
+
* curve handle ({@linkcode LineHandle} or {@linkcode ArcHandle}) that you pass to
|
|
10
|
+
* query, update, or entity-creation methods. Read geometry back as plain values
|
|
11
|
+
* via the `snaptrude.core.geom.query.*` methods.
|
|
13
12
|
*
|
|
14
13
|
* Accessed via `snaptrude.core.geom.create`.
|
|
15
14
|
*/
|
|
@@ -70,72 +69,6 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
70
69
|
* ```
|
|
71
70
|
*/
|
|
72
71
|
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>;
|
|
139
72
|
/**
|
|
140
73
|
* Create a closed profile from an ordered list of point handles connected by
|
|
141
74
|
* line segments (last auto-connected to first). Host API call — returns a handle.
|
|
@@ -167,38 +100,6 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
167
100
|
* ```
|
|
168
101
|
*/
|
|
169
102
|
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>;
|
|
202
103
|
/**
|
|
203
104
|
* Create an axis-aligned **rectangle** profile (XZ plane) of `width` × `depth`,
|
|
204
105
|
* centred at `center` (defaults to the origin). Host API call — returns a handle.
|
|
@@ -356,9 +257,7 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
356
257
|
* bottom — sections are auto-matched)
|
|
357
258
|
* @param intermediateContours Optional in-between cross-sections, ordered
|
|
358
259
|
* bottom to top (hole-free; edge counts may differ — every section is
|
|
359
|
-
* normalized to the largest)
|
|
360
|
-
* than 32 sections counting the bottom and the top still builds but
|
|
361
|
-
* carries no parameter record (records are capped, calls are not)
|
|
260
|
+
* normalized to the largest)
|
|
362
261
|
* @param options Optional behavior switches. `compatibility` — `"auto"`
|
|
363
262
|
* (default) inserts vertices to match differing edge counts; `"strict"`
|
|
364
263
|
* skips normalization and throws VALIDATION when outer edge counts (or,
|
|
@@ -533,66 +432,38 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
533
432
|
*/
|
|
534
433
|
abstract brepFromIntersection(a: BrepHandle, b: BrepHandle): PluginApiReturn<BrepHandle>;
|
|
535
434
|
/**
|
|
536
|
-
* Rounds the given edges of a solid with a constant radius. Host
|
|
537
|
-
* returns a new {@linkcode BrepHandle}; the input brep is
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
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).
|
|
435
|
+
* Rounds the given straight edges of a solid with a constant radius. Host
|
|
436
|
+
* API call — returns a new {@linkcode BrepHandle}; the input brep is
|
|
437
|
+
* read-only.
|
|
438
|
+
*
|
|
439
|
+
* v1 fillets straight edges only, and no two filleted edges may share a
|
|
440
|
+
* vertex — corner blends produce spherical patches Snaptrude cannot
|
|
441
|
+
* represent. Runs on the OpenCascade kernel (the first kernel call loads a
|
|
442
|
+
* wasm of tens of MB — expect a pause of seconds).
|
|
556
443
|
*
|
|
557
444
|
* Inspect the result via `core.geom.query.brep.*`, or commit it to the scene
|
|
558
445
|
* with `design.create.massFromBrep`.
|
|
559
446
|
*
|
|
560
447
|
* @param brep The solid whose edges to round
|
|
561
|
-
* @param edges The edges to fillet (
|
|
562
|
-
* duplicates; more than 64 still fillets but the result carries no
|
|
563
|
-
* parameter record)
|
|
448
|
+
* @param edges The straight edges to fillet (≥1, all on `brep`, no two sharing a vertex)
|
|
564
449
|
* @param radius Fillet radius (positive, finite)
|
|
565
450
|
* @returns The filleted solid as a new {@linkcode BrepHandle}
|
|
566
|
-
* @throws VALIDATION if `edges` is empty
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
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
|
|
451
|
+
* @throws VALIDATION if `edges` is empty, `radius` is not a positive finite
|
|
452
|
+
* number, an edge is not on `brep`, an edge is an arc (v1 fillets straight
|
|
453
|
+
* edges only), or two edges share a vertex (fillet non-adjacent edges)
|
|
454
|
+
* @throws OPERATION_FAILED if the kernel cannot build the fillet (the radius
|
|
455
|
+
* likely exceeds the adjacent face size — reduce it) or the result
|
|
456
|
+
* contains curved surfaces Snaptrude cannot represent
|
|
457
|
+
*
|
|
458
|
+
* @examplePrompt Round the edges of this mass
|
|
580
459
|
* @examplePrompt Fillet the corners of the podium with a 0.5m radius
|
|
581
460
|
* @examplePrompt Soften the vertical edges of this tower
|
|
582
461
|
*
|
|
583
462
|
* # Example
|
|
584
463
|
* ```ts
|
|
585
|
-
*
|
|
586
|
-
* const edges = await snaptrude.core.geom.query.brep.listEdges(
|
|
587
|
-
* const
|
|
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
|
|
464
|
+
* const brep = await snaptrude.core.geom.create.brepFromExtrusion(contour, { x: 0, y: 1, z: 0 }, 3)
|
|
465
|
+
* const edges = await snaptrude.core.geom.query.brep.listEdges(brep)
|
|
466
|
+
* const rounded = await snaptrude.core.geom.create.brepFromFillet(brep, [edges[0]], 0.3)
|
|
596
467
|
* ```
|
|
597
468
|
*/
|
|
598
469
|
abstract brepFromFillet(brep: BrepHandle, edges: EdgeHandle[], radius: number): PluginApiReturn<BrepHandle>;
|
|
@@ -601,14 +472,6 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
601
472
|
* moves faces outward, negative moves them inward. Host API call — returns
|
|
602
473
|
* a new {@linkcode BrepHandle}; the input brep is read-only.
|
|
603
474
|
*
|
|
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
|
-
*
|
|
612
475
|
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of
|
|
613
476
|
* tens of MB — expect a pause of seconds).
|
|
614
477
|
*
|
|
@@ -620,15 +483,9 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
620
483
|
* @returns The offset solid as a new {@linkcode BrepHandle}
|
|
621
484
|
* @throws VALIDATION if `distance` is not finite, is too small to offset
|
|
622
485
|
* anything, or an inward distance consumes the solid entirely
|
|
623
|
-
* @throws OPERATION_FAILED if the kernel
|
|
624
|
-
* result
|
|
625
|
-
*
|
|
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
|
|
486
|
+
* @throws OPERATION_FAILED if the kernel cannot build the offset or the
|
|
487
|
+
* result contains curved surfaces Snaptrude cannot represent
|
|
488
|
+
*
|
|
632
489
|
* @examplePrompt Grow this solid by 0.5m in every direction
|
|
633
490
|
* @examplePrompt Shrink this mass by 200mm
|
|
634
491
|
* @examplePrompt Offset the building envelope outward by 1m
|
|
@@ -646,17 +503,6 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
646
503
|
* input brep is read-only. The outer surface is kept and the walls grow
|
|
647
504
|
* inward.
|
|
648
505
|
*
|
|
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
|
-
*
|
|
660
506
|
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of
|
|
661
507
|
* tens of MB — expect a pause of seconds).
|
|
662
508
|
*
|
|
@@ -664,36 +510,24 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
664
510
|
* with `design.create.massFromBrep`.
|
|
665
511
|
*
|
|
666
512
|
* @param brep The solid to hollow
|
|
667
|
-
* @param openFaces The faces to remove as openings (
|
|
668
|
-
* `brep`, no duplicates; more than 32 still shells but the result carries
|
|
669
|
-
* no parameter record)
|
|
513
|
+
* @param openFaces The faces to remove as openings (≥1, all on `brep`)
|
|
670
514
|
* @param thickness Wall thickness (positive, finite, smaller than half the solid's smallest span)
|
|
671
515
|
* @returns The hollowed solid as a new {@linkcode BrepHandle}
|
|
672
|
-
* @throws VALIDATION if `openFaces` is empty
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
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
|
|
516
|
+
* @throws VALIDATION if `openFaces` is empty, a face is not on `brep`,
|
|
517
|
+
* `thickness` is not a positive finite number, or the thickness is too
|
|
518
|
+
* large (it must be smaller than half the solid's smallest span)
|
|
519
|
+
* @throws OPERATION_FAILED if the kernel cannot build the shell or the
|
|
520
|
+
* result contains curved surfaces Snaptrude cannot represent
|
|
521
|
+
*
|
|
684
522
|
* @examplePrompt Hollow this mass into 200mm walls
|
|
685
523
|
* @examplePrompt Shell this form with the top face open
|
|
686
524
|
* @examplePrompt Turn this solid tower into a tube open at both ends
|
|
687
525
|
*
|
|
688
526
|
* # Example
|
|
689
527
|
* ```ts
|
|
690
|
-
*
|
|
691
|
-
* const faces = await snaptrude.core.geom.query.brep.listFaces(
|
|
692
|
-
* const
|
|
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
|
|
528
|
+
* const brep = await snaptrude.core.geom.create.brepFromExtrusion(contour, { x: 0, y: 1, z: 0 }, 3)
|
|
529
|
+
* const faces = await snaptrude.core.geom.query.brep.listFaces(brep)
|
|
530
|
+
* const hollow = await snaptrude.core.geom.create.brepFromShell(brep, [faces[0]], 0.2)
|
|
697
531
|
* ```
|
|
698
532
|
*/
|
|
699
533
|
abstract brepFromShell(brep: BrepHandle, openFaces: FaceHandle[], thickness: number): PluginApiReturn<BrepHandle>;
|
|
@@ -733,48 +567,28 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
733
567
|
*/
|
|
734
568
|
abstract brepsFromSplit(brep: BrepHandle, planeOrigin: Vec3Components, planeNormal: Vec3Components): PluginApiReturn<BrepHandle[]>;
|
|
735
569
|
/**
|
|
736
|
-
* Bevels the given edges of a solid with a symmetric planar cut.
|
|
737
|
-
* call — returns a new {@linkcode BrepHandle}; the input brep is
|
|
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`.
|
|
570
|
+
* Bevels the given straight edges of a solid with a symmetric planar cut.
|
|
571
|
+
* Host API call — returns a new {@linkcode BrepHandle}; the input brep is
|
|
572
|
+
* read-only.
|
|
750
573
|
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
574
|
+
* v1 chamfers straight edges only, and no two chamfered edges may share a
|
|
575
|
+
* vertex. Runs on the OpenCascade kernel (the first kernel call loads a
|
|
576
|
+
* wasm of tens of MB — expect a pause of seconds).
|
|
753
577
|
*
|
|
754
578
|
* Inspect the result via `core.geom.query.brep.*`, or commit it to the scene
|
|
755
579
|
* with `design.create.massFromBrep`.
|
|
756
580
|
*
|
|
757
581
|
* @param brep The solid whose edges to bevel
|
|
758
|
-
* @param edges The edges to chamfer (
|
|
759
|
-
* duplicates; more than 64 still chamfers but the result carries no
|
|
760
|
-
* parameter record)
|
|
582
|
+
* @param edges The straight edges to chamfer (≥1, all on `brep`, no two sharing a vertex)
|
|
761
583
|
* @param distance Chamfer distance from the edge on each adjacent face (positive, finite)
|
|
762
584
|
* @returns The chamfered solid as a new {@linkcode BrepHandle}
|
|
763
|
-
* @throws VALIDATION if `edges` is empty
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
* @throws
|
|
768
|
-
*
|
|
769
|
-
*
|
|
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
|
|
585
|
+
* @throws VALIDATION if `edges` is empty, `distance` is not a positive
|
|
586
|
+
* finite number, an edge is not on `brep`, an edge is an arc (v1 chamfers
|
|
587
|
+
* straight edges only), or two edges share a vertex (chamfer non-adjacent
|
|
588
|
+
* edges)
|
|
589
|
+
* @throws OPERATION_FAILED if the kernel cannot build the chamfer (the
|
|
590
|
+
* distance likely exceeds the adjacent face size — reduce it)
|
|
591
|
+
*
|
|
778
592
|
* @examplePrompt Bevel these edges by 100mm
|
|
779
593
|
* @examplePrompt Chamfer the top edges of the plinth
|
|
780
594
|
* @examplePrompt Cut a 45-degree flat along the corners of this mass
|
|
@@ -805,15 +619,11 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
805
619
|
* tapering across a bend or along an arc edge would create faces Snaptrude
|
|
806
620
|
* cannot represent and throws (sweep each straight run separately and union
|
|
807
621
|
* the results instead). An optional `transition` picks the corner
|
|
808
|
-
* treatment: `"miter"` (default) is today's sharp mitred bend;
|
|
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);
|
|
622
|
+
* treatment: `"miter"` (default) is today's sharp mitred bend;
|
|
812
623
|
* `{ bevel: b }` chamfers each turning corner by cutting `b` back along
|
|
813
624
|
* both adjacent legs (works on open and closed paths — each leg must be
|
|
814
|
-
* long enough for its cuts). On a corner-less path `transition` has no
|
|
815
|
-
*
|
|
816
|
-
* a corner.
|
|
625
|
+
* long enough for its cuts). On a corner-less path `transition` has no effect, and the
|
|
626
|
+
* varying-scale lane takes straight paths, so it never sees a corner.
|
|
817
627
|
*
|
|
818
628
|
* Open paths run on the OpenCascade kernel (the first kernel call loads a
|
|
819
629
|
* wasm of tens of MB — expect a pause of seconds); closed paths are
|
|
@@ -823,22 +633,19 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
823
633
|
* with `design.create.massFromBrep`.
|
|
824
634
|
*
|
|
825
635
|
* @param profile The cross-section to sweep (hole-free contour)
|
|
826
|
-
* @param path The polyline path as plain `{x, y, z}` points (2
|
|
827
|
-
*
|
|
828
|
-
* than 512 points still sweeps but the result carries no parameter record)
|
|
636
|
+
* @param path The polyline path as plain `{x, y, z}` points (≥2; repeat the
|
|
637
|
+
* first point as the last to close the path into a ring)
|
|
829
638
|
* @param options Optional scale law and corner transition. Scale law:
|
|
830
639
|
* `startScale`/`endScale` (linear taper by arc length) or `scales` (one
|
|
831
640
|
* factor per path point; mutually exclusive with
|
|
832
641
|
* `startScale`/`endScale`); every factor must be finite and within
|
|
833
|
-
* 1e-3..1e3. `transition`: `"miter"` (default, sharp corners)
|
|
834
|
-
* `
|
|
835
|
-
*
|
|
836
|
-
* 1e-3..1e3; open and closed paths)
|
|
642
|
+
* 1e-3..1e3. `transition`: `"miter"` (default, sharp corners) or
|
|
643
|
+
* `{ bevel: b }` (chamfered corners, `b` finite within 1e-3..1e3; open
|
|
644
|
+
* and closed paths)
|
|
837
645
|
* @returns The swept solid as a new {@linkcode BrepHandle}
|
|
838
646
|
* @throws VALIDATION if the profile has holes, the path has fewer than 2
|
|
839
|
-
* points, consecutive path points coincide, a
|
|
840
|
-
*
|
|
841
|
-
* path segment's direction
|
|
647
|
+
* points, consecutive path points coincide, a coordinate is not finite,
|
|
648
|
+
* or the profile plane contains the first path segment's direction
|
|
842
649
|
* (degenerate sweep); for closed paths, if the ring has fewer than 3
|
|
843
650
|
* distinct corners, the path is non-planar, a corner doubles back, the
|
|
844
651
|
* profile has an arc edge, or the profile is too large for a mitred
|
|
@@ -846,14 +653,11 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
846
653
|
* is combined with `startScale`/`endScale`, `scales` does not match the
|
|
847
654
|
* path length, or a varying scale is used on a bent or closed path or
|
|
848
655
|
* with an arc-edged profile; for `{ bevel }`, if a leg is too short for
|
|
849
|
-
* the cuts its
|
|
850
|
-
* back so its
|
|
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
|
|
656
|
+
* the cuts its beveled corners take from it or a corner nearly doubles
|
|
657
|
+
* back so its chamfer collapses (the errors name the corner)
|
|
854
658
|
* @throws OPERATION_FAILED if the kernel cannot sweep the profile into a
|
|
855
|
-
* valid solid
|
|
856
|
-
*
|
|
659
|
+
* valid solid or a transition patch is a curved surface Snaptrude cannot
|
|
660
|
+
* represent
|
|
857
661
|
*
|
|
858
662
|
* @examplePrompt Sweep this profile along the corridor path
|
|
859
663
|
* @examplePrompt Extrude the railing section along this route
|
|
@@ -862,7 +666,6 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
862
666
|
* @examplePrompt Taper this duct from 1x1 to 2x2 along its run
|
|
863
667
|
* @examplePrompt Sweep a column section that narrows toward the top
|
|
864
668
|
* @examplePrompt Chamfer the corners of this swept frame by 200mm
|
|
865
|
-
* @examplePrompt Sweep this handrail with rounded corners at the bends
|
|
866
669
|
*
|
|
867
670
|
* # Example
|
|
868
671
|
* ```ts
|
|
@@ -898,7 +701,7 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
898
701
|
startScale?: number;
|
|
899
702
|
endScale?: number;
|
|
900
703
|
scales?: number[];
|
|
901
|
-
transition?: "miter" |
|
|
704
|
+
transition?: "miter" | {
|
|
902
705
|
bevel: number;
|
|
903
706
|
};
|
|
904
707
|
}): PluginApiReturn<BrepHandle>;
|
|
@@ -906,19 +709,9 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
906
709
|
* Revolves a planar profile about an axis to make a solid of revolution — a
|
|
907
710
|
* full turn by default. Host API call — returns a new
|
|
908
711
|
* {@linkcode BrepHandle}; the input contour is read-only. Holes in the
|
|
909
|
-
* profile are allowed
|
|
910
|
-
*
|
|
911
|
-
*
|
|
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.
|
|
712
|
+
* profile are allowed. Profile segments must stay parallel or perpendicular
|
|
713
|
+
* to the axis — inclined or arc segments would revolve into surfaces
|
|
714
|
+
* Snaptrude cannot represent.
|
|
922
715
|
*
|
|
923
716
|
* Runs on the OpenCascade kernel (the first kernel call loads a wasm of
|
|
924
717
|
* tens of MB — expect a pause of seconds).
|
|
@@ -932,25 +725,19 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
932
725
|
* @param angleInDegrees Optional revolution angle in degrees (0 < angle ≤ 360; default 360)
|
|
933
726
|
* @returns The revolved solid as a new {@linkcode BrepHandle}
|
|
934
727
|
* @throws VALIDATION if `axisDirection` is zero-length, `angleInDegrees` is
|
|
935
|
-
* not in (0, 360],
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
939
|
-
*
|
|
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
|
|
728
|
+
* not in (0, 360], the axis passes through the profile interior, or a
|
|
729
|
+
* coordinate is not finite
|
|
730
|
+
* @throws OPERATION_FAILED if the kernel cannot revolve the profile or the
|
|
731
|
+
* result contains curved surfaces Snaptrude cannot represent (keep
|
|
732
|
+
* profile segments parallel or perpendicular to the axis)
|
|
943
733
|
*
|
|
944
734
|
* @examplePrompt Create a dome from this section
|
|
945
735
|
* @examplePrompt Revolve this profile 360 degrees around the vertical axis
|
|
946
736
|
* @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
|
|
949
737
|
*
|
|
950
738
|
* # Example
|
|
951
739
|
* ```ts
|
|
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.
|
|
740
|
+
* // A cylinder: revolve a 2m-wide, 3m-tall rectangle about the Y axis at its edge
|
|
954
741
|
* const rect = await snaptrude.core.geom.create.profileFromLinePoints([
|
|
955
742
|
* await snaptrude.core.math.vec3.new(0, 0, 0),
|
|
956
743
|
* await snaptrude.core.math.vec3.new(2, 0, 0),
|
|
@@ -966,135 +753,6 @@ export declare abstract class PluginGeomCreateApi {
|
|
|
966
753
|
* ```
|
|
967
754
|
*/
|
|
968
755
|
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>;
|
|
1098
756
|
}
|
|
1099
757
|
/**
|
|
1100
758
|
* Arguments for {@linkcode PluginGeomCreateApi.line}.
|
|
@@ -1141,32 +799,6 @@ export declare const PluginGeomCreateCircleArgs: z.ZodObject<{
|
|
|
1141
799
|
radius: z.ZodNumber;
|
|
1142
800
|
}, z.core.$strip>;
|
|
1143
801
|
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>;
|
|
1170
802
|
/**
|
|
1171
803
|
* Arguments for {@linkcode PluginGeomCreateApi.profileFromLinePoints}.
|
|
1172
804
|
*
|
|
@@ -1186,20 +818,9 @@ export type PluginGeomCreateProfileFromLinePointsArgs = z.infer<typeof PluginGeo
|
|
|
1186
818
|
* | `curves` | {@linkcode CurveHandle}`[]` | Ordered curve handles forming a closed loop |
|
|
1187
819
|
*/
|
|
1188
820
|
export declare const PluginGeomCreateProfileFromCurvesArgs: z.ZodObject<{
|
|
1189
|
-
curves: z.ZodArray<z.
|
|
821
|
+
curves: z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>, z.ZodTransform<import("../../../..").Handle<"line">, string>>, z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>, z.ZodTransform<import("../../../..").Handle<"arc">, string>>]>>;
|
|
1190
822
|
}, z.core.$strip>;
|
|
1191
823
|
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>;
|
|
1203
824
|
/**
|
|
1204
825
|
* Arguments for {@linkcode PluginGeomCreateApi.contourFromProfile}.
|
|
1205
826
|
*
|
|
@@ -1265,7 +886,7 @@ export type PluginGeomCreateBrepFromExtrusionArgs = z.infer<typeof PluginGeomCre
|
|
|
1265
886
|
* |---|---|---|
|
|
1266
887
|
* | `bottomContour` | {@linkcode ContourHandle} | The bottom cross-section |
|
|
1267
888
|
* | `topContour` | {@linkcode ContourHandle} | The top cross-section |
|
|
1268
|
-
* | `intermediateContours` | {@linkcode ContourHandle}`[]`? | Optional in-between cross-sections, ordered bottom to top
|
|
889
|
+
* | `intermediateContours` | {@linkcode ContourHandle}`[]`? | Optional in-between cross-sections, ordered bottom to top |
|
|
1269
890
|
* | `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"`) |
|
|
1270
891
|
*/
|
|
1271
892
|
export declare const PluginGeomCreateBrepFromLoftArgs: z.ZodObject<{
|
|
@@ -1323,7 +944,7 @@ export type PluginGeomCreateBrepBooleanArgs = z.infer<typeof PluginGeomCreateBre
|
|
|
1323
944
|
* | Property | Type | Description |
|
|
1324
945
|
* |---|---|---|
|
|
1325
946
|
* | `brep` | {@linkcode BrepHandle} | The solid whose edges to round |
|
|
1326
|
-
* | `edges` | {@linkcode EdgeHandle}`[]` | The edges to fillet (
|
|
947
|
+
* | `edges` | {@linkcode EdgeHandle}`[]` | The straight edges to fillet (≥1) |
|
|
1327
948
|
* | `radius` | `number` | Fillet radius (positive, finite) |
|
|
1328
949
|
*/
|
|
1329
950
|
export declare const PluginGeomCreateBrepFromFilletArgs: z.ZodObject<{
|
|
@@ -1351,7 +972,7 @@ export type PluginGeomCreateBrepFromOffsetArgs = z.infer<typeof PluginGeomCreate
|
|
|
1351
972
|
* | Property | Type | Description |
|
|
1352
973
|
* |---|---|---|
|
|
1353
974
|
* | `brep` | {@linkcode BrepHandle} | The solid to hollow |
|
|
1354
|
-
* | `openFaces` | {@linkcode FaceHandle}`[]` | The faces to remove as openings (
|
|
975
|
+
* | `openFaces` | {@linkcode FaceHandle}`[]` | The faces to remove as openings (≥1) |
|
|
1355
976
|
* | `thickness` | `number` | Wall thickness (positive, finite) |
|
|
1356
977
|
*/
|
|
1357
978
|
export declare const PluginGeomCreateBrepFromShellArgs: z.ZodObject<{
|
|
@@ -1389,7 +1010,7 @@ export type PluginGeomCreateBrepsFromSplitArgs = z.infer<typeof PluginGeomCreate
|
|
|
1389
1010
|
* | Property | Type | Description |
|
|
1390
1011
|
* |---|---|---|
|
|
1391
1012
|
* | `brep` | {@linkcode BrepHandle} | The solid whose edges to bevel |
|
|
1392
|
-
* | `edges` | {@linkcode EdgeHandle}`[]` | The edges to chamfer (
|
|
1013
|
+
* | `edges` | {@linkcode EdgeHandle}`[]` | The straight edges to chamfer (≥1) |
|
|
1393
1014
|
* | `distance` | `number` | Chamfer distance from the edge on each adjacent face (positive, finite) |
|
|
1394
1015
|
*/
|
|
1395
1016
|
export declare const PluginGeomCreateBrepFromChamferArgs: z.ZodObject<{
|
|
@@ -1404,8 +1025,8 @@ export type PluginGeomCreateBrepFromChamferArgs = z.infer<typeof PluginGeomCreat
|
|
|
1404
1025
|
* | Property | Type | Description |
|
|
1405
1026
|
* |---|---|---|
|
|
1406
1027
|
* | `profile` | {@linkcode ContourHandle} | The cross-section to sweep (hole-free) |
|
|
1407
|
-
* | `path` | {@linkcode Vec3Components}`[]` | The polyline path (2
|
|
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)
|
|
1028
|
+
* | `path` | {@linkcode Vec3Components}`[]` | The polyline path (≥2 points, finite components; 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) |
|
|
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) |
|
|
1409
1030
|
*/
|
|
1410
1031
|
export declare const PluginGeomCreateBrepFromSweepArgs: z.ZodObject<{
|
|
1411
1032
|
profile: z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>, z.ZodTransform<import("../../../..").Handle<"contour">, string>>;
|
|
@@ -1418,7 +1039,7 @@ export declare const PluginGeomCreateBrepFromSweepArgs: z.ZodObject<{
|
|
|
1418
1039
|
startScale: z.ZodOptional<z.ZodNumber>;
|
|
1419
1040
|
endScale: z.ZodOptional<z.ZodNumber>;
|
|
1420
1041
|
scales: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
1421
|
-
transition: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"miter">, z.
|
|
1042
|
+
transition: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"miter">, z.ZodObject<{
|
|
1422
1043
|
bevel: z.ZodNumber;
|
|
1423
1044
|
}, z.core.$strip>]>>;
|
|
1424
1045
|
}, z.core.$strip>>;
|
|
@@ -1430,8 +1051,8 @@ export type PluginGeomCreateBrepFromSweepArgs = z.infer<typeof PluginGeomCreateB
|
|
|
1430
1051
|
* | Property | Type | Description |
|
|
1431
1052
|
* |---|---|---|
|
|
1432
1053
|
* | `profile` | {@linkcode ContourHandle} | The cross-section to revolve (holes allowed) |
|
|
1433
|
-
* | `axisOrigin` | {@linkcode Vec3Components} | A point on the revolution axis (finite components
|
|
1434
|
-
* | `axisDirection` | {@linkcode Vec3Components} | The axis direction (non-zero, finite components
|
|
1054
|
+
* | `axisOrigin` | {@linkcode Vec3Components} | A point on the revolution axis (finite components) |
|
|
1055
|
+
* | `axisDirection` | {@linkcode Vec3Components} | The axis direction (non-zero, finite components) |
|
|
1435
1056
|
* | `angleInDegrees` | `number`? | Revolution angle in degrees (0 < angle ≤ 360; default 360) |
|
|
1436
1057
|
*/
|
|
1437
1058
|
export declare const PluginGeomCreateBrepFromRevolutionArgs: z.ZodObject<{
|
|
@@ -1449,98 +1070,4 @@ export declare const PluginGeomCreateBrepFromRevolutionArgs: z.ZodObject<{
|
|
|
1449
1070
|
angleInDegrees: z.ZodOptional<z.ZodNumber>;
|
|
1450
1071
|
}, z.core.$strip>;
|
|
1451
1072
|
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>;
|
|
1546
1073
|
//# sourceMappingURL=index.d.ts.map
|