@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,294 @@
|
|
|
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 { getBrepApi } from '../../brep/handle-bridge.js';
|
|
15
|
+
import { getOcctKernel } from '../../occt-kernel/occtKernel.js';
|
|
16
|
+
import { ok, err } from '../../result/result.js';
|
|
17
|
+
import { kernelError, validationError } from '../../result/errors.js';
|
|
18
|
+
import { resolveArgs } from '../internal/dual-form-args.js';
|
|
19
|
+
import { brepHandleOf } from './brepHelpers.js';
|
|
20
|
+
const HEAL_PARAMS = { name: 'heal', params: ['shape'], formClass: 'A' };
|
|
21
|
+
const HEAL_SOLID_PARAMS = { name: 'healSolid', params: ['solid'], formClass: 'A' };
|
|
22
|
+
const FIX_SHAPE_PARAMS = { name: 'fixShape', params: ['shape'], formClass: 'A' };
|
|
23
|
+
const AUTO_HEAL_PARAMS = { name: 'autoHeal', params: ['shape', 'options'], formClass: 'A' };
|
|
24
|
+
const FIX_SELF_INTERSECTION_PARAMS = {
|
|
25
|
+
name: 'fixSelfIntersection',
|
|
26
|
+
params: ['shape'],
|
|
27
|
+
formClass: 'A',
|
|
28
|
+
};
|
|
29
|
+
const SIMPLIFY_PARAMS = { name: 'simplify', params: ['shape'], formClass: 'A' };
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// heal (type-dispatching)
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
/** Heal a solid (`ShapeFix_Solid`); error codes match brepjs `healSolid`.
|
|
34
|
+
*
|
|
35
|
+
* @param args - Resolved arguments (solid shape).
|
|
36
|
+
* @returns The healed solid as a `BrepHandle`.
|
|
37
|
+
*/
|
|
38
|
+
export function healSolidBrep(...args) {
|
|
39
|
+
const [solid] = resolveArgs(args, HEAL_SOLID_PARAMS);
|
|
40
|
+
const kernel = getBrepApi();
|
|
41
|
+
const h = brepHandleOf(solid);
|
|
42
|
+
if (!kernel.isSolid(h))
|
|
43
|
+
return err(validationError('NOT_A_SOLID', 'Input shape is not a solid'));
|
|
44
|
+
const alreadyValid = kernel.isValid(h);
|
|
45
|
+
try {
|
|
46
|
+
const result = kernel.healSolid(h);
|
|
47
|
+
if (result == null || result === h) {
|
|
48
|
+
if (alreadyValid)
|
|
49
|
+
return ok(h);
|
|
50
|
+
return err(kernelError('HEAL_NO_EFFECT', 'Solid healing had no effect — shape is still invalid'));
|
|
51
|
+
}
|
|
52
|
+
if (!kernel.isSolid(result))
|
|
53
|
+
return err(kernelError('HEAL_RESULT_NOT_SOLID', 'Healed result is not a solid'));
|
|
54
|
+
if (!kernel.isValid(result)) {
|
|
55
|
+
return err(kernelError('HEAL_SOLID_INCOMPLETE', 'Healed result is still invalid after ShapeFix_Solid'));
|
|
56
|
+
}
|
|
57
|
+
return ok(result);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
return err(kernelError('HEAL_SOLID_FAILED', 'Solid healing failed', e));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Heal a face (`ShapeFix_Face`, occt platform method). */
|
|
64
|
+
function healFaceBrep(handle) {
|
|
65
|
+
try {
|
|
66
|
+
const result = getOcctKernel().healFace(handle, 1e-6);
|
|
67
|
+
if (getOcctKernel().getShapeType(result) !== 'face') {
|
|
68
|
+
return err(kernelError('HEAL_RESULT_NOT_FACE', 'Healed result is not a face'));
|
|
69
|
+
}
|
|
70
|
+
return ok(result);
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
return err(kernelError('HEAL_FACE_FAILED', 'Face healing failed', e));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** Heal a wire (`ShapeFix_Wire`, occt platform method). */
|
|
77
|
+
function healWireBrep(handle) {
|
|
78
|
+
try {
|
|
79
|
+
const result = getOcctKernel().healWire(handle, 1e-6);
|
|
80
|
+
if (getOcctKernel().getShapeType(result) !== 'wire') {
|
|
81
|
+
return err(kernelError('HEAL_RESULT_NOT_WIRE', 'Healed result is not a wire'));
|
|
82
|
+
}
|
|
83
|
+
return ok(result);
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
return err(kernelError('HEAL_WIRE_FAILED', 'Wire healing failed', e));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Dispatch healing by shape type (solid/face/wire); other types pass through
|
|
91
|
+
* unchanged (brepjs `heal`).
|
|
92
|
+
*
|
|
93
|
+
* @param args - Resolved arguments (shape).
|
|
94
|
+
* @returns The healed shape as a `BrepHandle`.
|
|
95
|
+
*/
|
|
96
|
+
export function healBrep(...args) {
|
|
97
|
+
const [shape] = resolveArgs(args, HEAL_PARAMS);
|
|
98
|
+
const h = brepHandleOf(shape);
|
|
99
|
+
const type = getOcctKernel().getShapeType(h);
|
|
100
|
+
if (type === 'solid')
|
|
101
|
+
return healSolidBrep(shape);
|
|
102
|
+
if (type === 'face')
|
|
103
|
+
return healFaceBrep(h);
|
|
104
|
+
if (type === 'wire')
|
|
105
|
+
return healWireBrep(h);
|
|
106
|
+
return ok(h);
|
|
107
|
+
}
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// fixShape / fixSelfIntersection / simplify
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
/** General-purpose repair (`ShapeFix_Shape`).
|
|
112
|
+
*
|
|
113
|
+
* @param args - Resolved arguments (shape).
|
|
114
|
+
* @returns The repaired shape as a `BrepHandle`.
|
|
115
|
+
*/
|
|
116
|
+
export function fixShapeBrep(...args) {
|
|
117
|
+
const [shape] = resolveArgs(args, FIX_SHAPE_PARAMS);
|
|
118
|
+
const kernel = getBrepApi();
|
|
119
|
+
try {
|
|
120
|
+
return ok(kernel.fixShape(brepHandleOf(shape)));
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
return err(kernelError('FIX_SHAPE_FAILED', 'ShapeFix_Shape failed', e));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Fix wire self-intersection (occt platform method).
|
|
127
|
+
*
|
|
128
|
+
* @param args - Resolved arguments (wire shape).
|
|
129
|
+
* @returns The fixed wire as a `BrepHandle`.
|
|
130
|
+
*/
|
|
131
|
+
export function fixSelfIntersectionBrep(...args) {
|
|
132
|
+
const [shape] = resolveArgs(args, FIX_SELF_INTERSECTION_PARAMS);
|
|
133
|
+
try {
|
|
134
|
+
const result = getOcctKernel().healWire(brepHandleOf(shape), 1e-6);
|
|
135
|
+
if (getOcctKernel().getShapeType(result) !== 'wire') {
|
|
136
|
+
return err(kernelError('FIX_SELF_INTERSECTION_FAILED', 'Result is not a wire'));
|
|
137
|
+
}
|
|
138
|
+
return ok(result);
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
return err(kernelError('FIX_SELF_INTERSECTION_FAILED', 'Failed to fix wire self-intersection', e));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/** Simplify a shape (occt platform method).
|
|
145
|
+
*
|
|
146
|
+
* @param args - Resolved arguments (shape).
|
|
147
|
+
* @returns The simplified shape as a `BrepHandle`.
|
|
148
|
+
*/
|
|
149
|
+
export function simplifyBrep(...args) {
|
|
150
|
+
const [shape] = resolveArgs(args, SIMPLIFY_PARAMS);
|
|
151
|
+
try {
|
|
152
|
+
return ok(getOcctKernel().simplify(brepHandleOf(shape)));
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
return err(kernelError('SIMPLIFY_FAILED', 'Kernel simplify failed', e));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Shape-kind check on a raw handle (occt `shapeType`). */
|
|
159
|
+
function kindOf(h) {
|
|
160
|
+
return getOcctKernel().getShapeType(h);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Auto-heal pipeline (brepjs `autoHeal`): short-circuit on valid, optional
|
|
164
|
+
* sew / wire self-intersection pass, shape-level heal, sub-shape delta report.
|
|
165
|
+
*
|
|
166
|
+
* The returned record carries the healed shape as a raw BREP handle; the
|
|
167
|
+
* projection wraps it via `fromHandle` so callers receive a faijs Shape.
|
|
168
|
+
*
|
|
169
|
+
* @param args - Resolved arguments (shape, auto-heal options).
|
|
170
|
+
* @returns The healed shape with a diagnostic healing report.
|
|
171
|
+
*/
|
|
172
|
+
export function autoHealBrep(...args) {
|
|
173
|
+
const [shape, options] = resolveArgs(args, AUTO_HEAL_PARAMS);
|
|
174
|
+
const opts = (options ?? {});
|
|
175
|
+
const fixWires = opts.fixWires !== false;
|
|
176
|
+
const fixFaces = opts.fixFaces !== false;
|
|
177
|
+
const fixSolids = opts.fixSolids !== false;
|
|
178
|
+
const fixSelfIntersectionOpt = opts.fixSelfIntersection === true;
|
|
179
|
+
const sewTolerance = opts.sewTolerance;
|
|
180
|
+
const steps = [];
|
|
181
|
+
const diagnostics = [];
|
|
182
|
+
const kernel = getBrepApi();
|
|
183
|
+
const input = brepHandleOf(shape);
|
|
184
|
+
const valid = kernel.isValid(input);
|
|
185
|
+
if (valid) {
|
|
186
|
+
return ok({
|
|
187
|
+
shape: input,
|
|
188
|
+
report: {
|
|
189
|
+
isValid: true,
|
|
190
|
+
alreadyValid: true,
|
|
191
|
+
wiresHealed: 0,
|
|
192
|
+
facesHealed: 0,
|
|
193
|
+
solidHealed: false,
|
|
194
|
+
steps: ['Shape already valid'],
|
|
195
|
+
diagnostics: [{ name: 'validation', attempted: true, succeeded: true }],
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
steps.push('Shape invalid — applying shape-level healing');
|
|
200
|
+
const wiresBefore = kernel.getSubShapes(input, 'wire').length;
|
|
201
|
+
const facesBefore = kernel.getSubShapes(input, 'face').length;
|
|
202
|
+
let current = input;
|
|
203
|
+
let solidHealed = false;
|
|
204
|
+
const setCurrent = (next) => {
|
|
205
|
+
const prev = current;
|
|
206
|
+
current = next;
|
|
207
|
+
if (prev !== input && prev !== next)
|
|
208
|
+
kernel.release(prev);
|
|
209
|
+
};
|
|
210
|
+
if (sewTolerance !== undefined) {
|
|
211
|
+
try {
|
|
212
|
+
setCurrent(kernel.sew([current], sewTolerance));
|
|
213
|
+
steps.push(`Applied sewing with tolerance ${sewTolerance}`);
|
|
214
|
+
diagnostics.push({ name: 'sew', attempted: true, succeeded: true, detail: `tolerance=${sewTolerance}` });
|
|
215
|
+
}
|
|
216
|
+
catch (e) {
|
|
217
|
+
const detail = e instanceof Error ? e.message : String(e);
|
|
218
|
+
steps.push(`Sewing failed: ${detail}`);
|
|
219
|
+
diagnostics.push({ name: 'sew', attempted: true, succeeded: false, detail });
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (fixSelfIntersectionOpt && fixWires) {
|
|
223
|
+
const wires = kernel.getSubShapes(current, 'wire');
|
|
224
|
+
let fixCount = 0;
|
|
225
|
+
for (const wire of wires) {
|
|
226
|
+
try {
|
|
227
|
+
getOcctKernel().healWire(wire, 1e-6);
|
|
228
|
+
fixCount++;
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
// Ignore individual wire failures
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
steps.push(`Self-intersection fix: ${fixCount}/${wires.length} wires`);
|
|
235
|
+
diagnostics.push({
|
|
236
|
+
name: 'fixSelfIntersection',
|
|
237
|
+
attempted: true,
|
|
238
|
+
succeeded: fixCount > 0,
|
|
239
|
+
detail: `${fixCount}/${wires.length} wires fixed`,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
const kind = kindOf(current);
|
|
243
|
+
const shouldHealShape = (kind === 'solid' && fixSolids) || (kind === 'face' && fixFaces) || (kind === 'wire' && fixWires);
|
|
244
|
+
if (shouldHealShape) {
|
|
245
|
+
const healResult = kind === 'solid' ? healSolidBrep(current) : kind === 'face' ? healFaceBrep(current) : healWireBrep(current);
|
|
246
|
+
if (healResult.ok) {
|
|
247
|
+
setCurrent(healResult.value);
|
|
248
|
+
if (kind === 'solid') {
|
|
249
|
+
solidHealed = true;
|
|
250
|
+
steps.push('Applied ShapeFix_Solid');
|
|
251
|
+
diagnostics.push({ name: 'healSolid', attempted: true, succeeded: true });
|
|
252
|
+
}
|
|
253
|
+
else if (kind === 'face') {
|
|
254
|
+
steps.push('Applied ShapeFix_Face');
|
|
255
|
+
diagnostics.push({ name: 'healFace', attempted: true, succeeded: true });
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
steps.push('Applied ShapeFix_Wire');
|
|
259
|
+
diagnostics.push({ name: 'healWire', attempted: true, succeeded: true });
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
steps.push('Shape-level healing failed');
|
|
264
|
+
diagnostics.push({ name: 'healShape', attempted: true, succeeded: false });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
diagnostics.push({ name: 'healShape', attempted: false, succeeded: false, detail: 'skipped by options' });
|
|
269
|
+
}
|
|
270
|
+
const wiresAfter = kernel.getSubShapes(current, 'wire').length;
|
|
271
|
+
const facesAfter = kernel.getSubShapes(current, 'face').length;
|
|
272
|
+
const wiresHealed = Math.abs(wiresAfter - wiresBefore);
|
|
273
|
+
const facesHealed = Math.abs(facesAfter - facesBefore);
|
|
274
|
+
if (wiresHealed > 0)
|
|
275
|
+
steps.push(`Wire count changed by ${wiresHealed}`);
|
|
276
|
+
if (facesHealed > 0)
|
|
277
|
+
steps.push(`Face count changed by ${facesHealed}`);
|
|
278
|
+
const finalValid = kernel.isValid(current);
|
|
279
|
+
steps.push(finalValid ? 'Final validation: valid' : 'Final validation: still invalid');
|
|
280
|
+
diagnostics.push({ name: 'finalValidation', attempted: true, succeeded: finalValid });
|
|
281
|
+
return ok({
|
|
282
|
+
shape: current,
|
|
283
|
+
report: {
|
|
284
|
+
isValid: finalValid,
|
|
285
|
+
alreadyValid: false,
|
|
286
|
+
wiresHealed,
|
|
287
|
+
facesHealed,
|
|
288
|
+
solidHealed,
|
|
289
|
+
steps,
|
|
290
|
+
diagnostics,
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=healingFns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"healingFns.js","sourceRoot":"","sources":["../../../src/api/brep-operations/healingFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,GAAG,EAAe,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,MAAM,WAA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n * Brep-shaped implementations for `heal`, `healSolid`, `fixShape`, `autoHeal`,\n * `fixSelfIntersection`, `simplify`. Semantics mirror brepjs\n * `topology/healingFns.ts` / `topology/shapeFns.ts` (error codes preserved),\n * with the brepjs object model (castResultShape / cache invalidation) dropped:\n * occt-wasm handles only. Platform-native methods (`healFace`, `healWire`,\n * `simplify`, `fixSelfIntersection`) go through `getOcctKernel()` (D3).\n */\n\nimport type { BrepHandle } from '../../brep/engine/types'\nimport { getBrepApi } from '../../brep/handle-bridge'\nimport { getOcctKernel } from '../../occt-kernel/occtKernel'\nimport { ok, err, 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 { brepHandleOf } from './brepHelpers'\n\nconst HEAL_PARAMS = { name: 'heal', params: ['shape'], formClass: 'A' as FormClass }\nconst HEAL_SOLID_PARAMS = { name: 'healSolid', params: ['solid'], formClass: 'A' as FormClass }\nconst FIX_SHAPE_PARAMS = { name: 'fixShape', params: ['shape'], formClass: 'A' as FormClass }\nconst AUTO_HEAL_PARAMS = { name: 'autoHeal', params: ['shape', 'options'], formClass: 'A' as FormClass }\nconst FIX_SELF_INTERSECTION_PARAMS = {\n name: 'fixSelfIntersection',\n params: ['shape'],\n formClass: 'A' as FormClass,\n}\nconst SIMPLIFY_PARAMS = { name: 'simplify', params: ['shape'], formClass: 'A' as FormClass }\n\n// ---------------------------------------------------------------------------\n// heal (type-dispatching)\n// ---------------------------------------------------------------------------\n\n/** Heal a solid (`ShapeFix_Solid`); error codes match brepjs `healSolid`.\n *\n * @param args - Resolved arguments (solid shape).\n * @returns The healed solid as a `BrepHandle`.\n */\nexport function healSolidBrep(...args: unknown[]): Result<BrepHandle> {\n const [solid] = resolveArgs(args, HEAL_SOLID_PARAMS)\n const kernel = getBrepApi()\n const h = brepHandleOf(solid)\n if (!kernel.isSolid(h)) return err(validationError('NOT_A_SOLID', 'Input shape is not a solid'))\n const alreadyValid = kernel.isValid(h)\n try {\n const result = kernel.healSolid(h)\n if (result == null || result === h) {\n if (alreadyValid) return ok(h)\n return err(kernelError('HEAL_NO_EFFECT', 'Solid healing had no effect — shape is still invalid'))\n }\n if (!kernel.isSolid(result)) return err(kernelError('HEAL_RESULT_NOT_SOLID', 'Healed result is not a solid'))\n if (!kernel.isValid(result)) {\n return err(kernelError('HEAL_SOLID_INCOMPLETE', 'Healed result is still invalid after ShapeFix_Solid'))\n }\n return ok(result)\n } catch (e) {\n return err(kernelError('HEAL_SOLID_FAILED', 'Solid healing failed', e))\n }\n}\n\n/** Heal a face (`ShapeFix_Face`, occt platform method). */\nfunction healFaceBrep(handle: BrepHandle): Result<BrepHandle> {\n try {\n const result = getOcctKernel().healFace(handle as never, 1e-6)\n if (getOcctKernel().getShapeType(result as never) !== 'face') {\n return err(kernelError('HEAL_RESULT_NOT_FACE', 'Healed result is not a face'))\n }\n return ok(result as never as BrepHandle)\n } catch (e) {\n return err(kernelError('HEAL_FACE_FAILED', 'Face healing failed', e))\n }\n}\n\n/** Heal a wire (`ShapeFix_Wire`, occt platform method). */\nfunction healWireBrep(handle: BrepHandle): Result<BrepHandle> {\n try {\n const result = getOcctKernel().healWire(handle as never, 1e-6)\n if (getOcctKernel().getShapeType(result as never) !== 'wire') {\n return err(kernelError('HEAL_RESULT_NOT_WIRE', 'Healed result is not a wire'))\n }\n return ok(result as never as BrepHandle)\n } catch (e) {\n return err(kernelError('HEAL_WIRE_FAILED', 'Wire healing failed', e))\n }\n}\n\n/**\n * Dispatch healing by shape type (solid/face/wire); other types pass through\n * unchanged (brepjs `heal`).\n *\n * @param args - Resolved arguments (shape).\n * @returns The healed shape as a `BrepHandle`.\n */\nexport function healBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape] = resolveArgs(args, HEAL_PARAMS)\n const h = brepHandleOf(shape)\n const type = getOcctKernel().getShapeType(h as never)\n if (type === 'solid') return healSolidBrep(shape)\n if (type === 'face') return healFaceBrep(h)\n if (type === 'wire') return healWireBrep(h)\n return ok(h)\n}\n\n// ---------------------------------------------------------------------------\n// fixShape / fixSelfIntersection / simplify\n// ---------------------------------------------------------------------------\n\n/** General-purpose repair (`ShapeFix_Shape`).\n *\n * @param args - Resolved arguments (shape).\n * @returns The repaired shape as a `BrepHandle`.\n */\nexport function fixShapeBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape] = resolveArgs(args, FIX_SHAPE_PARAMS)\n const kernel = getBrepApi()\n try {\n return ok(kernel.fixShape(brepHandleOf(shape)))\n } catch (e) {\n return err(kernelError('FIX_SHAPE_FAILED', 'ShapeFix_Shape failed', e))\n }\n}\n\n/** Fix wire self-intersection (occt platform method).\n *\n * @param args - Resolved arguments (wire shape).\n * @returns The fixed wire as a `BrepHandle`.\n */\nexport function fixSelfIntersectionBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape] = resolveArgs(args, FIX_SELF_INTERSECTION_PARAMS)\n try {\n const result = getOcctKernel().healWire(brepHandleOf(shape) as never, 1e-6)\n if (getOcctKernel().getShapeType(result as never) !== 'wire') {\n return err(kernelError('FIX_SELF_INTERSECTION_FAILED', 'Result is not a wire'))\n }\n return ok(result as never as BrepHandle)\n } catch (e) {\n return err(kernelError('FIX_SELF_INTERSECTION_FAILED', 'Failed to fix wire self-intersection', e))\n }\n}\n\n/** Simplify a shape (occt platform method).\n *\n * @param args - Resolved arguments (shape).\n * @returns The simplified shape as a `BrepHandle`.\n */\nexport function simplifyBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape] = resolveArgs(args, SIMPLIFY_PARAMS)\n try {\n return ok(getOcctKernel().simplify(brepHandleOf(shape) as never) as never as BrepHandle)\n } catch (e) {\n return err(kernelError('SIMPLIFY_FAILED', 'Kernel simplify failed', e))\n }\n}\n\n// ---------------------------------------------------------------------------\n// autoHeal pipeline\n// ---------------------------------------------------------------------------\n\ninterface HealingStepDiagnostic {\n readonly name: string\n readonly attempted: boolean\n readonly succeeded: boolean\n readonly detail?: string\n}\n\ninterface AutoHealOptions {\n fixWires?: boolean\n fixFaces?: boolean\n fixSolids?: boolean\n sewTolerance?: number\n fixSelfIntersection?: boolean\n}\n\ninterface HealingReport {\n readonly isValid: boolean\n readonly alreadyValid: boolean\n readonly wiresHealed: number\n readonly facesHealed: number\n readonly solidHealed: boolean\n readonly steps: ReadonlyArray<string>\n readonly diagnostics: ReadonlyArray<HealingStepDiagnostic>\n}\n\n/** Shape-kind check on a raw handle (occt `shapeType`). */\nfunction kindOf(h: BrepHandle): string {\n return getOcctKernel().getShapeType(h as never)\n}\n\n/**\n * Auto-heal pipeline (brepjs `autoHeal`): short-circuit on valid, optional\n * sew / wire self-intersection pass, shape-level heal, sub-shape delta report.\n *\n * The returned record carries the healed shape as a raw BREP handle; the\n * projection wraps it via `fromHandle` so callers receive a faijs Shape.\n *\n * @param args - Resolved arguments (shape, auto-heal options).\n * @returns The healed shape with a diagnostic healing report.\n */\nexport function autoHealBrep(...args: unknown[]): Result<{ shape: BrepHandle; report: HealingReport }> {\n const [shape, options] = resolveArgs(args, AUTO_HEAL_PARAMS)\n const opts = (options ?? {}) as AutoHealOptions\n const fixWires = opts.fixWires !== false\n const fixFaces = opts.fixFaces !== false\n const fixSolids = opts.fixSolids !== false\n const fixSelfIntersectionOpt = opts.fixSelfIntersection === true\n const sewTolerance = opts.sewTolerance\n\n const steps: string[] = []\n const diagnostics: HealingStepDiagnostic[] = []\n const kernel = getBrepApi()\n const input = brepHandleOf(shape)\n\n const valid = kernel.isValid(input)\n if (valid) {\n return ok({\n shape: input,\n report: {\n isValid: true,\n alreadyValid: true,\n wiresHealed: 0,\n facesHealed: 0,\n solidHealed: false,\n steps: ['Shape already valid'],\n diagnostics: [{ name: 'validation', attempted: true, succeeded: true }],\n },\n })\n }\n\n steps.push('Shape invalid — applying shape-level healing')\n\n const wiresBefore = kernel.getSubShapes(input, 'wire').length\n const facesBefore = kernel.getSubShapes(input, 'face').length\n\n let current = input\n let solidHealed = false\n const setCurrent = (next: BrepHandle): void => {\n const prev = current\n current = next\n if (prev !== input && prev !== next) kernel.release(prev)\n }\n\n if (sewTolerance !== undefined) {\n try {\n setCurrent(kernel.sew([current], sewTolerance))\n steps.push(`Applied sewing with tolerance ${sewTolerance}`)\n diagnostics.push({ name: 'sew', attempted: true, succeeded: true, detail: `tolerance=${sewTolerance}` })\n } catch (e) {\n const detail = e instanceof Error ? e.message : String(e)\n steps.push(`Sewing failed: ${detail}`)\n diagnostics.push({ name: 'sew', attempted: true, succeeded: false, detail })\n }\n }\n\n if (fixSelfIntersectionOpt && fixWires) {\n const wires = kernel.getSubShapes(current, 'wire')\n let fixCount = 0\n for (const wire of wires) {\n try {\n getOcctKernel().healWire(wire as never, 1e-6)\n fixCount++\n } catch {\n // Ignore individual wire failures\n }\n }\n steps.push(`Self-intersection fix: ${fixCount}/${wires.length} wires`)\n diagnostics.push({\n name: 'fixSelfIntersection',\n attempted: true,\n succeeded: fixCount > 0,\n detail: `${fixCount}/${wires.length} wires fixed`,\n })\n }\n\n const kind = kindOf(current)\n const shouldHealShape =\n (kind === 'solid' && fixSolids) || (kind === 'face' && fixFaces) || (kind === 'wire' && fixWires)\n\n if (shouldHealShape) {\n const healResult = kind === 'solid' ? healSolidBrep(current) : kind === 'face' ? healFaceBrep(current) : healWireBrep(current)\n if (healResult.ok) {\n setCurrent(healResult.value)\n if (kind === 'solid') {\n solidHealed = true\n steps.push('Applied ShapeFix_Solid')\n diagnostics.push({ name: 'healSolid', attempted: true, succeeded: true })\n } else if (kind === 'face') {\n steps.push('Applied ShapeFix_Face')\n diagnostics.push({ name: 'healFace', attempted: true, succeeded: true })\n } else {\n steps.push('Applied ShapeFix_Wire')\n diagnostics.push({ name: 'healWire', attempted: true, succeeded: true })\n }\n } else {\n steps.push('Shape-level healing failed')\n diagnostics.push({ name: 'healShape', attempted: true, succeeded: false })\n }\n } else {\n diagnostics.push({ name: 'healShape', attempted: false, succeeded: false, detail: 'skipped by options' })\n }\n\n const wiresAfter = kernel.getSubShapes(current, 'wire').length\n const facesAfter = kernel.getSubShapes(current, 'face').length\n const wiresHealed = Math.abs(wiresAfter - wiresBefore)\n const facesHealed = Math.abs(facesAfter - facesBefore)\n\n if (wiresHealed > 0) steps.push(`Wire count changed by ${wiresHealed}`)\n if (facesHealed > 0) steps.push(`Face count changed by ${facesHealed}`)\n\n const finalValid = kernel.isValid(current)\n steps.push(finalValid ? 'Final validation: valid' : 'Final validation: still invalid')\n diagnostics.push({ name: 'finalValidation', attempted: true, succeeded: finalValid })\n\n return ok({\n shape: current,\n report: {\n isValid: finalValid,\n alreadyValid: false,\n wiresHealed,\n facesHealed,\n solidHealed,\n steps,\n diagnostics,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-hosted compat-op implementation — convexHull
|
|
3
|
+
* (core-decouple Phase 3, §5.4).
|
|
4
|
+
*
|
|
5
|
+
* @platform occt
|
|
6
|
+
*
|
|
7
|
+
* Semantics mirror brepjs `operations/convexHullFns.ts` (HULL_EMPTY_INPUT /
|
|
8
|
+
* HULL_NOT_3D / HULL_DEGENERATE guards) on the L1 `hullFromPoints` (core's own
|
|
9
|
+
* hull closure, §5.1) with tolerance 0.1 (brepjs default).
|
|
10
|
+
*/
|
|
11
|
+
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
12
|
+
import { type Result } from '../../result/result.js';
|
|
13
|
+
/**
|
|
14
|
+
* Compute the convex hull of a point set.
|
|
15
|
+
*
|
|
16
|
+
* @param args - Resolved arguments (point list).
|
|
17
|
+
* @returns The hull solid as a `BrepHandle`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function convexHullBrep(...args: unknown[]): Result<BrepHandle>;
|
|
20
|
+
//# sourceMappingURL=hullFns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hullFns.d.ts","sourceRoot":"","sources":["../../../src/api/brep-operations/hullFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAQ1D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CA6BrE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-hosted compat-op implementation — convexHull
|
|
3
|
+
* (core-decouple Phase 3, §5.4).
|
|
4
|
+
*
|
|
5
|
+
* @platform occt
|
|
6
|
+
*
|
|
7
|
+
* Semantics mirror brepjs `operations/convexHullFns.ts` (HULL_EMPTY_INPUT /
|
|
8
|
+
* HULL_NOT_3D / HULL_DEGENERATE guards) on the L1 `hullFromPoints` (core's own
|
|
9
|
+
* hull closure, §5.1) with tolerance 0.1 (brepjs default).
|
|
10
|
+
*/
|
|
11
|
+
import { getBrepApi } from '../../brep/handle-bridge.js';
|
|
12
|
+
import { ok, err } from '../../result/result.js';
|
|
13
|
+
import { kernelError, validationError } from '../../result/errors.js';
|
|
14
|
+
import { resolveArgs } from '../internal/dual-form-args.js';
|
|
15
|
+
const CONVEX_HULL_PARAMS = { name: 'convexHull', params: ['points'], formClass: 'A' };
|
|
16
|
+
/**
|
|
17
|
+
* Compute the convex hull of a point set.
|
|
18
|
+
*
|
|
19
|
+
* @param args - Resolved arguments (point list).
|
|
20
|
+
* @returns The hull solid as a `BrepHandle`.
|
|
21
|
+
*/
|
|
22
|
+
export function convexHullBrep(...args) {
|
|
23
|
+
const [pointsRaw] = resolveArgs(args, CONVEX_HULL_PARAMS);
|
|
24
|
+
const kernel = getBrepApi();
|
|
25
|
+
const points = (pointsRaw ?? []);
|
|
26
|
+
if (points.length < 4) {
|
|
27
|
+
return err(validationError('HULL_EMPTY_INPUT', `convexHull: at least 4 points required, got ${points.length}`));
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const objPoints = points.map((p) => ({ x: p[0], y: p[1], z: p[2] }));
|
|
31
|
+
const h = kernel.hullFromPoints(objPoints, 0.1);
|
|
32
|
+
if (!kernel.isSolid(h)) {
|
|
33
|
+
kernel.release(h);
|
|
34
|
+
return err(kernelError('HULL_NOT_3D', 'convexHull result is not a solid; points may be coplanar'));
|
|
35
|
+
}
|
|
36
|
+
return ok(h);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
const raw = e instanceof Error ? e.message : String(e);
|
|
40
|
+
if (raw.includes('coplanar') || raw.includes('fewer than') || raw.includes('degenerate')) {
|
|
41
|
+
return err(kernelError('HULL_DEGENERATE', `convexHull degenerate: ${raw}`, e));
|
|
42
|
+
}
|
|
43
|
+
return err(kernelError('HULL_FAILED', `convexHull failed: ${raw}`, e));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=hullFns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hullFns.js","sourceRoot":"","sources":["../../../src/api/brep-operations/hullFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,GAAG,EAAe,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGxD,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAgB,EAAE,CAAA;AAElG;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAG,IAAe;IAC/C,MAAM,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;IACzD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAA;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AO,GAAG,CAAC,WAAW,CAAC,aAAa,EAAE,sBAAsB,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IACxE,CAAC;AACH,CAAC","sourcesContent":["/**\n * Self-hosted compat-op implementation — convexHull\n * (core-decouple Phase 3, §5.4).\n *\n * @platform occt\n *\n * Semantics mirror brepjs `operations/convexHullFns.ts` (HULL_EMPTY_INPUT /\n * HULL_NOT_3D / HULL_DEGENERATE guards) on the L1 `hullFromPoints` (core's own\n * hull closure, §5.1) with tolerance 0.1 (brepjs default).\n */\n\nimport type { BrepHandle } from '../../brep/engine/types'\nimport { getBrepApi } from '../../brep/handle-bridge'\nimport { ok, err, 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'\n\nconst CONVEX_HULL_PARAMS = { name: 'convexHull', params: ['points'], formClass: 'A' as FormClass }\n\n/**\n * Compute the convex hull of a point set.\n *\n * @param args - Resolved arguments (point list).\n * @returns The hull solid as a `BrepHandle`.\n */\nexport function convexHullBrep(...args: unknown[]): Result<BrepHandle> {\n const [pointsRaw] = resolveArgs(args, CONVEX_HULL_PARAMS)\n const kernel = getBrepApi()\n const points = (pointsRaw ?? []) as Vec3[]\n\n if (points.length < 4) {\n return err(\n validationError(\n 'HULL_EMPTY_INPUT',\n `convexHull: at least 4 points required, got ${points.length}`,\n ),\n )\n }\n\n try {\n const objPoints = points.map((p) => ({ x: p[0], y: p[1], z: p[2] }))\n const h = kernel.hullFromPoints(objPoints, 0.1)\n if (!kernel.isSolid(h)) {\n kernel.release(h)\n return err(kernelError('HULL_NOT_3D', 'convexHull result is not a solid; points may be coplanar'))\n }\n return ok(h)\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n if (raw.includes('coplanar') || raw.includes('fewer than') || raw.includes('degenerate')) {\n return err(kernelError('HULL_DEGENERATE', `convexHull degenerate: ${raw}`, e))\n }\n return err(kernelError('HULL_FAILED', `convexHull failed: ${raw}`, e))\n }\n}\n"]}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BREP 榫卯结构操作 — 用 OCCT 精确实体复刻 mesh 路径的榫卯布尔序列
|
|
3
|
+
*
|
|
4
|
+
* See docs/api-contract.md §8 (dual-path geometry contract) and §10.5 (split).
|
|
5
|
+
*
|
|
6
|
+
* 与 mesh 路径(joinery-shapes.ts + csg-worker.ts)对照:
|
|
7
|
+
* - mesh 路径:buildWedgeGeometry/buildDowelGeometry/buildStraightTenonGeometry → Manifold CSG
|
|
8
|
+
* - BREP 路径:buildWedgeSolid/buildDowelSolid/buildTenonSolid → OCCT fuse/cut/common
|
|
9
|
+
*
|
|
10
|
+
* 坐标框架与 mesh 路径完全一致:
|
|
11
|
+
* - normal: 切割平面法线(单位向量,指向上方)
|
|
12
|
+
* - widthDir: 挤出方向(单位向量)
|
|
13
|
+
* - depthDir = normalize(cross(normal, widthDir))
|
|
14
|
+
* - planeCenter: 切割平面中心
|
|
15
|
+
*
|
|
16
|
+
* 所有函数都是纯函数,输入输出均为 OCCT BrepHandle,调用方负责句柄生命周期。
|
|
17
|
+
*/
|
|
18
|
+
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
19
|
+
import type { BrepEngineApi } from '../../brep/engine/primitives.js';
|
|
20
|
+
import type { Vec3 } from '../../mesh/types.js';
|
|
21
|
+
/** 榫卯操作的坐标框架(与 joinery-shapes.ts 一致) */
|
|
22
|
+
export interface JoineryBasis {
|
|
23
|
+
/** 切割平面法线(单位向量) */
|
|
24
|
+
normal: Vec3;
|
|
25
|
+
/** 宽度/挤出方向(单位向量) */
|
|
26
|
+
widthDir: Vec3;
|
|
27
|
+
/** 深度方向 = normalize(cross(normal, widthDir)) */
|
|
28
|
+
depthDir: Vec3;
|
|
29
|
+
/** 切割平面中心 */
|
|
30
|
+
planeCenter: Vec3;
|
|
31
|
+
/** 平面原点偏移 = dot(normal, planeCenter) */
|
|
32
|
+
planeDistance: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 梯形棱柱(燕尾楔)— BREP 等价物。
|
|
36
|
+
*
|
|
37
|
+
* 复刻 joinery-shapes.ts buildWedgeGeometry 的 8 顶点拓扑:
|
|
38
|
+
* - 梯形截面在 normal-depthDir 平面
|
|
39
|
+
* - 底边(宽)在 planeCenter - normal*depth
|
|
40
|
+
* - 顶边(窄)在 planeCenter
|
|
41
|
+
* - 沿 widthDir 拉伸 extrudeLength,居中于 planeCenter
|
|
42
|
+
*
|
|
43
|
+
* 用 kernel.makeLineEdge + makeWire + makeFace + extrude 构造实体,
|
|
44
|
+
* 然后用 transform 对齐到世界坐标系。
|
|
45
|
+
* @param kernel - the BREP engine API.
|
|
46
|
+
* @param basis - the joinery coordinate frame (normal/widthDir/depthDir/planeCenter).
|
|
47
|
+
* @param depth - the wedge depth along the normal direction.
|
|
48
|
+
* @param width - the wedge bottom width.
|
|
49
|
+
* @param angleDeg - the dovetail flap angle in degrees.
|
|
50
|
+
* @param extrudeLength - the extrusion length along the width direction.
|
|
51
|
+
* @returns the constructed wedge solid handle.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildWedgeSolid(kernel: BrepEngineApi, basis: JoineryBasis, depth: number, width: number, angleDeg: number, extrudeLength: number): BrepHandle;
|
|
54
|
+
/**
|
|
55
|
+
* 圆柱(定位销)— BREP 等价物。
|
|
56
|
+
*
|
|
57
|
+
* 复刻 joinery-shapes.ts buildDowelGeometry:
|
|
58
|
+
* - 圆截面在 widthDir-depthDir 平面,中心在 centroid
|
|
59
|
+
* - 从切割平面向下延伸 height(沿 -normal)
|
|
60
|
+
*
|
|
61
|
+
* 用 kernel.makeCylinder + transform 对齐方向。
|
|
62
|
+
* @param kernel - the BREP engine API.
|
|
63
|
+
* @param centroid - the centroid where the dowel is placed.
|
|
64
|
+
* @param basis - the joinery coordinate frame.
|
|
65
|
+
* @param diameter - the dowel diameter.
|
|
66
|
+
* @param height - the dowel height along the normal direction.
|
|
67
|
+
* @returns the constructed dowel solid handle.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildDowelSolid(kernel: BrepEngineApi, centroid: Vec3, basis: JoineryBasis, diameter: number, height: number): BrepHandle;
|
|
70
|
+
/**
|
|
71
|
+
* 长方体(直榫)— BREP 等价物。
|
|
72
|
+
*
|
|
73
|
+
* 复刻 joinery-shapes.ts buildStraightTenonGeometry:
|
|
74
|
+
* - 方截面在 widthDir-depthDir 平面,中心在 centroid
|
|
75
|
+
* - 从切割平面向下延伸 height(沿 -normal)
|
|
76
|
+
*
|
|
77
|
+
* 用 kernel.makeBoxFromCorners + transform 对齐方向。
|
|
78
|
+
* @param kernel - the BREP engine API.
|
|
79
|
+
* @param centroid - the centroid where the tenon is placed.
|
|
80
|
+
* @param basis - the joinery coordinate frame.
|
|
81
|
+
* @param sideLength - the tenon square side length.
|
|
82
|
+
* @param height - the tenon height along the normal direction.
|
|
83
|
+
* @returns the constructed tenon solid handle.
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildTenonSolid(kernel: BrepEngineApi, centroid: Vec3, basis: JoineryBasis, sideLength: number, height: number): BrepHandle;
|
|
86
|
+
/** 截面分量信息 */
|
|
87
|
+
export interface CrossSectionComponent {
|
|
88
|
+
/** 分量质心 */
|
|
89
|
+
centroid: Vec3;
|
|
90
|
+
/** 分量面积(近似,用于排序) */
|
|
91
|
+
area: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 检测上部实体在切割平面上的截面连通分量。
|
|
95
|
+
*
|
|
96
|
+
* BREP 等价物:将 upper solid 三角化后,用与 mesh 路径 detectCapComponents
|
|
97
|
+
* 完全相同的算法(找帽面三角形 → union-find)检测连通分量。
|
|
98
|
+
*
|
|
99
|
+
* 与 csg-worker.ts detectCapComponents + computeCrossSectionCentroid 一致。
|
|
100
|
+
* @param kernel - the BREP engine API.
|
|
101
|
+
* @param upper - the upper solid whose cross section is analyzed.
|
|
102
|
+
* @param basis - the joinery coordinate frame.
|
|
103
|
+
* @returns the detected cross-section components (centroid + area).
|
|
104
|
+
*/
|
|
105
|
+
export declare function detectCrossSectionComponents(kernel: BrepEngineApi, upper: BrepHandle, basis: JoineryBasis): CrossSectionComponent[];
|
|
106
|
+
/** dovetail 布尔分割的结果 */
|
|
107
|
+
export interface DovetailSplitBrepResult {
|
|
108
|
+
/** 上部 + 楔(法线正方向半部分加燕尾榫) */
|
|
109
|
+
front: BrepHandle;
|
|
110
|
+
/** 下部 - 凹腔(法线负方向半部分减燕尾槽) */
|
|
111
|
+
back: BrepHandle;
|
|
112
|
+
}
|
|
113
|
+
/** dowel/tenon 布尔分割的结果 */
|
|
114
|
+
export interface DowelOrTenonSplitBrepResult {
|
|
115
|
+
/** 上部 + 销/榫(法线正方向半部分加圆柱/方柱) */
|
|
116
|
+
front: BrepHandle;
|
|
117
|
+
/** 下部 - 孔(法线负方向半部分减圆柱/方柱) */
|
|
118
|
+
back: BrepHandle;
|
|
119
|
+
}
|
|
120
|
+
/** groove 参数 */
|
|
121
|
+
export interface GrooveParams {
|
|
122
|
+
depth: number;
|
|
123
|
+
depthTolerance: number;
|
|
124
|
+
width: number;
|
|
125
|
+
widthTolerance: number;
|
|
126
|
+
flapsAngle: number;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Dovetail(燕尾)布尔分割 — BREP 等价物。
|
|
130
|
+
*
|
|
131
|
+
* 1:1 复刻 csg-worker.ts dovetailBooleanSplit:
|
|
132
|
+
* 1. splitBrep → upper + lower
|
|
133
|
+
* 2. 计算 crossSectionWidth(bbox 投影近似)
|
|
134
|
+
* 3. buildWedgeSolid(overhang=20)→ common(wedge, lower) 裁剪贴合
|
|
135
|
+
* 4. fuse(upper, wedgeTrimmed) → upper'
|
|
136
|
+
* 5. buildWedgeSolid(公差)→ cut(lower, wedgeTol) → lower'
|
|
137
|
+
* @param kernel - the BREP engine API.
|
|
138
|
+
* @param original - the original solid to split.
|
|
139
|
+
* @param basis - the joinery coordinate frame.
|
|
140
|
+
* @param groove - the dovetail groove parameters.
|
|
141
|
+
* @returns the split result with front (upper + wedge) and back (lower - cavity) handles.
|
|
142
|
+
*/
|
|
143
|
+
export declare function dovetailBooleanSplitBrep(kernel: BrepEngineApi, original: BrepHandle, basis: JoineryBasis, groove: GrooveParams): DovetailSplitBrepResult;
|
|
144
|
+
/** dowel/tenon 参数 */
|
|
145
|
+
export interface DowelOrTenonParams {
|
|
146
|
+
/** 直径(dowel)或边长(tenon) */
|
|
147
|
+
size: number;
|
|
148
|
+
/** 尺寸公差 */
|
|
149
|
+
sizeTolerance: number;
|
|
150
|
+
/** 高度 */
|
|
151
|
+
height: number;
|
|
152
|
+
/** 高度公差 */
|
|
153
|
+
heightTolerance: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Dowel(定位销)/ Tenon(直榫)布尔分割 — BREP 等价物。
|
|
157
|
+
*
|
|
158
|
+
* 1:1 复刻 csg-worker.ts dowelOrTenonBooleanSplit:
|
|
159
|
+
* 1. splitBrep → upper + lower
|
|
160
|
+
* 2. detectCrossSectionComponents → 截面质心列表
|
|
161
|
+
* 3. 对每个质心:buildShapeSolid → fuse(upper, shape) → upper'
|
|
162
|
+
* 4. 对每个质心:buildShapeSolid(公差)→ cut(lower, shapeTol) → lower'
|
|
163
|
+
* @param kernel - the BREP engine API.
|
|
164
|
+
* @param original - the original solid to split.
|
|
165
|
+
* @param basis - the joinery coordinate frame.
|
|
166
|
+
* @param shape - whether to build a dowel or a tenon.
|
|
167
|
+
* @param params - the dowel/tenon size and tolerance parameters.
|
|
168
|
+
* @param selectedSections - optional indices of cross-section components to place shapes on.
|
|
169
|
+
* @returns the split result with front (upper + shape) and back (lower - hole) handles.
|
|
170
|
+
*/
|
|
171
|
+
export declare function dowelOrTenonBooleanSplitBrep(kernel: BrepEngineApi, original: BrepHandle, basis: JoineryBasis, shape: 'dowel' | 'tenon', params: DowelOrTenonParams, selectedSections?: number[] | null): DowelOrTenonSplitBrepResult;
|
|
172
|
+
//# sourceMappingURL=joinery-brep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joinery-brep.d.ts","sourceRoot":"","sources":["../../../src/api/brep-operations/joinery-brep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAQ5C,wCAAwC;AACxC,MAAM,WAAW,YAAY;IAC3B,mBAAmB;IACnB,MAAM,EAAE,IAAI,CAAA;IACZ,oBAAoB;IACpB,QAAQ,EAAE,IAAI,CAAA;IACd,gDAAgD;IAChD,QAAQ,EAAE,IAAI,CAAA;IACd,aAAa;IACb,WAAW,EAAE,IAAI,CAAA;IACjB,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAA;CACtB;AAsND;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB,UAAU,CAwCZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,IAAI,EACd,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,UAAU,CAsBZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,IAAI,EACd,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,UAA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