brepjs 8.0.1 → 8.0.3
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-DnAO3gr5.js} +116 -30
- package/dist/{Blueprint-CVctc41Z.cjs → Blueprint-FxmMji4s.cjs} +110 -24
- package/dist/{boolean2D-hOw5Qay5.js → boolean2D-BnZKKBWU.js} +391 -310
- package/dist/{boolean2D-BdZATaHs.cjs → boolean2D-BrjHZfWn.cjs} +426 -345
- package/dist/{booleanFns-CqehfzcK.js → booleanFns-Ct3wDnhc.js} +14 -18
- package/dist/{booleanFns-BBSVKhL2.cjs → booleanFns-ND7sZvhu.cjs} +12 -16
- package/dist/brepjs.cjs +171 -101
- package/dist/brepjs.js +315 -244
- package/dist/{cast-DQaUibmm.js → cast-BEg1mN7n.js} +2 -2
- package/dist/{cast-DkB0GKmQ.cjs → cast-CqDc8oFW.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-89obDwGi.js +59 -0
- package/dist/cornerFinder-BKsCkrXd.cjs +58 -0
- package/dist/curveBuilders-BjtdNw1B.cjs +196 -0
- package/dist/curveBuilders-U26XDfxg.js +197 -0
- package/dist/curveFns-BoG_iA07.cjs +375 -0
- package/dist/curveFns-Cg99XKe2.js +376 -0
- package/dist/{drawFns-CUyx50gi.cjs → drawFns-C-MCkYj6.cjs} +60 -62
- package/dist/{drawFns-921SkhDL.js → drawFns-DJV-nOox.js} +12 -14
- package/dist/{faceFns-DHu-2JpA.js → faceFns-CyokaCDr.js} +3 -3
- package/dist/{faceFns-BwK7FP7N.cjs → faceFns-DcSCjDG0.cjs} +3 -3
- package/dist/helpers--iZxPeJg.cjs +203 -0
- package/dist/helpers-CRx_ks-u.js +204 -0
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/curveOps.d.ts.map +1 -1
- package/dist/kernel/meshOps.d.ts.map +1 -1
- package/dist/kernel/modifierOps.d.ts.map +1 -1
- 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-8asn63t4.cjs +372 -0
- package/dist/loft-jIkZRqHm.js +373 -0
- package/dist/{measurement-C5JGCuUP.js → measurement-DWv8kK6J.js} +3 -3
- package/dist/{measurement-fxm_pW7x.cjs → measurement-lRLwaoqD.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-BhrZGi6w.cjs → meshFns-DWuLC3fk.cjs} +29 -9
- package/dist/{meshFns-AqAjTTVl.js → meshFns-DgAIL1B-.js} +29 -9
- package/dist/{occtBoundary-du8_ex-p.cjs → occtBoundary-DHtzU4tz.cjs} +93 -61
- package/dist/{occtBoundary-CwegMzqc.js → occtBoundary-DYsksDtE.js} +98 -66
- 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/patternFns.d.ts.map +1 -1
- package/dist/{operations-C1rWoba2.js → operations-B8FHVC22.js} +54 -9
- package/dist/{operations-BP1wVDw0.cjs → operations-CCFPvtd-.cjs} +54 -9
- 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/{shapeTypes-DKhwEnUM.cjs → shapeTypes-b_lhwQB7.cjs} +24 -20
- package/dist/{shapeTypes-BlSElW8z.js → shapeTypes-i7VwMRwc.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/meshFns.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-Bh-aPIxA.js} +7 -8
- package/dist/{topology-CIooytHH.cjs → topology-ByOn_z3E.cjs} +12 -13
- package/dist/topology.cjs +33 -34
- package/dist/topology.js +54 -55
- package/dist/{vectors-CBuaMeZv.js → vectors-DWLjb9-P.js} +1 -1
- package/dist/{vectors-ChWEZPwy.cjs → vectors-aQBZK0Sb.cjs} +1 -1
- package/dist/vectors.cjs +2 -2
- package/dist/vectors.js +2 -2
- package/package.json +1 -1
- package/dist/curveFns-BilyYL_s.cjs +0 -190
- package/dist/curveFns-CdVE4da7.js +0 -191
- 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/shapeFns-BrF97sKt.js +0 -204
- package/dist/shapeFns-BvOndshS.cjs +0 -203
- package/dist/shapeHelpers-B2SXz1p4.cjs +0 -488
- package/dist/shapeHelpers-BcoZf2N9.js +0 -489
|
@@ -536,6 +536,24 @@ function cutAll(oc, shape, tools, options = {}) {
|
|
|
536
536
|
toolCompound.delete();
|
|
537
537
|
return result;
|
|
538
538
|
}
|
|
539
|
+
function hasTriangulation(oc, shape) {
|
|
540
|
+
const explorer = new oc.TopExp_Explorer_2(
|
|
541
|
+
shape,
|
|
542
|
+
oc.TopAbs_ShapeEnum.TopAbs_FACE,
|
|
543
|
+
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
544
|
+
);
|
|
545
|
+
let hasTri = false;
|
|
546
|
+
if (explorer.More()) {
|
|
547
|
+
const face = oc.TopoDS.Face_1(explorer.Current());
|
|
548
|
+
const loc = new oc.TopLoc_Location_1();
|
|
549
|
+
const tri = oc.BRep_Tool.Triangulation(face, loc, 0);
|
|
550
|
+
hasTri = !tri.IsNull();
|
|
551
|
+
loc.delete();
|
|
552
|
+
tri.delete();
|
|
553
|
+
}
|
|
554
|
+
explorer.delete();
|
|
555
|
+
return hasTri;
|
|
556
|
+
}
|
|
539
557
|
function meshBulk(oc, shape, options) {
|
|
540
558
|
const raw = oc.MeshExtractor.extract(
|
|
541
559
|
shape,
|
|
@@ -722,14 +740,16 @@ function meshEdgesBulk(oc, shape, tolerance, angularTolerance) {
|
|
|
722
740
|
return { lines, edgeGroups };
|
|
723
741
|
}
|
|
724
742
|
function meshEdgesJS(oc, shape, tolerance, angularTolerance) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
743
|
+
if (!hasTriangulation(oc, shape)) {
|
|
744
|
+
const mesher = new oc.BRepMesh_IncrementalMesh_2(
|
|
745
|
+
shape,
|
|
746
|
+
tolerance,
|
|
747
|
+
false,
|
|
748
|
+
angularTolerance,
|
|
749
|
+
false
|
|
750
|
+
);
|
|
751
|
+
mesher.delete();
|
|
752
|
+
}
|
|
733
753
|
const lines = [];
|
|
734
754
|
const edgeGroups = [];
|
|
735
755
|
const seenHashes = /* @__PURE__ */ new Set();
|
|
@@ -1096,6 +1116,24 @@ function sweep(oc, wire, spine, options = {}) {
|
|
|
1096
1116
|
sweepBuilder.delete();
|
|
1097
1117
|
return result;
|
|
1098
1118
|
}
|
|
1119
|
+
function simplePipe(oc, profile, spine) {
|
|
1120
|
+
const maker = new oc.BRepOffsetAPI_MakePipe_1(spine, profile);
|
|
1121
|
+
const progress = new oc.Message_ProgressRange_1();
|
|
1122
|
+
maker.Build(progress);
|
|
1123
|
+
progress.delete();
|
|
1124
|
+
const shellShape = maker.Shape();
|
|
1125
|
+
const solidMaker = new oc.BRepBuilderAPI_MakeSolid_1();
|
|
1126
|
+
const shellDowncast = oc.TopoDS.Shell_1(shellShape);
|
|
1127
|
+
solidMaker.Add(shellDowncast);
|
|
1128
|
+
const solidProgress = new oc.Message_ProgressRange_1();
|
|
1129
|
+
solidMaker.Build(solidProgress);
|
|
1130
|
+
solidProgress.delete();
|
|
1131
|
+
const result = solidMaker.IsDone() ? solidMaker.Solid() : shellShape;
|
|
1132
|
+
shellDowncast.delete();
|
|
1133
|
+
solidMaker.delete();
|
|
1134
|
+
maker.delete();
|
|
1135
|
+
return result;
|
|
1136
|
+
}
|
|
1099
1137
|
function healSolid(oc, shape) {
|
|
1100
1138
|
const fixer = new oc.ShapeFix_Solid_2(shape);
|
|
1101
1139
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -1143,41 +1181,37 @@ function fillet(oc, shape, edges, radius) {
|
|
|
1143
1181
|
}
|
|
1144
1182
|
function chamfer(oc, shape, edges, distance2) {
|
|
1145
1183
|
const builder = new oc.BRepFilletAPI_MakeChamfer(shape);
|
|
1146
|
-
let
|
|
1147
|
-
function
|
|
1148
|
-
if (
|
|
1149
|
-
|
|
1150
|
-
const
|
|
1184
|
+
let edgeFaceMap = null;
|
|
1185
|
+
function getEdgeFaceMap() {
|
|
1186
|
+
if (edgeFaceMap) return edgeFaceMap;
|
|
1187
|
+
edgeFaceMap = /* @__PURE__ */ new Map();
|
|
1188
|
+
const faceExp = new oc.TopExp_Explorer_2(
|
|
1151
1189
|
shape,
|
|
1152
1190
|
oc.TopAbs_ShapeEnum.TopAbs_FACE,
|
|
1153
1191
|
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1154
1192
|
);
|
|
1155
|
-
while (
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
}
|
|
1159
|
-
explorer.delete();
|
|
1160
|
-
return faces;
|
|
1161
|
-
}
|
|
1162
|
-
function findContainingFace(edge) {
|
|
1163
|
-
for (const face of getFaces()) {
|
|
1164
|
-
const edgeExplorer = new oc.TopExp_Explorer_2(
|
|
1193
|
+
while (faceExp.More()) {
|
|
1194
|
+
const face = oc.TopoDS.Face_1(faceExp.Current());
|
|
1195
|
+
const edgeExp = new oc.TopExp_Explorer_2(
|
|
1165
1196
|
face,
|
|
1166
1197
|
oc.TopAbs_ShapeEnum.TopAbs_EDGE,
|
|
1167
1198
|
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1168
1199
|
);
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
if (
|
|
1172
|
-
|
|
1173
|
-
break;
|
|
1200
|
+
while (edgeExp.More()) {
|
|
1201
|
+
const hash = edgeExp.Current().HashCode(2147483647);
|
|
1202
|
+
if (!edgeFaceMap.has(hash)) {
|
|
1203
|
+
edgeFaceMap.set(hash, face);
|
|
1174
1204
|
}
|
|
1175
|
-
|
|
1205
|
+
edgeExp.Next();
|
|
1176
1206
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1207
|
+
edgeExp.delete();
|
|
1208
|
+
faceExp.Next();
|
|
1179
1209
|
}
|
|
1180
|
-
|
|
1210
|
+
faceExp.delete();
|
|
1211
|
+
return edgeFaceMap;
|
|
1212
|
+
}
|
|
1213
|
+
function findContainingFace(edge) {
|
|
1214
|
+
return getEdgeFaceMap().get(edge.HashCode(2147483647)) ?? null;
|
|
1181
1215
|
}
|
|
1182
1216
|
for (const edge of edges) {
|
|
1183
1217
|
const d = typeof distance2 === "function" ? distance2(edge) : distance2;
|
|
@@ -1235,39 +1269,32 @@ function thicken(oc, shape, thickness) {
|
|
|
1235
1269
|
function chamferDistAngle(oc, shape, edges, distance2, angleDeg) {
|
|
1236
1270
|
const builder = new oc.BRepFilletAPI_MakeChamfer(shape);
|
|
1237
1271
|
const angleRad = angleDeg * Math.PI / 180;
|
|
1238
|
-
const
|
|
1272
|
+
const edgeFaceMap = /* @__PURE__ */ new Map();
|
|
1239
1273
|
const faceExplorer = new oc.TopExp_Explorer_2(
|
|
1240
1274
|
shape,
|
|
1241
1275
|
oc.TopAbs_ShapeEnum.TopAbs_FACE,
|
|
1242
1276
|
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1243
1277
|
);
|
|
1244
1278
|
while (faceExplorer.More()) {
|
|
1245
|
-
|
|
1279
|
+
const face = oc.TopoDS.Face_1(faceExplorer.Current());
|
|
1280
|
+
const edgeExp = new oc.TopExp_Explorer_2(
|
|
1281
|
+
face,
|
|
1282
|
+
oc.TopAbs_ShapeEnum.TopAbs_EDGE,
|
|
1283
|
+
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1284
|
+
);
|
|
1285
|
+
while (edgeExp.More()) {
|
|
1286
|
+
const hash = edgeExp.Current().HashCode(2147483647);
|
|
1287
|
+
if (!edgeFaceMap.has(hash)) {
|
|
1288
|
+
edgeFaceMap.set(hash, face);
|
|
1289
|
+
}
|
|
1290
|
+
edgeExp.Next();
|
|
1291
|
+
}
|
|
1292
|
+
edgeExp.delete();
|
|
1246
1293
|
faceExplorer.Next();
|
|
1247
1294
|
}
|
|
1248
1295
|
faceExplorer.delete();
|
|
1249
1296
|
for (const edge of edges) {
|
|
1250
|
-
|
|
1251
|
-
for (const face of faces) {
|
|
1252
|
-
const edgeExplorer = new oc.TopExp_Explorer_2(
|
|
1253
|
-
face,
|
|
1254
|
-
oc.TopAbs_ShapeEnum.TopAbs_EDGE,
|
|
1255
|
-
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1256
|
-
);
|
|
1257
|
-
let found = false;
|
|
1258
|
-
while (edgeExplorer.More()) {
|
|
1259
|
-
if (edgeExplorer.Current().IsSame(edge)) {
|
|
1260
|
-
found = true;
|
|
1261
|
-
break;
|
|
1262
|
-
}
|
|
1263
|
-
edgeExplorer.Next();
|
|
1264
|
-
}
|
|
1265
|
-
edgeExplorer.delete();
|
|
1266
|
-
if (found) {
|
|
1267
|
-
containingFace = face;
|
|
1268
|
-
break;
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1297
|
+
const containingFace = edgeFaceMap.get(edge.HashCode(2147483647)) ?? null;
|
|
1271
1298
|
if (containingFace && distance2 > 0) {
|
|
1272
1299
|
builder.AddDA(distance2, angleRad, oc.TopoDS.Edge_1(edge), containingFace);
|
|
1273
1300
|
}
|
|
@@ -1306,12 +1333,13 @@ function offset(oc, shape, distance2, tolerance = 1e-6) {
|
|
|
1306
1333
|
function interpolatePoints(oc, points, options = {}) {
|
|
1307
1334
|
const { tolerance = 1e-8 } = options;
|
|
1308
1335
|
const pnts = new oc.TColgp_Array1OfPnt_2(1, points.length);
|
|
1336
|
+
const reusePnt = new oc.gp_Pnt_1();
|
|
1309
1337
|
let idx = 1;
|
|
1310
1338
|
for (const pt of points) {
|
|
1311
|
-
|
|
1312
|
-
pnts.SetValue(idx++,
|
|
1313
|
-
pnt.delete();
|
|
1339
|
+
reusePnt.SetCoord_2(pt[0], pt[1], pt[2]);
|
|
1340
|
+
pnts.SetValue(idx++, reusePnt);
|
|
1314
1341
|
}
|
|
1342
|
+
reusePnt.delete();
|
|
1315
1343
|
const splineBuilder = new oc.GeomAPI_PointsToBSpline_2(
|
|
1316
1344
|
pnts,
|
|
1317
1345
|
3,
|
|
@@ -1335,12 +1363,13 @@ function interpolatePoints(oc, points, options = {}) {
|
|
|
1335
1363
|
function approximatePoints(oc, points, options = {}) {
|
|
1336
1364
|
const { tolerance = 1e-3, degMin = 1, degMax = 6, smoothing = null } = options;
|
|
1337
1365
|
const pnts = new oc.TColgp_Array1OfPnt_2(1, points.length);
|
|
1366
|
+
const reusePnt = new oc.gp_Pnt_1();
|
|
1338
1367
|
let idx = 1;
|
|
1339
1368
|
for (const pt of points) {
|
|
1340
|
-
|
|
1341
|
-
pnts.SetValue(idx++,
|
|
1342
|
-
pnt.delete();
|
|
1369
|
+
reusePnt.SetCoord_2(pt[0], pt[1], pt[2]);
|
|
1370
|
+
pnts.SetValue(idx++, reusePnt);
|
|
1343
1371
|
}
|
|
1372
|
+
reusePnt.delete();
|
|
1344
1373
|
let splineBuilder;
|
|
1345
1374
|
if (smoothing) {
|
|
1346
1375
|
splineBuilder = new oc.GeomAPI_PointsToBSpline_5(
|
|
@@ -1439,6 +1468,9 @@ class OCCTAdapter {
|
|
|
1439
1468
|
sweep(wire, spine, options = {}) {
|
|
1440
1469
|
return sweep(this.oc, wire, spine, options);
|
|
1441
1470
|
}
|
|
1471
|
+
simplePipe(profile, spine) {
|
|
1472
|
+
return simplePipe(this.oc, profile, spine);
|
|
1473
|
+
}
|
|
1442
1474
|
// --- Modification (delegates to modifierOps.ts) ---
|
|
1443
1475
|
fillet(shape, edges, radius) {
|
|
1444
1476
|
return fillet(this.oc, shape, edges, radius);
|
|
@@ -535,6 +535,24 @@ function cutAll(oc, shape, tools, options = {}) {
|
|
|
535
535
|
toolCompound.delete();
|
|
536
536
|
return result;
|
|
537
537
|
}
|
|
538
|
+
function hasTriangulation(oc, shape) {
|
|
539
|
+
const explorer = new oc.TopExp_Explorer_2(
|
|
540
|
+
shape,
|
|
541
|
+
oc.TopAbs_ShapeEnum.TopAbs_FACE,
|
|
542
|
+
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
543
|
+
);
|
|
544
|
+
let hasTri = false;
|
|
545
|
+
if (explorer.More()) {
|
|
546
|
+
const face = oc.TopoDS.Face_1(explorer.Current());
|
|
547
|
+
const loc = new oc.TopLoc_Location_1();
|
|
548
|
+
const tri = oc.BRep_Tool.Triangulation(face, loc, 0);
|
|
549
|
+
hasTri = !tri.IsNull();
|
|
550
|
+
loc.delete();
|
|
551
|
+
tri.delete();
|
|
552
|
+
}
|
|
553
|
+
explorer.delete();
|
|
554
|
+
return hasTri;
|
|
555
|
+
}
|
|
538
556
|
function meshBulk(oc, shape, options) {
|
|
539
557
|
const raw = oc.MeshExtractor.extract(
|
|
540
558
|
shape,
|
|
@@ -721,14 +739,16 @@ function meshEdgesBulk(oc, shape, tolerance, angularTolerance) {
|
|
|
721
739
|
return { lines, edgeGroups };
|
|
722
740
|
}
|
|
723
741
|
function meshEdgesJS(oc, shape, tolerance, angularTolerance) {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
742
|
+
if (!hasTriangulation(oc, shape)) {
|
|
743
|
+
const mesher = new oc.BRepMesh_IncrementalMesh_2(
|
|
744
|
+
shape,
|
|
745
|
+
tolerance,
|
|
746
|
+
false,
|
|
747
|
+
angularTolerance,
|
|
748
|
+
false
|
|
749
|
+
);
|
|
750
|
+
mesher.delete();
|
|
751
|
+
}
|
|
732
752
|
const lines = [];
|
|
733
753
|
const edgeGroups = [];
|
|
734
754
|
const seenHashes = /* @__PURE__ */ new Set();
|
|
@@ -1095,6 +1115,24 @@ function sweep(oc, wire, spine, options = {}) {
|
|
|
1095
1115
|
sweepBuilder.delete();
|
|
1096
1116
|
return result;
|
|
1097
1117
|
}
|
|
1118
|
+
function simplePipe(oc, profile, spine) {
|
|
1119
|
+
const maker = new oc.BRepOffsetAPI_MakePipe_1(spine, profile);
|
|
1120
|
+
const progress = new oc.Message_ProgressRange_1();
|
|
1121
|
+
maker.Build(progress);
|
|
1122
|
+
progress.delete();
|
|
1123
|
+
const shellShape = maker.Shape();
|
|
1124
|
+
const solidMaker = new oc.BRepBuilderAPI_MakeSolid_1();
|
|
1125
|
+
const shellDowncast = oc.TopoDS.Shell_1(shellShape);
|
|
1126
|
+
solidMaker.Add(shellDowncast);
|
|
1127
|
+
const solidProgress = new oc.Message_ProgressRange_1();
|
|
1128
|
+
solidMaker.Build(solidProgress);
|
|
1129
|
+
solidProgress.delete();
|
|
1130
|
+
const result = solidMaker.IsDone() ? solidMaker.Solid() : shellShape;
|
|
1131
|
+
shellDowncast.delete();
|
|
1132
|
+
solidMaker.delete();
|
|
1133
|
+
maker.delete();
|
|
1134
|
+
return result;
|
|
1135
|
+
}
|
|
1098
1136
|
function healSolid(oc, shape) {
|
|
1099
1137
|
const fixer = new oc.ShapeFix_Solid_2(shape);
|
|
1100
1138
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -1142,41 +1180,37 @@ function fillet(oc, shape, edges, radius) {
|
|
|
1142
1180
|
}
|
|
1143
1181
|
function chamfer(oc, shape, edges, distance2) {
|
|
1144
1182
|
const builder = new oc.BRepFilletAPI_MakeChamfer(shape);
|
|
1145
|
-
let
|
|
1146
|
-
function
|
|
1147
|
-
if (
|
|
1148
|
-
|
|
1149
|
-
const
|
|
1183
|
+
let edgeFaceMap = null;
|
|
1184
|
+
function getEdgeFaceMap() {
|
|
1185
|
+
if (edgeFaceMap) return edgeFaceMap;
|
|
1186
|
+
edgeFaceMap = /* @__PURE__ */ new Map();
|
|
1187
|
+
const faceExp = new oc.TopExp_Explorer_2(
|
|
1150
1188
|
shape,
|
|
1151
1189
|
oc.TopAbs_ShapeEnum.TopAbs_FACE,
|
|
1152
1190
|
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1153
1191
|
);
|
|
1154
|
-
while (
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
}
|
|
1158
|
-
explorer.delete();
|
|
1159
|
-
return faces;
|
|
1160
|
-
}
|
|
1161
|
-
function findContainingFace(edge) {
|
|
1162
|
-
for (const face of getFaces()) {
|
|
1163
|
-
const edgeExplorer = new oc.TopExp_Explorer_2(
|
|
1192
|
+
while (faceExp.More()) {
|
|
1193
|
+
const face = oc.TopoDS.Face_1(faceExp.Current());
|
|
1194
|
+
const edgeExp = new oc.TopExp_Explorer_2(
|
|
1164
1195
|
face,
|
|
1165
1196
|
oc.TopAbs_ShapeEnum.TopAbs_EDGE,
|
|
1166
1197
|
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1167
1198
|
);
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
if (
|
|
1171
|
-
|
|
1172
|
-
break;
|
|
1199
|
+
while (edgeExp.More()) {
|
|
1200
|
+
const hash = edgeExp.Current().HashCode(2147483647);
|
|
1201
|
+
if (!edgeFaceMap.has(hash)) {
|
|
1202
|
+
edgeFaceMap.set(hash, face);
|
|
1173
1203
|
}
|
|
1174
|
-
|
|
1204
|
+
edgeExp.Next();
|
|
1175
1205
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1206
|
+
edgeExp.delete();
|
|
1207
|
+
faceExp.Next();
|
|
1178
1208
|
}
|
|
1179
|
-
|
|
1209
|
+
faceExp.delete();
|
|
1210
|
+
return edgeFaceMap;
|
|
1211
|
+
}
|
|
1212
|
+
function findContainingFace(edge) {
|
|
1213
|
+
return getEdgeFaceMap().get(edge.HashCode(2147483647)) ?? null;
|
|
1180
1214
|
}
|
|
1181
1215
|
for (const edge of edges) {
|
|
1182
1216
|
const d = typeof distance2 === "function" ? distance2(edge) : distance2;
|
|
@@ -1234,39 +1268,32 @@ function thicken(oc, shape, thickness) {
|
|
|
1234
1268
|
function chamferDistAngle(oc, shape, edges, distance2, angleDeg) {
|
|
1235
1269
|
const builder = new oc.BRepFilletAPI_MakeChamfer(shape);
|
|
1236
1270
|
const angleRad = angleDeg * Math.PI / 180;
|
|
1237
|
-
const
|
|
1271
|
+
const edgeFaceMap = /* @__PURE__ */ new Map();
|
|
1238
1272
|
const faceExplorer = new oc.TopExp_Explorer_2(
|
|
1239
1273
|
shape,
|
|
1240
1274
|
oc.TopAbs_ShapeEnum.TopAbs_FACE,
|
|
1241
1275
|
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1242
1276
|
);
|
|
1243
1277
|
while (faceExplorer.More()) {
|
|
1244
|
-
|
|
1278
|
+
const face = oc.TopoDS.Face_1(faceExplorer.Current());
|
|
1279
|
+
const edgeExp = new oc.TopExp_Explorer_2(
|
|
1280
|
+
face,
|
|
1281
|
+
oc.TopAbs_ShapeEnum.TopAbs_EDGE,
|
|
1282
|
+
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1283
|
+
);
|
|
1284
|
+
while (edgeExp.More()) {
|
|
1285
|
+
const hash = edgeExp.Current().HashCode(2147483647);
|
|
1286
|
+
if (!edgeFaceMap.has(hash)) {
|
|
1287
|
+
edgeFaceMap.set(hash, face);
|
|
1288
|
+
}
|
|
1289
|
+
edgeExp.Next();
|
|
1290
|
+
}
|
|
1291
|
+
edgeExp.delete();
|
|
1245
1292
|
faceExplorer.Next();
|
|
1246
1293
|
}
|
|
1247
1294
|
faceExplorer.delete();
|
|
1248
1295
|
for (const edge of edges) {
|
|
1249
|
-
|
|
1250
|
-
for (const face of faces) {
|
|
1251
|
-
const edgeExplorer = new oc.TopExp_Explorer_2(
|
|
1252
|
-
face,
|
|
1253
|
-
oc.TopAbs_ShapeEnum.TopAbs_EDGE,
|
|
1254
|
-
oc.TopAbs_ShapeEnum.TopAbs_SHAPE
|
|
1255
|
-
);
|
|
1256
|
-
let found = false;
|
|
1257
|
-
while (edgeExplorer.More()) {
|
|
1258
|
-
if (edgeExplorer.Current().IsSame(edge)) {
|
|
1259
|
-
found = true;
|
|
1260
|
-
break;
|
|
1261
|
-
}
|
|
1262
|
-
edgeExplorer.Next();
|
|
1263
|
-
}
|
|
1264
|
-
edgeExplorer.delete();
|
|
1265
|
-
if (found) {
|
|
1266
|
-
containingFace = face;
|
|
1267
|
-
break;
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1296
|
+
const containingFace = edgeFaceMap.get(edge.HashCode(2147483647)) ?? null;
|
|
1270
1297
|
if (containingFace && distance2 > 0) {
|
|
1271
1298
|
builder.AddDA(distance2, angleRad, oc.TopoDS.Edge_1(edge), containingFace);
|
|
1272
1299
|
}
|
|
@@ -1305,12 +1332,13 @@ function offset(oc, shape, distance2, tolerance = 1e-6) {
|
|
|
1305
1332
|
function interpolatePoints(oc, points, options = {}) {
|
|
1306
1333
|
const { tolerance = 1e-8 } = options;
|
|
1307
1334
|
const pnts = new oc.TColgp_Array1OfPnt_2(1, points.length);
|
|
1335
|
+
const reusePnt = new oc.gp_Pnt_1();
|
|
1308
1336
|
let idx = 1;
|
|
1309
1337
|
for (const pt of points) {
|
|
1310
|
-
|
|
1311
|
-
pnts.SetValue(idx++,
|
|
1312
|
-
pnt.delete();
|
|
1338
|
+
reusePnt.SetCoord_2(pt[0], pt[1], pt[2]);
|
|
1339
|
+
pnts.SetValue(idx++, reusePnt);
|
|
1313
1340
|
}
|
|
1341
|
+
reusePnt.delete();
|
|
1314
1342
|
const splineBuilder = new oc.GeomAPI_PointsToBSpline_2(
|
|
1315
1343
|
pnts,
|
|
1316
1344
|
3,
|
|
@@ -1334,12 +1362,13 @@ function interpolatePoints(oc, points, options = {}) {
|
|
|
1334
1362
|
function approximatePoints(oc, points, options = {}) {
|
|
1335
1363
|
const { tolerance = 1e-3, degMin = 1, degMax = 6, smoothing = null } = options;
|
|
1336
1364
|
const pnts = new oc.TColgp_Array1OfPnt_2(1, points.length);
|
|
1365
|
+
const reusePnt = new oc.gp_Pnt_1();
|
|
1337
1366
|
let idx = 1;
|
|
1338
1367
|
for (const pt of points) {
|
|
1339
|
-
|
|
1340
|
-
pnts.SetValue(idx++,
|
|
1341
|
-
pnt.delete();
|
|
1368
|
+
reusePnt.SetCoord_2(pt[0], pt[1], pt[2]);
|
|
1369
|
+
pnts.SetValue(idx++, reusePnt);
|
|
1342
1370
|
}
|
|
1371
|
+
reusePnt.delete();
|
|
1343
1372
|
let splineBuilder;
|
|
1344
1373
|
if (smoothing) {
|
|
1345
1374
|
splineBuilder = new oc.GeomAPI_PointsToBSpline_5(
|
|
@@ -1438,6 +1467,9 @@ class OCCTAdapter {
|
|
|
1438
1467
|
sweep(wire, spine, options = {}) {
|
|
1439
1468
|
return sweep(this.oc, wire, spine, options);
|
|
1440
1469
|
}
|
|
1470
|
+
simplePipe(profile, spine) {
|
|
1471
|
+
return simplePipe(this.oc, profile, spine);
|
|
1472
|
+
}
|
|
1441
1473
|
// --- Modification (delegates to modifierOps.ts) ---
|
|
1442
1474
|
fillet(shape, edges, radius) {
|
|
1443
1475
|
return fillet(this.oc, shape, edges, radius);
|
|
@@ -1688,10 +1720,10 @@ function makeOcAx3(origin, zDir, xDir) {
|
|
|
1688
1720
|
}
|
|
1689
1721
|
export {
|
|
1690
1722
|
toVec3 as a,
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1723
|
+
toOcPnt as b,
|
|
1724
|
+
toOcVec as c,
|
|
1725
|
+
makeOcAx3 as d,
|
|
1726
|
+
makeOcAx1 as e,
|
|
1695
1727
|
fromOcDir as f,
|
|
1696
1728
|
getKernel as g,
|
|
1697
1729
|
fromOcPnt as h,
|
|
@@ -1699,7 +1731,7 @@ export {
|
|
|
1699
1731
|
initFromOC as j,
|
|
1700
1732
|
withOcPnt as k,
|
|
1701
1733
|
withOcVec as l,
|
|
1702
|
-
|
|
1734
|
+
makeOcAx2 as m,
|
|
1703
1735
|
uniqueId as n,
|
|
1704
1736
|
resolveDirection as r,
|
|
1705
1737
|
surfaceCurvature as s,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extrude.d.ts","sourceRoot":"","sources":["../../src/operations/extrude.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAOnD,OAAO,EAAE,KAAK,MAAM,EAA4B,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAuB,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI9E;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,IAAI,EAAE,cAAc,UAAU,KAAG,KAUz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C,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAuFzC;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,IAAI,EACZ,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,OAAO,CAAC,CAIjB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,IAAI,EACZ,MAAM,EAAE,IAAI,EACZ,YAAY,CAAC,EAAE,gBAAgB,EAC/B,SAAS,UAAQ,GAChB,MAAM,CAAC,OAAO,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAWzC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,IAAI,EACZ,MAAM,EAAE,IAAI,EACZ,YAAY,CAAC,EAAE,gBAAgB,EAC/B,SAAS,UAAQ,GAChB,MAAM,CAAC,OAAO,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAmBzC"}
|
|
@@ -22,6 +22,23 @@ export interface SweepOptions {
|
|
|
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;IAC7E,cAAc,CAAC,EAAE,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC;IACnD,+BAA+B;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,6BAA6B,CAAC,EAAE,OAAO,CAAC;
|
|
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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A;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"patternFns.d.ts","sourceRoot":"","sources":["../../src/operations/patternFns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKzE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,IAAI,EACf,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,cAAc,GACvB,MAAM,CAAC,OAAO,CAAC,CA2BjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAY,EACvB,MAAM,GAAE,IAAgB,EACxB,OAAO,CAAC,EAAE,cAAc,GACvB,MAAM,CAAC,OAAO,CAAC,CA6BjB"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { g as getKernel,
|
|
1
|
+
import { g as getKernel, c as toOcVec, b as toOcPnt, d as makeOcAx3, u as uniqueIOFilename } from "./occtBoundary-DYsksDtE.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-i7VwMRwc.js";
|
|
4
|
+
import { d as downcast } from "./cast-BEg1mN7n.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 {
|
|
8
|
-
import { g as fuseAll } from "./booleanFns-CqehfzcK.js";
|
|
6
|
+
import { n as buildLawFromProfile } from "./loft-jIkZRqHm.js";
|
|
7
|
+
import { e as fuseAll } from "./booleanFns-Ct3wDnhc.js";
|
|
9
8
|
function uuidv() {
|
|
10
9
|
return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
|
|
11
10
|
/[018]/g,
|
|
@@ -149,6 +148,15 @@ function revolve(face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) {
|
|
|
149
148
|
return ok(result);
|
|
150
149
|
}
|
|
151
150
|
function sweep(wire, spine, config = {}, shellMode = false) {
|
|
151
|
+
if (config.mode === "simple" && !shellMode) {
|
|
152
|
+
const kernel = getKernel();
|
|
153
|
+
const resultOc = kernel.simplePipe(wire.wrapped, spine.wrapped);
|
|
154
|
+
const shape2 = castShape(resultOc);
|
|
155
|
+
if (!isShape3D(shape2)) {
|
|
156
|
+
return err(typeCastError("SWEEP_NOT_3D", "Simple pipe did not produce a 3D shape"));
|
|
157
|
+
}
|
|
158
|
+
return ok(shape2);
|
|
159
|
+
}
|
|
152
160
|
const oc = getKernel().oc;
|
|
153
161
|
const r = gcWithScope();
|
|
154
162
|
const {
|
|
@@ -158,10 +166,24 @@ function sweep(wire, spine, config = {}, shellMode = false) {
|
|
|
158
166
|
transitionMode = "right",
|
|
159
167
|
withContact,
|
|
160
168
|
support,
|
|
161
|
-
forceProfileSpineOthogonality
|
|
169
|
+
forceProfileSpineOthogonality,
|
|
170
|
+
tolerance,
|
|
171
|
+
boundTolerance,
|
|
172
|
+
angularTolerance,
|
|
173
|
+
maxDegree,
|
|
174
|
+
maxSegments
|
|
162
175
|
} = config;
|
|
163
176
|
const withCorrection = transitionMode === "round" ? true : !!forceProfileSpineOthogonality;
|
|
164
177
|
const builder = r(new oc.BRepOffsetAPI_MakePipeShell(spine.wrapped));
|
|
178
|
+
if (tolerance !== void 0) {
|
|
179
|
+
builder.SetTolerance(tolerance, boundTolerance ?? tolerance, angularTolerance ?? 1e-7);
|
|
180
|
+
}
|
|
181
|
+
if (maxDegree !== void 0) {
|
|
182
|
+
builder.SetMaxDegree(maxDegree);
|
|
183
|
+
}
|
|
184
|
+
if (maxSegments !== void 0) {
|
|
185
|
+
builder.SetMaxSegments(maxSegments);
|
|
186
|
+
}
|
|
165
187
|
{
|
|
166
188
|
const mode = {
|
|
167
189
|
transformed: oc.BRepBuilderAPI_TransitionMode.BRepBuilderAPI_Transformed,
|
|
@@ -287,10 +309,20 @@ function linearPattern(shape, direction, count, spacing, options) {
|
|
|
287
309
|
return err(validationError("PATTERN_ZERO_DIRECTION", "Pattern direction cannot be zero"));
|
|
288
310
|
const dir = vecNormalize(direction);
|
|
289
311
|
const copies = [shape];
|
|
312
|
+
const oc = getKernel().oc;
|
|
313
|
+
const trsf = new oc.gp_Trsf_1();
|
|
314
|
+
const vec = new oc.gp_Vec_4(0, 0, 0);
|
|
290
315
|
for (let i = 1; i < count; i++) {
|
|
291
316
|
const offset = vecScale(dir, spacing * i);
|
|
292
|
-
|
|
317
|
+
vec.SetCoord_2(offset[0], offset[1], offset[2]);
|
|
318
|
+
trsf.SetTranslation_1(vec);
|
|
319
|
+
const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
|
|
320
|
+
const result = transformer.ModifiedShape(shape.wrapped);
|
|
321
|
+
transformer.delete();
|
|
322
|
+
copies.push(castShape(result));
|
|
293
323
|
}
|
|
324
|
+
trsf.delete();
|
|
325
|
+
vec.delete();
|
|
294
326
|
return fuseAll(copies, options);
|
|
295
327
|
}
|
|
296
328
|
function circularPattern(shape, axis, count, fullAngle = 360, center = [0, 0, 0], options) {
|
|
@@ -301,9 +333,22 @@ function circularPattern(shape, axis, count, fullAngle = 360, center = [0, 0, 0]
|
|
|
301
333
|
return err(validationError("PATTERN_ZERO_AXIS", "Pattern axis cannot be zero"));
|
|
302
334
|
const angleStep = fullAngle / count;
|
|
303
335
|
const copies = [shape];
|
|
336
|
+
const oc = getKernel().oc;
|
|
337
|
+
const trsf = new oc.gp_Trsf_1();
|
|
338
|
+
const origin = new oc.gp_Pnt_3(center[0], center[1], center[2]);
|
|
339
|
+
const dir = new oc.gp_Dir_4(axis[0], axis[1], axis[2]);
|
|
340
|
+
const ax1 = new oc.gp_Ax1_2(origin, dir);
|
|
304
341
|
for (let i = 1; i < count; i++) {
|
|
305
|
-
|
|
342
|
+
trsf.SetRotation_1(ax1, angleStep * i * Math.PI / 180);
|
|
343
|
+
const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
|
|
344
|
+
const result = transformer.ModifiedShape(shape.wrapped);
|
|
345
|
+
transformer.delete();
|
|
346
|
+
copies.push(castShape(result));
|
|
306
347
|
}
|
|
348
|
+
trsf.delete();
|
|
349
|
+
ax1.delete();
|
|
350
|
+
origin.delete();
|
|
351
|
+
dir.delete();
|
|
307
352
|
return fuseAll(copies, options);
|
|
308
353
|
}
|
|
309
354
|
function createAssemblyNode(name, options = {}) {
|