brepjs 8.2.0 → 8.4.0
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/Curve2D.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/{Blueprint-D_luVeES.js → Blueprint-Bp45tnh0.js} +16 -12
- package/dist/{Blueprint-CTAwjJMN.cjs → Blueprint-zgFe_5Qj.cjs} +17 -13
- package/dist/{boolean2D-B5axNhjN.cjs → boolean2D-CfEbRMPF.cjs} +11 -11
- package/dist/{boolean2D-vw76Gayn.js → boolean2D-DN6ETTCq.js} +11 -11
- package/dist/{booleanFns-Yc3EBxdm.cjs → booleanFns-5dDG0jpA.cjs} +46 -9
- package/dist/{booleanFns-BhqXpQoZ.js → booleanFns-C-M6qqvB.js} +46 -9
- package/dist/brepjs.cjs +364 -109
- package/dist/brepjs.js +433 -177
- package/dist/{cast-C107o5ow.cjs → cast-CPNOTNFm.cjs} +3 -3
- package/dist/{cast-D0OhP1nV.js → cast-Cerqtxtb.js} +3 -3
- package/dist/core/errors.d.ts +7 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.js +4 -4
- package/dist/{cornerFinder-DuStF5jK.cjs → cornerFinder-BQ-_VJx0.cjs} +1 -1
- package/dist/{cornerFinder-CPm2baSJ.js → cornerFinder-CC_MunIh.js} +1 -1
- package/dist/{curveBuilders-CN72XaIQ.js → curveBuilders-BREwqvuc.js} +3 -3
- package/dist/{curveBuilders-Du03_Yyf.cjs → curveBuilders-BkEJ-RVn.cjs} +3 -3
- package/dist/curveFns-VMxgfkqw.cjs +177 -0
- package/dist/curveFns-ZuQUBZvd.js +178 -0
- package/dist/{drawFns-CzBbcoXA.js → drawFns-BbhX1IUq.js} +19 -15
- package/dist/{drawFns-CiNxPu6J.cjs → drawFns-CKaHgGSK.cjs} +22 -18
- package/dist/{errors-wGhcJMpB.js → errors-CSYOlCCR.js} +10 -1
- package/dist/{errors-DK1VAdP4.cjs → errors-D13q2HCk.cjs} +10 -1
- package/dist/{faceFns-ub3CugDN.js → faceFns-CfJIbHY3.js} +4 -4
- package/dist/{faceFns-D1Sqnlu6.cjs → faceFns-es3GENII.cjs} +4 -4
- package/dist/{helpers-Dje6wrKi.cjs → helpers-C0q_FVxq.cjs} +10 -10
- package/dist/{helpers-BSQfs538.js → helpers-CmVkMubc.js} +7 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +5 -5
- package/dist/io.js +5 -5
- package/dist/kernel/hullOps.d.ts +22 -0
- package/dist/kernel/hullOps.d.ts.map +1 -0
- package/dist/kernel/occtAdapter.d.ts +6 -0
- package/dist/kernel/occtAdapter.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +6 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-PMRx9iMG.cjs → loft-B-UCPW9P.cjs} +5 -5
- package/dist/{loft-BHn7GKm8.js → loft-oJq2OD3A.js} +5 -5
- package/dist/{measurement-B06hNs89.cjs → measurement-CYmT-C77.cjs} +3 -3
- package/dist/{measurement-BfhEneUl.js → measurement-Cf_SoIiR.js} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-BKSPaPXS.js → meshFns-CqNwW0PO.js} +6 -3
- package/dist/{meshFns-CFVxKBlE.cjs → meshFns-DDC_2U81.cjs} +6 -3
- package/dist/{occtBoundary-BFAaUtA7.cjs → occtBoundary-CocN2VKx.cjs} +419 -2
- package/dist/{occtBoundary-CoXB2xvx.js → occtBoundary-D_gjqgzo.js} +419 -2
- package/dist/{operations-CjQHEu1h.js → operations-6hdpuYmY.js} +6 -6
- package/dist/{operations-CdGb6IBU.cjs → operations-BQeW_DSM.cjs} +6 -6
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query.cjs +5 -5
- package/dist/query.js +6 -6
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{curveFns-ByeCqutv.cjs → shapeFns-B0zSdO9c.cjs} +98 -177
- package/dist/{curveFns-C5gSZ5EY.js → shapeFns-k1YHFwmB.js} +117 -196
- package/dist/{shapeTypes-UqVCIO_T.cjs → shapeTypes-BxVxLdiD.cjs} +1 -1
- package/dist/{shapeTypes-BU2LKv2S.js → shapeTypes-c-_pgYCx.js} +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/text/textBlueprints.d.ts.map +1 -1
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/hullFns.d.ts +16 -0
- package/dist/topology/hullFns.d.ts.map +1 -0
- package/dist/topology/meshFns.d.ts +1 -0
- package/dist/topology/meshFns.d.ts.map +1 -1
- package/dist/topology/minkowskiFns.d.ts +20 -0
- package/dist/topology/minkowskiFns.d.ts.map +1 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/shapeFns.d.ts +30 -0
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/{topology-D8Au8q4i.cjs → topology-CycEc6Oe.cjs} +14 -13
- package/dist/{topology-BFB3LI_y.js → topology-tMKHJgw2.js} +9 -8
- package/dist/topology.cjs +34 -33
- package/dist/topology.js +59 -58
- package/dist/{vectors-BhfKwL9J.js → vectors-DE0XriuQ.js} +2 -2
- package/dist/{vectors-t1XG4LpL.cjs → vectors-DVmHF4zt.cjs} +2 -2
- package/dist/vectors.cjs +2 -2
- package/dist/vectors.js +2 -2
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
3
|
-
const occtBoundary = require("./occtBoundary-
|
|
4
|
-
const errors = require("./errors-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
3
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
4
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
5
5
|
let _topoMap = null;
|
|
6
6
|
const asTopo = (entity) => {
|
|
7
7
|
if (!_topoMap) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as castShape, h as isShape3D$1, m as isWire$1 } from "./shapeTypes-
|
|
2
|
-
import { g as getKernel } from "./occtBoundary-
|
|
3
|
-
import { e as err, p as typeCastError, l as ok, a as andThen } from "./errors-
|
|
1
|
+
import { c as castShape, h as isShape3D$1, m as isWire$1 } from "./shapeTypes-c-_pgYCx.js";
|
|
2
|
+
import { g as getKernel } from "./occtBoundary-D_gjqgzo.js";
|
|
3
|
+
import { e as err, p as typeCastError, l as ok, a as andThen } from "./errors-CSYOlCCR.js";
|
|
4
4
|
let _topoMap = null;
|
|
5
5
|
const asTopo = (entity) => {
|
|
6
6
|
if (!_topoMap) {
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -74,6 +74,13 @@ export declare const BrepErrorCode: {
|
|
|
74
74
|
readonly INTERSECTION_FAILED: "INTERSECTION_FAILED";
|
|
75
75
|
readonly SELF_INTERSECTION_FAILED: "SELF_INTERSECTION_FAILED";
|
|
76
76
|
readonly FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE";
|
|
77
|
+
readonly HULL_EMPTY_INPUT: "HULL_EMPTY_INPUT";
|
|
78
|
+
readonly HULL_FAILED: "HULL_FAILED";
|
|
79
|
+
readonly HULL_DEGENERATE: "HULL_DEGENERATE";
|
|
80
|
+
readonly HULL_NOT_3D: "HULL_NOT_3D";
|
|
81
|
+
readonly MINKOWSKI_FAILED: "MINKOWSKI_FAILED";
|
|
82
|
+
readonly MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL";
|
|
83
|
+
readonly MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D";
|
|
77
84
|
};
|
|
78
85
|
/** Union of all known error code string literals. */
|
|
79
86
|
export type BrepErrorCode = (typeof BrepErrorCode)[keyof typeof BrepErrorCode];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAMpD,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GACrB,gBAAgB,GAChB,YAAY,GACZ,WAAW,GACX,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,IAAI,GACJ,OAAO,CAAC;AAMZ;;;;GAIG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"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"}
|
package/dist/core.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const occtBoundary = require("./occtBoundary-
|
|
3
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
4
4
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
5
|
-
const errors = require("./errors-
|
|
6
|
-
const vectors = require("./vectors-
|
|
7
|
-
const shapeTypes = require("./shapeTypes-
|
|
5
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
6
|
+
const vectors = require("./vectors-DVmHF4zt.cjs");
|
|
7
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
8
8
|
const result = require("./result.cjs");
|
|
9
9
|
exports.resolveDirection = occtBoundary.resolveDirection;
|
|
10
10
|
exports.toVec2 = occtBoundary.toVec2;
|
package/dist/core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r, t, a } from "./occtBoundary-
|
|
1
|
+
import { r, t, a } from "./occtBoundary-D_gjqgzo.js";
|
|
2
2
|
import { D, H, R, v, a as a2, b, c, d, e, f, g, h, i, j, k, l, m, n, o } from "./vecOps-ZDdZWbwT.js";
|
|
3
|
-
import { O, a as a3, c as c2, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, m as m2, h as h2, j as j2, k as k2, o as o2, l as l2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x } from "./errors-
|
|
4
|
-
import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-
|
|
5
|
-
import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, w as w2 } from "./shapeTypes-
|
|
3
|
+
import { O, a as a3, c as c2, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, m as m2, h as h2, j as j2, k as k2, o as o2, l as l2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x } from "./errors-CSYOlCCR.js";
|
|
4
|
+
import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-DE0XriuQ.js";
|
|
5
|
+
import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, w as w2 } from "./shapeTypes-c-_pgYCx.js";
|
|
6
6
|
import { BrepBugError, bug } from "./result.js";
|
|
7
7
|
export {
|
|
8
8
|
BrepBugError,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-
|
|
1
|
+
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-CmVkMubc.js";
|
|
2
2
|
import { D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
3
3
|
const PI_2 = 2 * Math.PI;
|
|
4
4
|
function positiveHalfAngle(angle) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getKernel, b as toOcPnt, c as toOcVec, m as makeOcAx2, d as makeOcAx3 } from "./occtBoundary-
|
|
2
|
-
import { d as isEdge, m as isWire, n as createWire, o as createEdge, p as gcWithScope } from "./shapeTypes-
|
|
3
|
-
import { e as err, o as occtError, l as ok, x as validationError } from "./errors-
|
|
1
|
+
import { g as getKernel, b as toOcPnt, c as toOcVec, m as makeOcAx2, d as makeOcAx3 } from "./occtBoundary-D_gjqgzo.js";
|
|
2
|
+
import { d as isEdge, m as isWire, n as createWire, o as createEdge, p as gcWithScope } from "./shapeTypes-c-_pgYCx.js";
|
|
3
|
+
import { e as err, o as occtError, l as ok, x as validationError } from "./errors-CSYOlCCR.js";
|
|
4
4
|
function makeLine(v1, v2) {
|
|
5
5
|
const oc = getKernel().oc;
|
|
6
6
|
const r = gcWithScope();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const occtBoundary = require("./occtBoundary-
|
|
3
|
-
const shapeTypes = require("./shapeTypes-
|
|
4
|
-
const errors = require("./errors-
|
|
2
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
3
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
4
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
5
5
|
function makeLine(v1, v2) {
|
|
6
6
|
const oc = occtBoundary.getKernel().oc;
|
|
7
7
|
const r = shapeTypes.gcWithScope();
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
3
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
4
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
5
|
+
let CURVE_TYPES_MAP = null;
|
|
6
|
+
const getCurveTypesMap = (refresh) => {
|
|
7
|
+
if (CURVE_TYPES_MAP && !refresh) return CURVE_TYPES_MAP;
|
|
8
|
+
const oc = occtBoundary.getKernel().oc;
|
|
9
|
+
const ga = oc.GeomAbs_CurveType;
|
|
10
|
+
CURVE_TYPES_MAP = /* @__PURE__ */ new Map([
|
|
11
|
+
[ga.GeomAbs_Line, "LINE"],
|
|
12
|
+
[ga.GeomAbs_Circle, "CIRCLE"],
|
|
13
|
+
[ga.GeomAbs_Ellipse, "ELLIPSE"],
|
|
14
|
+
[ga.GeomAbs_Hyperbola, "HYPERBOLA"],
|
|
15
|
+
[ga.GeomAbs_Parabola, "PARABOLA"],
|
|
16
|
+
[ga.GeomAbs_BezierCurve, "BEZIER_CURVE"],
|
|
17
|
+
[ga.GeomAbs_BSplineCurve, "BSPLINE_CURVE"],
|
|
18
|
+
[ga.GeomAbs_OffsetCurve, "OFFSET_CURVE"],
|
|
19
|
+
[ga.GeomAbs_OtherCurve, "OTHER_CURVE"]
|
|
20
|
+
]);
|
|
21
|
+
return CURVE_TYPES_MAP;
|
|
22
|
+
};
|
|
23
|
+
const findCurveType = (type) => {
|
|
24
|
+
let shapeType = getCurveTypesMap().get(type);
|
|
25
|
+
if (!shapeType) shapeType = getCurveTypesMap(true).get(type);
|
|
26
|
+
if (!shapeType) return errors.err(errors.typeCastError("UNKNOWN_CURVE_TYPE", "Unknown curve type"));
|
|
27
|
+
return errors.ok(shapeType);
|
|
28
|
+
};
|
|
29
|
+
function getAdaptor(shape) {
|
|
30
|
+
const oc = occtBoundary.getKernel().oc;
|
|
31
|
+
const st = shape.wrapped.ShapeType();
|
|
32
|
+
const e = oc.TopAbs_ShapeEnum;
|
|
33
|
+
if (st === e.TopAbs_WIRE) {
|
|
34
|
+
return new oc.BRepAdaptor_CompCurve_2(shape.wrapped, false);
|
|
35
|
+
}
|
|
36
|
+
return new oc.BRepAdaptor_Curve_2(shape.wrapped);
|
|
37
|
+
}
|
|
38
|
+
function mapParam(adaptor, t) {
|
|
39
|
+
const first = Number(adaptor.FirstParameter());
|
|
40
|
+
const last = Number(adaptor.LastParameter());
|
|
41
|
+
return first + (last - first) * t;
|
|
42
|
+
}
|
|
43
|
+
function getCurveType(shape) {
|
|
44
|
+
const r = shapeTypes.gcWithScope();
|
|
45
|
+
const adaptor = r(getAdaptor(shape));
|
|
46
|
+
const technicalType = adaptor.GetType && adaptor.GetType();
|
|
47
|
+
return errors.unwrap(findCurveType(technicalType));
|
|
48
|
+
}
|
|
49
|
+
function curveStartPoint(shape) {
|
|
50
|
+
const r = shapeTypes.gcWithScope();
|
|
51
|
+
const adaptor = r(getAdaptor(shape));
|
|
52
|
+
const pnt = r(adaptor.Value(adaptor.FirstParameter()));
|
|
53
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
54
|
+
}
|
|
55
|
+
function curveEndPoint(shape) {
|
|
56
|
+
const r = shapeTypes.gcWithScope();
|
|
57
|
+
const adaptor = r(getAdaptor(shape));
|
|
58
|
+
const pnt = r(adaptor.Value(adaptor.LastParameter()));
|
|
59
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
60
|
+
}
|
|
61
|
+
function curvePointAt(shape, position = 0.5) {
|
|
62
|
+
const r = shapeTypes.gcWithScope();
|
|
63
|
+
const adaptor = r(getAdaptor(shape));
|
|
64
|
+
const pnt = r(adaptor.Value(mapParam(adaptor, position)));
|
|
65
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
66
|
+
}
|
|
67
|
+
function curveTangentAt(shape, position = 0.5) {
|
|
68
|
+
const oc = occtBoundary.getKernel().oc;
|
|
69
|
+
const r = shapeTypes.gcWithScope();
|
|
70
|
+
const adaptor = r(getAdaptor(shape));
|
|
71
|
+
const param = mapParam(adaptor, position);
|
|
72
|
+
const tmpPnt = r(new oc.gp_Pnt_1());
|
|
73
|
+
const tmpVec = r(new oc.gp_Vec_1());
|
|
74
|
+
adaptor.D1(param, tmpPnt, tmpVec);
|
|
75
|
+
return [tmpVec.X(), tmpVec.Y(), tmpVec.Z()];
|
|
76
|
+
}
|
|
77
|
+
function curveLength(shape) {
|
|
78
|
+
const oc = occtBoundary.getKernel().oc;
|
|
79
|
+
const r = shapeTypes.gcWithScope();
|
|
80
|
+
const props = r(new oc.GProp_GProps_1());
|
|
81
|
+
oc.BRepGProp.LinearProperties(shape.wrapped, props, true, false);
|
|
82
|
+
return props.Mass();
|
|
83
|
+
}
|
|
84
|
+
function curveIsClosed(shape) {
|
|
85
|
+
const r = shapeTypes.gcWithScope();
|
|
86
|
+
const adaptor = r(getAdaptor(shape));
|
|
87
|
+
return adaptor.IsClosed();
|
|
88
|
+
}
|
|
89
|
+
function curveIsPeriodic(shape) {
|
|
90
|
+
const r = shapeTypes.gcWithScope();
|
|
91
|
+
const adaptor = r(getAdaptor(shape));
|
|
92
|
+
return adaptor.IsPeriodic();
|
|
93
|
+
}
|
|
94
|
+
function curvePeriod(shape) {
|
|
95
|
+
const adaptor = getAdaptor(shape);
|
|
96
|
+
const result = adaptor.Period();
|
|
97
|
+
adaptor.delete();
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
function getOrientation(shape) {
|
|
101
|
+
const oc = occtBoundary.getKernel().oc;
|
|
102
|
+
const orient = shape.wrapped.Orientation_1();
|
|
103
|
+
return orient === oc.TopAbs_Orientation.TopAbs_FORWARD ? "forward" : "backward";
|
|
104
|
+
}
|
|
105
|
+
function flipOrientation(shape) {
|
|
106
|
+
return shapeTypes.castShape(shape.wrapped.Reversed());
|
|
107
|
+
}
|
|
108
|
+
function interpolateCurve(points, options = {}) {
|
|
109
|
+
if (points.length < 2) {
|
|
110
|
+
return errors.err(errors.typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const result = occtBoundary.getKernel().interpolatePoints(points, options);
|
|
114
|
+
const cast = shapeTypes.castShape(result);
|
|
115
|
+
if (!shapeTypes.isEdge(cast)) {
|
|
116
|
+
return errors.err(errors.typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
|
|
117
|
+
}
|
|
118
|
+
return errors.ok(cast);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
return errors.err(
|
|
121
|
+
errors.typeCastError(
|
|
122
|
+
"INTERPOLATE_FAILED",
|
|
123
|
+
`Interpolation failed: ${e instanceof Error ? e.message : String(e)}`
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function approximateCurve(points, options = {}) {
|
|
129
|
+
if (points.length < 2) {
|
|
130
|
+
return errors.err(errors.typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
const result = occtBoundary.getKernel().approximatePoints(points, options);
|
|
134
|
+
const cast = shapeTypes.castShape(result);
|
|
135
|
+
if (!shapeTypes.isEdge(cast)) {
|
|
136
|
+
return errors.err(errors.typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
|
|
137
|
+
}
|
|
138
|
+
return errors.ok(cast);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
return errors.err(
|
|
141
|
+
errors.typeCastError(
|
|
142
|
+
"APPROXIMATE_FAILED",
|
|
143
|
+
`Approximation failed: ${e instanceof Error ? e.message : String(e)}`
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function offsetWire2D(wire, offset, kind = "arc") {
|
|
149
|
+
const oc = occtBoundary.getKernel().oc;
|
|
150
|
+
const joinTypes = {
|
|
151
|
+
arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
152
|
+
intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
|
|
153
|
+
tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
|
|
154
|
+
};
|
|
155
|
+
const resultShape = occtBoundary.getKernel().offsetWire2D(wire.wrapped, offset, joinTypes[kind]);
|
|
156
|
+
const wrapped = shapeTypes.castShape(resultShape);
|
|
157
|
+
if (!shapeTypes.isWire(wrapped)) {
|
|
158
|
+
wrapped[Symbol.dispose]();
|
|
159
|
+
return errors.err(errors.typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
|
|
160
|
+
}
|
|
161
|
+
return errors.ok(wrapped);
|
|
162
|
+
}
|
|
163
|
+
exports.approximateCurve = approximateCurve;
|
|
164
|
+
exports.curveEndPoint = curveEndPoint;
|
|
165
|
+
exports.curveIsClosed = curveIsClosed;
|
|
166
|
+
exports.curveIsPeriodic = curveIsPeriodic;
|
|
167
|
+
exports.curveLength = curveLength;
|
|
168
|
+
exports.curvePeriod = curvePeriod;
|
|
169
|
+
exports.curvePointAt = curvePointAt;
|
|
170
|
+
exports.curveStartPoint = curveStartPoint;
|
|
171
|
+
exports.curveTangentAt = curveTangentAt;
|
|
172
|
+
exports.findCurveType = findCurveType;
|
|
173
|
+
exports.flipOrientation = flipOrientation;
|
|
174
|
+
exports.getCurveType = getCurveType;
|
|
175
|
+
exports.getOrientation = getOrientation;
|
|
176
|
+
exports.interpolateCurve = interpolateCurve;
|
|
177
|
+
exports.offsetWire2D = offsetWire2D;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { g as getKernel } from "./occtBoundary-D_gjqgzo.js";
|
|
2
|
+
import { c as castShape, d as isEdge, m as isWire, p as gcWithScope } from "./shapeTypes-c-_pgYCx.js";
|
|
3
|
+
import { e as err, p as typeCastError, l as ok, u as unwrap } from "./errors-CSYOlCCR.js";
|
|
4
|
+
let CURVE_TYPES_MAP = null;
|
|
5
|
+
const getCurveTypesMap = (refresh) => {
|
|
6
|
+
if (CURVE_TYPES_MAP && !refresh) return CURVE_TYPES_MAP;
|
|
7
|
+
const oc = getKernel().oc;
|
|
8
|
+
const ga = oc.GeomAbs_CurveType;
|
|
9
|
+
CURVE_TYPES_MAP = /* @__PURE__ */ new Map([
|
|
10
|
+
[ga.GeomAbs_Line, "LINE"],
|
|
11
|
+
[ga.GeomAbs_Circle, "CIRCLE"],
|
|
12
|
+
[ga.GeomAbs_Ellipse, "ELLIPSE"],
|
|
13
|
+
[ga.GeomAbs_Hyperbola, "HYPERBOLA"],
|
|
14
|
+
[ga.GeomAbs_Parabola, "PARABOLA"],
|
|
15
|
+
[ga.GeomAbs_BezierCurve, "BEZIER_CURVE"],
|
|
16
|
+
[ga.GeomAbs_BSplineCurve, "BSPLINE_CURVE"],
|
|
17
|
+
[ga.GeomAbs_OffsetCurve, "OFFSET_CURVE"],
|
|
18
|
+
[ga.GeomAbs_OtherCurve, "OTHER_CURVE"]
|
|
19
|
+
]);
|
|
20
|
+
return CURVE_TYPES_MAP;
|
|
21
|
+
};
|
|
22
|
+
const findCurveType = (type) => {
|
|
23
|
+
let shapeType = getCurveTypesMap().get(type);
|
|
24
|
+
if (!shapeType) shapeType = getCurveTypesMap(true).get(type);
|
|
25
|
+
if (!shapeType) return err(typeCastError("UNKNOWN_CURVE_TYPE", "Unknown curve type"));
|
|
26
|
+
return ok(shapeType);
|
|
27
|
+
};
|
|
28
|
+
function getAdaptor(shape) {
|
|
29
|
+
const oc = getKernel().oc;
|
|
30
|
+
const st = shape.wrapped.ShapeType();
|
|
31
|
+
const e = oc.TopAbs_ShapeEnum;
|
|
32
|
+
if (st === e.TopAbs_WIRE) {
|
|
33
|
+
return new oc.BRepAdaptor_CompCurve_2(shape.wrapped, false);
|
|
34
|
+
}
|
|
35
|
+
return new oc.BRepAdaptor_Curve_2(shape.wrapped);
|
|
36
|
+
}
|
|
37
|
+
function mapParam(adaptor, t) {
|
|
38
|
+
const first = Number(adaptor.FirstParameter());
|
|
39
|
+
const last = Number(adaptor.LastParameter());
|
|
40
|
+
return first + (last - first) * t;
|
|
41
|
+
}
|
|
42
|
+
function getCurveType(shape) {
|
|
43
|
+
const r = gcWithScope();
|
|
44
|
+
const adaptor = r(getAdaptor(shape));
|
|
45
|
+
const technicalType = adaptor.GetType && adaptor.GetType();
|
|
46
|
+
return unwrap(findCurveType(technicalType));
|
|
47
|
+
}
|
|
48
|
+
function curveStartPoint(shape) {
|
|
49
|
+
const r = gcWithScope();
|
|
50
|
+
const adaptor = r(getAdaptor(shape));
|
|
51
|
+
const pnt = r(adaptor.Value(adaptor.FirstParameter()));
|
|
52
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
53
|
+
}
|
|
54
|
+
function curveEndPoint(shape) {
|
|
55
|
+
const r = gcWithScope();
|
|
56
|
+
const adaptor = r(getAdaptor(shape));
|
|
57
|
+
const pnt = r(adaptor.Value(adaptor.LastParameter()));
|
|
58
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
59
|
+
}
|
|
60
|
+
function curvePointAt(shape, position = 0.5) {
|
|
61
|
+
const r = gcWithScope();
|
|
62
|
+
const adaptor = r(getAdaptor(shape));
|
|
63
|
+
const pnt = r(adaptor.Value(mapParam(adaptor, position)));
|
|
64
|
+
return [pnt.X(), pnt.Y(), pnt.Z()];
|
|
65
|
+
}
|
|
66
|
+
function curveTangentAt(shape, position = 0.5) {
|
|
67
|
+
const oc = getKernel().oc;
|
|
68
|
+
const r = gcWithScope();
|
|
69
|
+
const adaptor = r(getAdaptor(shape));
|
|
70
|
+
const param = mapParam(adaptor, position);
|
|
71
|
+
const tmpPnt = r(new oc.gp_Pnt_1());
|
|
72
|
+
const tmpVec = r(new oc.gp_Vec_1());
|
|
73
|
+
adaptor.D1(param, tmpPnt, tmpVec);
|
|
74
|
+
return [tmpVec.X(), tmpVec.Y(), tmpVec.Z()];
|
|
75
|
+
}
|
|
76
|
+
function curveLength(shape) {
|
|
77
|
+
const oc = getKernel().oc;
|
|
78
|
+
const r = gcWithScope();
|
|
79
|
+
const props = r(new oc.GProp_GProps_1());
|
|
80
|
+
oc.BRepGProp.LinearProperties(shape.wrapped, props, true, false);
|
|
81
|
+
return props.Mass();
|
|
82
|
+
}
|
|
83
|
+
function curveIsClosed(shape) {
|
|
84
|
+
const r = gcWithScope();
|
|
85
|
+
const adaptor = r(getAdaptor(shape));
|
|
86
|
+
return adaptor.IsClosed();
|
|
87
|
+
}
|
|
88
|
+
function curveIsPeriodic(shape) {
|
|
89
|
+
const r = gcWithScope();
|
|
90
|
+
const adaptor = r(getAdaptor(shape));
|
|
91
|
+
return adaptor.IsPeriodic();
|
|
92
|
+
}
|
|
93
|
+
function curvePeriod(shape) {
|
|
94
|
+
const adaptor = getAdaptor(shape);
|
|
95
|
+
const result = adaptor.Period();
|
|
96
|
+
adaptor.delete();
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
function getOrientation(shape) {
|
|
100
|
+
const oc = getKernel().oc;
|
|
101
|
+
const orient = shape.wrapped.Orientation_1();
|
|
102
|
+
return orient === oc.TopAbs_Orientation.TopAbs_FORWARD ? "forward" : "backward";
|
|
103
|
+
}
|
|
104
|
+
function flipOrientation(shape) {
|
|
105
|
+
return castShape(shape.wrapped.Reversed());
|
|
106
|
+
}
|
|
107
|
+
function interpolateCurve(points, options = {}) {
|
|
108
|
+
if (points.length < 2) {
|
|
109
|
+
return err(typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const result = getKernel().interpolatePoints(points, options);
|
|
113
|
+
const cast = castShape(result);
|
|
114
|
+
if (!isEdge(cast)) {
|
|
115
|
+
return err(typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
|
|
116
|
+
}
|
|
117
|
+
return ok(cast);
|
|
118
|
+
} catch (e) {
|
|
119
|
+
return err(
|
|
120
|
+
typeCastError(
|
|
121
|
+
"INTERPOLATE_FAILED",
|
|
122
|
+
`Interpolation failed: ${e instanceof Error ? e.message : String(e)}`
|
|
123
|
+
)
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function approximateCurve(points, options = {}) {
|
|
128
|
+
if (points.length < 2) {
|
|
129
|
+
return err(typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const result = getKernel().approximatePoints(points, options);
|
|
133
|
+
const cast = castShape(result);
|
|
134
|
+
if (!isEdge(cast)) {
|
|
135
|
+
return err(typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
|
|
136
|
+
}
|
|
137
|
+
return ok(cast);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
return err(
|
|
140
|
+
typeCastError(
|
|
141
|
+
"APPROXIMATE_FAILED",
|
|
142
|
+
`Approximation failed: ${e instanceof Error ? e.message : String(e)}`
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function offsetWire2D(wire, offset, kind = "arc") {
|
|
148
|
+
const oc = getKernel().oc;
|
|
149
|
+
const joinTypes = {
|
|
150
|
+
arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
151
|
+
intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
|
|
152
|
+
tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
|
|
153
|
+
};
|
|
154
|
+
const resultShape = getKernel().offsetWire2D(wire.wrapped, offset, joinTypes[kind]);
|
|
155
|
+
const wrapped = castShape(resultShape);
|
|
156
|
+
if (!isWire(wrapped)) {
|
|
157
|
+
wrapped[Symbol.dispose]();
|
|
158
|
+
return err(typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
|
|
159
|
+
}
|
|
160
|
+
return ok(wrapped);
|
|
161
|
+
}
|
|
162
|
+
export {
|
|
163
|
+
curveTangentAt as a,
|
|
164
|
+
curvePointAt as b,
|
|
165
|
+
curveIsClosed as c,
|
|
166
|
+
curveEndPoint as d,
|
|
167
|
+
curveStartPoint as e,
|
|
168
|
+
curveLength as f,
|
|
169
|
+
approximateCurve as g,
|
|
170
|
+
curveIsPeriodic as h,
|
|
171
|
+
curvePeriod as i,
|
|
172
|
+
findCurveType as j,
|
|
173
|
+
flipOrientation as k,
|
|
174
|
+
getCurveType as l,
|
|
175
|
+
getOrientation as m,
|
|
176
|
+
interpolateCurve as n,
|
|
177
|
+
offsetWire2D as o
|
|
178
|
+
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { u as unwrap, g as isOk, e as err, x as validationError, l as ok } from "./errors-
|
|
2
|
-
import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-
|
|
3
|
-
import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-
|
|
1
|
+
import { u as unwrap, g as isOk, e as err, x as validationError, l as ok } from "./errors-CSYOlCCR.js";
|
|
2
|
+
import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-DE0XriuQ.js";
|
|
3
|
+
import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-D_gjqgzo.js";
|
|
4
4
|
import { n as vecScale, j as vecNormalize, v as vecAdd, o as vecSub, b as vecCross, m as vecRotate, R as RAD2DEG, g as vecLength, e as vecEquals, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
5
|
-
import { h as Flatbush, j as convertSvgEllipseParams, k as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, b as Blueprints, C as CompoundBlueprint, c as cut2D, l as intersectCurves, f as fuse2D, m as make2dOffset, n as filletCurves, q as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, i as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-
|
|
6
|
-
import { f as faceCenter, n as normalAt, o as outerWire } from "./faceFns-
|
|
7
|
-
import {
|
|
8
|
-
import { m as makeLine, i as makeThreePointArc, h as makeTangentArc, g as makeEllipseArc, c as makeBezierCurve, a as assembleWire, e as makeCircle, f as makeEllipse, b as makeHelix, d as makeBSplineApproximation } from "./curveBuilders-
|
|
9
|
-
import { n as createWire, t as localGC, u as createFace, e as isFace, p as gcWithScope, c as castShape } from "./shapeTypes-
|
|
10
|
-
import { d as downcast, c as cast } from "./cast-
|
|
11
|
-
import { h as mirror, a as addHolesInFace, m as makeFace, B as Blueprint, C as Curve2D, i as make2dSegmentCurve, j as make2dArcFromCenter, k as approximateAsSvgCompatibleCurve, e as BoundingBox2d, l as edgeToCurve, n as make2dInerpolatedBSplineCurve, o as make2dCircle, p as make2dEllipse, q as deserializeCurve2D } from "./Blueprint-
|
|
5
|
+
import { h as Flatbush, j as convertSvgEllipseParams, k as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, b as Blueprints, C as CompoundBlueprint, c as cut2D, l as intersectCurves, f as fuse2D, m as make2dOffset, n as filletCurves, q as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, i as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-DN6ETTCq.js";
|
|
6
|
+
import { f as faceCenter, n as normalAt, o as outerWire } from "./faceFns-CfJIbHY3.js";
|
|
7
|
+
import { a as curveTangentAt, d as curveEndPoint, l as getCurveType, o as offsetWire2D } from "./curveFns-ZuQUBZvd.js";
|
|
8
|
+
import { m as makeLine, i as makeThreePointArc, h as makeTangentArc, g as makeEllipseArc, c as makeBezierCurve, a as assembleWire, e as makeCircle, f as makeEllipse, b as makeHelix, d as makeBSplineApproximation } from "./curveBuilders-BREwqvuc.js";
|
|
9
|
+
import { n as createWire, t as localGC, u as createFace, e as isFace, p as gcWithScope, c as castShape } from "./shapeTypes-c-_pgYCx.js";
|
|
10
|
+
import { d as downcast, c as cast } from "./cast-Cerqtxtb.js";
|
|
11
|
+
import { h as mirror, a as addHolesInFace, m as makeFace, B as Blueprint, C as Curve2D, i as make2dSegmentCurve, j as make2dArcFromCenter, k as approximateAsSvgCompatibleCurve, e as BoundingBox2d, l as edgeToCurve, n as make2dInerpolatedBSplineCurve, o as make2dCircle, p as make2dEllipse, q as deserializeCurve2D } from "./Blueprint-Bp45tnh0.js";
|
|
12
12
|
import { bug } from "./result.js";
|
|
13
|
-
import { d as distance2d, p as polarAngle2d, b as polarToCartesian, P as PRECISION_OFFSET, e as squareDistance2d, s as samePoint$1, h as subtract2d, i as add2d } from "./helpers-
|
|
14
|
-
import {
|
|
13
|
+
import { d as distance2d, p as polarAngle2d, b as polarToCartesian, P as PRECISION_OFFSET, e as squareDistance2d, s as samePoint$1, h as subtract2d, i as add2d } from "./helpers-CmVkMubc.js";
|
|
14
|
+
import { e as getEdges } from "./shapeFns-k1YHFwmB.js";
|
|
15
|
+
import { m as makeCompound, i as basicFaceExtrusion, r as revolution, e as makeSolid, k as complexExtrude, t as twistExtrude } from "./loft-oJq2OD3A.js";
|
|
15
16
|
import opentype from "opentype.js";
|
|
16
|
-
import { c as cornerFinder } from "./cornerFinder-
|
|
17
|
+
import { c as cornerFinder } from "./cornerFinder-CC_MunIh.js";
|
|
17
18
|
const stitchCurves = (curves, precision = 1e-7) => {
|
|
18
19
|
const startPoints = new Flatbush(curves.length);
|
|
19
20
|
curves.forEach((c) => {
|
|
@@ -1022,7 +1023,8 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
1022
1023
|
response = await fetch(fontPath);
|
|
1023
1024
|
} catch (e) {
|
|
1024
1025
|
throw new Error(
|
|
1025
|
-
`Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}
|
|
1026
|
+
`Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}`,
|
|
1027
|
+
{ cause: e }
|
|
1026
1028
|
);
|
|
1027
1029
|
}
|
|
1028
1030
|
if (!response.ok) {
|
|
@@ -1038,7 +1040,9 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
1038
1040
|
try {
|
|
1039
1041
|
font = opentype.parse(fontData);
|
|
1040
1042
|
} catch (e) {
|
|
1041
|
-
throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}
|
|
1043
|
+
throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`, {
|
|
1044
|
+
cause: e
|
|
1045
|
+
});
|
|
1042
1046
|
}
|
|
1043
1047
|
FONT_REGISTER[fontFamily] = font;
|
|
1044
1048
|
if (!FONT_REGISTER["default"]) FONT_REGISTER["default"] = font;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const errors = require("./errors-
|
|
3
|
-
const vectors = require("./vectors-
|
|
4
|
-
const occtBoundary = require("./occtBoundary-
|
|
2
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
3
|
+
const vectors = require("./vectors-DVmHF4zt.cjs");
|
|
4
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
5
5
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
6
|
-
const boolean2D = require("./boolean2D-
|
|
7
|
-
const faceFns = require("./faceFns-
|
|
8
|
-
const curveFns = require("./curveFns-
|
|
9
|
-
const curveBuilders = require("./curveBuilders-
|
|
10
|
-
const shapeTypes = require("./shapeTypes-
|
|
11
|
-
const cast = require("./cast-
|
|
12
|
-
const Blueprint = require("./Blueprint-
|
|
6
|
+
const boolean2D = require("./boolean2D-CfEbRMPF.cjs");
|
|
7
|
+
const faceFns = require("./faceFns-es3GENII.cjs");
|
|
8
|
+
const curveFns = require("./curveFns-VMxgfkqw.cjs");
|
|
9
|
+
const curveBuilders = require("./curveBuilders-BkEJ-RVn.cjs");
|
|
10
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
11
|
+
const cast = require("./cast-CPNOTNFm.cjs");
|
|
12
|
+
const Blueprint = require("./Blueprint-zgFe_5Qj.cjs");
|
|
13
13
|
const result = require("./result.cjs");
|
|
14
|
-
const helpers = require("./helpers-
|
|
15
|
-
const
|
|
14
|
+
const helpers = require("./helpers-C0q_FVxq.cjs");
|
|
15
|
+
const shapeFns = require("./shapeFns-B0zSdO9c.cjs");
|
|
16
|
+
const loft = require("./loft-B-UCPW9P.cjs");
|
|
16
17
|
const opentype = require("opentype.js");
|
|
17
|
-
const cornerFinder = require("./cornerFinder-
|
|
18
|
+
const cornerFinder = require("./cornerFinder-BQ-_VJx0.cjs");
|
|
18
19
|
const stitchCurves = (curves, precision = 1e-7) => {
|
|
19
20
|
const startPoints = new boolean2D.Flatbush(curves.length);
|
|
20
21
|
curves.forEach((c) => {
|
|
@@ -414,7 +415,7 @@ const guessFaceFromWires = (wires) => {
|
|
|
414
415
|
new oc.BRepOffsetAPI_MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9)
|
|
415
416
|
);
|
|
416
417
|
wires.forEach((wire, wireIndex) => {
|
|
417
|
-
|
|
418
|
+
shapeFns.getEdges(wire).forEach((edge) => {
|
|
418
419
|
faceBuilder.Add_1(edge.wrapped, oc.GeomAbs_Shape.GeomAbs_C0, wireIndex === 0);
|
|
419
420
|
});
|
|
420
421
|
});
|
|
@@ -1023,7 +1024,8 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
1023
1024
|
response = await fetch(fontPath);
|
|
1024
1025
|
} catch (e) {
|
|
1025
1026
|
throw new Error(
|
|
1026
|
-
`Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}
|
|
1027
|
+
`Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}`,
|
|
1028
|
+
{ cause: e }
|
|
1027
1029
|
);
|
|
1028
1030
|
}
|
|
1029
1031
|
if (!response.ok) {
|
|
@@ -1039,7 +1041,9 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
1039
1041
|
try {
|
|
1040
1042
|
font = opentype.parse(fontData);
|
|
1041
1043
|
} catch (e) {
|
|
1042
|
-
throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}
|
|
1044
|
+
throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`, {
|
|
1045
|
+
cause: e
|
|
1046
|
+
});
|
|
1043
1047
|
}
|
|
1044
1048
|
FONT_REGISTER[fontFamily] = font;
|
|
1045
1049
|
if (!FONT_REGISTER["default"]) FONT_REGISTER["default"] = font;
|
|
@@ -1119,7 +1123,7 @@ function isProjectionPlane(plane) {
|
|
|
1119
1123
|
}
|
|
1120
1124
|
const getEdgesFromOc = (shape) => {
|
|
1121
1125
|
if (shape.IsNull()) return [];
|
|
1122
|
-
return
|
|
1126
|
+
return shapeFns.getEdges(shapeTypes.castShape(shape));
|
|
1123
1127
|
};
|
|
1124
1128
|
function makeProjectedEdges(shape, camera, withHiddenLines = true) {
|
|
1125
1129
|
const oc = occtBoundary.getKernel().oc;
|
|
@@ -1497,7 +1501,7 @@ function drawFaceOutline(face) {
|
|
|
1497
1501
|
const [r, gc] = shapeTypes.localGC();
|
|
1498
1502
|
const clonedFace = r(shapeTypes.createFace(errors.unwrap(cast.downcast(face.wrapped))));
|
|
1499
1503
|
const faceOuterWire = r(faceFns.outerWire(clonedFace));
|
|
1500
|
-
const curves =
|
|
1504
|
+
const curves = shapeFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
|
|
1501
1505
|
gc();
|
|
1502
1506
|
const stitchedCurves = stitchCurves(curves).map((s) => new Blueprint.Blueprint(s));
|
|
1503
1507
|
if (stitchedCurves.length === 0) return new Drawing();
|
|
@@ -160,7 +160,16 @@ const BrepErrorCode = {
|
|
|
160
160
|
INTERSECTION_FAILED: "INTERSECTION_FAILED",
|
|
161
161
|
SELF_INTERSECTION_FAILED: "SELF_INTERSECTION_FAILED",
|
|
162
162
|
// Query errors
|
|
163
|
-
FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE"
|
|
163
|
+
FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE",
|
|
164
|
+
// Hull errors
|
|
165
|
+
HULL_EMPTY_INPUT: "HULL_EMPTY_INPUT",
|
|
166
|
+
HULL_FAILED: "HULL_FAILED",
|
|
167
|
+
HULL_DEGENERATE: "HULL_DEGENERATE",
|
|
168
|
+
HULL_NOT_3D: "HULL_NOT_3D",
|
|
169
|
+
// Minkowski errors
|
|
170
|
+
MINKOWSKI_FAILED: "MINKOWSKI_FAILED",
|
|
171
|
+
MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL",
|
|
172
|
+
MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D"
|
|
164
173
|
};
|
|
165
174
|
function makeError(kind, code, message, cause, metadata, suggestion) {
|
|
166
175
|
const base = { kind, code, message, cause };
|
|
@@ -161,7 +161,16 @@ const BrepErrorCode = {
|
|
|
161
161
|
INTERSECTION_FAILED: "INTERSECTION_FAILED",
|
|
162
162
|
SELF_INTERSECTION_FAILED: "SELF_INTERSECTION_FAILED",
|
|
163
163
|
// Query errors
|
|
164
|
-
FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE"
|
|
164
|
+
FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE",
|
|
165
|
+
// Hull errors
|
|
166
|
+
HULL_EMPTY_INPUT: "HULL_EMPTY_INPUT",
|
|
167
|
+
HULL_FAILED: "HULL_FAILED",
|
|
168
|
+
HULL_DEGENERATE: "HULL_DEGENERATE",
|
|
169
|
+
HULL_NOT_3D: "HULL_NOT_3D",
|
|
170
|
+
// Minkowski errors
|
|
171
|
+
MINKOWSKI_FAILED: "MINKOWSKI_FAILED",
|
|
172
|
+
MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL",
|
|
173
|
+
MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D"
|
|
165
174
|
};
|
|
166
175
|
function makeError(kind, code, message, cause, metadata, suggestion) {
|
|
167
176
|
const base = { kind, code, message, cause };
|