brepjs 18.82.4 → 18.82.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brepjs.cjs +32 -32
- package/dist/brepjs.js +7 -7
- package/dist/{drawFns-DrlxFhe4.js → drawFns-C5Mdr0iH.js} +1 -1
- package/dist/{drawFns-CmSMHb12.cjs → drawFns-DK3DGHku.cjs} +1 -1
- package/dist/{healingFns-Ct_-O3yk.js → healingFns-C4JZHv8K.js} +1 -1
- package/dist/{healingFns-MxlhdTIc.cjs → healingFns-D3BkAVML.cjs} +5 -5
- package/dist/operations.cjs +1 -1
- package/dist/operations.js +1 -1
- package/dist/primitiveFns-BPfYb_t5.cjs +461 -0
- package/dist/primitiveFns-DkuLOFkI.js +300 -0
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{primitiveFns-CjL5bygY.js → solidBuilders-QUpJdbiK.js} +99 -256
- package/dist/{primitiveFns-LWkd7M2f.cjs → solidBuilders-lDXPwoCz.cjs} +120 -379
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-BjSwFtO2.cjs → textBlueprints-D4pLmVno.cjs} +25 -42
- package/dist/{textBlueprints-BJ22J1c2.js → textBlueprints-f8cgx9vi.js} +28 -45
- package/dist/{textMetrics-BrSfzuY6.js → textMetrics-CQtQI4vF.js} +1 -1
- package/dist/{textMetrics-5DyMA99n.cjs → textMetrics-DTRuXeXr.cjs} +1 -1
- package/dist/{threadFns-DqMbjyxZ.js → threadFns-CvLvKdwB.js} +2 -1
- package/dist/{threadFns-CX9l8sRv.cjs → threadFns-DvSdQiRw.cjs} +4 -3
- package/dist/topology.cjs +5 -4
- package/dist/topology.js +3 -2
- package/package.json +1 -1
- package/dist/solidBuilders-CgPOdC3Q.js +0 -140
- package/dist/solidBuilders-mxHbGDW6.cjs +0 -199
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D1eUDuzl.cjs");
|
|
2
|
+
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
+
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
4
|
+
const require_shapeFns = require("./shapeFns-sF0x5Zhj.cjs");
|
|
5
|
+
const require_surfaceBuilders = require("./surfaceBuilders-R4DKNFkI.cjs");
|
|
6
|
+
const require_solidBuilders = require("./solidBuilders-lDXPwoCz.cjs");
|
|
7
|
+
//#region src/topology/primitiveFns.ts
|
|
8
|
+
/**
|
|
9
|
+
* Create a box with the given dimensions.
|
|
10
|
+
*
|
|
11
|
+
* @param width - Size along X.
|
|
12
|
+
* @param depth - Size along Y.
|
|
13
|
+
* @param height - Size along Z.
|
|
14
|
+
*/
|
|
15
|
+
function box(width, depth, height, options) {
|
|
16
|
+
const solid = require_shapeTypes.createSolid(require_shapeTypes.getKernel().makeBox(width, depth, height));
|
|
17
|
+
const center = options?.at ?? (options?.centered ? [
|
|
18
|
+
0,
|
|
19
|
+
0,
|
|
20
|
+
0
|
|
21
|
+
] : void 0);
|
|
22
|
+
if (center) return require_shapeFns.translate(solid, [
|
|
23
|
+
center[0] - width / 2,
|
|
24
|
+
center[1] - depth / 2,
|
|
25
|
+
center[2] - height / 2
|
|
26
|
+
]);
|
|
27
|
+
return solid;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a cylinder with the given radius and height.
|
|
31
|
+
*/
|
|
32
|
+
function cylinder(radius, height, options) {
|
|
33
|
+
const at = options?.at ?? [
|
|
34
|
+
0,
|
|
35
|
+
0,
|
|
36
|
+
0
|
|
37
|
+
];
|
|
38
|
+
const axis = options?.axis ?? [
|
|
39
|
+
0,
|
|
40
|
+
0,
|
|
41
|
+
1
|
|
42
|
+
];
|
|
43
|
+
let solid = require_solidBuilders.makeCylinder(radius, height, at, axis);
|
|
44
|
+
if (options?.centered) {
|
|
45
|
+
const halfShift = [
|
|
46
|
+
-axis[0] * height * .5,
|
|
47
|
+
-axis[1] * height * .5,
|
|
48
|
+
-axis[2] * height * .5
|
|
49
|
+
];
|
|
50
|
+
solid = require_shapeFns.translate(solid, halfShift);
|
|
51
|
+
}
|
|
52
|
+
return solid;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a sphere with the given radius.
|
|
56
|
+
*/
|
|
57
|
+
function sphere(radius, options) {
|
|
58
|
+
let solid = require_solidBuilders.makeSphere(radius);
|
|
59
|
+
if (options?.at) solid = require_shapeFns.translate(solid, options.at);
|
|
60
|
+
return solid;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a cone (or frustum) with the given radii and height.
|
|
64
|
+
*
|
|
65
|
+
* @param bottomRadius - Radius at the base.
|
|
66
|
+
* @param topRadius - Radius at the top (0 for a full cone).
|
|
67
|
+
* @param height - Height of the cone.
|
|
68
|
+
*/
|
|
69
|
+
function cone(bottomRadius, topRadius, height, options) {
|
|
70
|
+
const at = options?.at ?? [
|
|
71
|
+
0,
|
|
72
|
+
0,
|
|
73
|
+
0
|
|
74
|
+
];
|
|
75
|
+
const axis = options?.axis ?? [
|
|
76
|
+
0,
|
|
77
|
+
0,
|
|
78
|
+
1
|
|
79
|
+
];
|
|
80
|
+
let solid = require_solidBuilders.makeCone(bottomRadius, topRadius, height, at, axis);
|
|
81
|
+
if (options?.centered) {
|
|
82
|
+
const halfShift = [
|
|
83
|
+
-axis[0] * height * .5,
|
|
84
|
+
-axis[1] * height * .5,
|
|
85
|
+
-axis[2] * height * .5
|
|
86
|
+
];
|
|
87
|
+
solid = require_shapeFns.translate(solid, halfShift);
|
|
88
|
+
}
|
|
89
|
+
return solid;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a torus with the given major and minor radii.
|
|
93
|
+
*/
|
|
94
|
+
function torus(majorRadius, minorRadius, options) {
|
|
95
|
+
return require_solidBuilders.makeTorus(majorRadius, minorRadius, options?.at ?? [
|
|
96
|
+
0,
|
|
97
|
+
0,
|
|
98
|
+
0
|
|
99
|
+
], options?.axis ?? [
|
|
100
|
+
0,
|
|
101
|
+
0,
|
|
102
|
+
1
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create an ellipsoid with the given axis half-lengths.
|
|
107
|
+
*
|
|
108
|
+
* @param rx - Half-length along X.
|
|
109
|
+
* @param ry - Half-length along Y.
|
|
110
|
+
* @param rz - Half-length along Z.
|
|
111
|
+
*/
|
|
112
|
+
function ellipsoid(rx, ry, rz, options) {
|
|
113
|
+
let solid = require_solidBuilders.makeEllipsoid(rx, ry, rz);
|
|
114
|
+
if (options?.at) solid = require_shapeFns.translate(solid, options.at);
|
|
115
|
+
return solid;
|
|
116
|
+
}
|
|
117
|
+
/** Create a straight edge between two 3D points. */
|
|
118
|
+
function line(from, to) {
|
|
119
|
+
return require_surfaceBuilders.makeLine(from, to);
|
|
120
|
+
}
|
|
121
|
+
/** Create a circular edge with the given radius. */
|
|
122
|
+
function circle(radius, options) {
|
|
123
|
+
const axisDir = options?.axis ?? [
|
|
124
|
+
0,
|
|
125
|
+
0,
|
|
126
|
+
1
|
|
127
|
+
];
|
|
128
|
+
return require_surfaceBuilders.makeCircle(radius, options?.at ?? [
|
|
129
|
+
0,
|
|
130
|
+
0,
|
|
131
|
+
0
|
|
132
|
+
], axisDir);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create an elliptical edge.
|
|
136
|
+
*
|
|
137
|
+
* @returns An error if `minorRadius` exceeds `majorRadius`.
|
|
138
|
+
*/
|
|
139
|
+
function ellipse(majorRadius, minorRadius, options) {
|
|
140
|
+
const axisDir = options?.axis ?? [
|
|
141
|
+
0,
|
|
142
|
+
0,
|
|
143
|
+
1
|
|
144
|
+
];
|
|
145
|
+
return require_surfaceBuilders.makeEllipse(majorRadius, minorRadius, options?.at ?? [
|
|
146
|
+
0,
|
|
147
|
+
0,
|
|
148
|
+
0
|
|
149
|
+
], axisDir, options?.xDir);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Create a helical wire.
|
|
153
|
+
*
|
|
154
|
+
* @param pitch - Vertical distance per full turn.
|
|
155
|
+
* @param height - Total height.
|
|
156
|
+
* @param radius - Helix radius.
|
|
157
|
+
*/
|
|
158
|
+
function helix(pitch, height, radius, options) {
|
|
159
|
+
return require_surfaceBuilders.makeHelix(pitch, height, radius, options?.at ?? [
|
|
160
|
+
0,
|
|
161
|
+
0,
|
|
162
|
+
0
|
|
163
|
+
], options?.axis ?? [
|
|
164
|
+
0,
|
|
165
|
+
0,
|
|
166
|
+
1
|
|
167
|
+
], options?.lefthand ?? false);
|
|
168
|
+
}
|
|
169
|
+
/** Create a circular arc edge passing through three points. */
|
|
170
|
+
function threePointArc(p1, p2, p3) {
|
|
171
|
+
return require_surfaceBuilders.makeThreePointArc(p1, p2, p3);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Create an elliptical arc edge between two angles.
|
|
175
|
+
*
|
|
176
|
+
* All angles are in **degrees** (unlike the legacy `makeEllipseArc` which used radians).
|
|
177
|
+
*
|
|
178
|
+
* @param startAngle - Start angle in degrees.
|
|
179
|
+
* @param endAngle - End angle in degrees.
|
|
180
|
+
*/
|
|
181
|
+
function ellipseArc(majorRadius, minorRadius, startAngle, endAngle, options) {
|
|
182
|
+
const axisDir = options?.axis ?? [
|
|
183
|
+
0,
|
|
184
|
+
0,
|
|
185
|
+
1
|
|
186
|
+
];
|
|
187
|
+
return require_surfaceBuilders.makeEllipseArc(majorRadius, minorRadius, startAngle * require_constants.DEG2RAD, endAngle * require_constants.DEG2RAD, options?.at ?? [
|
|
188
|
+
0,
|
|
189
|
+
0,
|
|
190
|
+
0
|
|
191
|
+
], axisDir, options?.xDir);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Create a B-spline edge that approximates a set of 3D points.
|
|
195
|
+
*
|
|
196
|
+
* @returns An error if the approximation algorithm fails.
|
|
197
|
+
*/
|
|
198
|
+
function bsplineApprox(points, config) {
|
|
199
|
+
return require_surfaceBuilders.makeBSplineApproximation(points, config);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Create a Bezier curve edge from control points.
|
|
203
|
+
*
|
|
204
|
+
* @param points - Two or more control points.
|
|
205
|
+
*/
|
|
206
|
+
function bezier(points) {
|
|
207
|
+
return require_surfaceBuilders.makeBezierCurve(points);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Create a circular arc edge tangent to a direction at the start point.
|
|
211
|
+
*/
|
|
212
|
+
function tangentArc(startPoint, startTgt, endPoint) {
|
|
213
|
+
return require_surfaceBuilders.makeTangentArc(startPoint, startTgt, endPoint);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Assemble edges and/or wires into a single connected wire.
|
|
217
|
+
*/
|
|
218
|
+
function wire(listOfEdges) {
|
|
219
|
+
return require_surfaceBuilders.assembleWire(listOfEdges);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Assemble edges into a wire and verify it forms a closed loop.
|
|
223
|
+
*
|
|
224
|
+
* Combines {@link wire} + the `closedWire` smart constructor in a single step.
|
|
225
|
+
* Returns an error if the edges cannot be assembled or the wire is not closed.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* const cw = unwrap(wireLoop([e1, e2, e3, e4]));
|
|
230
|
+
* const f = unwrap(face(cw)); // ClosedWire accepted directly
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
function wireLoop(listOfEdges) {
|
|
234
|
+
return require_errors.andThen(require_surfaceBuilders.assembleWire(listOfEdges), (w) => {
|
|
235
|
+
if (require_shapeTypes.isClosedWire(w)) return require_errors.ok(w);
|
|
236
|
+
return require_errors.err(require_errors.validationError("WIRE_NOT_CLOSED", "Assembled wire is not closed: start and end points do not coincide"));
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Create a planar face from a closed wire, optionally with holes.
|
|
241
|
+
* The resulting face is always oriented (consistent normal direction).
|
|
242
|
+
*/
|
|
243
|
+
function face(w, holes) {
|
|
244
|
+
return require_surfaceBuilders.makeFace(w, holes);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Create a non-planar face from a wire using surface filling.
|
|
248
|
+
* The resulting face is always oriented.
|
|
249
|
+
*/
|
|
250
|
+
function filledFace(w) {
|
|
251
|
+
return require_surfaceBuilders.makeNonPlanarFace(w);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Create a face bounded by a wire on an existing face's surface.
|
|
255
|
+
* The resulting face inherits orientation from the origin face.
|
|
256
|
+
*/
|
|
257
|
+
function subFace(originFace, w) {
|
|
258
|
+
return require_surfaceBuilders.makeNewFaceWithinFace(originFace, w);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Create a polygonal face from three or more coplanar points.
|
|
262
|
+
* The resulting face is always oriented.
|
|
263
|
+
*/
|
|
264
|
+
function polygon(points) {
|
|
265
|
+
return require_surfaceBuilders.makePolygon(points);
|
|
266
|
+
}
|
|
267
|
+
/** Create a vertex at a 3D point. */
|
|
268
|
+
function vertex(point) {
|
|
269
|
+
return require_solidBuilders.makeVertex(point);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Build a compound from multiple shapes.
|
|
273
|
+
*/
|
|
274
|
+
function compound(shapeArray) {
|
|
275
|
+
return require_solidBuilders.makeCompound(shapeArray);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Weld faces and shells into a single solid.
|
|
279
|
+
* The resulting solid is always validated.
|
|
280
|
+
*/
|
|
281
|
+
function solid(facesOrShells) {
|
|
282
|
+
return require_solidBuilders.makeSolid(facesOrShells);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Create an offset shape from a face.
|
|
286
|
+
*/
|
|
287
|
+
function offsetFace(f, distance, tolerance) {
|
|
288
|
+
return require_solidBuilders.makeOffset(f, distance, tolerance);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Weld faces and shells into a single shell.
|
|
292
|
+
*/
|
|
293
|
+
function sewShells(facesOrShells, ignoreType) {
|
|
294
|
+
return require_solidBuilders.weldShellsAndFaces(facesOrShells, ignoreType);
|
|
295
|
+
}
|
|
296
|
+
function addHoles(f, holes) {
|
|
297
|
+
return require_surfaceBuilders.addHolesInFace(f, holes);
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
Object.defineProperty(exports, "addHoles", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function() {
|
|
303
|
+
return addHoles;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
Object.defineProperty(exports, "bezier", {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function() {
|
|
309
|
+
return bezier;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
Object.defineProperty(exports, "box", {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
get: function() {
|
|
315
|
+
return box;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
Object.defineProperty(exports, "bsplineApprox", {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
get: function() {
|
|
321
|
+
return bsplineApprox;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
Object.defineProperty(exports, "circle", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
get: function() {
|
|
327
|
+
return circle;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
Object.defineProperty(exports, "compound", {
|
|
331
|
+
enumerable: true,
|
|
332
|
+
get: function() {
|
|
333
|
+
return compound;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
Object.defineProperty(exports, "cone", {
|
|
337
|
+
enumerable: true,
|
|
338
|
+
get: function() {
|
|
339
|
+
return cone;
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
Object.defineProperty(exports, "cylinder", {
|
|
343
|
+
enumerable: true,
|
|
344
|
+
get: function() {
|
|
345
|
+
return cylinder;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
Object.defineProperty(exports, "ellipse", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function() {
|
|
351
|
+
return ellipse;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
Object.defineProperty(exports, "ellipseArc", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
get: function() {
|
|
357
|
+
return ellipseArc;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
Object.defineProperty(exports, "ellipsoid", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function() {
|
|
363
|
+
return ellipsoid;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
Object.defineProperty(exports, "face", {
|
|
367
|
+
enumerable: true,
|
|
368
|
+
get: function() {
|
|
369
|
+
return face;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
Object.defineProperty(exports, "filledFace", {
|
|
373
|
+
enumerable: true,
|
|
374
|
+
get: function() {
|
|
375
|
+
return filledFace;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
Object.defineProperty(exports, "helix", {
|
|
379
|
+
enumerable: true,
|
|
380
|
+
get: function() {
|
|
381
|
+
return helix;
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
Object.defineProperty(exports, "line", {
|
|
385
|
+
enumerable: true,
|
|
386
|
+
get: function() {
|
|
387
|
+
return line;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
Object.defineProperty(exports, "offsetFace", {
|
|
391
|
+
enumerable: true,
|
|
392
|
+
get: function() {
|
|
393
|
+
return offsetFace;
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
Object.defineProperty(exports, "polygon", {
|
|
397
|
+
enumerable: true,
|
|
398
|
+
get: function() {
|
|
399
|
+
return polygon;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
Object.defineProperty(exports, "sewShells", {
|
|
403
|
+
enumerable: true,
|
|
404
|
+
get: function() {
|
|
405
|
+
return sewShells;
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
Object.defineProperty(exports, "solid", {
|
|
409
|
+
enumerable: true,
|
|
410
|
+
get: function() {
|
|
411
|
+
return solid;
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
Object.defineProperty(exports, "sphere", {
|
|
415
|
+
enumerable: true,
|
|
416
|
+
get: function() {
|
|
417
|
+
return sphere;
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
Object.defineProperty(exports, "subFace", {
|
|
421
|
+
enumerable: true,
|
|
422
|
+
get: function() {
|
|
423
|
+
return subFace;
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
Object.defineProperty(exports, "tangentArc", {
|
|
427
|
+
enumerable: true,
|
|
428
|
+
get: function() {
|
|
429
|
+
return tangentArc;
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
Object.defineProperty(exports, "threePointArc", {
|
|
433
|
+
enumerable: true,
|
|
434
|
+
get: function() {
|
|
435
|
+
return threePointArc;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
Object.defineProperty(exports, "torus", {
|
|
439
|
+
enumerable: true,
|
|
440
|
+
get: function() {
|
|
441
|
+
return torus;
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
Object.defineProperty(exports, "vertex", {
|
|
445
|
+
enumerable: true,
|
|
446
|
+
get: function() {
|
|
447
|
+
return vertex;
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
Object.defineProperty(exports, "wire", {
|
|
451
|
+
enumerable: true,
|
|
452
|
+
get: function() {
|
|
453
|
+
return wire;
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
Object.defineProperty(exports, "wireLoop", {
|
|
457
|
+
enumerable: true,
|
|
458
|
+
get: function() {
|
|
459
|
+
return wireLoop;
|
|
460
|
+
}
|
|
461
|
+
});
|