brepjs 8.8.2 → 8.8.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/curves.d.ts.map +1 -1
- package/dist/2d/lib/Curve2D.d.ts.map +1 -1
- package/dist/2d/lib/approximations.d.ts.map +1 -1
- package/dist/2d/lib/makeCurves.d.ts.map +1 -1
- package/dist/2d/lib/ocWrapper.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/Blueprint-BmFJ4caY.cjs +1439 -0
- package/dist/Blueprint-DsoGiJNJ.js +1440 -0
- package/dist/{boolean2D-q5FOdOQW.cjs → boolean2D-BQk8LNmZ.cjs} +212 -127
- package/dist/{boolean2D-Dgnuy63w.js → boolean2D-D5O0F3J8.js} +212 -127
- package/dist/{booleanFns-CFit7JYt.cjs → booleanFns-CVM3dOTP.cjs} +210 -130
- package/dist/{booleanFns--Orezl-b.js → booleanFns-DOyKxL7q.js} +210 -130
- package/dist/brepjs.cjs +457 -304
- package/dist/brepjs.js +551 -398
- package/dist/core/disposal.d.ts +44 -3
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core/geometryHelpers.d.ts.map +1 -1
- package/dist/core/kernelCall.d.ts +20 -0
- package/dist/core/kernelCall.d.ts.map +1 -1
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/memory.d.ts.map +1 -1
- package/dist/core.cjs +4 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -8
- package/dist/{cornerFinder-KNTFoGrm.js → cornerFinder-DH6EwYfL.js} +1 -1
- package/dist/{cornerFinder-v4un1Fr9.cjs → cornerFinder-XAV2ywVS.cjs} +1 -1
- package/dist/curveFns-BHRYwxBM.js +281 -0
- package/dist/{curveFns-6ovDM_sR.cjs → curveFns-BsAHC3Qv.cjs} +137 -36
- package/dist/{drawFns-WgXeXHH1.cjs → drawFns-CsmUF97U.cjs} +181 -101
- package/dist/{drawFns-XwroLxdb.js → drawFns-hD05g0ZQ.js} +181 -101
- package/dist/faceFns-DNQss51F.cjs +358 -0
- package/dist/faceFns-q5CR9pOW.js +359 -0
- package/dist/{helpers-CRfqaW0Y.cjs → helpers-aylLv0_I.cjs} +13 -10
- package/dist/{helpers-CtBCzEqs.js → helpers-tNdaX01G.js} +13 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/io/importFns.d.ts.map +1 -1
- package/dist/io.cjs +131 -63
- package/dist/io.js +131 -63
- package/dist/loft-CjEEqz2P.cjs +530 -0
- package/dist/loft-DTRcYrq2.js +531 -0
- package/dist/measurement-B6_cxjpw.cjs +200 -0
- package/dist/measurement-BXqFvcGh.js +201 -0
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-CPNNlpbw.cjs → meshFns-CTc1CRkF.cjs} +1 -1
- package/dist/{meshFns-DAmWVyEp.js → meshFns-DDFl7gLN.js} +1 -1
- package/dist/operations/exporterFns.d.ts.map +1 -1
- package/dist/operations/exporterUtils.d.ts +3 -3
- package/dist/operations/exporterUtils.d.ts.map +1 -1
- package/dist/operations/exporters.d.ts.map +1 -1
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/loft.d.ts.map +1 -1
- package/dist/operations/multiSweepFns.d.ts.map +1 -1
- package/dist/{operations-vN0tcoaU.js → operations-jRE2QbPo.js} +261 -166
- package/dist/{operations-BQ25CPI8.cjs → operations-pxjbW4Er.cjs} +261 -166
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query/shapeDistanceFilter.d.ts.map +1 -1
- package/dist/query.cjs +66 -14
- package/dist/query.js +67 -15
- package/dist/{shapeFns-C785aeVn.cjs → shapeFns-D4CRxxmF.cjs} +61 -7
- package/dist/{shapeFns-ClpALED4.js → shapeFns-DNnBK8fG.js} +61 -7
- package/dist/{shapeTypes-DnwCo942.js → shapeTypes-Bi_9RZa2.js} +50 -19
- package/dist/{shapeTypes-CIijJxCz.cjs → shapeTypes-CWuX602K.cjs} +32 -1
- package/dist/sketching/CompoundSketch.d.ts.map +1 -1
- package/dist/sketching/Sketch.d.ts.map +1 -1
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching/Sketcher2d.d.ts.map +1 -1
- package/dist/sketching/cannedSketches.d.ts.map +1 -1
- package/dist/sketching/draw.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/surfaceBuilders-CLal3WlK.cjs +429 -0
- package/dist/surfaceBuilders-W9Y25CIb.js +430 -0
- package/dist/topology/curveBuilders.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/solidBuilders.d.ts.map +1 -1
- package/dist/topology/surfaceBuilders.d.ts.map +1 -1
- package/dist/{topology-CqyxpmEh.js → topology-CMM6vAzx.js} +6 -6
- package/dist/{topology-zG8maSDK.cjs → topology-CNw-wsmG.cjs} +6 -6
- package/dist/topology.cjs +6 -6
- package/dist/topology.js +6 -6
- package/package.json +4 -1
- package/dist/Blueprint-BmbNUnGI.cjs +0 -1185
- package/dist/Blueprint-C-JJkkwL.js +0 -1186
- package/dist/curveFns-BhQECv8e.js +0 -180
- package/dist/faceFns-3PDjBeW7.js +0 -272
- package/dist/faceFns-CxaLWOjc.cjs +0 -271
- package/dist/loft-CVb-IjEI.cjs +0 -372
- package/dist/loft-DMFjK6lk.js +0 -373
- package/dist/measurement-CecYIt3s.cjs +0 -134
- package/dist/measurement-DHDLAH7-.js +0 -135
- package/dist/surfaceBuilders-CC0ZQGix.cjs +0 -289
- package/dist/surfaceBuilders-CrJtFu2a.js +0 -290
|
@@ -1,16 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
3
|
+
var __typeError = (msg) => {
|
|
4
|
+
throw TypeError(msg);
|
|
5
|
+
};
|
|
6
|
+
var __using = (stack, value, async) => {
|
|
7
|
+
if (value != null) {
|
|
8
|
+
if (typeof value !== "object" && typeof value !== "function") __typeError("Object expected");
|
|
9
|
+
var dispose, inner;
|
|
10
|
+
if (async) dispose = value[__knownSymbol("asyncDispose")];
|
|
11
|
+
if (dispose === void 0) {
|
|
12
|
+
dispose = value[__knownSymbol("dispose")];
|
|
13
|
+
if (async) inner = dispose;
|
|
14
|
+
}
|
|
15
|
+
if (typeof dispose !== "function") __typeError("Object not disposable");
|
|
16
|
+
if (inner) dispose = function() {
|
|
17
|
+
try {
|
|
18
|
+
inner.call(this);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return Promise.reject(e);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
stack.push([async, dispose, value]);
|
|
24
|
+
} else if (async) {
|
|
25
|
+
stack.push([async]);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
var __callDispose = (stack, error, hasError) => {
|
|
30
|
+
var E = typeof SuppressedError === "function" ? SuppressedError : function(e, s, m, _) {
|
|
31
|
+
return _ = Error(m), _.name = "SuppressedError", _.error = e, _.suppressed = s, _;
|
|
32
|
+
};
|
|
33
|
+
var fail = (e) => error = hasError ? new E(e, error, "An error was suppressed during disposal") : (hasError = true, e);
|
|
34
|
+
var next = (it) => {
|
|
35
|
+
while (it = stack.pop()) {
|
|
36
|
+
try {
|
|
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
|
+
} catch (e) {
|
|
40
|
+
fail(e);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (hasError) throw error;
|
|
44
|
+
};
|
|
45
|
+
return next();
|
|
46
|
+
};
|
|
2
47
|
const vectors = require("./vectors-CGLqemPY.cjs");
|
|
3
48
|
const errors = require("./errors-NNmTtM5u.cjs");
|
|
4
|
-
const faceFns = require("./faceFns-
|
|
49
|
+
const faceFns = require("./faceFns-DNQss51F.cjs");
|
|
5
50
|
const occtBoundary = require("./occtBoundary-Cqfsau2c.cjs");
|
|
6
51
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
7
|
-
const loft = require("./loft-
|
|
8
|
-
const shapeTypes = require("./shapeTypes-
|
|
9
|
-
const curveFns = require("./curveFns-
|
|
10
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
52
|
+
const loft = require("./loft-CjEEqz2P.cjs");
|
|
53
|
+
const shapeTypes = require("./shapeTypes-CWuX602K.cjs");
|
|
54
|
+
const curveFns = require("./curveFns-BsAHC3Qv.cjs");
|
|
55
|
+
const surfaceBuilders = require("./surfaceBuilders-CLal3WlK.cjs");
|
|
11
56
|
const result = require("./result.cjs");
|
|
12
|
-
const helpers = require("./helpers-
|
|
13
|
-
const Blueprint = require("./Blueprint-
|
|
57
|
+
const helpers = require("./helpers-aylLv0_I.cjs");
|
|
58
|
+
const Blueprint = require("./Blueprint-BmFJ4caY.cjs");
|
|
14
59
|
function* pointsIteration(intersector) {
|
|
15
60
|
const nPoints = intersector.NbPoints();
|
|
16
61
|
if (!nPoints) return;
|
|
@@ -20,56 +65,77 @@ function* pointsIteration(intersector) {
|
|
|
20
65
|
}
|
|
21
66
|
}
|
|
22
67
|
function* commonSegmentsIteration(intersector) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
68
|
+
var _stack = [];
|
|
69
|
+
try {
|
|
70
|
+
const nSegments = intersector.NbSegments();
|
|
71
|
+
if (!nSegments) return;
|
|
72
|
+
const oc = occtBoundary.getKernel().oc;
|
|
73
|
+
const scope = __using(_stack, new shapeTypes.DisposalScope());
|
|
74
|
+
for (let i = 1; i <= nSegments; i++) {
|
|
75
|
+
const h1 = new oc.Handle_Geom2d_Curve_1();
|
|
76
|
+
const h2 = scope.register(new oc.Handle_Geom2d_Curve_1());
|
|
77
|
+
try {
|
|
78
|
+
intersector.Segment(i, h1, h2);
|
|
79
|
+
} catch {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
yield new Blueprint.Curve2D(h1);
|
|
34
83
|
}
|
|
35
|
-
|
|
84
|
+
} catch (_) {
|
|
85
|
+
var _error = _, _hasError = true;
|
|
86
|
+
} finally {
|
|
87
|
+
__callDispose(_stack, _error, _hasError);
|
|
36
88
|
}
|
|
37
89
|
}
|
|
38
90
|
const intersectCurves = (first, second, precision = 1e-9) => {
|
|
39
|
-
|
|
40
|
-
return errors.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
|
|
41
|
-
const oc = occtBoundary.getKernel().oc;
|
|
42
|
-
const r = shapeTypes.gcWithScope();
|
|
43
|
-
const intersector = r(new oc.Geom2dAPI_InterCurveCurve_1());
|
|
44
|
-
let intersections;
|
|
45
|
-
let commonSegments;
|
|
91
|
+
var _stack = [];
|
|
46
92
|
try {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
93
|
+
if (first.boundingBox.isOut(second.boundingBox))
|
|
94
|
+
return errors.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
|
|
95
|
+
const oc = occtBoundary.getKernel().oc;
|
|
96
|
+
const scope = __using(_stack, new shapeTypes.DisposalScope());
|
|
97
|
+
const intersector = scope.register(new oc.Geom2dAPI_InterCurveCurve_1());
|
|
98
|
+
let intersections;
|
|
99
|
+
let commonSegments;
|
|
100
|
+
try {
|
|
101
|
+
intersector.Init_1(first.wrapped, second.wrapped, precision);
|
|
102
|
+
intersections = Array.from(pointsIteration(intersector));
|
|
103
|
+
commonSegments = Array.from(commonSegmentsIteration(intersector));
|
|
104
|
+
} catch (e) {
|
|
105
|
+
return errors.err(errors.computationError("INTERSECTION_FAILED", "Intersections failed between curves", e));
|
|
106
|
+
}
|
|
107
|
+
const segmentsAsPoints = commonSegments.filter((c) => helpers.samePoint(c.firstPoint, c.lastPoint, precision)).map((c) => c.firstPoint);
|
|
108
|
+
if (segmentsAsPoints.length) {
|
|
109
|
+
intersections.push(...segmentsAsPoints);
|
|
110
|
+
commonSegments = commonSegments.filter((c) => !helpers.samePoint(c.firstPoint, c.lastPoint, precision));
|
|
111
|
+
}
|
|
112
|
+
const commonSegmentsPoints = commonSegments.flatMap((c) => [c.firstPoint, c.lastPoint]);
|
|
113
|
+
return errors.ok({ intersections, commonSegments, commonSegmentsPoints });
|
|
114
|
+
} catch (_) {
|
|
115
|
+
var _error = _, _hasError = true;
|
|
116
|
+
} finally {
|
|
117
|
+
__callDispose(_stack, _error, _hasError);
|
|
118
|
+
}
|
|
60
119
|
};
|
|
61
120
|
const selfIntersections = (curve, precision = 1e-9) => {
|
|
62
|
-
|
|
63
|
-
const r = shapeTypes.gcWithScope();
|
|
64
|
-
const intersector = r(new oc.Geom2dAPI_InterCurveCurve_1());
|
|
65
|
-
let intersections;
|
|
121
|
+
var _stack = [];
|
|
66
122
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
123
|
+
const oc = occtBoundary.getKernel().oc;
|
|
124
|
+
const scope = __using(_stack, new shapeTypes.DisposalScope());
|
|
125
|
+
const intersector = scope.register(new oc.Geom2dAPI_InterCurveCurve_1());
|
|
126
|
+
let intersections;
|
|
127
|
+
try {
|
|
128
|
+
intersector.Init_1(curve.wrapped, curve.wrapped, precision);
|
|
129
|
+
intersections = Array.from(pointsIteration(intersector));
|
|
130
|
+
} catch (e) {
|
|
131
|
+
return errors.err(errors.computationError("SELF_INTERSECTION_FAILED", "Self intersection failed", e));
|
|
132
|
+
}
|
|
133
|
+
return errors.ok(intersections);
|
|
134
|
+
} catch (_) {
|
|
135
|
+
var _error = _, _hasError = true;
|
|
136
|
+
} finally {
|
|
137
|
+
__callDispose(_stack, _error, _hasError);
|
|
71
138
|
}
|
|
72
|
-
return errors.ok(intersections);
|
|
73
139
|
};
|
|
74
140
|
const offsetEndPoints = (firstPoint, lastPoint, offset) => {
|
|
75
141
|
const tangent = helpers.normalize2d(helpers.subtract2d(lastPoint, firstPoint));
|
|
@@ -81,58 +147,65 @@ const offsetEndPoints = (firstPoint, lastPoint, offset) => {
|
|
|
81
147
|
};
|
|
82
148
|
};
|
|
83
149
|
const make2dOffset = (curve, offset) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
150
|
+
var _stack = [];
|
|
151
|
+
try {
|
|
152
|
+
const scope = __using(_stack, new shapeTypes.DisposalScope());
|
|
153
|
+
const curveType = curve.geomType;
|
|
154
|
+
if (curveType === "CIRCLE") {
|
|
155
|
+
const circle = scope.register(scope.register(curve.adaptor()).Circle());
|
|
156
|
+
const radius = circle.Radius();
|
|
157
|
+
const orientationCorrection = circle.IsDirect() ? 1 : -1;
|
|
158
|
+
const orientedOffset = offset * orientationCorrection;
|
|
159
|
+
const newRadius = Number(radius) + orientedOffset;
|
|
160
|
+
if (newRadius < 1e-10) {
|
|
161
|
+
const centerPos = scope.register(circle.Location());
|
|
162
|
+
const center = [centerPos.X(), centerPos.Y()];
|
|
163
|
+
const offsetViaCenter = (point) => {
|
|
164
|
+
const [x, y] = helpers.normalize2d(helpers.subtract2d(point, center));
|
|
165
|
+
return helpers.add2d(point, [orientedOffset * x, orientedOffset * y]);
|
|
166
|
+
};
|
|
167
|
+
return {
|
|
168
|
+
collapsed: true,
|
|
169
|
+
firstPoint: offsetViaCenter(curve.firstPoint),
|
|
170
|
+
lastPoint: offsetViaCenter(curve.lastPoint)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const oc2 = occtBoundary.getKernel().oc;
|
|
174
|
+
const newCircle = new oc2.gp_Circ2d_3(circle.Axis(), newRadius);
|
|
175
|
+
const newInnerCurve = new oc2.Geom2d_Circle_1(newCircle);
|
|
176
|
+
newCircle.delete();
|
|
177
|
+
const newCurve = new oc2.Geom2d_TrimmedCurve(
|
|
178
|
+
new oc2.Handle_Geom2d_Curve_2(newInnerCurve),
|
|
179
|
+
curve.firstParameter,
|
|
180
|
+
curve.lastParameter,
|
|
181
|
+
true,
|
|
182
|
+
true
|
|
183
|
+
);
|
|
184
|
+
return new Blueprint.Curve2D(new oc2.Handle_Geom2d_Curve_2(newCurve));
|
|
185
|
+
}
|
|
186
|
+
if (curveType === "LINE") {
|
|
187
|
+
const { firstPoint, lastPoint } = offsetEndPoints(curve.firstPoint, curve.lastPoint, offset);
|
|
188
|
+
return Blueprint.make2dSegmentCurve(firstPoint, lastPoint);
|
|
189
|
+
}
|
|
190
|
+
const oc = occtBoundary.getKernel().oc;
|
|
191
|
+
const offsetCurve = new Blueprint.Curve2D(
|
|
192
|
+
new oc.Handle_Geom2d_Curve_2(new oc.Geom2d_OffsetCurve(curve.wrapped, offset, true))
|
|
193
|
+
);
|
|
194
|
+
const approximation = Blueprint.approximateAsBSpline(offsetCurve.adaptor());
|
|
195
|
+
const selfIntersects = errors.unwrap(selfIntersections(approximation));
|
|
196
|
+
if (selfIntersects.length) {
|
|
99
197
|
return {
|
|
100
198
|
collapsed: true,
|
|
101
|
-
firstPoint:
|
|
102
|
-
lastPoint:
|
|
199
|
+
firstPoint: approximation.firstPoint,
|
|
200
|
+
lastPoint: approximation.lastPoint
|
|
103
201
|
};
|
|
104
202
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
new oc2.Handle_Geom2d_Curve_2(newInnerCurve),
|
|
111
|
-
curve.firstParameter,
|
|
112
|
-
curve.lastParameter,
|
|
113
|
-
true,
|
|
114
|
-
true
|
|
115
|
-
);
|
|
116
|
-
return new Blueprint.Curve2D(new oc2.Handle_Geom2d_Curve_2(newCurve));
|
|
117
|
-
}
|
|
118
|
-
if (curveType === "LINE") {
|
|
119
|
-
const { firstPoint, lastPoint } = offsetEndPoints(curve.firstPoint, curve.lastPoint, offset);
|
|
120
|
-
return Blueprint.make2dSegmentCurve(firstPoint, lastPoint);
|
|
121
|
-
}
|
|
122
|
-
const oc = occtBoundary.getKernel().oc;
|
|
123
|
-
const offsetCurve = new Blueprint.Curve2D(
|
|
124
|
-
new oc.Handle_Geom2d_Curve_2(new oc.Geom2d_OffsetCurve(curve.wrapped, offset, true))
|
|
125
|
-
);
|
|
126
|
-
const approximation = Blueprint.approximateAsBSpline(offsetCurve.adaptor());
|
|
127
|
-
const selfIntersects = errors.unwrap(selfIntersections(approximation));
|
|
128
|
-
if (selfIntersects.length) {
|
|
129
|
-
return {
|
|
130
|
-
collapsed: true,
|
|
131
|
-
firstPoint: approximation.firstPoint,
|
|
132
|
-
lastPoint: approximation.lastPoint
|
|
133
|
-
};
|
|
203
|
+
return approximation;
|
|
204
|
+
} catch (_) {
|
|
205
|
+
var _error = _, _hasError = true;
|
|
206
|
+
} finally {
|
|
207
|
+
__callDispose(_stack, _error, _hasError);
|
|
134
208
|
}
|
|
135
|
-
return approximation;
|
|
136
209
|
};
|
|
137
210
|
function removeCorner(firstCurve, secondCurve, radius) {
|
|
138
211
|
const sinAngle = helpers.crossProduct2d(firstCurve.tangentAt(1), secondCurve.tangentAt(0));
|
|
@@ -1037,7 +1110,6 @@ class Sketch {
|
|
|
1037
1110
|
twistAngle,
|
|
1038
1111
|
origin
|
|
1039
1112
|
} = {}) {
|
|
1040
|
-
const gc = shapeTypes.localGC()[1];
|
|
1041
1113
|
const direction = extrusionDirection ? occtBoundary.toVec3(extrusionDirection) : this.defaultDirection;
|
|
1042
1114
|
const extrusionVec = vecOps.vecScale(vecOps.vecNormalize(direction), extrusionDistance);
|
|
1043
1115
|
const originVec = origin ? occtBoundary.toVec3(origin) : this.defaultOrigin;
|
|
@@ -1045,7 +1117,6 @@ class Sketch {
|
|
|
1045
1117
|
const solid2 = errors.unwrap(
|
|
1046
1118
|
loft.complexExtrude(this.wire, [...originVec], [...extrusionVec], extrusionProfile)
|
|
1047
1119
|
);
|
|
1048
|
-
gc();
|
|
1049
1120
|
this.delete();
|
|
1050
1121
|
return solid2;
|
|
1051
1122
|
}
|
|
@@ -1053,13 +1124,11 @@ class Sketch {
|
|
|
1053
1124
|
const solid2 = errors.unwrap(
|
|
1054
1125
|
loft.twistExtrude(this.wire, twistAngle, [...originVec], [...extrusionVec], extrusionProfile)
|
|
1055
1126
|
);
|
|
1056
|
-
gc();
|
|
1057
1127
|
this.delete();
|
|
1058
1128
|
return solid2;
|
|
1059
1129
|
}
|
|
1060
1130
|
const face = errors.unwrap(surfaceBuilders.makeFace(this.wire));
|
|
1061
1131
|
const solid = loft.basicFaceExtrusion(face, [...extrusionVec]);
|
|
1062
|
-
gc();
|
|
1063
1132
|
this.delete();
|
|
1064
1133
|
return solid;
|
|
1065
1134
|
}
|
|
@@ -1649,38 +1718,54 @@ class FaceSketcher extends BaseSketcher2d {
|
|
|
1649
1718
|
* @ignore
|
|
1650
1719
|
*/
|
|
1651
1720
|
buildWire() {
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1721
|
+
var _stack = [];
|
|
1722
|
+
try {
|
|
1723
|
+
const scope = __using(_stack, new shapeTypes.DisposalScope());
|
|
1724
|
+
const oc = occtBoundary.getKernel().oc;
|
|
1725
|
+
const geomSurf = scope.register(this._adaptSurface());
|
|
1726
|
+
const edges = this.pendingCurves.map((curve) => {
|
|
1727
|
+
return scope.register(
|
|
1728
|
+
shapeTypes.createEdge(
|
|
1729
|
+
scope.register(new oc.BRepBuilderAPI_MakeEdge_30(curve.wrapped, geomSurf)).Edge()
|
|
1730
|
+
)
|
|
1731
|
+
);
|
|
1732
|
+
});
|
|
1733
|
+
const wire = errors.unwrap(surfaceBuilders.assembleWire(edges));
|
|
1734
|
+
oc.BRepLib.BuildCurves3d_2(wire.wrapped);
|
|
1735
|
+
return wire;
|
|
1736
|
+
} catch (_) {
|
|
1737
|
+
var _error = _, _hasError = true;
|
|
1738
|
+
} finally {
|
|
1739
|
+
__callDispose(_stack, _error, _hasError);
|
|
1740
|
+
}
|
|
1662
1741
|
}
|
|
1663
1742
|
/** Finish drawing and return the resulting {@link Sketch} (does not close the path). */
|
|
1664
1743
|
done() {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1744
|
+
var _stack = [];
|
|
1745
|
+
try {
|
|
1746
|
+
const scope = __using(_stack, new shapeTypes.DisposalScope());
|
|
1747
|
+
const wire = this.buildWire();
|
|
1748
|
+
const sketch = new Sketch(wire);
|
|
1749
|
+
if (curveFns.curveIsClosed(wire)) {
|
|
1750
|
+
const face = scope.register(sketch.clone().face());
|
|
1751
|
+
const origin = faceFns.pointOnSurface(face, 0.5, 0.5);
|
|
1752
|
+
const normal = faceFns.normalAt(face);
|
|
1753
|
+
const direction = vecOps.vecScale(normal, -1);
|
|
1754
|
+
sketch.defaultOrigin = [origin[0], origin[1], origin[2]];
|
|
1755
|
+
sketch.defaultDirection = [direction[0], direction[1], direction[2]];
|
|
1756
|
+
} else {
|
|
1757
|
+
const startPoint = curveFns.curveStartPoint(wire);
|
|
1758
|
+
const normal = faceFns.normalAt(this.face, [startPoint[0], startPoint[1], startPoint[2]]);
|
|
1759
|
+
sketch.defaultOrigin = [startPoint[0], startPoint[1], startPoint[2]];
|
|
1760
|
+
sketch.defaultDirection = [normal[0], normal[1], normal[2]];
|
|
1761
|
+
}
|
|
1762
|
+
sketch.baseFace = this.face;
|
|
1763
|
+
return sketch;
|
|
1764
|
+
} catch (_) {
|
|
1765
|
+
var _error = _, _hasError = true;
|
|
1766
|
+
} finally {
|
|
1767
|
+
__callDispose(_stack, _error, _hasError);
|
|
1680
1768
|
}
|
|
1681
|
-
sketch.baseFace = this.face;
|
|
1682
|
-
gc();
|
|
1683
|
-
return sketch;
|
|
1684
1769
|
}
|
|
1685
1770
|
/** Close the path with a straight line to the start point and return the Sketch. */
|
|
1686
1771
|
close() {
|