brepjs 8.0.1 → 8.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2d/blueprints/booleanHelpers.d.ts +32 -0
- package/dist/2d/blueprints/booleanHelpers.d.ts.map +1 -0
- package/dist/2d/blueprints/booleanOperations.d.ts +5 -3
- package/dist/2d/blueprints/booleanOperations.d.ts.map +1 -1
- package/dist/2d/blueprints/intersectionSegments.d.ts +12 -0
- package/dist/2d/blueprints/intersectionSegments.d.ts.map +1 -0
- package/dist/2d/blueprints/segmentAssembly.d.ts +31 -0
- package/dist/2d/blueprints/segmentAssembly.d.ts.map +1 -0
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +8 -8
- package/dist/{Blueprint-D3JfGJTz.js → Blueprint-DnAO3gr5.js} +116 -30
- package/dist/{Blueprint-CVctc41Z.cjs → Blueprint-FxmMji4s.cjs} +110 -24
- package/dist/{boolean2D-hOw5Qay5.js → boolean2D-BnZKKBWU.js} +391 -310
- package/dist/{boolean2D-BdZATaHs.cjs → boolean2D-BrjHZfWn.cjs} +426 -345
- package/dist/{booleanFns-CqehfzcK.js → booleanFns-Ct3wDnhc.js} +14 -18
- package/dist/{booleanFns-BBSVKhL2.cjs → booleanFns-ND7sZvhu.cjs} +12 -16
- package/dist/brepjs.cjs +171 -101
- package/dist/brepjs.js +315 -244
- package/dist/{cast-DQaUibmm.js → cast-BEg1mN7n.js} +2 -2
- package/dist/{cast-DkB0GKmQ.cjs → cast-CqDc8oFW.cjs} +2 -2
- package/dist/core/disposal.d.ts +1 -1
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core.cjs +3 -3
- package/dist/core.js +3 -3
- package/dist/cornerFinder-89obDwGi.js +59 -0
- package/dist/cornerFinder-BKsCkrXd.cjs +58 -0
- package/dist/curveBuilders-BjtdNw1B.cjs +196 -0
- package/dist/curveBuilders-U26XDfxg.js +197 -0
- package/dist/curveFns-BoG_iA07.cjs +375 -0
- package/dist/curveFns-Cg99XKe2.js +376 -0
- package/dist/{drawFns-CUyx50gi.cjs → drawFns-C-MCkYj6.cjs} +60 -62
- package/dist/{drawFns-921SkhDL.js → drawFns-DJV-nOox.js} +12 -14
- package/dist/{faceFns-DHu-2JpA.js → faceFns-CyokaCDr.js} +3 -3
- package/dist/{faceFns-BwK7FP7N.cjs → faceFns-DcSCjDG0.cjs} +3 -3
- package/dist/helpers--iZxPeJg.cjs +203 -0
- package/dist/helpers-CRx_ks-u.js +204 -0
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/curveOps.d.ts.map +1 -1
- package/dist/kernel/meshOps.d.ts.map +1 -1
- package/dist/kernel/modifierOps.d.ts.map +1 -1
- package/dist/kernel/occtAdapter.d.ts +1 -0
- package/dist/kernel/occtAdapter.d.ts.map +1 -1
- package/dist/kernel/sweepOps.d.ts +8 -0
- package/dist/kernel/sweepOps.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +1 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/loft-8asn63t4.cjs +372 -0
- package/dist/loft-jIkZRqHm.js +373 -0
- package/dist/{measurement-C5JGCuUP.js → measurement-DWv8kK6J.js} +3 -3
- package/dist/{measurement-fxm_pW7x.cjs → measurement-lRLwaoqD.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-BhrZGi6w.cjs → meshFns-DWuLC3fk.cjs} +29 -9
- package/dist/{meshFns-AqAjTTVl.js → meshFns-DgAIL1B-.js} +29 -9
- package/dist/{occtBoundary-du8_ex-p.cjs → occtBoundary-DHtzU4tz.cjs} +93 -61
- package/dist/{occtBoundary-CwegMzqc.js → occtBoundary-DYsksDtE.js} +98 -66
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/extrudeUtils.d.ts +17 -0
- package/dist/operations/extrudeUtils.d.ts.map +1 -1
- package/dist/operations/patternFns.d.ts.map +1 -1
- package/dist/{operations-C1rWoba2.js → operations-B8FHVC22.js} +54 -9
- package/dist/{operations-BP1wVDw0.cjs → operations-CCFPvtd-.cjs} +54 -9
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +4 -4
- package/dist/query/cornerFinder.d.ts +48 -0
- package/dist/query/cornerFinder.d.ts.map +1 -0
- package/dist/query/directionUtils.d.ts +6 -0
- package/dist/query/directionUtils.d.ts.map +1 -0
- package/dist/query/edgeFinder.d.ts +15 -0
- package/dist/query/edgeFinder.d.ts.map +1 -0
- package/dist/query/faceFinder.d.ts +15 -0
- package/dist/query/faceFinder.d.ts.map +1 -0
- package/dist/query/finderCore.d.ts +35 -0
- package/dist/query/finderCore.d.ts.map +1 -0
- package/dist/query/finderFns.d.ts +21 -106
- package/dist/query/finderFns.d.ts.map +1 -1
- package/dist/query/shapeDistanceFilter.d.ts +11 -0
- package/dist/query/shapeDistanceFilter.d.ts.map +1 -0
- package/dist/query/vertexFinder.d.ts +16 -0
- package/dist/query/vertexFinder.d.ts.map +1 -0
- package/dist/query/wireFinder.d.ts +10 -0
- package/dist/query/wireFinder.d.ts.map +1 -0
- package/dist/query.cjs +42 -5
- package/dist/query.js +40 -2
- package/dist/{shapeTypes-DKhwEnUM.cjs → shapeTypes-b_lhwQB7.cjs} +24 -20
- package/dist/{shapeTypes-BlSElW8z.js → shapeTypes-i7VwMRwc.js} +32 -28
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching/Sketcher2d.d.ts +12 -4
- package/dist/sketching/Sketcher2d.d.ts.map +1 -1
- package/dist/sketching/ellipseUtils.d.ts +29 -0
- package/dist/sketching/ellipseUtils.d.ts.map +1 -0
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/curveBuilders.d.ts +75 -0
- package/dist/topology/curveBuilders.d.ts.map +1 -0
- package/dist/topology/curveFns.d.ts.map +1 -1
- package/dist/topology/meshFns.d.ts.map +1 -1
- package/dist/topology/primitiveFns.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/shapeHelpers.d.ts +6 -173
- package/dist/topology/shapeHelpers.d.ts.map +1 -1
- package/dist/topology/shapeUtils.d.ts +13 -0
- package/dist/topology/shapeUtils.d.ts.map +1 -0
- package/dist/topology/solidBuilders.d.ts +70 -0
- package/dist/topology/solidBuilders.d.ts.map +1 -0
- package/dist/topology/surfaceBuilders.d.ts +35 -0
- package/dist/topology/surfaceBuilders.d.ts.map +1 -0
- package/dist/topology/wrapperFns.d.ts +1 -0
- package/dist/topology/wrapperFns.d.ts.map +1 -1
- package/dist/{topology-tFzqSrGH.js → topology-Bh-aPIxA.js} +7 -8
- package/dist/{topology-CIooytHH.cjs → topology-ByOn_z3E.cjs} +12 -13
- package/dist/topology.cjs +33 -34
- package/dist/topology.js +54 -55
- package/dist/{vectors-CBuaMeZv.js → vectors-DWLjb9-P.js} +1 -1
- package/dist/{vectors-ChWEZPwy.cjs → vectors-aQBZK0Sb.cjs} +1 -1
- package/dist/vectors.cjs +2 -2
- package/dist/vectors.js +2 -2
- package/package.json +1 -1
- package/dist/curveFns-BilyYL_s.cjs +0 -190
- package/dist/curveFns-CdVE4da7.js +0 -191
- package/dist/loft-BzWFokmC.cjs +0 -178
- package/dist/loft-CtG5nMq5.js +0 -179
- package/dist/query-V6nV-VfL.js +0 -396
- package/dist/query-hMSmOWJP.cjs +0 -395
- package/dist/shapeFns-BrF97sKt.js +0 -204
- package/dist/shapeFns-BvOndshS.cjs +0 -203
- package/dist/shapeHelpers-B2SXz1p4.cjs +0 -488
- package/dist/shapeHelpers-BcoZf2N9.js +0 -489
package/dist/brepjs.cjs
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const occtBoundary = require("./occtBoundary-
|
|
3
|
+
const occtBoundary = require("./occtBoundary-DHtzU4tz.cjs");
|
|
4
4
|
const errors = require("./errors-DK1VAdP4.cjs");
|
|
5
|
-
const shapeTypes = require("./shapeTypes-
|
|
5
|
+
const shapeTypes = require("./shapeTypes-b_lhwQB7.cjs");
|
|
6
6
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
7
|
-
const Blueprint = require("./Blueprint-
|
|
8
|
-
const curveFns = require("./curveFns-
|
|
9
|
-
const loft$2 = require("./loft-
|
|
10
|
-
const operations = require("./operations-
|
|
11
|
-
const boolean2D = require("./boolean2D-
|
|
7
|
+
const Blueprint = require("./Blueprint-FxmMji4s.cjs");
|
|
8
|
+
const curveFns = require("./curveFns-BoG_iA07.cjs");
|
|
9
|
+
const loft$2 = require("./loft-8asn63t4.cjs");
|
|
10
|
+
const operations = require("./operations-CCFPvtd-.cjs");
|
|
11
|
+
const boolean2D = require("./boolean2D-BrjHZfWn.cjs");
|
|
12
12
|
const _2d = require("./2d.cjs");
|
|
13
|
-
const
|
|
13
|
+
const helpers = require("./helpers--iZxPeJg.cjs");
|
|
14
14
|
const io = require("./io.cjs");
|
|
15
|
-
const drawFns = require("./drawFns-
|
|
16
|
-
const vectors = require("./vectors-
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
15
|
+
const drawFns = require("./drawFns-C-MCkYj6.cjs");
|
|
16
|
+
const vectors = require("./vectors-aQBZK0Sb.cjs");
|
|
17
|
+
const topology = require("./topology-ByOn_z3E.cjs");
|
|
18
|
+
const faceFns = require("./faceFns-DcSCjDG0.cjs");
|
|
19
|
+
const meshFns = require("./meshFns-DWuLC3fk.cjs");
|
|
20
|
+
const booleanFns = require("./booleanFns-ND7sZvhu.cjs");
|
|
21
|
+
const measurement = require("./measurement-lRLwaoqD.cjs");
|
|
22
|
+
const curveBuilders = require("./curveBuilders-BjtdNw1B.cjs");
|
|
23
|
+
const cast = require("./cast-CqDc8oFW.cjs");
|
|
24
|
+
const query = require("./query.cjs");
|
|
25
25
|
const result = require("./result.cjs");
|
|
26
|
+
const cornerFinder = require("./cornerFinder-BKsCkrXd.cjs");
|
|
26
27
|
const worker = require("./worker.cjs");
|
|
27
28
|
const errorFactories = {
|
|
28
29
|
OCCT_OPERATION: (code, message, cause) => ({ kind: "OCCT_OPERATION", code, message, cause }),
|
|
@@ -70,6 +71,79 @@ function isFilletRadius(r) {
|
|
|
70
71
|
}
|
|
71
72
|
return false;
|
|
72
73
|
}
|
|
74
|
+
function buildWireFinder(filters) {
|
|
75
|
+
return helpers.createTypedFinder(
|
|
76
|
+
"wire",
|
|
77
|
+
filters,
|
|
78
|
+
buildWireFinder,
|
|
79
|
+
(_base, withFilter) => ({
|
|
80
|
+
isClosed: () => withFilter((wire2) => curveFns.curveIsClosed(wire2)),
|
|
81
|
+
isOpen: () => withFilter((wire2) => !curveFns.curveIsClosed(wire2)),
|
|
82
|
+
ofEdgeCount: (count) => withFilter((wire2) => {
|
|
83
|
+
let edgeCount = 0;
|
|
84
|
+
for (const _raw of cast.iterTopo(wire2.wrapped, "edge")) {
|
|
85
|
+
edgeCount++;
|
|
86
|
+
}
|
|
87
|
+
return edgeCount === count;
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function wireFinder() {
|
|
93
|
+
return buildWireFinder([]);
|
|
94
|
+
}
|
|
95
|
+
function withNearestPostFilter(baseFinder, nearestPoint) {
|
|
96
|
+
const findAllNearest = (shape2) => {
|
|
97
|
+
const candidates = baseFinder.findAll(shape2);
|
|
98
|
+
if (candidates.length === 0) return [];
|
|
99
|
+
let bestIdx = 0;
|
|
100
|
+
let bestDist = vecOps.vecDistance(curveFns.vertexPosition(candidates[0]), nearestPoint);
|
|
101
|
+
for (let i = 1; i < candidates.length; i++) {
|
|
102
|
+
const d = vecOps.vecDistance(curveFns.vertexPosition(candidates[i]), nearestPoint);
|
|
103
|
+
if (d < bestDist) {
|
|
104
|
+
bestDist = d;
|
|
105
|
+
bestIdx = i;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return [candidates[bestIdx]];
|
|
109
|
+
};
|
|
110
|
+
const findUniqueNearest = (shape2) => {
|
|
111
|
+
const nearest = findAllNearest(shape2);
|
|
112
|
+
if (nearest.length === 0) {
|
|
113
|
+
return errors.err(
|
|
114
|
+
errors.queryError("FINDER_NOT_UNIQUE", "Finder expected a unique match but found 0 element(s)")
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return errors.ok(nearest[0]);
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
...baseFinder,
|
|
121
|
+
findAll: findAllNearest,
|
|
122
|
+
findUnique: findUniqueNearest
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function buildVertexFinder(filters) {
|
|
126
|
+
return helpers.createTypedFinder(
|
|
127
|
+
"vertex",
|
|
128
|
+
filters,
|
|
129
|
+
buildVertexFinder,
|
|
130
|
+
(_base, withFilter) => ({
|
|
131
|
+
nearestTo: (point) => withNearestPostFilter(buildVertexFinder(filters), point),
|
|
132
|
+
atPosition: (point, tolerance = 1e-4) => withFilter((vertex2) => vecOps.vecDistance(curveFns.vertexPosition(vertex2), point) < tolerance),
|
|
133
|
+
withinBox: (min, max) => withFilter((vertex2) => {
|
|
134
|
+
const pos = curveFns.vertexPosition(vertex2);
|
|
135
|
+
return pos[0] >= min[0] - 1e-6 && pos[0] <= max[0] + 1e-6 && pos[1] >= min[1] - 1e-6 && pos[1] <= max[1] + 1e-6 && pos[2] >= min[2] - 1e-6 && pos[2] <= max[2] + 1e-6;
|
|
136
|
+
}),
|
|
137
|
+
atDistance: (distance, point = [0, 0, 0], tolerance = 1e-4) => withFilter((vertex2) => {
|
|
138
|
+
const pos = curveFns.vertexPosition(vertex2);
|
|
139
|
+
return Math.abs(vecOps.vecDistance(pos, point) - distance) < tolerance;
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
function vertexFinder() {
|
|
145
|
+
return buildVertexFinder([]);
|
|
146
|
+
}
|
|
73
147
|
function checkInterference(shape1, shape2, tolerance = 1e-6) {
|
|
74
148
|
if (shape1.wrapped.IsNull()) {
|
|
75
149
|
return errors.err(
|
|
@@ -118,78 +192,73 @@ function resolve3D(s) {
|
|
|
118
192
|
}
|
|
119
193
|
function box(width, depth, height, options) {
|
|
120
194
|
const oc = occtBoundary.getKernel().oc;
|
|
121
|
-
const
|
|
195
|
+
const r = shapeTypes.gcWithScope();
|
|
122
196
|
const maker = r(new oc.BRepPrimAPI_MakeBox_2(width, depth, height));
|
|
123
|
-
|
|
124
|
-
gc();
|
|
197
|
+
const solid2 = shapeTypes.createSolid(maker.Solid());
|
|
125
198
|
const center = options?.at ?? (options?.centered ? [0, 0, 0] : void 0);
|
|
126
199
|
if (center) {
|
|
127
|
-
|
|
128
|
-
center[0] - width / 2,
|
|
129
|
-
center[1] - depth / 2,
|
|
130
|
-
center[2] - height / 2
|
|
131
|
-
]);
|
|
200
|
+
return curveFns.translate(solid2, [center[0] - width / 2, center[1] - depth / 2, center[2] - height / 2]);
|
|
132
201
|
}
|
|
133
202
|
return solid2;
|
|
134
203
|
}
|
|
135
204
|
function cylinder(radius, height, options) {
|
|
136
205
|
const at = options?.at ?? [0, 0, 0];
|
|
137
206
|
const axis = options?.axis ?? [0, 0, 1];
|
|
138
|
-
let solid2 =
|
|
207
|
+
let solid2 = loft$2.makeCylinder(radius, height, at, axis);
|
|
139
208
|
if (options?.centered) {
|
|
140
209
|
const halfShift = [
|
|
141
210
|
-axis[0] * height * 0.5,
|
|
142
211
|
-axis[1] * height * 0.5,
|
|
143
212
|
-axis[2] * height * 0.5
|
|
144
213
|
];
|
|
145
|
-
solid2 =
|
|
214
|
+
solid2 = curveFns.translate(solid2, halfShift);
|
|
146
215
|
}
|
|
147
216
|
return solid2;
|
|
148
217
|
}
|
|
149
218
|
function sphere(radius, options) {
|
|
150
|
-
let solid2 =
|
|
219
|
+
let solid2 = loft$2.makeSphere(radius);
|
|
151
220
|
if (options?.at) {
|
|
152
|
-
solid2 =
|
|
221
|
+
solid2 = curveFns.translate(solid2, options.at);
|
|
153
222
|
}
|
|
154
223
|
return solid2;
|
|
155
224
|
}
|
|
156
225
|
function cone(bottomRadius, topRadius, height, options) {
|
|
157
226
|
const at = options?.at ?? [0, 0, 0];
|
|
158
227
|
const axis = options?.axis ?? [0, 0, 1];
|
|
159
|
-
let solid2 =
|
|
228
|
+
let solid2 = loft$2.makeCone(bottomRadius, topRadius, height, at, axis);
|
|
160
229
|
if (options?.centered) {
|
|
161
230
|
const halfShift = [
|
|
162
231
|
-axis[0] * height * 0.5,
|
|
163
232
|
-axis[1] * height * 0.5,
|
|
164
233
|
-axis[2] * height * 0.5
|
|
165
234
|
];
|
|
166
|
-
solid2 =
|
|
235
|
+
solid2 = curveFns.translate(solid2, halfShift);
|
|
167
236
|
}
|
|
168
237
|
return solid2;
|
|
169
238
|
}
|
|
170
239
|
function torus(majorRadius, minorRadius, options) {
|
|
171
|
-
return
|
|
240
|
+
return loft$2.makeTorus(majorRadius, minorRadius, options?.at ?? [0, 0, 0], options?.axis ?? [0, 0, 1]);
|
|
172
241
|
}
|
|
173
242
|
function ellipsoid(rx, ry, rz, options) {
|
|
174
|
-
let solid2 =
|
|
243
|
+
let solid2 = loft$2.makeEllipsoid(rx, ry, rz);
|
|
175
244
|
if (options?.at) {
|
|
176
|
-
solid2 =
|
|
245
|
+
solid2 = curveFns.translate(solid2, options.at);
|
|
177
246
|
}
|
|
178
247
|
return solid2;
|
|
179
248
|
}
|
|
180
249
|
function line(from, to) {
|
|
181
|
-
return
|
|
250
|
+
return curveBuilders.makeLine(from, to);
|
|
182
251
|
}
|
|
183
252
|
function circle(radius, options) {
|
|
184
253
|
const axisDir = options?.axis ?? [0, 0, 1];
|
|
185
|
-
return
|
|
254
|
+
return curveBuilders.makeCircle(radius, options?.at ?? [0, 0, 0], axisDir);
|
|
186
255
|
}
|
|
187
256
|
function ellipse(majorRadius, minorRadius, options) {
|
|
188
257
|
const axisDir = options?.axis ?? [0, 0, 1];
|
|
189
|
-
return
|
|
258
|
+
return curveBuilders.makeEllipse(majorRadius, minorRadius, options?.at ?? [0, 0, 0], axisDir, options?.xDir);
|
|
190
259
|
}
|
|
191
260
|
function helix(pitch, height, radius, options) {
|
|
192
|
-
return
|
|
261
|
+
return curveBuilders.makeHelix(
|
|
193
262
|
pitch,
|
|
194
263
|
height,
|
|
195
264
|
radius,
|
|
@@ -199,11 +268,11 @@ function helix(pitch, height, radius, options) {
|
|
|
199
268
|
);
|
|
200
269
|
}
|
|
201
270
|
function threePointArc(p1, p2, p3) {
|
|
202
|
-
return
|
|
271
|
+
return curveBuilders.makeThreePointArc(p1, p2, p3);
|
|
203
272
|
}
|
|
204
273
|
function ellipseArc(majorRadius, minorRadius, startAngle, endAngle, options) {
|
|
205
274
|
const axisDir = options?.axis ?? [0, 0, 1];
|
|
206
|
-
return
|
|
275
|
+
return curveBuilders.makeEllipseArc(
|
|
207
276
|
majorRadius,
|
|
208
277
|
minorRadius,
|
|
209
278
|
startAngle * vecOps.DEG2RAD,
|
|
@@ -214,46 +283,46 @@ function ellipseArc(majorRadius, minorRadius, startAngle, endAngle, options) {
|
|
|
214
283
|
);
|
|
215
284
|
}
|
|
216
285
|
function bsplineApprox(points, config) {
|
|
217
|
-
return
|
|
286
|
+
return curveBuilders.makeBSplineApproximation(points, config);
|
|
218
287
|
}
|
|
219
288
|
function bezier(points) {
|
|
220
|
-
return
|
|
289
|
+
return curveBuilders.makeBezierCurve(points);
|
|
221
290
|
}
|
|
222
291
|
function tangentArc(startPoint, startTgt, endPoint) {
|
|
223
|
-
return
|
|
292
|
+
return curveBuilders.makeTangentArc(startPoint, startTgt, endPoint);
|
|
224
293
|
}
|
|
225
294
|
function wire(listOfEdges) {
|
|
226
|
-
return
|
|
295
|
+
return curveBuilders.assembleWire(listOfEdges);
|
|
227
296
|
}
|
|
228
297
|
function face(w, holes) {
|
|
229
|
-
return
|
|
298
|
+
return Blueprint.makeFace(w, holes);
|
|
230
299
|
}
|
|
231
300
|
function filledFace(w) {
|
|
232
|
-
return
|
|
301
|
+
return Blueprint.makeNonPlanarFace(w);
|
|
233
302
|
}
|
|
234
303
|
function subFace(originFace, w) {
|
|
235
|
-
return
|
|
304
|
+
return Blueprint.makeNewFaceWithinFace(originFace, w);
|
|
236
305
|
}
|
|
237
306
|
function polygon(points) {
|
|
238
|
-
return
|
|
307
|
+
return Blueprint.makePolygon(points);
|
|
239
308
|
}
|
|
240
309
|
function vertex(point) {
|
|
241
|
-
return
|
|
310
|
+
return loft$2.makeVertex(point);
|
|
242
311
|
}
|
|
243
312
|
function compound(shapeArray) {
|
|
244
|
-
return
|
|
313
|
+
return loft$2.makeCompound(shapeArray);
|
|
245
314
|
}
|
|
246
315
|
function solid(facesOrShells) {
|
|
247
|
-
return
|
|
316
|
+
return loft$2.makeSolid(facesOrShells);
|
|
248
317
|
}
|
|
249
318
|
function offsetFace(f, distance, tolerance) {
|
|
250
|
-
return
|
|
319
|
+
return loft$2.makeOffset(f, distance, tolerance);
|
|
251
320
|
}
|
|
252
321
|
function sewShells(facesOrShells, ignoreType) {
|
|
253
|
-
return
|
|
322
|
+
return loft$2.weldShellsAndFaces(facesOrShells, ignoreType);
|
|
254
323
|
}
|
|
255
324
|
function addHoles(f, holes) {
|
|
256
|
-
return
|
|
325
|
+
return Blueprint.addHolesInFace(f, holes);
|
|
257
326
|
}
|
|
258
327
|
function validateNotNull(shape2, label) {
|
|
259
328
|
if (shape2.wrapped.IsNull()) {
|
|
@@ -295,7 +364,7 @@ function fillet$1(shape2, edges, radius) {
|
|
|
295
364
|
)
|
|
296
365
|
);
|
|
297
366
|
}
|
|
298
|
-
const selectedEdges = edges ??
|
|
367
|
+
const selectedEdges = edges ?? curveFns.getEdges(shape2);
|
|
299
368
|
if (selectedEdges.length === 0) {
|
|
300
369
|
return errors.err(
|
|
301
370
|
errors.validationError(
|
|
@@ -362,7 +431,7 @@ function chamfer$1(shape2, edges, distance) {
|
|
|
362
431
|
)
|
|
363
432
|
);
|
|
364
433
|
}
|
|
365
|
-
const selectedEdges = edges ??
|
|
434
|
+
const selectedEdges = edges ?? curveFns.getEdges(shape2);
|
|
366
435
|
if (selectedEdges.length === 0) {
|
|
367
436
|
return errors.err(errors.validationError("NO_EDGES", "No edges found for chamfer"));
|
|
368
437
|
}
|
|
@@ -441,21 +510,21 @@ function offset$1(shape2, distance, tolerance = 1e-6) {
|
|
|
441
510
|
);
|
|
442
511
|
}
|
|
443
512
|
function translate(shape2, v) {
|
|
444
|
-
return
|
|
513
|
+
return curveFns.translate(resolve(shape2), v);
|
|
445
514
|
}
|
|
446
515
|
function rotate(shape2, angle, options) {
|
|
447
516
|
const pivotPoint = options?.at;
|
|
448
|
-
return
|
|
517
|
+
return curveFns.rotate(resolve(shape2), angle, pivotPoint, options?.axis);
|
|
449
518
|
}
|
|
450
519
|
function mirror(shape2, options) {
|
|
451
520
|
const planeOrigin = options?.at;
|
|
452
|
-
return
|
|
521
|
+
return curveFns.mirror(resolve(shape2), options?.normal ?? [1, 0, 0], planeOrigin);
|
|
453
522
|
}
|
|
454
523
|
function scale(shape2, factor, options) {
|
|
455
|
-
return
|
|
524
|
+
return curveFns.scale(resolve(shape2), factor, options?.center);
|
|
456
525
|
}
|
|
457
526
|
function clone(shape2) {
|
|
458
|
-
return
|
|
527
|
+
return curveFns.clone(resolve(shape2));
|
|
459
528
|
}
|
|
460
529
|
function fuse(a, b, options) {
|
|
461
530
|
return booleanFns.fuse(resolve(a), resolve(b), options);
|
|
@@ -489,7 +558,7 @@ function resolveFaces(facesOrFn, shape2) {
|
|
|
489
558
|
if (typeof facesOrFn === "object" && "findAll" in facesOrFn) {
|
|
490
559
|
return facesOrFn.findAll(shape2);
|
|
491
560
|
}
|
|
492
|
-
const finder = facesOrFn(
|
|
561
|
+
const finder = facesOrFn(helpers.faceFinder());
|
|
493
562
|
return finder.findAll(shape2);
|
|
494
563
|
}
|
|
495
564
|
function normalizeFilletRadius(radius) {
|
|
@@ -538,7 +607,7 @@ function chamfer(shape2, edgesOrDistance, maybeDistance) {
|
|
|
538
607
|
}
|
|
539
608
|
const normalized = normalizeChamferDistance(distance);
|
|
540
609
|
if (normalized.mode === "distAngle") {
|
|
541
|
-
const selectedEdges = edges ??
|
|
610
|
+
const selectedEdges = edges ?? curveFns.getEdges(s);
|
|
542
611
|
return topology.chamferDistAngle(
|
|
543
612
|
s,
|
|
544
613
|
[...selectedEdges],
|
|
@@ -563,7 +632,7 @@ function heal(shape2) {
|
|
|
563
632
|
return topology.heal(resolve(shape2));
|
|
564
633
|
}
|
|
565
634
|
function simplify(shape2) {
|
|
566
|
-
return
|
|
635
|
+
return curveFns.simplify(resolve(shape2));
|
|
567
636
|
}
|
|
568
637
|
function mesh(shape2, options) {
|
|
569
638
|
return meshFns.mesh(resolve(shape2), options);
|
|
@@ -572,10 +641,10 @@ function meshEdges(shape2, options) {
|
|
|
572
641
|
return meshFns.meshEdges(resolve(shape2), options);
|
|
573
642
|
}
|
|
574
643
|
function describe(shape2) {
|
|
575
|
-
return
|
|
644
|
+
return curveFns.describe(resolve(shape2));
|
|
576
645
|
}
|
|
577
646
|
function toBREP(shape2) {
|
|
578
|
-
return
|
|
647
|
+
return curveFns.toBREP(resolve(shape2));
|
|
579
648
|
}
|
|
580
649
|
function fromBREP(data) {
|
|
581
650
|
return cast.fromBREP(data);
|
|
@@ -584,7 +653,7 @@ function isValid(shape2) {
|
|
|
584
653
|
return topology.isValid(resolve(shape2));
|
|
585
654
|
}
|
|
586
655
|
function isEmpty(shape2) {
|
|
587
|
-
return
|
|
656
|
+
return curveFns.isEmpty(resolve(shape2));
|
|
588
657
|
}
|
|
589
658
|
function loft$1(wires, { ruled = true, startPoint, endPoint } = {}, returnShell = false) {
|
|
590
659
|
if (wires.length === 0 && !startPoint && !endPoint) {
|
|
@@ -637,7 +706,7 @@ function loft(wires, options) {
|
|
|
637
706
|
}
|
|
638
707
|
function resolveTargetFace(shape2, faceSpec) {
|
|
639
708
|
if (faceSpec === void 0) {
|
|
640
|
-
const faces =
|
|
709
|
+
const faces = curveFns.getFaces(shape2);
|
|
641
710
|
if (faces.length === 0) {
|
|
642
711
|
throw new Error("compoundOps: shape has no faces");
|
|
643
712
|
}
|
|
@@ -654,7 +723,7 @@ function resolveTargetFace(shape2, faceSpec) {
|
|
|
654
723
|
return best;
|
|
655
724
|
}
|
|
656
725
|
if (typeof faceSpec === "function") {
|
|
657
|
-
const finder = faceSpec(
|
|
726
|
+
const finder = faceSpec(helpers.faceFinder());
|
|
658
727
|
const found = finder.findAll(shape2);
|
|
659
728
|
if (found.length === 0) {
|
|
660
729
|
throw new Error("compoundOps: face finder matched no faces");
|
|
@@ -683,15 +752,15 @@ function drill(shape2, options) {
|
|
|
683
752
|
const pos = at.length === 2 ? [at[0], at[1], 0] : [at[0], at[1], at[2]];
|
|
684
753
|
let depth = options.depth;
|
|
685
754
|
if (depth === void 0) {
|
|
686
|
-
const b =
|
|
755
|
+
const b = curveFns.getBounds(s);
|
|
687
756
|
const dx = b.xMax - b.xMin;
|
|
688
757
|
const dy = b.yMax - b.yMin;
|
|
689
758
|
const dz = b.zMax - b.zMin;
|
|
690
759
|
depth = Math.sqrt(dx * dx + dy * dy + dz * dz) + 1;
|
|
691
760
|
}
|
|
692
|
-
const cyl =
|
|
761
|
+
const cyl = loft$2.makeCylinder(radius, depth, pos, dir);
|
|
693
762
|
const startOffset = options.depth === void 0 ? vecOps.vecScale(dir, -depth / 2) : [0, 0, 0];
|
|
694
|
-
const tool = startOffset[0] !== 0 || startOffset[1] !== 0 || startOffset[2] !== 0 ?
|
|
763
|
+
const tool = startOffset[0] !== 0 || startOffset[1] !== 0 || startOffset[2] !== 0 ? curveFns.translate(cyl, startOffset) : cyl;
|
|
695
764
|
return booleanFns.cut(s, tool);
|
|
696
765
|
}
|
|
697
766
|
function pocket(shape2, options) {
|
|
@@ -703,7 +772,7 @@ function pocket(shape2, options) {
|
|
|
703
772
|
const targetFace = resolveTargetFace(s, options.face);
|
|
704
773
|
const normal = faceFns.normalAt(targetFace);
|
|
705
774
|
const w = toWire(profile);
|
|
706
|
-
const faceResult =
|
|
775
|
+
const faceResult = Blueprint.makeFace(w);
|
|
707
776
|
if (errors.isErr(faceResult)) return faceResult;
|
|
708
777
|
const extDir = vecOps.vecScale(vecOps.vecNormalize(normal), -depth);
|
|
709
778
|
const toolResult = operations.extrude(faceResult.value, extDir);
|
|
@@ -719,7 +788,7 @@ function boss(shape2, options) {
|
|
|
719
788
|
const targetFace = resolveTargetFace(s, options.face);
|
|
720
789
|
const normal = faceFns.normalAt(targetFace);
|
|
721
790
|
const w = toWire(profile);
|
|
722
|
-
const faceResult =
|
|
791
|
+
const faceResult = Blueprint.makeFace(w);
|
|
723
792
|
if (errors.isErr(faceResult)) return faceResult;
|
|
724
793
|
const extDir = vecOps.vecScale(vecOps.vecNormalize(normal), height);
|
|
725
794
|
const toolResult = operations.extrude(faceResult.value, extDir);
|
|
@@ -730,7 +799,7 @@ function mirrorJoin(shape2, options) {
|
|
|
730
799
|
const s = resolve(shape2);
|
|
731
800
|
const normal = options?.normal ?? [1, 0, 0];
|
|
732
801
|
const planeOrigin = options?.at;
|
|
733
|
-
const mirrored =
|
|
802
|
+
const mirrored = curveFns.mirror(s, normal, planeOrigin);
|
|
734
803
|
return booleanFns.fuse(s, mirrored);
|
|
735
804
|
}
|
|
736
805
|
function rectangularPattern(shape2, options) {
|
|
@@ -757,7 +826,7 @@ function rectangularPattern(shape2, options) {
|
|
|
757
826
|
xNorm[1] * xSpacing * xi + yNorm[1] * ySpacing * yi,
|
|
758
827
|
xNorm[2] * xSpacing * xi + yNorm[2] * ySpacing * yi
|
|
759
828
|
];
|
|
760
|
-
const copy =
|
|
829
|
+
const copy = curveFns.translate(s, offset2);
|
|
761
830
|
const fuseResult = booleanFns.fuse(result2, copy);
|
|
762
831
|
if (errors.isErr(fuseResult)) return fuseResult;
|
|
763
832
|
result2 = fuseResult.value;
|
|
@@ -806,7 +875,7 @@ function createWrappedBase(val) {
|
|
|
806
875
|
rotateX: (a) => wrapAny(rotate(val, a, { axis: [1, 0, 0] })),
|
|
807
876
|
rotateY: (a) => wrapAny(rotate(val, a, { axis: [0, 1, 0] })),
|
|
808
877
|
rotateZ: (a) => wrapAny(rotate(val, a, { axis: [0, 0, 1] })),
|
|
809
|
-
bounds: () =>
|
|
878
|
+
bounds: () => curveFns.getBounds(val),
|
|
810
879
|
describe: () => describe(val),
|
|
811
880
|
clone: () => wrapAny(clone(val)),
|
|
812
881
|
// Meshing & Rendering
|
|
@@ -834,6 +903,7 @@ function createWrapped3D(val) {
|
|
|
834
903
|
cut: (tool, opts) => wrap3D(unwrapOrThrow(cut(val, resolve(tool), opts))),
|
|
835
904
|
intersect: (tool, opts) => wrap3D(unwrapOrThrow(intersect(val, resolve(tool), opts))),
|
|
836
905
|
// Batch booleans
|
|
906
|
+
fuseAll: (tools, opts) => wrap3D(unwrapOrThrow(booleanFns.fuseAll([val, ...tools.map(resolve)], opts))),
|
|
837
907
|
cutAll: (tools, opts) => wrap3D(unwrapOrThrow(booleanFns.cutAll(val, tools, opts))),
|
|
838
908
|
// Boolean variants
|
|
839
909
|
section: (plane, opts) => wrapAny(unwrapOrThrow(section(val, plane, opts))),
|
|
@@ -866,10 +936,10 @@ function createWrapped3D(val) {
|
|
|
866
936
|
volumeProps: () => measurement.measureVolumeProps(val),
|
|
867
937
|
surfaceProps: () => measurement.measureSurfaceProps(val),
|
|
868
938
|
// Queries
|
|
869
|
-
edges: () =>
|
|
870
|
-
faces: () =>
|
|
871
|
-
wires: () =>
|
|
872
|
-
vertices: () =>
|
|
939
|
+
edges: () => curveFns.getEdges(val),
|
|
940
|
+
faces: () => curveFns.getFaces(val),
|
|
941
|
+
wires: () => curveFns.getWires(val),
|
|
942
|
+
vertices: () => curveFns.getVertices(val),
|
|
873
943
|
// Patterns
|
|
874
944
|
linearPattern: (dir, count, spacing) => wrap3D(unwrapOrThrow(operations.linearPattern(val, dir, count, spacing))),
|
|
875
945
|
circularPattern: (axis, count, angle) => wrap3D(unwrapOrThrow(operations.circularPattern(val, axis, count, angle)))
|
|
@@ -1029,10 +1099,23 @@ exports.curveStartPoint = curveFns.curveStartPoint;
|
|
|
1029
1099
|
exports.curveTangentAt = curveFns.curveTangentAt;
|
|
1030
1100
|
exports.findCurveType = curveFns.findCurveType;
|
|
1031
1101
|
exports.flipOrientation = curveFns.flipOrientation;
|
|
1102
|
+
exports.getBounds = curveFns.getBounds;
|
|
1032
1103
|
exports.getCurveType = curveFns.getCurveType;
|
|
1104
|
+
exports.getEdges = curveFns.getEdges;
|
|
1105
|
+
exports.getFaces = curveFns.getFaces;
|
|
1106
|
+
exports.getHashCode = curveFns.getHashCode;
|
|
1033
1107
|
exports.getOrientation = curveFns.getOrientation;
|
|
1108
|
+
exports.getVertices = curveFns.getVertices;
|
|
1109
|
+
exports.getWires = curveFns.getWires;
|
|
1034
1110
|
exports.interpolateCurve = curveFns.interpolateCurve;
|
|
1111
|
+
exports.isEqualShape = curveFns.isEqualShape;
|
|
1112
|
+
exports.isSameShape = curveFns.isSameShape;
|
|
1113
|
+
exports.iterEdges = curveFns.iterEdges;
|
|
1114
|
+
exports.iterFaces = curveFns.iterFaces;
|
|
1115
|
+
exports.iterVertices = curveFns.iterVertices;
|
|
1116
|
+
exports.iterWires = curveFns.iterWires;
|
|
1035
1117
|
exports.offsetWire2D = curveFns.offsetWire2D;
|
|
1118
|
+
exports.vertexPosition = curveFns.vertexPosition;
|
|
1036
1119
|
exports.basicFaceExtrusion = loft$2.basicFaceExtrusion;
|
|
1037
1120
|
exports.genericSweep = loft$2.genericSweep;
|
|
1038
1121
|
exports.revolution = loft$2.revolution;
|
|
@@ -1101,12 +1184,8 @@ exports.sketch2DOnPlane = _2d.sketch2DOnPlane;
|
|
|
1101
1184
|
exports.stretch2D = _2d.stretch2D;
|
|
1102
1185
|
exports.toSVGPathD = _2d.toSVGPathD;
|
|
1103
1186
|
exports.translate2D = _2d.translate2D;
|
|
1104
|
-
exports.
|
|
1105
|
-
exports.
|
|
1106
|
-
exports.faceFinder = query.faceFinder;
|
|
1107
|
-
exports.getSingleFace = query.getSingleFace;
|
|
1108
|
-
exports.vertexFinder = query.vertexFinder;
|
|
1109
|
-
exports.wireFinder = query.wireFinder;
|
|
1187
|
+
exports.faceFinder = helpers.faceFinder;
|
|
1188
|
+
exports.getSingleFace = helpers.getSingleFace;
|
|
1110
1189
|
exports.blueprintToDXF = io.blueprintToDXF;
|
|
1111
1190
|
exports.exportDXF = io.exportDXF;
|
|
1112
1191
|
exports.exportGlb = io.exportGlb;
|
|
@@ -1182,19 +1261,6 @@ exports.createPlane = vectors.createPlane;
|
|
|
1182
1261
|
exports.pivotPlane = vectors.pivotPlane;
|
|
1183
1262
|
exports.resolvePlane = vectors.resolvePlane;
|
|
1184
1263
|
exports.translatePlane = vectors.translatePlane;
|
|
1185
|
-
exports.getBounds = shapeFns.getBounds;
|
|
1186
|
-
exports.getEdges = shapeFns.getEdges;
|
|
1187
|
-
exports.getFaces = shapeFns.getFaces;
|
|
1188
|
-
exports.getHashCode = shapeFns.getHashCode;
|
|
1189
|
-
exports.getVertices = shapeFns.getVertices;
|
|
1190
|
-
exports.getWires = shapeFns.getWires;
|
|
1191
|
-
exports.isEqualShape = shapeFns.isEqualShape;
|
|
1192
|
-
exports.isSameShape = shapeFns.isSameShape;
|
|
1193
|
-
exports.iterEdges = shapeFns.iterEdges;
|
|
1194
|
-
exports.iterFaces = shapeFns.iterFaces;
|
|
1195
|
-
exports.iterVertices = shapeFns.iterVertices;
|
|
1196
|
-
exports.iterWires = shapeFns.iterWires;
|
|
1197
|
-
exports.vertexPosition = shapeFns.vertexPosition;
|
|
1198
1264
|
exports.adjacentFaces = topology.adjacentFaces;
|
|
1199
1265
|
exports.autoHeal = topology.autoHeal;
|
|
1200
1266
|
exports.chamferDistAngleShape = topology.chamferDistAngle;
|
|
@@ -1247,8 +1313,10 @@ exports.downcast = cast.downcast;
|
|
|
1247
1313
|
exports.isCompSolid = cast.isCompSolid;
|
|
1248
1314
|
exports.iterTopo = cast.iterTopo;
|
|
1249
1315
|
exports.shapeType = cast.shapeType;
|
|
1316
|
+
exports.edgeFinder = query.edgeFinder;
|
|
1250
1317
|
exports.BrepBugError = result.BrepBugError;
|
|
1251
1318
|
exports.bug = result.bug;
|
|
1319
|
+
exports.cornerFinder = cornerFinder.cornerFinder;
|
|
1252
1320
|
exports.createOperationRegistry = worker.createOperationRegistry;
|
|
1253
1321
|
exports.createTaskQueue = worker.createTaskQueue;
|
|
1254
1322
|
exports.createWorkerClient = worker.createWorkerClient;
|
|
@@ -1333,4 +1401,6 @@ exports.toBREP = toBREP;
|
|
|
1333
1401
|
exports.torus = torus;
|
|
1334
1402
|
exports.translate = translate;
|
|
1335
1403
|
exports.vertex = vertex;
|
|
1404
|
+
exports.vertexFinder = vertexFinder;
|
|
1336
1405
|
exports.wire = wire;
|
|
1406
|
+
exports.wireFinder = wireFinder;
|