brepjs 12.8.2 → 12.9.1
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/lib/svgPath.d.ts.map +1 -1
- package/dist/2d/lib/vectorOperations.d.ts +4 -1
- package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +5 -5
- package/dist/{Blueprint-DbVaf6k7.js → Blueprint-1HGbugaC.js} +33 -63
- package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-CUyXM6CV.cjs} +15 -45
- package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-9OnbotKT.cjs} +9 -9
- package/dist/{boolean2D-y3E92F0u.js → boolean2D-CR4efa35.js} +11 -11
- package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-BBd2oTvv.cjs} +43 -40
- package/dist/{booleanFns-BCTjYZAg.js → booleanFns-Br2KdGJq.js} +53 -50
- package/dist/brepjs.cjs +379 -284
- package/dist/brepjs.js +1437 -1341
- package/dist/core/definitionMaps.d.ts +2 -7
- package/dist/core/definitionMaps.d.ts.map +1 -1
- package/dist/core/dimensionTypes.d.ts +52 -0
- package/dist/core/dimensionTypes.d.ts.map +1 -0
- package/dist/core/disposal.d.ts +18 -0
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core/errors.d.ts +1 -8
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/kernelErrorTranslation.d.ts +15 -0
- package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
- package/dist/core/planeOps.d.ts +14 -0
- package/dist/core/planeOps.d.ts.map +1 -1
- package/dist/core/result.d.ts +4 -0
- package/dist/core/result.d.ts.map +1 -1
- package/dist/core/shapeTypes.d.ts +14 -146
- package/dist/core/shapeTypes.d.ts.map +1 -1
- package/dist/core/typeDiscriminants.d.ts +14 -0
- package/dist/core/typeDiscriminants.d.ts.map +1 -0
- package/dist/core/validityTypes.d.ts +100 -0
- package/dist/core/validityTypes.d.ts.map +1 -0
- package/dist/core.cjs +52 -11
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +118 -75
- package/dist/{curveFns-mROFhiuG.js → curveFns-1u0oZ0u0.js} +14 -14
- package/dist/{curveFns-BZngcnQ1.cjs → curveFns-BwLvO_Ia.cjs} +2 -2
- package/dist/{drawFns-Bwakrq7w.js → drawFns-B0na6sbo.js} +16 -16
- package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-CzlEePor.cjs} +18 -18
- package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-BAKkZG6D.cjs} +2 -2
- package/dist/{faceFns-B8GnxjdY.js → faceFns-DGMp47Os.js} +3 -3
- package/dist/{helpers-C8NoT0Wu.cjs → helpers-DVdscQxW.cjs} +73 -8
- package/dist/{helpers-X0juxnwj.js → helpers-sJjnIXDA.js} +85 -20
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
- package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
- package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
- package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/helpers.d.ts +84 -0
- package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
- package/dist/kernel/brepkit/internalOps.d.ts +28 -0
- package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/ioOps.d.ts +43 -0
- package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/measureOps.d.ts +30 -0
- package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/meshOps.d.ts +7 -0
- package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
- package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/repairOps.d.ts +14 -0
- package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
- package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
- package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/transformOps.d.ts +14 -0
- package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
- package/dist/kernel/brepkitAdapter.d.ts +1 -1
- package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
- package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
- package/dist/kernel/defaultAdapter.d.ts.map +1 -1
- package/dist/kernel/extendedConstructorOps.d.ts +9 -1
- package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
- package/dist/kernel/index.d.ts +1 -0
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
- package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/construction-ops.d.ts +76 -0
- package/dist/kernel/interfaces/construction-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/core.d.ts +45 -0
- package/dist/kernel/interfaces/core.d.ts.map +1 -0
- package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
- package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/geometry-ops.d.ts +77 -0
- package/dist/kernel/interfaces/geometry-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/index.d.ts +29 -0
- package/dist/kernel/interfaces/index.d.ts.map +1 -0
- package/dist/kernel/interfaces/io-ops.d.ts +66 -0
- package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
- package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
- package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
- package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
- package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
- package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
- package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/transform-ops.d.ts +20 -0
- package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
- package/dist/kernel/modifierOps.d.ts +2 -2
- package/dist/kernel/modifierOps.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +2 -446
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-hp3pc1M7.cjs → loft-BNvBZzqe.cjs} +5 -5
- package/dist/{loft-Bhw-FMoL.js → loft-D0aCZRaB.js} +7 -7
- package/dist/measurement/measureFns.d.ts +2 -2
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/{measurement-D8EJ694A.js → measurement-C7o5jE6G.js} +2 -2
- package/dist/{measurement-BoNTUBAp.cjs → measurement-DZcaxo1A.cjs} +2 -2
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-7dgZgNYK.cjs} +4 -4
- package/dist/{meshFns-nQjK38EC.js → meshFns-CtUl9fGY.js} +3 -3
- package/dist/operations/compoundOpsFns.d.ts +38 -0
- package/dist/operations/compoundOpsFns.d.ts.map +1 -0
- package/dist/operations/extrude.d.ts +2 -12
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts +2 -93
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/guidedSweepFns.d.ts +3 -22
- package/dist/operations/guidedSweepFns.d.ts.map +1 -1
- package/dist/operations/loft.d.ts +2 -16
- package/dist/operations/loft.d.ts.map +1 -1
- package/dist/operations/multiSweepFns.d.ts +3 -29
- package/dist/operations/multiSweepFns.d.ts.map +1 -1
- package/dist/operations/roofFns.d.ts +2 -2
- package/dist/operations/roofFns.d.ts.map +1 -1
- package/dist/operations/sweepFns.d.ts +121 -0
- package/dist/operations/sweepFns.d.ts.map +1 -0
- package/dist/{operations-BfbkK6DU.js → operations-DisJ5F8s.js} +110 -57
- package/dist/{operations-CYpmLSC4.cjs → operations-DwZ-RBO1.cjs} +97 -44
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +14 -14
- package/dist/originTrackingFns-NJ1dWoiF.js +137 -0
- package/dist/originTrackingFns-dhaCe8Yb.cjs +136 -0
- package/dist/query/edgeFinder.d.ts +4 -14
- package/dist/query/edgeFinder.d.ts.map +1 -1
- package/dist/query/faceFinder.d.ts +4 -14
- package/dist/query/faceFinder.d.ts.map +1 -1
- package/dist/query/finderCore.d.ts +6 -0
- package/dist/query/finderCore.d.ts.map +1 -1
- package/dist/query/shapeFinders.d.ts +32 -0
- package/dist/query/shapeFinders.d.ts.map +1 -0
- package/dist/query/wireFinder.d.ts +4 -9
- package/dist/query/wireFinder.d.ts.map +1 -1
- package/dist/query.cjs +54 -32
- package/dist/query.js +56 -34
- package/dist/{result-fAX0OZzI.cjs → result-DJAAj1yb.cjs} +8 -59
- package/dist/{result-BaSD1fqR.js → result-DtuwWSUD.js} +38 -89
- package/dist/result.cjs +1 -1
- package/dist/result.js +22 -22
- package/dist/shapeFns-BJbua5kT.js +34 -0
- package/dist/shapeFns-w9tWELHX.cjs +33 -0
- package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-CAEAyk8j.js} +233 -172
- package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-owrg2MNK.cjs} +421 -360
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BLQ4I6Ig.cjs} +3 -3
- package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-BS-1220W.js} +3 -3
- package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dj6AjhOv.js} +7 -7
- package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-KU_7OD2q.cjs} +3 -3
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/compoundOpsFns.d.ts +3 -35
- package/dist/topology/compoundOpsFns.d.ts.map +1 -1
- package/dist/topology/index.d.ts +0 -1
- package/dist/topology/index.d.ts.map +1 -1
- package/dist/topology/metadataPropagation.d.ts +30 -0
- package/dist/topology/metadataPropagation.d.ts.map +1 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/originTrackingFns.d.ts +23 -0
- package/dist/topology/originTrackingFns.d.ts.map +1 -0
- package/dist/topology/shapeFns.d.ts +6 -120
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/topologyQueryFns.d.ts +67 -0
- package/dist/topology/topologyQueryFns.d.ts.map +1 -0
- package/dist/topology/transformFns.d.ts +49 -0
- package/dist/topology/transformFns.d.ts.map +1 -0
- package/dist/topology/wrapperFns.d.ts.map +1 -1
- package/dist/{topology-ANwCzGL8.cjs → topology-CyPHYYjV.cjs} +205 -20
- package/dist/{topology-C7x98OVn.js → topology-D6LeuhI_.js} +235 -50
- package/dist/topology.cjs +18 -17
- package/dist/topology.js +92 -91
- package/dist/topologyQueryFns-De439iBP.js +119 -0
- package/dist/topologyQueryFns-fz5kz5e1.cjs +118 -0
- package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
- package/dist/utils/precisionRound.d.ts +4 -0
- package/dist/utils/precisionRound.d.ts.map +1 -1
- package/dist/utils/vec2d.d.ts +5 -0
- package/dist/utils/vec2d.d.ts.map +1 -1
- package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
- package/dist/{vectors-D_IiZx0q.cjs → vectors-C8N_QeEX.cjs} +9 -1
- package/dist/{vectors-Bx8wkNui.js → vectors-DTREgnVp.js} +15 -7
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +23 -23
- package/package.json +3 -3
- package/dist/core/geometryHelpers.d.ts +0 -30
- package/dist/core/geometryHelpers.d.ts.map +0 -1
- package/dist/core/memory.d.ts +0 -6
- package/dist/core/memory.d.ts.map +0 -1
- package/dist/core/typeErrors.d.ts +0 -17
- package/dist/core/typeErrors.d.ts.map +0 -1
- package/dist/cornerFinder-Ckz-mPHE.js +0 -59
- package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
- package/dist/shapeFns-C2SnNvdH.cjs +0 -468
- package/dist/shapeFns-FDuKkrDR.js +0 -469
- package/dist/utils/round2.d.ts +0 -3
- package/dist/utils/round2.d.ts.map +0 -1
- package/dist/utils/round5.d.ts +0 -3
- package/dist/utils/round5.d.ts.map +0 -1
|
@@ -34,8 +34,8 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
34
34
|
var next = (it) => {
|
|
35
35
|
while (it = stack.pop()) {
|
|
36
36
|
try {
|
|
37
|
-
var
|
|
38
|
-
if (it[0]) return Promise.resolve(
|
|
37
|
+
var result2 = it[1] && it[1].call(it[2]);
|
|
38
|
+
if (it[0]) return Promise.resolve(result2).then(next, (e) => (fail(e), next()));
|
|
39
39
|
} catch (e) {
|
|
40
40
|
fail(e);
|
|
41
41
|
}
|
|
@@ -44,6 +44,7 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
44
44
|
};
|
|
45
45
|
return next();
|
|
46
46
|
};
|
|
47
|
+
const result = require("./result-DJAAj1yb.cjs");
|
|
47
48
|
function supportsKernel2D(kernel) {
|
|
48
49
|
return "makeLine2d" in kernel;
|
|
49
50
|
}
|
|
@@ -185,19 +186,19 @@ function centerOfMass(oc, shape) {
|
|
|
185
186
|
const props = new oc.GProp_GProps_1();
|
|
186
187
|
oc.BRepGProp.VolumeProperties_1(shape, props, true, false, false);
|
|
187
188
|
const center = props.CentreOfMass();
|
|
188
|
-
const
|
|
189
|
+
const result2 = [center.X(), center.Y(), center.Z()];
|
|
189
190
|
center.delete();
|
|
190
191
|
props.delete();
|
|
191
|
-
return
|
|
192
|
+
return result2;
|
|
192
193
|
}
|
|
193
194
|
function linearCenterOfMass(oc, shape) {
|
|
194
195
|
const props = new oc.GProp_GProps_1();
|
|
195
196
|
oc.BRepGProp.LinearProperties(shape, props, true, false);
|
|
196
197
|
const center = props.CentreOfMass();
|
|
197
|
-
const
|
|
198
|
+
const result2 = [center.X(), center.Y(), center.Z()];
|
|
198
199
|
center.delete();
|
|
199
200
|
props.delete();
|
|
200
|
-
return
|
|
201
|
+
return result2;
|
|
201
202
|
}
|
|
202
203
|
function boundingBox(oc, shape) {
|
|
203
204
|
const box = new oc.Bnd_Box_1();
|
|
@@ -229,7 +230,7 @@ function distance(oc, shape1, shape2) {
|
|
|
229
230
|
const value = distTool.Value();
|
|
230
231
|
const p1 = distTool.PointOnShape1(1);
|
|
231
232
|
const p2 = distTool.PointOnShape2(1);
|
|
232
|
-
const
|
|
233
|
+
const result2 = {
|
|
233
234
|
value,
|
|
234
235
|
point1: [p1.X(), p1.Y(), p1.Z()],
|
|
235
236
|
point2: [p2.X(), p2.Y(), p2.Z()]
|
|
@@ -238,7 +239,7 @@ function distance(oc, shape1, shape2) {
|
|
|
238
239
|
p2.delete();
|
|
239
240
|
progress.delete();
|
|
240
241
|
distTool.delete();
|
|
241
|
-
return
|
|
242
|
+
return result2;
|
|
242
243
|
}
|
|
243
244
|
function classifyPointOnFace(oc, face, u, v, tolerance = 1e-6) {
|
|
244
245
|
if (!oc.BRepClass_FaceClassifier) {
|
|
@@ -256,18 +257,18 @@ function classifyPointOnFace(oc, face, u, v, tolerance = 1e-6) {
|
|
|
256
257
|
}
|
|
257
258
|
function transform(oc, shape, trsf) {
|
|
258
259
|
const transformer = new oc.BRepBuilderAPI_Transform_2(shape, trsf, true);
|
|
259
|
-
const
|
|
260
|
+
const result2 = transformer.ModifiedShape(shape);
|
|
260
261
|
transformer.delete();
|
|
261
|
-
return
|
|
262
|
+
return result2;
|
|
262
263
|
}
|
|
263
264
|
function translate(oc, shape, x, y, z) {
|
|
264
265
|
const trsf = new oc.gp_Trsf_1();
|
|
265
266
|
const vec = new oc.gp_Vec_4(x, y, z);
|
|
266
267
|
trsf.SetTranslation_1(vec);
|
|
267
|
-
const
|
|
268
|
+
const result2 = transform(oc, shape, trsf);
|
|
268
269
|
trsf.delete();
|
|
269
270
|
vec.delete();
|
|
270
|
-
return
|
|
271
|
+
return result2;
|
|
271
272
|
}
|
|
272
273
|
function rotate(oc, shape, angle, axis = [0, 0, 1], center = [0, 0, 0]) {
|
|
273
274
|
const trsf = new oc.gp_Trsf_1();
|
|
@@ -275,12 +276,12 @@ function rotate(oc, shape, angle, axis = [0, 0, 1], center = [0, 0, 0]) {
|
|
|
275
276
|
const dir = new oc.gp_Dir_4(...axis);
|
|
276
277
|
const ax1 = new oc.gp_Ax1_2(origin, dir);
|
|
277
278
|
trsf.SetRotation_1(ax1, angle * Math.PI / 180);
|
|
278
|
-
const
|
|
279
|
+
const result2 = transform(oc, shape, trsf);
|
|
279
280
|
trsf.delete();
|
|
280
281
|
ax1.delete();
|
|
281
282
|
origin.delete();
|
|
282
283
|
dir.delete();
|
|
283
|
-
return
|
|
284
|
+
return result2;
|
|
284
285
|
}
|
|
285
286
|
function mirror(oc, shape, origin, normal) {
|
|
286
287
|
const trsf = new oc.gp_Trsf_1();
|
|
@@ -288,21 +289,21 @@ function mirror(oc, shape, origin, normal) {
|
|
|
288
289
|
const dir = new oc.gp_Dir_4(...normal);
|
|
289
290
|
const ax2 = new oc.gp_Ax2_3(pnt, dir);
|
|
290
291
|
trsf.SetMirror_3(ax2);
|
|
291
|
-
const
|
|
292
|
+
const result2 = transform(oc, shape, trsf);
|
|
292
293
|
trsf.delete();
|
|
293
294
|
ax2.delete();
|
|
294
295
|
pnt.delete();
|
|
295
296
|
dir.delete();
|
|
296
|
-
return
|
|
297
|
+
return result2;
|
|
297
298
|
}
|
|
298
299
|
function scale(oc, shape, center, factor) {
|
|
299
300
|
const trsf = new oc.gp_Trsf_1();
|
|
300
301
|
const pnt = new oc.gp_Pnt_3(...center);
|
|
301
302
|
trsf.SetScale(pnt, factor);
|
|
302
|
-
const
|
|
303
|
+
const result2 = transform(oc, shape, trsf);
|
|
303
304
|
trsf.delete();
|
|
304
305
|
pnt.delete();
|
|
305
|
-
return
|
|
306
|
+
return result2;
|
|
306
307
|
}
|
|
307
308
|
function generalTransform(oc, shape, linear, translation, isOrthogonal) {
|
|
308
309
|
if (isOrthogonal) {
|
|
@@ -322,10 +323,10 @@ function generalTransform(oc, shape, linear, translation, isOrthogonal) {
|
|
|
322
323
|
translation[2]
|
|
323
324
|
);
|
|
324
325
|
const transformer2 = new oc.BRepBuilderAPI_Transform_2(shape, trsf, true);
|
|
325
|
-
const
|
|
326
|
+
const result22 = transformer2.ModifiedShape(shape);
|
|
326
327
|
transformer2.delete();
|
|
327
328
|
trsf.delete();
|
|
328
|
-
return
|
|
329
|
+
return result22;
|
|
329
330
|
}
|
|
330
331
|
const gtrsf = new oc.gp_GTrsf_1();
|
|
331
332
|
for (let row = 0; row < 3; row++) {
|
|
@@ -337,17 +338,17 @@ function generalTransform(oc, shape, linear, translation, isOrthogonal) {
|
|
|
337
338
|
gtrsf.SetTranslationPart(xyz);
|
|
338
339
|
xyz.delete();
|
|
339
340
|
const transformer = new oc.BRepBuilderAPI_GTransform_2(shape, gtrsf, true);
|
|
340
|
-
const
|
|
341
|
+
const result2 = transformer.ModifiedShape(shape);
|
|
341
342
|
transformer.delete();
|
|
342
343
|
gtrsf.delete();
|
|
343
|
-
return
|
|
344
|
+
return result2;
|
|
344
345
|
}
|
|
345
346
|
function simplify(oc, shape) {
|
|
346
347
|
const upgrader = new oc.ShapeUpgrade_UnifySameDomain_2(shape, true, true, false);
|
|
347
348
|
upgrader.Build();
|
|
348
|
-
const
|
|
349
|
+
const result2 = upgrader.Shape();
|
|
349
350
|
upgrader.delete();
|
|
350
|
-
return
|
|
351
|
+
return result2;
|
|
351
352
|
}
|
|
352
353
|
const SIMPLIFY_TOLERANCE = 1e-3;
|
|
353
354
|
function applyGlue(oc, op, optimisation) {
|
|
@@ -383,10 +384,10 @@ function fuse(oc, shape, tool, options = {}) {
|
|
|
383
384
|
applyBooleanDefaults(fuseOp, fuzzyValue);
|
|
384
385
|
fuseOp.Build(progress);
|
|
385
386
|
if (simplify2) fuseOp.SimplifyResult(true, true, SIMPLIFY_TOLERANCE);
|
|
386
|
-
const
|
|
387
|
+
const result2 = fuseOp.Shape();
|
|
387
388
|
fuseOp.delete();
|
|
388
389
|
progress.delete();
|
|
389
|
-
return
|
|
390
|
+
return result2;
|
|
390
391
|
}
|
|
391
392
|
function cut(oc, shape, tool, options = {}) {
|
|
392
393
|
const { optimisation, simplify: simplify2 = false, fuzzyValue } = options;
|
|
@@ -396,10 +397,10 @@ function cut(oc, shape, tool, options = {}) {
|
|
|
396
397
|
applyBooleanDefaults(cutOp, fuzzyValue);
|
|
397
398
|
cutOp.Build(progress);
|
|
398
399
|
if (simplify2) cutOp.SimplifyResult(true, true, SIMPLIFY_TOLERANCE);
|
|
399
|
-
const
|
|
400
|
+
const result2 = cutOp.Shape();
|
|
400
401
|
cutOp.delete();
|
|
401
402
|
progress.delete();
|
|
402
|
-
return
|
|
403
|
+
return result2;
|
|
403
404
|
}
|
|
404
405
|
function intersect(oc, shape, tool, options = {}) {
|
|
405
406
|
const { optimisation, simplify: simplify2 = false, fuzzyValue } = options;
|
|
@@ -409,10 +410,10 @@ function intersect(oc, shape, tool, options = {}) {
|
|
|
409
410
|
applyBooleanDefaults(commonOp, fuzzyValue);
|
|
410
411
|
commonOp.Build(progress);
|
|
411
412
|
if (simplify2) commonOp.SimplifyResult(true, true, SIMPLIFY_TOLERANCE);
|
|
412
|
-
const
|
|
413
|
+
const result2 = commonOp.Shape();
|
|
413
414
|
commonOp.delete();
|
|
414
415
|
progress.delete();
|
|
415
|
-
return
|
|
416
|
+
return result2;
|
|
416
417
|
}
|
|
417
418
|
function section(oc, shape, tool, approximation = true) {
|
|
418
419
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -425,10 +426,10 @@ function section(oc, shape, tool, approximation = true) {
|
|
|
425
426
|
progress.delete();
|
|
426
427
|
throw new Error("BRepAlgoAPI_Section build failed");
|
|
427
428
|
}
|
|
428
|
-
const
|
|
429
|
+
const result2 = sectionOp.Shape();
|
|
429
430
|
sectionOp.delete();
|
|
430
431
|
progress.delete();
|
|
431
|
-
return
|
|
432
|
+
return result2;
|
|
432
433
|
}
|
|
433
434
|
function fuseAllNative(oc, shapes, options = {}) {
|
|
434
435
|
const { optimisation, simplify: simplify2 = false, fuzzyValue } = options;
|
|
@@ -442,17 +443,17 @@ function fuseAllNative(oc, shapes, options = {}) {
|
|
|
442
443
|
applyBooleanDefaults(builder, fuzzyValue);
|
|
443
444
|
const progress = new oc.Message_ProgressRange_1();
|
|
444
445
|
builder.Build(progress);
|
|
445
|
-
let
|
|
446
|
+
let result2 = builder.Shape();
|
|
446
447
|
if (simplify2) {
|
|
447
|
-
const upgrader = new oc.ShapeUpgrade_UnifySameDomain_2(
|
|
448
|
+
const upgrader = new oc.ShapeUpgrade_UnifySameDomain_2(result2, true, true, false);
|
|
448
449
|
upgrader.Build();
|
|
449
|
-
|
|
450
|
+
result2 = upgrader.Shape();
|
|
450
451
|
upgrader.delete();
|
|
451
452
|
}
|
|
452
453
|
argList.delete();
|
|
453
454
|
builder.delete();
|
|
454
455
|
progress.delete();
|
|
455
|
-
return
|
|
456
|
+
return result2;
|
|
456
457
|
}
|
|
457
458
|
function fuseAllPairwiseRange(oc, shapes, start, end, options) {
|
|
458
459
|
options.signal?.throwIfAborted();
|
|
@@ -467,15 +468,15 @@ function fuseAllPairwiseRange(oc, shapes, start, end, options) {
|
|
|
467
468
|
return fuse(oc, left, right, { ...options, simplify: false });
|
|
468
469
|
}
|
|
469
470
|
function fuseAllPairwise(oc, shapes, options = {}) {
|
|
470
|
-
const
|
|
471
|
+
const result2 = fuseAllPairwiseRange(oc, shapes, 0, shapes.length, options);
|
|
471
472
|
if (options.simplify) {
|
|
472
|
-
const upgrader = new oc.ShapeUpgrade_UnifySameDomain_2(
|
|
473
|
+
const upgrader = new oc.ShapeUpgrade_UnifySameDomain_2(result2, true, true, false);
|
|
473
474
|
upgrader.Build();
|
|
474
475
|
const simplified = upgrader.Shape();
|
|
475
476
|
upgrader.delete();
|
|
476
477
|
return simplified;
|
|
477
478
|
}
|
|
478
|
-
return
|
|
479
|
+
return result2;
|
|
479
480
|
}
|
|
480
481
|
function fuseAll(oc, shapes, options = {}) {
|
|
481
482
|
if (shapes.length === 0) throw new Error("fuseAll requires at least one shape");
|
|
@@ -502,19 +503,19 @@ function split(oc, shape, tools) {
|
|
|
502
503
|
applyBooleanDefaults(splitter);
|
|
503
504
|
const progress = new oc.Message_ProgressRange_1();
|
|
504
505
|
splitter.Build(progress);
|
|
505
|
-
const
|
|
506
|
+
const result2 = splitter.Shape();
|
|
506
507
|
splitter.delete();
|
|
507
508
|
progress.delete();
|
|
508
509
|
argList.delete();
|
|
509
510
|
toolList.delete();
|
|
510
|
-
return
|
|
511
|
+
return result2;
|
|
511
512
|
}
|
|
512
513
|
function cutAll(oc, shape, tools, options = {}) {
|
|
513
514
|
if (tools.length === 0) return shape;
|
|
514
515
|
const toolCompound = buildCompound(oc, tools);
|
|
515
|
-
const
|
|
516
|
+
const result2 = cut(oc, shape, toolCompound, options);
|
|
516
517
|
toolCompound.delete();
|
|
517
|
-
return
|
|
518
|
+
return result2;
|
|
518
519
|
}
|
|
519
520
|
function sliceF32(heap, ptr, size) {
|
|
520
521
|
if (size === 0) return new Float32Array(0);
|
|
@@ -587,12 +588,12 @@ const BULK_TYPE_ENUM_MAP = {
|
|
|
587
588
|
function iterShapesBulk(oc, shape, type) {
|
|
588
589
|
const raw = oc.TopologyExtractor.extract(shape, BULK_TYPE_ENUM_MAP[type]);
|
|
589
590
|
const count = raw.getShapesCount();
|
|
590
|
-
const
|
|
591
|
+
const result2 = [];
|
|
591
592
|
for (let i = 0; i < count; i++) {
|
|
592
|
-
|
|
593
|
+
result2.push(raw.getShape(i));
|
|
593
594
|
}
|
|
594
595
|
raw.delete();
|
|
595
|
-
return
|
|
596
|
+
return result2;
|
|
596
597
|
}
|
|
597
598
|
const jsTypeEnumMaps = /* @__PURE__ */ new WeakMap();
|
|
598
599
|
function iterShapesJS(oc, shape, type) {
|
|
@@ -612,7 +613,7 @@ function iterShapesJS(oc, shape, type) {
|
|
|
612
613
|
jsTypeEnumMaps.set(oc, typeMap);
|
|
613
614
|
}
|
|
614
615
|
const explorer = new oc.TopExp_Explorer_2(shape, typeMap[type], oc.TopAbs_ShapeEnum.TopAbs_SHAPE);
|
|
615
|
-
const
|
|
616
|
+
const result2 = [];
|
|
616
617
|
const seen = /* @__PURE__ */ new Map();
|
|
617
618
|
while (explorer.More()) {
|
|
618
619
|
const item = explorer.Current();
|
|
@@ -620,15 +621,15 @@ function iterShapesJS(oc, shape, type) {
|
|
|
620
621
|
const bucket = seen.get(hash);
|
|
621
622
|
if (!bucket) {
|
|
622
623
|
seen.set(hash, [item]);
|
|
623
|
-
|
|
624
|
+
result2.push(item);
|
|
624
625
|
} else if (!bucket.some((s) => s.IsSame(item))) {
|
|
625
626
|
bucket.push(item);
|
|
626
|
-
|
|
627
|
+
result2.push(item);
|
|
627
628
|
}
|
|
628
629
|
explorer.Next();
|
|
629
630
|
}
|
|
630
631
|
explorer.delete();
|
|
631
|
-
return
|
|
632
|
+
return result2;
|
|
632
633
|
}
|
|
633
634
|
function iterShapes(oc, shape, type) {
|
|
634
635
|
if (oc.TopologyExtractor) {
|
|
@@ -657,9 +658,9 @@ function getShapeTypeMap(oc) {
|
|
|
657
658
|
}
|
|
658
659
|
function shapeType(oc, shape) {
|
|
659
660
|
if (shape.IsNull()) throw new Error("Cannot determine shape type: shape is null");
|
|
660
|
-
const
|
|
661
|
-
if (!
|
|
662
|
-
return
|
|
661
|
+
const result2 = getShapeTypeMap(oc).get(shape.ShapeType());
|
|
662
|
+
if (!result2) throw new Error("Unknown shape type enum value");
|
|
663
|
+
return result2;
|
|
663
664
|
}
|
|
664
665
|
function isValid(oc, shape) {
|
|
665
666
|
const analyzer = new oc.BRepCheck_Analyzer(shape, true, false);
|
|
@@ -674,10 +675,10 @@ function sew(oc, shapes, tolerance = 1e-6) {
|
|
|
674
675
|
}
|
|
675
676
|
const progress = new oc.Message_ProgressRange_1();
|
|
676
677
|
builder.Perform(progress);
|
|
677
|
-
const
|
|
678
|
+
const result2 = builder.SewedShape();
|
|
678
679
|
progress.delete();
|
|
679
680
|
builder.delete();
|
|
680
|
-
return
|
|
681
|
+
return result2;
|
|
681
682
|
}
|
|
682
683
|
function iterShapeList(oc, list, callback) {
|
|
683
684
|
if (oc.TopTools_ListIteratorOfListOfShape) {
|
|
@@ -852,16 +853,16 @@ function makeTorus(oc, majorRadius, minorRadius, center = [0, 0, 0], direction =
|
|
|
852
853
|
function extrude(oc, face, direction, length2) {
|
|
853
854
|
const vec = new oc.gp_Vec_4(direction[0] * length2, direction[1] * length2, direction[2] * length2);
|
|
854
855
|
const maker = new oc.BRepPrimAPI_MakePrism_1(face, vec, false, true);
|
|
855
|
-
const
|
|
856
|
+
const result2 = maker.Shape();
|
|
856
857
|
maker.delete();
|
|
857
858
|
vec.delete();
|
|
858
|
-
return
|
|
859
|
+
return result2;
|
|
859
860
|
}
|
|
860
861
|
function revolve(oc, shape, axis, angle) {
|
|
861
862
|
const maker = new oc.BRepPrimAPI_MakeRevol_1(shape, axis, angle, false);
|
|
862
|
-
const
|
|
863
|
+
const result2 = maker.Shape();
|
|
863
864
|
maker.delete();
|
|
864
|
-
return
|
|
865
|
+
return result2;
|
|
865
866
|
}
|
|
866
867
|
function loft(oc, wires, ruled = false, startShape, endShape) {
|
|
867
868
|
const loftBuilder = new oc.BRepOffsetAPI_ThruSections(true, ruled, 1e-6);
|
|
@@ -872,10 +873,10 @@ function loft(oc, wires, ruled = false, startShape, endShape) {
|
|
|
872
873
|
if (endShape) loftBuilder.AddVertex(endShape);
|
|
873
874
|
const progress = new oc.Message_ProgressRange_1();
|
|
874
875
|
loftBuilder.Build(progress);
|
|
875
|
-
const
|
|
876
|
+
const result2 = loftBuilder.Shape();
|
|
876
877
|
loftBuilder.delete();
|
|
877
878
|
progress.delete();
|
|
878
|
-
return
|
|
879
|
+
return result2;
|
|
879
880
|
}
|
|
880
881
|
function sweep(oc, wire, spine, options = {}) {
|
|
881
882
|
const { transitionMode } = options;
|
|
@@ -888,9 +889,9 @@ function sweep(oc, wire, spine, options = {}) {
|
|
|
888
889
|
sweepBuilder.Build(progress);
|
|
889
890
|
progress.delete();
|
|
890
891
|
sweepBuilder.MakeSolid();
|
|
891
|
-
const
|
|
892
|
+
const result2 = sweepBuilder.Shape();
|
|
892
893
|
sweepBuilder.delete();
|
|
893
|
-
return
|
|
894
|
+
return result2;
|
|
894
895
|
}
|
|
895
896
|
function simplePipe(oc, profile, spine) {
|
|
896
897
|
const maker = new oc.BRepOffsetAPI_MakePipe_1(spine, profile);
|
|
@@ -904,28 +905,28 @@ function simplePipe(oc, profile, spine) {
|
|
|
904
905
|
const solidProgress = new oc.Message_ProgressRange_1();
|
|
905
906
|
solidMaker.Build(solidProgress);
|
|
906
907
|
solidProgress.delete();
|
|
907
|
-
const
|
|
908
|
+
const result2 = solidMaker.IsDone() ? solidMaker.Solid() : shellShape;
|
|
908
909
|
shellDowncast.delete();
|
|
909
910
|
solidMaker.delete();
|
|
910
911
|
maker.delete();
|
|
911
|
-
return
|
|
912
|
+
return result2;
|
|
912
913
|
}
|
|
913
914
|
function healSolid(oc, shape) {
|
|
914
915
|
const fixer = new oc.ShapeFix_Solid_2(shape);
|
|
915
916
|
const progress = new oc.Message_ProgressRange_1();
|
|
916
917
|
fixer.Perform(progress);
|
|
917
918
|
progress.delete();
|
|
918
|
-
const
|
|
919
|
+
const result2 = fixer.Solid();
|
|
919
920
|
fixer.delete();
|
|
920
|
-
if (
|
|
921
|
-
return
|
|
921
|
+
if (result2.IsNull()) return null;
|
|
922
|
+
return result2;
|
|
922
923
|
}
|
|
923
924
|
function healFace(oc, shape) {
|
|
924
925
|
const fixer = new oc.ShapeFix_Face_2(shape);
|
|
925
926
|
fixer.Perform();
|
|
926
|
-
const
|
|
927
|
+
const result2 = fixer.Face();
|
|
927
928
|
fixer.delete();
|
|
928
|
-
return
|
|
929
|
+
return result2;
|
|
929
930
|
}
|
|
930
931
|
function healWire(oc, wire, face) {
|
|
931
932
|
let fixer;
|
|
@@ -936,9 +937,9 @@ function healWire(oc, wire, face) {
|
|
|
936
937
|
fixer.Load_1(wire);
|
|
937
938
|
}
|
|
938
939
|
fixer.Perform();
|
|
939
|
-
const
|
|
940
|
+
const result2 = fixer.Wire();
|
|
940
941
|
fixer.delete();
|
|
941
|
-
return
|
|
942
|
+
return result2;
|
|
942
943
|
}
|
|
943
944
|
function fillet(oc, shape, edges, radius) {
|
|
944
945
|
const builder = new oc.BRepFilletAPI_MakeFillet(shape, oc.ChFi3d_FilletShape.ChFi3d_Rational);
|
|
@@ -952,9 +953,9 @@ function fillet(oc, shape, edges, radius) {
|
|
|
952
953
|
if (r1 > 0 && r2 > 0) builder.Add_3(r1, r2, downcast2);
|
|
953
954
|
}
|
|
954
955
|
}
|
|
955
|
-
const
|
|
956
|
+
const result2 = builder.Shape();
|
|
956
957
|
builder.delete();
|
|
957
|
-
return
|
|
958
|
+
return result2;
|
|
958
959
|
}
|
|
959
960
|
function chamfer(oc, shape, edges, distance2) {
|
|
960
961
|
const builder = new oc.BRepFilletAPI_MakeChamfer(shape);
|
|
@@ -1005,9 +1006,9 @@ function chamfer(oc, shape, edges, distance2) {
|
|
|
1005
1006
|
}
|
|
1006
1007
|
}
|
|
1007
1008
|
}
|
|
1008
|
-
const
|
|
1009
|
+
const result2 = builder.Shape();
|
|
1009
1010
|
builder.delete();
|
|
1010
|
-
return
|
|
1011
|
+
return result2;
|
|
1011
1012
|
}
|
|
1012
1013
|
function shell(oc, shape, faces, thickness, tolerance = 1e-3) {
|
|
1013
1014
|
const facesToRemove = new oc.TopTools_ListOfShape_1();
|
|
@@ -1028,21 +1029,21 @@ function shell(oc, shape, faces, thickness, tolerance = 1e-3) {
|
|
|
1028
1029
|
false,
|
|
1029
1030
|
progress
|
|
1030
1031
|
);
|
|
1031
|
-
const
|
|
1032
|
+
const result2 = builder.Shape();
|
|
1032
1033
|
builder.delete();
|
|
1033
1034
|
facesToRemove.delete();
|
|
1034
1035
|
progress.delete();
|
|
1035
|
-
return
|
|
1036
|
+
return result2;
|
|
1036
1037
|
}
|
|
1037
1038
|
function thicken(oc, shape, thickness) {
|
|
1038
1039
|
const builder = new oc.BRepOffsetAPI_MakeThickSolid();
|
|
1039
1040
|
builder.MakeThickSolidBySimple(shape, thickness);
|
|
1040
1041
|
const progress = new oc.Message_ProgressRange_1();
|
|
1041
1042
|
builder.Build(progress);
|
|
1042
|
-
const
|
|
1043
|
+
const result2 = builder.Shape();
|
|
1043
1044
|
builder.delete();
|
|
1044
1045
|
progress.delete();
|
|
1045
|
-
return
|
|
1046
|
+
return result2;
|
|
1046
1047
|
}
|
|
1047
1048
|
function chamferDistAngle(oc, shape, edges, distance2, angleDeg) {
|
|
1048
1049
|
const builder = new oc.BRepFilletAPI_MakeChamfer(shape);
|
|
@@ -1077,17 +1078,27 @@ function chamferDistAngle(oc, shape, edges, distance2, angleDeg) {
|
|
|
1077
1078
|
builder.AddDA(distance2, angleRad, oc.TopoDS.Edge_1(edge), containingFace);
|
|
1078
1079
|
}
|
|
1079
1080
|
}
|
|
1080
|
-
const
|
|
1081
|
+
const result2 = builder.Shape();
|
|
1081
1082
|
builder.delete();
|
|
1082
|
-
return
|
|
1083
|
+
return result2;
|
|
1083
1084
|
}
|
|
1084
1085
|
function offsetWire2D(oc, wire, offsetVal, joinType) {
|
|
1085
|
-
|
|
1086
|
+
let jt;
|
|
1087
|
+
if (typeof joinType === "string") {
|
|
1088
|
+
const map = {
|
|
1089
|
+
arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
1090
|
+
intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
|
|
1091
|
+
tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
|
|
1092
|
+
};
|
|
1093
|
+
jt = map[joinType] ?? oc.GeomAbs_JoinType.GeomAbs_Arc;
|
|
1094
|
+
} else {
|
|
1095
|
+
jt = joinType ?? oc.GeomAbs_JoinType.GeomAbs_Arc;
|
|
1096
|
+
}
|
|
1086
1097
|
const offsetter = new oc.BRepOffsetAPI_MakeOffset_3(wire, jt, false);
|
|
1087
1098
|
offsetter.Perform(offsetVal, 0);
|
|
1088
|
-
const
|
|
1099
|
+
const result2 = offsetter.Shape();
|
|
1089
1100
|
offsetter.delete();
|
|
1090
|
-
return
|
|
1101
|
+
return result2;
|
|
1091
1102
|
}
|
|
1092
1103
|
function offset(oc, shape, distance2, tolerance = 1e-6) {
|
|
1093
1104
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -1103,10 +1114,10 @@ function offset(oc, shape, distance2, tolerance = 1e-6) {
|
|
|
1103
1114
|
false,
|
|
1104
1115
|
progress
|
|
1105
1116
|
);
|
|
1106
|
-
const
|
|
1117
|
+
const result2 = builder.Shape();
|
|
1107
1118
|
builder.delete();
|
|
1108
1119
|
progress.delete();
|
|
1109
|
-
return
|
|
1120
|
+
return result2;
|
|
1110
1121
|
}
|
|
1111
1122
|
function interpolatePoints(oc, points, options = {}) {
|
|
1112
1123
|
const { tolerance = 1e-8 } = options;
|
|
@@ -1232,18 +1243,18 @@ function signedDist(face, point) {
|
|
|
1232
1243
|
}
|
|
1233
1244
|
function deduplicatePoints(points, tolerance) {
|
|
1234
1245
|
const tolSq = tolerance * tolerance;
|
|
1235
|
-
const
|
|
1246
|
+
const result2 = [];
|
|
1236
1247
|
for (const p of points) {
|
|
1237
1248
|
let isDuplicate = false;
|
|
1238
|
-
for (const q of
|
|
1249
|
+
for (const q of result2) {
|
|
1239
1250
|
if (distSq(p, q) < tolSq) {
|
|
1240
1251
|
isDuplicate = true;
|
|
1241
1252
|
break;
|
|
1242
1253
|
}
|
|
1243
1254
|
}
|
|
1244
|
-
if (!isDuplicate)
|
|
1255
|
+
if (!isDuplicate) result2.push(p);
|
|
1245
1256
|
}
|
|
1246
|
-
return
|
|
1257
|
+
return result2;
|
|
1247
1258
|
}
|
|
1248
1259
|
function findInitialTetrahedron(points) {
|
|
1249
1260
|
const n = points.length;
|
|
@@ -1566,9 +1577,9 @@ function hullFromPoints(oc, points, tolerance) {
|
|
|
1566
1577
|
}
|
|
1567
1578
|
function vertexPosition(oc, vertex) {
|
|
1568
1579
|
const pnt = oc.BRep_Tool.Pnt(vertex);
|
|
1569
|
-
const
|
|
1580
|
+
const result2 = [pnt.X(), pnt.Y(), pnt.Z()];
|
|
1570
1581
|
pnt.delete();
|
|
1571
|
-
return
|
|
1582
|
+
return result2;
|
|
1572
1583
|
}
|
|
1573
1584
|
function buildSurfaceTypeMap(oc) {
|
|
1574
1585
|
const e = oc.GeomAbs_SurfaceType;
|
|
@@ -1619,20 +1630,20 @@ function surfaceNormal(oc, face, u, v) {
|
|
|
1619
1630
|
const pnt = new oc.gp_Pnt_1();
|
|
1620
1631
|
const vec = new oc.gp_Vec_1();
|
|
1621
1632
|
props.Normal(u, v, pnt, vec);
|
|
1622
|
-
const
|
|
1633
|
+
const result2 = [vec.X(), vec.Y(), vec.Z()];
|
|
1623
1634
|
props.delete();
|
|
1624
1635
|
pnt.delete();
|
|
1625
1636
|
vec.delete();
|
|
1626
|
-
return
|
|
1637
|
+
return result2;
|
|
1627
1638
|
}
|
|
1628
1639
|
function pointOnSurface(oc, face, u, v) {
|
|
1629
1640
|
const adaptor = new oc.BRepAdaptor_Surface_2(face, false);
|
|
1630
1641
|
const pnt = new oc.gp_Pnt_1();
|
|
1631
1642
|
adaptor.D0(u, v, pnt);
|
|
1632
|
-
const
|
|
1643
|
+
const result2 = [pnt.X(), pnt.Y(), pnt.Z()];
|
|
1633
1644
|
adaptor.delete();
|
|
1634
1645
|
pnt.delete();
|
|
1635
|
-
return
|
|
1646
|
+
return result2;
|
|
1636
1647
|
}
|
|
1637
1648
|
function uvFromPoint(oc, face, point) {
|
|
1638
1649
|
const surface = oc.BRep_Tool.Surface_2(face);
|
|
@@ -1642,16 +1653,16 @@ function uvFromPoint(oc, face, point) {
|
|
|
1642
1653
|
surface,
|
|
1643
1654
|
oc.Extrema_ExtAlgo.Extrema_ExtAlgo_Grad
|
|
1644
1655
|
);
|
|
1645
|
-
let
|
|
1656
|
+
let result2 = null;
|
|
1646
1657
|
if (proj.NbPoints() > 0) {
|
|
1647
1658
|
const u = { current: 0 };
|
|
1648
1659
|
const v = { current: 0 };
|
|
1649
1660
|
proj.LowerDistanceParameters(u, v);
|
|
1650
|
-
|
|
1661
|
+
result2 = [u.current, v.current];
|
|
1651
1662
|
}
|
|
1652
1663
|
proj.delete();
|
|
1653
1664
|
pnt.delete();
|
|
1654
|
-
return
|
|
1665
|
+
return result2;
|
|
1655
1666
|
}
|
|
1656
1667
|
function projectPointOnFace(oc, face, point) {
|
|
1657
1668
|
const surface = oc.BRep_Tool.Surface_2(face);
|
|
@@ -1661,17 +1672,17 @@ function projectPointOnFace(oc, face, point) {
|
|
|
1661
1672
|
surface,
|
|
1662
1673
|
oc.Extrema_ExtAlgo.Extrema_ExtAlgo_Grad
|
|
1663
1674
|
);
|
|
1664
|
-
let
|
|
1675
|
+
let result2;
|
|
1665
1676
|
if (proj.NbPoints() > 0) {
|
|
1666
1677
|
const nearest = proj.NearestPoint();
|
|
1667
|
-
|
|
1678
|
+
result2 = [nearest.X(), nearest.Y(), nearest.Z()];
|
|
1668
1679
|
nearest.delete();
|
|
1669
1680
|
} else {
|
|
1670
|
-
|
|
1681
|
+
result2 = point;
|
|
1671
1682
|
}
|
|
1672
1683
|
proj.delete();
|
|
1673
1684
|
pnt.delete();
|
|
1674
|
-
return
|
|
1685
|
+
return result2;
|
|
1675
1686
|
}
|
|
1676
1687
|
function curveTangent(oc, shape, param) {
|
|
1677
1688
|
const isWire2 = shape.ShapeType() === oc.TopAbs_ShapeEnum.TopAbs_WIRE;
|
|
@@ -1679,51 +1690,51 @@ function curveTangent(oc, shape, param) {
|
|
|
1679
1690
|
const pnt = new oc.gp_Pnt_1();
|
|
1680
1691
|
const vec = new oc.gp_Vec_1();
|
|
1681
1692
|
adaptor.D1(param, pnt, vec);
|
|
1682
|
-
const
|
|
1693
|
+
const result2 = {
|
|
1683
1694
|
point: [pnt.X(), pnt.Y(), pnt.Z()],
|
|
1684
1695
|
tangent: [vec.X(), vec.Y(), vec.Z()]
|
|
1685
1696
|
};
|
|
1686
1697
|
adaptor.delete();
|
|
1687
1698
|
pnt.delete();
|
|
1688
1699
|
vec.delete();
|
|
1689
|
-
return
|
|
1700
|
+
return result2;
|
|
1690
1701
|
}
|
|
1691
1702
|
function curveParameters(oc, shape) {
|
|
1692
1703
|
const isWire2 = shape.ShapeType() === oc.TopAbs_ShapeEnum.TopAbs_WIRE;
|
|
1693
1704
|
const adaptor = isWire2 ? new oc.BRepAdaptor_CompCurve_2(shape, false) : new oc.BRepAdaptor_Curve_2(shape);
|
|
1694
|
-
const
|
|
1705
|
+
const result2 = [adaptor.FirstParameter(), adaptor.LastParameter()];
|
|
1695
1706
|
adaptor.delete();
|
|
1696
|
-
return
|
|
1707
|
+
return result2;
|
|
1697
1708
|
}
|
|
1698
1709
|
function curvePointAtParam(oc, shape, param) {
|
|
1699
1710
|
const isWire2 = shape.ShapeType() === oc.TopAbs_ShapeEnum.TopAbs_WIRE;
|
|
1700
1711
|
const adaptor = isWire2 ? new oc.BRepAdaptor_CompCurve_2(shape, false) : new oc.BRepAdaptor_Curve_2(shape);
|
|
1701
1712
|
const pnt = adaptor.Value(param);
|
|
1702
|
-
const
|
|
1713
|
+
const result2 = [pnt.X(), pnt.Y(), pnt.Z()];
|
|
1703
1714
|
pnt.delete();
|
|
1704
1715
|
adaptor.delete();
|
|
1705
|
-
return
|
|
1716
|
+
return result2;
|
|
1706
1717
|
}
|
|
1707
1718
|
function curveIsClosed(oc, shape) {
|
|
1708
1719
|
const isWire2 = shape.ShapeType() === oc.TopAbs_ShapeEnum.TopAbs_WIRE;
|
|
1709
1720
|
const adaptor = isWire2 ? new oc.BRepAdaptor_CompCurve_2(shape, false) : new oc.BRepAdaptor_Curve_2(shape);
|
|
1710
|
-
const
|
|
1721
|
+
const result2 = adaptor.IsClosed();
|
|
1711
1722
|
adaptor.delete();
|
|
1712
|
-
return
|
|
1723
|
+
return result2;
|
|
1713
1724
|
}
|
|
1714
1725
|
function curveIsPeriodic(oc, shape) {
|
|
1715
1726
|
const isWire2 = shape.ShapeType() === oc.TopAbs_ShapeEnum.TopAbs_WIRE;
|
|
1716
1727
|
const adaptor = isWire2 ? new oc.BRepAdaptor_CompCurve_2(shape, false) : new oc.BRepAdaptor_Curve_2(shape);
|
|
1717
|
-
const
|
|
1728
|
+
const result2 = adaptor.IsPeriodic();
|
|
1718
1729
|
adaptor.delete();
|
|
1719
|
-
return
|
|
1730
|
+
return result2;
|
|
1720
1731
|
}
|
|
1721
1732
|
function curvePeriod(oc, shape) {
|
|
1722
1733
|
const isWire2 = shape.ShapeType() === oc.TopAbs_ShapeEnum.TopAbs_WIRE;
|
|
1723
1734
|
const adaptor = isWire2 ? new oc.BRepAdaptor_CompCurve_2(shape, false) : new oc.BRepAdaptor_Curve_2(shape);
|
|
1724
|
-
const
|
|
1735
|
+
const result2 = adaptor.Period();
|
|
1725
1736
|
adaptor.delete();
|
|
1726
|
-
return
|
|
1737
|
+
return result2;
|
|
1727
1738
|
}
|
|
1728
1739
|
function curveType(oc, shape) {
|
|
1729
1740
|
const isWire2 = shape.ShapeType() === oc.TopAbs_ShapeEnum.TopAbs_WIRE;
|
|
@@ -1832,9 +1843,9 @@ function getBezierPenultimatePole(oc, edge) {
|
|
|
1832
1843
|
const nbPoles = bezier.NbPoles();
|
|
1833
1844
|
if (nbPoles < 2) return null;
|
|
1834
1845
|
const pole = bezier.Pole(nbPoles - 1);
|
|
1835
|
-
const
|
|
1846
|
+
const result2 = [pole.X(), pole.Y(), pole.Z()];
|
|
1836
1847
|
pole.delete();
|
|
1837
|
-
return
|
|
1848
|
+
return result2;
|
|
1838
1849
|
} catch {
|
|
1839
1850
|
return null;
|
|
1840
1851
|
} finally {
|
|
@@ -1854,13 +1865,13 @@ function getSurfaceCylinderData(oc, surface) {
|
|
|
1854
1865
|
return null;
|
|
1855
1866
|
}
|
|
1856
1867
|
const cyl = adaptor.Cylinder();
|
|
1857
|
-
const
|
|
1868
|
+
const result2 = {
|
|
1858
1869
|
radius: cyl.Radius(),
|
|
1859
1870
|
isDirect: cyl.Direct()
|
|
1860
1871
|
};
|
|
1861
1872
|
cyl.delete();
|
|
1862
1873
|
adaptor.delete();
|
|
1863
|
-
return
|
|
1874
|
+
return result2;
|
|
1864
1875
|
}
|
|
1865
1876
|
function reverseSurfaceU(_oc, surface) {
|
|
1866
1877
|
return surface.get().UReversed();
|
|
@@ -2084,9 +2095,9 @@ function makeEllipsoidGTrsf(oc, x, y, z) {
|
|
|
2084
2095
|
applyToPoint(p) {
|
|
2085
2096
|
const coords = p.XYZ();
|
|
2086
2097
|
transform2.Transforms_1(coords);
|
|
2087
|
-
const
|
|
2098
|
+
const result2 = new oc.gp_Pnt_2(coords);
|
|
2088
2099
|
coords.delete();
|
|
2089
|
-
return
|
|
2100
|
+
return result2;
|
|
2090
2101
|
}
|
|
2091
2102
|
};
|
|
2092
2103
|
}
|
|
@@ -2190,17 +2201,17 @@ function exportSTEPAssembly(oc, parts, options = {}) {
|
|
|
2190
2201
|
progress.delete();
|
|
2191
2202
|
const filename = `assembly_export_${Date.now()}.step`;
|
|
2192
2203
|
const status = writer.Write_1(filename);
|
|
2193
|
-
let
|
|
2204
|
+
let result2 = "";
|
|
2194
2205
|
if (status === oc.IFSelect_ReturnStatus.IFSelect_RetDone) {
|
|
2195
2206
|
const content = oc.FS.readFile("/" + filename);
|
|
2196
|
-
|
|
2207
|
+
result2 = new TextDecoder().decode(content);
|
|
2197
2208
|
oc.FS.unlink("/" + filename);
|
|
2198
2209
|
}
|
|
2199
2210
|
writer.delete();
|
|
2200
2211
|
sessionHandle.delete();
|
|
2201
2212
|
docHandle.delete();
|
|
2202
2213
|
doc.delete();
|
|
2203
|
-
return
|
|
2214
|
+
return result2;
|
|
2204
2215
|
}
|
|
2205
2216
|
function dispose(_oc, handle) {
|
|
2206
2217
|
try {
|
|
@@ -2208,6 +2219,74 @@ function dispose(_oc, handle) {
|
|
|
2208
2219
|
} catch {
|
|
2209
2220
|
}
|
|
2210
2221
|
}
|
|
2222
|
+
function makeRectangle(oc, width, height) {
|
|
2223
|
+
const e1 = makeLineEdge(oc, [0, 0, 0], [width, 0, 0]);
|
|
2224
|
+
const e2 = makeLineEdge(oc, [width, 0, 0], [width, height, 0]);
|
|
2225
|
+
const e3 = makeLineEdge(oc, [width, height, 0], [0, height, 0]);
|
|
2226
|
+
const e4 = makeLineEdge(oc, [0, height, 0], [0, 0, 0]);
|
|
2227
|
+
const bw = new oc.BRepBuilderAPI_MakeWire_1();
|
|
2228
|
+
bw.Add_1(e1);
|
|
2229
|
+
bw.Add_1(e2);
|
|
2230
|
+
bw.Add_1(e3);
|
|
2231
|
+
bw.Add_1(e4);
|
|
2232
|
+
const wire = bw.Wire();
|
|
2233
|
+
bw.delete();
|
|
2234
|
+
e1.delete();
|
|
2235
|
+
e2.delete();
|
|
2236
|
+
e3.delete();
|
|
2237
|
+
e4.delete();
|
|
2238
|
+
const bf = new oc.BRepBuilderAPI_MakeFace_15(wire, false);
|
|
2239
|
+
const face = bf.Face();
|
|
2240
|
+
bf.delete();
|
|
2241
|
+
return face;
|
|
2242
|
+
}
|
|
2243
|
+
function createPoint3d(oc, x, y, z) {
|
|
2244
|
+
return new oc.gp_Pnt_3(x, y, z);
|
|
2245
|
+
}
|
|
2246
|
+
function createDirection3d(oc, x, y, z) {
|
|
2247
|
+
return new oc.gp_Dir_4(x, y, z);
|
|
2248
|
+
}
|
|
2249
|
+
function createVector3d(oc, x, y, z) {
|
|
2250
|
+
return new oc.gp_Vec_4(x, y, z);
|
|
2251
|
+
}
|
|
2252
|
+
function createAxis1(oc, cx, cy, cz, dx, dy, dz) {
|
|
2253
|
+
const pnt = new oc.gp_Pnt_3(cx, cy, cz);
|
|
2254
|
+
const dir = new oc.gp_Dir_4(dx, dy, dz);
|
|
2255
|
+
const ax = new oc.gp_Ax1_2(pnt, dir);
|
|
2256
|
+
pnt.delete();
|
|
2257
|
+
dir.delete();
|
|
2258
|
+
return ax;
|
|
2259
|
+
}
|
|
2260
|
+
function createAxis2(oc, ox, oy, oz, zx, zy, zz, xx, xy, xz) {
|
|
2261
|
+
const pnt = new oc.gp_Pnt_3(ox, oy, oz);
|
|
2262
|
+
const z = new oc.gp_Dir_4(zx, zy, zz);
|
|
2263
|
+
let ax;
|
|
2264
|
+
if (xx !== void 0 && xy !== void 0 && xz !== void 0) {
|
|
2265
|
+
const x = new oc.gp_Dir_4(xx, xy, xz);
|
|
2266
|
+
ax = new oc.gp_Ax2_2(pnt, z, x);
|
|
2267
|
+
x.delete();
|
|
2268
|
+
} else {
|
|
2269
|
+
ax = new oc.gp_Ax2_3(pnt, z);
|
|
2270
|
+
}
|
|
2271
|
+
pnt.delete();
|
|
2272
|
+
z.delete();
|
|
2273
|
+
return ax;
|
|
2274
|
+
}
|
|
2275
|
+
function createAxis3(oc, ox, oy, oz, zx, zy, zz, xx, xy, xz) {
|
|
2276
|
+
const pnt = new oc.gp_Pnt_3(ox, oy, oz);
|
|
2277
|
+
const z = new oc.gp_Dir_4(zx, zy, zz);
|
|
2278
|
+
let ax;
|
|
2279
|
+
if (xx !== void 0 && xy !== void 0 && xz !== void 0) {
|
|
2280
|
+
const x = new oc.gp_Dir_4(xx, xy, xz);
|
|
2281
|
+
ax = new oc.gp_Ax3_3(pnt, z, x);
|
|
2282
|
+
x.delete();
|
|
2283
|
+
} else {
|
|
2284
|
+
ax = new oc.gp_Ax3_4(pnt, z);
|
|
2285
|
+
}
|
|
2286
|
+
pnt.delete();
|
|
2287
|
+
z.delete();
|
|
2288
|
+
return ax;
|
|
2289
|
+
}
|
|
2211
2290
|
function mapContinuity(oc, continuity) {
|
|
2212
2291
|
switch (continuity) {
|
|
2213
2292
|
case "C0":
|
|
@@ -2367,22 +2446,22 @@ function makeBSpline2d(oc, points, options = {}) {
|
|
|
2367
2446
|
function evaluateCurve2d(_oc, curve, param) {
|
|
2368
2447
|
const inner = curve.get();
|
|
2369
2448
|
const p = inner.Value(param);
|
|
2370
|
-
const
|
|
2449
|
+
const result2 = [p.X(), p.Y()];
|
|
2371
2450
|
p.delete();
|
|
2372
|
-
return
|
|
2451
|
+
return result2;
|
|
2373
2452
|
}
|
|
2374
2453
|
function evaluateCurve2dD1(oc, curve, param) {
|
|
2375
2454
|
const inner = curve.get();
|
|
2376
2455
|
const pnt = new oc.gp_Pnt2d_1();
|
|
2377
2456
|
const vec = new oc.gp_Vec2d_1();
|
|
2378
2457
|
inner.D1(param, pnt, vec);
|
|
2379
|
-
const
|
|
2458
|
+
const result2 = {
|
|
2380
2459
|
point: [pnt.X(), pnt.Y()],
|
|
2381
2460
|
tangent: [vec.X(), vec.Y()]
|
|
2382
2461
|
};
|
|
2383
2462
|
pnt.delete();
|
|
2384
2463
|
vec.delete();
|
|
2385
|
-
return
|
|
2464
|
+
return result2;
|
|
2386
2465
|
}
|
|
2387
2466
|
function getCurve2dBounds(_oc, curve) {
|
|
2388
2467
|
const inner = curve.get();
|
|
@@ -2425,10 +2504,10 @@ function offsetCurve2d(oc, curve, offset2) {
|
|
|
2425
2504
|
}
|
|
2426
2505
|
function transformCurve(oc, curve, trsf) {
|
|
2427
2506
|
const gtrsf = new oc.gp_GTrsf2d_2(trsf);
|
|
2428
|
-
const
|
|
2507
|
+
const result2 = oc.GeomLib.GTransform(curve, gtrsf);
|
|
2429
2508
|
gtrsf.delete();
|
|
2430
2509
|
trsf.delete();
|
|
2431
|
-
return
|
|
2510
|
+
return result2;
|
|
2432
2511
|
}
|
|
2433
2512
|
function translateCurve2d(oc, curve, dx, dy) {
|
|
2434
2513
|
const v = new oc.gp_Vec2d_4(dx, dy);
|
|
@@ -2478,9 +2557,9 @@ function affinityTransform2d(oc, curve, axisOriginX, axisOriginY, axisDirX, axis
|
|
|
2478
2557
|
ax.delete();
|
|
2479
2558
|
dir.delete();
|
|
2480
2559
|
origin.delete();
|
|
2481
|
-
const
|
|
2560
|
+
const result2 = oc.GeomLib.GTransform(curve, gtrsf);
|
|
2482
2561
|
gtrsf.delete();
|
|
2483
|
-
return
|
|
2562
|
+
return result2;
|
|
2484
2563
|
}
|
|
2485
2564
|
function wrapTrsf2dAsGTrsf2d(oc, trsf) {
|
|
2486
2565
|
const gtrsf = new oc.gp_GTrsf2d_2(trsf);
|
|
@@ -2581,10 +2660,10 @@ function projectPointOnCurve2d(oc, curve, x, y) {
|
|
|
2581
2660
|
const pnt = new oc.gp_Pnt2d_3(x, y);
|
|
2582
2661
|
const projector = new oc.Geom2dAPI_ProjectPointOnCurve_2(pnt, curve);
|
|
2583
2662
|
pnt.delete();
|
|
2584
|
-
let
|
|
2663
|
+
let result2 = null;
|
|
2585
2664
|
try {
|
|
2586
2665
|
if (projector.NbPoints() > 0) {
|
|
2587
|
-
|
|
2666
|
+
result2 = {
|
|
2588
2667
|
param: projector.LowerDistanceParameter(),
|
|
2589
2668
|
distance: projector.LowerDistance()
|
|
2590
2669
|
};
|
|
@@ -2592,7 +2671,7 @@ function projectPointOnCurve2d(oc, curve, x, y) {
|
|
|
2592
2671
|
} catch {
|
|
2593
2672
|
}
|
|
2594
2673
|
projector.delete();
|
|
2595
|
-
return
|
|
2674
|
+
return result2;
|
|
2596
2675
|
}
|
|
2597
2676
|
function distanceBetweenCurves2d(oc, c1, c2, p1Start, p1End, p2Start, p2End) {
|
|
2598
2677
|
const extrema = new oc.Geom2dAPI_ExtremaCurveCurve(c1, c2, p1Start, p1End, p2Start, p2End);
|
|
@@ -2614,10 +2693,10 @@ function approximateCurve2dAsBSpline(oc, curve, tolerance, continuity, maxSegmen
|
|
|
2614
2693
|
maxSegments,
|
|
2615
2694
|
3
|
|
2616
2695
|
);
|
|
2617
|
-
const
|
|
2696
|
+
const result2 = convert.Curve();
|
|
2618
2697
|
convert.delete();
|
|
2619
2698
|
adaptor.delete();
|
|
2620
|
-
return
|
|
2699
|
+
return result2;
|
|
2621
2700
|
}
|
|
2622
2701
|
function decomposeBSpline2dToBeziers(oc, curve) {
|
|
2623
2702
|
const adaptor = new oc.Geom2dAdaptor_Curve_2(curve);
|
|
@@ -2659,9 +2738,9 @@ function isBBox2dOut(_oc, a, b) {
|
|
|
2659
2738
|
}
|
|
2660
2739
|
function isBBox2dOutPoint(oc, bbox, x, y) {
|
|
2661
2740
|
const pnt = new oc.gp_Pnt2d_3(x, y);
|
|
2662
|
-
const
|
|
2741
|
+
const result2 = bbox.IsOut_1(pnt);
|
|
2663
2742
|
pnt.delete();
|
|
2664
|
-
return
|
|
2743
|
+
return result2;
|
|
2665
2744
|
}
|
|
2666
2745
|
function getCurve2dCircleData(oc, curve) {
|
|
2667
2746
|
const adaptor = new oc.Geom2dAdaptor_Curve_2(curve);
|
|
@@ -2673,7 +2752,7 @@ function getCurve2dCircleData(oc, curve) {
|
|
|
2673
2752
|
}
|
|
2674
2753
|
const circle = adaptor.Circle();
|
|
2675
2754
|
const center = circle.Location();
|
|
2676
|
-
const
|
|
2755
|
+
const result2 = {
|
|
2677
2756
|
cx: center.X(),
|
|
2678
2757
|
cy: center.Y(),
|
|
2679
2758
|
radius: circle.Radius(),
|
|
@@ -2682,7 +2761,7 @@ function getCurve2dCircleData(oc, curve) {
|
|
|
2682
2761
|
center.delete();
|
|
2683
2762
|
circle.delete();
|
|
2684
2763
|
adaptor.delete();
|
|
2685
|
-
return
|
|
2764
|
+
return result2;
|
|
2686
2765
|
}
|
|
2687
2766
|
function getCurve2dEllipseData(oc, curve) {
|
|
2688
2767
|
const adaptor = new oc.Geom2dAdaptor_Curve_2(curve);
|
|
@@ -2694,7 +2773,7 @@ function getCurve2dEllipseData(oc, curve) {
|
|
|
2694
2773
|
}
|
|
2695
2774
|
const elips = adaptor.Ellipse();
|
|
2696
2775
|
const xDir = elips.XAxis().Direction();
|
|
2697
|
-
const
|
|
2776
|
+
const result2 = {
|
|
2698
2777
|
majorRadius: elips.MajorRadius(),
|
|
2699
2778
|
minorRadius: elips.MinorRadius(),
|
|
2700
2779
|
xAxisAngle: Math.atan2(xDir.Y(), xDir.X()),
|
|
@@ -2703,7 +2782,7 @@ function getCurve2dEllipseData(oc, curve) {
|
|
|
2703
2782
|
xDir.delete();
|
|
2704
2783
|
elips.delete();
|
|
2705
2784
|
adaptor.delete();
|
|
2706
|
-
return
|
|
2785
|
+
return result2;
|
|
2707
2786
|
}
|
|
2708
2787
|
function getCurve2dBezierPoles(oc, curve) {
|
|
2709
2788
|
const adaptor = new oc.Geom2dAdaptor_Curve_2(curve);
|
|
@@ -2761,7 +2840,7 @@ function getCurve2dBSplineData(oc, curve) {
|
|
|
2761
2840
|
for (let i = multsArr.Lower(); i <= multsArr.Upper(); i++) {
|
|
2762
2841
|
multiplicities.push(multsArr.Value(i));
|
|
2763
2842
|
}
|
|
2764
|
-
const
|
|
2843
|
+
const result2 = {
|
|
2765
2844
|
poles,
|
|
2766
2845
|
knots,
|
|
2767
2846
|
multiplicities,
|
|
@@ -2769,7 +2848,7 @@ function getCurve2dBSplineData(oc, curve) {
|
|
|
2769
2848
|
isPeriodic: bspline.IsPeriodic()
|
|
2770
2849
|
};
|
|
2771
2850
|
adaptor.delete();
|
|
2772
|
-
return
|
|
2851
|
+
return result2;
|
|
2773
2852
|
}
|
|
2774
2853
|
function serializeCurve2d(oc, curve) {
|
|
2775
2854
|
return oc.GeomToolsWrapper.Write(curve);
|
|
@@ -2857,9 +2936,9 @@ function buildCurves3d(oc, wire) {
|
|
|
2857
2936
|
function fixWireOnFace(oc, wire, face, tolerance) {
|
|
2858
2937
|
const fixer = new oc.ShapeFix_Wire_2(wire, face, tolerance);
|
|
2859
2938
|
fixer.FixEdgeCurves();
|
|
2860
|
-
const
|
|
2939
|
+
const result2 = fixer.Wire();
|
|
2861
2940
|
fixer.delete();
|
|
2862
|
-
return
|
|
2941
|
+
return result2;
|
|
2863
2942
|
}
|
|
2864
2943
|
function fillSurface(oc, wires, options = {}) {
|
|
2865
2944
|
const {
|
|
@@ -2945,24 +3024,24 @@ function parseEvolutionData(oc, raw) {
|
|
|
2945
3024
|
}
|
|
2946
3025
|
}
|
|
2947
3026
|
function iterListHashes(oc, list, hashUpperBound) {
|
|
2948
|
-
const
|
|
2949
|
-
if (list.Size() === 0) return
|
|
3027
|
+
const result2 = [];
|
|
3028
|
+
if (list.Size() === 0) return result2;
|
|
2950
3029
|
if (oc.TopTools_ListIteratorOfListOfShape) {
|
|
2951
3030
|
const iter = new oc.TopTools_ListIteratorOfListOfShape(list);
|
|
2952
3031
|
while (iter.More()) {
|
|
2953
|
-
|
|
3032
|
+
result2.push(iter.Value().HashCode(hashUpperBound));
|
|
2954
3033
|
iter.Next();
|
|
2955
3034
|
}
|
|
2956
3035
|
iter.delete();
|
|
2957
3036
|
} else {
|
|
2958
3037
|
const copy = new oc.TopTools_ListOfShape_3(list);
|
|
2959
3038
|
while (copy.Size() > 0) {
|
|
2960
|
-
|
|
3039
|
+
result2.push(copy.First_1().HashCode(hashUpperBound));
|
|
2961
3040
|
copy.RemoveFirst();
|
|
2962
3041
|
}
|
|
2963
3042
|
copy.delete();
|
|
2964
3043
|
}
|
|
2965
|
-
return
|
|
3044
|
+
return result2;
|
|
2966
3045
|
}
|
|
2967
3046
|
function buildEvolution(oc, op, shapes, inputFaceHashes, hashUpperBound) {
|
|
2968
3047
|
if (inputFaceHashes.length === 0) {
|
|
@@ -3062,10 +3141,10 @@ function generalTransformNonOrthogonal(oc, shape, linear, translation) {
|
|
|
3062
3141
|
gtrsf.SetTranslationPart(xyz);
|
|
3063
3142
|
xyz.delete();
|
|
3064
3143
|
const transformer = new oc.BRepBuilderAPI_GTransform_2(shape, gtrsf, true);
|
|
3065
|
-
const
|
|
3144
|
+
const result2 = transformer.Shape();
|
|
3066
3145
|
transformer.delete();
|
|
3067
3146
|
gtrsf.delete();
|
|
3068
|
-
return
|
|
3147
|
+
return result2;
|
|
3069
3148
|
}
|
|
3070
3149
|
function composeTransform(oc, ops) {
|
|
3071
3150
|
const trsf = new oc.gp_Trsf_1();
|
|
@@ -3151,9 +3230,9 @@ function sweepPipeShell(oc, profile, spine, options = {}) {
|
|
|
3151
3230
|
return { shape, firstShape, lastShape };
|
|
3152
3231
|
}
|
|
3153
3232
|
builder.MakeSolid();
|
|
3154
|
-
const
|
|
3233
|
+
const result2 = builder.Shape();
|
|
3155
3234
|
builder.delete();
|
|
3156
|
-
return
|
|
3235
|
+
return result2;
|
|
3157
3236
|
}
|
|
3158
3237
|
function loftAdvanced(oc, wires, options = {}) {
|
|
3159
3238
|
const solid = options.solid ?? true;
|
|
@@ -3171,9 +3250,9 @@ function loftAdvanced(oc, wires, options = {}) {
|
|
|
3171
3250
|
const progress = new oc.Message_ProgressRange_1();
|
|
3172
3251
|
builder.Build(progress);
|
|
3173
3252
|
progress.delete();
|
|
3174
|
-
const
|
|
3253
|
+
const result2 = builder.Shape();
|
|
3175
3254
|
builder.delete();
|
|
3176
|
-
return
|
|
3255
|
+
return result2;
|
|
3177
3256
|
}
|
|
3178
3257
|
function buildExtrusionLaw(oc, profile, length2, endFactor) {
|
|
3179
3258
|
if (profile === "linear") {
|
|
@@ -3190,12 +3269,12 @@ function revolveVec(oc, shape, center, direction, angle) {
|
|
|
3190
3269
|
const dir = new oc.gp_Dir_4(direction[0], direction[1], direction[2]);
|
|
3191
3270
|
const ax1 = new oc.gp_Ax1_2(origin, dir);
|
|
3192
3271
|
const maker = new oc.BRepPrimAPI_MakeRevol_1(shape, ax1, angle, false);
|
|
3193
|
-
const
|
|
3272
|
+
const result2 = maker.Shape();
|
|
3194
3273
|
maker.delete();
|
|
3195
3274
|
ax1.delete();
|
|
3196
3275
|
dir.delete();
|
|
3197
3276
|
origin.delete();
|
|
3198
|
-
return
|
|
3277
|
+
return result2;
|
|
3199
3278
|
}
|
|
3200
3279
|
function linearPattern(oc, shape, direction, spacing, count) {
|
|
3201
3280
|
const results = [];
|
|
@@ -3245,7 +3324,7 @@ function positionOnCurve(oc, shape, spine, param) {
|
|
|
3245
3324
|
trsf.SetTransformation_2(toAx3);
|
|
3246
3325
|
trsf.Invert();
|
|
3247
3326
|
const transformer = new oc.BRepBuilderAPI_Transform_2(shape, trsf, true);
|
|
3248
|
-
const
|
|
3327
|
+
const result2 = transformer.Shape();
|
|
3249
3328
|
transformer.delete();
|
|
3250
3329
|
trsf.delete();
|
|
3251
3330
|
toAx3.delete();
|
|
@@ -3253,7 +3332,7 @@ function positionOnCurve(oc, shape, spine, param) {
|
|
|
3253
3332
|
tangent.delete();
|
|
3254
3333
|
pnt.delete();
|
|
3255
3334
|
adaptor.delete();
|
|
3256
|
-
return
|
|
3335
|
+
return result2;
|
|
3257
3336
|
}
|
|
3258
3337
|
function makeNonPlanarFace(oc, wire) {
|
|
3259
3338
|
const filler = new oc.BRepOffsetAPI_MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9);
|
|
@@ -3271,9 +3350,9 @@ function makeNonPlanarFace(oc, wire) {
|
|
|
3271
3350
|
const progress = new oc.Message_ProgressRange_1();
|
|
3272
3351
|
filler.Build(progress);
|
|
3273
3352
|
progress.delete();
|
|
3274
|
-
const
|
|
3353
|
+
const result2 = filler.Shape();
|
|
3275
3354
|
filler.delete();
|
|
3276
|
-
return
|
|
3355
|
+
return result2;
|
|
3277
3356
|
}
|
|
3278
3357
|
function addHolesInFace(oc, face, holeWires) {
|
|
3279
3358
|
const faceMaker = new oc.BRepBuilderAPI_MakeFace_2(face);
|
|
@@ -3285,18 +3364,18 @@ function addHolesInFace(oc, face, holeWires) {
|
|
|
3285
3364
|
const fixer = new oc.ShapeFix_Face_2(rawFace);
|
|
3286
3365
|
fixer.FixOrientation_1();
|
|
3287
3366
|
fixer.Perform();
|
|
3288
|
-
const
|
|
3367
|
+
const result2 = fixer.Face();
|
|
3289
3368
|
fixer.delete();
|
|
3290
|
-
return
|
|
3369
|
+
return result2;
|
|
3291
3370
|
}
|
|
3292
3371
|
function removeHolesFromFace(oc, face) {
|
|
3293
3372
|
const outerWire2 = oc.BRepTools.OuterWire(face);
|
|
3294
3373
|
const surface = oc.BRep_Tool.Surface_2(face);
|
|
3295
3374
|
try {
|
|
3296
3375
|
const maker = new oc.BRepBuilderAPI_MakeFace_21(surface, outerWire2, true);
|
|
3297
|
-
const
|
|
3376
|
+
const result2 = maker.Face();
|
|
3298
3377
|
maker.delete();
|
|
3299
|
-
const fixer = new oc.ShapeFix_Face_2(
|
|
3378
|
+
const fixer = new oc.ShapeFix_Face_2(result2);
|
|
3300
3379
|
fixer.FixOrientation_1();
|
|
3301
3380
|
fixer.Perform();
|
|
3302
3381
|
const fixed = fixer.Face();
|
|
@@ -3318,10 +3397,10 @@ function makeFaceOnSurface(oc, surfaceOrFace, wire) {
|
|
|
3318
3397
|
} catch {
|
|
3319
3398
|
}
|
|
3320
3399
|
const maker = new oc.BRepBuilderAPI_MakeFace_21(surface, wire, true);
|
|
3321
|
-
const
|
|
3400
|
+
const result2 = maker.Face();
|
|
3322
3401
|
maker.delete();
|
|
3323
3402
|
if (surfaceOwned) surface.delete();
|
|
3324
|
-
return
|
|
3403
|
+
return result2;
|
|
3325
3404
|
}
|
|
3326
3405
|
function bsplineSurface(oc, points, rows, cols) {
|
|
3327
3406
|
const arr = new oc.TColgp_Array2OfPnt_2(1, rows, 1, cols);
|
|
@@ -3344,10 +3423,10 @@ function bsplineSurface(oc, points, rows, cols) {
|
|
|
3344
3423
|
const surface = fitter.Surface();
|
|
3345
3424
|
arr.delete();
|
|
3346
3425
|
const maker = new oc.BRepBuilderAPI_MakeFace_8(surface, 1e-6);
|
|
3347
|
-
const
|
|
3426
|
+
const result2 = maker.Face();
|
|
3348
3427
|
maker.delete();
|
|
3349
3428
|
fitter.delete();
|
|
3350
|
-
return
|
|
3429
|
+
return result2;
|
|
3351
3430
|
}
|
|
3352
3431
|
function triangulatedSurface(oc, points, rows, cols) {
|
|
3353
3432
|
const sewing = new oc.BRepBuilderAPI_Sewing(1e-6, true, true, true, false);
|
|
@@ -3370,9 +3449,9 @@ function triangulatedSurface(oc, points, rows, cols) {
|
|
|
3370
3449
|
const progress = new oc.Message_ProgressRange_1();
|
|
3371
3450
|
sewing.Perform(progress);
|
|
3372
3451
|
progress.delete();
|
|
3373
|
-
const
|
|
3452
|
+
const result2 = sewing.SewedShape();
|
|
3374
3453
|
sewing.delete();
|
|
3375
|
-
return
|
|
3454
|
+
return result2;
|
|
3376
3455
|
}
|
|
3377
3456
|
function makeTriFace(oc, p1, p2, p3) {
|
|
3378
3457
|
const gp1 = new oc.gp_Pnt_3(p1[0], p1[1], p1[2]);
|
|
@@ -3420,18 +3499,18 @@ function fixShape(oc, shape) {
|
|
|
3420
3499
|
const fixer = new oc.ShapeFix_Shape_1(shape);
|
|
3421
3500
|
const progress = new oc.Message_ProgressRange_1();
|
|
3422
3501
|
fixer.Perform(progress);
|
|
3423
|
-
const
|
|
3502
|
+
const result2 = fixer.Shape();
|
|
3424
3503
|
progress.delete();
|
|
3425
3504
|
fixer.delete();
|
|
3426
|
-
return
|
|
3505
|
+
return result2;
|
|
3427
3506
|
}
|
|
3428
3507
|
function fixSelfIntersection(oc, wire) {
|
|
3429
3508
|
const fixer = new oc.ShapeFix_Wire_1();
|
|
3430
3509
|
fixer.Load_1(wire);
|
|
3431
3510
|
fixer.FixSelfIntersection();
|
|
3432
|
-
const
|
|
3511
|
+
const result2 = fixer.Wire();
|
|
3433
3512
|
fixer.delete();
|
|
3434
|
-
return
|
|
3513
|
+
return result2;
|
|
3435
3514
|
}
|
|
3436
3515
|
function surfaceCurvature(oc, face, u, v) {
|
|
3437
3516
|
const adaptor = new oc.BRepAdaptor_Surface_2(face, false);
|
|
@@ -3447,9 +3526,9 @@ function surfaceCurvature(oc, face, u, v) {
|
|
|
3447
3526
|
const G = D1V.Dot(D1V);
|
|
3448
3527
|
const N = D1U.Crossed(D1V);
|
|
3449
3528
|
const nLen = N.Magnitude();
|
|
3450
|
-
let
|
|
3529
|
+
let result2;
|
|
3451
3530
|
if (nLen < 1e-15) {
|
|
3452
|
-
|
|
3531
|
+
result2 = {
|
|
3453
3532
|
gaussian: 0,
|
|
3454
3533
|
mean: 0,
|
|
3455
3534
|
max: 0,
|
|
@@ -3504,7 +3583,7 @@ function surfaceCurvature(oc, face, u, v) {
|
|
|
3504
3583
|
}
|
|
3505
3584
|
const maxDir = dirFromUV(D1U, D1V, du1, dv1);
|
|
3506
3585
|
const minDir = dirFromUV(D1U, D1V, -dv1, du1);
|
|
3507
|
-
|
|
3586
|
+
result2 = {
|
|
3508
3587
|
gaussian,
|
|
3509
3588
|
mean,
|
|
3510
3589
|
max: k1,
|
|
@@ -3521,7 +3600,7 @@ function surfaceCurvature(oc, face, u, v) {
|
|
|
3521
3600
|
D2UV.delete();
|
|
3522
3601
|
N.delete();
|
|
3523
3602
|
adaptor.delete();
|
|
3524
|
-
return
|
|
3603
|
+
return result2;
|
|
3525
3604
|
}
|
|
3526
3605
|
function dirFromUV(D1U, D1V, du, dv) {
|
|
3527
3606
|
const x = du * D1U.X() + dv * D1V.X();
|
|
@@ -3535,10 +3614,10 @@ function surfaceCenterOfMass(oc, face) {
|
|
|
3535
3614
|
const props = new oc.GProp_GProps_1();
|
|
3536
3615
|
oc.BRepGProp.SurfaceProperties_2(face, props, 1e-7, true);
|
|
3537
3616
|
const center = props.CentreOfMass();
|
|
3538
|
-
const
|
|
3617
|
+
const result2 = [center.X(), center.Y(), center.Z()];
|
|
3539
3618
|
center.delete();
|
|
3540
3619
|
props.delete();
|
|
3541
|
-
return
|
|
3620
|
+
return result2;
|
|
3542
3621
|
}
|
|
3543
3622
|
function createDistanceQuery(oc, referenceShape) {
|
|
3544
3623
|
const distTool = new oc.BRepExtrema_DistShapeShape_1();
|
|
@@ -3555,14 +3634,14 @@ function createDistanceQuery(oc, referenceShape) {
|
|
|
3555
3634
|
const value = distTool.Value();
|
|
3556
3635
|
const p1 = distTool.PointOnShape1(1);
|
|
3557
3636
|
const p2 = distTool.PointOnShape2(1);
|
|
3558
|
-
const
|
|
3637
|
+
const result2 = {
|
|
3559
3638
|
value,
|
|
3560
3639
|
point1: [p1.X(), p1.Y(), p1.Z()],
|
|
3561
3640
|
point2: [p2.X(), p2.Y(), p2.Z()]
|
|
3562
3641
|
};
|
|
3563
3642
|
p1.delete();
|
|
3564
3643
|
p2.delete();
|
|
3565
|
-
return
|
|
3644
|
+
return result2;
|
|
3566
3645
|
},
|
|
3567
3646
|
dispose() {
|
|
3568
3647
|
distTool.delete();
|
|
@@ -3588,7 +3667,7 @@ function projectEdges(oc, shape, cameraOrigin, cameraDirection, cameraXAxis) {
|
|
|
3588
3667
|
hlr.Hide_1();
|
|
3589
3668
|
const hlrHandle = new oc.Handle_HLRBRep_Algo_2(hlr);
|
|
3590
3669
|
const hlrShapes = new oc.HLRBRep_HLRToShape(hlrHandle);
|
|
3591
|
-
const
|
|
3670
|
+
const result2 = {
|
|
3592
3671
|
visible: {
|
|
3593
3672
|
outline: hlrShapes.OutLineVCompound_1(),
|
|
3594
3673
|
smooth: hlrShapes.Rg1LineVCompound_1(),
|
|
@@ -3600,7 +3679,7 @@ function projectEdges(oc, shape, cameraOrigin, cameraDirection, cameraXAxis) {
|
|
|
3600
3679
|
sharp: hlrShapes.HCompound_1()
|
|
3601
3680
|
}
|
|
3602
3681
|
};
|
|
3603
|
-
for (const group of [
|
|
3682
|
+
for (const group of [result2.visible, result2.hidden]) {
|
|
3604
3683
|
for (const s of [group.outline, group.smooth, group.sharp]) {
|
|
3605
3684
|
if (!s.IsNull()) {
|
|
3606
3685
|
oc.BRepLib.BuildCurves3d_2(s);
|
|
@@ -3613,7 +3692,7 @@ function projectEdges(oc, shape, cameraOrigin, cameraDirection, cameraXAxis) {
|
|
|
3613
3692
|
ax2.delete();
|
|
3614
3693
|
dir.delete();
|
|
3615
3694
|
origin.delete();
|
|
3616
|
-
return
|
|
3695
|
+
return result2;
|
|
3617
3696
|
}
|
|
3618
3697
|
function draftPrism(oc, shape, face, baseFace, height, angleDeg, fuse2) {
|
|
3619
3698
|
const angleRad = angleDeg * Math.PI / 180;
|
|
@@ -3626,9 +3705,9 @@ function draftPrism(oc, shape, face, baseFace, height, angleDeg, fuse2) {
|
|
|
3626
3705
|
} else {
|
|
3627
3706
|
maker.PerformThruAll();
|
|
3628
3707
|
}
|
|
3629
|
-
const
|
|
3708
|
+
const result2 = maker.Shape();
|
|
3630
3709
|
maker.delete();
|
|
3631
|
-
return
|
|
3710
|
+
return result2;
|
|
3632
3711
|
}
|
|
3633
3712
|
function createXCAFDocument(oc, shapes) {
|
|
3634
3713
|
const nameStr = new oc.TCollection_ExtendedString_2("XmlOcaf", true);
|
|
@@ -3679,15 +3758,15 @@ function writeXCAFToSTEP(oc, doc, options = {}) {
|
|
|
3679
3758
|
progress.delete();
|
|
3680
3759
|
const filename = uniqueIOFilename("_xcaf_export", "step");
|
|
3681
3760
|
const status = writer.Write(filename);
|
|
3682
|
-
let
|
|
3761
|
+
let result2 = "";
|
|
3683
3762
|
if (status === oc.IFSelect_ReturnStatus.IFSelect_RetDone) {
|
|
3684
3763
|
const content = oc.FS.readFile("/" + filename);
|
|
3685
|
-
|
|
3764
|
+
result2 = new TextDecoder().decode(content);
|
|
3686
3765
|
oc.FS.unlink("/" + filename);
|
|
3687
3766
|
}
|
|
3688
3767
|
writer.delete();
|
|
3689
3768
|
sessionHandle.delete();
|
|
3690
|
-
return
|
|
3769
|
+
return result2;
|
|
3691
3770
|
}
|
|
3692
3771
|
function exportSTEPConfigured(oc, shapes, options = {}) {
|
|
3693
3772
|
const unit = options.unit ?? "MM";
|
|
@@ -3733,17 +3812,17 @@ function exportSTEPConfigured(oc, shapes, options = {}) {
|
|
|
3733
3812
|
progress2.delete();
|
|
3734
3813
|
const filename2 = uniqueIOFilename("_step_cfg_export", "step");
|
|
3735
3814
|
const status = writer2.Write(filename2);
|
|
3736
|
-
let
|
|
3815
|
+
let result2 = "";
|
|
3737
3816
|
if (status === oc.IFSelect_ReturnStatus.IFSelect_RetDone) {
|
|
3738
3817
|
const content = oc.FS.readFile("/" + filename2);
|
|
3739
|
-
|
|
3818
|
+
result2 = new TextDecoder().decode(content);
|
|
3740
3819
|
oc.FS.unlink("/" + filename2);
|
|
3741
3820
|
}
|
|
3742
3821
|
writer2.delete();
|
|
3743
3822
|
sessionHandle.delete();
|
|
3744
3823
|
docHandle.delete();
|
|
3745
3824
|
doc.delete();
|
|
3746
|
-
return
|
|
3825
|
+
return result2;
|
|
3747
3826
|
}
|
|
3748
3827
|
const writer = new oc.STEPControl_Writer_1();
|
|
3749
3828
|
writer.Model(true).delete();
|
|
@@ -3767,9 +3846,9 @@ function translateWithHistory(oc, shape, x, y, z, inputFaceHashes, hashUpperBoun
|
|
|
3767
3846
|
const vec = new oc.gp_Vec_4(x, y, z);
|
|
3768
3847
|
trsf.SetTranslation_1(vec);
|
|
3769
3848
|
vec.delete();
|
|
3770
|
-
const
|
|
3849
|
+
const result2 = transformWithEvolution(oc, shape, trsf, inputFaceHashes, hashUpperBound);
|
|
3771
3850
|
trsf.delete();
|
|
3772
|
-
return
|
|
3851
|
+
return result2;
|
|
3773
3852
|
}
|
|
3774
3853
|
function rotateWithHistory(oc, shape, angle, inputFaceHashes, hashUpperBound, axis = [0, 0, 1], center = [0, 0, 0]) {
|
|
3775
3854
|
const trsf = new oc.gp_Trsf_1();
|
|
@@ -3780,9 +3859,9 @@ function rotateWithHistory(oc, shape, angle, inputFaceHashes, hashUpperBound, ax
|
|
|
3780
3859
|
pnt.delete();
|
|
3781
3860
|
dir.delete();
|
|
3782
3861
|
ax1.delete();
|
|
3783
|
-
const
|
|
3862
|
+
const result2 = transformWithEvolution(oc, shape, trsf, inputFaceHashes, hashUpperBound);
|
|
3784
3863
|
trsf.delete();
|
|
3785
|
-
return
|
|
3864
|
+
return result2;
|
|
3786
3865
|
}
|
|
3787
3866
|
function mirrorWithHistory(oc, shape, origin, normal, inputFaceHashes, hashUpperBound) {
|
|
3788
3867
|
const trsf = new oc.gp_Trsf_1();
|
|
@@ -3793,18 +3872,18 @@ function mirrorWithHistory(oc, shape, origin, normal, inputFaceHashes, hashUpper
|
|
|
3793
3872
|
pnt.delete();
|
|
3794
3873
|
dir.delete();
|
|
3795
3874
|
ax2.delete();
|
|
3796
|
-
const
|
|
3875
|
+
const result2 = transformWithEvolution(oc, shape, trsf, inputFaceHashes, hashUpperBound);
|
|
3797
3876
|
trsf.delete();
|
|
3798
|
-
return
|
|
3877
|
+
return result2;
|
|
3799
3878
|
}
|
|
3800
3879
|
function scaleWithHistory(oc, shape, center, factor, inputFaceHashes, hashUpperBound) {
|
|
3801
3880
|
const trsf = new oc.gp_Trsf_1();
|
|
3802
3881
|
const pnt = new oc.gp_Pnt_3(center[0], center[1], center[2]);
|
|
3803
3882
|
trsf.SetScale(pnt, factor);
|
|
3804
3883
|
pnt.delete();
|
|
3805
|
-
const
|
|
3884
|
+
const result2 = transformWithEvolution(oc, shape, trsf, inputFaceHashes, hashUpperBound);
|
|
3806
3885
|
trsf.delete();
|
|
3807
|
-
return
|
|
3886
|
+
return result2;
|
|
3808
3887
|
}
|
|
3809
3888
|
function generalTransformWithHistory(oc, shape, linear, translation, _isOrthogonal, inputFaceHashes, hashUpperBound) {
|
|
3810
3889
|
const trsf = new oc.gp_Trsf_1();
|
|
@@ -3822,9 +3901,9 @@ function generalTransformWithHistory(oc, shape, linear, translation, _isOrthogon
|
|
|
3822
3901
|
linear[8],
|
|
3823
3902
|
translation[2]
|
|
3824
3903
|
);
|
|
3825
|
-
const
|
|
3904
|
+
const result2 = transformWithEvolution(oc, shape, trsf, inputFaceHashes, hashUpperBound);
|
|
3826
3905
|
trsf.delete();
|
|
3827
|
-
return
|
|
3906
|
+
return result2;
|
|
3828
3907
|
}
|
|
3829
3908
|
function fuseWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound, options = {}) {
|
|
3830
3909
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -3832,7 +3911,7 @@ function fuseWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound, optio
|
|
|
3832
3911
|
applyGlue(oc, fuseOp, options.optimisation);
|
|
3833
3912
|
applyBooleanDefaults(fuseOp, options.fuzzyValue);
|
|
3834
3913
|
fuseOp.Build(progress);
|
|
3835
|
-
const
|
|
3914
|
+
const result2 = booleanWithEvolution(
|
|
3836
3915
|
oc,
|
|
3837
3916
|
fuseOp,
|
|
3838
3917
|
[shape, tool],
|
|
@@ -3842,7 +3921,7 @@ function fuseWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound, optio
|
|
|
3842
3921
|
);
|
|
3843
3922
|
fuseOp.delete();
|
|
3844
3923
|
progress.delete();
|
|
3845
|
-
return
|
|
3924
|
+
return result2;
|
|
3846
3925
|
}
|
|
3847
3926
|
function cutWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound, options = {}) {
|
|
3848
3927
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -3850,7 +3929,7 @@ function cutWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound, option
|
|
|
3850
3929
|
applyGlue(oc, cutOp, options.optimisation);
|
|
3851
3930
|
applyBooleanDefaults(cutOp, options.fuzzyValue);
|
|
3852
3931
|
cutOp.Build(progress);
|
|
3853
|
-
const
|
|
3932
|
+
const result2 = booleanWithEvolution(
|
|
3854
3933
|
oc,
|
|
3855
3934
|
cutOp,
|
|
3856
3935
|
[shape, tool],
|
|
@@ -3860,7 +3939,7 @@ function cutWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound, option
|
|
|
3860
3939
|
);
|
|
3861
3940
|
cutOp.delete();
|
|
3862
3941
|
progress.delete();
|
|
3863
|
-
return
|
|
3942
|
+
return result2;
|
|
3864
3943
|
}
|
|
3865
3944
|
function intersectWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound, options = {}) {
|
|
3866
3945
|
const progress = new oc.Message_ProgressRange_1();
|
|
@@ -3868,7 +3947,7 @@ function intersectWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound,
|
|
|
3868
3947
|
applyGlue(oc, intOp, options.optimisation);
|
|
3869
3948
|
applyBooleanDefaults(intOp, options.fuzzyValue);
|
|
3870
3949
|
intOp.Build(progress);
|
|
3871
|
-
const
|
|
3950
|
+
const result2 = booleanWithEvolution(
|
|
3872
3951
|
oc,
|
|
3873
3952
|
intOp,
|
|
3874
3953
|
[shape, tool],
|
|
@@ -3878,7 +3957,7 @@ function intersectWithHistory(oc, shape, tool, inputFaceHashes, hashUpperBound,
|
|
|
3878
3957
|
);
|
|
3879
3958
|
intOp.delete();
|
|
3880
3959
|
progress.delete();
|
|
3881
|
-
return
|
|
3960
|
+
return result2;
|
|
3882
3961
|
}
|
|
3883
3962
|
function filletWithHistory(oc, shape, edges, radius, inputFaceHashes, hashUpperBound) {
|
|
3884
3963
|
const builder = new oc.BRepFilletAPI_MakeFillet(shape, oc.ChFi3d_FilletShape.ChFi3d_Rational);
|
|
@@ -3893,9 +3972,9 @@ function filletWithHistory(oc, shape, edges, radius, inputFaceHashes, hashUpperB
|
|
|
3893
3972
|
const progress = new oc.Message_ProgressRange_1();
|
|
3894
3973
|
builder.Build(progress);
|
|
3895
3974
|
progress.delete();
|
|
3896
|
-
const
|
|
3975
|
+
const result2 = modifierWithEvolution(oc, builder, shape, inputFaceHashes, hashUpperBound);
|
|
3897
3976
|
builder.delete();
|
|
3898
|
-
return
|
|
3977
|
+
return result2;
|
|
3899
3978
|
}
|
|
3900
3979
|
function chamferWithHistory(oc, shape, edges, distance2, inputFaceHashes, hashUpperBound) {
|
|
3901
3980
|
const builder = new oc.BRepFilletAPI_MakeChamfer(shape);
|
|
@@ -3933,9 +4012,9 @@ function chamferWithHistory(oc, shape, edges, distance2, inputFaceHashes, hashUp
|
|
|
3933
4012
|
const progress = new oc.Message_ProgressRange_1();
|
|
3934
4013
|
builder.Build(progress);
|
|
3935
4014
|
progress.delete();
|
|
3936
|
-
const
|
|
4015
|
+
const result2 = modifierWithEvolution(oc, builder, shape, inputFaceHashes, hashUpperBound);
|
|
3937
4016
|
builder.delete();
|
|
3938
|
-
return
|
|
4017
|
+
return result2;
|
|
3939
4018
|
}
|
|
3940
4019
|
function shellWithHistory(oc, shape, faces, thickness, inputFaceHashes, hashUpperBound, tolerance = 1e-3) {
|
|
3941
4020
|
const builder = new oc.BRepOffsetAPI_MakeThickSolid();
|
|
@@ -3956,9 +4035,9 @@ function shellWithHistory(oc, shape, faces, thickness, inputFaceHashes, hashUppe
|
|
|
3956
4035
|
);
|
|
3957
4036
|
progress.delete();
|
|
3958
4037
|
faceList.delete();
|
|
3959
|
-
const
|
|
4038
|
+
const result2 = modifierWithEvolution(oc, builder, shape, inputFaceHashes, hashUpperBound);
|
|
3960
4039
|
builder.delete();
|
|
3961
|
-
return
|
|
4040
|
+
return result2;
|
|
3962
4041
|
}
|
|
3963
4042
|
function thickenWithHistory(oc, shape, thickness, inputFaceHashes, hashUpperBound) {
|
|
3964
4043
|
const builder = new oc.BRepOffsetAPI_MakeThickSolid();
|
|
@@ -3966,9 +4045,9 @@ function thickenWithHistory(oc, shape, thickness, inputFaceHashes, hashUpperBoun
|
|
|
3966
4045
|
const progress = new oc.Message_ProgressRange_1();
|
|
3967
4046
|
builder.Build(progress);
|
|
3968
4047
|
progress.delete();
|
|
3969
|
-
const
|
|
4048
|
+
const result2 = modifierWithEvolution(oc, builder, shape, inputFaceHashes, hashUpperBound);
|
|
3970
4049
|
builder.delete();
|
|
3971
|
-
return
|
|
4050
|
+
return result2;
|
|
3972
4051
|
}
|
|
3973
4052
|
function offsetWithHistory(oc, shape, distance2, inputFaceHashes, hashUpperBound, tolerance = 1e-6) {
|
|
3974
4053
|
const builder = new oc.BRepOffsetAPI_MakeOffsetShape();
|
|
@@ -3985,9 +4064,9 @@ function offsetWithHistory(oc, shape, distance2, inputFaceHashes, hashUpperBound
|
|
|
3985
4064
|
progress
|
|
3986
4065
|
);
|
|
3987
4066
|
progress.delete();
|
|
3988
|
-
const
|
|
4067
|
+
const result2 = modifierWithEvolution(oc, builder, shape, inputFaceHashes, hashUpperBound);
|
|
3989
4068
|
builder.delete();
|
|
3990
|
-
return
|
|
4069
|
+
return result2;
|
|
3991
4070
|
}
|
|
3992
4071
|
class DefaultAdapter {
|
|
3993
4072
|
oc;
|
|
@@ -4111,12 +4190,7 @@ class DefaultAdapter {
|
|
|
4111
4190
|
return makeBoxFromCorners(this.oc, p1, p2);
|
|
4112
4191
|
}
|
|
4113
4192
|
makeRectangle(width, height) {
|
|
4114
|
-
|
|
4115
|
-
const e2 = this.makeLineEdge([width, 0, 0], [width, height, 0]);
|
|
4116
|
-
const e3 = this.makeLineEdge([width, height, 0], [0, height, 0]);
|
|
4117
|
-
const e4 = this.makeLineEdge([0, height, 0], [0, 0, 0]);
|
|
4118
|
-
const wire = this.makeWire([e1, e2, e3, e4]);
|
|
4119
|
-
return this.makeFace(wire);
|
|
4193
|
+
return makeRectangle(this.oc, width, height);
|
|
4120
4194
|
}
|
|
4121
4195
|
solidFromShell(shell2) {
|
|
4122
4196
|
return solidFromShell(this.oc, shell2);
|
|
@@ -4333,17 +4407,7 @@ class DefaultAdapter {
|
|
|
4333
4407
|
}
|
|
4334
4408
|
// --- 2D offset ---
|
|
4335
4409
|
offsetWire2D(wire, offset2, joinType) {
|
|
4336
|
-
|
|
4337
|
-
if (typeof joinType === "string") {
|
|
4338
|
-
const oc = this.oc;
|
|
4339
|
-
const map = {
|
|
4340
|
-
arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
4341
|
-
intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
|
|
4342
|
-
tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
|
|
4343
|
-
};
|
|
4344
|
-
jt = map[joinType];
|
|
4345
|
-
}
|
|
4346
|
-
return offsetWire2D(this.oc, wire, offset2, jt);
|
|
4410
|
+
return offsetWire2D(this.oc, wire, offset2, joinType);
|
|
4347
4411
|
}
|
|
4348
4412
|
// --- Distance ---
|
|
4349
4413
|
distance(shape1, shape2) {
|
|
@@ -4779,51 +4843,22 @@ class DefaultAdapter {
|
|
|
4779
4843
|
}
|
|
4780
4844
|
// --- 3D Geometry primitive factories ---
|
|
4781
4845
|
createPoint3d(x, y, z) {
|
|
4782
|
-
return
|
|
4846
|
+
return createPoint3d(this.oc, x, y, z);
|
|
4783
4847
|
}
|
|
4784
4848
|
createDirection3d(x, y, z) {
|
|
4785
|
-
return
|
|
4849
|
+
return createDirection3d(this.oc, x, y, z);
|
|
4786
4850
|
}
|
|
4787
4851
|
createVector3d(x, y, z) {
|
|
4788
|
-
return
|
|
4852
|
+
return createVector3d(this.oc, x, y, z);
|
|
4789
4853
|
}
|
|
4790
4854
|
createAxis1(cx, cy, cz, dx, dy, dz) {
|
|
4791
|
-
|
|
4792
|
-
const dir = new this.oc.gp_Dir_4(dx, dy, dz);
|
|
4793
|
-
const ax = new this.oc.gp_Ax1_2(pnt, dir);
|
|
4794
|
-
pnt.delete();
|
|
4795
|
-
dir.delete();
|
|
4796
|
-
return ax;
|
|
4855
|
+
return createAxis1(this.oc, cx, cy, cz, dx, dy, dz);
|
|
4797
4856
|
}
|
|
4798
4857
|
createAxis2(ox, oy, oz, zx, zy, zz, xx, xy, xz) {
|
|
4799
|
-
|
|
4800
|
-
const z = new this.oc.gp_Dir_4(zx, zy, zz);
|
|
4801
|
-
let ax;
|
|
4802
|
-
if (xx !== void 0 && xy !== void 0 && xz !== void 0) {
|
|
4803
|
-
const x = new this.oc.gp_Dir_4(xx, xy, xz);
|
|
4804
|
-
ax = new this.oc.gp_Ax2_2(pnt, z, x);
|
|
4805
|
-
x.delete();
|
|
4806
|
-
} else {
|
|
4807
|
-
ax = new this.oc.gp_Ax2_3(pnt, z);
|
|
4808
|
-
}
|
|
4809
|
-
pnt.delete();
|
|
4810
|
-
z.delete();
|
|
4811
|
-
return ax;
|
|
4858
|
+
return createAxis2(this.oc, ox, oy, oz, zx, zy, zz, xx, xy, xz);
|
|
4812
4859
|
}
|
|
4813
4860
|
createAxis3(ox, oy, oz, zx, zy, zz, xx, xy, xz) {
|
|
4814
|
-
|
|
4815
|
-
const z = new this.oc.gp_Dir_4(zx, zy, zz);
|
|
4816
|
-
let ax;
|
|
4817
|
-
if (xx !== void 0 && xy !== void 0 && xz !== void 0) {
|
|
4818
|
-
const x = new this.oc.gp_Dir_4(xx, xy, xz);
|
|
4819
|
-
ax = new this.oc.gp_Ax3_3(pnt, z, x);
|
|
4820
|
-
x.delete();
|
|
4821
|
-
} else {
|
|
4822
|
-
ax = new this.oc.gp_Ax3_4(pnt, z);
|
|
4823
|
-
}
|
|
4824
|
-
pnt.delete();
|
|
4825
|
-
z.delete();
|
|
4826
|
-
return ax;
|
|
4861
|
+
return createAxis3(this.oc, ox, oy, oz, zx, zy, zz, xx, xy, xz);
|
|
4827
4862
|
}
|
|
4828
4863
|
// --- Unsupported brepkit-only methods ---
|
|
4829
4864
|
export3MF(_shape, _tolerance) {
|
|
@@ -4967,7 +5002,13 @@ function withKernel(id, fn) {
|
|
|
4967
5002
|
_defaultKernelId = id;
|
|
4968
5003
|
_cachedDefault = _kernels.get(id) ?? null;
|
|
4969
5004
|
try {
|
|
4970
|
-
|
|
5005
|
+
const result2 = fn();
|
|
5006
|
+
if (result2 instanceof Promise) {
|
|
5007
|
+
throw new Error(
|
|
5008
|
+
"withKernel() callback returned a Promise. Async code must use getKernel(id) directly — the kernel override is restored synchronously in finally."
|
|
5009
|
+
);
|
|
5010
|
+
}
|
|
5011
|
+
return result2;
|
|
4971
5012
|
} finally {
|
|
4972
5013
|
_defaultKernelId = prev;
|
|
4973
5014
|
_cachedDefault = prev ? _kernels.get(prev) ?? null : null;
|
|
@@ -4993,7 +5034,38 @@ if (!globalWithRegistry.FinalizationRegistry) {
|
|
|
4993
5034
|
}
|
|
4994
5035
|
};
|
|
4995
5036
|
}
|
|
5037
|
+
const _stats = {
|
|
5038
|
+
liveHandles: 0,
|
|
5039
|
+
peakHandles: 0,
|
|
5040
|
+
gcCollected: 0,
|
|
5041
|
+
scopeEnters: 0,
|
|
5042
|
+
scopeExits: 0
|
|
5043
|
+
};
|
|
5044
|
+
function getDisposalStats() {
|
|
5045
|
+
return { ..._stats };
|
|
5046
|
+
}
|
|
5047
|
+
function resetDisposalStats() {
|
|
5048
|
+
_stats.liveHandles = 0;
|
|
5049
|
+
_stats.peakHandles = 0;
|
|
5050
|
+
_stats.gcCollected = 0;
|
|
5051
|
+
_stats.scopeEnters = 0;
|
|
5052
|
+
_stats.scopeExits = 0;
|
|
5053
|
+
}
|
|
5054
|
+
function trackHandleCreated() {
|
|
5055
|
+
_stats.liveHandles++;
|
|
5056
|
+
if (_stats.liveHandles > _stats.peakHandles) {
|
|
5057
|
+
_stats.peakHandles = _stats.liveHandles;
|
|
5058
|
+
}
|
|
5059
|
+
}
|
|
5060
|
+
function trackHandleDisposed() {
|
|
5061
|
+
_stats.liveHandles--;
|
|
5062
|
+
}
|
|
5063
|
+
function trackGcCollected() {
|
|
5064
|
+
_stats.gcCollected++;
|
|
5065
|
+
_stats.liveHandles--;
|
|
5066
|
+
}
|
|
4996
5067
|
const registry = new FinalizationRegistry((heldValue) => {
|
|
5068
|
+
trackGcCollected();
|
|
4997
5069
|
try {
|
|
4998
5070
|
heldValue.delete();
|
|
4999
5071
|
} catch {
|
|
@@ -5004,6 +5076,7 @@ function createHandle(ocShape) {
|
|
|
5004
5076
|
const dispose2 = () => {
|
|
5005
5077
|
if (!disposed) {
|
|
5006
5078
|
disposed = true;
|
|
5079
|
+
trackHandleDisposed();
|
|
5007
5080
|
registry.unregister(handle);
|
|
5008
5081
|
try {
|
|
5009
5082
|
ocShape.delete();
|
|
@@ -5026,6 +5099,7 @@ function createHandle(ocShape) {
|
|
|
5026
5099
|
dispose2();
|
|
5027
5100
|
}
|
|
5028
5101
|
};
|
|
5102
|
+
trackHandleCreated();
|
|
5029
5103
|
registry.register(handle, ocShape, handle);
|
|
5030
5104
|
return handle;
|
|
5031
5105
|
}
|
|
@@ -5042,6 +5116,7 @@ function createKernelHandle(ocObj) {
|
|
|
5042
5116
|
[Symbol.dispose]() {
|
|
5043
5117
|
if (!disposed) {
|
|
5044
5118
|
disposed = true;
|
|
5119
|
+
trackHandleDisposed();
|
|
5045
5120
|
registry.unregister(handle);
|
|
5046
5121
|
try {
|
|
5047
5122
|
ocObj.delete();
|
|
@@ -5050,11 +5125,15 @@ function createKernelHandle(ocObj) {
|
|
|
5050
5125
|
}
|
|
5051
5126
|
}
|
|
5052
5127
|
};
|
|
5128
|
+
trackHandleCreated();
|
|
5053
5129
|
registry.register(handle, ocObj, handle);
|
|
5054
5130
|
return handle;
|
|
5055
5131
|
}
|
|
5056
5132
|
class DisposalScope {
|
|
5057
5133
|
handles = [];
|
|
5134
|
+
constructor() {
|
|
5135
|
+
_stats.scopeEnters++;
|
|
5136
|
+
}
|
|
5058
5137
|
/** Register a resource for disposal when scope ends. */
|
|
5059
5138
|
register(resource) {
|
|
5060
5139
|
this.handles.push(() => {
|
|
@@ -5076,6 +5155,7 @@ class DisposalScope {
|
|
|
5076
5155
|
return disposable;
|
|
5077
5156
|
}
|
|
5078
5157
|
[Symbol.dispose]() {
|
|
5158
|
+
_stats.scopeExits++;
|
|
5079
5159
|
for (let i = this.handles.length - 1; i >= 0; i--) {
|
|
5080
5160
|
this.handles[i]?.();
|
|
5081
5161
|
}
|
|
@@ -5124,20 +5204,64 @@ async function withScopeResultAsync(fn) {
|
|
|
5124
5204
|
function isLive(handle) {
|
|
5125
5205
|
return !handle.disposed;
|
|
5126
5206
|
}
|
|
5127
|
-
function
|
|
5207
|
+
function is3D(s) {
|
|
5208
|
+
return s.__is2D !== true;
|
|
5209
|
+
}
|
|
5210
|
+
function is2D(s) {
|
|
5211
|
+
return s.__is2D === true;
|
|
5212
|
+
}
|
|
5213
|
+
function as3D(s) {
|
|
5214
|
+
if (!is3D(s)) throw new Error("Expected 3D shape, got 2D");
|
|
5215
|
+
return s;
|
|
5216
|
+
}
|
|
5217
|
+
function as2D(s) {
|
|
5218
|
+
if (!is2D(s)) throw new Error("Expected 2D shape, got 3D");
|
|
5219
|
+
return s;
|
|
5220
|
+
}
|
|
5221
|
+
const CURVE_TYPE_BY_INT = [
|
|
5222
|
+
"LINE",
|
|
5223
|
+
// 0
|
|
5224
|
+
"CIRCLE",
|
|
5225
|
+
// 1
|
|
5226
|
+
"ELLIPSE",
|
|
5227
|
+
// 2
|
|
5228
|
+
"HYPERBOLA",
|
|
5229
|
+
// 3
|
|
5230
|
+
"PARABOLA",
|
|
5231
|
+
// 4
|
|
5232
|
+
"BEZIER_CURVE",
|
|
5233
|
+
// 5
|
|
5234
|
+
"BSPLINE_CURVE",
|
|
5235
|
+
// 6
|
|
5236
|
+
"OFFSET_CURVE",
|
|
5237
|
+
// 7
|
|
5238
|
+
"OTHER_CURVE"
|
|
5239
|
+
// 8
|
|
5240
|
+
];
|
|
5241
|
+
const findCurveType = (type) => {
|
|
5242
|
+
const idx = typeof type === "number" ? type : Number(type?.value ?? type);
|
|
5243
|
+
const curveType2 = CURVE_TYPE_BY_INT[idx];
|
|
5244
|
+
if (!curveType2) return result.err(result.typeCastError("UNKNOWN_CURVE_TYPE", "Unknown curve type"));
|
|
5245
|
+
return result.ok(curveType2);
|
|
5246
|
+
};
|
|
5247
|
+
function getShapeKind(shape) {
|
|
5248
|
+
return getKernel().shapeType(shape.wrapped);
|
|
5249
|
+
}
|
|
5250
|
+
function brandHandle(handle, dim) {
|
|
5251
|
+
if (dim === "2D") handle.__is2D = true;
|
|
5128
5252
|
return handle;
|
|
5129
5253
|
}
|
|
5130
|
-
function createVertex(ocShape) {
|
|
5131
|
-
return brandHandle(createHandle(ocShape));
|
|
5254
|
+
function createVertex(ocShape, dim) {
|
|
5255
|
+
return brandHandle(createHandle(ocShape), dim);
|
|
5132
5256
|
}
|
|
5133
|
-
function createEdge(ocShape) {
|
|
5134
|
-
return brandHandle(createHandle(ocShape));
|
|
5257
|
+
function createEdge(ocShape, dim) {
|
|
5258
|
+
return brandHandle(createHandle(ocShape), dim);
|
|
5135
5259
|
}
|
|
5136
|
-
function createWire(ocShape) {
|
|
5137
|
-
return brandHandle(createHandle(ocShape));
|
|
5260
|
+
function createWire(ocShape, dim) {
|
|
5261
|
+
return brandHandle(createHandle(ocShape), dim);
|
|
5138
5262
|
}
|
|
5139
|
-
function createFace(ocShape) {
|
|
5140
|
-
return brandHandle(createHandle(ocShape));
|
|
5263
|
+
function createFace(ocShape, dim) {
|
|
5264
|
+
return brandHandle(createHandle(ocShape), dim);
|
|
5141
5265
|
}
|
|
5142
5266
|
function createShell(ocShape) {
|
|
5143
5267
|
return brandHandle(createHandle(ocShape));
|
|
@@ -5148,11 +5272,8 @@ function createSolid(ocShape) {
|
|
|
5148
5272
|
function createCompSolid(ocShape) {
|
|
5149
5273
|
return brandHandle(createHandle(ocShape));
|
|
5150
5274
|
}
|
|
5151
|
-
function createCompound(ocShape) {
|
|
5152
|
-
return brandHandle(createHandle(ocShape));
|
|
5153
|
-
}
|
|
5154
|
-
function getShapeKind(shape) {
|
|
5155
|
-
return getKernel().shapeType(shape.wrapped);
|
|
5275
|
+
function createCompound(ocShape, dim) {
|
|
5276
|
+
return brandHandle(createHandle(ocShape), dim);
|
|
5156
5277
|
}
|
|
5157
5278
|
function isVertex(s) {
|
|
5158
5279
|
return getShapeKind(s) === "vertex";
|
|
@@ -5185,73 +5306,18 @@ function isShape1D(s) {
|
|
|
5185
5306
|
const kind = getShapeKind(s);
|
|
5186
5307
|
return kind === "edge" || kind === "wire";
|
|
5187
5308
|
}
|
|
5188
|
-
function
|
|
5189
|
-
return s.__is2D !== true;
|
|
5190
|
-
}
|
|
5191
|
-
function is2D(s) {
|
|
5192
|
-
return s.__is2D === true;
|
|
5193
|
-
}
|
|
5194
|
-
function as3D(s) {
|
|
5195
|
-
if (!is3D(s)) throw new Error("Expected 3D shape, got 2D");
|
|
5196
|
-
return s;
|
|
5197
|
-
}
|
|
5198
|
-
function as2D(s) {
|
|
5199
|
-
if (!is2D(s)) throw new Error("Expected 2D shape, got 3D");
|
|
5200
|
-
return s;
|
|
5201
|
-
}
|
|
5202
|
-
function isClosedWire(wire) {
|
|
5203
|
-
return getKernel().curveIsClosed(wire.wrapped);
|
|
5204
|
-
}
|
|
5205
|
-
function isOrientedFace(face) {
|
|
5206
|
-
return getKernel().isValid(face.wrapped);
|
|
5207
|
-
}
|
|
5208
|
-
function isManifoldShell(shell2) {
|
|
5209
|
-
const kernel = getKernel();
|
|
5210
|
-
if (!kernel.isValid(shell2.wrapped)) return false;
|
|
5211
|
-
const validate = kernel.isValidStrict?.bind(kernel) ?? kernel.isValid.bind(kernel);
|
|
5212
|
-
try {
|
|
5213
|
-
const solid = kernel.solidFromShell(shell2.wrapped);
|
|
5214
|
-
const valid = validate(solid);
|
|
5215
|
-
try {
|
|
5216
|
-
kernel.dispose(solid);
|
|
5217
|
-
} catch {
|
|
5218
|
-
}
|
|
5219
|
-
return valid;
|
|
5220
|
-
} catch {
|
|
5221
|
-
return false;
|
|
5222
|
-
}
|
|
5223
|
-
}
|
|
5224
|
-
function isValidSolid(solid) {
|
|
5225
|
-
return getKernel().isValid(solid.wrapped);
|
|
5226
|
-
}
|
|
5227
|
-
function closedWire(wire) {
|
|
5228
|
-
if (isClosedWire(wire)) return { valid: true, shape: wire };
|
|
5229
|
-
return { valid: false, reason: "Wire is not closed: start and end points do not coincide" };
|
|
5230
|
-
}
|
|
5231
|
-
function orientedFace(face) {
|
|
5232
|
-
if (isOrientedFace(face)) return { valid: true, shape: face };
|
|
5233
|
-
return { valid: false, reason: "Face orientation is inconsistent or face is invalid" };
|
|
5234
|
-
}
|
|
5235
|
-
function manifoldShell(shell2) {
|
|
5236
|
-
if (isManifoldShell(shell2)) return { valid: true, shape: shell2 };
|
|
5237
|
-
return { valid: false, reason: "Shell is not manifold: has free edges or is invalid" };
|
|
5238
|
-
}
|
|
5239
|
-
function validSolid(solid) {
|
|
5240
|
-
if (isValidSolid(solid)) return { valid: true, shape: solid };
|
|
5241
|
-
return { valid: false, reason: "Solid failed BRepCheck validation" };
|
|
5242
|
-
}
|
|
5243
|
-
function castShape(ocShape) {
|
|
5309
|
+
function castShape(ocShape, dim) {
|
|
5244
5310
|
const kernel = getKernel();
|
|
5245
5311
|
const st = kernel.shapeType(ocShape);
|
|
5246
5312
|
const dc = kernel.downcast(ocShape, st);
|
|
5247
|
-
if (st === "vertex") return createVertex(dc);
|
|
5248
|
-
if (st === "edge") return createEdge(dc);
|
|
5249
|
-
if (st === "wire") return createWire(dc);
|
|
5250
|
-
if (st === "face") return createFace(dc);
|
|
5313
|
+
if (st === "vertex") return createVertex(dc, dim);
|
|
5314
|
+
if (st === "edge") return createEdge(dc, dim);
|
|
5315
|
+
if (st === "wire") return createWire(dc, dim);
|
|
5316
|
+
if (st === "face") return createFace(dc, dim);
|
|
5251
5317
|
if (st === "shell") return createShell(dc);
|
|
5252
5318
|
if (st === "solid") return createSolid(dc);
|
|
5253
5319
|
if (st === "compsolid") return createCompSolid(dc);
|
|
5254
|
-
return createCompound(dc);
|
|
5320
|
+
return createCompound(dc, dim);
|
|
5255
5321
|
}
|
|
5256
5322
|
function castShape3D(ocShape) {
|
|
5257
5323
|
return castShape(ocShape);
|
|
@@ -5261,7 +5327,6 @@ exports.as2D = as2D;
|
|
|
5261
5327
|
exports.as3D = as3D;
|
|
5262
5328
|
exports.castShape = castShape;
|
|
5263
5329
|
exports.castShape3D = castShape3D;
|
|
5264
|
-
exports.closedWire = closedWire;
|
|
5265
5330
|
exports.createCompound = createCompound;
|
|
5266
5331
|
exports.createEdge = createEdge;
|
|
5267
5332
|
exports.createFace = createFace;
|
|
@@ -5271,32 +5336,28 @@ exports.createShell = createShell;
|
|
|
5271
5336
|
exports.createSolid = createSolid;
|
|
5272
5337
|
exports.createVertex = createVertex;
|
|
5273
5338
|
exports.createWire = createWire;
|
|
5339
|
+
exports.findCurveType = findCurveType;
|
|
5340
|
+
exports.getDisposalStats = getDisposalStats;
|
|
5274
5341
|
exports.getKernel = getKernel;
|
|
5275
5342
|
exports.getKernel2D = getKernel2D;
|
|
5276
5343
|
exports.getShapeKind = getShapeKind;
|
|
5277
5344
|
exports.initFromOC = initFromOC;
|
|
5278
5345
|
exports.is2D = is2D;
|
|
5279
5346
|
exports.is3D = is3D;
|
|
5280
|
-
exports.isClosedWire = isClosedWire;
|
|
5281
5347
|
exports.isCompound = isCompound;
|
|
5282
5348
|
exports.isEdge = isEdge;
|
|
5283
5349
|
exports.isFace = isFace;
|
|
5284
5350
|
exports.isLive = isLive;
|
|
5285
|
-
exports.isManifoldShell = isManifoldShell;
|
|
5286
|
-
exports.isOrientedFace = isOrientedFace;
|
|
5287
5351
|
exports.isShape1D = isShape1D;
|
|
5288
5352
|
exports.isShape3D = isShape3D;
|
|
5289
5353
|
exports.isShell = isShell;
|
|
5290
5354
|
exports.isSolid = isSolid;
|
|
5291
|
-
exports.isValidSolid = isValidSolid;
|
|
5292
5355
|
exports.isVertex = isVertex;
|
|
5293
5356
|
exports.isWire = isWire;
|
|
5294
|
-
exports.manifoldShell = manifoldShell;
|
|
5295
|
-
exports.orientedFace = orientedFace;
|
|
5296
5357
|
exports.registerForCleanup = registerForCleanup;
|
|
5297
5358
|
exports.registerKernel = registerKernel;
|
|
5359
|
+
exports.resetDisposalStats = resetDisposalStats;
|
|
5298
5360
|
exports.unregisterFromCleanup = unregisterFromCleanup;
|
|
5299
|
-
exports.validSolid = validSolid;
|
|
5300
5361
|
exports.withKernel = withKernel;
|
|
5301
5362
|
exports.withScope = withScope;
|
|
5302
5363
|
exports.withScopeResult = withScopeResult;
|