brepjs 18.118.13 → 18.118.14
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/2d.cjs +4 -4
- package/dist/2d.js +4 -4
- package/dist/{blueprint-DF-Ig1SW.cjs → blueprint-CN536u9V.cjs} +8 -3
- package/dist/{blueprint-CJ7k25eW.js → blueprint-dqI319c7.js} +8 -3
- package/dist/{blueprintFns-CjvHOuIy.cjs → blueprintFns-CF-6WzuR.cjs} +2 -2
- package/dist/{blueprintFns-BKtVfo16.js → blueprintFns-Ci1QVESM.js} +2 -2
- package/dist/{blueprintSketcher-DRGumaWR.cjs → blueprintSketcher-CGnohIOe.cjs} +1 -1
- package/dist/{blueprintSketcher-BIUHqWo9.js → blueprintSketcher-CY9DgQqk.js} +1 -1
- package/dist/{boolean2D-Buf04D7l.js → boolean2D-CaAwVwCR.js} +2 -2
- package/dist/{boolean2D-5WdQm5Kb.cjs → boolean2D-DnBT9gQ5.cjs} +2 -2
- package/dist/brepjs.cjs +105 -64
- package/dist/brepjs.js +105 -64
- package/dist/{cameraFns-CiGOarQ4.cjs → cameraFns-Ckw5prda.cjs} +28 -12
- package/dist/{cameraFns-MViqtlSh.js → cameraFns-CythF7Ob.js} +30 -14
- package/dist/{drawFns-DZHPT-nb.cjs → drawFns-CMyY6ED-.cjs} +15 -9
- package/dist/{drawFns-CWfBvGiY.js → drawFns-hOQecCHR.js} +15 -9
- package/dist/{importFns-Tgnymh7F.cjs → importFns-CvlUuJ59.cjs} +1 -1
- package/dist/{importFns-CzBtuX0j.js → importFns-TbwuxynG.js} +1 -1
- package/dist/io.cjs +1 -1
- package/dist/io.js +1 -1
- package/dist/{loftFns-Be0OZxYM.cjs → loftFns-BTWRncKQ.cjs} +44 -25
- package/dist/{loftFns-DxJAP4Qv.js → loftFns-CUg8_4_X.js} +45 -26
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-DgTBXc6O.cjs → textBlueprints-D5mNvqKF.cjs} +2 -2
- package/dist/{textBlueprints-CFPE5_QI.js → textBlueprints-DBjpb8G_.js} +2 -2
- package/dist/{textMetrics-C2cwK7wU.js → textMetrics-C7pEipGp.js} +1 -1
- package/dist/{textMetrics-BH-izd6N.cjs → textMetrics-CgyvE6u0.cjs} +1 -1
- package/dist/{threadFns-B6SQd48K.cjs → threadFns-DDcOeRGs.cjs} +1 -1
- package/dist/{threadFns-G71HVwW7.js → threadFns-Dsn9lSDD.js} +1 -1
- package/package.json +1 -1
package/dist/brepjs.js
CHANGED
|
@@ -15,19 +15,19 @@ import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayA
|
|
|
15
15
|
import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-HAF4Xtow.js";
|
|
16
16
|
import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-CgEPRock.js";
|
|
17
17
|
import { A as toBufferGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, M as toLODGeometryData, N as toLODGeometryLevels, O as getNurbsSurfaceData, P as toLineGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as toGroupedBufferGeometryData, k as chamferDistAngle, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution } from "./healingFns-BhB_G0L0.js";
|
|
18
|
-
import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatMultiply, G as circularPattern, H as removeChild, I as quatRotate, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-
|
|
19
|
-
import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-
|
|
18
|
+
import { A as setJointValue, B as createAssemblyNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatMultiply, G as circularPattern, H as removeChild, I as quatRotate, J as exportAssemblySTEP, K as gridPattern, L as addChild, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as collectShapes, S as addJoint, T as jointTransform, U as updateNode, V as findNode, W as walkAssembly, Y as createAssembly, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as linearPattern, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as countNodes } from "./threadFns-Dsn9lSDD.js";
|
|
19
|
+
import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-CY9DgQqk.js";
|
|
20
20
|
import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-zVYq0h_A.js";
|
|
21
|
-
import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-
|
|
21
|
+
import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-hOQecCHR.js";
|
|
22
22
|
import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, i as measureCurvatureAtMid, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, r as measureCurvatureAt, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-Bbgcgo9U.js";
|
|
23
23
|
import { t as cornerFinder } from "./cornerFinder-BEe90gzY.js";
|
|
24
|
-
import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-
|
|
25
|
-
import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, n as createCompoundBlueprint, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-
|
|
26
|
-
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-
|
|
27
|
-
import { a as revolve$1, c as multiSectionSweep, d as twistExtrude, i as extrudeAll, l as supportExtrude, n as loftAll, o as complexExtrude, r as extrude$1, s as guidedSweep, t as loft$1, u as sweep$1 } from "./loftFns-
|
|
28
|
-
import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, n as getFont, o as compoundSketchExtrude, p as sketchRevolve, r as loadFont, s as compoundSketchFace, t as textBlueprints, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-
|
|
29
|
-
import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-
|
|
30
|
-
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-
|
|
24
|
+
import { a as fuseBlueprints, c as roundedRectangleBlueprint, i as cutBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-CaAwVwCR.js";
|
|
25
|
+
import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, n as createCompoundBlueprint, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-Ci1QVESM.js";
|
|
26
|
+
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-TbwuxynG.js";
|
|
27
|
+
import { a as revolve$1, c as multiSectionSweep, d as twistExtrude, i as extrudeAll, l as supportExtrude, n as loftAll, o as complexExtrude, r as extrude$1, s as guidedSweep, t as loft$1, u as sweep$1 } from "./loftFns-CUg8_4_X.js";
|
|
28
|
+
import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, n as getFont, o as compoundSketchExtrude, p as sketchRevolve, r as loadFont, s as compoundSketchFace, t as textBlueprints, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-DBjpb8G_.js";
|
|
29
|
+
import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-CythF7Ob.js";
|
|
30
|
+
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-C7pEipGp.js";
|
|
31
31
|
import { a as sharedEdges, c as wiresOfFace, i as facesOfVertex, n as edgesOfFace, o as verticesOfEdge, r as facesOfEdge, s as verticesOfFace, t as adjacentFaces } from "./adjacencyFns-qxeJWyj-.js";
|
|
32
32
|
import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-_niAxNu8.js";
|
|
33
33
|
import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty$1, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-XcYX2UZ0.js";
|
|
@@ -252,8 +252,8 @@ function repairMesh(mesh, opts, id) {
|
|
|
252
252
|
if (isErr(engine)) return engine;
|
|
253
253
|
try {
|
|
254
254
|
try {
|
|
255
|
-
var _usingCtx$
|
|
256
|
-
const repaired = _usingCtx$
|
|
255
|
+
var _usingCtx$8 = _usingCtx();
|
|
256
|
+
const repaired = _usingCtx$8.u(engine.value.repair_mesh(mesh.vertices, mesh.triangles, resolution, padding));
|
|
257
257
|
const vertexCount = repaired.positions.length / 3;
|
|
258
258
|
return ok({
|
|
259
259
|
vertices: repaired.positions,
|
|
@@ -267,9 +267,9 @@ function repairMesh(mesh, opts, id) {
|
|
|
267
267
|
}]
|
|
268
268
|
});
|
|
269
269
|
} catch (_) {
|
|
270
|
-
_usingCtx$
|
|
270
|
+
_usingCtx$8.e = _;
|
|
271
271
|
} finally {
|
|
272
|
-
_usingCtx$
|
|
272
|
+
_usingCtx$8.d();
|
|
273
273
|
}
|
|
274
274
|
} catch (cause) {
|
|
275
275
|
return err(computationError("VOXEL_REPAIR_FAILED", cause instanceof Error ? cause.message : "voxel repair failed (grid too large?).", cause));
|
|
@@ -348,12 +348,12 @@ function offsetMesh(mesh, distance, opts, id) {
|
|
|
348
348
|
if (isErr(engine)) return engine;
|
|
349
349
|
try {
|
|
350
350
|
try {
|
|
351
|
-
var _usingCtx$
|
|
352
|
-
return meshFromResult(_usingCtx$
|
|
351
|
+
var _usingCtx$7 = _usingCtx();
|
|
352
|
+
return meshFromResult(_usingCtx$7.u(engine.value.offset_mesh(mesh.vertices, mesh.triangles, distance, params.value.resolution, params.value.padding)));
|
|
353
353
|
} catch (_) {
|
|
354
|
-
_usingCtx$
|
|
354
|
+
_usingCtx$7.e = _;
|
|
355
355
|
} finally {
|
|
356
|
-
_usingCtx$
|
|
356
|
+
_usingCtx$7.d();
|
|
357
357
|
}
|
|
358
358
|
} catch (cause) {
|
|
359
359
|
return err(computationError("VOXEL_OFFSET_FAILED", cause instanceof Error ? cause.message : "voxel offset failed (grid too large?).", cause));
|
|
@@ -478,9 +478,9 @@ function resolveGridParams$1(opts) {
|
|
|
478
478
|
*/
|
|
479
479
|
function meshFromField(field) {
|
|
480
480
|
try {
|
|
481
|
-
var _usingCtx$
|
|
481
|
+
var _usingCtx$6 = _usingCtx();
|
|
482
482
|
const rawResult = field.contour();
|
|
483
|
-
const { positions, normals, indices } = _usingCtx$
|
|
483
|
+
const { positions, normals, indices } = _usingCtx$6.u({
|
|
484
484
|
value: rawResult,
|
|
485
485
|
[Symbol.dispose]() {
|
|
486
486
|
rawResult.free();
|
|
@@ -500,9 +500,9 @@ function meshFromField(field) {
|
|
|
500
500
|
}]
|
|
501
501
|
});
|
|
502
502
|
} catch (_) {
|
|
503
|
-
_usingCtx$
|
|
503
|
+
_usingCtx$6.e = _;
|
|
504
504
|
} finally {
|
|
505
|
-
_usingCtx$
|
|
505
|
+
_usingCtx$6.d();
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
function fieldDeletable(raw) {
|
|
@@ -1067,12 +1067,12 @@ function latticeInfill(mesh, opts, id) {
|
|
|
1067
1067
|
const { tag, period, thickness, resolution, padding } = resolved.value;
|
|
1068
1068
|
try {
|
|
1069
1069
|
try {
|
|
1070
|
-
var _usingCtx$
|
|
1071
|
-
return ok(toMesh(_usingCtx$
|
|
1070
|
+
var _usingCtx$5 = _usingCtx();
|
|
1071
|
+
return ok(toMesh(_usingCtx$5.u(engine.value.lattice_infill(mesh.vertices, mesh.triangles, resolution, padding, tag, period, thickness))));
|
|
1072
1072
|
} catch (_) {
|
|
1073
|
-
_usingCtx$
|
|
1073
|
+
_usingCtx$5.e = _;
|
|
1074
1074
|
} finally {
|
|
1075
|
-
_usingCtx$
|
|
1075
|
+
_usingCtx$5.d();
|
|
1076
1076
|
}
|
|
1077
1077
|
} catch (cause) {
|
|
1078
1078
|
return err(computationError("LATTICE_INFILL_FAILED", cause instanceof Error ? cause.message : "lattice infill failed (grid too large?).", cause));
|
|
@@ -3744,10 +3744,20 @@ function resolveTargetFace(shape, faceSpec) {
|
|
|
3744
3744
|
}
|
|
3745
3745
|
return ok(faceSpec);
|
|
3746
3746
|
}
|
|
3747
|
-
/**
|
|
3747
|
+
/**
|
|
3748
|
+
* Convert a DrawingLike or Wire to a ClosedWire & PlanarWire (profiles are always
|
|
3749
|
+
* closed and planar). `owned` is true when we materialised a fresh sketch wire
|
|
3750
|
+
* (the caller must dispose it); false when the caller's own Wire is passed through.
|
|
3751
|
+
*/
|
|
3748
3752
|
function toWire(profile) {
|
|
3749
|
-
if ("sketchOnPlane" in profile && typeof profile.sketchOnPlane === "function") return
|
|
3750
|
-
|
|
3753
|
+
if ("sketchOnPlane" in profile && typeof profile.sketchOnPlane === "function") return {
|
|
3754
|
+
wire: profile.sketchOnPlane("XY").wire,
|
|
3755
|
+
owned: true
|
|
3756
|
+
};
|
|
3757
|
+
return {
|
|
3758
|
+
wire: profile,
|
|
3759
|
+
owned: false
|
|
3760
|
+
};
|
|
3751
3761
|
}
|
|
3752
3762
|
/**
|
|
3753
3763
|
* Drill a hole through a 3D shape.
|
|
@@ -3850,19 +3860,31 @@ function drill(shape, options) {
|
|
|
3850
3860
|
* inward by the specified depth, then subtracted from the shape.
|
|
3851
3861
|
*/
|
|
3852
3862
|
function pocket(shape, options) {
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3863
|
+
try {
|
|
3864
|
+
var _usingCtx$4 = _usingCtx();
|
|
3865
|
+
const s = resolve(shape);
|
|
3866
|
+
const { profile, depth } = options;
|
|
3867
|
+
if (depth <= 0) return err(validationError("POCKET_INVALID_DEPTH", "Pocket depth must be positive"));
|
|
3868
|
+
const targetResult = resolveTargetFace(s, options.face);
|
|
3869
|
+
if (isErr(targetResult)) return targetResult;
|
|
3870
|
+
const targetFace = targetResult.value;
|
|
3871
|
+
const normal = normalAt(targetFace);
|
|
3872
|
+
const center = faceCenter(targetFace);
|
|
3873
|
+
const scope = _usingCtx$4.u(new DisposalScope());
|
|
3874
|
+
const { wire: w, owned } = toWire(profile);
|
|
3875
|
+
if (owned) scope.register(w);
|
|
3876
|
+
const faceResult = makeFace(w);
|
|
3877
|
+
if (isErr(faceResult)) return faceResult;
|
|
3878
|
+
scope.register(faceResult.value);
|
|
3879
|
+
const toolResult = extrude$1(scope.register(translate$2(faceResult.value, center)), vecScale(vecNormalize(normal), -depth));
|
|
3880
|
+
if (isErr(toolResult)) return toolResult;
|
|
3881
|
+
scope.register(toolResult.value);
|
|
3882
|
+
return cut$2(s, toolResult.value, { unsafe: true });
|
|
3883
|
+
} catch (_) {
|
|
3884
|
+
_usingCtx$4.e = _;
|
|
3885
|
+
} finally {
|
|
3886
|
+
_usingCtx$4.d();
|
|
3887
|
+
}
|
|
3866
3888
|
}
|
|
3867
3889
|
/**
|
|
3868
3890
|
* Add a boss (2D profile extruded outward) onto a shape.
|
|
@@ -3871,19 +3893,31 @@ function pocket(shape, options) {
|
|
|
3871
3893
|
* outward by the specified height, then fused with the shape.
|
|
3872
3894
|
*/
|
|
3873
3895
|
function boss(shape, options) {
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3896
|
+
try {
|
|
3897
|
+
var _usingCtx3 = _usingCtx();
|
|
3898
|
+
const s = resolve(shape);
|
|
3899
|
+
const { profile, height } = options;
|
|
3900
|
+
if (height <= 0) return err(validationError("BOSS_INVALID_HEIGHT", "Boss height must be positive"));
|
|
3901
|
+
const targetResult = resolveTargetFace(s, options.face);
|
|
3902
|
+
if (isErr(targetResult)) return targetResult;
|
|
3903
|
+
const targetFace = targetResult.value;
|
|
3904
|
+
const normal = normalAt(targetFace);
|
|
3905
|
+
const center = faceCenter(targetFace);
|
|
3906
|
+
const scope = _usingCtx3.u(new DisposalScope());
|
|
3907
|
+
const { wire: w, owned } = toWire(profile);
|
|
3908
|
+
if (owned) scope.register(w);
|
|
3909
|
+
const faceResult = makeFace(w);
|
|
3910
|
+
if (isErr(faceResult)) return faceResult;
|
|
3911
|
+
scope.register(faceResult.value);
|
|
3912
|
+
const toolResult = extrude$1(scope.register(translate$2(faceResult.value, center)), vecScale(vecNormalize(normal), height));
|
|
3913
|
+
if (isErr(toolResult)) return toolResult;
|
|
3914
|
+
scope.register(toolResult.value);
|
|
3915
|
+
return fuse$2(s, toolResult.value, { unsafe: true });
|
|
3916
|
+
} catch (_) {
|
|
3917
|
+
_usingCtx3.e = _;
|
|
3918
|
+
} finally {
|
|
3919
|
+
_usingCtx3.d();
|
|
3920
|
+
}
|
|
3887
3921
|
}
|
|
3888
3922
|
/**
|
|
3889
3923
|
* Mirror a shape and fuse it with the original.
|
|
@@ -3891,15 +3925,22 @@ function boss(shape, options) {
|
|
|
3891
3925
|
* Common pattern: model half a part, then mirror-join for symmetry.
|
|
3892
3926
|
*/
|
|
3893
3927
|
function mirrorJoin(shape, options) {
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3928
|
+
try {
|
|
3929
|
+
var _usingCtx4 = _usingCtx();
|
|
3930
|
+
const s = resolve(shape);
|
|
3931
|
+
const normal = options?.normal ?? [
|
|
3932
|
+
1,
|
|
3933
|
+
0,
|
|
3934
|
+
0
|
|
3935
|
+
];
|
|
3936
|
+
const planeOrigin = options?.at;
|
|
3937
|
+
if (vecIsZero(normal)) return err(validationError("MIRROR_ZERO_NORMAL", "Mirror plane normal cannot be zero"));
|
|
3938
|
+
return fuse$2(s, _usingCtx4.u(mirror$2(s, normal, planeOrigin)), { unsafe: true });
|
|
3939
|
+
} catch (_) {
|
|
3940
|
+
_usingCtx4.e = _;
|
|
3941
|
+
} finally {
|
|
3942
|
+
_usingCtx4.d();
|
|
3943
|
+
}
|
|
3903
3944
|
}
|
|
3904
3945
|
/**
|
|
3905
3946
|
* Create a rectangular (2D grid) pattern of a shape.
|
|
@@ -2,6 +2,7 @@ const require_shapeTypes = require("./shapeTypes-C4gRoPYX.cjs");
|
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
3
|
const require_topologyQueryFns = require("./topologyQueryFns-BzIV1jHw.cjs");
|
|
4
4
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
5
|
+
const require_shapeFns = require("./shapeFns-m5OBBpM4.cjs");
|
|
5
6
|
//#region src/projection/projectionPlanes.ts
|
|
6
7
|
/** Lookup table mapping each {@link ProjectionPlane} to its camera configuration. */
|
|
7
8
|
var PROJECTION_PLANES = {
|
|
@@ -157,8 +158,15 @@ function isProjectionPlane(plane) {
|
|
|
157
158
|
//#endregion
|
|
158
159
|
//#region src/projection/makeProjectedEdges.ts
|
|
159
160
|
var getEdgesFromOc = (shape) => {
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
try {
|
|
162
|
+
var _usingCtx$1 = require_shapeTypes._usingCtx();
|
|
163
|
+
if (shape.IsNull()) return [];
|
|
164
|
+
return require_topologyQueryFns.getEdges(_usingCtx$1.u(require_shapeTypes.castResultShape(shape))).map((e) => require_errors.unwrap(require_shapeFns.clone(e)));
|
|
165
|
+
} catch (_) {
|
|
166
|
+
_usingCtx$1.e = _;
|
|
167
|
+
} finally {
|
|
168
|
+
_usingCtx$1.d();
|
|
169
|
+
}
|
|
162
170
|
};
|
|
163
171
|
/**
|
|
164
172
|
* Project a 3D shape onto a 2D plane using hidden-line removal (HLR).
|
|
@@ -169,17 +177,25 @@ var getEdgesFromOc = (shape) => {
|
|
|
169
177
|
*/
|
|
170
178
|
function makeProjectedEdges(shape, camera, withHiddenLines = true) {
|
|
171
179
|
const projected = require_shapeTypes.getKernel().projectEdges(shape.wrapped, [...camera.position], [...camera.direction], [...camera.xAxis]);
|
|
180
|
+
const visible = [
|
|
181
|
+
...getEdgesFromOc(projected.visible.sharp),
|
|
182
|
+
...getEdgesFromOc(projected.visible.smooth),
|
|
183
|
+
...getEdgesFromOc(projected.visible.outline)
|
|
184
|
+
];
|
|
185
|
+
const hiddenEdges = [
|
|
186
|
+
...getEdgesFromOc(projected.hidden.sharp),
|
|
187
|
+
...getEdgesFromOc(projected.hidden.smooth),
|
|
188
|
+
...getEdgesFromOc(projected.hidden.outline)
|
|
189
|
+
];
|
|
190
|
+
let hidden;
|
|
191
|
+
if (withHiddenLines) hidden = hiddenEdges;
|
|
192
|
+
else {
|
|
193
|
+
for (const e of hiddenEdges) e[Symbol.dispose]();
|
|
194
|
+
hidden = [];
|
|
195
|
+
}
|
|
172
196
|
return {
|
|
173
|
-
visible
|
|
174
|
-
|
|
175
|
-
...getEdgesFromOc(projected.visible.smooth),
|
|
176
|
-
...getEdgesFromOc(projected.visible.outline)
|
|
177
|
-
],
|
|
178
|
-
hidden: withHiddenLines ? [
|
|
179
|
-
...getEdgesFromOc(projected.hidden.sharp),
|
|
180
|
-
...getEdgesFromOc(projected.hidden.smooth),
|
|
181
|
-
...getEdgesFromOc(projected.hidden.outline)
|
|
182
|
-
] : []
|
|
197
|
+
visible,
|
|
198
|
+
hidden
|
|
183
199
|
};
|
|
184
200
|
}
|
|
185
201
|
//#endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { nt as getKernel,
|
|
2
|
-
import { A as ok, b as err, d as validationError } from "./errors-DNWJsfVU.js";
|
|
1
|
+
import { et as _usingCtx, nt as getKernel, t as castResultShape } from "./shapeTypes-BalkiKtK.js";
|
|
2
|
+
import { A as ok, R as unwrap, b as err, d as validationError } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { s as getEdges } from "./topologyQueryFns-vDjZw1k2.js";
|
|
4
4
|
import { c as vecLength, d as vecNormalize, g as vecSub, r as vecCross } from "./vecOps-SKPRvPH-.js";
|
|
5
|
+
import { t as clone } from "./shapeFns-Gzaax25v.js";
|
|
5
6
|
//#region src/projection/projectionPlanes.ts
|
|
6
7
|
/** Lookup table mapping each {@link ProjectionPlane} to its camera configuration. */
|
|
7
8
|
var PROJECTION_PLANES = {
|
|
@@ -157,8 +158,15 @@ function isProjectionPlane(plane) {
|
|
|
157
158
|
//#endregion
|
|
158
159
|
//#region src/projection/makeProjectedEdges.ts
|
|
159
160
|
var getEdgesFromOc = (shape) => {
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
try {
|
|
162
|
+
var _usingCtx$1 = _usingCtx();
|
|
163
|
+
if (shape.IsNull()) return [];
|
|
164
|
+
return getEdges(_usingCtx$1.u(castResultShape(shape))).map((e) => unwrap(clone(e)));
|
|
165
|
+
} catch (_) {
|
|
166
|
+
_usingCtx$1.e = _;
|
|
167
|
+
} finally {
|
|
168
|
+
_usingCtx$1.d();
|
|
169
|
+
}
|
|
162
170
|
};
|
|
163
171
|
/**
|
|
164
172
|
* Project a 3D shape onto a 2D plane using hidden-line removal (HLR).
|
|
@@ -169,17 +177,25 @@ var getEdgesFromOc = (shape) => {
|
|
|
169
177
|
*/
|
|
170
178
|
function makeProjectedEdges(shape, camera, withHiddenLines = true) {
|
|
171
179
|
const projected = getKernel().projectEdges(shape.wrapped, [...camera.position], [...camera.direction], [...camera.xAxis]);
|
|
180
|
+
const visible = [
|
|
181
|
+
...getEdgesFromOc(projected.visible.sharp),
|
|
182
|
+
...getEdgesFromOc(projected.visible.smooth),
|
|
183
|
+
...getEdgesFromOc(projected.visible.outline)
|
|
184
|
+
];
|
|
185
|
+
const hiddenEdges = [
|
|
186
|
+
...getEdgesFromOc(projected.hidden.sharp),
|
|
187
|
+
...getEdgesFromOc(projected.hidden.smooth),
|
|
188
|
+
...getEdgesFromOc(projected.hidden.outline)
|
|
189
|
+
];
|
|
190
|
+
let hidden;
|
|
191
|
+
if (withHiddenLines) hidden = hiddenEdges;
|
|
192
|
+
else {
|
|
193
|
+
for (const e of hiddenEdges) e[Symbol.dispose]();
|
|
194
|
+
hidden = [];
|
|
195
|
+
}
|
|
172
196
|
return {
|
|
173
|
-
visible
|
|
174
|
-
|
|
175
|
-
...getEdgesFromOc(projected.visible.smooth),
|
|
176
|
-
...getEdgesFromOc(projected.visible.outline)
|
|
177
|
-
],
|
|
178
|
-
hidden: withHiddenLines ? [
|
|
179
|
-
...getEdgesFromOc(projected.hidden.sharp),
|
|
180
|
-
...getEdgesFromOc(projected.hidden.smooth),
|
|
181
|
-
...getEdgesFromOc(projected.hidden.outline)
|
|
182
|
-
] : []
|
|
197
|
+
visible,
|
|
198
|
+
hidden
|
|
183
199
|
};
|
|
184
200
|
}
|
|
185
201
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
1
|
+
const require_textBlueprints = require("./textBlueprints-D5mNvqKF.cjs");
|
|
2
2
|
const require_shapeTypes = require("./shapeTypes-C4gRoPYX.cjs");
|
|
3
3
|
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
4
4
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
@@ -11,12 +11,12 @@ const require_faceFns = require("./faceFns-BbmIuuFt.cjs");
|
|
|
11
11
|
const require_curveFns = require("./curveFns-C2zZ7Xuq.cjs");
|
|
12
12
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
13
13
|
const require_surfaceBuilders = require("./surfaceBuilders-DWHDogVL.cjs");
|
|
14
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
14
|
+
const require_blueprintSketcher = require("./blueprintSketcher-CGnohIOe.cjs");
|
|
15
15
|
const require_helpers = require("./helpers-D0be4TzF.cjs");
|
|
16
|
-
const require_blueprint = require("./blueprint-
|
|
16
|
+
const require_blueprint = require("./blueprint-CN536u9V.cjs");
|
|
17
17
|
const require_cornerFinder = require("./cornerFinder-Bss_mZV9.cjs");
|
|
18
|
-
const require_boolean2D = require("./boolean2D-
|
|
19
|
-
const require_cameraFns = require("./cameraFns-
|
|
18
|
+
const require_boolean2D = require("./boolean2D-DnBT9gQ5.cjs");
|
|
19
|
+
const require_cameraFns = require("./cameraFns-Ckw5prda.cjs");
|
|
20
20
|
//#region src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -1236,6 +1236,7 @@ var edgesToDrawing = (edges) => {
|
|
|
1236
1236
|
var _usingCtx$1 = require_shapeTypes._usingCtx();
|
|
1237
1237
|
const scope = _usingCtx$1.u(new require_shapeTypes.DisposalScope());
|
|
1238
1238
|
const planeSketch = drawRectangle(1e3, 1e3).sketchOnPlane();
|
|
1239
|
+
scope.register(planeSketch.wire);
|
|
1239
1240
|
const planeFace = scope.register(require_errors.unwrap(require_surfaceBuilders.makeFace(planeSketch.wire)));
|
|
1240
1241
|
const stitchedCurves = stitchCurves(edges.map((e) => require_blueprint.edgeToCurve(e, planeFace))).map((s) => new require_blueprint.Blueprint(s));
|
|
1241
1242
|
if (stitchedCurves.length === 0) return new Drawing();
|
|
@@ -1259,10 +1260,15 @@ function drawProjection(shape, projectionCamera = "front") {
|
|
|
1259
1260
|
if (typeof projectionCamera === "string") camera = require_errors.unwrap(require_cameraFns.cameraFromPlane(projectionCamera));
|
|
1260
1261
|
else camera = projectionCamera;
|
|
1261
1262
|
const { visible, hidden } = require_cameraFns.projectEdges(shape, camera);
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1263
|
+
try {
|
|
1264
|
+
return {
|
|
1265
|
+
visible: edgesToDrawing(visible),
|
|
1266
|
+
hidden: edgesToDrawing(hidden)
|
|
1267
|
+
};
|
|
1268
|
+
} finally {
|
|
1269
|
+
for (const e of visible) e[Symbol.dispose]();
|
|
1270
|
+
for (const e of hidden) e[Symbol.dispose]();
|
|
1271
|
+
}
|
|
1266
1272
|
}
|
|
1267
1273
|
/**
|
|
1268
1274
|
* Creates the `Drawing` out of a face
|
|
@@ -10,13 +10,13 @@ import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u a
|
|
|
10
10
|
import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-CH6gaGTf.js";
|
|
11
11
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
12
12
|
import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-HAF4Xtow.js";
|
|
13
|
-
import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-
|
|
13
|
+
import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-CY9DgQqk.js";
|
|
14
14
|
import { _ as samePoint$1, b as subtract2d, c as PRECISION_OFFSET, l as add2d, y as squareDistance2d } from "./helpers-zVYq0h_A.js";
|
|
15
|
-
import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } from "./blueprint-
|
|
15
|
+
import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } from "./blueprint-dqI319c7.js";
|
|
16
16
|
import { t as cornerFinder } from "./cornerFinder-BEe90gzY.js";
|
|
17
|
-
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-
|
|
18
|
-
import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-
|
|
19
|
-
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-
|
|
17
|
+
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-CaAwVwCR.js";
|
|
18
|
+
import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-DBjpb8G_.js";
|
|
19
|
+
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-CythF7Ob.js";
|
|
20
20
|
//#region src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -1236,6 +1236,7 @@ var edgesToDrawing = (edges) => {
|
|
|
1236
1236
|
var _usingCtx$1 = _usingCtx();
|
|
1237
1237
|
const scope = _usingCtx$1.u(new DisposalScope());
|
|
1238
1238
|
const planeSketch = drawRectangle(1e3, 1e3).sketchOnPlane();
|
|
1239
|
+
scope.register(planeSketch.wire);
|
|
1239
1240
|
const planeFace = scope.register(unwrap(makeFace(planeSketch.wire)));
|
|
1240
1241
|
const stitchedCurves = stitchCurves(edges.map((e) => edgeToCurve(e, planeFace))).map((s) => new Blueprint(s));
|
|
1241
1242
|
if (stitchedCurves.length === 0) return new Drawing();
|
|
@@ -1259,10 +1260,15 @@ function drawProjection(shape, projectionCamera = "front") {
|
|
|
1259
1260
|
if (typeof projectionCamera === "string") camera = unwrap(cameraFromPlane(projectionCamera));
|
|
1260
1261
|
else camera = projectionCamera;
|
|
1261
1262
|
const { visible, hidden } = projectEdges(shape, camera);
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1263
|
+
try {
|
|
1264
|
+
return {
|
|
1265
|
+
visible: edgesToDrawing(visible),
|
|
1266
|
+
hidden: edgesToDrawing(hidden)
|
|
1267
|
+
};
|
|
1268
|
+
} finally {
|
|
1269
|
+
for (const e of visible) e[Symbol.dispose]();
|
|
1270
|
+
for (const e of hidden) e[Symbol.dispose]();
|
|
1271
|
+
}
|
|
1266
1272
|
}
|
|
1267
1273
|
/**
|
|
1268
1274
|
* Creates the `Drawing` out of a face
|
|
@@ -2,7 +2,7 @@ const require_shapeTypes = require("./shapeTypes-C4gRoPYX.cjs");
|
|
|
2
2
|
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
3
3
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
4
4
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
5
|
-
const require_blueprint = require("./blueprint-
|
|
5
|
+
const require_blueprint = require("./blueprint-CN536u9V.cjs");
|
|
6
6
|
//#region src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
|
@@ -2,7 +2,7 @@ import { nt as getKernel, r as castShape } from "./shapeTypes-BalkiKtK.js";
|
|
|
2
2
|
import { n as wasmIndex, t as vec3At$1 } from "./vec3-Dpha8d5k.js";
|
|
3
3
|
import { A as ok, b as err, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
4
4
|
import { n as getAtOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
5
|
-
import { f as make2dSegmentCurve, m as make2dThreePointArc, s as make2dBezierCurve, t as Blueprint } from "./blueprint-
|
|
5
|
+
import { f as make2dSegmentCurve, m as make2dThreePointArc, s as make2dBezierCurve, t as Blueprint } from "./blueprint-dqI319c7.js";
|
|
6
6
|
//#region src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
package/dist/io.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_meshFns = require("./meshFns-Df26UzQ9.cjs");
|
|
3
|
-
const require_importFns = require("./importFns-
|
|
3
|
+
const require_importFns = require("./importFns-CvlUuJ59.cjs");
|
|
4
4
|
exports.blueprintToDXF = require_importFns.blueprintToDXF;
|
|
5
5
|
exports.exportDXF = require_importFns.exportDXF;
|
|
6
6
|
exports.exportGlb = require_importFns.exportGlb;
|
package/dist/io.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-CKXYSlFr.js";
|
|
2
|
-
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-
|
|
2
|
+
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-TbwuxynG.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -36,7 +36,9 @@ function buildLawFromProfile(extrusionLength, { profile, endFactor = 1 }) {
|
|
|
36
36
|
function makeSpineWire(start, end) {
|
|
37
37
|
const kernel = require_shapeTypes.getKernel();
|
|
38
38
|
const edge = kernel.makeLineEdge([...start], [...end]);
|
|
39
|
-
|
|
39
|
+
const wire = kernel.makeWire([edge]);
|
|
40
|
+
kernel.dispose(edge);
|
|
41
|
+
return require_shapeTypes.castResultShape(wire);
|
|
40
42
|
}
|
|
41
43
|
/** Build a helix wire for twist extrusion. */
|
|
42
44
|
function makeHelixWire(pitch, height, radius, center, dir, leftHanded = false) {
|
|
@@ -147,16 +149,24 @@ function supportExtrude(wire, center, normal, support) {
|
|
|
147
149
|
* @returns `Result` containing the extruded shape or a shell tuple.
|
|
148
150
|
*/
|
|
149
151
|
function complexExtrude(wire, center, normal, profileShape, shellMode = false) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
try {
|
|
153
|
+
var _usingCtx$1 = require_shapeTypes._usingCtx();
|
|
154
|
+
const extrusionLength = require_vecOps.vecLength(normal);
|
|
155
|
+
if (extrusionLength < 1e-10) return require_errors.err(require_errors.validationError("ZERO_LENGTH_EXTRUSION", "Extrusion vector cannot have zero length"));
|
|
156
|
+
const endPoint = require_vecOps.vecAdd(center, normal);
|
|
157
|
+
const spine = _usingCtx$1.u(makeSpineWire(center, endPoint));
|
|
158
|
+
let law = null;
|
|
159
|
+
if (profileShape) {
|
|
160
|
+
const lawResult = buildLawFromProfile(extrusionLength, profileShape);
|
|
161
|
+
if (require_errors.isErr(lawResult)) return lawResult;
|
|
162
|
+
law = lawResult.value;
|
|
163
|
+
}
|
|
164
|
+
return sweep(wire, spine, { law }, shellMode);
|
|
165
|
+
} catch (_) {
|
|
166
|
+
_usingCtx$1.e = _;
|
|
167
|
+
} finally {
|
|
168
|
+
_usingCtx$1.d();
|
|
158
169
|
}
|
|
159
|
-
return sweep(wire, spine, { law }, shellMode);
|
|
160
170
|
}
|
|
161
171
|
/**
|
|
162
172
|
* Extrude a wire along a normal with helical twist and optional profile scaling.
|
|
@@ -174,22 +184,31 @@ function complexExtrude(wire, center, normal, profileShape, shellMode = false) {
|
|
|
174
184
|
* @returns `Result` containing the twisted extruded shape or a shell tuple.
|
|
175
185
|
*/
|
|
176
186
|
function twistExtrude(wire, angleDegrees, center, normal, profileShape, shellMode = false) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
law =
|
|
187
|
+
try {
|
|
188
|
+
var _usingCtx3 = require_shapeTypes._usingCtx();
|
|
189
|
+
if (Math.abs(angleDegrees) < 1e-10) return require_errors.err(require_errors.validationError("ZERO_TWIST_ANGLE", "Twist angle cannot be zero"));
|
|
190
|
+
const extrusionLength = require_vecOps.vecLength(normal);
|
|
191
|
+
if (extrusionLength < 1e-10) return require_errors.err(require_errors.validationError("ZERO_LENGTH_EXTRUSION", "Extrusion vector cannot have zero length"));
|
|
192
|
+
const endPoint = require_vecOps.vecAdd(center, normal);
|
|
193
|
+
const spine = _usingCtx3.u(makeSpineWire(center, endPoint));
|
|
194
|
+
const leftHanded = angleDegrees < 0;
|
|
195
|
+
const pitch = 360 / Math.abs(angleDegrees) * extrusionLength;
|
|
196
|
+
const auxiliarySpine = _usingCtx3.u(makeHelixWire(pitch, extrusionLength, 1, center, normal, leftHanded));
|
|
197
|
+
let law = null;
|
|
198
|
+
if (profileShape) {
|
|
199
|
+
const lawResult = buildLawFromProfile(extrusionLength, profileShape);
|
|
200
|
+
if (require_errors.isErr(lawResult)) return lawResult;
|
|
201
|
+
law = lawResult.value;
|
|
202
|
+
}
|
|
203
|
+
return sweep(wire, spine, {
|
|
204
|
+
auxiliarySpine,
|
|
205
|
+
law
|
|
206
|
+
}, shellMode);
|
|
207
|
+
} catch (_) {
|
|
208
|
+
_usingCtx3.e = _;
|
|
209
|
+
} finally {
|
|
210
|
+
_usingCtx3.d();
|
|
188
211
|
}
|
|
189
|
-
return sweep(wire, spine, {
|
|
190
|
-
auxiliarySpine,
|
|
191
|
-
law
|
|
192
|
-
}, shellMode);
|
|
193
212
|
}
|
|
194
213
|
/** Validate that explicit section locations are in [0,1] and strictly increasing. */
|
|
195
214
|
function validateSectionLocations(sections) {
|