brepjs 18.124.0 → 18.124.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2d.cjs +10 -8
- package/dist/2d.js +10 -8
- package/dist/{adjacencyFns-BJ6jcQ-N.cjs → adjacencyFns-Dxx7ftVV.cjs} +3 -3
- package/dist/{adjacencyFns-CnehwLNj.js → adjacencyFns-Syimhi5A.js} +3 -3
- package/dist/{blueprint-BSfG0Uik.cjs → blueprint-BxwG1Gza.cjs} +14 -10
- package/dist/{blueprint-BGWbpQ-w.js → blueprint-DvJhiSQF.js} +16 -11
- package/dist/{blueprintFns-C0-nGqlW.cjs → blueprintFns-CURJa6gK.cjs} +2 -2
- package/dist/{blueprintFns-Bt1hKlL7.js → blueprintFns-CiOJiPIw.js} +2 -2
- package/dist/{blueprintSketcher-Bd5ZS9p6.cjs → blueprintSketcher-COLNJfbg.cjs} +19 -11
- package/dist/{blueprintSketcher-BTGRoQ_G.js → blueprintSketcher-CfgOzgxc.js} +19 -11
- package/dist/{boolean2D-Cr6oLsbf.cjs → boolean2D-BQqC_nps.cjs} +12 -8
- package/dist/{boolean2D-zZ9-qR5a.js → boolean2D-Cdh2qVf6.js} +14 -9
- package/dist/brepjs.cjs +121 -81
- package/dist/brepjs.js +132 -85
- package/dist/{cameraFns-j2I9G3L_.cjs → cameraFns-CFVDwvGj.cjs} +5 -4
- package/dist/{cameraFns-CGMawqfi.js → cameraFns-USpwGr6_.js} +5 -4
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/{cornerFinder-CaXBdZz9.js → cornerFinder-CIiXl5Kq.js} +1 -1
- package/dist/{cornerFinder-CPwSLgpM.cjs → cornerFinder-DyWf9i1I.cjs} +1 -1
- package/dist/{curveFns-BBLaLG1U.cjs → curveFns-CSY23hP9.cjs} +8 -5
- package/dist/{curveFns-BoHbhtqX.js → curveFns-F4E56Inv.js} +8 -5
- package/dist/{drawFns-BrRbAeYB.js → drawFns-BiTlyKMy.js} +59 -30
- package/dist/{drawFns-DOkSdo8E.cjs → drawFns-r8PNRpEn.cjs} +59 -30
- package/dist/{faceFns-UozswcwP.cjs → faceFns-D9LdZArB.cjs} +4 -3
- package/dist/{faceFns-Ce7Fq6j5.js → faceFns-Dy4lA0f_.js} +6 -4
- package/dist/{healingFns-Dn0EFSHm.js → healingFns-B6tDq40C.js} +38 -21
- package/dist/{healingFns-mKogaVOk.cjs → healingFns-jxoJQApv.cjs} +38 -21
- package/dist/{helpers-DuTAcGVX.cjs → helpers-CeX5zwCS.cjs} +6 -6
- package/dist/{helpers-CZsK8STz.js → helpers-ClZ_C5nP.js} +6 -6
- package/dist/{importFns-Ch2YwieP.cjs → importFns-CR3k4ct3.cjs} +5 -6
- package/dist/{importFns-CE4byS-8.js → importFns-DpbQ02xU.js} +5 -6
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/{loftFns-BYiUcAxk.cjs → loftFns-Bd6Qs7uB.cjs} +15 -9
- package/dist/{loftFns-DQVg8qxM.js → loftFns-sILTLlrA.js} +15 -9
- package/dist/{measureFns-BbLLBg5q.js → measureFns-B9CjOY97.js} +3 -3
- package/dist/{measureFns-Cao9gY1L.cjs → measureFns-D3wAgSGr.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-B6NveFwc.js → meshFns-BWgXP2-7.js} +3 -3
- package/dist/{meshFns-CnYIUU9b.cjs → meshFns-C5Mni6NE.cjs} +3 -3
- package/dist/{occtWasmAdapter-BQKQXF63.js → occtWasmAdapter-BEe---7w.js} +3 -1
- package/dist/{occtWasmAdapter-Aubfbks6.cjs → occtWasmAdapter-DEpy64ji.cjs} +3 -1
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{originTrackingFns-uz38yuMp.cjs → originTrackingFns-BVmoGfxj.cjs} +2 -2
- package/dist/{originTrackingFns-DXcggmgf.js → originTrackingFns-CgXHRXve.js} +2 -2
- package/dist/{primitiveFns-DmEPf6av.cjs → primitiveFns-BI3xR_wX.cjs} +7 -5
- package/dist/{primitiveFns-CmmTWOkO.js → primitiveFns-CSOkiKA7.js} +7 -5
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{refResolveFns-CnPEaqHw.cjs → refResolveFns-D_RnidoD.cjs} +10 -8
- package/dist/{refResolveFns-DqY7Cd00.js → refResolveFns-DxjdVw1p.js} +10 -8
- package/dist/{rolldown-runtime-DakpK96I.cjs → rolldown-runtime-C0BPl7ul.cjs} +1 -1
- package/dist/{shapeFns-BLZ1dDSz.cjs → shapeFns-XPAVA2ZZ.cjs} +2 -2
- package/dist/{shapeFns-mYczuWOy.js → shapeFns-lw5Mzj__.js} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-bHlssytH.js → shapeTypes-7_c5mEYb.js} +25 -17
- package/dist/{shapeTypes-DZKuRt24.cjs → shapeTypes-Dm6f4xsN.cjs} +9 -9
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-9s-j-ZiW.js → solidBuilders-Cyfx4vIB.js} +14 -9
- package/dist/{solidBuilders-5tA9O1SM.cjs → solidBuilders-D0dqmSE6.cjs} +14 -9
- package/dist/{surfaceBuilders-B7UnwkQz.js → surfaceBuilders-BCDBd5Ii.js} +7 -5
- package/dist/{surfaceBuilders-0x7j0ibk.cjs → surfaceBuilders-DEMrBvXW.cjs} +7 -5
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-BPbIpA4-.cjs → textBlueprints-B-7POKfB.cjs} +37 -22
- package/dist/{textBlueprints-DE3M-E9o.js → textBlueprints-DnCz3w4s.js} +36 -21
- package/dist/{textMetrics-rRuWxQG_.cjs → textMetrics-4a8KfRbQ.cjs} +3 -2
- package/dist/{textMetrics-D3Bly1w4.js → textMetrics-m_H1URz5.js} +3 -2
- package/dist/{threadFns-BAjFNk2_.js → threadFns-CJDOHziO.js} +17 -12
- package/dist/{threadFns-BMT6ziG_.cjs → threadFns-ZrJsQtPC.cjs} +17 -12
- package/dist/topology.cjs +9 -9
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-DVhWxBwT.js → topologyQueryFns-Bihcwoz0.js} +1 -1
- package/dist/{topologyQueryFns-DZUpJz2p.cjs → topologyQueryFns-RjAzu76K.cjs} +1 -1
- package/dist/{validityTypes-19mfqWVv.js → validityTypes-C1GMwI9t.js} +1 -1
- package/dist/{validityTypes-CCnRq3A9.cjs → validityTypes-DeiK-KFO.cjs} +1 -1
- package/package.json +5 -5
package/dist/sketching.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
3
|
-
const require_drawFns = require("./drawFns-
|
|
4
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
2
|
+
const require_blueprintSketcher = require("./blueprintSketcher-COLNJfbg.cjs");
|
|
3
|
+
const require_drawFns = require("./drawFns-r8PNRpEn.cjs");
|
|
4
|
+
const require_textBlueprints = require("./textBlueprints-B-7POKfB.cjs");
|
|
5
5
|
//#region src/sketching.ts
|
|
6
6
|
/**
|
|
7
7
|
* brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
|
package/dist/sketching.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as BaseSketcher2d, t as BlueprintSketcher } from "./blueprintSketcher-
|
|
2
|
-
import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-
|
|
3
|
-
import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, o as compoundSketchExtrude, p as sketchRevolve, s as compoundSketchFace, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-
|
|
1
|
+
import { n as BaseSketcher2d, t as BlueprintSketcher } from "./blueprintSketcher-CfgOzgxc.js";
|
|
2
|
+
import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-BiTlyKMy.js";
|
|
3
|
+
import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, o as compoundSketchExtrude, p as sketchRevolve, s as compoundSketchFace, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-DnCz3w4s.js";
|
|
4
4
|
//#region src/sketching.ts
|
|
5
5
|
/**
|
|
6
6
|
* brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as isSolid, E as getShapeKind, K as getKernel, S as isShell, W as _usingCtx, d as createSolid, f as createVertex, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, s as createCompound, x as isShape3D } from "./shapeTypes-
|
|
1
|
+
import { C as isSolid, E as getShapeKind, K as getKernel, S as isShell, W as _usingCtx, d as createSolid, f as createVertex, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, s as createCompound, x as isShape3D } from "./shapeTypes-7_c5mEYb.js";
|
|
2
2
|
import { E as ok, P as unwrap, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, m as andThen, t as BrepErrorCode } from "./errors-MHLiNE-C.js";
|
|
3
|
-
import { S as subShapeHashes, c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
3
|
+
import { S as subShapeHashes, c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-Bihcwoz0.js";
|
|
4
4
|
import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
|
|
5
5
|
import { a as vecDot, g as vecSub, h as vecScale, t as vecAdd } from "./vecOps-SKPRvPH-.js";
|
|
6
6
|
import { o as resolvePlane } from "./planeOps-CQahLrCx.js";
|
|
7
|
-
import { _ as cast, y as downcast } from "./faceFns-
|
|
8
|
-
import { n as propagateOriginsByHash, r as propagateOriginsFromEvolution, t as getFaceOrigins } from "./originTrackingFns-
|
|
7
|
+
import { _ as cast, y as downcast } from "./faceFns-Dy4lA0f_.js";
|
|
8
|
+
import { n as propagateOriginsByHash, r as propagateOriginsFromEvolution, t as getFaceOrigins } from "./originTrackingFns-CgXHRXve.js";
|
|
9
9
|
import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
10
|
-
import { r as makeFace } from "./surfaceBuilders-
|
|
10
|
+
import { r as makeFace } from "./surfaceBuilders-BCDBd5Ii.js";
|
|
11
11
|
//#region src/topology/metadata/faceTagFns.ts
|
|
12
12
|
var shapeTagStore = /* @__PURE__ */ new WeakMap();
|
|
13
13
|
var tagMetadataStore = /* @__PURE__ */ new WeakMap();
|
|
@@ -595,7 +595,9 @@ function section(shape, plane, { approximation = true, planeSize } = {}) {
|
|
|
595
595
|
const { size, center } = resolveSectionPlacement(shape, resolvedPlane, planeSize);
|
|
596
596
|
const sectionFace = makeSectionFace(resolvedPlane, size, center);
|
|
597
597
|
try {
|
|
598
|
-
|
|
598
|
+
const resultOc = getKernel().section(shape.wrapped, sectionFace, approximation);
|
|
599
|
+
const wrapped = castResultShape(resultOc);
|
|
600
|
+
return ok(wrapped);
|
|
599
601
|
} catch (e) {
|
|
600
602
|
const raw = e instanceof Error ? e.message : String(e);
|
|
601
603
|
const planeName = typeof plane === "string" ? plane : "custom";
|
|
@@ -743,7 +745,8 @@ function split(shape, tools) {
|
|
|
743
745
|
if (getKernel().isNull(shape.wrapped)) return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "split: shape is a null shape"));
|
|
744
746
|
for (let i = 0; i < tools.length; i++) if (getKernel().isNull(getAtOrThrow(tools, i).wrapped)) return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, `splitShape: tool at index ${i} is a null shape`));
|
|
745
747
|
try {
|
|
746
|
-
|
|
748
|
+
const result = getKernel().split(shape.wrapped, tools.map((t) => t.wrapped));
|
|
749
|
+
return ok(castResultShape(result));
|
|
747
750
|
} catch (e) {
|
|
748
751
|
const raw = e instanceof Error ? e.message : String(e);
|
|
749
752
|
return err(kernelError("SPLIT_FAILED", `Split operation failed on ${tools.length} tool(s): ${raw}`, e, {
|
|
@@ -817,7 +820,8 @@ function booleanPipelineFallback(base, steps, options) {
|
|
|
817
820
|
*/
|
|
818
821
|
/** Sew faces/shells into a single shape using the kernel's sewing algorithm. */
|
|
819
822
|
function weldShapes(facesOrShells) {
|
|
820
|
-
|
|
823
|
+
const sewn = getKernel().sew(facesOrShells.map((s) => s.wrapped));
|
|
824
|
+
return castResultShape(sewn);
|
|
821
825
|
}
|
|
822
826
|
/**
|
|
823
827
|
* Welds faces and shells into a single shell.
|
|
@@ -917,7 +921,8 @@ function makeVertex(point) {
|
|
|
917
921
|
* @returns An error if the result is not a valid 3D shape.
|
|
918
922
|
*/
|
|
919
923
|
function makeOffset(face, offset, tolerance = 1e-6) {
|
|
920
|
-
|
|
924
|
+
const resultShape = getKernel().offset(face.wrapped, offset, tolerance);
|
|
925
|
+
return andThen(downcast(resultShape), (downcasted) => andThen(cast(downcasted), (newShape) => {
|
|
921
926
|
if (!isShape3D(newShape)) return err(typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
|
|
922
927
|
return ok(newShape);
|
|
923
928
|
}));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-Dm6f4xsN.cjs");
|
|
2
2
|
const require_errors = require("./errors-RHkKO5bZ.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-RjAzu76K.cjs");
|
|
4
4
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
5
5
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
6
6
|
const require_planeOps = require("./planeOps-VlFxtvzY.cjs");
|
|
7
|
-
const require_faceFns = require("./faceFns-
|
|
8
|
-
const require_originTrackingFns = require("./originTrackingFns-
|
|
7
|
+
const require_faceFns = require("./faceFns-D9LdZArB.cjs");
|
|
8
|
+
const require_originTrackingFns = require("./originTrackingFns-BVmoGfxj.cjs");
|
|
9
9
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
10
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
10
|
+
const require_surfaceBuilders = require("./surfaceBuilders-DEMrBvXW.cjs");
|
|
11
11
|
//#region src/topology/metadata/faceTagFns.ts
|
|
12
12
|
var shapeTagStore = /* @__PURE__ */ new WeakMap();
|
|
13
13
|
var tagMetadataStore = /* @__PURE__ */ new WeakMap();
|
|
@@ -595,7 +595,9 @@ function section(shape, plane, { approximation = true, planeSize } = {}) {
|
|
|
595
595
|
const { size, center } = resolveSectionPlacement(shape, resolvedPlane, planeSize);
|
|
596
596
|
const sectionFace = makeSectionFace(resolvedPlane, size, center);
|
|
597
597
|
try {
|
|
598
|
-
|
|
598
|
+
const resultOc = require_shapeTypes.getKernel().section(shape.wrapped, sectionFace, approximation);
|
|
599
|
+
const wrapped = require_shapeTypes.castResultShape(resultOc);
|
|
600
|
+
return require_errors.ok(wrapped);
|
|
599
601
|
} catch (e) {
|
|
600
602
|
const raw = e instanceof Error ? e.message : String(e);
|
|
601
603
|
const planeName = typeof plane === "string" ? plane : "custom";
|
|
@@ -743,7 +745,8 @@ function split(shape, tools) {
|
|
|
743
745
|
if (require_shapeTypes.getKernel().isNull(shape.wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, "split: shape is a null shape"));
|
|
744
746
|
for (let i = 0; i < tools.length; i++) if (require_shapeTypes.getKernel().isNull(require_arrayAccess.getAtOrThrow(tools, i).wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, `splitShape: tool at index ${i} is a null shape`));
|
|
745
747
|
try {
|
|
746
|
-
|
|
748
|
+
const result = require_shapeTypes.getKernel().split(shape.wrapped, tools.map((t) => t.wrapped));
|
|
749
|
+
return require_errors.ok(require_shapeTypes.castResultShape(result));
|
|
747
750
|
} catch (e) {
|
|
748
751
|
const raw = e instanceof Error ? e.message : String(e);
|
|
749
752
|
return require_errors.err(require_errors.kernelError("SPLIT_FAILED", `Split operation failed on ${tools.length} tool(s): ${raw}`, e, {
|
|
@@ -817,7 +820,8 @@ function booleanPipelineFallback(base, steps, options) {
|
|
|
817
820
|
*/
|
|
818
821
|
/** Sew faces/shells into a single shape using the kernel's sewing algorithm. */
|
|
819
822
|
function weldShapes(facesOrShells) {
|
|
820
|
-
|
|
823
|
+
const sewn = require_shapeTypes.getKernel().sew(facesOrShells.map((s) => s.wrapped));
|
|
824
|
+
return require_shapeTypes.castResultShape(sewn);
|
|
821
825
|
}
|
|
822
826
|
/**
|
|
823
827
|
* Welds faces and shells into a single shell.
|
|
@@ -917,7 +921,8 @@ function makeVertex(point) {
|
|
|
917
921
|
* @returns An error if the result is not a valid 3D shape.
|
|
918
922
|
*/
|
|
919
923
|
function makeOffset(face, offset, tolerance = 1e-6) {
|
|
920
|
-
|
|
924
|
+
const resultShape = require_shapeTypes.getKernel().offset(face.wrapped, offset, tolerance);
|
|
925
|
+
return require_errors.andThen(require_faceFns.downcast(resultShape), (downcasted) => require_errors.andThen(require_faceFns.cast(downcasted), (newShape) => {
|
|
921
926
|
if (!require_shapeTypes.isShape3D(newShape)) return require_errors.err(require_errors.typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
|
|
922
927
|
return require_errors.ok(newShape);
|
|
923
928
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire, y as isFace } from "./shapeTypes-
|
|
1
|
+
import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire, y as isFace } from "./shapeTypes-7_c5mEYb.js";
|
|
2
2
|
import { E as ok, d as validationError, g as err, i as kernelError, m as andThen } from "./errors-MHLiNE-C.js";
|
|
3
|
-
import { a as isPlanarFace } from "./validityTypes-
|
|
4
|
-
import { _ as cast, u as outerWire } from "./faceFns-
|
|
3
|
+
import { a as isPlanarFace } from "./validityTypes-C1GMwI9t.js";
|
|
4
|
+
import { _ as cast, u as outerWire } from "./faceFns-Dy4lA0f_.js";
|
|
5
5
|
//#region src/utils/range.ts
|
|
6
6
|
/** Generate an array of integers `[0, 1, …, len - 1]`. */
|
|
7
7
|
function range(len) {
|
|
@@ -214,7 +214,8 @@ function makeNewFaceWithinFace(originFace, wire) {
|
|
|
214
214
|
*/
|
|
215
215
|
function makeNonPlanarFace(wire) {
|
|
216
216
|
try {
|
|
217
|
-
|
|
217
|
+
const shape = getKernel().makeNonPlanarFace(wire.wrapped);
|
|
218
|
+
return andThen(cast(shape), (newFace) => {
|
|
218
219
|
if (!isFace(newFace)) return err(kernelError("FACE_BUILD_FAILED", "Failed to create a non-planar face"));
|
|
219
220
|
return ok(newFace);
|
|
220
221
|
});
|
|
@@ -236,7 +237,8 @@ function makePolygon(points) {
|
|
|
236
237
|
if (points.length < 3) return err(validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon"));
|
|
237
238
|
const closing = [...points.slice(1), points[0]];
|
|
238
239
|
const scope = _usingCtx$1.u(new DisposalScope());
|
|
239
|
-
|
|
240
|
+
const edges = zip([points, closing]).map(([p1, p2]) => scope.register(makeLine(p1, p2)));
|
|
241
|
+
return andThen(assembleWire(edges), (wire) => makeFace(scope.register(wire)));
|
|
240
242
|
} catch (_) {
|
|
241
243
|
_usingCtx$1.e = _;
|
|
242
244
|
} finally {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-Dm6f4xsN.cjs");
|
|
2
2
|
const require_errors = require("./errors-RHkKO5bZ.cjs");
|
|
3
|
-
const require_validityTypes = require("./validityTypes-
|
|
4
|
-
const require_faceFns = require("./faceFns-
|
|
3
|
+
const require_validityTypes = require("./validityTypes-DeiK-KFO.cjs");
|
|
4
|
+
const require_faceFns = require("./faceFns-D9LdZArB.cjs");
|
|
5
5
|
//#region src/utils/range.ts
|
|
6
6
|
/** Generate an array of integers `[0, 1, …, len - 1]`. */
|
|
7
7
|
function range(len) {
|
|
@@ -214,7 +214,8 @@ function makeNewFaceWithinFace(originFace, wire) {
|
|
|
214
214
|
*/
|
|
215
215
|
function makeNonPlanarFace(wire) {
|
|
216
216
|
try {
|
|
217
|
-
|
|
217
|
+
const shape = require_shapeTypes.getKernel().makeNonPlanarFace(wire.wrapped);
|
|
218
|
+
return require_errors.andThen(require_faceFns.cast(shape), (newFace) => {
|
|
218
219
|
if (!require_shapeTypes.isFace(newFace)) return require_errors.err(require_errors.kernelError("FACE_BUILD_FAILED", "Failed to create a non-planar face"));
|
|
219
220
|
return require_errors.ok(newFace);
|
|
220
221
|
});
|
|
@@ -236,7 +237,8 @@ function makePolygon(points) {
|
|
|
236
237
|
if (points.length < 3) return require_errors.err(require_errors.validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon"));
|
|
237
238
|
const closing = [...points.slice(1), points[0]];
|
|
238
239
|
const scope = _usingCtx$1.u(new require_shapeTypes.DisposalScope());
|
|
239
|
-
|
|
240
|
+
const edges = zip([points, closing]).map(([p1, p2]) => scope.register(makeLine(p1, p2)));
|
|
241
|
+
return require_errors.andThen(assembleWire(edges), (wire) => makeFace(scope.register(wire)));
|
|
240
242
|
} catch (_) {
|
|
241
243
|
_usingCtx$1.e = _;
|
|
242
244
|
} finally {
|
package/dist/text.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
3
|
-
const require_textMetrics = require("./textMetrics-
|
|
2
|
+
const require_textBlueprints = require("./textBlueprints-B-7POKfB.cjs");
|
|
3
|
+
const require_textMetrics = require("./textMetrics-4a8KfRbQ.cjs");
|
|
4
4
|
exports.fontMetrics = require_textMetrics.fontMetrics;
|
|
5
5
|
exports.getFont = require_textBlueprints.getFont;
|
|
6
6
|
exports.loadFont = require_textBlueprints.loadFont;
|
package/dist/text.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-
|
|
2
|
-
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-
|
|
1
|
+
import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-DnCz3w4s.js";
|
|
2
|
+
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-m_H1URz5.js";
|
|
3
3
|
export { fontMetrics, getFont, loadFont, sketchText, textBlueprints, textMetrics };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
+
const require_shapeTypes = require("./shapeTypes-Dm6f4xsN.cjs");
|
|
3
3
|
const require_bug = require("./bug-O02CsAmt.cjs");
|
|
4
4
|
const require_errors = require("./errors-RHkKO5bZ.cjs");
|
|
5
5
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
|
6
6
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
7
7
|
const require_planeOps = require("./planeOps-VlFxtvzY.cjs");
|
|
8
|
-
const require_faceFns = require("./faceFns-
|
|
9
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
10
|
-
const require_curveFns = require("./curveFns-
|
|
8
|
+
const require_faceFns = require("./faceFns-D9LdZArB.cjs");
|
|
9
|
+
const require_solidBuilders = require("./solidBuilders-D0dqmSE6.cjs");
|
|
10
|
+
const require_curveFns = require("./curveFns-CSY23hP9.cjs");
|
|
11
11
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
12
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
13
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
14
|
-
const require_loftFns = require("./loftFns-
|
|
12
|
+
const require_surfaceBuilders = require("./surfaceBuilders-DEMrBvXW.cjs");
|
|
13
|
+
const require_blueprintSketcher = require("./blueprintSketcher-COLNJfbg.cjs");
|
|
14
|
+
const require_loftFns = require("./loftFns-Bd6Qs7uB.cjs");
|
|
15
15
|
let opentype_js = require("opentype.js");
|
|
16
16
|
opentype_js = require_rolldown_runtime.__toESM(opentype_js, 1);
|
|
17
17
|
//#region src/operations/extrudeFns.ts
|
|
@@ -36,7 +36,8 @@ function extrude(face, extrusionVec) {
|
|
|
36
36
|
const len = require_vecOps.vecLength(extrusionVec);
|
|
37
37
|
const dir = require_vecOps.vecNormalize(extrusionVec);
|
|
38
38
|
const shape = kernel.extrude(face.wrapped, [...dir], len);
|
|
39
|
-
const
|
|
39
|
+
const downcastShape = kernel.downcast(shape, "solid");
|
|
40
|
+
const solid = require_shapeTypes.createSolid(downcastShape);
|
|
40
41
|
require_shapeTypes.disposeDowncastSource(shape, solid);
|
|
41
42
|
return require_errors.ok(solid);
|
|
42
43
|
} catch (e) {
|
|
@@ -66,7 +67,8 @@ function revolve(face, center = [
|
|
|
66
67
|
], angle = 2 * Math.PI) {
|
|
67
68
|
if (require_shapeTypes.getKernel().isNull(face.wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, "revolve: face is a null shape"));
|
|
68
69
|
try {
|
|
69
|
-
const
|
|
70
|
+
const shape = require_shapeTypes.getKernel().revolveVec(face.wrapped, [...center], [...direction], angle);
|
|
71
|
+
const result = require_shapeTypes.castResultShape(shape);
|
|
70
72
|
if (!require_shapeTypes.isShape3D(result)) {
|
|
71
73
|
require_shapeTypes.disposeResultShape(result);
|
|
72
74
|
return require_errors.err(require_errors.typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
|
|
@@ -109,8 +111,10 @@ function extrudeAll(entries) {
|
|
|
109
111
|
});
|
|
110
112
|
}
|
|
111
113
|
try {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
const shapes = kernel.extrudeBatch?.(kernelEntries) ?? kernelEntries.map((e) => kernel.extrude(e.face, e.direction, e.length));
|
|
115
|
+
return require_errors.ok(shapes.map((shape) => {
|
|
116
|
+
const downcast = kernel.downcast(shape, "solid");
|
|
117
|
+
const solid = require_shapeTypes.createSolid(downcast);
|
|
114
118
|
require_shapeTypes.disposeDowncastSource(shape, solid);
|
|
115
119
|
return solid;
|
|
116
120
|
}));
|
|
@@ -252,11 +256,13 @@ function sketchWires(sketch) {
|
|
|
252
256
|
*/
|
|
253
257
|
function sketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
254
258
|
const face = require_errors.unwrap(require_surfaceBuilders.makeFace(sketch.wire));
|
|
255
|
-
const
|
|
259
|
+
const center = origin ? require_types.toVec3(origin) : sketch.defaultOrigin;
|
|
260
|
+
const dir = revolutionAxis ? require_types.toVec3(revolutionAxis) : [
|
|
256
261
|
0,
|
|
257
262
|
0,
|
|
258
263
|
1
|
|
259
|
-
]
|
|
264
|
+
];
|
|
265
|
+
const solid = require_errors.unwrap(revolve(face, center, dir));
|
|
260
266
|
face[Symbol.dispose]();
|
|
261
267
|
sketch.delete();
|
|
262
268
|
return solid;
|
|
@@ -270,7 +276,8 @@ function sketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
|
270
276
|
* @remarks Consumes the sketch — calling twice throws on the second call.
|
|
271
277
|
*/
|
|
272
278
|
function sketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
|
|
273
|
-
const
|
|
279
|
+
const direction = extrusionDirection ? require_types.toVec3(extrusionDirection) : sketch.defaultDirection;
|
|
280
|
+
const extrusionVec = require_vecOps.vecScale(require_vecOps.vecNormalize(direction), extrusionDistance);
|
|
274
281
|
const originVec = origin ? require_types.toVec3(origin) : sketch.defaultOrigin;
|
|
275
282
|
if (extrusionProfile && !twistAngle) {
|
|
276
283
|
const solid = require_errors.unwrap(require_loftFns.complexExtrude(sketch.wire, [...originVec], [...extrusionVec], extrusionProfile));
|
|
@@ -296,7 +303,8 @@ function sketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusio
|
|
|
296
303
|
*/
|
|
297
304
|
function sketchSweep(sketch, sketchOnPlane, sweepConfig = {}) {
|
|
298
305
|
const startPoint = require_curveFns.curveStartPoint(sketch.wire);
|
|
299
|
-
const
|
|
306
|
+
const tangent = require_curveFns.curveTangentAt(sketch.wire, 1e-9);
|
|
307
|
+
const normal = require_vecOps.vecNormalize(require_vecOps.vecScale(tangent, -1));
|
|
300
308
|
const defaultDir = sketch.defaultDirection;
|
|
301
309
|
const xDir = require_vecOps.vecScale(require_vecOps.vecCross(normal, defaultDir), -1);
|
|
302
310
|
const profile = asSketch(sketchOnPlane(require_planeOps.createPlane([...startPoint], [...xDir], [...normal]), [...startPoint]));
|
|
@@ -354,7 +362,8 @@ function compoundSketchFace(sketch) {
|
|
|
354
362
|
}
|
|
355
363
|
/** Return all wires (outer + holes) combined into a compound shape. */
|
|
356
364
|
function compoundSketchWires(sketch) {
|
|
357
|
-
|
|
365
|
+
const wires = sketch.sketches.map((s) => s.wire);
|
|
366
|
+
return require_solidBuilders.makeCompound(wires);
|
|
358
367
|
}
|
|
359
368
|
/**
|
|
360
369
|
* Extrude a compound sketch (outer + holes) along the default or given direction.
|
|
@@ -363,7 +372,9 @@ function compoundSketchWires(sketch) {
|
|
|
363
372
|
* sub-sketch is extruded as a shell, then capped into a solid.
|
|
364
373
|
*/
|
|
365
374
|
function compoundSketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
|
|
366
|
-
const
|
|
375
|
+
const rawVec = extrusionDirection ? require_types.toVec3(extrusionDirection) : sketch.outerSketch.defaultDirection;
|
|
376
|
+
const normVec = require_vecOps.vecNormalize(rawVec);
|
|
377
|
+
const extrusionVec = require_vecOps.vecScale(normVec, extrusionDistance);
|
|
367
378
|
if (extrusionProfile && !twistAngle) return holedSweptSolid(sketch.sketches, (s) => require_loftFns.complexExtrude(s.wire, origin ? require_types.toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile));
|
|
368
379
|
if (twistAngle) return holedSweptSolid(sketch.sketches, (s) => require_loftFns.twistExtrude(s.wire, twistAngle, origin ? require_types.toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile));
|
|
369
380
|
const face = compoundSketchFace(sketch);
|
|
@@ -602,11 +613,13 @@ var Sketches = class {
|
|
|
602
613
|
* leaks an arena slot on arena kernels.
|
|
603
614
|
*/
|
|
604
615
|
wires() {
|
|
605
|
-
|
|
616
|
+
const wires = this.sketches.flatMap((s) => s instanceof Sketch ? [s.wire] : s.sketches.map((sub) => sub.wire));
|
|
617
|
+
return require_solidBuilders.makeCompound(wires);
|
|
606
618
|
}
|
|
607
619
|
/** Return all sketch faces combined into a single compound shape. */
|
|
608
620
|
faces() {
|
|
609
|
-
|
|
621
|
+
const faces = this.sketches.map((s) => s.face());
|
|
622
|
+
return require_solidBuilders.makeCompound(faces);
|
|
610
623
|
}
|
|
611
624
|
/** Extrudes the sketch to a certain distance (along the default direction
|
|
612
625
|
* and origin of the sketch).
|
|
@@ -619,7 +632,8 @@ var Sketches = class {
|
|
|
619
632
|
* a s-shape).
|
|
620
633
|
*/
|
|
621
634
|
extrude(extrusionDistance, extrusionConfig = {}) {
|
|
622
|
-
|
|
635
|
+
const extruded = this.sketches.map((s) => s.extrude(extrusionDistance, extrusionConfig));
|
|
636
|
+
return require_solidBuilders.makeCompound(extruded);
|
|
623
637
|
}
|
|
624
638
|
/**
|
|
625
639
|
* Revolves the drawing on an axis (defined by its direction and an origin
|
|
@@ -719,7 +733,8 @@ function textBlueprints(text, { startX = 0, startY = 0, fontSize = 16, fontFamil
|
|
|
719
733
|
if (!font) font = getFont();
|
|
720
734
|
if (!font) require_bug.bug("text", "No fonts loaded. Call loadFont() before using text functions.");
|
|
721
735
|
const writtenText = font.getPath(text, -startX, -startY, fontSize);
|
|
722
|
-
|
|
736
|
+
const blueprints = Array.from(sketchFontCommands(writtenText.commands));
|
|
737
|
+
return require_blueprintSketcher.organiseBlueprints(blueprints).mirror([0, 0]);
|
|
723
738
|
}
|
|
724
739
|
//#endregion
|
|
725
740
|
Object.defineProperty(exports, "CompoundSketch", {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { K as getKernel, d as createSolid, h as disposeResultShape, l as createFace, m as disposeDowncastSource, n as castResultShape, p as createWire, x as isShape3D } from "./shapeTypes-
|
|
1
|
+
import { K as getKernel, d as createSolid, h as disposeResultShape, l as createFace, m as disposeDowncastSource, n as castResultShape, p as createWire, x as isShape3D } from "./shapeTypes-7_c5mEYb.js";
|
|
2
2
|
import { n as bug } from "./bug-BdOHwn_e.js";
|
|
3
3
|
import { E as ok, P as unwrap, d as validationError, g as err, i as kernelError, l as typeCastError, r as ioError, t as BrepErrorCode } from "./errors-MHLiNE-C.js";
|
|
4
4
|
import { r as toVec3 } from "./types-D24Y27N0.js";
|
|
5
5
|
import { c as vecLength, d as vecNormalize, h as vecScale, r as vecCross } from "./vecOps-SKPRvPH-.js";
|
|
6
6
|
import { n as createPlane } from "./planeOps-CQahLrCx.js";
|
|
7
|
-
import { v as copyShape } from "./faceFns-
|
|
8
|
-
import { o as makeSolid, p as cutAll, t as makeCompound } from "./solidBuilders-
|
|
9
|
-
import { l as curveStartPoint, u as curveTangentAt } from "./curveFns-
|
|
7
|
+
import { v as copyShape } from "./faceFns-Dy4lA0f_.js";
|
|
8
|
+
import { o as makeSolid, p as cutAll, t as makeCompound } from "./solidBuilders-Cyfx4vIB.js";
|
|
9
|
+
import { l as curveStartPoint, u as curveTangentAt } from "./curveFns-F4E56Inv.js";
|
|
10
10
|
import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
11
|
-
import { i as makeNewFaceWithinFace, r as makeFace, t as addHolesInFace } from "./surfaceBuilders-
|
|
12
|
-
import { r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-
|
|
13
|
-
import { c as twistExtrude, r as complexExtrude, s as sweep, t as loft } from "./loftFns-
|
|
11
|
+
import { i as makeNewFaceWithinFace, r as makeFace, t as addHolesInFace } from "./surfaceBuilders-BCDBd5Ii.js";
|
|
12
|
+
import { r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-CfgOzgxc.js";
|
|
13
|
+
import { c as twistExtrude, r as complexExtrude, s as sweep, t as loft } from "./loftFns-sILTLlrA.js";
|
|
14
14
|
import opentype from "opentype.js";
|
|
15
15
|
//#region src/operations/extrudeFns.ts
|
|
16
16
|
/**
|
|
@@ -34,7 +34,8 @@ function extrude(face, extrusionVec) {
|
|
|
34
34
|
const len = vecLength(extrusionVec);
|
|
35
35
|
const dir = vecNormalize(extrusionVec);
|
|
36
36
|
const shape = kernel.extrude(face.wrapped, [...dir], len);
|
|
37
|
-
const
|
|
37
|
+
const downcastShape = kernel.downcast(shape, "solid");
|
|
38
|
+
const solid = createSolid(downcastShape);
|
|
38
39
|
disposeDowncastSource(shape, solid);
|
|
39
40
|
return ok(solid);
|
|
40
41
|
} catch (e) {
|
|
@@ -64,7 +65,8 @@ function revolve(face, center = [
|
|
|
64
65
|
], angle = 2 * Math.PI) {
|
|
65
66
|
if (getKernel().isNull(face.wrapped)) return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "revolve: face is a null shape"));
|
|
66
67
|
try {
|
|
67
|
-
const
|
|
68
|
+
const shape = getKernel().revolveVec(face.wrapped, [...center], [...direction], angle);
|
|
69
|
+
const result = castResultShape(shape);
|
|
68
70
|
if (!isShape3D(result)) {
|
|
69
71
|
disposeResultShape(result);
|
|
70
72
|
return err(typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
|
|
@@ -107,8 +109,10 @@ function extrudeAll(entries) {
|
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
111
|
try {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
const shapes = kernel.extrudeBatch?.(kernelEntries) ?? kernelEntries.map((e) => kernel.extrude(e.face, e.direction, e.length));
|
|
113
|
+
return ok(shapes.map((shape) => {
|
|
114
|
+
const downcast = kernel.downcast(shape, "solid");
|
|
115
|
+
const solid = createSolid(downcast);
|
|
112
116
|
disposeDowncastSource(shape, solid);
|
|
113
117
|
return solid;
|
|
114
118
|
}));
|
|
@@ -250,11 +254,13 @@ function sketchWires(sketch) {
|
|
|
250
254
|
*/
|
|
251
255
|
function sketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
252
256
|
const face = unwrap(makeFace(sketch.wire));
|
|
253
|
-
const
|
|
257
|
+
const center = origin ? toVec3(origin) : sketch.defaultOrigin;
|
|
258
|
+
const dir = revolutionAxis ? toVec3(revolutionAxis) : [
|
|
254
259
|
0,
|
|
255
260
|
0,
|
|
256
261
|
1
|
|
257
|
-
]
|
|
262
|
+
];
|
|
263
|
+
const solid = unwrap(revolve(face, center, dir));
|
|
258
264
|
face[Symbol.dispose]();
|
|
259
265
|
sketch.delete();
|
|
260
266
|
return solid;
|
|
@@ -268,7 +274,8 @@ function sketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
|
268
274
|
* @remarks Consumes the sketch — calling twice throws on the second call.
|
|
269
275
|
*/
|
|
270
276
|
function sketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
|
|
271
|
-
const
|
|
277
|
+
const direction = extrusionDirection ? toVec3(extrusionDirection) : sketch.defaultDirection;
|
|
278
|
+
const extrusionVec = vecScale(vecNormalize(direction), extrusionDistance);
|
|
272
279
|
const originVec = origin ? toVec3(origin) : sketch.defaultOrigin;
|
|
273
280
|
if (extrusionProfile && !twistAngle) {
|
|
274
281
|
const solid = unwrap(complexExtrude(sketch.wire, [...originVec], [...extrusionVec], extrusionProfile));
|
|
@@ -294,7 +301,8 @@ function sketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusio
|
|
|
294
301
|
*/
|
|
295
302
|
function sketchSweep(sketch, sketchOnPlane, sweepConfig = {}) {
|
|
296
303
|
const startPoint = curveStartPoint(sketch.wire);
|
|
297
|
-
const
|
|
304
|
+
const tangent = curveTangentAt(sketch.wire, 1e-9);
|
|
305
|
+
const normal = vecNormalize(vecScale(tangent, -1));
|
|
298
306
|
const defaultDir = sketch.defaultDirection;
|
|
299
307
|
const xDir = vecScale(vecCross(normal, defaultDir), -1);
|
|
300
308
|
const profile = asSketch(sketchOnPlane(createPlane([...startPoint], [...xDir], [...normal]), [...startPoint]));
|
|
@@ -352,7 +360,8 @@ function compoundSketchFace(sketch) {
|
|
|
352
360
|
}
|
|
353
361
|
/** Return all wires (outer + holes) combined into a compound shape. */
|
|
354
362
|
function compoundSketchWires(sketch) {
|
|
355
|
-
|
|
363
|
+
const wires = sketch.sketches.map((s) => s.wire);
|
|
364
|
+
return makeCompound(wires);
|
|
356
365
|
}
|
|
357
366
|
/**
|
|
358
367
|
* Extrude a compound sketch (outer + holes) along the default or given direction.
|
|
@@ -361,7 +370,9 @@ function compoundSketchWires(sketch) {
|
|
|
361
370
|
* sub-sketch is extruded as a shell, then capped into a solid.
|
|
362
371
|
*/
|
|
363
372
|
function compoundSketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
|
|
364
|
-
const
|
|
373
|
+
const rawVec = extrusionDirection ? toVec3(extrusionDirection) : sketch.outerSketch.defaultDirection;
|
|
374
|
+
const normVec = vecNormalize(rawVec);
|
|
375
|
+
const extrusionVec = vecScale(normVec, extrusionDistance);
|
|
365
376
|
if (extrusionProfile && !twistAngle) return holedSweptSolid(sketch.sketches, (s) => complexExtrude(s.wire, origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile));
|
|
366
377
|
if (twistAngle) return holedSweptSolid(sketch.sketches, (s) => twistExtrude(s.wire, twistAngle, origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile));
|
|
367
378
|
const face = compoundSketchFace(sketch);
|
|
@@ -600,11 +611,13 @@ var Sketches = class {
|
|
|
600
611
|
* leaks an arena slot on arena kernels.
|
|
601
612
|
*/
|
|
602
613
|
wires() {
|
|
603
|
-
|
|
614
|
+
const wires = this.sketches.flatMap((s) => s instanceof Sketch ? [s.wire] : s.sketches.map((sub) => sub.wire));
|
|
615
|
+
return makeCompound(wires);
|
|
604
616
|
}
|
|
605
617
|
/** Return all sketch faces combined into a single compound shape. */
|
|
606
618
|
faces() {
|
|
607
|
-
|
|
619
|
+
const faces = this.sketches.map((s) => s.face());
|
|
620
|
+
return makeCompound(faces);
|
|
608
621
|
}
|
|
609
622
|
/** Extrudes the sketch to a certain distance (along the default direction
|
|
610
623
|
* and origin of the sketch).
|
|
@@ -617,7 +630,8 @@ var Sketches = class {
|
|
|
617
630
|
* a s-shape).
|
|
618
631
|
*/
|
|
619
632
|
extrude(extrusionDistance, extrusionConfig = {}) {
|
|
620
|
-
|
|
633
|
+
const extruded = this.sketches.map((s) => s.extrude(extrusionDistance, extrusionConfig));
|
|
634
|
+
return makeCompound(extruded);
|
|
621
635
|
}
|
|
622
636
|
/**
|
|
623
637
|
* Revolves the drawing on an axis (defined by its direction and an origin
|
|
@@ -717,7 +731,8 @@ function textBlueprints(text, { startX = 0, startY = 0, fontSize = 16, fontFamil
|
|
|
717
731
|
if (!font) font = getFont();
|
|
718
732
|
if (!font) bug("text", "No fonts loaded. Call loadFont() before using text functions.");
|
|
719
733
|
const writtenText = font.getPath(text, -startX, -startY, fontSize);
|
|
720
|
-
|
|
734
|
+
const blueprints = Array.from(sketchFontCommands(writtenText.commands));
|
|
735
|
+
return organiseBlueprints(blueprints).mirror([0, 0]);
|
|
721
736
|
}
|
|
722
737
|
//#endregion
|
|
723
738
|
export { wrapSketchDataArray as _, Sketch as a, extrudeAll as b, compoundSketchLoft as c, sketchFace as d, sketchLoft as f, wrapSketchData as g, sketchWires as h, Sketches as i, compoundSketchRevolve as l, sketchSweep as m, getFont as n, compoundSketchExtrude as o, sketchRevolve as p, loadFont as r, compoundSketchFace as s, textBlueprints as t, sketchExtrude as u, CompoundSketch as v, revolve as x, extrude as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_errors = require("./errors-RHkKO5bZ.cjs");
|
|
2
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
2
|
+
const require_textBlueprints = require("./textBlueprints-B-7POKfB.cjs");
|
|
3
3
|
//#region src/text/sketchText.ts
|
|
4
4
|
/**
|
|
5
5
|
* Render text as 3D sketch outlines on a plane.
|
|
@@ -21,7 +21,8 @@ const require_textBlueprints = require("./textBlueprints-BPbIpA4-.cjs");
|
|
|
21
21
|
*/
|
|
22
22
|
function sketchText(text, textConfig, planeConfig = {}) {
|
|
23
23
|
const textBp = require_textBlueprints.textBlueprints(text, textConfig);
|
|
24
|
-
|
|
24
|
+
const results = typeof planeConfig.plane === "string" || planeConfig.plane === void 0 ? textBp.sketchOnPlane(planeConfig.plane, planeConfig.origin) : textBp.sketchOnPlane(planeConfig.plane);
|
|
25
|
+
return new require_textBlueprints.Sketches(results.map((item) => Array.isArray(item) ? new require_textBlueprints.CompoundSketch(item.map(require_textBlueprints.wrapSketchData)) : require_textBlueprints.wrapSketchData(item)));
|
|
25
26
|
}
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region src/text/textMetrics.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-MHLiNE-C.js";
|
|
2
|
-
import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-
|
|
2
|
+
import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints, v as CompoundSketch } from "./textBlueprints-DnCz3w4s.js";
|
|
3
3
|
//#region src/text/sketchText.ts
|
|
4
4
|
/**
|
|
5
5
|
* Render text as 3D sketch outlines on a plane.
|
|
@@ -21,7 +21,8 @@ import { g as wrapSketchData, i as Sketches, n as getFont, t as textBlueprints,
|
|
|
21
21
|
*/
|
|
22
22
|
function sketchText(text, textConfig, planeConfig = {}) {
|
|
23
23
|
const textBp = textBlueprints(text, textConfig);
|
|
24
|
-
|
|
24
|
+
const results = typeof planeConfig.plane === "string" || planeConfig.plane === void 0 ? textBp.sketchOnPlane(planeConfig.plane, planeConfig.origin) : textBp.sketchOnPlane(planeConfig.plane);
|
|
25
|
+
return new Sketches(results.map((item) => Array.isArray(item) ? new CompoundSketch(item.map(wrapSketchData)) : wrapSketchData(item)));
|
|
25
26
|
}
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region src/text/textMetrics.ts
|