@faicad/faijs 0.29.5 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +6 -5
- package/dist/api/align/index.d.ts +64 -0
- package/dist/api/align/index.d.ts.map +1 -0
- package/dist/api/align/index.js +101 -0
- package/dist/api/align/index.js.map +1 -0
- package/dist/api/api-namespace.d.ts +6 -5
- package/dist/api/api-namespace.d.ts.map +1 -1
- package/dist/api/api-namespace.js +89 -5
- 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-op/index.d.ts +65 -0
- package/dist/api/boolean-op/index.d.ts.map +1 -0
- package/dist/api/boolean-op/index.js +113 -0
- package/dist/api/boolean-op/index.js.map +1 -0
- package/dist/api/boolean.d.ts.map +1 -1
- package/dist/api/boolean.js +22 -33
- 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 +91 -0
- package/dist/api/brep-operations/healingFns.d.ts.map +1 -0
- package/dist/api/brep-operations/healingFns.js +321 -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 +111 -0
- package/dist/api/brep-operations/topologyFns.d.ts.map +1 -0
- package/dist/api/brep-operations/topologyFns.js +300 -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/chamfer.d.ts +5 -4
- package/dist/api/chamfer.d.ts.map +1 -1
- package/dist/api/chamfer.js +12 -11
- package/dist/api/chamfer.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 +493 -0
- package/dist/api/curve-sketch/index.js.map +1 -0
- package/dist/api/draft.d.ts.map +1 -1
- package/dist/api/draft.js +1 -3
- package/dist/api/draft.js.map +1 -1
- package/dist/api/engrave.d.ts.map +1 -1
- package/dist/api/engrave.js +6 -15
- package/dist/api/engrave.js.map +1 -1
- package/dist/api/export-3mf.d.ts +73 -0
- package/dist/api/export-3mf.d.ts.map +1 -0
- package/dist/api/export-3mf.js +121 -0
- package/dist/api/export-3mf.js.map +1 -0
- package/dist/api/export-brep.d.ts +47 -0
- package/dist/api/export-brep.d.ts.map +1 -0
- package/dist/api/export-brep.js +67 -0
- package/dist/api/export-brep.js.map +1 -0
- package/dist/api/export-step.d.ts +67 -0
- package/dist/api/export-step.d.ts.map +1 -0
- package/dist/api/export-step.js +98 -0
- package/dist/api/export-step.js.map +1 -0
- package/dist/api/export-stl.d.ts +58 -0
- package/dist/api/export-stl.d.ts.map +1 -0
- package/dist/api/export-stl.js +114 -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/feature-repair.d.ts +1 -1
- package/dist/api/feature-repair.d.ts.map +1 -1
- package/dist/api/feature-repair.js +1 -7
- package/dist/api/feature-repair.js.map +1 -1
- package/dist/api/fillet-variable.d.ts +2 -2
- package/dist/api/fillet-variable.d.ts.map +1 -1
- package/dist/api/fillet-variable.js +2 -3
- package/dist/api/fillet-variable.js.map +1 -1
- package/dist/api/fillet.d.ts +5 -7
- package/dist/api/fillet.d.ts.map +1 -1
- package/dist/api/fillet.js +5 -8
- 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 +58 -54
- 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/script-face-manifest.d.ts +1 -1
- package/dist/api/generated/script-face-manifest.js +3 -3
- package/dist/api/generated/script-face-manifest.js.map +1 -1
- package/dist/api/generated/script-face.d.ts +1 -1
- package/dist/api/generated/script-face.js +1 -1
- package/dist/api/generated/script-face.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 +8 -4
- 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 +77 -73
- 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 +11 -2
- package/dist/api/helix.d.ts.map +1 -1
- package/dist/api/helix.js +20 -4
- package/dist/api/helix.js.map +1 -1
- package/dist/api/index.d.ts +19 -7
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +44 -11
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/compat-op.d.ts +10 -36
- package/dist/api/internal/compat-op.d.ts.map +1 -1
- package/dist/api/internal/compat-op.js +17 -51
- 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/export-members.d.ts +80 -0
- package/dist/api/internal/export-members.d.ts.map +1 -0
- package/dist/api/internal/export-members.js +104 -0
- package/dist/api/internal/export-members.js.map +1 -0
- package/dist/api/internal/l3-bridge.d.ts +22 -37
- package/dist/api/internal/l3-bridge.d.ts.map +1 -1
- package/dist/api/internal/l3-bridge.js +30 -77
- 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/measure-query/index.d.ts +262 -0
- package/dist/api/measure-query/index.d.ts.map +1 -0
- package/dist/api/measure-query/index.js +390 -0
- package/dist/api/measure-query/index.js.map +1 -0
- 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.d.ts.map +1 -1
- package/dist/api/pattern.js +3 -6
- package/dist/api/pattern.js.map +1 -1
- package/dist/api/primitives.d.ts +6 -6
- package/dist/api/primitives.d.ts.map +1 -1
- package/dist/api/primitives.js +19 -17
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/profile.d.ts.map +1 -1
- package/dist/api/profile.js +0 -1
- package/dist/api/profile.js.map +1 -1
- package/dist/api/punch-hole.d.ts.map +1 -1
- package/dist/api/punch-hole.js +0 -1
- package/dist/api/punch-hole.js.map +1 -1
- package/dist/api/replicate.d.ts +6 -8
- package/dist/api/replicate.d.ts.map +1 -1
- package/dist/api/replicate.js +27 -65
- 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/section-by-plane.d.ts.map +1 -1
- package/dist/api/section-by-plane.js +0 -1
- package/dist/api/section-by-plane.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.d.ts.map +1 -1
- package/dist/api/shell.js +12 -3
- package/dist/api/shell.js.map +1 -1
- package/dist/api/sketch-on-face.d.ts +3 -3
- package/dist/api/sketch-on-face.d.ts.map +1 -1
- package/dist/api/sketch-on-face.js +6 -4
- package/dist/api/sketch-on-face.js.map +1 -1
- package/dist/api/sketch-on-plane.d.ts.map +1 -1
- package/dist/api/sketch-on-plane.js +0 -1
- package/dist/api/sketch-on-plane.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/split-by-plane.d.ts.map +1 -1
- package/dist/api/split-by-plane.js +0 -1
- package/dist/api/split-by-plane.js.map +1 -1
- package/dist/api/split.d.ts +1 -1
- package/dist/api/split.js +1 -1
- package/dist/api/split.js.map +1 -1
- package/dist/api/surface/arg-spec.d.ts +37 -44
- package/dist/api/surface/arg-spec.d.ts.map +1 -1
- package/dist/api/surface/arg-spec.js +224 -233
- 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 +71 -9
- package/dist/api/sweep.d.ts.map +1 -1
- package/dist/api/sweep.js +13 -6
- package/dist/api/sweep.js.map +1 -1
- package/dist/api/thicken.d.ts +1 -1
- package/dist/api/thicken.d.ts.map +1 -1
- package/dist/api/thicken.js +12 -3
- package/dist/api/thicken.js.map +1 -1
- package/dist/api/transform.d.ts +8 -8
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +58 -27
- 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/boolean/index.d.ts +23 -0
- package/dist/boolean/index.d.ts.map +1 -0
- package/dist/boolean/index.js +27 -0
- package/dist/boolean/index.js.map +1 -0
- package/dist/brep/brep-chain.d.ts +1 -19
- package/dist/brep/brep-chain.d.ts.map +1 -1
- package/dist/brep/brep-chain.js +0 -1
- package/dist/brep/brep-chain.js.map +1 -1
- package/dist/brep/brep-ops.d.ts +93 -2
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +185 -15
- 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/brep-mock.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.js +0 -3
- package/dist/brep/engine/adapters/brep-mock.js.map +1 -1
- package/dist/brep/engine/adapters/brepkit.d.ts +4 -3
- package/dist/brep/engine/adapters/brepkit.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brepkit.js +4 -98
- package/dist/brep/engine/adapters/brepkit.js.map +1 -1
- package/dist/brep/engine/adapters/occt.d.ts +1 -1
- package/dist/brep/engine/adapters/occt.d.ts.map +1 -1
- package/dist/brep/engine/adapters/occt.js +4 -148
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/engine/native-history.d.ts +27 -0
- package/dist/brep/engine/native-history.d.ts.map +1 -0
- package/dist/brep/engine/native-history.js +54 -0
- package/dist/brep/engine/native-history.js.map +1 -0
- 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 +3 -5
- package/dist/brep/engine/registry.d.ts.map +1 -1
- package/dist/brep/engine/registry.js +2 -2
- package/dist/brep/engine/registry.js.map +1 -1
- package/dist/brep/engine/types.d.ts +35 -77
- package/dist/brep/engine/types.d.ts.map +1 -1
- package/dist/brep/engine/types.js.map +1 -1
- package/dist/brep/export/export-model.d.ts +21 -0
- package/dist/brep/export/export-model.d.ts.map +1 -1
- package/dist/brep/export/export-model.js +171 -73
- package/dist/brep/export/export-model.js.map +1 -1
- package/dist/brep/export/step.d.ts +17 -1
- package/dist/brep/export/step.d.ts.map +1 -1
- package/dist/brep/export/step.js +133 -0
- package/dist/brep/export/step.js.map +1 -1
- package/dist/brep/export/stl.d.ts +22 -1
- package/dist/brep/export/stl.d.ts.map +1 -1
- package/dist/brep/export/stl.js +58 -10
- package/dist/brep/export/stl.js.map +1 -1
- package/dist/brep/export/transform12.d.ts +47 -0
- package/dist/brep/export/transform12.d.ts.map +1 -0
- package/dist/brep/export/transform12.js +87 -0
- package/dist/brep/export/transform12.js.map +1 -0
- package/dist/brep/face-evolution.d.ts +53 -0
- package/dist/brep/face-evolution.d.ts.map +1 -1
- package/dist/brep/face-evolution.js +65 -0
- package/dist/brep/face-evolution.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-host/index.d.ts +4 -1
- package/dist/browser-host/index.d.ts.map +1 -1
- package/dist/browser-host/index.js +7 -1
- package/dist/browser-host/index.js.map +1 -1
- package/dist/browser.d.ts +5 -9
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +5 -26
- 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.d.ts +13 -58
- package/dist/cad-runtime/backend-dispatch.d.ts.map +1 -1
- package/dist/cad-runtime/backend-dispatch.js +34 -83
- package/dist/cad-runtime/backend-dispatch.js.map +1 -1
- package/dist/cad-runtime/content-key.d.ts +3 -3
- package/dist/cad-runtime/content-key.js +3 -3
- package/dist/cad-runtime/content-key.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 +31 -3
- package/dist/cad-runtime/ports.d.ts.map +1 -1
- package/dist/cad-runtime/ports.js.map +1 -1
- package/dist/cad-runtime/runtime.d.ts +54 -19
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +89 -54
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +10 -14
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +5 -22
- package/dist/define-op.js.map +1 -1
- package/dist/env-agnostic.d.ts +2 -2
- package/dist/env-agnostic.d.ts.map +1 -1
- package/dist/env-agnostic.js +1 -1
- package/dist/env-agnostic.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 +14 -65
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -70
- 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 +53 -0
- package/dist/lang/symbol-table.generated.d.ts.map +1 -1
- package/dist/lang/symbol-table.generated.js +53 -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 -63
- package/dist/mesh/index.d.ts.map +1 -1
- package/dist/mesh/index.js +19 -72
- package/dist/mesh/index.js.map +1 -1
- package/dist/mesh/io.d.ts +62 -17
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +210 -41
- 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 +52 -5
- package/dist/mesh/threemf-loader.d.ts.map +1 -1
- package/dist/mesh/threemf-loader.js +139 -41
- 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 +35 -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 +56 -0
- package/dist/node-host/execute-script.d.ts.map +1 -0
- package/dist/node-host/execute-script.js +47 -0
- package/dist/node-host/execute-script.js.map +1 -0
- package/dist/node-host/index.d.ts +1 -0
- package/dist/node-host/index.d.ts.map +1 -1
- package/dist/node-host/index.js +4 -0
- package/dist/node-host/index.js.map +1 -1
- 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/primitives/index.d.ts +19 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +21 -0
- package/dist/primitives/index.js.map +1 -0
- 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 +79 -29
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +84 -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/sdf/index.d.ts +12 -0
- package/dist/sdf/index.d.ts.map +1 -0
- package/dist/sdf/index.js +13 -0
- package/dist/sdf/index.js.map +1 -0
- package/dist/sdk.d.ts +0 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js.map +1 -1
- 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 +3 -3
- package/dist/weapp.d.ts.map +1 -1
- package/dist/weapp.js +2 -2
- package/dist/weapp.js.map +1 -1
- package/package.json +283 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compoundFns.js","sourceRoot":"","sources":["../../../src/api/brep-mirror/compoundFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;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,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,GAAgB,EAAE,CAAA;AACjG,MAAM,aA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AAC,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 * Semantics mirror vendored `operations/compoundOpsFns.ts` with the brepjs\n * object model dropped:\n * - `options.face` supports an omitted default (highest-Z face) or an already\n * constructed brepjs Face (`{ wrapped }`); FinderFn (brepjs finder DSL) is\n * not supported after selfhosting.\n * - `options.profile` must be an already constructed brepjs Wire (`{ wrapped }`);\n * DrawingLike (sketchOnPlane) is not supported (sketch DSL is the brepjs\n * compat surface, 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 '../brepjs-compat/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 (vendored vecOps)\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 brepjs Face handle or omitted'),\n )\n }\n }\n return err(validationError('COMPOUND_FACE_NOT_FOUND', 'compoundOps: face spec must be a brepjs Face handle or omitted'))\n}\n\n/** 面法向(uv 中心,vendored normalAt)。 */\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/** 面质心(vendored faceCenter)。 */\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(brepjs 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 brepjs Wire (${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"]}
|
|
1
|
+
{"version":3,"file":"compoundFns.js","sourceRoot":"","sources":["../../../src/api/brep-mirror/compoundFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,GA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EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAC5C,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAC9B,CAAA;QACD,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAA;IACrC,CAAC;IAAC,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 * Semantics mirror brepjs `operations/compoundOpsFns.ts` with the brepjs\n * object model dropped:\n * - `options.face` supports an omitted default (highest-Z face) or an already\n * constructed brepjs Face (`{ wrapped }`); FinderFn (brepjs finder DSL) is\n * not supported after selfhosting.\n * - `options.profile` must be an already constructed brepjs Wire (`{ wrapped }`);\n * DrawingLike (sketchOnPlane) is not supported (sketch DSL is the brepjs\n * compat surface, 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 '../brepjs-compat/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 (brepjs vecOps)\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 brepjs Face handle or omitted'),\n )\n }\n }\n return err(validationError('COMPOUND_FACE_NOT_FOUND', 'compoundOps: face spec must be a brepjs Face handle or omitted'))\n}\n\n/** 面法向(uv 中心,brepjs normalAt)。 */\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/** 面质心(brepjs faceCenter)。 */\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(brepjs 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 brepjs Wire (${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"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @platform occt
|
|
6
6
|
*
|
|
7
7
|
* Brep-shaped implementations for `heal`, `healSolid`, `fixShape`, `autoHeal`,
|
|
8
|
-
* `fixSelfIntersection`, `simplify`. Semantics mirror
|
|
8
|
+
* `fixSelfIntersection`, `simplify`. Semantics mirror brepjs
|
|
9
9
|
* `topology/healingFns.ts` / `topology/shapeFns.ts` (error codes preserved),
|
|
10
10
|
* with the brepjs object model (castResultShape / cache invalidation) dropped:
|
|
11
11
|
* occt-wasm handles only. Platform-native methods (`healFace`, `healWire`,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
15
15
|
import { type Result } from '../../result/result.js';
|
|
16
|
-
/** Heal a solid (`ShapeFix_Solid`); error codes match
|
|
16
|
+
/** Heal a solid (`ShapeFix_Solid`); error codes match brepjs `healSolid`.
|
|
17
17
|
*
|
|
18
18
|
* @param args - Resolved arguments (solid shape).
|
|
19
19
|
* @returns The healed solid as a `BrepHandle`.
|
|
@@ -21,7 +21,7 @@ import { type Result } from '../../result/result.js';
|
|
|
21
21
|
export declare function healSolidBrep(...args: unknown[]): Result<BrepHandle>;
|
|
22
22
|
/**
|
|
23
23
|
* Dispatch healing by shape type (solid/face/wire); other types pass through
|
|
24
|
-
* unchanged (
|
|
24
|
+
* unchanged (brepjs `heal`).
|
|
25
25
|
*
|
|
26
26
|
* @param args - Resolved arguments (shape).
|
|
27
27
|
* @returns The healed shape as a `BrepHandle`.
|
|
@@ -61,7 +61,7 @@ interface HealingReport {
|
|
|
61
61
|
readonly diagnostics: ReadonlyArray<HealingStepDiagnostic>;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
* Auto-heal pipeline (
|
|
64
|
+
* Auto-heal pipeline (brepjs `autoHeal`): short-circuit on valid, optional
|
|
65
65
|
* sew / wire self-intersection pass, shape-level heal, sub-shape delta report.
|
|
66
66
|
*
|
|
67
67
|
* The returned record carries the healed shape as a raw BREP handle; the
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @platform occt
|
|
6
6
|
*
|
|
7
7
|
* Brep-shaped implementations for `heal`, `healSolid`, `fixShape`, `autoHeal`,
|
|
8
|
-
* `fixSelfIntersection`, `simplify`. Semantics mirror
|
|
8
|
+
* `fixSelfIntersection`, `simplify`. Semantics mirror brepjs
|
|
9
9
|
* `topology/healingFns.ts` / `topology/shapeFns.ts` (error codes preserved),
|
|
10
10
|
* with the brepjs object model (castResultShape / cache invalidation) dropped:
|
|
11
11
|
* occt-wasm handles only. Platform-native methods (`healFace`, `healWire`,
|
|
@@ -30,7 +30,7 @@ const SIMPLIFY_PARAMS = { name: 'simplify', params: ['shape'], formClass: 'A' };
|
|
|
30
30
|
// ---------------------------------------------------------------------------
|
|
31
31
|
// heal (type-dispatching)
|
|
32
32
|
// ---------------------------------------------------------------------------
|
|
33
|
-
/** Heal a solid (`ShapeFix_Solid`); error codes match
|
|
33
|
+
/** Heal a solid (`ShapeFix_Solid`); error codes match brepjs `healSolid`.
|
|
34
34
|
*
|
|
35
35
|
* @param args - Resolved arguments (solid shape).
|
|
36
36
|
* @returns The healed solid as a `BrepHandle`.
|
|
@@ -88,7 +88,7 @@ function healWireBrep(handle) {
|
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Dispatch healing by shape type (solid/face/wire); other types pass through
|
|
91
|
-
* unchanged (
|
|
91
|
+
* unchanged (brepjs `heal`).
|
|
92
92
|
*
|
|
93
93
|
* @param args - Resolved arguments (shape).
|
|
94
94
|
* @returns The healed shape as a `BrepHandle`.
|
|
@@ -160,7 +160,7 @@ function kindOf(h) {
|
|
|
160
160
|
return getOcctKernel().getShapeType(h);
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
* Auto-heal pipeline (
|
|
163
|
+
* Auto-heal pipeline (brepjs `autoHeal`): short-circuit on valid, optional
|
|
164
164
|
* sew / wire self-intersection pass, shape-level heal, sub-shape delta report.
|
|
165
165
|
*
|
|
166
166
|
* The returned record carries the healed shape as a raw BREP handle; the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"healingFns.js","sourceRoot":"","sources":["../../../src/api/brep-mirror/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,WAAW,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,GAAgB,EAAE,CAAA;AACpF,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,GAAgB,EAAE,CAAA;AAC/F,MAAM,gBAAgB,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,GAAgB,EAAE,CAAA;AAC7F,MAAM,gBAAgB,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,GAAgB,EA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I,WAAW,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAA;IACvE,IAAI,WAAW,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAA;IAEvE,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1C,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAA;IACtF,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAA;IAErF,OAAO,EAAE,CAAC;QACR,KAAK,EAAE,OAAO;QACd,MAAM,EAAE;YACN,OAAO,EAAE,UAAU;YACnB,YAAY,EAAE,KAAK;YACnB,WAAW;YACX,WAAW;YACX,WAAW;YACX,KAAK;YACL,WAAW;SACZ;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * Self-hosted compat-op implementations — shape healing family\n * (core-decouple Phase 3, §5.4).\n *\n * @platform occt\n *\n * Brep-shaped implementations for `heal`, `healSolid`, `fixShape`, `autoHeal`,\n * `fixSelfIntersection`, `simplify`. Semantics mirror vendored\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 vendored `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 (vendored `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 (vendored `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"]}
|
|
1
|
+
{"version":3,"file":"healingFns.js","sourceRoot":"","sources":["../../../src/api/brep-mir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AW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAA;IAErF,OAAO,EAAE,CAAC;QACR,KAAK,EAAE,OAAO;QACd,MAAM,EAAE;YACN,OAAO,EAAE,UAAU;YACnB,YAAY,EAAE,KAAK;YACnB,WAAW;YACX,WAAW;YACX,WAAW;YACX,KAAK;YACL,WAAW;SACZ;KACF,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * Self-hosted compat-op implementations — shape healing family\n * (core-decouple Phase 3, §5.4).\n *\n * @platform occt\n *\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"]}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @platform occt
|
|
6
6
|
*
|
|
7
|
-
* Semantics mirror
|
|
7
|
+
* Semantics mirror brepjs `operations/convexHullFns.ts` (HULL_EMPTY_INPUT /
|
|
8
8
|
* HULL_NOT_3D / HULL_DEGENERATE guards) on the L1 `hullFromPoints` (core's own
|
|
9
|
-
* hull closure, §5.1) with tolerance 0.1 (
|
|
9
|
+
* hull closure, §5.1) with tolerance 0.1 (brepjs default).
|
|
10
10
|
*/
|
|
11
11
|
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
12
12
|
import { type Result } from '../../result/result.js';
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @platform occt
|
|
6
6
|
*
|
|
7
|
-
* Semantics mirror
|
|
7
|
+
* Semantics mirror brepjs `operations/convexHullFns.ts` (HULL_EMPTY_INPUT /
|
|
8
8
|
* HULL_NOT_3D / HULL_DEGENERATE guards) on the L1 `hullFromPoints` (core's own
|
|
9
|
-
* hull closure, §5.1) with tolerance 0.1 (
|
|
9
|
+
* hull closure, §5.1) with tolerance 0.1 (brepjs default).
|
|
10
10
|
*/
|
|
11
11
|
import { getBrepApi } from '../../brep/handle-bridge.js';
|
|
12
12
|
import { ok, err } from '../../result/result.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hullFns.js","sourceRoot":"","sources":["../../../src/api/brep-mirror/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;IAC3B,MAAM,MAAM,GAAG,CAAC,SAAS,IAAI,EAAE,CAAW,CAAA;IAE1C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,CACR,eAAe,CACb,kBAAkB,EAClB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ase 3, §5.4).\n *\n * @platform occt\n *\n * Semantics mirror
|
|
1
|
+
{"version":3,"file":"hullFns.js","sourceRoot":"","sources":["../../../src/api/brep-mirror/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;IAC3B,MAAM,MAAM,GAAG,CAAC,SAAS,IAAI,EAAE,CAAW,CAAA;IAE1C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,CACR,eAAe,CACb,kBAAkB,EAClB,+CAA+C,MAAM,CAAC,MAAM,EAAE,CAC/D,CACF,CAAA;IACH,CAAC;IAED,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACpE,MAAM,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QAC/C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;YACjB,OAAO,GAAG,CAAC,WAAW,CAAC,aAAa,EAAE,0DAA0D,CAAC,CAAC,CAAA;QACpG,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;IACd,CAAC;IAAC,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,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACzF,OAAO,GAAG,CAAC,WAAW,CAAC,iBAAiB,EAAE,0BAA0B,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;QAChF,CAAC;QACD,OAAO,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 '../brepjs-compat/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"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @platform occt
|
|
6
6
|
*
|
|
7
|
-
* Semantics mirror
|
|
7
|
+
* Semantics mirror brepjs `operations/patternFns.ts` + `compoundOpsFns.ts`
|
|
8
8
|
* rectangularPattern, on the L1 pattern primitives (occt-primitives:
|
|
9
9
|
* native compound split per replica; gridPattern pre-fused compound).
|
|
10
10
|
* Guards: PATTERN_INVALID_COUNT / PATTERN_ZERO_DIRECTION / PATTERN_ZERO_AXIS.
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
13
13
|
import { type Result } from '../../result/result.js';
|
|
14
14
|
/**
|
|
15
|
-
* Linear pattern — copy a shape along a direction (
|
|
15
|
+
* Linear pattern — copy a shape along a direction (brepjs patternFns.ts#linearPattern).
|
|
16
16
|
*
|
|
17
17
|
* @param args - Resolved arguments (shape, direction, count, spacing).
|
|
18
18
|
* @returns The fused pattern copies as a `BrepHandle`.
|
|
19
19
|
*/
|
|
20
20
|
export declare function linearPatternBrep(...args: unknown[]): Result<BrepHandle>;
|
|
21
21
|
/**
|
|
22
|
-
* Circular pattern — copy a shape around an axis (
|
|
22
|
+
* Circular pattern — copy a shape around an axis (brepjs patternFns.ts#circularPattern).
|
|
23
23
|
*
|
|
24
24
|
* @param args - Resolved arguments (shape, axis, count, fullAngle, center).
|
|
25
25
|
* @returns The fused pattern copies as a `BrepHandle`.
|
|
26
26
|
*/
|
|
27
27
|
export declare function circularPatternBrep(...args: unknown[]): Result<BrepHandle>;
|
|
28
28
|
/**
|
|
29
|
-
* Grid pattern — 2D grid copies of a shape (
|
|
29
|
+
* Grid pattern — 2D grid copies of a shape (brepjs patternFns.ts#gridPattern).
|
|
30
30
|
*
|
|
31
31
|
* @param args - Resolved arguments (shape, directions, counts, spacings).
|
|
32
32
|
* @returns The fused pattern copies as a `BrepHandle`.
|
|
@@ -34,7 +34,7 @@ export declare function circularPatternBrep(...args: unknown[]): Result<BrepHand
|
|
|
34
34
|
export declare function gridPatternBrep(...args: unknown[]): Result<BrepHandle>;
|
|
35
35
|
/**
|
|
36
36
|
* Rectangular pattern — two-direction rectangular array
|
|
37
|
-
* (
|
|
37
|
+
* (brepjs compoundOpsFns.ts#rectangularPattern).
|
|
38
38
|
*
|
|
39
39
|
* @param args - Resolved arguments (shape, rectangular pattern options).
|
|
40
40
|
* @returns The fused pattern copies as a `BrepHandle`.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @platform occt
|
|
6
6
|
*
|
|
7
|
-
* Semantics mirror
|
|
7
|
+
* Semantics mirror brepjs `operations/patternFns.ts` + `compoundOpsFns.ts`
|
|
8
8
|
* rectangularPattern, on the L1 pattern primitives (occt-primitives:
|
|
9
9
|
* native compound split per replica; gridPattern pre-fused compound).
|
|
10
10
|
* Guards: PATTERN_INVALID_COUNT / PATTERN_ZERO_DIRECTION / PATTERN_ZERO_AXIS.
|
|
@@ -25,7 +25,7 @@ function vecNormalize(v) {
|
|
|
25
25
|
const len = Math.hypot(v[0], v[1], v[2]);
|
|
26
26
|
return [v[0] / len, v[1] / len, v[2] / len];
|
|
27
27
|
}
|
|
28
|
-
/** fuse 全部 replicas 并释放中间句柄(
|
|
28
|
+
/** fuse 全部 replicas 并释放中间句柄(brepjs fuseAll sameFace 等价)。 */
|
|
29
29
|
function fuseReplicas(kernel, copies) {
|
|
30
30
|
const fused = kernel.fuseAll(copies);
|
|
31
31
|
for (const c of copies)
|
|
@@ -33,10 +33,10 @@ function fuseReplicas(kernel, copies) {
|
|
|
33
33
|
return fused;
|
|
34
34
|
}
|
|
35
35
|
// ---------------------------------------------------------------------------
|
|
36
|
-
// linearPattern — 沿方向复制(
|
|
36
|
+
// linearPattern — 沿方向复制(brepjs patternFns.ts#linearPattern)
|
|
37
37
|
// ---------------------------------------------------------------------------
|
|
38
38
|
/**
|
|
39
|
-
* Linear pattern — copy a shape along a direction (
|
|
39
|
+
* Linear pattern — copy a shape along a direction (brepjs patternFns.ts#linearPattern).
|
|
40
40
|
*
|
|
41
41
|
* @param args - Resolved arguments (shape, direction, count, spacing).
|
|
42
42
|
* @returns The fused pattern copies as a `BrepHandle`.
|
|
@@ -60,10 +60,10 @@ export function linearPatternBrep(...args) {
|
|
|
60
60
|
return ok(fuseReplicas(kernel, copies));
|
|
61
61
|
}
|
|
62
62
|
// ---------------------------------------------------------------------------
|
|
63
|
-
// circularPattern — 绕轴环形复制(
|
|
63
|
+
// circularPattern — 绕轴环形复制(brepjs patternFns.ts#circularPattern)
|
|
64
64
|
// ---------------------------------------------------------------------------
|
|
65
65
|
/**
|
|
66
|
-
* Circular pattern — copy a shape around an axis (
|
|
66
|
+
* Circular pattern — copy a shape around an axis (brepjs patternFns.ts#circularPattern).
|
|
67
67
|
*
|
|
68
68
|
* @param args - Resolved arguments (shape, axis, count, fullAngle, center).
|
|
69
69
|
* @returns The fused pattern copies as a `BrepHandle`.
|
|
@@ -88,10 +88,10 @@ export function circularPatternBrep(...args) {
|
|
|
88
88
|
return ok(fuseReplicas(kernel, copies));
|
|
89
89
|
}
|
|
90
90
|
// ---------------------------------------------------------------------------
|
|
91
|
-
// gridPattern — 二维网格复制(
|
|
91
|
+
// gridPattern — 二维网格复制(brepjs patternFns.ts#gridPattern)
|
|
92
92
|
// ---------------------------------------------------------------------------
|
|
93
93
|
/**
|
|
94
|
-
* Grid pattern — 2D grid copies of a shape (
|
|
94
|
+
* Grid pattern — 2D grid copies of a shape (brepjs patternFns.ts#gridPattern).
|
|
95
95
|
*
|
|
96
96
|
* @param args - Resolved arguments (shape, directions, counts, spacings).
|
|
97
97
|
* @returns The fused pattern copies as a `BrepHandle`.
|
|
@@ -121,11 +121,11 @@ export function gridPatternBrep(...args) {
|
|
|
121
121
|
return ok(kernel.gridPattern(s, { x: nx2[0], y: nx2[1], z: nx2[2] }, { x: ny2[0], y: ny2[1], z: ny2[2] }, Number(spacingX), Number(spacingY), nx, ny));
|
|
122
122
|
}
|
|
123
123
|
// ---------------------------------------------------------------------------
|
|
124
|
-
// rectangularPattern — 双向矩形阵列(
|
|
124
|
+
// rectangularPattern — 双向矩形阵列(brepjs compoundOpsFns.ts#rectangularPattern)
|
|
125
125
|
// ---------------------------------------------------------------------------
|
|
126
126
|
/**
|
|
127
127
|
* Rectangular pattern — two-direction rectangular array
|
|
128
|
-
* (
|
|
128
|
+
* (brepjs compoundOpsFns.ts#rectangularPattern).
|
|
129
129
|
*
|
|
130
130
|
* @param args - Resolved arguments (shape, rectangular pattern options).
|
|
131
131
|
* @returns The fused pattern copies as a `BrepHandle`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patternFns.js","sourceRoot":"","sources":["../../../src/api/brep-mirror/patternFns.ts"],"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,GAAG,EAAE;gBACvC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE;gBACvC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE;aACxC,CAAA;YACD,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;YAC9D,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACd,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACpC,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACxC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;AAClB,CAAC","sourcesContent":["/**\n * Self-hosted compat-op implementations — pattern family\n * (core-decouple Phase 3, §5.4; G4).\n *\n * @platform occt\n *\n * Semantics mirror vendored `operations/patternFns.ts` + `compoundOpsFns.ts`\n * rectangularPattern, on the L1 pattern primitives (occt-primitives:\n * native compound split per replica; gridPattern pre-fused compound).\n * Guards: PATTERN_INVALID_COUNT / PATTERN_ZERO_DIRECTION / PATTERN_ZERO_AXIS.\n */\n\nimport type { BrepHandle } from '../../brep/engine/types'\nimport { getBrepApi } from '../../brep/handle-bridge'\nimport { ok, err, type Result } from '../../result/result'\nimport { validationError } from '../../result/errors'\nimport type { FormClass } from '../internal/dual-form-args'\nimport { resolveArgs } from '../internal/dual-form-args'\nimport type { Vec3 } from '../brepjs-compat/types'\nimport { brepHandleOf } from './brepHelpers'\n\nconst LINEAR_PATTERN_PARAMS = { name: 'linearPattern', params: ['shape', 'direction', 'count', 'spacing'], formClass: 'A' as FormClass }\nconst CIRCULAR_PATTERN_PARAMS = { name: 'circularPattern', params: ['shape', 'axis', 'count', 'fullAngle', 'center'], formClass: 'A' as FormClass }\nconst GRID_PATTERN_PARAMS = { name: 'gridPattern', params: ['shape', 'directionX', 'directionY', 'countX', 'countY', 'spacingX', 'spacingY'], formClass: 'A' as FormClass }\nconst RECT_PATTERN_PARAMS = { name: 'rectangularPattern', params: ['shape', 'options'], formClass: 'A' as FormClass }\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\n/** fuse 全部 replicas 并释放中间句柄(vendored fuseAll sameFace 等价)。 */\nfunction fuseReplicas(kernel: ReturnType<typeof getBrepApi>, copies: BrepHandle[]): BrepHandle {\n const fused = kernel.fuseAll(copies)\n for (const c of copies) kernel.release(c)\n return fused\n}\n\n// ---------------------------------------------------------------------------\n// linearPattern — 沿方向复制(vendored patternFns.ts#linearPattern)\n// ---------------------------------------------------------------------------\n\n/**\n * Linear pattern — copy a shape along a direction (vendored patternFns.ts#linearPattern).\n *\n * @param args - Resolved arguments (shape, direction, count, spacing).\n * @returns The fused pattern copies as a `BrepHandle`.\n */\nexport function linearPatternBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, direction, count, spacing] = resolveArgs(args, LINEAR_PATTERN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const n = Number(count)\n if (n < 1) {\n return err(validationError('PATTERN_INVALID_COUNT', 'Pattern count must be at least 1'))\n }\n if (n === 1) return ok(s)\n const dir = (direction ?? [0, 0, 0]) as Vec3\n if (vecIsZero(dir)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'Pattern direction cannot be zero'))\n }\n const nn = vecNormalize([dir[0], dir[1], dir[2]])\n const copies = kernel.linearPattern(\n s,\n { x: nn[0], y: nn[1], z: nn[2] },\n Number(spacing),\n n,\n )\n return ok(fuseReplicas(kernel, copies))\n}\n\n// ---------------------------------------------------------------------------\n// circularPattern — 绕轴环形复制(vendored patternFns.ts#circularPattern)\n// ---------------------------------------------------------------------------\n\n/**\n * Circular pattern — copy a shape around an axis (vendored patternFns.ts#circularPattern).\n *\n * @param args - Resolved arguments (shape, axis, count, fullAngle, center).\n * @returns The fused pattern copies as a `BrepHandle`.\n */\nexport function circularPatternBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, axis, count, fullAngle, center] = resolveArgs(args, CIRCULAR_PATTERN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const n = Number(count)\n if (n < 1) {\n return err(validationError('PATTERN_INVALID_COUNT', 'Pattern count must be at least 1'))\n }\n if (n === 1) return ok(s)\n const ax = (axis ?? [0, 0, 0]) as Vec3\n if (vecIsZero(ax)) {\n return err(validationError('PATTERN_ZERO_AXIS', 'Pattern axis cannot be zero'))\n }\n const angleStep = (fullAngle === undefined ? 360 : Number(fullAngle)) / n\n const c = (center ?? [0, 0, 0]) as Vec3\n const copies = kernel.circularPattern(\n s,\n { x: c[0], y: c[1], z: c[2] },\n { x: ax[0], y: ax[1], z: ax[2] },\n angleStep,\n n,\n )\n return ok(fuseReplicas(kernel, copies))\n}\n\n// ---------------------------------------------------------------------------\n// gridPattern — 二维网格复制(vendored patternFns.ts#gridPattern)\n// ---------------------------------------------------------------------------\n\n/**\n * Grid pattern — 2D grid copies of a shape (vendored patternFns.ts#gridPattern).\n *\n * @param args - Resolved arguments (shape, directions, counts, spacings).\n * @returns The fused pattern copies as a `BrepHandle`.\n */\nexport function gridPatternBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, directionX, directionY, countX, countY, spacingX, spacingY] = resolveArgs(args, GRID_PATTERN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const nx = Number(countX)\n const ny = Number(countY)\n if (nx < 1 || ny < 1) {\n return err(validationError('PATTERN_INVALID_COUNT', 'Grid pattern counts must be at least 1'))\n }\n if (nx === 1 && ny === 1) return ok(s)\n const dx = (directionX ?? [0, 0, 0]) as Vec3\n const dy = (directionY ?? [0, 0, 0]) as Vec3\n if (vecIsZero(dx)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'Grid directionX cannot be zero'))\n }\n if (vecIsZero(dy)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'Grid directionY cannot be zero'))\n }\n const nx2 = vecNormalize([dx[0], dx[1], dx[2]])\n const ny2 = vecNormalize([dy[0], dy[1], dy[2]])\n // core gridPattern 已组合复制并 fuse 成单个 compound/solid\n return ok(\n kernel.gridPattern(\n s,\n { x: nx2[0], y: nx2[1], z: nx2[2] },\n { x: ny2[0], y: ny2[1], z: ny2[2] },\n Number(spacingX),\n Number(spacingY),\n nx,\n ny,\n ),\n )\n}\n\n// ---------------------------------------------------------------------------\n// rectangularPattern — 双向矩形阵列(vendored compoundOpsFns.ts#rectangularPattern)\n// ---------------------------------------------------------------------------\n\n/**\n * Rectangular pattern — two-direction rectangular array\n * (vendored compoundOpsFns.ts#rectangularPattern).\n *\n * @param args - Resolved arguments (shape, rectangular pattern options).\n * @returns The fused pattern copies as a `BrepHandle`.\n */\nexport function rectangularPatternBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, options] = resolveArgs(args, RECT_PATTERN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const { xDir, xCount, xSpacing, yDir, yCount, ySpacing } = (options ?? {}) as {\n xDir?: Vec3\n xCount?: number\n xSpacing?: number\n yDir?: Vec3\n yCount?: number\n ySpacing?: number\n }\n const xc = Number(xCount ?? 0)\n const yc = Number(yCount ?? 0)\n const xs = Number(xSpacing ?? 0)\n const ys = Number(ySpacing ?? 0)\n if (xc < 1 || yc < 1) {\n return err(validationError('PATTERN_INVALID_COUNT', 'Pattern counts must be at least 1'))\n }\n if (xc === 1 && yc === 1) return ok(s)\n const xd = (xDir ?? [0, 0, 0]) as Vec3\n const yd = (yDir ?? [0, 0, 0]) as Vec3\n if (vecIsZero(xd)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'X direction cannot be zero'))\n }\n if (vecIsZero(yd)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'Y direction cannot be zero'))\n }\n const xNorm = vecNormalize([xd[0], xd[1], xd[2]])\n const yNorm = vecNormalize([yd[0], yd[1], yd[2]])\n const copies: BrepHandle[] = [s]\n const owned: BrepHandle[] = []\n for (let xi = 0; xi < xc; xi++) {\n for (let yi = 0; yi < yc; yi++) {\n if (xi === 0 && yi === 0) continue\n const offset: Vec3 = [\n xNorm[0] * xs * xi + yNorm[0] * ys * yi,\n xNorm[1] * xs * xi + yNorm[1] * ys * yi,\n xNorm[2] * xs * xi + yNorm[2] * ys * yi,\n ]\n const c = kernel.translate(s, offset[0], offset[1], offset[2])\n copies.push(c)\n owned.push(c)\n }\n }\n const fused = kernel.fuseAll(copies)\n for (const c of owned) kernel.release(c)\n return ok(fused)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"patternFns.js","sourceRoot":"","sources":["../../../src/api/brep-mirror/patternFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,EAAE,EAAE,GAAG,EAAe,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,GAAgB,EAAE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KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACpC,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACxC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;AAClB,CAAC","sourcesContent":["/**\n * Self-hosted compat-op implementations — pattern family\n * (core-decouple Phase 3, §5.4; G4).\n *\n * @platform occt\n *\n * Semantics mirror brepjs `operations/patternFns.ts` + `compoundOpsFns.ts`\n * rectangularPattern, on the L1 pattern primitives (occt-primitives:\n * native compound split per replica; gridPattern pre-fused compound).\n * Guards: PATTERN_INVALID_COUNT / PATTERN_ZERO_DIRECTION / PATTERN_ZERO_AXIS.\n */\n\nimport type { BrepHandle } from '../../brep/engine/types'\nimport { getBrepApi } from '../../brep/handle-bridge'\nimport { ok, err, type Result } from '../../result/result'\nimport { validationError } from '../../result/errors'\nimport type { FormClass } from '../internal/dual-form-args'\nimport { resolveArgs } from '../internal/dual-form-args'\nimport type { Vec3 } from '../brepjs-compat/types'\nimport { brepHandleOf } from './brepHelpers'\n\nconst LINEAR_PATTERN_PARAMS = { name: 'linearPattern', params: ['shape', 'direction', 'count', 'spacing'], formClass: 'A' as FormClass }\nconst CIRCULAR_PATTERN_PARAMS = { name: 'circularPattern', params: ['shape', 'axis', 'count', 'fullAngle', 'center'], formClass: 'A' as FormClass }\nconst GRID_PATTERN_PARAMS = { name: 'gridPattern', params: ['shape', 'directionX', 'directionY', 'countX', 'countY', 'spacingX', 'spacingY'], formClass: 'A' as FormClass }\nconst RECT_PATTERN_PARAMS = { name: 'rectangularPattern', params: ['shape', 'options'], formClass: 'A' as FormClass }\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\n/** fuse 全部 replicas 并释放中间句柄(brepjs fuseAll sameFace 等价)。 */\nfunction fuseReplicas(kernel: ReturnType<typeof getBrepApi>, copies: BrepHandle[]): BrepHandle {\n const fused = kernel.fuseAll(copies)\n for (const c of copies) kernel.release(c)\n return fused\n}\n\n// ---------------------------------------------------------------------------\n// linearPattern — 沿方向复制(brepjs patternFns.ts#linearPattern)\n// ---------------------------------------------------------------------------\n\n/**\n * Linear pattern — copy a shape along a direction (brepjs patternFns.ts#linearPattern).\n *\n * @param args - Resolved arguments (shape, direction, count, spacing).\n * @returns The fused pattern copies as a `BrepHandle`.\n */\nexport function linearPatternBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, direction, count, spacing] = resolveArgs(args, LINEAR_PATTERN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const n = Number(count)\n if (n < 1) {\n return err(validationError('PATTERN_INVALID_COUNT', 'Pattern count must be at least 1'))\n }\n if (n === 1) return ok(s)\n const dir = (direction ?? [0, 0, 0]) as Vec3\n if (vecIsZero(dir)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'Pattern direction cannot be zero'))\n }\n const nn = vecNormalize([dir[0], dir[1], dir[2]])\n const copies = kernel.linearPattern(\n s,\n { x: nn[0], y: nn[1], z: nn[2] },\n Number(spacing),\n n,\n )\n return ok(fuseReplicas(kernel, copies))\n}\n\n// ---------------------------------------------------------------------------\n// circularPattern — 绕轴环形复制(brepjs patternFns.ts#circularPattern)\n// ---------------------------------------------------------------------------\n\n/**\n * Circular pattern — copy a shape around an axis (brepjs patternFns.ts#circularPattern).\n *\n * @param args - Resolved arguments (shape, axis, count, fullAngle, center).\n * @returns The fused pattern copies as a `BrepHandle`.\n */\nexport function circularPatternBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, axis, count, fullAngle, center] = resolveArgs(args, CIRCULAR_PATTERN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const n = Number(count)\n if (n < 1) {\n return err(validationError('PATTERN_INVALID_COUNT', 'Pattern count must be at least 1'))\n }\n if (n === 1) return ok(s)\n const ax = (axis ?? [0, 0, 0]) as Vec3\n if (vecIsZero(ax)) {\n return err(validationError('PATTERN_ZERO_AXIS', 'Pattern axis cannot be zero'))\n }\n const angleStep = (fullAngle === undefined ? 360 : Number(fullAngle)) / n\n const c = (center ?? [0, 0, 0]) as Vec3\n const copies = kernel.circularPattern(\n s,\n { x: c[0], y: c[1], z: c[2] },\n { x: ax[0], y: ax[1], z: ax[2] },\n angleStep,\n n,\n )\n return ok(fuseReplicas(kernel, copies))\n}\n\n// ---------------------------------------------------------------------------\n// gridPattern — 二维网格复制(brepjs patternFns.ts#gridPattern)\n// ---------------------------------------------------------------------------\n\n/**\n * Grid pattern — 2D grid copies of a shape (brepjs patternFns.ts#gridPattern).\n *\n * @param args - Resolved arguments (shape, directions, counts, spacings).\n * @returns The fused pattern copies as a `BrepHandle`.\n */\nexport function gridPatternBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, directionX, directionY, countX, countY, spacingX, spacingY] = resolveArgs(args, GRID_PATTERN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const nx = Number(countX)\n const ny = Number(countY)\n if (nx < 1 || ny < 1) {\n return err(validationError('PATTERN_INVALID_COUNT', 'Grid pattern counts must be at least 1'))\n }\n if (nx === 1 && ny === 1) return ok(s)\n const dx = (directionX ?? [0, 0, 0]) as Vec3\n const dy = (directionY ?? [0, 0, 0]) as Vec3\n if (vecIsZero(dx)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'Grid directionX cannot be zero'))\n }\n if (vecIsZero(dy)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'Grid directionY cannot be zero'))\n }\n const nx2 = vecNormalize([dx[0], dx[1], dx[2]])\n const ny2 = vecNormalize([dy[0], dy[1], dy[2]])\n // core gridPattern 已组合复制并 fuse 成单个 compound/solid\n return ok(\n kernel.gridPattern(\n s,\n { x: nx2[0], y: nx2[1], z: nx2[2] },\n { x: ny2[0], y: ny2[1], z: ny2[2] },\n Number(spacingX),\n Number(spacingY),\n nx,\n ny,\n ),\n )\n}\n\n// ---------------------------------------------------------------------------\n// rectangularPattern — 双向矩形阵列(brepjs compoundOpsFns.ts#rectangularPattern)\n// ---------------------------------------------------------------------------\n\n/**\n * Rectangular pattern — two-direction rectangular array\n * (brepjs compoundOpsFns.ts#rectangularPattern).\n *\n * @param args - Resolved arguments (shape, rectangular pattern options).\n * @returns The fused pattern copies as a `BrepHandle`.\n */\nexport function rectangularPatternBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, options] = resolveArgs(args, RECT_PATTERN_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const { xDir, xCount, xSpacing, yDir, yCount, ySpacing } = (options ?? {}) as {\n xDir?: Vec3\n xCount?: number\n xSpacing?: number\n yDir?: Vec3\n yCount?: number\n ySpacing?: number\n }\n const xc = Number(xCount ?? 0)\n const yc = Number(yCount ?? 0)\n const xs = Number(xSpacing ?? 0)\n const ys = Number(ySpacing ?? 0)\n if (xc < 1 || yc < 1) {\n return err(validationError('PATTERN_INVALID_COUNT', 'Pattern counts must be at least 1'))\n }\n if (xc === 1 && yc === 1) return ok(s)\n const xd = (xDir ?? [0, 0, 0]) as Vec3\n const yd = (yDir ?? [0, 0, 0]) as Vec3\n if (vecIsZero(xd)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'X direction cannot be zero'))\n }\n if (vecIsZero(yd)) {\n return err(validationError('PATTERN_ZERO_DIRECTION', 'Y direction cannot be zero'))\n }\n const xNorm = vecNormalize([xd[0], xd[1], xd[2]])\n const yNorm = vecNormalize([yd[0], yd[1], yd[2]])\n const copies: BrepHandle[] = [s]\n const owned: BrepHandle[] = []\n for (let xi = 0; xi < xc; xi++) {\n for (let yi = 0; yi < yc; yi++) {\n if (xi === 0 && yi === 0) continue\n const offset: Vec3 = [\n xNorm[0] * xs * xi + yNorm[0] * ys * yi,\n xNorm[1] * xs * xi + yNorm[1] * ys * yi,\n xNorm[2] * xs * xi + yNorm[2] * ys * yi,\n ]\n const c = kernel.translate(s, offset[0], offset[1], offset[2])\n copies.push(c)\n owned.push(c)\n }\n }\n const fused = kernel.fuseAll(copies)\n for (const c of owned) kernel.release(c)\n return ok(fused)\n}\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @platform occt
|
|
6
6
|
*
|
|
7
7
|
* Brep-shaped implementations for `torus`, `ellipsoid`, `makeBaseBox`.
|
|
8
|
-
* Semantics mirror
|
|
8
|
+
* Semantics mirror brepjs `topology/primitiveFns.ts` + `solidBuilders.ts`
|
|
9
9
|
* (`makeTorus`/`makeEllipsoid` take at/axis placement) and
|
|
10
10
|
* `sketching/shortcuts.ts` `makeBaseBox` (origin-centered XY rectangle extruded
|
|
11
11
|
* along +Z). Placement is composed from L1 `translate`/`generalTransform`
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
15
15
|
import { type Result } from '../../result/result.js';
|
|
16
16
|
/**
|
|
17
|
-
* Create a torus (
|
|
17
|
+
* Create a torus (brepjs `torus(majorRadius, minorRadius, {at, axis})`).
|
|
18
18
|
*
|
|
19
19
|
* The L1 `makeTorus(major, minor)` builds the ring on the +Z axis at the
|
|
20
20
|
* origin; placement is composed afterwards (`axis` → rotation, `at` →
|
|
@@ -25,7 +25,7 @@ import { type Result } from '../../result/result.js';
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function torusBrep(...args: unknown[]): Result<BrepHandle>;
|
|
27
27
|
/**
|
|
28
|
-
* Create an ellipsoid (
|
|
28
|
+
* Create an ellipsoid (brepjs `ellipsoid(rx, ry, rz, {at})`).
|
|
29
29
|
*
|
|
30
30
|
* @param args - Resolved arguments (rx, ry, rz, placement options).
|
|
31
31
|
* @returns The ellipsoid as a `BrepHandle`.
|
|
@@ -33,7 +33,7 @@ export declare function torusBrep(...args: unknown[]): Result<BrepHandle>;
|
|
|
33
33
|
export declare function ellipsoidBrep(...args: unknown[]): Result<BrepHandle>;
|
|
34
34
|
/**
|
|
35
35
|
* Create a base box: origin-centered XY rectangle extruded by `zLength` along
|
|
36
|
-
* +Z (
|
|
36
|
+
* +Z (brepjs `makeBaseBox(xLength, yLength, zLength)` via the sketcher).
|
|
37
37
|
*
|
|
38
38
|
* @param args - Resolved arguments (xLength, yLength, zLength).
|
|
39
39
|
* @returns The box as a `BrepHandle`.
|