brepjs 18.6.0 → 18.14.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/README.md +6 -0
- package/dist/{sketching/sketcher2d.d.ts → 2d/blueprints/baseSketcher2d.d.ts} +4 -91
- package/dist/2d/blueprints/blueprint.d.ts +0 -1
- package/dist/2d/blueprints/blueprintApproximations.d.ts +0 -1
- package/dist/2d/blueprints/blueprintCustomCorners.d.ts +0 -1
- package/dist/2d/blueprints/blueprintFns.d.ts +0 -1
- package/dist/2d/blueprints/blueprintOffset.d.ts +0 -1
- package/dist/2d/blueprints/blueprintSketcher.d.ts +29 -0
- package/dist/2d/blueprints/blueprints.d.ts +0 -1
- package/dist/2d/blueprints/boolean2D.d.ts +0 -1
- package/dist/2d/blueprints/booleanHelpers.d.ts +0 -1
- package/dist/2d/blueprints/booleanOperations.d.ts +0 -1
- package/dist/2d/blueprints/cannedBlueprints.d.ts +0 -1
- package/dist/2d/blueprints/compoundBlueprint.d.ts +0 -1
- package/dist/{sketching → 2d/blueprints}/ellipseUtils.d.ts +19 -2
- package/dist/{sketching/sketcherlib.d.ts → 2d/blueprints/genericSketcher.d.ts} +1 -20
- package/dist/2d/blueprints/index.d.ts +0 -1
- package/dist/2d/blueprints/intersectionSegments.d.ts +0 -1
- package/dist/2d/blueprints/lib.d.ts +0 -1
- package/dist/2d/blueprints/segmentAssembly.d.ts +0 -1
- package/dist/2d/blueprints/svg.d.ts +0 -1
- package/dist/2d/curve2dGeometryFns.d.ts +0 -1
- package/dist/2d/curves.d.ts +0 -1
- package/dist/2d/lib/approximations.d.ts +0 -1
- package/dist/2d/lib/boundingBox2d.d.ts +0 -1
- package/dist/2d/lib/curve2D.d.ts +0 -1
- package/dist/2d/lib/curve2dFns.d.ts +0 -1
- package/dist/2d/lib/customCorners.d.ts +0 -1
- package/dist/2d/lib/definitions.d.ts +0 -1
- package/dist/2d/lib/index.d.ts +0 -1
- package/dist/2d/lib/intersections.d.ts +0 -1
- package/dist/2d/lib/makeCurves.d.ts +0 -1
- package/dist/2d/lib/offset.d.ts +0 -1
- package/dist/2d/lib/precision.d.ts +0 -1
- package/dist/2d/lib/stitching.d.ts +0 -1
- package/dist/2d/lib/svgPath.d.ts +0 -1
- package/dist/2d/lib/utils.d.ts +0 -1
- package/dist/2d/lib/vectorOperations.d.ts +0 -1
- package/dist/2d.cjs +20 -19
- package/dist/2d.d.ts +0 -1
- package/dist/2d.js +7 -6
- package/dist/{blueprint-CscZ0-wr.cjs → blueprint-B8ogGJiQ.cjs} +16 -15
- package/dist/{blueprint-BCoJbaQN.js → blueprint-Dv45Evnu.js} +16 -15
- package/dist/{blueprintFns-DQP4KQHE.cjs → blueprintFns-BK3FYYjO.cjs} +4 -4
- package/dist/{blueprintFns-BZlx6BjG.js → blueprintFns-a9C2g8_E.js} +3 -3
- package/dist/{boolean2D-k1AJmCMp.cjs → blueprintSketcher-Bei866Bt.cjs} +65 -1383
- package/dist/{boolean2D-JvgjbESt.js → blueprintSketcher-xDsl9GXO.js} +70 -1316
- package/dist/boolean2D-DGuiEJHA.cjs +902 -0
- package/dist/boolean2D-Z7P0c012.js +855 -0
- package/dist/{booleanFns-D13Pb-NO.js → booleanFns-CRa80qMX.js} +9 -9
- package/dist/{booleanFns-DQW4lt7H.cjs → booleanFns-qmgMQyDl.cjs} +12 -12
- package/dist/brepjs.cjs +772 -112
- package/dist/brepjs.js +692 -42
- package/dist/cameraFns-1y1NyACI.cjs +315 -0
- package/dist/cameraFns-CUzI5RKS.js +274 -0
- package/dist/core/constants.d.ts +0 -1
- package/dist/core/curve2dHandle.d.ts +0 -1
- package/dist/core/dimensionTypes.d.ts +0 -1
- package/dist/core/disposal.d.ts +0 -1
- package/dist/core/errors.d.ts +0 -1
- package/dist/core/kernelBoundary.d.ts +0 -1
- package/dist/core/kernelCall.d.ts +0 -1
- package/dist/core/kernelErrorTranslation.d.ts +0 -1
- package/dist/core/planeOps.d.ts +0 -1
- package/dist/core/planeTypes.d.ts +0 -1
- package/dist/core/result.d.ts +0 -1
- package/dist/core/shapeTypeCache.d.ts +0 -1
- package/dist/core/shapeTypes.d.ts +0 -1
- package/dist/core/typeDiscriminants.d.ts +0 -1
- package/dist/core/types.d.ts +0 -1
- package/dist/core/validityTypes.d.ts +0 -1
- package/dist/core/vecOps.d.ts +0 -1
- package/dist/core.cjs +6 -6
- package/dist/core.d.ts +0 -1
- package/dist/core.js +6 -6
- package/dist/{cornerFinder-5BYE2cbd.cjs → cornerFinder-CC8EBRCR.cjs} +3 -3
- package/dist/{cornerFinder-Zg7pf2s0.js → cornerFinder-Dix2ghke.js} +3 -3
- package/dist/{curveFns-DhqUp0EI.js → curveFns-B4tWuinR.js} +2 -2
- package/dist/{curveFns-DrT54cm8.cjs → curveFns-CD20-4fM.cjs} +2 -2
- package/dist/{drawFns-lUXjhTYL.js → drawFns-BsarLfUN.js} +163 -769
- package/dist/{drawFns-DmP2o1oF.cjs → drawFns-LlOZoFyp.cjs} +203 -985
- package/dist/{errors-DboJwVCf.js → errors-0fYW_YnO.js} +2 -1
- package/dist/{errors-CXRNVCec.cjs → errors-Dv6pfNct.cjs} +2 -1
- package/dist/{extrudeFns-B9bVCt3C.js → extrudeFns-7pE8dIWz.js} +3 -3
- package/dist/{extrudeFns-BtblHdaJ.cjs → extrudeFns-DD36mWKv.cjs} +3 -3
- package/dist/faceFns-BFWz17_E.js +218 -0
- package/dist/faceFns-DP7i60yJ.cjs +343 -0
- package/dist/gear/gearFns.d.ts +129 -0
- package/dist/gear/gearMath.d.ts +88 -0
- package/dist/gear/gearProfile.d.ts +16 -0
- package/dist/gear/index.d.ts +3 -0
- package/dist/{helpers-BpXNcxuJ.cjs → helpers-Cyj6gaqy.cjs} +14 -13
- package/dist/{helpers-S_Ht6gwX.js → helpers-vV2ONZwD.js} +9 -8
- package/dist/{historyFns-B01hrkcJ.js → historyFns-DGb61ETW.js} +6 -6
- package/dist/{historyFns-RHO-QvEZ.cjs → historyFns-DfyrPjnK.cjs} +6 -6
- package/dist/{importFns-CG49lyTm.cjs → importFns-C-p0vl_h.cjs} +11 -19
- package/dist/{importFns-C0tUyeiW.js → importFns-Ci-L2iB3.js} +11 -19
- package/dist/index.d.ts +16 -8
- package/dist/io/dxfExportFns.d.ts +0 -1
- package/dist/io/dxfImportFns.d.ts +0 -1
- package/dist/io/gltfExportFns.d.ts +0 -1
- package/dist/io/gltfImportFns.d.ts +0 -1
- package/dist/io/importFns.d.ts +0 -1
- package/dist/io/ioUtils.d.ts +0 -1
- package/dist/io/objExportFns.d.ts +0 -1
- package/dist/io/objImportFns.d.ts +0 -1
- package/dist/io/stepConfigFns.d.ts +0 -1
- package/dist/io/svgImportFns.d.ts +0 -1
- package/dist/io/threemfExportFns.d.ts +0 -1
- package/dist/io/threemfImportFns.d.ts +0 -1
- package/dist/io.cjs +2 -2
- package/dist/io.d.ts +0 -1
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/booleanOps.d.ts +23 -1
- package/dist/kernel/brepkit/brepkitAdapter.d.ts +21 -408
- package/dist/kernel/brepkit/brepkitWasmTypes.d.ts +0 -1
- package/dist/kernel/brepkit/constructionOps.d.ts +51 -1
- package/dist/kernel/brepkit/evolutionOps.d.ts +34 -3
- package/dist/kernel/brepkit/geometryOps.d.ts +63 -2
- package/dist/kernel/brepkit/helpers.d.ts +6 -1
- package/dist/kernel/brepkit/internalOps.d.ts +0 -1
- package/dist/kernel/brepkit/ioOps.d.ts +47 -9
- package/dist/kernel/brepkit/kernel2dOps.d.ts +113 -1
- package/dist/kernel/brepkit/measureOps.d.ts +39 -1
- package/dist/kernel/brepkit/meshOps.d.ts +7 -1
- package/dist/kernel/brepkit/modifierOps.d.ts +15 -1
- package/dist/kernel/brepkit/repairOps.d.ts +14 -1
- package/dist/kernel/brepkit/sketchOps.d.ts +3 -1
- package/dist/kernel/brepkit/sweepOps.d.ts +37 -1
- package/dist/kernel/brepkit/topologyOps.d.ts +16 -1
- package/dist/kernel/brepkit/transformOps.d.ts +18 -1
- package/dist/kernel/geometry2d.d.ts +0 -1
- package/dist/kernel/index.d.ts +0 -1
- package/dist/kernel/interfaces/booleanOps.d.ts +0 -1
- package/dist/kernel/interfaces/builderOps.d.ts +0 -1
- package/dist/kernel/interfaces/core.d.ts +0 -1
- package/dist/kernel/interfaces/curveOps.d.ts +0 -1
- package/dist/kernel/interfaces/evolutionOps.d.ts +0 -1
- package/dist/kernel/interfaces/index.d.ts +0 -1
- package/dist/kernel/interfaces/ioOps.d.ts +0 -1
- package/dist/kernel/interfaces/measureOps.d.ts +0 -1
- package/dist/kernel/interfaces/meshOps.d.ts +0 -1
- package/dist/kernel/interfaces/modifierOps.d.ts +0 -1
- package/dist/kernel/interfaces/primitiveOps.d.ts +0 -1
- package/dist/kernel/interfaces/repairOps.d.ts +0 -1
- package/dist/kernel/interfaces/surfaceOps.d.ts +0 -1
- package/dist/kernel/interfaces/sweepOps.d.ts +0 -1
- package/dist/kernel/interfaces/topologyOps.d.ts +0 -1
- package/dist/kernel/interfaces/transformOps.d.ts +0 -1
- package/dist/kernel/kernel2dTypes.d.ts +0 -1
- package/dist/kernel/occt/advancedOps.d.ts +126 -24
- package/dist/kernel/occt/booleanBatchOps.d.ts +0 -1
- package/dist/kernel/occt/booleanOps.d.ts +11 -1
- package/dist/kernel/occt/booleanPipelineOps.d.ts +10 -1
- package/dist/kernel/occt/constructorOps.d.ts +14 -1
- package/dist/kernel/occt/curveOps.d.ts +13 -1
- package/dist/kernel/occt/defaultAdapter.d.ts +10 -441
- package/dist/kernel/occt/evolutionOps.d.ts +0 -1
- package/dist/kernel/occt/extendedConstructorOps.d.ts +31 -1
- package/dist/kernel/occt/geometryQueryOps.d.ts +40 -1
- package/dist/kernel/occt/healingOps.d.ts +6 -1
- package/dist/kernel/occt/historyOps.d.ts +17 -1
- package/dist/kernel/occt/hullOps.d.ts +14 -1
- package/dist/kernel/occt/ioOps.d.ts +9 -1
- package/dist/kernel/occt/kernel2dOps.d.ts +113 -1
- package/dist/kernel/occt/measureOps.d.ts +19 -1
- package/dist/kernel/occt/meshOps.d.ts +5 -1
- package/dist/kernel/occt/modifierOps.d.ts +24 -1
- package/dist/kernel/occt/nurbsQueryOps.d.ts +5 -1
- package/dist/kernel/occt/sweepOps.d.ts +23 -1
- package/dist/kernel/occt/topologyOps.d.ts +10 -1
- package/dist/kernel/occt/transformOps.d.ts +14 -4
- package/dist/kernel/occt/wasmTypes/externals.d.ts +0 -1
- package/dist/kernel/occt/wasmTypes/index.d.ts +0 -1
- package/dist/kernel/occt/wasmTypes/occtBuilders.d.ts +0 -1
- package/dist/kernel/occtWasm/adapterShims.d.ts +4 -0
- package/dist/kernel/occtWasm/booleanOps.d.ts +11 -0
- package/dist/kernel/occtWasm/constructionOps.d.ts +36 -0
- package/dist/kernel/occtWasm/curveOps.d.ts +23 -0
- package/dist/kernel/occtWasm/evolutionOps.d.ts +17 -0
- package/dist/kernel/occtWasm/helpers.d.ts +31 -0
- package/dist/kernel/occtWasm/hullOps.d.ts +12 -0
- package/dist/kernel/occtWasm/ioOps.d.ts +52 -0
- package/dist/kernel/occtWasm/kernel2dOps.d.ts +90 -0
- package/dist/kernel/occtWasm/measureOps.d.ts +31 -0
- package/dist/kernel/occtWasm/meshOps.d.ts +6 -0
- package/dist/kernel/occtWasm/modifierOps.d.ts +14 -0
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +30 -31
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/kernel/occtWasm/occtWasmTypes.d.ts +0 -1
- package/dist/kernel/occtWasm/primitiveOps.d.ts +10 -0
- package/dist/kernel/occtWasm/repairOps.d.ts +10 -0
- package/dist/kernel/occtWasm/surfaceOps.d.ts +28 -0
- package/dist/kernel/occtWasm/sweepOps.d.ts +38 -0
- package/dist/kernel/occtWasm/topologyOps.d.ts +14 -0
- package/dist/kernel/occtWasm/transformOps.d.ts +27 -0
- package/dist/kernel/perfStats.d.ts +0 -1
- package/dist/kernel/solverAdapter.d.ts +0 -1
- package/dist/kernel/types.d.ts +0 -1
- package/dist/{measureFns-C751QGI1.cjs → measureFns-6ifSQfJt.cjs} +6 -5
- package/dist/{measureFns-B8C85hbT.js → measureFns-Io2nHE1k.js} +4 -3
- package/dist/measurement/interferenceFns.d.ts +0 -1
- package/dist/measurement/measureCache.d.ts +0 -1
- package/dist/measurement/measureFns.d.ts +0 -1
- package/dist/measurement/measureTypes.d.ts +0 -1
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.d.ts +0 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-Cdhtbrhm.cjs → meshFns-BCRVZgPi.cjs} +3 -3
- package/dist/{meshFns-BgvsA-xA.js → meshFns-DSdkRFWq.js} +3 -3
- package/dist/ns/booleans.d.ts +0 -1
- package/dist/ns/construction.d.ts +0 -1
- package/dist/ns/ioNs.d.ts +0 -1
- package/dist/ns/measurement.d.ts +0 -1
- package/dist/ns/modifiers.d.ts +0 -1
- package/dist/ns/patterns.d.ts +0 -1
- package/dist/ns/primitives.d.ts +0 -1
- package/dist/ns/query.d.ts +0 -1
- package/dist/ns/transforms.d.ts +0 -1
- package/dist/occtWasmAdapter--TZGP9DX.js +4606 -0
- package/dist/occtWasmAdapter-C2VW-uYg.cjs +4719 -0
- package/dist/operations/api.d.ts +0 -1
- package/dist/operations/assemblyFns.d.ts +0 -1
- package/dist/operations/compoundOpsFns.d.ts +0 -1
- package/dist/operations/convexHullFns.d.ts +0 -1
- package/dist/operations/exporterFns.d.ts +0 -1
- package/dist/operations/exporterUtils.d.ts +0 -1
- package/dist/operations/exporters.d.ts +0 -1
- package/dist/operations/extrudeFns.d.ts +0 -1
- package/dist/operations/extrudeUtils.d.ts +0 -1
- package/dist/operations/guidedSweepFns.d.ts +0 -1
- package/dist/operations/historyFns.d.ts +0 -1
- package/dist/operations/loftFns.d.ts +0 -1
- package/dist/operations/mateFns.d.ts +0 -1
- package/dist/operations/multiSweepFns.d.ts +0 -1
- package/dist/operations/patternFns.d.ts +0 -1
- package/dist/operations/roofFns.d.ts +0 -1
- package/dist/operations/straightSkeleton.d.ts +0 -1
- package/dist/operations/sweepFns.d.ts +0 -1
- package/dist/operations.cjs +2 -2
- package/dist/operations.d.ts +0 -1
- package/dist/operations.js +2 -2
- package/dist/{planeOps-sTrM3dcQ.js → planeOps-4i2qEraD.js} +4 -4
- package/dist/{planeOps-BJOIbn4K.cjs → planeOps-CH4ruLuj.cjs} +4 -4
- package/dist/{primitiveFns-BLxaJ40A.cjs → primitiveFns-BH-JQPzh.cjs} +20 -19
- package/dist/{primitiveFns-fR9sWOEb.js → primitiveFns-C1p92ZcD.js} +8 -7
- package/dist/projection/cameraFns.d.ts +0 -1
- package/dist/projection/makeProjectedEdges.d.ts +0 -1
- package/dist/projection/projectionPlanes.d.ts +0 -1
- package/dist/projection.cjs +9 -0
- package/dist/projection.d.ts +11 -0
- package/dist/projection.js +2 -0
- package/dist/query/cornerFinder.d.ts +0 -1
- package/dist/query/directionUtils.d.ts +0 -1
- package/dist/query/edgeFinder.d.ts +0 -1
- package/dist/query/faceFinder.d.ts +0 -1
- package/dist/query/finderCore.d.ts +0 -1
- package/dist/query/finderFns.d.ts +0 -1
- package/dist/query/helpers.d.ts +0 -1
- package/dist/query/shapeDistanceFilter.d.ts +0 -1
- package/dist/query/shapeFinders.d.ts +0 -1
- package/dist/query/vertexFinder.d.ts +0 -1
- package/dist/query/wireFinder.d.ts +0 -1
- package/dist/query.cjs +2 -2
- package/dist/query.d.ts +0 -1
- package/dist/query.js +2 -2
- package/dist/result.cjs +1 -1
- package/dist/result.d.ts +0 -1
- package/dist/result.js +1 -1
- package/dist/{shapeFns-183zCtMc.cjs → shapeFns-B7x82K11.cjs} +17 -17
- package/dist/{shapeFns-2X3VOi1a.js → shapeFns-BhZ9weSI.js} +4 -4
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.d.ts +0 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-CU1Jwq9C.js → shapeRefFns-B9PsEqWf.js} +6 -4
- package/dist/{shapeRefFns-CFyv5cdW.cjs → shapeRefFns-wDY88A8u.cjs} +8 -6
- package/dist/{shapeTypes-C0MDggKf.cjs → shapeTypes-BTt_LLbk.cjs} +6922 -7884
- package/dist/{shapeTypes-CN0GUoHr.js → shapeTypes-C--1jaT1.js} +6900 -7862
- package/dist/sketching/cannedSketches.d.ts +0 -1
- package/dist/sketching/compoundSketch.d.ts +8 -7
- package/dist/sketching/draw3d.d.ts +1 -2
- package/dist/sketching/drawFns.d.ts +4 -3
- package/dist/sketching/{draw.d.ts → drawing.d.ts} +2 -127
- package/dist/sketching/drawingFactories.d.ts +94 -0
- package/dist/sketching/drawingPen.d.ts +34 -0
- package/dist/sketching/faceSketcher.d.ts +52 -0
- package/dist/sketching/shortcuts.d.ts +0 -1
- package/dist/sketching/sketch.d.ts +64 -10
- package/dist/sketching/sketchFns.d.ts +42 -95
- package/dist/sketching/sketcher.d.ts +2 -3
- package/dist/sketching/sketches.d.ts +5 -6
- package/dist/sketching.cjs +19 -18
- package/dist/sketching.d.ts +8 -5
- package/dist/sketching.js +3 -2
- package/dist/{solidBuilders-DACzFqvX.cjs → solidBuilders-CX_197Xm.cjs} +3 -3
- package/dist/{solidBuilders-BuS5ByIl.js → solidBuilders-Xs7VDMGD.js} +3 -3
- package/dist/{surfaceBuilders-CbH4FIW5.cjs → surfaceBuilders-CYeTNW33.cjs} +25 -3
- package/dist/{surfaceBuilders-BVH2SL-z.js → surfaceBuilders-CinmHCbZ.js} +20 -4
- package/dist/text/fontRegistry.d.ts +22 -0
- package/dist/text/sketchText.d.ts +30 -0
- package/dist/text/textBlueprints.d.ts +0 -91
- package/dist/text/textMetrics.d.ts +39 -0
- package/dist/text.cjs +9 -0
- package/dist/text.d.ts +12 -0
- package/dist/text.js +3 -0
- package/dist/textBlueprints-Do6xNsLt.js +643 -0
- package/dist/textBlueprints-oWhiABaY.cjs +800 -0
- package/dist/textMetrics-BjJ8sn_e.js +69 -0
- package/dist/textMetrics-CUvtglQE.cjs +86 -0
- package/dist/topology/adjacencyFns.d.ts +0 -1
- package/dist/topology/api.d.ts +0 -1
- package/dist/topology/apiTypes.d.ts +0 -1
- package/dist/topology/booleanDiagnosticFns.d.ts +0 -1
- package/dist/topology/booleanFns.d.ts +0 -1
- package/dist/topology/cast.d.ts +0 -1
- package/dist/topology/chamferAngleFns.d.ts +0 -1
- package/dist/topology/compoundOpsFns.d.ts +0 -1
- package/dist/topology/curveBuilders.d.ts +12 -1
- package/dist/topology/curveFns.d.ts +0 -1
- package/dist/topology/evolutionFns.d.ts +0 -1
- package/dist/topology/faceFns.d.ts +0 -1
- package/dist/topology/healingFns.d.ts +0 -1
- package/dist/topology/hullFns.d.ts +0 -1
- package/dist/topology/index.d.ts +0 -1
- package/dist/topology/meshCache.d.ts +0 -1
- package/dist/topology/meshFns.d.ts +0 -1
- package/dist/topology/metadata/colorFns.d.ts +0 -1
- package/dist/topology/metadata/faceTagFns.d.ts +0 -1
- package/dist/topology/metadata/metadataPropagation.d.ts +0 -1
- package/dist/topology/metadata/originTrackingFns.d.ts +0 -1
- package/dist/topology/minkowskiFns.d.ts +0 -1
- package/dist/topology/modifierFns.d.ts +0 -1
- package/dist/topology/nurbsFns.d.ts +0 -1
- package/dist/topology/polyhedronFns.d.ts +0 -1
- package/dist/topology/positionFns.d.ts +0 -1
- package/dist/topology/primitiveFns.d.ts +0 -1
- package/dist/topology/shapeBooleans.d.ts +0 -1
- package/dist/topology/shapeFns.d.ts +0 -1
- package/dist/topology/shapeHelpers.d.ts +0 -1
- package/dist/topology/shapeModifiers.d.ts +0 -1
- package/dist/topology/shapeRef/index.d.ts +0 -1
- package/dist/topology/shapeRef/scoring.d.ts +0 -1
- package/dist/topology/shapeRef/shapeRefFns.d.ts +0 -1
- package/dist/topology/shapeRef/shapeRefTypes.d.ts +0 -1
- package/dist/topology/shapeUtils.d.ts +0 -1
- package/dist/topology/solidBuilders.d.ts +0 -1
- package/dist/topology/surfaceBuilders.d.ts +0 -1
- package/dist/topology/surfaceFns.d.ts +0 -1
- package/dist/topology/threeHelpers.d.ts +0 -1
- package/dist/topology/topologyQueryFns.d.ts +0 -1
- package/dist/topology/transformFns.d.ts +0 -1
- package/dist/topology/wrapperFns.d.ts +0 -1
- package/dist/topology.cjs +18 -17
- package/dist/topology.d.ts +0 -1
- package/dist/topology.js +7 -6
- package/dist/{faceFns-22idS-ht.cjs → topologyQueryFns-BU0qdNJP.cjs} +2 -342
- package/dist/{faceFns-NbWd8-iR.js → topologyQueryFns-Dhf85ZBK.js} +3 -217
- package/dist/utils/arrayAccess.d.ts +0 -1
- package/dist/utils/bug.d.ts +0 -1
- package/dist/utils/ioFilename.d.ts +0 -1
- package/dist/utils/precisionRound.d.ts +0 -1
- package/dist/utils/range.d.ts +0 -1
- package/dist/utils/uuid.d.ts +0 -1
- package/dist/utils/vec2d.d.ts +0 -1
- package/dist/utils/vec3.d.ts +8 -1
- package/dist/utils/zip.d.ts +0 -1
- package/dist/vec3-BRj3eI54.js +25 -0
- package/dist/vec3-S4Oh59IX.cjs +36 -0
- package/dist/vectors.cjs +4 -4
- package/dist/vectors.d.ts +0 -1
- package/dist/vectors.js +4 -4
- package/dist/worker/index.d.ts +0 -1
- package/dist/worker/protocol.d.ts +0 -1
- package/dist/worker/taskQueue.d.ts +0 -1
- package/dist/worker/workerClient.d.ts +0 -1
- package/dist/worker/workerHandler.d.ts +0 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.ts +0 -1
- package/dist/worker.js +1 -1
- package/package.json +35 -14
- package/dist/2d/blueprints/blueprint.d.ts.map +0 -1
- package/dist/2d/blueprints/blueprintApproximations.d.ts.map +0 -1
- package/dist/2d/blueprints/blueprintCustomCorners.d.ts.map +0 -1
- package/dist/2d/blueprints/blueprintFns.d.ts.map +0 -1
- package/dist/2d/blueprints/blueprintOffset.d.ts.map +0 -1
- package/dist/2d/blueprints/blueprints.d.ts.map +0 -1
- package/dist/2d/blueprints/boolean2D.d.ts.map +0 -1
- package/dist/2d/blueprints/booleanHelpers.d.ts.map +0 -1
- package/dist/2d/blueprints/booleanOperations.d.ts.map +0 -1
- package/dist/2d/blueprints/cannedBlueprints.d.ts.map +0 -1
- package/dist/2d/blueprints/compoundBlueprint.d.ts.map +0 -1
- package/dist/2d/blueprints/index.d.ts.map +0 -1
- package/dist/2d/blueprints/intersectionSegments.d.ts.map +0 -1
- package/dist/2d/blueprints/lib.d.ts.map +0 -1
- package/dist/2d/blueprints/segmentAssembly.d.ts.map +0 -1
- package/dist/2d/blueprints/svg.d.ts.map +0 -1
- package/dist/2d/curve2dGeometryFns.d.ts.map +0 -1
- package/dist/2d/curves.d.ts.map +0 -1
- package/dist/2d/lib/approximations.d.ts.map +0 -1
- package/dist/2d/lib/boundingBox2d.d.ts.map +0 -1
- package/dist/2d/lib/curve2D.d.ts.map +0 -1
- package/dist/2d/lib/curve2dFns.d.ts.map +0 -1
- package/dist/2d/lib/customCorners.d.ts.map +0 -1
- package/dist/2d/lib/definitions.d.ts.map +0 -1
- package/dist/2d/lib/index.d.ts.map +0 -1
- package/dist/2d/lib/intersections.d.ts.map +0 -1
- package/dist/2d/lib/makeCurves.d.ts.map +0 -1
- package/dist/2d/lib/offset.d.ts.map +0 -1
- package/dist/2d/lib/precision.d.ts.map +0 -1
- package/dist/2d/lib/stitching.d.ts.map +0 -1
- package/dist/2d/lib/svgPath.d.ts.map +0 -1
- package/dist/2d/lib/utils.d.ts.map +0 -1
- package/dist/2d/lib/vectorOperations.d.ts.map +0 -1
- package/dist/2d.d.ts.map +0 -1
- package/dist/core/constants.d.ts.map +0 -1
- package/dist/core/curve2dHandle.d.ts.map +0 -1
- package/dist/core/dimensionTypes.d.ts.map +0 -1
- package/dist/core/disposal.d.ts.map +0 -1
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/kernelBoundary.d.ts.map +0 -1
- package/dist/core/kernelCall.d.ts.map +0 -1
- package/dist/core/kernelErrorTranslation.d.ts.map +0 -1
- package/dist/core/planeOps.d.ts.map +0 -1
- package/dist/core/planeTypes.d.ts.map +0 -1
- package/dist/core/result.d.ts.map +0 -1
- package/dist/core/shapeTypeCache.d.ts.map +0 -1
- package/dist/core/shapeTypes.d.ts.map +0 -1
- package/dist/core/typeDiscriminants.d.ts.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/validityTypes.d.ts.map +0 -1
- package/dist/core/vecOps.d.ts.map +0 -1
- package/dist/core.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/io/dxfExportFns.d.ts.map +0 -1
- package/dist/io/dxfImportFns.d.ts.map +0 -1
- package/dist/io/gltfExportFns.d.ts.map +0 -1
- package/dist/io/gltfImportFns.d.ts.map +0 -1
- package/dist/io/importFns.d.ts.map +0 -1
- package/dist/io/ioUtils.d.ts.map +0 -1
- package/dist/io/objExportFns.d.ts.map +0 -1
- package/dist/io/objImportFns.d.ts.map +0 -1
- package/dist/io/stepConfigFns.d.ts.map +0 -1
- package/dist/io/svgImportFns.d.ts.map +0 -1
- package/dist/io/threemfExportFns.d.ts.map +0 -1
- package/dist/io/threemfImportFns.d.ts.map +0 -1
- package/dist/io.d.ts.map +0 -1
- package/dist/kernel/brepkit/booleanOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/brepkitAdapter.d.ts.map +0 -1
- package/dist/kernel/brepkit/brepkitWasmTypes.d.ts.map +0 -1
- package/dist/kernel/brepkit/constructionOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/geometryOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/helpers.d.ts.map +0 -1
- package/dist/kernel/brepkit/internalOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/ioOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/kernel2dOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/measureOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/meshOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/modifierOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/repairOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/sketchOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/sweepOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/topologyOps.d.ts.map +0 -1
- package/dist/kernel/brepkit/transformOps.d.ts.map +0 -1
- package/dist/kernel/geometry2d.d.ts.map +0 -1
- package/dist/kernel/index.d.ts.map +0 -1
- package/dist/kernel/interfaces/booleanOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/builderOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/core.d.ts.map +0 -1
- package/dist/kernel/interfaces/curveOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/evolutionOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/index.d.ts.map +0 -1
- package/dist/kernel/interfaces/ioOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/measureOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/meshOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/modifierOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/primitiveOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/repairOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/surfaceOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/sweepOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/topologyOps.d.ts.map +0 -1
- package/dist/kernel/interfaces/transformOps.d.ts.map +0 -1
- package/dist/kernel/kernel2dTypes.d.ts.map +0 -1
- package/dist/kernel/occt/advancedOps.d.ts.map +0 -1
- package/dist/kernel/occt/booleanBatchOps.d.ts.map +0 -1
- package/dist/kernel/occt/booleanOps.d.ts.map +0 -1
- package/dist/kernel/occt/booleanPipelineOps.d.ts.map +0 -1
- package/dist/kernel/occt/constructorOps.d.ts.map +0 -1
- package/dist/kernel/occt/curveOps.d.ts.map +0 -1
- package/dist/kernel/occt/defaultAdapter.d.ts.map +0 -1
- package/dist/kernel/occt/evolutionOps.d.ts.map +0 -1
- package/dist/kernel/occt/extendedConstructorOps.d.ts.map +0 -1
- package/dist/kernel/occt/geometryQueryOps.d.ts.map +0 -1
- package/dist/kernel/occt/healingOps.d.ts.map +0 -1
- package/dist/kernel/occt/historyOps.d.ts.map +0 -1
- package/dist/kernel/occt/hullOps.d.ts.map +0 -1
- package/dist/kernel/occt/ioOps.d.ts.map +0 -1
- package/dist/kernel/occt/kernel2dOps.d.ts.map +0 -1
- package/dist/kernel/occt/measureOps.d.ts.map +0 -1
- package/dist/kernel/occt/meshOps.d.ts.map +0 -1
- package/dist/kernel/occt/modifierOps.d.ts.map +0 -1
- package/dist/kernel/occt/nurbsQueryOps.d.ts.map +0 -1
- package/dist/kernel/occt/sweepOps.d.ts.map +0 -1
- package/dist/kernel/occt/topologyOps.d.ts.map +0 -1
- package/dist/kernel/occt/transformOps.d.ts.map +0 -1
- package/dist/kernel/occt/wasmTypes/externals.d.ts.map +0 -1
- package/dist/kernel/occt/wasmTypes/index.d.ts.map +0 -1
- package/dist/kernel/occt/wasmTypes/occtBuilders.d.ts.map +0 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.d.ts.map +0 -1
- package/dist/kernel/occtWasm/occtWasmTypes.d.ts.map +0 -1
- package/dist/kernel/perfStats.d.ts.map +0 -1
- package/dist/kernel/solverAdapter.d.ts.map +0 -1
- package/dist/kernel/types.d.ts.map +0 -1
- package/dist/measurement/interferenceFns.d.ts.map +0 -1
- package/dist/measurement/measureCache.d.ts.map +0 -1
- package/dist/measurement/measureFns.d.ts.map +0 -1
- package/dist/measurement/measureTypes.d.ts.map +0 -1
- package/dist/measurement.d.ts.map +0 -1
- package/dist/ns/booleans.d.ts.map +0 -1
- package/dist/ns/construction.d.ts.map +0 -1
- package/dist/ns/ioNs.d.ts.map +0 -1
- package/dist/ns/measurement.d.ts.map +0 -1
- package/dist/ns/modifiers.d.ts.map +0 -1
- package/dist/ns/patterns.d.ts.map +0 -1
- package/dist/ns/primitives.d.ts.map +0 -1
- package/dist/ns/query.d.ts.map +0 -1
- package/dist/ns/transforms.d.ts.map +0 -1
- package/dist/occtWasmAdapter-CuZRRioz.cjs +0 -3947
- package/dist/occtWasmAdapter-DIhUXubY.js +0 -3834
- package/dist/operations/api.d.ts.map +0 -1
- package/dist/operations/assemblyFns.d.ts.map +0 -1
- package/dist/operations/compoundOpsFns.d.ts.map +0 -1
- package/dist/operations/convexHullFns.d.ts.map +0 -1
- package/dist/operations/exporterFns.d.ts.map +0 -1
- package/dist/operations/exporterUtils.d.ts.map +0 -1
- package/dist/operations/exporters.d.ts.map +0 -1
- package/dist/operations/extrudeFns.d.ts.map +0 -1
- package/dist/operations/extrudeUtils.d.ts.map +0 -1
- package/dist/operations/guidedSweepFns.d.ts.map +0 -1
- package/dist/operations/historyFns.d.ts.map +0 -1
- package/dist/operations/loftFns.d.ts.map +0 -1
- package/dist/operations/mateFns.d.ts.map +0 -1
- package/dist/operations/multiSweepFns.d.ts.map +0 -1
- package/dist/operations/patternFns.d.ts.map +0 -1
- package/dist/operations/roofFns.d.ts.map +0 -1
- package/dist/operations/straightSkeleton.d.ts.map +0 -1
- package/dist/operations/sweepFns.d.ts.map +0 -1
- package/dist/operations.d.ts.map +0 -1
- package/dist/projection/cameraFns.d.ts.map +0 -1
- package/dist/projection/makeProjectedEdges.d.ts.map +0 -1
- package/dist/projection/projectionPlanes.d.ts.map +0 -1
- package/dist/query/cornerFinder.d.ts.map +0 -1
- package/dist/query/directionUtils.d.ts.map +0 -1
- package/dist/query/edgeFinder.d.ts.map +0 -1
- package/dist/query/faceFinder.d.ts.map +0 -1
- package/dist/query/finderCore.d.ts.map +0 -1
- package/dist/query/finderFns.d.ts.map +0 -1
- package/dist/query/helpers.d.ts.map +0 -1
- package/dist/query/shapeDistanceFilter.d.ts.map +0 -1
- package/dist/query/shapeFinders.d.ts.map +0 -1
- package/dist/query/vertexFinder.d.ts.map +0 -1
- package/dist/query/wireFinder.d.ts.map +0 -1
- package/dist/query.d.ts.map +0 -1
- package/dist/quick.d.ts.map +0 -1
- package/dist/result.d.ts.map +0 -1
- package/dist/shapeRef.d.ts.map +0 -1
- package/dist/sketching/cannedSketches.d.ts.map +0 -1
- package/dist/sketching/compoundSketch.d.ts.map +0 -1
- package/dist/sketching/draw.d.ts.map +0 -1
- package/dist/sketching/draw3d.d.ts.map +0 -1
- package/dist/sketching/drawFns.d.ts.map +0 -1
- package/dist/sketching/ellipseUtils.d.ts.map +0 -1
- package/dist/sketching/shortcuts.d.ts.map +0 -1
- package/dist/sketching/sketch.d.ts.map +0 -1
- package/dist/sketching/sketchFns.d.ts.map +0 -1
- package/dist/sketching/sketchLib.d.ts +0 -47
- package/dist/sketching/sketchLib.d.ts.map +0 -1
- package/dist/sketching/sketchUtils.d.ts +0 -8
- package/dist/sketching/sketchUtils.d.ts.map +0 -1
- package/dist/sketching/sketcher.d.ts.map +0 -1
- package/dist/sketching/sketcher2d.d.ts.map +0 -1
- package/dist/sketching/sketcherlib.d.ts.map +0 -1
- package/dist/sketching/sketches.d.ts.map +0 -1
- package/dist/sketching.d.ts.map +0 -1
- package/dist/text/textBlueprints.d.ts.map +0 -1
- package/dist/topology/adjacencyFns.d.ts.map +0 -1
- package/dist/topology/api.d.ts.map +0 -1
- package/dist/topology/apiTypes.d.ts.map +0 -1
- package/dist/topology/booleanDiagnosticFns.d.ts.map +0 -1
- package/dist/topology/booleanFns.d.ts.map +0 -1
- package/dist/topology/cast.d.ts.map +0 -1
- package/dist/topology/chamferAngleFns.d.ts.map +0 -1
- package/dist/topology/compoundOpsFns.d.ts.map +0 -1
- package/dist/topology/curveBuilders.d.ts.map +0 -1
- package/dist/topology/curveFns.d.ts.map +0 -1
- package/dist/topology/evolutionFns.d.ts.map +0 -1
- package/dist/topology/faceFns.d.ts.map +0 -1
- package/dist/topology/healingFns.d.ts.map +0 -1
- package/dist/topology/hullFns.d.ts.map +0 -1
- package/dist/topology/index.d.ts.map +0 -1
- package/dist/topology/meshCache.d.ts.map +0 -1
- package/dist/topology/meshFns.d.ts.map +0 -1
- package/dist/topology/metadata/colorFns.d.ts.map +0 -1
- package/dist/topology/metadata/faceTagFns.d.ts.map +0 -1
- package/dist/topology/metadata/metadataPropagation.d.ts.map +0 -1
- package/dist/topology/metadata/originTrackingFns.d.ts.map +0 -1
- package/dist/topology/minkowskiFns.d.ts.map +0 -1
- package/dist/topology/modifierFns.d.ts.map +0 -1
- package/dist/topology/nurbsFns.d.ts.map +0 -1
- package/dist/topology/polyhedronFns.d.ts.map +0 -1
- package/dist/topology/positionFns.d.ts.map +0 -1
- package/dist/topology/primitiveFns.d.ts.map +0 -1
- package/dist/topology/shapeBooleans.d.ts.map +0 -1
- package/dist/topology/shapeFns.d.ts.map +0 -1
- package/dist/topology/shapeHelpers.d.ts.map +0 -1
- package/dist/topology/shapeModifiers.d.ts.map +0 -1
- package/dist/topology/shapeRef/index.d.ts.map +0 -1
- package/dist/topology/shapeRef/scoring.d.ts.map +0 -1
- package/dist/topology/shapeRef/shapeRefFns.d.ts.map +0 -1
- package/dist/topology/shapeRef/shapeRefTypes.d.ts.map +0 -1
- package/dist/topology/shapeUtils.d.ts.map +0 -1
- package/dist/topology/solidBuilders.d.ts.map +0 -1
- package/dist/topology/surfaceBuilders.d.ts.map +0 -1
- package/dist/topology/surfaceFns.d.ts.map +0 -1
- package/dist/topology/threeHelpers.d.ts.map +0 -1
- package/dist/topology/topologyQueryFns.d.ts.map +0 -1
- package/dist/topology/transformFns.d.ts.map +0 -1
- package/dist/topology/wrapperFns.d.ts.map +0 -1
- package/dist/topology.d.ts.map +0 -1
- package/dist/utils/arrayAccess.d.ts.map +0 -1
- package/dist/utils/bug.d.ts.map +0 -1
- package/dist/utils/ioFilename.d.ts.map +0 -1
- package/dist/utils/precisionRound.d.ts.map +0 -1
- package/dist/utils/range.d.ts.map +0 -1
- package/dist/utils/uuid.d.ts.map +0 -1
- package/dist/utils/vec2d.d.ts.map +0 -1
- package/dist/utils/vec3.d.ts.map +0 -1
- package/dist/utils/zip.d.ts.map +0 -1
- package/dist/vectors.d.ts.map +0 -1
- package/dist/worker/index.d.ts.map +0 -1
- package/dist/worker/protocol.d.ts.map +0 -1
- package/dist/worker/taskQueue.d.ts.map +0 -1
- package/dist/worker/workerClient.d.ts.map +0 -1
- package/dist/worker/workerHandler.d.ts.map +0 -1
- package/dist/worker.d.ts.map +0 -1
- /package/dist/{arrayAccess-DsnQpdSD.cjs → arrayAccess-7pTWqkJu.cjs} +0 -0
- /package/dist/{arrayAccess-tCIbjLs5.js → arrayAccess-C5IWcxs9.js} +0 -0
- /package/dist/{constants-csSEYddm.js → constants-Ci5CA3aZ.js} +0 -0
- /package/dist/{constants-BNP_xnBN.cjs → constants-DTorLmes.cjs} +0 -0
- /package/dist/{types--GD-LVc6.js → types-BIdk_GJY.js} +0 -0
- /package/dist/{types-gLi9wL0N.cjs → types-CDkxah-M.cjs} +0 -0
- /package/dist/{vecOps-CODplJp3.cjs → vecOps-D7xplSx8.cjs} +0 -0
- /package/dist/{vecOps-B-PCHgyB.js → vecOps-DVROrqTV.js} +0 -0
- /package/dist/{workerHandler-C-3cFcsQ.cjs → workerHandler-C7seK7H-.cjs} +0 -0
- /package/dist/{workerHandler-Dm0_0F8Z.js → workerHandler-DaulgMax.js} +0 -0
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* brepjs/text — Font loading and text-to-geometry conversion.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { loadFont, sketchText } from 'brepjs/text';
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
9
|
+
export { loadFont, getFont } from './text/fontRegistry.js';
|
|
10
|
+
export { textBlueprints } from './text/textBlueprints.js';
|
|
11
|
+
export { sketchText } from './text/sketchText.js';
|
|
12
|
+
export { textMetrics, fontMetrics, type TextMetricsResult, type FontMetricsResult, } from './text/textMetrics.js';
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-Do6xNsLt.js";
|
|
2
|
+
import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-BjJ8sn_e.js";
|
|
3
|
+
export { fontMetrics, getFont, loadFont, sketchText, textBlueprints, textMetrics };
|
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
import { X as getKernel, h as isShape3D, o as createFace, p as isFace, t as castShape, u as createWire } from "./shapeTypes-C--1jaT1.js";
|
|
2
|
+
import { A as ok, R as unwrap, T as isOk, b as err, d as validationError, h as bug, i as kernelError, l as typeCastError, r as ioError, t as BrepErrorCode } from "./errors-0fYW_YnO.js";
|
|
3
|
+
import { r as toVec3 } from "./types-BIdk_GJY.js";
|
|
4
|
+
import { d as vecNormalize, h as vecScale, r as vecCross } from "./vecOps-DVROrqTV.js";
|
|
5
|
+
import { n as createPlane } from "./planeOps-4i2qEraD.js";
|
|
6
|
+
import { _ as downcast, g as cast } from "./faceFns-BFWz17_E.js";
|
|
7
|
+
import { c as curveStartPoint, l as curveTangentAt } from "./curveFns-B4tWuinR.js";
|
|
8
|
+
import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-C5IWcxs9.js";
|
|
9
|
+
import { i as makeNewFaceWithinFace, r as makeFace, t as addHolesInFace } from "./surfaceBuilders-CinmHCbZ.js";
|
|
10
|
+
import { r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-xDsl9GXO.js";
|
|
11
|
+
import { o as makeSolid, t as makeCompound } from "./solidBuilders-Xs7VDMGD.js";
|
|
12
|
+
import { c as sweep, i as complexExtrude, l as twistExtrude, r as revolve, t as extrude } from "./extrudeFns-7pE8dIWz.js";
|
|
13
|
+
import opentype from "opentype.js";
|
|
14
|
+
//#region src/operations/loftFns.ts
|
|
15
|
+
/**
|
|
16
|
+
* Functional loft operation using branded shape types.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Loft through a set of wire profiles to create a 3D shape.
|
|
20
|
+
*
|
|
21
|
+
* Builds a `BRepOffsetAPI_ThruSections` surface through the given wires,
|
|
22
|
+
* optionally starting and/or ending at point vertices. Produces a solid
|
|
23
|
+
* by default, or a shell when `returnShell` is `true`.
|
|
24
|
+
*
|
|
25
|
+
* @param wires - Ordered wire profiles to loft through.
|
|
26
|
+
* @param config - Loft configuration (ruled interpolation, start/end points).
|
|
27
|
+
* @param returnShell - When `true`, return a shell instead of a solid.
|
|
28
|
+
* @returns `Result` containing the lofted 3D shape, or an error on failure.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const result = loft([bottomWire, topWire], { ruled: false });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link loft!loft | loft} for the OOP API equivalent.
|
|
36
|
+
*/
|
|
37
|
+
function loft(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 } = {}, returnShell = false) {
|
|
38
|
+
if (wires.length === 0 && !startPoint && !endPoint) return err(validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
39
|
+
const kernel = getKernel();
|
|
40
|
+
const startVertex = startPoint ? kernel.makeVertex(...toVec3(startPoint)) : void 0;
|
|
41
|
+
const endVertex = endPoint ? kernel.makeVertex(...toVec3(endPoint)) : void 0;
|
|
42
|
+
try {
|
|
43
|
+
const result = castShape(kernel.loftAdvanced(wires.map((w) => w.wrapped), {
|
|
44
|
+
solid: !returnShell,
|
|
45
|
+
ruled,
|
|
46
|
+
tolerance,
|
|
47
|
+
...startVertex ? { startVertex } : {},
|
|
48
|
+
...endVertex ? { endVertex } : {}
|
|
49
|
+
}));
|
|
50
|
+
if (!isShape3D(result)) return err(typeCastError("LOFT_NOT_3D", "Loft did not produce a 3D shape"));
|
|
51
|
+
return ok(result);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
return err(kernelError("LOFT_FAILED", "Loft operation failed", e, void 0, "Common causes: wire profiles with different edge counts, self-intersecting result, or profiles too far apart. Ensure profiles are compatible and ordered."));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Batch loft: build N independent lofts in a single kernel call.
|
|
58
|
+
*
|
|
59
|
+
* Uses the C++ LoftBatch extractor when available (single WASM call),
|
|
60
|
+
* falling back to N individual loft operations otherwise.
|
|
61
|
+
*
|
|
62
|
+
* @returns Array of 3D shapes, one per entry.
|
|
63
|
+
*/
|
|
64
|
+
function loftAll(entries) {
|
|
65
|
+
if (entries.length === 0) return ok([]);
|
|
66
|
+
const kernel = getKernel();
|
|
67
|
+
const verticesToDelete = [];
|
|
68
|
+
const kernelEntries = entries.map((e) => {
|
|
69
|
+
const startVertex = e.startPoint ? kernel.makeVertex(...toVec3(e.startPoint)) : void 0;
|
|
70
|
+
const endVertex = e.endPoint ? kernel.makeVertex(...toVec3(e.endPoint)) : void 0;
|
|
71
|
+
if (startVertex) verticesToDelete.push(startVertex);
|
|
72
|
+
if (endVertex) verticesToDelete.push(endVertex);
|
|
73
|
+
return {
|
|
74
|
+
wires: e.wires.map((w) => w.wrapped),
|
|
75
|
+
solid: true,
|
|
76
|
+
ruled: e.ruled ?? true,
|
|
77
|
+
tolerance: e.tolerance ?? 1e-6,
|
|
78
|
+
startVertex,
|
|
79
|
+
endVertex
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
try {
|
|
83
|
+
const shapes = kernel.loftBatch?.(kernelEntries) ?? kernelEntries.map((e) => kernel.loftAdvanced(e.wires, {
|
|
84
|
+
solid: e.solid,
|
|
85
|
+
ruled: e.ruled,
|
|
86
|
+
tolerance: e.tolerance,
|
|
87
|
+
startVertex: e.startVertex,
|
|
88
|
+
endVertex: e.endVertex
|
|
89
|
+
}));
|
|
90
|
+
const results = [];
|
|
91
|
+
for (const shape of shapes) {
|
|
92
|
+
const cast = castShape(shape);
|
|
93
|
+
if (!isShape3D(cast)) return err(typeCastError("LOFT_ALL_NOT_3D", "Batch loft entry did not produce a 3D shape"));
|
|
94
|
+
results.push(cast);
|
|
95
|
+
}
|
|
96
|
+
return ok(results);
|
|
97
|
+
} catch (e) {
|
|
98
|
+
return err(kernelError("LOFT_ALL_FAILED", "Batch loft operation failed", e));
|
|
99
|
+
} finally {
|
|
100
|
+
for (const v of verticesToDelete) kernel.dispose(v);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/sketching/compoundSketch.ts
|
|
105
|
+
/**
|
|
106
|
+
* Represent a face with holes as a group of sketches (one outer + zero or more inner).
|
|
107
|
+
*
|
|
108
|
+
* All contained sketches must share the same base surface. The first sketch is
|
|
109
|
+
* treated as the outer boundary; subsequent sketches define holes.
|
|
110
|
+
*
|
|
111
|
+
* Typically produced from a {@link CompoundBlueprint} via `sketchOnPlane`.
|
|
112
|
+
*
|
|
113
|
+
* The class methods are thin delegations to the canonical functions in
|
|
114
|
+
* `sketchFns.ts` (`compoundSketchExtrude`, `compoundSketchRevolve`, etc.).
|
|
115
|
+
*
|
|
116
|
+
* @see {@link Sketch} for single-wire profiles without holes.
|
|
117
|
+
* @category Sketching
|
|
118
|
+
*/
|
|
119
|
+
var CompoundSketch = class {
|
|
120
|
+
sketches;
|
|
121
|
+
constructor(sketches) {
|
|
122
|
+
if (sketches.length === 0) bug("CompoundSketch", "Cannot create CompoundSketch with an empty array of sketches");
|
|
123
|
+
this.sketches = sketches;
|
|
124
|
+
}
|
|
125
|
+
/** Release all kernel resources held by every sub-sketch. */
|
|
126
|
+
delete() {
|
|
127
|
+
this.sketches.forEach((sketch) => {
|
|
128
|
+
sketch.delete();
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/** Get the outer boundary sketch (the first in the array). */
|
|
132
|
+
get outerSketch() {
|
|
133
|
+
return firstOrThrow(this.sketches);
|
|
134
|
+
}
|
|
135
|
+
/** Get the hole sketches (all but the first). */
|
|
136
|
+
get innerSketches() {
|
|
137
|
+
return this.sketches.slice(1);
|
|
138
|
+
}
|
|
139
|
+
/** Return all wires (outer + holes) combined into a compound shape. */
|
|
140
|
+
get wires() {
|
|
141
|
+
return compoundSketchWires(this);
|
|
142
|
+
}
|
|
143
|
+
/** Build a face from the outer boundary with inner wires subtracted as holes. */
|
|
144
|
+
face() {
|
|
145
|
+
return compoundSketchFace(this);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Extrude the compound face (with holes) along the default or given direction.
|
|
149
|
+
*
|
|
150
|
+
* Supports twist and profile extrusions. For twist/profile modes each
|
|
151
|
+
* sub-sketch is extruded as a shell, then capped into a solid.
|
|
152
|
+
*/
|
|
153
|
+
extrude(extrusionDistance, config = {}) {
|
|
154
|
+
return compoundSketchExtrude(this, extrusionDistance, config);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Revolves the drawing on an axis (defined by its direction and an origin
|
|
158
|
+
* (defaults to the sketch origin)
|
|
159
|
+
*/
|
|
160
|
+
revolve(revolutionAxis, config = {}) {
|
|
161
|
+
return compoundSketchRevolve(this, revolutionAxis, config);
|
|
162
|
+
}
|
|
163
|
+
/** Loft between this compound sketch and another with matching sub-sketch counts. */
|
|
164
|
+
loftWith(otherCompound, loftConfig) {
|
|
165
|
+
return compoundSketchLoft(this, otherCompound, loftConfig);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/sketching/sketchFns.ts
|
|
170
|
+
/** Wrap SketchData into a Sketch instance. */
|
|
171
|
+
function wrapSketchData(data) {
|
|
172
|
+
const opts = {};
|
|
173
|
+
if (data.defaultOrigin) opts.defaultOrigin = data.defaultOrigin;
|
|
174
|
+
if (data.defaultDirection) opts.defaultDirection = data.defaultDirection;
|
|
175
|
+
const sketch = new Sketch(data.wire, opts);
|
|
176
|
+
if (data.baseFace) sketch.baseFace = data.baseFace;
|
|
177
|
+
return sketch;
|
|
178
|
+
}
|
|
179
|
+
/** Wrap an array of SketchData into a CompoundSketch. */
|
|
180
|
+
function wrapSketchDataArray(dataArr) {
|
|
181
|
+
return new CompoundSketch(dataArr.map(wrapSketchData));
|
|
182
|
+
}
|
|
183
|
+
/** Build a face from a sketch's closed planar wire. */
|
|
184
|
+
function sketchFace(sketch) {
|
|
185
|
+
let face;
|
|
186
|
+
if (!sketch.baseFace) face = unwrap(makeFace(sketch.wire));
|
|
187
|
+
else face = makeNewFaceWithinFace(sketch.baseFace, sketch.wire);
|
|
188
|
+
return face;
|
|
189
|
+
}
|
|
190
|
+
/** Return an independent clone of the sketch's wire. */
|
|
191
|
+
function sketchWires(sketch) {
|
|
192
|
+
return createWire(unwrap(downcast(sketch.wire.wrapped)));
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Revolve a sketch around an axis to produce a solid of revolution.
|
|
196
|
+
*
|
|
197
|
+
* @remarks Consumes the sketch — calling twice throws on the second call.
|
|
198
|
+
*/
|
|
199
|
+
function sketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
200
|
+
const face = unwrap(makeFace(sketch.wire));
|
|
201
|
+
const solid = unwrap(revolve(face, origin ? toVec3(origin) : sketch.defaultOrigin, revolutionAxis ? toVec3(revolutionAxis) : [
|
|
202
|
+
0,
|
|
203
|
+
0,
|
|
204
|
+
1
|
|
205
|
+
]));
|
|
206
|
+
face.delete();
|
|
207
|
+
sketch.delete();
|
|
208
|
+
return solid;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Extrude a sketch to a given distance.
|
|
212
|
+
*
|
|
213
|
+
* Supports profile (taper) extrusion via `extrusionProfile`, twist extrusion
|
|
214
|
+
* via `twistAngle`, and direction/origin overrides.
|
|
215
|
+
*
|
|
216
|
+
* @remarks Consumes the sketch — calling twice throws on the second call.
|
|
217
|
+
*/
|
|
218
|
+
function sketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
|
|
219
|
+
const extrusionVec = vecScale(vecNormalize(extrusionDirection ? toVec3(extrusionDirection) : sketch.defaultDirection), extrusionDistance);
|
|
220
|
+
const originVec = origin ? toVec3(origin) : sketch.defaultOrigin;
|
|
221
|
+
if (extrusionProfile && !twistAngle) {
|
|
222
|
+
const solid = unwrap(complexExtrude(sketch.wire, [...originVec], [...extrusionVec], extrusionProfile));
|
|
223
|
+
sketch.delete();
|
|
224
|
+
return solid;
|
|
225
|
+
}
|
|
226
|
+
if (twistAngle) {
|
|
227
|
+
const solid = unwrap(twistExtrude(sketch.wire, twistAngle, [...originVec], [...extrusionVec], extrusionProfile));
|
|
228
|
+
sketch.delete();
|
|
229
|
+
return solid;
|
|
230
|
+
}
|
|
231
|
+
const solid = unwrap(extrude(unwrap(makeFace(sketch.wire)), [...extrusionVec]));
|
|
232
|
+
sketch.delete();
|
|
233
|
+
return solid;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Sweep a profile sketch (built by `sketchOnPlane`) along this sketch's wire path.
|
|
237
|
+
*
|
|
238
|
+
* @remarks Consumes both this sketch and the one returned by `sketchOnPlane` —
|
|
239
|
+
* calling either twice throws on the second call.
|
|
240
|
+
*/
|
|
241
|
+
function sketchSweep(sketch, sketchOnPlane, sweepConfig = {}) {
|
|
242
|
+
const startPoint = curveStartPoint(sketch.wire);
|
|
243
|
+
const normal = vecNormalize(vecScale(curveTangentAt(sketch.wire, 1e-9), -1));
|
|
244
|
+
const defaultDir = sketch.defaultDirection;
|
|
245
|
+
const xDir = vecScale(vecCross(normal, defaultDir), -1);
|
|
246
|
+
const result = sketchOnPlane(createPlane([...startPoint], [...xDir], [...normal]), [...startPoint]);
|
|
247
|
+
let profile;
|
|
248
|
+
if ("sketches" in result && Array.isArray(result.sketches)) {
|
|
249
|
+
const pieces = result.sketches;
|
|
250
|
+
profile = pieces[0];
|
|
251
|
+
for (let i = 1; i < pieces.length; i++) pieces[i]?.delete();
|
|
252
|
+
} else profile = result;
|
|
253
|
+
const config = {
|
|
254
|
+
forceProfileSpineOthogonality: true,
|
|
255
|
+
...sweepConfig
|
|
256
|
+
};
|
|
257
|
+
if (sketch.baseFace) config.support = sketch.baseFace.wrapped;
|
|
258
|
+
const shape = unwrap(sweep(profile.wire, sketch.wire, config));
|
|
259
|
+
sketch.delete();
|
|
260
|
+
return shape;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Loft between this sketch and one or more other sketches.
|
|
264
|
+
*
|
|
265
|
+
* @remarks Consumes all input sketches — calling twice throws on the second call.
|
|
266
|
+
*/
|
|
267
|
+
function sketchLoft(sketch, otherSketches, loftConfig = {}, returnShell = false) {
|
|
268
|
+
const sketchArray = Array.isArray(otherSketches) ? [sketch, ...otherSketches] : [sketch, otherSketches];
|
|
269
|
+
const shape = unwrap(loft(sketchArray.map((s) => s.wire), loftConfig, returnShell));
|
|
270
|
+
sketchArray.forEach((s) => {
|
|
271
|
+
s.delete();
|
|
272
|
+
});
|
|
273
|
+
return shape;
|
|
274
|
+
}
|
|
275
|
+
var guessFaceFromWires = (wires) => {
|
|
276
|
+
const wireShapes = wires.map((w) => w.wrapped);
|
|
277
|
+
const newFace = unwrap(cast(getKernel().fillSurface(wireShapes)));
|
|
278
|
+
if (!isFace(newFace)) bug("guessFaceFromWires", "Failed to create a face");
|
|
279
|
+
return newFace;
|
|
280
|
+
};
|
|
281
|
+
var fixWire = (wire, baseFace) => {
|
|
282
|
+
return createWire(getKernel().fixWireOnFace(wire.wrapped, baseFace.wrapped, 1e-9));
|
|
283
|
+
};
|
|
284
|
+
var faceFromWires = (wires) => {
|
|
285
|
+
let baseFace;
|
|
286
|
+
let holeWires;
|
|
287
|
+
const faceResult = makeFace(firstOrThrow(wires));
|
|
288
|
+
if (isOk(faceResult)) {
|
|
289
|
+
baseFace = faceResult.value;
|
|
290
|
+
holeWires = wires.slice(1);
|
|
291
|
+
} else {
|
|
292
|
+
baseFace = guessFaceFromWires(wires);
|
|
293
|
+
holeWires = wires.slice(1).map((w) => fixWire(w, baseFace));
|
|
294
|
+
}
|
|
295
|
+
return addHolesInFace(baseFace, holeWires);
|
|
296
|
+
};
|
|
297
|
+
var solidFromShellGenerator = (sketches, shellGenerator) => {
|
|
298
|
+
const shells = [];
|
|
299
|
+
const startWires = [];
|
|
300
|
+
const endWires = [];
|
|
301
|
+
sketches.forEach((sketch) => {
|
|
302
|
+
const [shell, startWire, endWire] = unwrap(shellGenerator(sketch));
|
|
303
|
+
shells.push(shell);
|
|
304
|
+
startWires.push(startWire);
|
|
305
|
+
endWires.push(endWire);
|
|
306
|
+
});
|
|
307
|
+
const startFace = faceFromWires(startWires);
|
|
308
|
+
const endFace = faceFromWires(endWires);
|
|
309
|
+
return unwrap(makeSolid([
|
|
310
|
+
startFace,
|
|
311
|
+
...shells,
|
|
312
|
+
endFace
|
|
313
|
+
]));
|
|
314
|
+
};
|
|
315
|
+
/** Build a face from a compound sketch (outer boundary with holes). */
|
|
316
|
+
function compoundSketchFace(sketch) {
|
|
317
|
+
return addHolesInFace(sketch.outerSketch.face(), sketch.innerSketches.map((s) => s.wire));
|
|
318
|
+
}
|
|
319
|
+
/** Return all wires (outer + holes) combined into a compound shape. */
|
|
320
|
+
function compoundSketchWires(sketch) {
|
|
321
|
+
return makeCompound(sketch.sketches.map((s) => s.wire));
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Extrude a compound sketch (outer + holes) along the default or given direction.
|
|
325
|
+
*
|
|
326
|
+
* Supports twist and profile extrusions. For twist/profile modes each
|
|
327
|
+
* sub-sketch is extruded as a shell, then capped into a solid.
|
|
328
|
+
*/
|
|
329
|
+
function compoundSketchExtrude(sketch, extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
|
|
330
|
+
const extrusionVec = vecScale(vecNormalize(extrusionDirection ? toVec3(extrusionDirection) : sketch.outerSketch.defaultDirection), extrusionDistance);
|
|
331
|
+
if (extrusionProfile && !twistAngle) return solidFromShellGenerator(sketch.sketches, (s) => complexExtrude(s.wire, origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile, true));
|
|
332
|
+
if (twistAngle) return solidFromShellGenerator(sketch.sketches, (s) => twistExtrude(s.wire, twistAngle, origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin, extrusionVec, extrusionProfile, true));
|
|
333
|
+
return unwrap(extrude(compoundSketchFace(sketch), extrusionVec));
|
|
334
|
+
}
|
|
335
|
+
/** Revolve a compound sketch (outer + holes) around an axis. */
|
|
336
|
+
function compoundSketchRevolve(sketch, revolutionAxis, { origin } = {}) {
|
|
337
|
+
const center = origin ? toVec3(origin) : sketch.outerSketch.defaultOrigin;
|
|
338
|
+
const dir = revolutionAxis ? toVec3(revolutionAxis) : [
|
|
339
|
+
0,
|
|
340
|
+
0,
|
|
341
|
+
1
|
|
342
|
+
];
|
|
343
|
+
return unwrap(revolve(compoundSketchFace(sketch), center, dir));
|
|
344
|
+
}
|
|
345
|
+
/** Loft between two compound sketches with matching sub-sketch counts. */
|
|
346
|
+
function compoundSketchLoft(sketch, other, loftConfig) {
|
|
347
|
+
if (sketch.sketches.length !== other.sketches.length) bug("CompoundSketch.loftWith", "You need to loft with another compound with the same number of sketches");
|
|
348
|
+
const shells = sketch.sketches.map((base, cIndex) => {
|
|
349
|
+
const outer = getAtOrThrow(other.sketches, cIndex);
|
|
350
|
+
const loftOpts = {};
|
|
351
|
+
if (loftConfig.ruled !== void 0) loftOpts.ruled = loftConfig.ruled;
|
|
352
|
+
return base.clone().loftWith(outer.clone(), loftOpts, true);
|
|
353
|
+
});
|
|
354
|
+
const baseFace = createFace(unwrap(downcast(compoundSketchFace(sketch).wrapped)));
|
|
355
|
+
shells.push(baseFace, compoundSketchFace(other));
|
|
356
|
+
return unwrap(makeSolid(shells));
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/sketching/sketch.ts
|
|
360
|
+
/**
|
|
361
|
+
* Represent a closed or open wire profile with a default extrusion origin and direction.
|
|
362
|
+
*
|
|
363
|
+
* A Sketch wraps a single {@link Wire} and carries metadata (origin, direction,
|
|
364
|
+
* optional base face) so that downstream operations like {@link Sketch.extrude},
|
|
365
|
+
* {@link Sketch.revolve}, {@link Sketch.sweepSketch}, and {@link Sketch.loftWith}
|
|
366
|
+
* know how to act on it without extra arguments.
|
|
367
|
+
*
|
|
368
|
+
* The class methods are thin delegations to the canonical functions in
|
|
369
|
+
* `sketchFns.ts` (`sketchExtrude`, `sketchRevolve`, etc.). New functionality
|
|
370
|
+
* should be added there.
|
|
371
|
+
*
|
|
372
|
+
* @remarks Most operations consume (delete) the sketch after producing a solid.
|
|
373
|
+
*
|
|
374
|
+
* @see {@link Sketcher} to build a Sketch interactively.
|
|
375
|
+
* @see {@link CompoundSketch} for multi-wire (outer + holes) profiles.
|
|
376
|
+
* @category Sketching
|
|
377
|
+
*/
|
|
378
|
+
var Sketch = class Sketch {
|
|
379
|
+
/**
|
|
380
|
+
* The wire is typed as `ClosedWire & PlanarWire` to reflect the contract at
|
|
381
|
+
* Sketcher boundaries: `Sketcher.close()`, `closeWithMirror()`,
|
|
382
|
+
* `closeWithCustomCorner()`, and the canned-sketch factories all produce
|
|
383
|
+
* closed planar wires. Callers constructing `Sketch` from an arbitrary
|
|
384
|
+
* `Wire` must assert validity at the construction site.
|
|
385
|
+
*/
|
|
386
|
+
wire;
|
|
387
|
+
/**
|
|
388
|
+
* @ignore
|
|
389
|
+
*/
|
|
390
|
+
_defaultOrigin;
|
|
391
|
+
/**
|
|
392
|
+
* @ignore
|
|
393
|
+
*/
|
|
394
|
+
_defaultDirection;
|
|
395
|
+
_baseFace;
|
|
396
|
+
constructor(wire, { defaultOrigin = [
|
|
397
|
+
0,
|
|
398
|
+
0,
|
|
399
|
+
0
|
|
400
|
+
], defaultDirection = [
|
|
401
|
+
0,
|
|
402
|
+
0,
|
|
403
|
+
1
|
|
404
|
+
] } = {}) {
|
|
405
|
+
this.wire = wire;
|
|
406
|
+
this._defaultOrigin = toVec3(defaultOrigin);
|
|
407
|
+
this._defaultDirection = toVec3(defaultDirection);
|
|
408
|
+
this.baseFace = null;
|
|
409
|
+
}
|
|
410
|
+
get baseFace() {
|
|
411
|
+
return this._baseFace;
|
|
412
|
+
}
|
|
413
|
+
set baseFace(newFace) {
|
|
414
|
+
if (this._baseFace) this._baseFace.delete();
|
|
415
|
+
this._baseFace = newFace ? createFace(unwrap(downcast(newFace.wrapped))) : newFace;
|
|
416
|
+
}
|
|
417
|
+
/** Release all kernel resources held by this sketch. */
|
|
418
|
+
delete() {
|
|
419
|
+
this.wire.delete();
|
|
420
|
+
if (this.baseFace) this.baseFace.delete();
|
|
421
|
+
}
|
|
422
|
+
/** Create an independent deep copy of this sketch. */
|
|
423
|
+
clone() {
|
|
424
|
+
const sketch = new Sketch(createWire(unwrap(downcast(this.wire.wrapped))), {
|
|
425
|
+
defaultOrigin: this.defaultOrigin,
|
|
426
|
+
defaultDirection: this.defaultDirection
|
|
427
|
+
});
|
|
428
|
+
if (this.baseFace) sketch.baseFace = createFace(unwrap(downcast(this.baseFace.wrapped)));
|
|
429
|
+
return sketch;
|
|
430
|
+
}
|
|
431
|
+
/** Get the 3D origin used as default for extrusion and revolution. */
|
|
432
|
+
get defaultOrigin() {
|
|
433
|
+
return this._defaultOrigin;
|
|
434
|
+
}
|
|
435
|
+
/** Set the 3D origin used as default for extrusion and revolution. */
|
|
436
|
+
set defaultOrigin(newOrigin) {
|
|
437
|
+
this._defaultOrigin = toVec3(newOrigin);
|
|
438
|
+
}
|
|
439
|
+
/** Get the default extrusion/normal direction. */
|
|
440
|
+
get defaultDirection() {
|
|
441
|
+
return this._defaultDirection;
|
|
442
|
+
}
|
|
443
|
+
/** Set the default extrusion/normal direction. */
|
|
444
|
+
set defaultDirection(newDirection) {
|
|
445
|
+
this._defaultDirection = toVec3(newDirection);
|
|
446
|
+
}
|
|
447
|
+
/** Transforms the lines into a face. The lines should be closed. */
|
|
448
|
+
face() {
|
|
449
|
+
return sketchFace(this);
|
|
450
|
+
}
|
|
451
|
+
/** Return a clone of the underlying wire. */
|
|
452
|
+
wires() {
|
|
453
|
+
return sketchWires(this);
|
|
454
|
+
}
|
|
455
|
+
/** Alias for {@link Sketch.face}. */
|
|
456
|
+
faces() {
|
|
457
|
+
return this.face();
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Revolves the drawing on an axis (defined by its direction and an origin
|
|
461
|
+
* (defaults to the sketch origin)
|
|
462
|
+
*
|
|
463
|
+
* @remarks Consumes the sketch — calling this twice throws on the second call.
|
|
464
|
+
*/
|
|
465
|
+
revolve(revolutionAxis, config = {}) {
|
|
466
|
+
return sketchRevolve(this, revolutionAxis, config);
|
|
467
|
+
}
|
|
468
|
+
/** Extrudes the sketch to a certain distance (along the default direction
|
|
469
|
+
* and origin of the sketch).
|
|
470
|
+
*
|
|
471
|
+
* You can define another extrusion direction or origin,
|
|
472
|
+
*
|
|
473
|
+
* It is also possible to twist extrude with an angle (in degrees), or to
|
|
474
|
+
* give a profile to the extrusion (the endFactor will scale the face, and
|
|
475
|
+
* the profile will define how the scale is applied (either linearly or with
|
|
476
|
+
* a s-shape).
|
|
477
|
+
*
|
|
478
|
+
* @remarks Consumes the sketch — calling this twice throws on the second call.
|
|
479
|
+
*/
|
|
480
|
+
extrude(extrusionDistance, config = {}) {
|
|
481
|
+
return sketchExtrude(this, extrusionDistance, config);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Sweep along this sketch another sketch defined in the function
|
|
485
|
+
* `sketchOnPlane`.
|
|
486
|
+
*
|
|
487
|
+
* @remarks Consumes both this sketch and the one returned by `sketchOnPlane` —
|
|
488
|
+
* calling either consumer twice throws on the second call.
|
|
489
|
+
*/
|
|
490
|
+
sweepSketch(sketchOnPlane, sweepConfig = {}) {
|
|
491
|
+
return sketchSweep(this, sketchOnPlane, sweepConfig);
|
|
492
|
+
}
|
|
493
|
+
/** Loft between this sketch and another sketch (or an array of them)
|
|
494
|
+
*
|
|
495
|
+
* You can also define a `startPoint` for the loft (that will be placed
|
|
496
|
+
* before this sketch) and an `endPoint` after the last one.
|
|
497
|
+
*
|
|
498
|
+
* You can also define if you want the loft to result in a ruled surface.
|
|
499
|
+
*
|
|
500
|
+
* Note that all sketches will be deleted by this operation
|
|
501
|
+
*/
|
|
502
|
+
loftWith(otherSketches, loftConfig = {}, returnShell = false) {
|
|
503
|
+
return sketchLoft(this, otherSketches, loftConfig, returnShell);
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/sketching/sketches.ts
|
|
508
|
+
/**
|
|
509
|
+
* Batch wrapper around multiple {@link Sketch} or {@link CompoundSketch} instances.
|
|
510
|
+
*
|
|
511
|
+
* Applies the same operation (extrude, revolve, etc.) to every contained sketch
|
|
512
|
+
* and returns the results combined into a single compound shape.
|
|
513
|
+
*
|
|
514
|
+
* @category Sketching
|
|
515
|
+
*/
|
|
516
|
+
var Sketches = class {
|
|
517
|
+
sketches;
|
|
518
|
+
constructor(sketches) {
|
|
519
|
+
this.sketches = sketches;
|
|
520
|
+
}
|
|
521
|
+
/** Return all wires combined into a single compound shape. */
|
|
522
|
+
wires() {
|
|
523
|
+
return makeCompound(this.sketches.map((s) => s instanceof Sketch ? s.wire : s.wires));
|
|
524
|
+
}
|
|
525
|
+
/** Return all sketch faces combined into a single compound shape. */
|
|
526
|
+
faces() {
|
|
527
|
+
return makeCompound(this.sketches.map((s) => s.face()));
|
|
528
|
+
}
|
|
529
|
+
/** Extrudes the sketch to a certain distance (along the default direction
|
|
530
|
+
* and origin of the sketch).
|
|
531
|
+
*
|
|
532
|
+
* You can define another extrusion direction or origin,
|
|
533
|
+
*
|
|
534
|
+
* It is also possible to twist extrude with an angle (in degrees), or to
|
|
535
|
+
* give a profile to the extrusion (the endFactor will scale the face, and
|
|
536
|
+
* the profile will define how the scale is applied (either linearly or with
|
|
537
|
+
* a s-shape).
|
|
538
|
+
*/
|
|
539
|
+
extrude(extrusionDistance, extrusionConfig = {}) {
|
|
540
|
+
return makeCompound(this.sketches.map((s) => s.extrude(extrusionDistance, extrusionConfig)));
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Revolves the drawing on an axis (defined by its direction and an origin
|
|
544
|
+
* (defaults to the sketch origin)
|
|
545
|
+
*/
|
|
546
|
+
revolve(revolutionAxis, config) {
|
|
547
|
+
return makeCompound(this.sketches.map((s) => s.revolve(revolutionAxis, config)));
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region src/text/fontRegistry.ts
|
|
552
|
+
var FONT_REGISTER = {};
|
|
553
|
+
/**
|
|
554
|
+
* Load and register an OpenType/TrueType font for use with text drawing functions.
|
|
555
|
+
*
|
|
556
|
+
* The font is fetched (if a URL string) or parsed (if an ArrayBuffer) and
|
|
557
|
+
* stored in an internal registry keyed by `fontFamily`. The first font loaded
|
|
558
|
+
* is also registered as `'default'`.
|
|
559
|
+
*
|
|
560
|
+
* @param fontPath - URL string or raw ArrayBuffer of the font file.
|
|
561
|
+
* @param fontFamily - Registry key for later retrieval (defaults to `'default'`).
|
|
562
|
+
* @param force - If true, overwrite a previously loaded font with the same key.
|
|
563
|
+
* @returns The parsed opentype.js Font object.
|
|
564
|
+
*/
|
|
565
|
+
async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
566
|
+
if (!force && FONT_REGISTER[fontFamily]) return ok(FONT_REGISTER[fontFamily]);
|
|
567
|
+
let fontData;
|
|
568
|
+
if (typeof fontPath === "string") {
|
|
569
|
+
let response;
|
|
570
|
+
try {
|
|
571
|
+
response = await fetch(fontPath);
|
|
572
|
+
} catch (e) {
|
|
573
|
+
return err(ioError(BrepErrorCode.FONT_FETCH_FAILED, `Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
574
|
+
}
|
|
575
|
+
if (!response.ok) return err(ioError(BrepErrorCode.FONT_FETCH_FAILED, `Failed to fetch font from ${fontPath}: HTTP ${response.status} ${response.statusText}`));
|
|
576
|
+
fontData = await response.arrayBuffer();
|
|
577
|
+
} else fontData = fontPath;
|
|
578
|
+
let font;
|
|
579
|
+
try {
|
|
580
|
+
font = opentype.parse(fontData);
|
|
581
|
+
} catch (e) {
|
|
582
|
+
return err(ioError(BrepErrorCode.FONT_PARSE_FAILED, `Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`, e));
|
|
583
|
+
}
|
|
584
|
+
const typedFont = font;
|
|
585
|
+
FONT_REGISTER[fontFamily] = typedFont;
|
|
586
|
+
if (!FONT_REGISTER["default"]) FONT_REGISTER["default"] = typedFont;
|
|
587
|
+
return ok(typedFont);
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Retrieve a previously loaded font by family name.
|
|
591
|
+
*
|
|
592
|
+
* @param fontFamily - Registry key (defaults to `'default'`).
|
|
593
|
+
* @returns The opentype.js Font object, or `undefined` if not loaded.
|
|
594
|
+
*/
|
|
595
|
+
var getFont = (fontFamily = "default") => {
|
|
596
|
+
return FONT_REGISTER[fontFamily];
|
|
597
|
+
};
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/text/textBlueprints.ts
|
|
600
|
+
var sketchFontCommands = function* (commands) {
|
|
601
|
+
let sk = null;
|
|
602
|
+
let lastPoint = null;
|
|
603
|
+
for (const command of commands) {
|
|
604
|
+
if (command.type === "Z") {
|
|
605
|
+
if (sk) yield sk.close();
|
|
606
|
+
sk = null;
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
const p = [-command.x, command.y];
|
|
610
|
+
if (command.type === "M") {
|
|
611
|
+
if (sk) yield sk.done();
|
|
612
|
+
sk = new BlueprintSketcher();
|
|
613
|
+
sk.movePointerTo(p);
|
|
614
|
+
lastPoint = p;
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
if (lastPoint && Math.abs(p[0] - lastPoint[0]) < 1e-9 && Math.abs(p[1] - lastPoint[1]) < 1e-9) continue;
|
|
618
|
+
if (command.type === "L") sk?.lineTo(p);
|
|
619
|
+
if (command.type === "C") sk?.cubicBezierCurveTo(p, [-command.x1, command.y1], [-command.x2, command.y2]);
|
|
620
|
+
if (command.type === "Q") sk?.quadraticBezierCurveTo(p, [-command.x1, command.y1]);
|
|
621
|
+
lastPoint = p;
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
/**
|
|
625
|
+
* Convert a text string into 2D Blueprints using a loaded font.
|
|
626
|
+
*
|
|
627
|
+
* Each glyph outline is traced as a series of line/bezier curves, then
|
|
628
|
+
* organised into a {@link Blueprints} collection (outer contours + holes).
|
|
629
|
+
*
|
|
630
|
+
* @param text - The string to render.
|
|
631
|
+
* @returns A Blueprints instance representing the text outlines.
|
|
632
|
+
*
|
|
633
|
+
* @remarks Requires a font to be loaded via {@link loadFont} before use.
|
|
634
|
+
*/
|
|
635
|
+
function textBlueprints(text, { startX = 0, startY = 0, fontSize = 16, fontFamily = "default" } = {}) {
|
|
636
|
+
let font = getFont(fontFamily);
|
|
637
|
+
if (!font) font = getFont();
|
|
638
|
+
if (!font) bug("text", "No fonts loaded. Call loadFont() before using text functions.");
|
|
639
|
+
const writtenText = font.getPath(text, -startX, -startY, fontSize);
|
|
640
|
+
return organiseBlueprints(Array.from(sketchFontCommands(writtenText.commands))).mirror([0, 0]);
|
|
641
|
+
}
|
|
642
|
+
//#endregion
|
|
643
|
+
export { wrapSketchDataArray as _, Sketch as a, loftAll 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, loft as y };
|