@faicad/faijs 0.29.5 → 0.30.9
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/NOTICE +6 -5
- package/dist/api/api-namespace.d.ts +1 -1
- package/dist/api/api-namespace.d.ts.map +1 -1
- package/dist/api/api-namespace.js +53 -1
- package/dist/api/api-namespace.js.map +1 -1
- package/dist/api/appearance.d.ts +0 -2
- package/dist/api/appearance.d.ts.map +1 -1
- package/dist/api/appearance.js +0 -2
- package/dist/api/appearance.js.map +1 -1
- package/dist/api/assembly/entities.d.ts +1 -1
- package/dist/api/assembly/entities.js +1 -1
- package/dist/api/assembly/entities.js.map +1 -1
- package/dist/api/assembly/index.d.ts +1 -1
- package/dist/api/assembly/index.js +1 -1
- package/dist/api/assembly/index.js.map +1 -1
- package/dist/api/assembly/joints.d.ts +33 -15
- package/dist/api/assembly/joints.d.ts.map +1 -1
- package/dist/api/assembly/joints.js +31 -13
- package/dist/api/assembly/joints.js.map +1 -1
- package/dist/api/assembly/preview.d.ts +1 -1
- package/dist/api/assembly/preview.js +1 -1
- package/dist/api/assembly/preview.js.map +1 -1
- package/dist/api/assembly/solve.d.ts +1 -1
- package/dist/api/assembly/solve.js +1 -1
- package/dist/api/assembly/solve.js.map +1 -1
- package/dist/api/assembly/solvers/assembly-tree.d.ts +1 -1
- package/dist/api/assembly/solvers/assembly-tree.js +1 -1
- package/dist/api/assembly/solvers/assembly-tree.js.map +1 -1
- package/dist/api/assembly/solvers/chain-solver.d.ts +2 -2
- package/dist/api/assembly/solvers/chain-solver.js.map +1 -1
- package/dist/api/assembly/solvers/global-solver.d.ts +1 -2
- package/dist/api/assembly/solvers/global-solver.d.ts.map +1 -1
- package/dist/api/assembly/solvers/global-solver.js +3 -4
- package/dist/api/assembly/solvers/global-solver.js.map +1 -1
- package/dist/api/assembly/solvers/joints-kinematics.js +1 -1
- package/dist/api/assembly/solvers/joints-kinematics.js.map +1 -1
- package/dist/api/assembly/solvers/linalg.d.ts +2 -2
- package/dist/api/assembly/solvers/linalg.js +2 -2
- package/dist/api/assembly/solvers/linalg.js.map +1 -1
- package/dist/api/assembly/solvers/types.d.ts +2 -5
- package/dist/api/assembly/solvers/types.d.ts.map +1 -1
- package/dist/api/assembly/solvers/types.js +1 -4
- package/dist/api/assembly/solvers/types.js.map +1 -1
- package/dist/api/boolean.d.ts.map +1 -1
- package/dist/api/boolean.js +7 -6
- package/dist/api/boolean.js.map +1 -1
- package/dist/api/brep-mirror/booleanFns.d.ts +3 -3
- package/dist/api/brep-mirror/booleanFns.js +5 -5
- package/dist/api/brep-mirror/booleanFns.js.map +1 -1
- package/dist/api/brep-mirror/compoundFns.d.ts +1 -1
- package/dist/api/brep-mirror/compoundFns.js +4 -4
- package/dist/api/brep-mirror/compoundFns.js.map +1 -1
- package/dist/api/brep-mirror/healingFns.d.ts +4 -4
- package/dist/api/brep-mirror/healingFns.js +4 -4
- package/dist/api/brep-mirror/healingFns.js.map +1 -1
- package/dist/api/brep-mirror/hullFns.d.ts +2 -2
- package/dist/api/brep-mirror/hullFns.js +2 -2
- package/dist/api/brep-mirror/hullFns.js.map +1 -1
- package/dist/api/brep-mirror/patternFns.d.ts +5 -5
- package/dist/api/brep-mirror/patternFns.js +10 -10
- package/dist/api/brep-mirror/patternFns.js.map +1 -1
- package/dist/api/brep-mirror/primitiveFns.d.ts +4 -4
- package/dist/api/brep-mirror/primitiveFns.js +4 -4
- package/dist/api/brep-mirror/primitiveFns.js.map +1 -1
- package/dist/api/brep-mirror/roofFns.d.ts +3 -3
- package/dist/api/brep-mirror/roofFns.js +7 -7
- package/dist/api/brep-mirror/roofFns.js.map +1 -1
- package/dist/api/brep-mirror/sweepFns.d.ts +7 -7
- package/dist/api/brep-mirror/sweepFns.js +14 -14
- package/dist/api/brep-mirror/sweepFns.js.map +1 -1
- package/dist/api/brep-mirror/threadFns.d.ts +1 -1
- package/dist/api/brep-mirror/threadFns.js +1 -1
- package/dist/api/brep-mirror/threadFns.js.map +1 -1
- package/dist/api/brep-mirror/topologyFns.d.ts +5 -5
- package/dist/api/brep-mirror/topologyFns.js +8 -8
- package/dist/api/brep-mirror/topologyFns.js.map +1 -1
- package/dist/api/brep-operations/booleanFns.d.ts +40 -0
- package/dist/api/brep-operations/booleanFns.d.ts.map +1 -0
- package/dist/api/brep-operations/booleanFns.js +104 -0
- package/dist/api/brep-operations/booleanFns.js.map +1 -0
- package/dist/api/brep-operations/brepHelpers.d.ts +55 -0
- package/dist/api/brep-operations/brepHelpers.d.ts.map +1 -0
- package/dist/api/brep-operations/brepHelpers.js +131 -0
- package/dist/api/brep-operations/brepHelpers.js.map +1 -0
- package/dist/api/brep-operations/compoundFns.d.ts +46 -0
- package/dist/api/brep-operations/compoundFns.d.ts.map +1 -0
- package/dist/api/brep-operations/compoundFns.js +299 -0
- package/dist/api/brep-operations/compoundFns.js.map +1 -0
- package/dist/api/brep-operations/healingFns.d.ts +78 -0
- package/dist/api/brep-operations/healingFns.d.ts.map +1 -0
- package/dist/api/brep-operations/healingFns.js +294 -0
- package/dist/api/brep-operations/healingFns.js.map +1 -0
- package/dist/api/brep-operations/hullFns.d.ts +20 -0
- package/dist/api/brep-operations/hullFns.d.ts.map +1 -0
- package/dist/api/brep-operations/hullFns.js +46 -0
- package/dist/api/brep-operations/hullFns.js.map +1 -0
- package/dist/api/brep-operations/joinery-brep.d.ts +172 -0
- package/dist/api/brep-operations/joinery-brep.d.ts.map +1 -0
- package/dist/api/brep-operations/joinery-brep.js +463 -0
- package/dist/api/brep-operations/joinery-brep.js.map +1 -0
- package/dist/api/brep-operations/patternFns.d.ts +43 -0
- package/dist/api/brep-operations/patternFns.d.ts.map +1 -0
- package/dist/api/brep-operations/patternFns.js +178 -0
- package/dist/api/brep-operations/patternFns.js.map +1 -0
- package/dist/api/brep-operations/primitiveFns.d.ts +42 -0
- package/dist/api/brep-operations/primitiveFns.d.ts.map +1 -0
- package/dist/api/brep-operations/primitiveFns.js +104 -0
- package/dist/api/brep-operations/primitiveFns.js.map +1 -0
- package/dist/api/brep-operations/roofFns.d.ts +24 -0
- package/dist/api/brep-operations/roofFns.d.ts.map +1 -0
- package/dist/api/brep-operations/roofFns.js +229 -0
- package/dist/api/brep-operations/roofFns.js.map +1 -0
- package/dist/api/brep-operations/straightSkeleton.d.ts +36 -0
- package/dist/api/brep-operations/straightSkeleton.d.ts.map +1 -0
- package/dist/api/brep-operations/straightSkeleton.js +431 -0
- package/dist/api/brep-operations/straightSkeleton.js.map +1 -0
- package/dist/api/brep-operations/sweepFns.d.ts +60 -0
- package/dist/api/brep-operations/sweepFns.d.ts.map +1 -0
- package/dist/api/brep-operations/sweepFns.js +323 -0
- package/dist/api/brep-operations/sweepFns.js.map +1 -0
- package/dist/api/brep-operations/threadFns.d.ts +83 -0
- package/dist/api/brep-operations/threadFns.d.ts.map +1 -0
- package/dist/api/brep-operations/threadFns.js +138 -0
- package/dist/api/brep-operations/threadFns.js.map +1 -0
- package/dist/api/brep-operations/topologyFns.d.ts +90 -0
- package/dist/api/brep-operations/topologyFns.d.ts.map +1 -0
- package/dist/api/brep-operations/topologyFns.js +276 -0
- package/dist/api/brep-operations/topologyFns.js.map +1 -0
- package/dist/api/brep-topology.d.ts +1 -1
- package/dist/api/brep-topology.d.ts.map +1 -1
- package/dist/api/brep-topology.js +1 -1
- package/dist/api/brep-topology.js.map +1 -1
- package/dist/api/brepjs-compat/index.d.ts +1 -1
- package/dist/api/brepjs-compat/index.js +3 -3
- package/dist/api/brepjs-compat/index.js.map +1 -1
- package/dist/api/cadquery-selectors/borrow-bridge.d.ts.map +1 -1
- package/dist/api/cadquery-selectors/borrow-bridge.js +3 -4
- package/dist/api/cadquery-selectors/borrow-bridge.js.map +1 -1
- package/dist/api/curve-sketch/index.d.ts +235 -0
- package/dist/api/curve-sketch/index.d.ts.map +1 -0
- package/dist/api/curve-sketch/index.js +487 -0
- package/dist/api/curve-sketch/index.js.map +1 -0
- package/dist/api/engrave.d.ts.map +1 -1
- package/dist/api/engrave.js +3 -2
- package/dist/api/engrave.js.map +1 -1
- package/dist/api/export-brep.d.ts +41 -0
- package/dist/api/export-brep.d.ts.map +1 -0
- package/dist/api/export-brep.js +58 -0
- package/dist/api/export-brep.js.map +1 -0
- package/dist/api/export-stl.d.ts +50 -0
- package/dist/api/export-stl.d.ts.map +1 -0
- package/dist/api/export-stl.js +99 -0
- package/dist/api/export-stl.js.map +1 -0
- package/dist/api/extrude.d.ts +8 -11
- package/dist/api/extrude.d.ts.map +1 -1
- package/dist/api/extrude.js +11 -14
- package/dist/api/extrude.js.map +1 -1
- package/dist/api/fillet-variable.d.ts +2 -2
- package/dist/api/fillet-variable.js +2 -2
- package/dist/api/fillet-variable.js.map +1 -1
- package/dist/api/fillet.d.ts +2 -4
- package/dist/api/fillet.d.ts.map +1 -1
- package/dist/api/fillet.js +2 -4
- package/dist/api/fillet.js.map +1 -1
- package/dist/api/generated/2d.d.ts +4 -0
- package/dist/api/generated/2d.d.ts.map +1 -1
- package/dist/api/generated/2d.js +4 -0
- package/dist/api/generated/2d.js.map +1 -1
- package/dist/api/generated/core.d.ts +4 -0
- package/dist/api/generated/core.d.ts.map +1 -1
- package/dist/api/generated/core.js +4 -0
- package/dist/api/generated/core.js.map +1 -1
- package/dist/api/generated/gear.d.ts +4 -0
- package/dist/api/generated/gear.d.ts.map +1 -1
- package/dist/api/generated/gear.js +4 -0
- package/dist/api/generated/gear.js.map +1 -1
- package/dist/api/generated/io.d.ts +4 -0
- package/dist/api/generated/io.d.ts.map +1 -1
- package/dist/api/generated/io.js +4 -0
- package/dist/api/generated/io.js.map +1 -1
- package/dist/api/generated/kernel.d.ts +4 -0
- package/dist/api/generated/kernel.d.ts.map +1 -1
- package/dist/api/generated/kernel.js +4 -0
- package/dist/api/generated/kernel.js.map +1 -1
- package/dist/api/generated/measurement.d.ts +21 -21
- package/dist/api/generated/measurement.d.ts.map +1 -1
- package/dist/api/generated/measurement.js +25 -21
- package/dist/api/generated/measurement.js.map +1 -1
- package/dist/api/generated/ns.d.ts +4 -0
- package/dist/api/generated/ns.d.ts.map +1 -1
- package/dist/api/generated/ns.js +4 -0
- package/dist/api/generated/ns.js.map +1 -1
- package/dist/api/generated/operations.d.ts +32 -32
- package/dist/api/generated/operations.d.ts.map +1 -1
- package/dist/api/generated/operations.js +52 -48
- package/dist/api/generated/operations.js.map +1 -1
- package/dist/api/generated/projection.d.ts +4 -0
- package/dist/api/generated/projection.d.ts.map +1 -1
- package/dist/api/generated/projection.js +4 -0
- package/dist/api/generated/projection.js.map +1 -1
- package/dist/api/generated/query.d.ts +4 -0
- package/dist/api/generated/query.d.ts.map +1 -1
- package/dist/api/generated/query.js +4 -0
- package/dist/api/generated/query.js.map +1 -1
- package/dist/api/generated/sketching.d.ts +2 -2
- package/dist/api/generated/sketching.d.ts.map +1 -1
- package/dist/api/generated/sketching.js +7 -3
- package/dist/api/generated/sketching.js.map +1 -1
- package/dist/api/generated/text.d.ts +4 -0
- package/dist/api/generated/text.d.ts.map +1 -1
- package/dist/api/generated/text.js +4 -0
- package/dist/api/generated/text.js.map +1 -1
- package/dist/api/generated/topology.d.ts +45 -45
- package/dist/api/generated/topology.d.ts.map +1 -1
- package/dist/api/generated/topology.js +67 -63
- package/dist/api/generated/topology.js.map +1 -1
- package/dist/api/generated/view.d.ts +4 -0
- package/dist/api/generated/view.d.ts.map +1 -1
- package/dist/api/generated/view.js +4 -0
- package/dist/api/generated/view.js.map +1 -1
- package/dist/api/geom-types/constants.d.ts +11 -0
- package/dist/api/geom-types/constants.d.ts.map +1 -0
- package/dist/api/geom-types/constants.js +11 -0
- package/dist/api/geom-types/constants.js.map +1 -0
- package/dist/api/geom-types/index.d.ts +21 -0
- package/dist/api/geom-types/index.d.ts.map +1 -0
- package/dist/api/geom-types/index.js +22 -0
- package/dist/api/geom-types/index.js.map +1 -0
- package/dist/api/geom-types/planeOps.d.ts +98 -0
- package/dist/api/geom-types/planeOps.d.ts.map +1 -0
- package/dist/api/geom-types/planeOps.js +170 -0
- package/dist/api/geom-types/planeOps.js.map +1 -0
- package/dist/api/geom-types/planeTypes.d.ts +24 -0
- package/dist/api/geom-types/planeTypes.d.ts.map +1 -0
- package/dist/api/geom-types/planeTypes.js +8 -0
- package/dist/api/geom-types/planeTypes.js.map +1 -0
- package/dist/api/geom-types/types.d.ts +64 -0
- package/dist/api/geom-types/types.d.ts.map +1 -0
- package/dist/api/geom-types/types.js +48 -0
- package/dist/api/geom-types/types.js.map +1 -0
- package/dist/api/geom-types/vecOps.d.ts +124 -0
- package/dist/api/geom-types/vecOps.d.ts.map +1 -0
- package/dist/api/geom-types/vecOps.js +202 -0
- package/dist/api/geom-types/vecOps.js.map +1 -0
- package/dist/api/geom.d.ts.map +1 -1
- package/dist/api/geom.js +6 -5
- package/dist/api/geom.js.map +1 -1
- package/dist/api/half-space.d.ts +56 -0
- package/dist/api/half-space.d.ts.map +1 -0
- package/dist/api/half-space.js +82 -0
- package/dist/api/half-space.js.map +1 -0
- package/dist/api/helix.d.ts +10 -1
- package/dist/api/helix.d.ts.map +1 -1
- package/dist/api/helix.js +19 -3
- package/dist/api/helix.js.map +1 -1
- package/dist/api/index.d.ts +15 -6
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +29 -8
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/compat-op.d.ts +4 -30
- package/dist/api/internal/compat-op.d.ts.map +1 -1
- package/dist/api/internal/compat-op.js +10 -42
- package/dist/api/internal/compat-op.js.map +1 -1
- package/dist/api/internal/compat-projection.d.ts +5 -5
- package/dist/api/internal/compat-projection.js +5 -5
- package/dist/api/internal/compat-projection.js.map +1 -1
- package/dist/api/internal/dual-form-args.d.ts +0 -2
- package/dist/api/internal/dual-form-args.d.ts.map +1 -1
- package/dist/api/internal/dual-form-args.js +1 -3
- package/dist/api/internal/dual-form-args.js.map +1 -1
- package/dist/api/internal/l3-bridge.d.ts +5 -37
- package/dist/api/internal/l3-bridge.d.ts.map +1 -1
- package/dist/api/internal/l3-bridge.js +7 -76
- package/dist/api/internal/l3-bridge.js.map +1 -1
- package/dist/api/internal/profile-wire.d.ts +1 -1
- package/dist/api/internal/profile-wire.js +1 -1
- package/dist/api/internal/profile-wire.js.map +1 -1
- package/dist/api/internal/result-unwrap.d.ts +4 -6
- package/dist/api/internal/result-unwrap.d.ts.map +1 -1
- package/dist/api/internal/result-unwrap.js +4 -6
- package/dist/api/internal/result-unwrap.js.map +1 -1
- package/dist/api/knurl.d.ts.map +1 -1
- package/dist/api/knurl.js +5 -3
- package/dist/api/knurl.js.map +1 -1
- package/dist/api/loft.d.ts +2 -2
- package/dist/api/loft.d.ts.map +1 -1
- package/dist/api/loft.js +2 -2
- package/dist/api/loft.js.map +1 -1
- package/dist/api/measurement/index.d.ts +3 -3
- package/dist/api/measurement/index.js +3 -3
- package/dist/api/measurement/index.js.map +1 -1
- package/dist/api/meta.d.ts +0 -2
- package/dist/api/meta.d.ts.map +1 -1
- package/dist/api/meta.js +0 -2
- package/dist/api/meta.js.map +1 -1
- package/dist/api/offset2d.d.ts +49 -0
- package/dist/api/offset2d.d.ts.map +1 -0
- package/dist/api/offset2d.js +86 -0
- package/dist/api/offset2d.js.map +1 -0
- package/dist/api/pattern.js +3 -3
- package/dist/api/pattern.js.map +1 -1
- package/dist/api/primitives.d.ts.map +1 -1
- package/dist/api/primitives.js +7 -6
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/replicate.d.ts +2 -2
- package/dist/api/replicate.d.ts.map +1 -1
- package/dist/api/replicate.js +12 -12
- package/dist/api/replicate.js.map +1 -1
- package/dist/api/result.d.ts +1 -1
- package/dist/api/result.js +1 -1
- package/dist/api/result.js.map +1 -1
- package/dist/api/revolve.d.ts +2 -2
- package/dist/api/revolve.js +3 -3
- package/dist/api/revolve.js.map +1 -1
- package/dist/api/screw.d.ts +1 -1
- package/dist/api/screw.d.ts.map +1 -1
- package/dist/api/screw.js +5 -4
- package/dist/api/screw.js.map +1 -1
- package/dist/api/sdf.d.ts.map +1 -1
- package/dist/api/sdf.js +3 -2
- package/dist/api/sdf.js.map +1 -1
- package/dist/api/shape-type/index.d.ts +141 -0
- package/dist/api/shape-type/index.d.ts.map +1 -0
- package/dist/api/shape-type/index.js +182 -0
- package/dist/api/shape-type/index.js.map +1 -0
- package/dist/api/shell.d.ts +2 -2
- package/dist/api/shell.js +2 -2
- package/dist/api/shell.js.map +1 -1
- package/dist/api/solid-from-faces.d.ts +45 -0
- package/dist/api/solid-from-faces.d.ts.map +1 -0
- package/dist/api/solid-from-faces.js +72 -0
- package/dist/api/solid-from-faces.js.map +1 -0
- package/dist/api/solid-offset/index.d.ts +67 -0
- package/dist/api/solid-offset/index.d.ts.map +1 -0
- package/dist/api/solid-offset/index.js +132 -0
- package/dist/api/solid-offset/index.js.map +1 -0
- package/dist/api/surface/arg-spec.d.ts +35 -33
- package/dist/api/surface/arg-spec.d.ts.map +1 -1
- package/dist/api/surface/arg-spec.js +222 -224
- package/dist/api/surface/arg-spec.js.map +1 -1
- package/dist/api/surface-face/index.d.ts +104 -0
- package/dist/api/surface-face/index.d.ts.map +1 -0
- package/dist/api/surface-face/index.js +217 -0
- package/dist/api/surface-face/index.js.map +1 -0
- package/dist/api/surface.d.ts +44 -0
- package/dist/api/surface.d.ts.map +1 -0
- package/dist/api/surface.js +66 -0
- package/dist/api/surface.js.map +1 -0
- package/dist/api/sweep.d.ts +59 -9
- package/dist/api/sweep.d.ts.map +1 -1
- package/dist/api/sweep.js +11 -6
- package/dist/api/sweep.js.map +1 -1
- package/dist/api/thicken.d.ts +1 -1
- package/dist/api/thicken.js +1 -1
- package/dist/api/thicken.js.map +1 -1
- package/dist/api/transform.d.ts +5 -5
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +11 -10
- package/dist/api/transform.js.map +1 -1
- package/dist/api/view/cameraFns.d.ts +1 -1
- package/dist/api/view/cameraFns.d.ts.map +1 -1
- package/dist/api/view/cameraFns.js +1 -1
- package/dist/api/view/cameraFns.js.map +1 -1
- package/dist/api/view/index.d.ts +0 -2
- package/dist/api/view/index.d.ts.map +1 -1
- package/dist/api/view/index.js +0 -2
- package/dist/api/view/index.js.map +1 -1
- package/dist/api/view/projectionPlanes.d.ts +1 -1
- package/dist/api/view/projectionPlanes.d.ts.map +1 -1
- package/dist/api/view/projectionPlanes.js.map +1 -1
- package/dist/api/view/view-camera.d.ts +7 -9
- package/dist/api/view/view-camera.d.ts.map +1 -1
- package/dist/api/view/view-camera.js +4 -6
- package/dist/api/view/view-camera.js.map +1 -1
- package/dist/api/view/view-projection.d.ts +0 -2
- package/dist/api/view/view-projection.d.ts.map +1 -1
- package/dist/api/view/view-projection.js +0 -2
- package/dist/api/view/view-projection.js.map +1 -1
- package/dist/api/view/view-sheet.d.ts +0 -2
- package/dist/api/view/view-sheet.d.ts.map +1 -1
- package/dist/api/view/view-sheet.js +0 -2
- package/dist/api/view/view-sheet.js.map +1 -1
- package/dist/api/view-export/index.d.ts +97 -0
- package/dist/api/view-export/index.d.ts.map +1 -0
- package/dist/api/view-export/index.js +118 -0
- package/dist/api/view-export/index.js.map +1 -0
- package/dist/brep/brep-ops.d.ts +89 -1
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +176 -10
- package/dist/brep/brep-ops.js.map +1 -1
- package/dist/brep/brep-topology.d.ts +20 -0
- package/dist/brep/brep-topology.d.ts.map +1 -1
- package/dist/brep/brep-topology.js +46 -0
- package/dist/brep/brep-topology.js.map +1 -1
- package/dist/brep/engine/adapters/occt.d.ts +1 -1
- package/dist/brep/engine/adapters/occt.js +7 -7
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/engine/primitives.d.ts +2 -3
- package/dist/brep/engine/primitives.d.ts.map +1 -1
- package/dist/brep/engine/primitives.js +1 -2
- package/dist/brep/engine/primitives.js.map +1 -1
- package/dist/brep/engine/registry.d.ts +1 -1
- package/dist/brep/engine/registry.js +1 -1
- package/dist/brep/engine/registry.js.map +1 -1
- package/dist/brep/engine/types.d.ts +2 -2
- package/dist/brep/engine/types.js.map +1 -1
- package/dist/brep/handle-bridge.d.ts +2 -2
- package/dist/brep/handle-bridge.js +2 -2
- package/dist/brep/handle-bridge.js.map +1 -1
- package/dist/brep/index.d.ts +6 -3
- package/dist/brep/index.d.ts.map +1 -1
- package/dist/brep/index.js +6 -3
- package/dist/brep/index.js.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.d.ts +1 -1
- package/dist/brepkit-kernel/brepkitKernel.js +2 -2
- package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
- package/dist/browser.d.ts +2 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +5 -4
- package/dist/browser.js.map +1 -1
- package/dist/cad-runtime/admit-compat-lib.d.ts +3 -10
- package/dist/cad-runtime/admit-compat-lib.d.ts.map +1 -1
- package/dist/cad-runtime/admit-compat-lib.js +3 -9
- package/dist/cad-runtime/admit-compat-lib.js.map +1 -1
- package/dist/cad-runtime/backend-dispatch.js +12 -3
- package/dist/cad-runtime/backend-dispatch.js.map +1 -1
- package/dist/cad-runtime/direct-executor.d.ts +6 -3
- package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
- package/dist/cad-runtime/direct-executor.js +31 -9
- package/dist/cad-runtime/direct-executor.js.map +1 -1
- package/dist/cad-runtime/interp/env.d.ts +1 -1
- package/dist/cad-runtime/interp/env.js.map +1 -1
- package/dist/cad-runtime/lib-id.d.ts +0 -2
- package/dist/cad-runtime/lib-id.d.ts.map +1 -1
- package/dist/cad-runtime/lib-id.js +0 -2
- package/dist/cad-runtime/lib-id.js.map +1 -1
- package/dist/cad-runtime/live-shapes.d.ts +3 -5
- package/dist/cad-runtime/live-shapes.d.ts.map +1 -1
- package/dist/cad-runtime/live-shapes.js +8 -10
- package/dist/cad-runtime/live-shapes.js.map +1 -1
- package/dist/cad-runtime/ports.d.ts +3 -3
- package/dist/cad-runtime/ports.js.map +1 -1
- package/dist/cad-runtime/runtime.d.ts +21 -7
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +45 -6
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +4 -3
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +2 -2
- package/dist/define-op.js.map +1 -1
- package/dist/geometry2d/bridge/plane.d.ts +1 -1
- package/dist/geometry2d/bridge/plane.js +1 -1
- package/dist/geometry2d/bridge/plane.js.map +1 -1
- package/dist/geometry2d/curve2d.d.ts +1 -1
- package/dist/geometry2d/curve2d.js +1 -1
- package/dist/geometry2d/curve2d.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/io/fai-zip/container-read.d.ts +16 -0
- package/dist/io/fai-zip/container-read.d.ts.map +1 -1
- package/dist/io/fai-zip/container-read.js +22 -0
- package/dist/io/fai-zip/container-read.js.map +1 -1
- package/dist/io/fai-zip/index.d.ts +1 -1
- package/dist/io/fai-zip/index.d.ts.map +1 -1
- package/dist/io/fai-zip/index.js +1 -1
- package/dist/io/fai-zip/index.js.map +1 -1
- package/dist/lang/code-to-args.d.ts.map +1 -1
- package/dist/lang/code-to-args.js +10 -1
- package/dist/lang/code-to-args.js.map +1 -1
- package/dist/lang/determinism-scanner.d.ts.map +1 -1
- package/dist/lang/determinism-scanner.js +22 -9
- package/dist/lang/determinism-scanner.js.map +1 -1
- package/dist/lang/metadata-extractor.d.ts +27 -6
- package/dist/lang/metadata-extractor.d.ts.map +1 -1
- package/dist/lang/metadata-extractor.js +88 -8
- package/dist/lang/metadata-extractor.js.map +1 -1
- package/dist/lang/parse-error.d.ts +4 -0
- package/dist/lang/parse-error.d.ts.map +1 -1
- package/dist/lang/parse-error.js.map +1 -1
- package/dist/lang/security-scanner.d.ts +27 -2
- package/dist/lang/security-scanner.d.ts.map +1 -1
- package/dist/lang/security-scanner.js +29 -2
- package/dist/lang/security-scanner.js.map +1 -1
- package/dist/lang/source-edit.d.ts +2 -2
- package/dist/lang/source-edit.js.map +1 -1
- package/dist/lang/symbol-table.generated.d.ts +36 -0
- package/dist/lang/symbol-table.generated.d.ts.map +1 -1
- package/dist/lang/symbol-table.generated.js +36 -0
- package/dist/lang/symbol-table.generated.js.map +1 -1
- package/dist/mesh/import-model.d.ts +94 -0
- package/dist/mesh/import-model.d.ts.map +1 -0
- package/dist/mesh/import-model.js +15 -0
- package/dist/mesh/import-model.js.map +1 -0
- package/dist/mesh/index.d.ts +19 -58
- package/dist/mesh/index.d.ts.map +1 -1
- package/dist/mesh/index.js +19 -70
- package/dist/mesh/index.js.map +1 -1
- package/dist/mesh/io.d.ts +33 -16
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +144 -39
- package/dist/mesh/io.js.map +1 -1
- package/dist/mesh/primitives.js +1 -1
- package/dist/mesh/primitives.js.map +1 -1
- package/dist/mesh/threemf-bambu.d.ts +12 -1
- package/dist/mesh/threemf-bambu.d.ts.map +1 -1
- package/dist/mesh/threemf-bambu.js +68 -16
- package/dist/mesh/threemf-bambu.js.map +1 -1
- package/dist/mesh/threemf-loader.d.ts +14 -1
- package/dist/mesh/threemf-loader.d.ts.map +1 -1
- package/dist/mesh/threemf-loader.js +24 -7
- package/dist/mesh/threemf-loader.js.map +1 -1
- package/dist/mesh/transform.d.ts +1 -1
- package/dist/mesh/transform.js +1 -1
- package/dist/mesh/transform.js.map +1 -1
- package/dist/mesh/types.d.ts +5 -5
- package/dist/mesh/types.d.ts.map +1 -1
- package/dist/mesh/types.js.map +1 -1
- package/dist/node-host/cli.d.ts +49 -1
- package/dist/node-host/cli.d.ts.map +1 -1
- package/dist/node-host/cli.js +125 -19
- package/dist/node-host/cli.js.map +1 -1
- package/dist/node-host/execute-script.d.ts +55 -0
- package/dist/node-host/execute-script.d.ts.map +1 -0
- package/dist/node-host/execute-script.js +46 -0
- package/dist/node-host/execute-script.js.map +1 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -1
- package/dist/occt-kernel/generated/occtPlatform.generated.d.ts +260 -0
- package/dist/occt-kernel/generated/occtPlatform.generated.d.ts.map +1 -0
- package/dist/occt-kernel/generated/occtPlatform.generated.js +875 -0
- package/dist/occt-kernel/generated/occtPlatform.generated.js.map +1 -0
- package/dist/occt-kernel/hullGeometry.d.ts +2 -2
- package/dist/occt-kernel/hullGeometry.js +2 -3
- package/dist/occt-kernel/hullGeometry.js.map +1 -1
- package/dist/occt-kernel/hullOps.d.ts +3 -3
- package/dist/occt-kernel/hullOps.js +4 -4
- package/dist/occt-kernel/hullOps.js.map +1 -1
- package/dist/occt-kernel/occt-primitives.d.ts.map +1 -1
- package/dist/occt-kernel/occt-primitives.js +31 -4
- package/dist/occt-kernel/occt-primitives.js.map +1 -1
- package/dist/occt-kernel/occtKernel.d.ts.map +1 -1
- package/dist/occt-kernel/occtKernel.js +18 -0
- package/dist/occt-kernel/occtKernel.js.map +1 -1
- package/dist/occt-scan/recognize.d.ts +58 -0
- package/dist/occt-scan/recognize.d.ts.map +1 -0
- package/dist/occt-scan/recognize.js +216 -0
- package/dist/occt-scan/recognize.js.map +1 -0
- package/dist/primitives/brep-primitives.js +7 -7
- package/dist/primitives/brep-primitives.js.map +1 -1
- package/dist/result/bug.d.ts +1 -1
- package/dist/result/bug.js +1 -1
- package/dist/result/bug.js.map +1 -1
- package/dist/result/errors.d.ts +2 -2
- package/dist/result/errors.d.ts.map +1 -1
- package/dist/result/errors.js +1 -1
- package/dist/result/errors.js.map +1 -1
- package/dist/result/vec3.d.ts +1 -1
- package/dist/result/vec3.js +1 -1
- package/dist/result/vec3.js.map +1 -1
- package/dist/runtime-state.d.ts +16 -0
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +27 -0
- package/dist/runtime-state.js.map +1 -1
- package/dist/script-globals.d.ts +24 -0
- package/dist/script-globals.d.ts.map +1 -0
- package/dist/script-globals.js +24 -0
- package/dist/script-globals.js.map +1 -0
- package/dist/shape.d.ts +24 -0
- package/dist/shape.d.ts.map +1 -1
- package/dist/shape.js +40 -0
- package/dist/shape.js.map +1 -1
- package/dist/topology/naming/lineage.d.ts +3 -2
- package/dist/topology/naming/lineage.d.ts.map +1 -1
- package/dist/topology/naming/lineage.js.map +1 -1
- package/dist/weapp.d.ts +1 -1
- package/dist/weapp.js +1 -1
- package/dist/weapp.js.map +1 -1
- package/package.json +8 -10
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-hosted compat-op implementations — compound feature family
|
|
3
|
+
* (core-decouple Phase 3, §5.4; drill / pocket / boss / mirrorJoin).
|
|
4
|
+
*
|
|
5
|
+
* @platform occt
|
|
6
|
+
*
|
|
7
|
+
* Argument contract (post core-decouple; handle extraction lives in
|
|
8
|
+
* `brepHelpers.ts`):
|
|
9
|
+
* - `options.face` supports an omitted default (highest-Z face) or an already
|
|
10
|
+
* constructed face handle (`{ wrapped }` / `{ id }`); a finder DSL is not
|
|
11
|
+
* supported.
|
|
12
|
+
* - `options.profile` must be an already constructed wire handle (`{ wrapped }` /
|
|
13
|
+
* `{ id }`); a drawing/sketch DSL is not supported (it is not a core data type).
|
|
14
|
+
* Intermediates (tool/profile face/positioned face) are released after use.
|
|
15
|
+
*/
|
|
16
|
+
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
17
|
+
import { type Result } from '../../result/result.js';
|
|
18
|
+
/**
|
|
19
|
+
* Drill — cut a cylinder through the shape.
|
|
20
|
+
*
|
|
21
|
+
* @param args - Resolved arguments (shape, drill options).
|
|
22
|
+
* @returns The drilled shape as a `BrepHandle`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function drillBrep(...args: unknown[]): Result<BrepHandle>;
|
|
25
|
+
/**
|
|
26
|
+
* Pocket — extrude a profile inward and cut it from the shape.
|
|
27
|
+
*
|
|
28
|
+
* @param args - Resolved arguments (shape, pocket options).
|
|
29
|
+
* @returns The pocketed shape as a `BrepHandle`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function pocketBrep(...args: unknown[]): Result<BrepHandle>;
|
|
32
|
+
/**
|
|
33
|
+
* Boss — extrude a profile outward and fuse it onto the shape.
|
|
34
|
+
*
|
|
35
|
+
* @param args - Resolved arguments (shape, boss options).
|
|
36
|
+
* @returns The shape with the boss fused as a `BrepHandle`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function bossBrep(...args: unknown[]): Result<BrepHandle>;
|
|
39
|
+
/**
|
|
40
|
+
* Mirror the shape across a plane and fuse the mirrored copy to the original.
|
|
41
|
+
*
|
|
42
|
+
* @param args - Resolved arguments (shape, mirror options).
|
|
43
|
+
* @returns The shape joined with its mirror as a `BrepHandle`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function mirrorJoinBrep(...args: unknown[]): Result<BrepHandle>;
|
|
46
|
+
//# sourceMappingURL=compoundFns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compoundFns.d.ts","sourceRoot":"","sources":["../../../src/api/brep-operations/compoundFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAkHjE;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CA4DhE;AAMD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAmCjE;AAMD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAmC/D;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAwBrE"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-hosted compat-op implementations — compound feature family
|
|
3
|
+
* (core-decouple Phase 3, §5.4; drill / pocket / boss / mirrorJoin).
|
|
4
|
+
*
|
|
5
|
+
* @platform occt
|
|
6
|
+
*
|
|
7
|
+
* Argument contract (post core-decouple; handle extraction lives in
|
|
8
|
+
* `brepHelpers.ts`):
|
|
9
|
+
* - `options.face` supports an omitted default (highest-Z face) or an already
|
|
10
|
+
* constructed face handle (`{ wrapped }` / `{ id }`); a finder DSL is not
|
|
11
|
+
* supported.
|
|
12
|
+
* - `options.profile` must be an already constructed wire handle (`{ wrapped }` /
|
|
13
|
+
* `{ id }`); a drawing/sketch DSL is not supported (it is not a core data type).
|
|
14
|
+
* Intermediates (tool/profile face/positioned face) are released after use.
|
|
15
|
+
*/
|
|
16
|
+
import { getBrepApi } from '../../brep/handle-bridge.js';
|
|
17
|
+
import { ok, err, isErr } from '../../result/result.js';
|
|
18
|
+
import { kernelError, validationError } from '../../result/errors.js';
|
|
19
|
+
import { resolveArgs } from '../internal/dual-form-args.js';
|
|
20
|
+
import { brepHandleOf, composeAffine, rotationZTo, translationMatrix } from './brepHelpers.js';
|
|
21
|
+
const DRILL_PARAMS = { name: 'drill', params: ['shape', 'options'], formClass: 'A' };
|
|
22
|
+
const POCKET_PARAMS = { name: 'pocket', params: ['shape', 'options'], formClass: 'A' };
|
|
23
|
+
const BOSS_PARAMS = { name: 'boss', params: ['shape', 'options'], formClass: 'A' };
|
|
24
|
+
const MIRROR_JOIN_PARAMS = { name: 'mirrorJoin', params: ['shape', 'options'], formClass: 'A' };
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Vec helpers
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
function vecIsZero(v) {
|
|
29
|
+
return v[0] === 0 && v[1] === 0 && v[2] === 0;
|
|
30
|
+
}
|
|
31
|
+
function vecNormalize(v) {
|
|
32
|
+
const len = Math.hypot(v[0], v[1], v[2]);
|
|
33
|
+
return [v[0] / len, v[1] / len, v[2] / len];
|
|
34
|
+
}
|
|
35
|
+
function vecScale(v, k) {
|
|
36
|
+
return [v[0] * k, v[1] * k, v[2] * k];
|
|
37
|
+
}
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Face/profile helpers
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
/** 构造位于 pos、沿 dir 轴的 cylinder(radius × height),返回句柄(调用方负责释放/消费)。 */
|
|
42
|
+
function cylinderAt(kernel, radius, height, pos, dir) {
|
|
43
|
+
const base = kernel.makeCylinder(radius, height);
|
|
44
|
+
const m = composeAffine(rotationZTo(dir), translationMatrix(pos));
|
|
45
|
+
const placed = kernel.located(base, m);
|
|
46
|
+
kernel.release(base);
|
|
47
|
+
return placed;
|
|
48
|
+
}
|
|
49
|
+
/** 解析目标面:省略 → 最高 Z 面(faceCenter 最大);Face({wrapped})→ 直取。 */
|
|
50
|
+
function resolveTargetFace(kernel, shape, faceSpec) {
|
|
51
|
+
if (faceSpec === undefined || faceSpec === null) {
|
|
52
|
+
const faces = kernel.getSubShapes(shape, 'face');
|
|
53
|
+
if (faces.length === 0) {
|
|
54
|
+
return err(validationError('COMPOUND_NO_FACES', 'compoundOps: shape has no faces'));
|
|
55
|
+
}
|
|
56
|
+
let best = faces[0];
|
|
57
|
+
let bestZ = kernel.surfaceCenterOfMass(best).z;
|
|
58
|
+
for (let i = 1; i < faces.length; i++) {
|
|
59
|
+
const z = kernel.surfaceCenterOfMass(faces[i]).z;
|
|
60
|
+
if (z > bestZ) {
|
|
61
|
+
best = faces[i];
|
|
62
|
+
bestZ = z;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return ok(best);
|
|
66
|
+
}
|
|
67
|
+
if (typeof faceSpec === 'object') {
|
|
68
|
+
try {
|
|
69
|
+
return ok(brepHandleOf(faceSpec));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return err(validationError('COMPOUND_FACE_NOT_FOUND', 'compoundOps: face spec must be a face handle or omitted'));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return err(validationError('COMPOUND_FACE_NOT_FOUND', 'compoundOps: face spec must be a face handle or omitted'));
|
|
76
|
+
}
|
|
77
|
+
/** 面法向(uv 中心)。 */
|
|
78
|
+
function faceNormalAt(kernel, face) {
|
|
79
|
+
const b = kernel.uvBounds(face);
|
|
80
|
+
const u = 0.5 * (b.uMin + b.uMax);
|
|
81
|
+
const v = 0.5 * (b.vMin + b.vMax);
|
|
82
|
+
const n = kernel.surfaceNormal(face, u, v);
|
|
83
|
+
return [n.x, n.y, n.z];
|
|
84
|
+
}
|
|
85
|
+
/** 面质心。 */
|
|
86
|
+
function faceCenterAt(kernel, face) {
|
|
87
|
+
const c = kernel.surfaceCenterOfMass(face);
|
|
88
|
+
return [c.x, c.y, c.z];
|
|
89
|
+
}
|
|
90
|
+
/** profile(wire 句柄)→ face handle。 */
|
|
91
|
+
function profileToFace(kernel, profile) {
|
|
92
|
+
try {
|
|
93
|
+
const wire = brepHandleOf(profile);
|
|
94
|
+
return ok(kernel.makeFace(wire));
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
98
|
+
return err(validationError('COMPOUND_PROFILE_INVALID', `compoundOps: profile must be a wire handle (${raw})`));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// drill — cut a cylinder through the shape
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
/**
|
|
105
|
+
* Drill — cut a cylinder through the shape.
|
|
106
|
+
*
|
|
107
|
+
* @param args - Resolved arguments (shape, drill options).
|
|
108
|
+
* @returns The drilled shape as a `BrepHandle`.
|
|
109
|
+
*/
|
|
110
|
+
export function drillBrep(...args) {
|
|
111
|
+
const [shape, options] = resolveArgs(args, DRILL_PARAMS);
|
|
112
|
+
const kernel = getBrepApi();
|
|
113
|
+
const s = brepHandleOf(shape);
|
|
114
|
+
const { at, radius, axis, depth } = options;
|
|
115
|
+
const ax = (axis ?? [0, 0, 1]);
|
|
116
|
+
if (radius <= 0)
|
|
117
|
+
return err(validationError('DRILL_INVALID_RADIUS', 'Drill radius must be positive'));
|
|
118
|
+
if (vecIsZero(ax))
|
|
119
|
+
return err(validationError('DRILL_ZERO_AXIS', 'Drill axis cannot be zero'));
|
|
120
|
+
const dir = vecNormalize([ax[0], ax[1], ax[2]]);
|
|
121
|
+
const pos = at.length === 2 ? [at[0], at[1], 0] : [at[0], at[1], at[2]];
|
|
122
|
+
let tool;
|
|
123
|
+
try {
|
|
124
|
+
if (depth !== undefined) {
|
|
125
|
+
tool = cylinderAt(kernel, radius, depth, pos, dir);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// Through-all: project bounding box onto the drill axis, add overshoot.
|
|
129
|
+
const bb = kernel.getBoundingBox(s);
|
|
130
|
+
const corners = [
|
|
131
|
+
[bb.xmin, bb.ymin, bb.zmin],
|
|
132
|
+
[bb.xmax, bb.ymin, bb.zmin],
|
|
133
|
+
[bb.xmin, bb.ymax, bb.zmin],
|
|
134
|
+
[bb.xmax, bb.ymax, bb.zmin],
|
|
135
|
+
[bb.xmin, bb.ymin, bb.zmax],
|
|
136
|
+
[bb.xmax, bb.ymin, bb.zmax],
|
|
137
|
+
[bb.xmin, bb.ymax, bb.zmax],
|
|
138
|
+
[bb.xmax, bb.ymax, bb.zmax],
|
|
139
|
+
];
|
|
140
|
+
let tMin = Infinity;
|
|
141
|
+
let tMax = -Infinity;
|
|
142
|
+
for (const c of corners) {
|
|
143
|
+
const t = (c[0] - pos[0]) * dir[0] + (c[1] - pos[1]) * dir[1] + (c[2] - pos[2]) * dir[2];
|
|
144
|
+
if (t < tMin)
|
|
145
|
+
tMin = t;
|
|
146
|
+
if (t > tMax)
|
|
147
|
+
tMax = t;
|
|
148
|
+
}
|
|
149
|
+
const overshoot = 1;
|
|
150
|
+
tMin -= overshoot;
|
|
151
|
+
tMax += overshoot;
|
|
152
|
+
const d = tMax - tMin;
|
|
153
|
+
const startPos = [
|
|
154
|
+
pos[0] + dir[0] * tMin,
|
|
155
|
+
pos[1] + dir[1] * tMin,
|
|
156
|
+
pos[2] + dir[2] * tMin,
|
|
157
|
+
];
|
|
158
|
+
tool = cylinderAt(kernel, radius, d, startPos, dir);
|
|
159
|
+
}
|
|
160
|
+
return ok(kernel.cut(s, tool));
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
164
|
+
return err(kernelError('DRILL_FAILED', `drill failed: ${raw}`, e));
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
if (tool !== undefined)
|
|
168
|
+
kernel.release(tool);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
// pocket — extrude a profile inward and cut
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
/**
|
|
175
|
+
* Pocket — extrude a profile inward and cut it from the shape.
|
|
176
|
+
*
|
|
177
|
+
* @param args - Resolved arguments (shape, pocket options).
|
|
178
|
+
* @returns The pocketed shape as a `BrepHandle`.
|
|
179
|
+
*/
|
|
180
|
+
export function pocketBrep(...args) {
|
|
181
|
+
const [shape, options] = resolveArgs(args, POCKET_PARAMS);
|
|
182
|
+
const kernel = getBrepApi();
|
|
183
|
+
const s = brepHandleOf(shape);
|
|
184
|
+
const { profile, depth } = options;
|
|
185
|
+
if (depth <= 0)
|
|
186
|
+
return err(validationError('POCKET_INVALID_DEPTH', 'Pocket depth must be positive'));
|
|
187
|
+
const faceRes = resolveTargetFace(kernel, s, options.face);
|
|
188
|
+
if (isErr(faceRes))
|
|
189
|
+
return faceRes;
|
|
190
|
+
const face = faceRes.value;
|
|
191
|
+
const normal = faceNormalAt(kernel, face);
|
|
192
|
+
const center = faceCenterAt(kernel, face);
|
|
193
|
+
const profRes = profileToFace(kernel, profile);
|
|
194
|
+
if (isErr(profRes))
|
|
195
|
+
return profRes;
|
|
196
|
+
const profFace = profRes.value;
|
|
197
|
+
let positioned;
|
|
198
|
+
let tool;
|
|
199
|
+
try {
|
|
200
|
+
positioned = kernel.translate(profFace, center[0], center[1], center[2]);
|
|
201
|
+
kernel.release(profFace);
|
|
202
|
+
const nn = vecNormalize([normal[0], normal[1], normal[2]]);
|
|
203
|
+
const extDir = vecScale(nn, -depth);
|
|
204
|
+
tool = kernel.extrude(positioned, extDir[0], extDir[1], extDir[2]);
|
|
205
|
+
kernel.release(positioned);
|
|
206
|
+
return ok(kernel.cut(s, tool));
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
210
|
+
return err(kernelError('POCKET_FAILED', `pocket failed: ${raw}`, e));
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
if (tool !== undefined)
|
|
214
|
+
kernel.release(tool);
|
|
215
|
+
if (positioned !== undefined)
|
|
216
|
+
kernel.release(positioned);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
// boss — extrude a profile outward and fuse
|
|
221
|
+
// ---------------------------------------------------------------------------
|
|
222
|
+
/**
|
|
223
|
+
* Boss — extrude a profile outward and fuse it onto the shape.
|
|
224
|
+
*
|
|
225
|
+
* @param args - Resolved arguments (shape, boss options).
|
|
226
|
+
* @returns The shape with the boss fused as a `BrepHandle`.
|
|
227
|
+
*/
|
|
228
|
+
export function bossBrep(...args) {
|
|
229
|
+
const [shape, options] = resolveArgs(args, BOSS_PARAMS);
|
|
230
|
+
const kernel = getBrepApi();
|
|
231
|
+
const s = brepHandleOf(shape);
|
|
232
|
+
const { profile, height } = options;
|
|
233
|
+
if (height <= 0)
|
|
234
|
+
return err(validationError('BOSS_INVALID_HEIGHT', 'Boss height must be positive'));
|
|
235
|
+
const faceRes = resolveTargetFace(kernel, s, options.face);
|
|
236
|
+
if (isErr(faceRes))
|
|
237
|
+
return faceRes;
|
|
238
|
+
const face = faceRes.value;
|
|
239
|
+
const normal = faceNormalAt(kernel, face);
|
|
240
|
+
const center = faceCenterAt(kernel, face);
|
|
241
|
+
const profRes = profileToFace(kernel, profile);
|
|
242
|
+
if (isErr(profRes))
|
|
243
|
+
return profRes;
|
|
244
|
+
const profFace = profRes.value;
|
|
245
|
+
let positioned;
|
|
246
|
+
let tool;
|
|
247
|
+
try {
|
|
248
|
+
positioned = kernel.translate(profFace, center[0], center[1], center[2]);
|
|
249
|
+
kernel.release(profFace);
|
|
250
|
+
const nn = vecNormalize([normal[0], normal[1], normal[2]]);
|
|
251
|
+
const extDir = vecScale(nn, height);
|
|
252
|
+
tool = kernel.extrude(positioned, extDir[0], extDir[1], extDir[2]);
|
|
253
|
+
kernel.release(positioned);
|
|
254
|
+
return ok(kernel.fuse(s, tool));
|
|
255
|
+
}
|
|
256
|
+
catch (e) {
|
|
257
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
258
|
+
return err(kernelError('BOSS_FAILED', `boss failed: ${raw}`, e));
|
|
259
|
+
}
|
|
260
|
+
finally {
|
|
261
|
+
if (tool !== undefined)
|
|
262
|
+
kernel.release(tool);
|
|
263
|
+
if (positioned !== undefined)
|
|
264
|
+
kernel.release(positioned);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// ---------------------------------------------------------------------------
|
|
268
|
+
// mirrorJoin — mirror and fuse in one step
|
|
269
|
+
// ---------------------------------------------------------------------------
|
|
270
|
+
/**
|
|
271
|
+
* Mirror the shape across a plane and fuse the mirrored copy to the original.
|
|
272
|
+
*
|
|
273
|
+
* @param args - Resolved arguments (shape, mirror options).
|
|
274
|
+
* @returns The shape joined with its mirror as a `BrepHandle`.
|
|
275
|
+
*/
|
|
276
|
+
export function mirrorJoinBrep(...args) {
|
|
277
|
+
const [shape, options] = resolveArgs(args, MIRROR_JOIN_PARAMS);
|
|
278
|
+
const kernel = getBrepApi();
|
|
279
|
+
const s = brepHandleOf(shape);
|
|
280
|
+
const { normal, at } = (options ?? {});
|
|
281
|
+
const n = (normal ?? [1, 0, 0]);
|
|
282
|
+
if (vecIsZero(n))
|
|
283
|
+
return err(validationError('MIRROR_ZERO_NORMAL', 'Mirror plane normal cannot be zero'));
|
|
284
|
+
const origin = (at ?? [0, 0, 0]);
|
|
285
|
+
let mirrored;
|
|
286
|
+
try {
|
|
287
|
+
mirrored = kernel.mirror(s, { x: origin[0], y: origin[1], z: origin[2] }, { x: n[0], y: n[1], z: n[2] });
|
|
288
|
+
return ok(kernel.fuse(s, mirrored));
|
|
289
|
+
}
|
|
290
|
+
catch (e) {
|
|
291
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
292
|
+
return err(kernelError('MIRROR_JOIN_FAILED', `mirrorJoin failed: ${raw}`, e));
|
|
293
|
+
}
|
|
294
|
+
finally {
|
|
295
|
+
if (mirrored !== undefined)
|
|
296
|
+
kernel.release(mirrored);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=compoundFns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compoundFns.js","sourceRoot":"","sources":["../../../src/api/brep-operations/compoundFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAe,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAE3F,MAAM,YAAY,GAAG,EAAE,IAA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C,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACtD,OAAO,GAAG,CAAC,WAAW,CAAC,oBAAoB,EAAE,sBAAsB,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAC/E,CAAC;YAAS,CAAC;QACT,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IACtD,CAAC;AACH,CAAC","sourcesContent":["/**\n * Self-hosted compat-op implementations — compound feature family\n * (core-decouple Phase 3, §5.4; drill / pocket / boss / mirrorJoin).\n *\n * @platform occt\n *\n * Argument contract (post core-decouple; handle extraction lives in\n * `brepHelpers.ts`):\n * - `options.face` supports an omitted default (highest-Z face) or an already\n * constructed face handle (`{ wrapped }` / `{ id }`); a finder DSL is not\n * supported.\n * - `options.profile` must be an already constructed wire handle (`{ wrapped }` /\n * `{ id }`); a drawing/sketch DSL is not supported (it is not a core data type).\n * Intermediates (tool/profile face/positioned face) are released after use.\n */\n\nimport type { BrepHandle } from '../../brep/engine/types'\nimport { getBrepApi } from '../../brep/handle-bridge'\nimport { ok, err, isErr, type Result } from '../../result/result'\nimport { kernelError, validationError } from '../../result/errors'\nimport type { FormClass } from '../internal/dual-form-args'\nimport { resolveArgs } from '../internal/dual-form-args'\nimport type { Vec3 } from '../geom-types/types'\nimport { brepHandleOf, composeAffine, rotationZTo, translationMatrix } from './brepHelpers'\n\nconst DRILL_PARAMS = { name: 'drill', params: ['shape', 'options'], formClass: 'A' as FormClass }\nconst POCKET_PARAMS = { name: 'pocket', params: ['shape', 'options'], formClass: 'A' as FormClass }\nconst BOSS_PARAMS = { name: 'boss', params: ['shape', 'options'], formClass: 'A' as FormClass }\nconst MIRROR_JOIN_PARAMS = { name: 'mirrorJoin', params: ['shape', 'options'], formClass: 'A' as FormClass }\n\n// ---------------------------------------------------------------------------\n// Vec helpers\n// ---------------------------------------------------------------------------\n\nfunction vecIsZero(v: readonly number[]): boolean {\n return v[0] === 0 && v[1] === 0 && v[2] === 0\n}\n\nfunction vecNormalize(v: readonly [number, number, number]): [number, number, number] {\n const len = Math.hypot(v[0], v[1], v[2])\n return [v[0] / len, v[1] / len, v[2] / len]\n}\n\nfunction vecScale(v: readonly [number, number, number], k: number): [number, number, number] {\n return [v[0] * k, v[1] * k, v[2] * k]\n}\n\n// ---------------------------------------------------------------------------\n// Face/profile helpers\n// ---------------------------------------------------------------------------\n\n/** 构造位于 pos、沿 dir 轴的 cylinder(radius × height),返回句柄(调用方负责释放/消费)。 */\nfunction cylinderAt(\n kernel: ReturnType<typeof getBrepApi>,\n radius: number,\n height: number,\n pos: [number, number, number],\n dir: [number, number, number],\n): BrepHandle {\n const base = kernel.makeCylinder(radius, height)\n const m = composeAffine(rotationZTo(dir), translationMatrix(pos))\n const placed = kernel.located(base, m as number[])\n kernel.release(base)\n return placed\n}\n\n/** 解析目标面:省略 → 最高 Z 面(faceCenter 最大);Face({wrapped})→ 直取。 */\nfunction resolveTargetFace(\n kernel: ReturnType<typeof getBrepApi>,\n shape: BrepHandle,\n faceSpec: unknown,\n): Result<BrepHandle> {\n if (faceSpec === undefined || faceSpec === null) {\n const faces = kernel.getSubShapes(shape, 'face')\n if (faces.length === 0) {\n return err(validationError('COMPOUND_NO_FACES', 'compoundOps: shape has no faces'))\n }\n let best = faces[0]\n let bestZ = kernel.surfaceCenterOfMass(best).z\n for (let i = 1; i < faces.length; i++) {\n const z = kernel.surfaceCenterOfMass(faces[i]).z\n if (z > bestZ) {\n best = faces[i]\n bestZ = z\n }\n }\n return ok(best)\n }\n if (typeof faceSpec === 'object') {\n try {\n return ok(brepHandleOf(faceSpec))\n } catch {\n return err(\n validationError('COMPOUND_FACE_NOT_FOUND', 'compoundOps: face spec must be a face handle or omitted'),\n )\n }\n }\n return err(validationError('COMPOUND_FACE_NOT_FOUND', 'compoundOps: face spec must be a face handle or omitted'))\n}\n\n/** 面法向(uv 中心)。 */\nfunction faceNormalAt(kernel: ReturnType<typeof getBrepApi>, face: BrepHandle): Vec3 {\n const b = kernel.uvBounds(face)\n const u = 0.5 * (b.uMin + b.uMax)\n const v = 0.5 * (b.vMin + b.vMax)\n const n = kernel.surfaceNormal(face, u, v)\n return [n.x, n.y, n.z]\n}\n\n/** 面质心。 */\nfunction faceCenterAt(kernel: ReturnType<typeof getBrepApi>, face: BrepHandle): Vec3 {\n const c = kernel.surfaceCenterOfMass(face)\n return [c.x, c.y, c.z]\n}\n\n/** profile(wire 句柄)→ face handle。 */\nfunction profileToFace(kernel: ReturnType<typeof getBrepApi>, profile: unknown): Result<BrepHandle> {\n try {\n const wire = brepHandleOf(profile)\n return ok(kernel.makeFace(wire))\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n return err(\n validationError('COMPOUND_PROFILE_INVALID', `compoundOps: profile must be a wire handle (${raw})`),\n )\n }\n}\n\n// ---------------------------------------------------------------------------\n// drill — cut a cylinder through the shape\n// ---------------------------------------------------------------------------\n\n/**\n * Drill — cut a cylinder through the shape.\n *\n * @param args - Resolved arguments (shape, drill options).\n * @returns The drilled shape as a `BrepHandle`.\n */\nexport function drillBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, options] = resolveArgs(args, DRILL_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const { at, radius, axis, depth } = options as {\n at: Vec3 | [number, number]\n radius: number\n axis?: Vec3\n depth?: number\n }\n const ax = (axis ?? [0, 0, 1]) as Vec3\n\n if (radius <= 0) return err(validationError('DRILL_INVALID_RADIUS', 'Drill radius must be positive'))\n if (vecIsZero(ax)) return err(validationError('DRILL_ZERO_AXIS', 'Drill axis cannot be zero'))\n\n const dir = vecNormalize([ax[0], ax[1], ax[2]])\n const pos: [number, number, number] = at.length === 2 ? [at[0], at[1], 0] : [at[0], at[1], at[2]]\n\n let tool: BrepHandle | undefined\n try {\n if (depth !== undefined) {\n tool = cylinderAt(kernel, radius, depth, pos, dir)\n } else {\n // Through-all: project bounding box onto the drill axis, add overshoot.\n const bb = kernel.getBoundingBox(s)\n const corners: [number, number, number][] = [\n [bb.xmin, bb.ymin, bb.zmin],\n [bb.xmax, bb.ymin, bb.zmin],\n [bb.xmin, bb.ymax, bb.zmin],\n [bb.xmax, bb.ymax, bb.zmin],\n [bb.xmin, bb.ymin, bb.zmax],\n [bb.xmax, bb.ymin, bb.zmax],\n [bb.xmin, bb.ymax, bb.zmax],\n [bb.xmax, bb.ymax, bb.zmax],\n ]\n let tMin = Infinity\n let tMax = -Infinity\n for (const c of corners) {\n const t = (c[0] - pos[0]) * dir[0] + (c[1] - pos[1]) * dir[1] + (c[2] - pos[2]) * dir[2]\n if (t < tMin) tMin = t\n if (t > tMax) tMax = t\n }\n const overshoot = 1\n tMin -= overshoot\n tMax += overshoot\n const d = tMax - tMin\n const startPos: [number, number, number] = [\n pos[0] + dir[0] * tMin,\n pos[1] + dir[1] * tMin,\n pos[2] + dir[2] * tMin,\n ]\n tool = cylinderAt(kernel, radius, d, startPos, dir)\n }\n return ok(kernel.cut(s, tool))\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n return err(kernelError('DRILL_FAILED', `drill failed: ${raw}`, e))\n } finally {\n if (tool !== undefined) kernel.release(tool)\n }\n}\n\n// ---------------------------------------------------------------------------\n// pocket — extrude a profile inward and cut\n// ---------------------------------------------------------------------------\n\n/**\n * Pocket — extrude a profile inward and cut it from the shape.\n *\n * @param args - Resolved arguments (shape, pocket options).\n * @returns The pocketed shape as a `BrepHandle`.\n */\nexport function pocketBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, options] = resolveArgs(args, POCKET_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const { profile, depth } = options as { profile: unknown; depth: number; face?: unknown }\n\n if (depth <= 0) return err(validationError('POCKET_INVALID_DEPTH', 'Pocket depth must be positive'))\n\n const faceRes = resolveTargetFace(kernel, s, (options as { face?: unknown }).face)\n if (isErr(faceRes)) return faceRes\n const face = faceRes.value\n const normal = faceNormalAt(kernel, face)\n const center = faceCenterAt(kernel, face)\n\n const profRes = profileToFace(kernel, profile)\n if (isErr(profRes)) return profRes\n const profFace = profRes.value\n\n let positioned: BrepHandle | undefined\n let tool: BrepHandle | undefined\n try {\n positioned = kernel.translate(profFace, center[0], center[1], center[2])\n kernel.release(profFace)\n const nn = vecNormalize([normal[0], normal[1], normal[2]])\n const extDir = vecScale(nn, -depth)\n tool = kernel.extrude(positioned, extDir[0], extDir[1], extDir[2])\n kernel.release(positioned)\n return ok(kernel.cut(s, tool))\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n return err(kernelError('POCKET_FAILED', `pocket failed: ${raw}`, e))\n } finally {\n if (tool !== undefined) kernel.release(tool)\n if (positioned !== undefined) kernel.release(positioned)\n }\n}\n\n// ---------------------------------------------------------------------------\n// boss — extrude a profile outward and fuse\n// ---------------------------------------------------------------------------\n\n/**\n * Boss — extrude a profile outward and fuse it onto the shape.\n *\n * @param args - Resolved arguments (shape, boss options).\n * @returns The shape with the boss fused as a `BrepHandle`.\n */\nexport function bossBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, options] = resolveArgs(args, BOSS_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const { profile, height } = options as { profile: unknown; height: number; face?: unknown }\n\n if (height <= 0) return err(validationError('BOSS_INVALID_HEIGHT', 'Boss height must be positive'))\n\n const faceRes = resolveTargetFace(kernel, s, (options as { face?: unknown }).face)\n if (isErr(faceRes)) return faceRes\n const face = faceRes.value\n const normal = faceNormalAt(kernel, face)\n const center = faceCenterAt(kernel, face)\n\n const profRes = profileToFace(kernel, profile)\n if (isErr(profRes)) return profRes\n const profFace = profRes.value\n\n let positioned: BrepHandle | undefined\n let tool: BrepHandle | undefined\n try {\n positioned = kernel.translate(profFace, center[0], center[1], center[2])\n kernel.release(profFace)\n const nn = vecNormalize([normal[0], normal[1], normal[2]])\n const extDir = vecScale(nn, height)\n tool = kernel.extrude(positioned, extDir[0], extDir[1], extDir[2])\n kernel.release(positioned)\n return ok(kernel.fuse(s, tool))\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n return err(kernelError('BOSS_FAILED', `boss failed: ${raw}`, e))\n } finally {\n if (tool !== undefined) kernel.release(tool)\n if (positioned !== undefined) kernel.release(positioned)\n }\n}\n\n// ---------------------------------------------------------------------------\n// mirrorJoin — mirror and fuse in one step\n// ---------------------------------------------------------------------------\n\n/**\n * Mirror the shape across a plane and fuse the mirrored copy to the original.\n *\n * @param args - Resolved arguments (shape, mirror options).\n * @returns The shape joined with its mirror as a `BrepHandle`.\n */\nexport function mirrorJoinBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, options] = resolveArgs(args, MIRROR_JOIN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const { normal, at } = (options ?? {}) as { normal?: Vec3; at?: Vec3 }\n const n = (normal ?? [1, 0, 0]) as Vec3\n\n if (vecIsZero(n)) return err(validationError('MIRROR_ZERO_NORMAL', 'Mirror plane normal cannot be zero'))\n\n const origin = (at ?? [0, 0, 0]) as Vec3\n let mirrored: BrepHandle | undefined\n try {\n mirrored = kernel.mirror(\n s,\n { x: origin[0], y: origin[1], z: origin[2] },\n { x: n[0], y: n[1], z: n[2] },\n )\n return ok(kernel.fuse(s, mirrored))\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n return err(kernelError('MIRROR_JOIN_FAILED', `mirrorJoin failed: ${raw}`, e))\n } finally {\n if (mirrored !== undefined) kernel.release(mirrored)\n }\n}\n"]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-hosted compat-op implementations — shape healing family
|
|
3
|
+
* (core-decouple Phase 3, §5.4).
|
|
4
|
+
*
|
|
5
|
+
* @platform occt
|
|
6
|
+
*
|
|
7
|
+
* Brep-shaped implementations for `heal`, `healSolid`, `fixShape`, `autoHeal`,
|
|
8
|
+
* `fixSelfIntersection`, `simplify`. Semantics mirror brepjs
|
|
9
|
+
* `topology/healingFns.ts` / `topology/shapeFns.ts` (error codes preserved),
|
|
10
|
+
* with the brepjs object model (castResultShape / cache invalidation) dropped:
|
|
11
|
+
* occt-wasm handles only. Platform-native methods (`healFace`, `healWire`,
|
|
12
|
+
* `simplify`, `fixSelfIntersection`) go through `getOcctKernel()` (D3).
|
|
13
|
+
*/
|
|
14
|
+
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
15
|
+
import { type Result } from '../../result/result.js';
|
|
16
|
+
/** Heal a solid (`ShapeFix_Solid`); error codes match brepjs `healSolid`.
|
|
17
|
+
*
|
|
18
|
+
* @param args - Resolved arguments (solid shape).
|
|
19
|
+
* @returns The healed solid as a `BrepHandle`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function healSolidBrep(...args: unknown[]): Result<BrepHandle>;
|
|
22
|
+
/**
|
|
23
|
+
* Dispatch healing by shape type (solid/face/wire); other types pass through
|
|
24
|
+
* unchanged (brepjs `heal`).
|
|
25
|
+
*
|
|
26
|
+
* @param args - Resolved arguments (shape).
|
|
27
|
+
* @returns The healed shape as a `BrepHandle`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function healBrep(...args: unknown[]): Result<BrepHandle>;
|
|
30
|
+
/** General-purpose repair (`ShapeFix_Shape`).
|
|
31
|
+
*
|
|
32
|
+
* @param args - Resolved arguments (shape).
|
|
33
|
+
* @returns The repaired shape as a `BrepHandle`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function fixShapeBrep(...args: unknown[]): Result<BrepHandle>;
|
|
36
|
+
/** Fix wire self-intersection (occt platform method).
|
|
37
|
+
*
|
|
38
|
+
* @param args - Resolved arguments (wire shape).
|
|
39
|
+
* @returns The fixed wire as a `BrepHandle`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function fixSelfIntersectionBrep(...args: unknown[]): Result<BrepHandle>;
|
|
42
|
+
/** Simplify a shape (occt platform method).
|
|
43
|
+
*
|
|
44
|
+
* @param args - Resolved arguments (shape).
|
|
45
|
+
* @returns The simplified shape as a `BrepHandle`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function simplifyBrep(...args: unknown[]): Result<BrepHandle>;
|
|
48
|
+
interface HealingStepDiagnostic {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly attempted: boolean;
|
|
51
|
+
readonly succeeded: boolean;
|
|
52
|
+
readonly detail?: string;
|
|
53
|
+
}
|
|
54
|
+
interface HealingReport {
|
|
55
|
+
readonly isValid: boolean;
|
|
56
|
+
readonly alreadyValid: boolean;
|
|
57
|
+
readonly wiresHealed: number;
|
|
58
|
+
readonly facesHealed: number;
|
|
59
|
+
readonly solidHealed: boolean;
|
|
60
|
+
readonly steps: ReadonlyArray<string>;
|
|
61
|
+
readonly diagnostics: ReadonlyArray<HealingStepDiagnostic>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Auto-heal pipeline (brepjs `autoHeal`): short-circuit on valid, optional
|
|
65
|
+
* sew / wire self-intersection pass, shape-level heal, sub-shape delta report.
|
|
66
|
+
*
|
|
67
|
+
* The returned record carries the healed shape as a raw BREP handle; the
|
|
68
|
+
* projection wraps it via `fromHandle` so callers receive a faijs Shape.
|
|
69
|
+
*
|
|
70
|
+
* @param args - Resolved arguments (shape, auto-heal options).
|
|
71
|
+
* @returns The healed shape with a diagnostic healing report.
|
|
72
|
+
*/
|
|
73
|
+
export declare function autoHealBrep(...args: unknown[]): Result<{
|
|
74
|
+
shape: BrepHandle;
|
|
75
|
+
report: HealingReport;
|
|
76
|
+
}>;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=healingFns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"healingFns.d.ts","sourceRoot":"","sources":["../../../src/api/brep-operations/healingFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAA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