brepjs 8.0.0 → 8.0.2
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/blueprints/booleanHelpers.d.ts +32 -0
- package/dist/2d/blueprints/booleanHelpers.d.ts.map +1 -0
- package/dist/2d/blueprints/booleanOperations.d.ts +5 -3
- package/dist/2d/blueprints/booleanOperations.d.ts.map +1 -1
- package/dist/2d/blueprints/intersectionSegments.d.ts +12 -0
- package/dist/2d/blueprints/intersectionSegments.d.ts.map +1 -0
- package/dist/2d/blueprints/segmentAssembly.d.ts +31 -0
- package/dist/2d/blueprints/segmentAssembly.d.ts.map +1 -0
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +8 -8
- package/dist/{Blueprint-D3JfGJTz.js → Blueprint-B9fhnpFp.js} +117 -30
- package/dist/{Blueprint-CVctc41Z.cjs → Blueprint-VGbo3izk.cjs} +111 -24
- package/dist/{boolean2D-BdZATaHs.cjs → boolean2D-B1XrGVgx.cjs} +426 -345
- package/dist/{boolean2D-hOw5Qay5.js → boolean2D-_WiqPxWZ.js} +391 -310
- package/dist/{booleanFns-BBSVKhL2.cjs → booleanFns-BxW-N3rP.cjs} +12 -16
- package/dist/{booleanFns-CqehfzcK.js → booleanFns-CkccZ7UL.js} +14 -18
- package/dist/brepjs.cjs +133 -62
- package/dist/brepjs.js +290 -217
- package/dist/{cast-DQaUibmm.js → cast-C4Ff_1Qe.js} +2 -2
- package/dist/{cast-DkB0GKmQ.cjs → cast-DIiyxDLo.cjs} +2 -2
- package/dist/core/disposal.d.ts +1 -1
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core.cjs +3 -3
- package/dist/core.js +3 -3
- package/dist/cornerFinder-BndBNtJE.cjs +58 -0
- package/dist/cornerFinder-DzGzfiqb.js +59 -0
- package/dist/curveBuilders-BUoFO1UG.cjs +196 -0
- package/dist/curveBuilders-CBlIWlbU.js +197 -0
- package/dist/{curveFns-BilyYL_s.cjs → curveFns-BrJDkaWi.cjs} +31 -44
- package/dist/{curveFns-CdVE4da7.js → curveFns-BshHA9Ys.js} +31 -44
- package/dist/{drawFns-921SkhDL.js → drawFns-Btmlh_Oz.js} +13 -14
- package/dist/{drawFns-CUyx50gi.cjs → drawFns-D2eDcf4k.cjs} +58 -59
- package/dist/{faceFns-DHu-2JpA.js → faceFns-DDzCECn3.js} +3 -3
- package/dist/{faceFns-BwK7FP7N.cjs → faceFns-NDRFeekj.cjs} +3 -3
- package/dist/helpers-Ck8GJ58k.cjs +203 -0
- package/dist/helpers-jku2V1DY.js +204 -0
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/occtAdapter.d.ts +1 -0
- package/dist/kernel/occtAdapter.d.ts.map +1 -1
- package/dist/kernel/sweepOps.d.ts +8 -0
- package/dist/kernel/sweepOps.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +1 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/loft-Bk9EM0gZ.js +373 -0
- package/dist/loft-DJXwxV_L.cjs +372 -0
- package/dist/{measurement-C5JGCuUP.js → measurement-DlXaTzKc.js} +3 -3
- package/dist/{measurement-fxm_pW7x.cjs → measurement-LcGh4wV0.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-AqAjTTVl.js → meshFns-Djzdn-CS.js} +1 -1
- package/dist/{meshFns-BhrZGi6w.cjs → meshFns-c8lDKfYy.cjs} +1 -1
- package/dist/{occtBoundary-du8_ex-p.cjs → occtBoundary-6kQSl3cF.cjs} +21 -0
- package/dist/{occtBoundary-CwegMzqc.js → occtBoundary-CqXvDhZY.js} +26 -5
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/extrudeUtils.d.ts +17 -0
- package/dist/operations/extrudeUtils.d.ts.map +1 -1
- package/dist/{operations-C1rWoba2.js → operations-CrQlFDHc.js} +30 -7
- package/dist/{operations-BP1wVDw0.cjs → operations-Do-WZGXc.cjs} +30 -7
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +4 -4
- package/dist/query/cornerFinder.d.ts +48 -0
- package/dist/query/cornerFinder.d.ts.map +1 -0
- package/dist/query/directionUtils.d.ts +6 -0
- package/dist/query/directionUtils.d.ts.map +1 -0
- package/dist/query/edgeFinder.d.ts +15 -0
- package/dist/query/edgeFinder.d.ts.map +1 -0
- package/dist/query/faceFinder.d.ts +15 -0
- package/dist/query/faceFinder.d.ts.map +1 -0
- package/dist/query/finderCore.d.ts +35 -0
- package/dist/query/finderCore.d.ts.map +1 -0
- package/dist/query/finderFns.d.ts +21 -106
- package/dist/query/finderFns.d.ts.map +1 -1
- package/dist/query/shapeDistanceFilter.d.ts +11 -0
- package/dist/query/shapeDistanceFilter.d.ts.map +1 -0
- package/dist/query/vertexFinder.d.ts +16 -0
- package/dist/query/vertexFinder.d.ts.map +1 -0
- package/dist/query/wireFinder.d.ts +10 -0
- package/dist/query/wireFinder.d.ts.map +1 -0
- package/dist/query.cjs +42 -5
- package/dist/query.js +40 -2
- package/dist/{shapeFns-BrF97sKt.js → shapeFns-DQtpzndX.js} +17 -18
- package/dist/{shapeFns-BvOndshS.cjs → shapeFns-cN4qGpbO.cjs} +6 -7
- package/dist/{shapeTypes-DKhwEnUM.cjs → shapeTypes-BJ3Hmskg.cjs} +24 -20
- package/dist/{shapeTypes-BlSElW8z.js → shapeTypes-C9sUsmEW.js} +32 -28
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching/Sketcher2d.d.ts +12 -4
- package/dist/sketching/Sketcher2d.d.ts.map +1 -1
- package/dist/sketching/ellipseUtils.d.ts +29 -0
- package/dist/sketching/ellipseUtils.d.ts.map +1 -0
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/curveBuilders.d.ts +75 -0
- package/dist/topology/curveBuilders.d.ts.map +1 -0
- package/dist/topology/curveFns.d.ts.map +1 -1
- package/dist/topology/primitiveFns.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/shapeHelpers.d.ts +6 -173
- package/dist/topology/shapeHelpers.d.ts.map +1 -1
- package/dist/topology/shapeUtils.d.ts +13 -0
- package/dist/topology/shapeUtils.d.ts.map +1 -0
- package/dist/topology/solidBuilders.d.ts +70 -0
- package/dist/topology/solidBuilders.d.ts.map +1 -0
- package/dist/topology/surfaceBuilders.d.ts +35 -0
- package/dist/topology/surfaceBuilders.d.ts.map +1 -0
- package/dist/topology/wrapperFns.d.ts +1 -0
- package/dist/topology/wrapperFns.d.ts.map +1 -1
- package/dist/{topology-tFzqSrGH.js → topology-CtfUZwLR.js} +8 -8
- package/dist/{topology-CIooytHH.cjs → topology-DXq8dLsi.cjs} +8 -8
- package/dist/topology.cjs +7 -7
- package/dist/topology.js +31 -31
- package/dist/{vectors-CBuaMeZv.js → vectors-BVgXsYWl.js} +1 -1
- package/dist/{vectors-ChWEZPwy.cjs → vectors-DK2hEKcI.cjs} +1 -1
- package/dist/vectors.cjs +2 -2
- package/dist/vectors.js +2 -2
- package/package.json +1 -1
- package/dist/loft-BzWFokmC.cjs +0 -178
- package/dist/loft-CtG5nMq5.js +0 -179
- package/dist/query-V6nV-VfL.js +0 -396
- package/dist/query-hMSmOWJP.cjs +0 -395
- package/dist/shapeHelpers-B2SXz1p4.cjs +0 -488
- package/dist/shapeHelpers-BcoZf2N9.js +0 -489
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const occtBoundary = require("./occtBoundary-6kQSl3cF.cjs");
|
|
3
|
+
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
4
|
+
const cast = require("./cast-DIiyxDLo.cjs");
|
|
5
|
+
const errors = require("./errors-DK1VAdP4.cjs");
|
|
6
|
+
const shapeTypes = require("./shapeTypes-BJ3Hmskg.cjs");
|
|
7
|
+
const curveBuilders = require("./curveBuilders-BUoFO1UG.cjs");
|
|
8
|
+
function buildLawFromProfile(extrusionLength, { profile, endFactor = 1 }) {
|
|
9
|
+
const oc = occtBoundary.getKernel().oc;
|
|
10
|
+
const r = shapeTypes.gcWithScope();
|
|
11
|
+
let law;
|
|
12
|
+
if (profile === "s-curve") {
|
|
13
|
+
law = r(new oc.Law_S());
|
|
14
|
+
law.Set_1(0, 1, extrusionLength, endFactor);
|
|
15
|
+
} else if (profile === "linear") {
|
|
16
|
+
law = r(new oc.Law_Linear());
|
|
17
|
+
law.Set(0, 1, extrusionLength, endFactor);
|
|
18
|
+
} else {
|
|
19
|
+
return errors.err(
|
|
20
|
+
errors.validationError("UNSUPPORTED_PROFILE", `Unsupported extrusion profile: ${String(profile)}`)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return errors.ok(law.Trim(0, extrusionLength, 1e-6));
|
|
24
|
+
}
|
|
25
|
+
function weldShapes(facesOrShells) {
|
|
26
|
+
const sewn = occtBoundary.getKernel().sew(facesOrShells.map((s) => s.wrapped));
|
|
27
|
+
return errors.unwrap(cast.cast(errors.unwrap(cast.downcast(sewn))));
|
|
28
|
+
}
|
|
29
|
+
function weldShellsAndFaces(facesOrShells, ignoreType = false) {
|
|
30
|
+
const shell = weldShapes(facesOrShells);
|
|
31
|
+
if (!ignoreType && !shapeTypes.isShell(shell))
|
|
32
|
+
return errors.err(errors.typeCastError("WELD_NOT_SHELL", "Could not make a shell from faces and shells"));
|
|
33
|
+
return errors.ok(shell);
|
|
34
|
+
}
|
|
35
|
+
function makeCylinder(radius, height, location = [0, 0, 0], direction = [0, 0, 1]) {
|
|
36
|
+
const oc = occtBoundary.getKernel().oc;
|
|
37
|
+
const r = shapeTypes.gcWithScope();
|
|
38
|
+
const axis = r(occtBoundary.makeOcAx2(location, direction));
|
|
39
|
+
const cylinder = r(new oc.BRepPrimAPI_MakeCylinder_3(axis, radius, height));
|
|
40
|
+
return shapeTypes.createSolid(cylinder.Shape());
|
|
41
|
+
}
|
|
42
|
+
function makeSphere(radius) {
|
|
43
|
+
const oc = occtBoundary.getKernel().oc;
|
|
44
|
+
const r = shapeTypes.gcWithScope();
|
|
45
|
+
const sphereMaker = r(new oc.BRepPrimAPI_MakeSphere_1(radius));
|
|
46
|
+
return shapeTypes.createSolid(sphereMaker.Shape());
|
|
47
|
+
}
|
|
48
|
+
function makeCone(radius1, radius2, height, location = [0, 0, 0], direction = [0, 0, 1]) {
|
|
49
|
+
const oc = occtBoundary.getKernel().oc;
|
|
50
|
+
const r = shapeTypes.gcWithScope();
|
|
51
|
+
const axis = r(occtBoundary.makeOcAx2(location, direction));
|
|
52
|
+
const coneMaker = r(new oc.BRepPrimAPI_MakeCone_3(axis, radius1, radius2, height));
|
|
53
|
+
return shapeTypes.createSolid(coneMaker.Shape());
|
|
54
|
+
}
|
|
55
|
+
function makeTorus(majorRadius, minorRadius, location = [0, 0, 0], direction = [0, 0, 1]) {
|
|
56
|
+
const oc = occtBoundary.getKernel().oc;
|
|
57
|
+
const r = shapeTypes.gcWithScope();
|
|
58
|
+
const axis = r(occtBoundary.makeOcAx2(location, direction));
|
|
59
|
+
const torusMaker = r(new oc.BRepPrimAPI_MakeTorus_5(axis, majorRadius, minorRadius));
|
|
60
|
+
return shapeTypes.createSolid(torusMaker.Shape());
|
|
61
|
+
}
|
|
62
|
+
function makeEllipsoidTransform(x, y, z) {
|
|
63
|
+
const oc = occtBoundary.getKernel().oc;
|
|
64
|
+
const r = shapeTypes.gcWithScope();
|
|
65
|
+
const xyRatio = Math.sqrt(x * y / z);
|
|
66
|
+
const xzRatio = x / xyRatio;
|
|
67
|
+
const yzRatio = y / xyRatio;
|
|
68
|
+
const ax1 = r(occtBoundary.makeOcAx1([0, 0, 0], [0, 1, 0]));
|
|
69
|
+
const ax2 = r(occtBoundary.makeOcAx1([0, 0, 0], [0, 0, 1]));
|
|
70
|
+
const ax3 = r(occtBoundary.makeOcAx1([0, 0, 0], [1, 0, 0]));
|
|
71
|
+
const transform = new oc.gp_GTrsf_1();
|
|
72
|
+
transform.SetAffinity_1(ax1, xzRatio);
|
|
73
|
+
const xy = r(new oc.gp_GTrsf_1());
|
|
74
|
+
xy.SetAffinity_1(ax2, xyRatio);
|
|
75
|
+
const yz = r(new oc.gp_GTrsf_1());
|
|
76
|
+
yz.SetAffinity_1(ax3, yzRatio);
|
|
77
|
+
transform.Multiply(xy);
|
|
78
|
+
transform.Multiply(yz);
|
|
79
|
+
return {
|
|
80
|
+
transform,
|
|
81
|
+
applyToPoint(p) {
|
|
82
|
+
const r2 = shapeTypes.gcWithScope();
|
|
83
|
+
const coords = r2(p.XYZ());
|
|
84
|
+
transform.Transforms_1(coords);
|
|
85
|
+
return new oc.gp_Pnt_2(coords);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function convertToJSArray(arrayOfPoints) {
|
|
90
|
+
const newArray = [];
|
|
91
|
+
for (let row = arrayOfPoints.LowerRow(); row <= arrayOfPoints.UpperRow(); row++) {
|
|
92
|
+
const rowArr = [];
|
|
93
|
+
newArray.push(rowArr);
|
|
94
|
+
for (let c = arrayOfPoints.LowerCol(); c <= arrayOfPoints.UpperCol(); c++) {
|
|
95
|
+
const pnt = arrayOfPoints.Value(row, c);
|
|
96
|
+
rowArr.push(pnt);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return newArray;
|
|
100
|
+
}
|
|
101
|
+
function makeEllipsoid(aLength, bLength, cLength) {
|
|
102
|
+
const oc = occtBoundary.getKernel().oc;
|
|
103
|
+
const r = shapeTypes.gcWithScope();
|
|
104
|
+
const sphere = r(new oc.gp_Sphere_1());
|
|
105
|
+
sphere.SetRadius(1);
|
|
106
|
+
const sphericalSurface = r(new oc.Geom_SphericalSurface_2(sphere));
|
|
107
|
+
const baseSurface = oc.GeomConvert.SurfaceToBSplineSurface(sphericalSurface.UReversed()).get();
|
|
108
|
+
try {
|
|
109
|
+
const poles = convertToJSArray(baseSurface.Poles_2());
|
|
110
|
+
const ellipsoidTrsf = makeEllipsoidTransform(aLength, bLength, cLength);
|
|
111
|
+
poles.forEach((columns, rowIdx) => {
|
|
112
|
+
columns.forEach((value, colIdx) => {
|
|
113
|
+
const newPoint = ellipsoidTrsf.applyToPoint(value);
|
|
114
|
+
baseSurface.SetPole_1(rowIdx + 1, colIdx + 1, newPoint);
|
|
115
|
+
newPoint.delete();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
ellipsoidTrsf.transform.delete();
|
|
119
|
+
const shell = errors.unwrap(
|
|
120
|
+
cast.cast(r(new oc.BRepBuilderAPI_MakeShell_2(baseSurface.UReversed(), false)).Shell())
|
|
121
|
+
);
|
|
122
|
+
return errors.unwrap(makeSolid([shell]));
|
|
123
|
+
} finally {
|
|
124
|
+
baseSurface.delete();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function makeVertex(point) {
|
|
128
|
+
const oc = occtBoundary.getKernel().oc;
|
|
129
|
+
const r = shapeTypes.gcWithScope();
|
|
130
|
+
const pnt = r(occtBoundary.toOcPnt(point));
|
|
131
|
+
const vertexMaker = r(new oc.BRepBuilderAPI_MakeVertex(pnt));
|
|
132
|
+
return shapeTypes.createVertex(vertexMaker.Vertex());
|
|
133
|
+
}
|
|
134
|
+
function makeOffset(face, offset, tolerance = 1e-6) {
|
|
135
|
+
const oc = occtBoundary.getKernel().oc;
|
|
136
|
+
const progress = new oc.Message_ProgressRange_1();
|
|
137
|
+
const offsetBuilder = new oc.BRepOffsetAPI_MakeOffsetShape();
|
|
138
|
+
try {
|
|
139
|
+
offsetBuilder.PerformByJoin(
|
|
140
|
+
face.wrapped,
|
|
141
|
+
offset,
|
|
142
|
+
tolerance,
|
|
143
|
+
oc.BRepOffset_Mode.BRepOffset_Skin,
|
|
144
|
+
false,
|
|
145
|
+
false,
|
|
146
|
+
oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
147
|
+
false,
|
|
148
|
+
progress
|
|
149
|
+
);
|
|
150
|
+
return errors.andThen(
|
|
151
|
+
cast.downcast(offsetBuilder.Shape()),
|
|
152
|
+
(downcasted) => errors.andThen(cast.cast(downcasted), (newShape) => {
|
|
153
|
+
if (!shapeTypes.isShape3D(newShape))
|
|
154
|
+
return errors.err(errors.typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
|
|
155
|
+
return errors.ok(newShape);
|
|
156
|
+
})
|
|
157
|
+
);
|
|
158
|
+
} finally {
|
|
159
|
+
offsetBuilder.delete();
|
|
160
|
+
progress.delete();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function makeCompound(shapeArray) {
|
|
164
|
+
const oc = occtBoundary.getKernel().oc;
|
|
165
|
+
const builder = new oc.TopoDS_Builder();
|
|
166
|
+
const compound = new oc.TopoDS_Compound();
|
|
167
|
+
builder.MakeCompound(compound);
|
|
168
|
+
for (const s of shapeArray) {
|
|
169
|
+
builder.Add(compound, s.wrapped);
|
|
170
|
+
}
|
|
171
|
+
builder.delete();
|
|
172
|
+
return shapeTypes.createCompound(compound);
|
|
173
|
+
}
|
|
174
|
+
function makeSolid(facesOrShells) {
|
|
175
|
+
const r = shapeTypes.gcWithScope();
|
|
176
|
+
const oc = occtBoundary.getKernel().oc;
|
|
177
|
+
const shell = weldShapes(facesOrShells);
|
|
178
|
+
return errors.andThen(cast.cast(r(new oc.ShapeFix_Solid_1()).SolidFromShell(shell.wrapped)), (solid) => {
|
|
179
|
+
if (!shapeTypes.isSolid(solid))
|
|
180
|
+
return errors.err(errors.typeCastError("SOLID_BUILD_FAILED", "Could not make a solid of faces and shells"));
|
|
181
|
+
return errors.ok(solid);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const basicFaceExtrusion = (face, extrusionVec) => {
|
|
185
|
+
const oc = occtBoundary.getKernel().oc;
|
|
186
|
+
const [r, gc] = shapeTypes.localGC();
|
|
187
|
+
const vec = occtBoundary.toVec3(extrusionVec);
|
|
188
|
+
const ocVec = r(new oc.gp_Vec_4(vec[0], vec[1], vec[2]));
|
|
189
|
+
const solidBuilder = r(new oc.BRepPrimAPI_MakePrism_1(face.wrapped, ocVec, false, true));
|
|
190
|
+
const solid = shapeTypes.createSolid(errors.unwrap(cast.downcast(solidBuilder.Shape())));
|
|
191
|
+
gc();
|
|
192
|
+
return solid;
|
|
193
|
+
};
|
|
194
|
+
const revolution = (face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) => {
|
|
195
|
+
const oc = occtBoundary.getKernel().oc;
|
|
196
|
+
const [r, gc] = shapeTypes.localGC();
|
|
197
|
+
const centerVec = occtBoundary.toVec3(center);
|
|
198
|
+
const directionVec = occtBoundary.toVec3(direction);
|
|
199
|
+
const ax = r(occtBoundary.makeOcAx1(centerVec, directionVec));
|
|
200
|
+
const revolBuilder = r(new oc.BRepPrimAPI_MakeRevol_1(face.wrapped, ax, angle * vecOps.DEG2RAD, false));
|
|
201
|
+
const result = errors.andThen(cast.cast(revolBuilder.Shape()), (shape) => {
|
|
202
|
+
if (!cast.isShape3D(shape))
|
|
203
|
+
return errors.err(errors.typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
|
|
204
|
+
return errors.ok(shape);
|
|
205
|
+
});
|
|
206
|
+
gc();
|
|
207
|
+
return result;
|
|
208
|
+
};
|
|
209
|
+
function genericSweep(wire, spine, {
|
|
210
|
+
frenet = false,
|
|
211
|
+
auxiliarySpine,
|
|
212
|
+
law = null,
|
|
213
|
+
transitionMode = "right",
|
|
214
|
+
withContact,
|
|
215
|
+
support,
|
|
216
|
+
forceProfileSpineOthogonality,
|
|
217
|
+
mode: sweepMode,
|
|
218
|
+
tolerance,
|
|
219
|
+
boundTolerance,
|
|
220
|
+
angularTolerance,
|
|
221
|
+
maxDegree,
|
|
222
|
+
maxSegments
|
|
223
|
+
} = {}, shellMode = false) {
|
|
224
|
+
if (sweepMode === "simple" && !shellMode) {
|
|
225
|
+
const kernel = occtBoundary.getKernel();
|
|
226
|
+
const resultOc = kernel.simplePipe(wire.wrapped, spine.wrapped);
|
|
227
|
+
const result = errors.andThen(cast.cast(resultOc), (shape2) => {
|
|
228
|
+
if (!cast.isShape3D(shape2))
|
|
229
|
+
return errors.err(errors.typeCastError("SWEEP_NOT_3D", "Simple pipe did not produce a 3D shape"));
|
|
230
|
+
return errors.ok(shape2);
|
|
231
|
+
});
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
const oc = occtBoundary.getKernel().oc;
|
|
235
|
+
const [r, gc] = shapeTypes.localGC();
|
|
236
|
+
const withCorrection = transitionMode === "round" ? true : !!forceProfileSpineOthogonality;
|
|
237
|
+
const sweepBuilder = r(new oc.BRepOffsetAPI_MakePipeShell(spine.wrapped));
|
|
238
|
+
if (tolerance !== void 0) {
|
|
239
|
+
sweepBuilder.SetTolerance(tolerance, boundTolerance ?? tolerance, angularTolerance ?? 1e-7);
|
|
240
|
+
}
|
|
241
|
+
if (maxDegree !== void 0) {
|
|
242
|
+
sweepBuilder.SetMaxDegree(maxDegree);
|
|
243
|
+
}
|
|
244
|
+
if (maxSegments !== void 0) {
|
|
245
|
+
sweepBuilder.SetMaxSegments(maxSegments);
|
|
246
|
+
}
|
|
247
|
+
{
|
|
248
|
+
const mode = {
|
|
249
|
+
transformed: oc.BRepBuilderAPI_TransitionMode.BRepBuilderAPI_Transformed,
|
|
250
|
+
round: oc.BRepBuilderAPI_TransitionMode.BRepBuilderAPI_RoundCorner,
|
|
251
|
+
right: oc.BRepBuilderAPI_TransitionMode.BRepBuilderAPI_RightCorner
|
|
252
|
+
}[transitionMode];
|
|
253
|
+
if (mode) sweepBuilder.SetTransitionMode(mode);
|
|
254
|
+
}
|
|
255
|
+
if (support) {
|
|
256
|
+
sweepBuilder.SetMode_4(support);
|
|
257
|
+
} else if (frenet) {
|
|
258
|
+
sweepBuilder.SetMode_1(frenet);
|
|
259
|
+
}
|
|
260
|
+
if (auxiliarySpine) {
|
|
261
|
+
sweepBuilder.SetMode_5(
|
|
262
|
+
auxiliarySpine.wrapped,
|
|
263
|
+
false,
|
|
264
|
+
oc.BRepFill_TypeOfContact.BRepFill_NoContact
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
if (!law) sweepBuilder.Add_1(wire.wrapped, !!withContact, withCorrection);
|
|
268
|
+
else sweepBuilder.SetLaw_1(wire.wrapped, law, !!withContact, withCorrection);
|
|
269
|
+
const progress = r(new oc.Message_ProgressRange_1());
|
|
270
|
+
sweepBuilder.Build(progress);
|
|
271
|
+
if (!sweepBuilder.IsDone()) {
|
|
272
|
+
gc();
|
|
273
|
+
return errors.err(errors.occtError("SWEEP_FAILED", "Sweep operation failed"));
|
|
274
|
+
}
|
|
275
|
+
if (!shellMode) {
|
|
276
|
+
sweepBuilder.MakeSolid();
|
|
277
|
+
}
|
|
278
|
+
const shape = errors.unwrap(cast.cast(sweepBuilder.Shape()));
|
|
279
|
+
if (!cast.isShape3D(shape)) {
|
|
280
|
+
gc();
|
|
281
|
+
return errors.err(errors.typeCastError("SWEEP_NOT_3D", "Sweep did not produce a 3D shape"));
|
|
282
|
+
}
|
|
283
|
+
if (shellMode) {
|
|
284
|
+
const startWire = errors.unwrap(cast.cast(sweepBuilder.FirstShape()));
|
|
285
|
+
const endWire = errors.unwrap(cast.cast(sweepBuilder.LastShape()));
|
|
286
|
+
if (!cast.isWire(startWire)) {
|
|
287
|
+
gc();
|
|
288
|
+
return errors.err(errors.typeCastError("SWEEP_START_NOT_WIRE", "Sweep did not produce a start Wire"));
|
|
289
|
+
}
|
|
290
|
+
if (!cast.isWire(endWire)) {
|
|
291
|
+
gc();
|
|
292
|
+
return errors.err(errors.typeCastError("SWEEP_END_NOT_WIRE", "Sweep did not produce an end Wire"));
|
|
293
|
+
}
|
|
294
|
+
gc();
|
|
295
|
+
return errors.ok([shape, startWire, endWire]);
|
|
296
|
+
}
|
|
297
|
+
gc();
|
|
298
|
+
return errors.ok(shape);
|
|
299
|
+
}
|
|
300
|
+
function complexExtrude(wire, center, normal, profileShape, shellMode = false) {
|
|
301
|
+
const [r, gc] = shapeTypes.localGC();
|
|
302
|
+
const centerVec = occtBoundary.toVec3(center);
|
|
303
|
+
const normalVec = occtBoundary.toVec3(normal);
|
|
304
|
+
const endVec = vecOps.vecAdd(centerVec, normalVec);
|
|
305
|
+
const mainSpineEdge = r(curveBuilders.makeLine(centerVec, endVec));
|
|
306
|
+
const spine = r(errors.unwrap(curveBuilders.assembleWire([mainSpineEdge])));
|
|
307
|
+
const law = profileShape ? r(errors.unwrap(buildLawFromProfile(vecOps.vecLength(normalVec), profileShape))) : null;
|
|
308
|
+
const result = shellMode ? genericSweep(wire, spine, { law }, shellMode) : genericSweep(wire, spine, { law }, shellMode);
|
|
309
|
+
gc();
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
function twistExtrude(wire, angleDegrees, center, normal, profileShape, shellMode = false) {
|
|
313
|
+
const [r, gc] = shapeTypes.localGC();
|
|
314
|
+
const centerVec = occtBoundary.toVec3(center);
|
|
315
|
+
const normalVec = occtBoundary.toVec3(normal);
|
|
316
|
+
const endVec = vecOps.vecAdd(centerVec, normalVec);
|
|
317
|
+
const mainSpineEdge = r(curveBuilders.makeLine(centerVec, endVec));
|
|
318
|
+
const spine = r(errors.unwrap(curveBuilders.assembleWire([mainSpineEdge])));
|
|
319
|
+
const extrusionLength = vecOps.vecLength(normalVec);
|
|
320
|
+
const pitch = 360 / angleDegrees * extrusionLength;
|
|
321
|
+
const radius = 1;
|
|
322
|
+
const auxiliarySpine = r(curveBuilders.makeHelix(pitch, extrusionLength, radius, centerVec, normalVec));
|
|
323
|
+
const law = profileShape ? r(errors.unwrap(buildLawFromProfile(extrusionLength, profileShape))) : null;
|
|
324
|
+
const result = shellMode ? genericSweep(wire, spine, { auxiliarySpine, law }, shellMode) : genericSweep(wire, spine, { auxiliarySpine, law }, shellMode);
|
|
325
|
+
gc();
|
|
326
|
+
return result;
|
|
327
|
+
}
|
|
328
|
+
const loft = (wires, { ruled = true, startPoint, endPoint } = {}, returnShell = false) => {
|
|
329
|
+
if (wires.length === 0 && !startPoint && !endPoint) {
|
|
330
|
+
return errors.err(errors.validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
331
|
+
}
|
|
332
|
+
const oc = occtBoundary.getKernel().oc;
|
|
333
|
+
const [r, gc] = shapeTypes.localGC();
|
|
334
|
+
const loftBuilder = r(new oc.BRepOffsetAPI_ThruSections(!returnShell, ruled, 1e-6));
|
|
335
|
+
if (startPoint) {
|
|
336
|
+
loftBuilder.AddVertex(r(makeVertex(occtBoundary.toVec3(startPoint))).wrapped);
|
|
337
|
+
}
|
|
338
|
+
wires.forEach((w) => loftBuilder.AddWire(w.wrapped));
|
|
339
|
+
if (endPoint) {
|
|
340
|
+
loftBuilder.AddVertex(r(makeVertex(occtBoundary.toVec3(endPoint))).wrapped);
|
|
341
|
+
}
|
|
342
|
+
const progress = r(new oc.Message_ProgressRange_1());
|
|
343
|
+
loftBuilder.Build(progress);
|
|
344
|
+
if (!loftBuilder.IsDone()) {
|
|
345
|
+
gc();
|
|
346
|
+
return errors.err(errors.occtError("LOFT_FAILED", "Loft operation failed"));
|
|
347
|
+
}
|
|
348
|
+
const result = errors.andThen(cast.cast(loftBuilder.Shape()), (shape) => {
|
|
349
|
+
if (!cast.isShape3D(shape))
|
|
350
|
+
return errors.err(errors.typeCastError("LOFT_NOT_3D", "Loft did not produce a 3D shape"));
|
|
351
|
+
return errors.ok(shape);
|
|
352
|
+
});
|
|
353
|
+
gc();
|
|
354
|
+
return result;
|
|
355
|
+
};
|
|
356
|
+
exports.basicFaceExtrusion = basicFaceExtrusion;
|
|
357
|
+
exports.buildLawFromProfile = buildLawFromProfile;
|
|
358
|
+
exports.complexExtrude = complexExtrude;
|
|
359
|
+
exports.genericSweep = genericSweep;
|
|
360
|
+
exports.loft = loft;
|
|
361
|
+
exports.makeCompound = makeCompound;
|
|
362
|
+
exports.makeCone = makeCone;
|
|
363
|
+
exports.makeCylinder = makeCylinder;
|
|
364
|
+
exports.makeEllipsoid = makeEllipsoid;
|
|
365
|
+
exports.makeOffset = makeOffset;
|
|
366
|
+
exports.makeSolid = makeSolid;
|
|
367
|
+
exports.makeSphere = makeSphere;
|
|
368
|
+
exports.makeTorus = makeTorus;
|
|
369
|
+
exports.makeVertex = makeVertex;
|
|
370
|
+
exports.revolution = revolution;
|
|
371
|
+
exports.twistExtrude = twistExtrude;
|
|
372
|
+
exports.weldShellsAndFaces = weldShellsAndFaces;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getKernel, s as surfaceCurvature } from "./occtBoundary-
|
|
2
|
-
import {
|
|
3
|
-
import { u as uvBounds } from "./faceFns-
|
|
1
|
+
import { g as getKernel, s as surfaceCurvature } from "./occtBoundary-CqXvDhZY.js";
|
|
2
|
+
import { p as gcWithScope } from "./shapeTypes-C9sUsmEW.js";
|
|
3
|
+
import { u as uvBounds } from "./faceFns-DDzCECn3.js";
|
|
4
4
|
function assertShapeNotNull(shape, fn) {
|
|
5
5
|
if (shape.wrapped.IsNull()) {
|
|
6
6
|
throw new Error(`${fn}: shape is a null shape`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const occtBoundary = require("./occtBoundary-
|
|
3
|
-
const shapeTypes = require("./shapeTypes-
|
|
4
|
-
const faceFns = require("./faceFns-
|
|
2
|
+
const occtBoundary = require("./occtBoundary-6kQSl3cF.cjs");
|
|
3
|
+
const shapeTypes = require("./shapeTypes-BJ3Hmskg.cjs");
|
|
4
|
+
const faceFns = require("./faceFns-NDRFeekj.cjs");
|
|
5
5
|
function assertShapeNotNull(shape, fn) {
|
|
6
6
|
if (shape.wrapped.IsNull()) {
|
|
7
7
|
throw new Error(`${fn}: shape is a null shape`);
|
package/dist/measurement.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const measurement = require("./measurement-
|
|
3
|
+
const measurement = require("./measurement-LcGh4wV0.cjs");
|
|
4
4
|
exports.createDistanceQuery = measurement.createDistanceQuery;
|
|
5
5
|
exports.measureArea = measurement.measureArea;
|
|
6
6
|
exports.measureDistance = measurement.measureDistance;
|
package/dist/measurement.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getKernel, u as uniqueIOFilename } from "./occtBoundary-
|
|
1
|
+
import { g as getKernel, u as uniqueIOFilename } from "./occtBoundary-CqXvDhZY.js";
|
|
2
2
|
import { l as ok, e as err, i as ioError } from "./errors-wGhcJMpB.js";
|
|
3
3
|
function buildMeshCacheKey(tolerance, angularTolerance, skipNormals) {
|
|
4
4
|
return `${tolerance}:${angularTolerance}:${skipNormals}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const occtBoundary = require("./occtBoundary-
|
|
2
|
+
const occtBoundary = require("./occtBoundary-6kQSl3cF.cjs");
|
|
3
3
|
const errors = require("./errors-DK1VAdP4.cjs");
|
|
4
4
|
function buildMeshCacheKey(tolerance, angularTolerance, skipNormals) {
|
|
5
5
|
return `${tolerance}:${angularTolerance}:${skipNormals}`;
|
|
@@ -1096,6 +1096,24 @@ function sweep(oc, wire, spine, options = {}) {
|
|
|
1096
1096
|
sweepBuilder.delete();
|
|
1097
1097
|
return result;
|
|
1098
1098
|
}
|
|
1099
|
+
function simplePipe(oc, profile, spine) {
|
|
1100
|
+
const maker = new oc.BRepOffsetAPI_MakePipe_1(spine, profile);
|
|
1101
|
+
const progress = new oc.Message_ProgressRange_1();
|
|
1102
|
+
maker.Build(progress);
|
|
1103
|
+
progress.delete();
|
|
1104
|
+
const shellShape = maker.Shape();
|
|
1105
|
+
const solidMaker = new oc.BRepBuilderAPI_MakeSolid_1();
|
|
1106
|
+
const shellDowncast = oc.TopoDS.Shell_1(shellShape);
|
|
1107
|
+
solidMaker.Add(shellDowncast);
|
|
1108
|
+
const solidProgress = new oc.Message_ProgressRange_1();
|
|
1109
|
+
solidMaker.Build(solidProgress);
|
|
1110
|
+
solidProgress.delete();
|
|
1111
|
+
const result = solidMaker.IsDone() ? solidMaker.Solid() : shellShape;
|
|
1112
|
+
shellDowncast.delete();
|
|
1113
|
+
solidMaker.delete();
|
|
1114
|
+
maker.delete();
|
|
1115
|
+
return result;
|
|
1116
|
+
}
|
|
1099
1117
|
function healSolid(oc, shape) {
|
|
1100
1118
|
const fixer = new oc.ShapeFix_Solid_2(shape);
|
|
1101
1119
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -1439,6 +1457,9 @@ class OCCTAdapter {
|
|
|
1439
1457
|
sweep(wire, spine, options = {}) {
|
|
1440
1458
|
return sweep(this.oc, wire, spine, options);
|
|
1441
1459
|
}
|
|
1460
|
+
simplePipe(profile, spine) {
|
|
1461
|
+
return simplePipe(this.oc, profile, spine);
|
|
1462
|
+
}
|
|
1442
1463
|
// --- Modification (delegates to modifierOps.ts) ---
|
|
1443
1464
|
fillet(shape, edges, radius) {
|
|
1444
1465
|
return fillet(this.oc, shape, edges, radius);
|
|
@@ -1095,6 +1095,24 @@ function sweep(oc, wire, spine, options = {}) {
|
|
|
1095
1095
|
sweepBuilder.delete();
|
|
1096
1096
|
return result;
|
|
1097
1097
|
}
|
|
1098
|
+
function simplePipe(oc, profile, spine) {
|
|
1099
|
+
const maker = new oc.BRepOffsetAPI_MakePipe_1(spine, profile);
|
|
1100
|
+
const progress = new oc.Message_ProgressRange_1();
|
|
1101
|
+
maker.Build(progress);
|
|
1102
|
+
progress.delete();
|
|
1103
|
+
const shellShape = maker.Shape();
|
|
1104
|
+
const solidMaker = new oc.BRepBuilderAPI_MakeSolid_1();
|
|
1105
|
+
const shellDowncast = oc.TopoDS.Shell_1(shellShape);
|
|
1106
|
+
solidMaker.Add(shellDowncast);
|
|
1107
|
+
const solidProgress = new oc.Message_ProgressRange_1();
|
|
1108
|
+
solidMaker.Build(solidProgress);
|
|
1109
|
+
solidProgress.delete();
|
|
1110
|
+
const result = solidMaker.IsDone() ? solidMaker.Solid() : shellShape;
|
|
1111
|
+
shellDowncast.delete();
|
|
1112
|
+
solidMaker.delete();
|
|
1113
|
+
maker.delete();
|
|
1114
|
+
return result;
|
|
1115
|
+
}
|
|
1098
1116
|
function healSolid(oc, shape) {
|
|
1099
1117
|
const fixer = new oc.ShapeFix_Solid_2(shape);
|
|
1100
1118
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -1438,6 +1456,9 @@ class OCCTAdapter {
|
|
|
1438
1456
|
sweep(wire, spine, options = {}) {
|
|
1439
1457
|
return sweep(this.oc, wire, spine, options);
|
|
1440
1458
|
}
|
|
1459
|
+
simplePipe(profile, spine) {
|
|
1460
|
+
return simplePipe(this.oc, profile, spine);
|
|
1461
|
+
}
|
|
1441
1462
|
// --- Modification (delegates to modifierOps.ts) ---
|
|
1442
1463
|
fillet(shape, edges, radius) {
|
|
1443
1464
|
return fillet(this.oc, shape, edges, radius);
|
|
@@ -1688,10 +1709,10 @@ function makeOcAx3(origin, zDir, xDir) {
|
|
|
1688
1709
|
}
|
|
1689
1710
|
export {
|
|
1690
1711
|
toVec3 as a,
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1712
|
+
toOcPnt as b,
|
|
1713
|
+
toOcVec as c,
|
|
1714
|
+
makeOcAx3 as d,
|
|
1715
|
+
makeOcAx1 as e,
|
|
1695
1716
|
fromOcDir as f,
|
|
1696
1717
|
getKernel as g,
|
|
1697
1718
|
fromOcPnt as h,
|
|
@@ -1699,7 +1720,7 @@ export {
|
|
|
1699
1720
|
initFromOC as j,
|
|
1700
1721
|
withOcPnt as k,
|
|
1701
1722
|
withOcVec as l,
|
|
1702
|
-
|
|
1723
|
+
makeOcAx2 as m,
|
|
1703
1724
|
uniqueId as n,
|
|
1704
1725
|
resolveDirection as r,
|
|
1705
1726
|
surfaceCurvature as s,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extrude.d.ts","sourceRoot":"","sources":["../../src/operations/extrude.ts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
|
|
22
22
|
support?: OcType;
|
|
23
23
|
/** Force profile to be orthogonal to spine */
|
|
24
24
|
forceProfileSpineOthogonality?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Use BRepOffsetAPI_MakePipe (simple pipe) instead of MakePipeShell.
|
|
27
|
+
* Much faster for constant cross-section profiles, especially rotationally
|
|
28
|
+
* symmetric ones (circles, regular polygons) where orientation doesn't matter.
|
|
29
|
+
* Incompatible with frenet, auxiliarySpine, law, and support options.
|
|
30
|
+
*/
|
|
31
|
+
mode?: 'general' | 'simple';
|
|
32
|
+
/** 3D approximation tolerance for MakePipeShell (default: OCCT default ~1e-7). */
|
|
33
|
+
tolerance?: number;
|
|
34
|
+
/** Boundary tolerance for MakePipeShell. Defaults to `tolerance` if set. */
|
|
35
|
+
boundTolerance?: number;
|
|
36
|
+
/** Angular tolerance in radians for MakePipeShell. */
|
|
37
|
+
angularTolerance?: number;
|
|
38
|
+
/** Maximum B-spline degree for pipe surface approximation. */
|
|
39
|
+
maxDegree?: number;
|
|
40
|
+
/** Maximum number of approximation segments. */
|
|
41
|
+
maxSegments?: number;
|
|
25
42
|
}
|
|
26
43
|
/** Configuration for extrusion profile scaling along the path. */
|
|
27
44
|
export interface ExtrusionProfile {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extrudeUtils.d.ts","sourceRoot":"","sources":["../../src/operations/extrudeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,KAAK,MAAM,GAAG,GAAG,CAAC;AAIlB,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAOzD,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,cAAc,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7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AW,gBAAgB;IAC/B,qFAAqF;IACrF,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,EACvB,EAAE,OAAO,EAAE,SAAa,EAAE,EAAE,gBAAgB,GAC3C,MAAM,CAAC,MAAM,CAAC,CAkBhB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { g as getKernel,
|
|
1
|
+
import { g as getKernel, c as toOcVec, b as toOcPnt, d as makeOcAx3, u as uniqueIOFilename } from "./occtBoundary-CqXvDhZY.js";
|
|
2
2
|
import { g as vecLength, v as vecAdd, D as DEG2RAD, f as vecIsZero, j as vecNormalize, n as vecScale } from "./vecOps-ZDdZWbwT.js";
|
|
3
|
-
import { b as createOcHandle, c as castShape, h as isShape3D, m as isWire,
|
|
4
|
-
import { d as downcast } from "./cast-
|
|
3
|
+
import { b as createOcHandle, c as castShape, h as isShape3D, m as isWire, p as gcWithScope, s as createSolid } from "./shapeTypes-C9sUsmEW.js";
|
|
4
|
+
import { d as downcast } from "./cast-C4Ff_1Qe.js";
|
|
5
5
|
import { e as err, x as validationError, u as unwrap, p as typeCastError, l as ok, B as BrepErrorCode, d as isErr, o as occtError, i as ioError, b as computationError } from "./errors-wGhcJMpB.js";
|
|
6
|
-
import {
|
|
7
|
-
import { r as rotate, t as translate } from "./shapeFns-
|
|
8
|
-
import {
|
|
6
|
+
import { n as buildLawFromProfile } from "./loft-Bk9EM0gZ.js";
|
|
7
|
+
import { r as rotate, t as translate } from "./shapeFns-DQtpzndX.js";
|
|
8
|
+
import { e as fuseAll } from "./booleanFns-CkccZ7UL.js";
|
|
9
9
|
function uuidv() {
|
|
10
10
|
return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
|
|
11
11
|
/[018]/g,
|
|
@@ -149,6 +149,15 @@ function revolve(face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) {
|
|
|
149
149
|
return ok(result);
|
|
150
150
|
}
|
|
151
151
|
function sweep(wire, spine, config = {}, shellMode = false) {
|
|
152
|
+
if (config.mode === "simple" && !shellMode) {
|
|
153
|
+
const kernel = getKernel();
|
|
154
|
+
const resultOc = kernel.simplePipe(wire.wrapped, spine.wrapped);
|
|
155
|
+
const shape2 = castShape(resultOc);
|
|
156
|
+
if (!isShape3D(shape2)) {
|
|
157
|
+
return err(typeCastError("SWEEP_NOT_3D", "Simple pipe did not produce a 3D shape"));
|
|
158
|
+
}
|
|
159
|
+
return ok(shape2);
|
|
160
|
+
}
|
|
152
161
|
const oc = getKernel().oc;
|
|
153
162
|
const r = gcWithScope();
|
|
154
163
|
const {
|
|
@@ -158,10 +167,24 @@ function sweep(wire, spine, config = {}, shellMode = false) {
|
|
|
158
167
|
transitionMode = "right",
|
|
159
168
|
withContact,
|
|
160
169
|
support,
|
|
161
|
-
forceProfileSpineOthogonality
|
|
170
|
+
forceProfileSpineOthogonality,
|
|
171
|
+
tolerance,
|
|
172
|
+
boundTolerance,
|
|
173
|
+
angularTolerance,
|
|
174
|
+
maxDegree,
|
|
175
|
+
maxSegments
|
|
162
176
|
} = config;
|
|
163
177
|
const withCorrection = transitionMode === "round" ? true : !!forceProfileSpineOthogonality;
|
|
164
178
|
const builder = r(new oc.BRepOffsetAPI_MakePipeShell(spine.wrapped));
|
|
179
|
+
if (tolerance !== void 0) {
|
|
180
|
+
builder.SetTolerance(tolerance, boundTolerance ?? tolerance, angularTolerance ?? 1e-7);
|
|
181
|
+
}
|
|
182
|
+
if (maxDegree !== void 0) {
|
|
183
|
+
builder.SetMaxDegree(maxDegree);
|
|
184
|
+
}
|
|
185
|
+
if (maxSegments !== void 0) {
|
|
186
|
+
builder.SetMaxSegments(maxSegments);
|
|
187
|
+
}
|
|
165
188
|
{
|
|
166
189
|
const mode = {
|
|
167
190
|
transformed: oc.BRepBuilderAPI_TransitionMode.BRepBuilderAPI_Transformed,
|