@faicad/faijs 0.22.2 → 0.29.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -28
- package/dist/api/api-namespace.d.ts +5 -5
- package/dist/api/api-namespace.d.ts.map +1 -1
- package/dist/api/api-namespace.js +4 -4
- package/dist/api/api-namespace.js.map +1 -1
- package/dist/api/assert.d.ts +2 -2
- package/dist/api/assert.js +8 -8
- package/dist/api/assert.js.map +1 -1
- package/dist/api/asset.d.ts +1 -1
- package/dist/api/asset.js +2 -2
- package/dist/api/asset.js.map +1 -1
- package/dist/api/boolean.d.ts +1 -1
- package/dist/api/boolean.d.ts.map +1 -1
- package/dist/api/boolean.js +128 -16
- package/dist/api/boolean.js.map +1 -1
- package/dist/api/cadquery-selectors/borrow-bridge.d.ts +14 -0
- package/dist/api/cadquery-selectors/borrow-bridge.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/borrow-bridge.js +52 -0
- package/dist/api/cadquery-selectors/borrow-bridge.js.map +1 -0
- package/dist/api/cadquery-selectors/edge.d.ts +40 -0
- package/dist/api/cadquery-selectors/edge.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/edge.js +70 -0
- package/dist/api/cadquery-selectors/edge.js.map +1 -0
- package/dist/api/cadquery-selectors/entity.d.ts +121 -0
- package/dist/api/cadquery-selectors/entity.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/entity.js +167 -0
- package/dist/api/cadquery-selectors/entity.js.map +1 -0
- package/dist/api/cadquery-selectors/face.d.ts +33 -0
- package/dist/api/cadquery-selectors/face.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/face.js +353 -0
- package/dist/api/cadquery-selectors/face.js.map +1 -0
- package/dist/api/cadquery-selectors/grammar.d.ts +50 -0
- package/dist/api/cadquery-selectors/grammar.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/grammar.js +345 -0
- package/dist/api/cadquery-selectors/grammar.js.map +1 -0
- package/dist/api/cadquery-selectors/index.d.ts +18 -0
- package/dist/api/cadquery-selectors/index.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/index.js +17 -0
- package/dist/api/cadquery-selectors/index.js.map +1 -0
- package/dist/api/cadquery-selectors/predicates.d.ts +76 -0
- package/dist/api/cadquery-selectors/predicates.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/predicates.js +85 -0
- package/dist/api/cadquery-selectors/predicates.js.map +1 -0
- package/dist/api/cadquery-selectors/resolve.d.ts +41 -0
- package/dist/api/cadquery-selectors/resolve.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/resolve.js +243 -0
- package/dist/api/cadquery-selectors/resolve.js.map +1 -0
- package/dist/api/cadquery-selectors/types.d.ts +96 -0
- package/dist/api/cadquery-selectors/types.d.ts.map +1 -0
- package/dist/api/cadquery-selectors/types.js +11 -0
- package/dist/api/cadquery-selectors/types.js.map +1 -0
- package/dist/api/chamfer.d.ts +13 -5
- package/dist/api/chamfer.d.ts.map +1 -1
- package/dist/api/chamfer.js +63 -7
- package/dist/api/chamfer.js.map +1 -1
- package/dist/api/compound-geom.d.ts +1 -1
- package/dist/api/compound-geom.js +1 -1
- package/dist/api/compound-geom.js.map +1 -1
- package/dist/api/draft.d.ts +1 -1
- package/dist/api/draft.js +1 -1
- package/dist/api/draft.js.map +1 -1
- package/dist/api/edge-ref.d.ts +1 -1
- package/dist/api/edge-ref.d.ts.map +1 -1
- package/dist/api/edge-ref.js +11 -3
- package/dist/api/edge-ref.js.map +1 -1
- package/dist/api/engrave.d.ts +1 -1
- package/dist/api/engrave.js +7 -7
- package/dist/api/engrave.js.map +1 -1
- package/dist/api/extrude.d.ts +6 -1
- package/dist/api/extrude.d.ts.map +1 -1
- package/dist/api/extrude.js +59 -5
- package/dist/api/extrude.js.map +1 -1
- package/dist/api/face-ref.d.ts +1 -1
- package/dist/api/face-ref.js +1 -1
- package/dist/api/face-ref.js.map +1 -1
- package/dist/api/feature-repair.d.ts +1 -1
- package/dist/api/feature-repair.js +1 -1
- package/dist/api/feature-repair.js.map +1 -1
- package/dist/api/fillet-variable.d.ts +1 -1
- package/dist/api/fillet-variable.js +1 -1
- package/dist/api/fillet-variable.js.map +1 -1
- package/dist/api/fillet.d.ts +28 -8
- package/dist/api/fillet.d.ts.map +1 -1
- package/dist/api/fillet.js +64 -9
- package/dist/api/fillet.js.map +1 -1
- package/dist/api/geom.d.ts +1 -1
- package/dist/api/geom.js +1 -1
- package/dist/api/geom.js.map +1 -1
- package/dist/api/helix.d.ts +1 -1
- package/dist/api/helix.js +1 -1
- package/dist/api/helix.js.map +1 -1
- package/dist/api/import-brep.d.ts +20 -2
- package/dist/api/import-brep.d.ts.map +1 -1
- package/dist/api/import-brep.js +28 -3
- package/dist/api/import-brep.js.map +1 -1
- package/dist/api/import-step.d.ts +17 -2
- package/dist/api/import-step.d.ts.map +1 -1
- package/dist/api/import-step.js +23 -3
- package/dist/api/import-step.js.map +1 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +5 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/compat-op.js +1 -1
- package/dist/api/internal/compat-op.js.map +1 -1
- package/dist/api/internal/mesh-solid-op.d.ts +236 -0
- package/dist/api/internal/mesh-solid-op.d.ts.map +1 -0
- package/dist/api/internal/mesh-solid-op.js +352 -0
- package/dist/api/internal/mesh-solid-op.js.map +1 -0
- package/dist/api/internal/svg-asset-resolver.d.ts +1 -1
- package/dist/api/internal/svg-asset-resolver.js +1 -1
- package/dist/api/internal/svg-asset-resolver.js.map +1 -1
- package/dist/api/knurl.d.ts +1 -1
- package/dist/api/knurl.js +2 -2
- package/dist/api/knurl.js.map +1 -1
- package/dist/api/loft.d.ts +1 -1
- package/dist/api/loft.js +1 -1
- package/dist/api/loft.js.map +1 -1
- package/dist/api/measurement/index.d.ts +9 -5
- package/dist/api/measurement/index.d.ts.map +1 -1
- package/dist/api/measurement/index.js +47 -20
- package/dist/api/measurement/index.js.map +1 -1
- package/dist/api/pattern.d.ts +5 -3
- package/dist/api/pattern.d.ts.map +1 -1
- package/dist/api/pattern.js +32 -4
- package/dist/api/pattern.js.map +1 -1
- package/dist/api/place.d.ts +1 -1
- package/dist/api/place.js +1 -1
- package/dist/api/place.js.map +1 -1
- package/dist/api/primitives.d.ts +1 -1
- package/dist/api/primitives.js +2 -2
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/profile.d.ts +39 -12
- package/dist/api/profile.d.ts.map +1 -1
- package/dist/api/profile.js +4 -4
- package/dist/api/profile.js.map +1 -1
- package/dist/api/reconcile.d.ts +1 -1
- package/dist/api/reconcile.js +1 -1
- package/dist/api/reconcile.js.map +1 -1
- package/dist/api/replicate.d.ts.map +1 -1
- package/dist/api/replicate.js +122 -1
- package/dist/api/replicate.js.map +1 -1
- package/dist/api/screw.d.ts +1 -1
- package/dist/api/screw.js +3 -3
- package/dist/api/screw.js.map +1 -1
- package/dist/api/sdf.d.ts +1 -1
- package/dist/api/sdf.js +2 -2
- package/dist/api/sdf.js.map +1 -1
- package/dist/api/section-by-plane.d.ts +1 -1
- package/dist/api/section-by-plane.d.ts.map +1 -1
- package/dist/api/section-by-plane.js +2 -1
- package/dist/api/section-by-plane.js.map +1 -1
- package/dist/api/shell.d.ts +11 -4
- package/dist/api/shell.d.ts.map +1 -1
- package/dist/api/shell.js +53 -7
- package/dist/api/shell.js.map +1 -1
- package/dist/api/sketch-on-face.d.ts +41 -0
- package/dist/api/sketch-on-face.d.ts.map +1 -1
- package/dist/api/sketch-on-face.js +100 -1
- package/dist/api/sketch-on-face.js.map +1 -1
- package/dist/api/sketch-on-plane.d.ts +7 -5
- package/dist/api/sketch-on-plane.d.ts.map +1 -1
- package/dist/api/sketch-on-plane.js +6 -7
- package/dist/api/sketch-on-plane.js.map +1 -1
- package/dist/api/split-by-plane.d.ts +1 -1
- package/dist/api/split-by-plane.d.ts.map +1 -1
- package/dist/api/split-by-plane.js +2 -1
- package/dist/api/split-by-plane.js.map +1 -1
- package/dist/api/split.d.ts +1 -1
- package/dist/api/split.js +2 -2
- package/dist/api/split.js.map +1 -1
- package/dist/api/sweep.d.ts +1 -1
- package/dist/api/sweep.js +1 -1
- package/dist/api/sweep.js.map +1 -1
- package/dist/api/thicken.d.ts +1 -1
- package/dist/api/thicken.js +1 -1
- package/dist/api/thicken.js.map +1 -1
- package/dist/api/topo-resolve.d.ts +74 -1
- package/dist/api/topo-resolve.d.ts.map +1 -1
- package/dist/api/topo-resolve.js +180 -2
- package/dist/api/topo-resolve.js.map +1 -1
- package/dist/api/transform.d.ts +5 -1
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +62 -11
- package/dist/api/transform.js.map +1 -1
- package/dist/api/wire.d.ts +1 -1
- package/dist/api/wire.js +1 -1
- package/dist/api/wire.js.map +1 -1
- package/dist/brep/brep-ops.d.ts +9 -7
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +23 -24
- package/dist/brep/brep-ops.js.map +1 -1
- package/dist/brep/brep-topology.d.ts +5 -4
- package/dist/brep/brep-topology.d.ts.map +1 -1
- package/dist/brep/brep-topology.js +6 -5
- package/dist/brep/brep-topology.js.map +1 -1
- package/dist/brep/effective-deflection.d.ts +35 -0
- package/dist/brep/effective-deflection.d.ts.map +1 -0
- package/dist/brep/effective-deflection.js +49 -0
- package/dist/brep/effective-deflection.js.map +1 -0
- package/dist/brep/engine/adapters/brep-mock.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.js +27 -0
- package/dist/brep/engine/adapters/brep-mock.js.map +1 -1
- package/dist/brep/engine/adapters/brepkit.d.ts +18 -0
- package/dist/brep/engine/adapters/brepkit.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brepkit.js +46 -1
- 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 +3 -1
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/engine/primitives.d.ts +29 -7
- package/dist/brep/engine/primitives.d.ts.map +1 -1
- package/dist/brep/engine/primitives.js.map +1 -1
- package/dist/brep/engine/registry.d.ts +24 -1
- package/dist/brep/engine/registry.d.ts.map +1 -1
- package/dist/brep/engine/registry.js +24 -0
- package/dist/brep/engine/registry.js.map +1 -1
- package/dist/brep/engine/types.d.ts +54 -3
- package/dist/brep/engine/types.d.ts.map +1 -1
- package/dist/brep/engine/types.js +10 -0
- package/dist/brep/engine/types.js.map +1 -1
- package/dist/brep/export/export-model.d.ts.map +1 -1
- package/dist/brep/export/export-model.js +6 -5
- package/dist/brep/export/export-model.js.map +1 -1
- package/dist/brep/face-evolution.d.ts +1 -1
- package/dist/brep/face-evolution.d.ts.map +1 -1
- package/dist/brep/face-evolution.js +20 -1
- package/dist/brep/face-evolution.js.map +1 -1
- package/dist/brep/handle-bridge.d.ts +1 -1
- package/dist/brep/handle-bridge.js +1 -1
- package/dist/brep/handle-bridge.js.map +1 -1
- package/dist/brep/mesh-solid.d.ts +218 -0
- package/dist/brep/mesh-solid.d.ts.map +1 -0
- package/dist/brep/mesh-solid.js +229 -0
- package/dist/brep/mesh-solid.js.map +1 -0
- package/dist/brep/text/fontRegistry.d.ts +32 -1
- package/dist/brep/text/fontRegistry.d.ts.map +1 -1
- package/dist/brep/text/fontRegistry.js +51 -1
- package/dist/brep/text/fontRegistry.js.map +1 -1
- package/dist/brep/text/text-to-solid.d.ts.map +1 -1
- package/dist/brep/text/text-to-solid.js +8 -3
- package/dist/brep/text/text-to-solid.js.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.d.ts +18 -2
- package/dist/brepkit-kernel/brepkitKernel.d.ts.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.js +449 -123
- package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
- package/dist/brepkit-kernel/brepkitWasm.d.ts +8 -0
- package/dist/brepkit-kernel/brepkitWasm.d.ts.map +1 -1
- package/dist/brepkit-kernel/brepkitWasm.js +10 -0
- package/dist/brepkit-kernel/brepkitWasm.js.map +1 -1
- package/dist/browser-host/browser-font-provider.d.ts +12 -0
- package/dist/browser-host/browser-font-provider.d.ts.map +1 -1
- package/dist/browser-host/browser-font-provider.js +25 -0
- package/dist/browser-host/browser-font-provider.js.map +1 -1
- package/dist/browser.d.ts +6 -3
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +10 -3
- package/dist/browser.js.map +1 -1
- package/dist/cad-runtime/backend-dispatch.d.ts +28 -3
- package/dist/cad-runtime/backend-dispatch.d.ts.map +1 -1
- package/dist/cad-runtime/backend-dispatch.js +119 -4
- package/dist/cad-runtime/backend-dispatch.js.map +1 -1
- package/dist/cad-runtime/browser-lib-loader.js.map +1 -1
- package/dist/cad-runtime/direct-executor.d.ts +15 -3
- package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
- package/dist/cad-runtime/direct-executor.js +33 -1
- package/dist/cad-runtime/direct-executor.js.map +1 -1
- package/dist/cad-runtime/ports.d.ts +3 -3
- package/dist/cad-runtime/ports.d.ts.map +1 -1
- package/dist/cad-runtime/ports.js.map +1 -1
- package/dist/cad-runtime/preview-exec.d.ts +4 -4
- package/dist/cad-runtime/preview-exec.js +2 -2
- package/dist/cad-runtime/preview-exec.js.map +1 -1
- package/dist/cad-runtime/runtime.d.ts +42 -7
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +68 -5
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +15 -1
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +10 -1
- 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/adapt.d.ts +39 -4
- package/dist/geometry2d/adapt.d.ts.map +1 -1
- package/dist/geometry2d/adapt.js +14 -3
- package/dist/geometry2d/adapt.js.map +1 -1
- package/dist/geometry2d/blueprint.d.ts +2 -2
- package/dist/geometry2d/blueprint.js +2 -2
- package/dist/geometry2d/blueprint.js.map +1 -1
- package/dist/geometry2d/bridge/lift-on-plane.d.ts +18 -8
- package/dist/geometry2d/bridge/lift-on-plane.d.ts.map +1 -1
- package/dist/geometry2d/bridge/lift-on-plane.js +65 -12
- package/dist/geometry2d/bridge/lift-on-plane.js.map +1 -1
- package/dist/geometry2d/bridge/plane.d.ts +17 -0
- package/dist/geometry2d/bridge/plane.d.ts.map +1 -1
- package/dist/geometry2d/bridge/plane.js +22 -0
- package/dist/geometry2d/bridge/plane.js.map +1 -1
- package/dist/geometry2d/curve2d.d.ts +25 -0
- package/dist/geometry2d/curve2d.d.ts.map +1 -1
- package/dist/geometry2d/curve2d.js +41 -5
- package/dist/geometry2d/curve2d.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/io/bytes-node.d.ts +11 -0
- package/dist/io/bytes-node.d.ts.map +1 -0
- package/dist/io/bytes-node.js +28 -0
- package/dist/io/bytes-node.js.map +1 -0
- package/dist/io/bytes.d.ts +33 -0
- package/dist/io/bytes.d.ts.map +1 -0
- package/dist/io/bytes.js +41 -0
- package/dist/io/bytes.js.map +1 -0
- package/dist/io/fai-zip/container-read.d.ts +102 -0
- package/dist/io/fai-zip/container-read.d.ts.map +1 -0
- package/dist/io/fai-zip/container-read.js +305 -0
- package/dist/io/fai-zip/container-read.js.map +1 -0
- package/dist/io/fai-zip/container-write.d.ts +70 -0
- package/dist/io/fai-zip/container-write.d.ts.map +1 -0
- package/dist/io/fai-zip/container-write.js +186 -0
- package/dist/io/fai-zip/container-write.js.map +1 -0
- package/dist/io/fai-zip/container.d.ts +107 -0
- package/dist/io/fai-zip/container.d.ts.map +1 -0
- package/dist/io/fai-zip/container.js +89 -0
- package/dist/io/fai-zip/container.js.map +1 -0
- package/dist/io/fai-zip/index.d.ts +18 -0
- package/dist/io/fai-zip/index.d.ts.map +1 -0
- package/dist/io/fai-zip/index.js +4 -0
- package/dist/io/fai-zip/index.js.map +1 -0
- package/dist/io/index.d.ts +10 -0
- package/dist/io/index.d.ts.map +1 -0
- package/dist/io/index.js +13 -0
- package/dist/io/index.js.map +1 -0
- package/dist/io/zip.d.ts +68 -0
- package/dist/io/zip.d.ts.map +1 -0
- package/dist/io/zip.js +147 -0
- package/dist/io/zip.js.map +1 -0
- package/dist/lang/code-to-args.d.ts +1 -1
- package/dist/lang/code-to-args.js +1 -1
- package/dist/lang/code-to-args.js.map +1 -1
- package/dist/lang/statement-summary.d.ts +1 -1
- package/dist/lang/statement-summary.js +1 -1
- package/dist/lang/statement-summary.js.map +1 -1
- package/dist/lang/types.d.ts +1 -1
- package/dist/lang/types.js +1 -1
- package/dist/lang/types.js.map +1 -1
- package/dist/mesh/index.d.ts +2 -1
- package/dist/mesh/index.d.ts.map +1 -1
- package/dist/mesh/index.js +2 -1
- package/dist/mesh/index.js.map +1 -1
- package/dist/mesh/io.d.ts +7 -0
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +14 -17
- package/dist/mesh/io.js.map +1 -1
- package/dist/mesh/reconcile.d.ts +1 -1
- package/dist/mesh/reconcile.js +1 -1
- package/dist/mesh/reconcile.js.map +1 -1
- package/dist/mesh/rigid-transform.d.ts +3 -3
- package/dist/mesh/rigid-transform.js +3 -3
- package/dist/mesh/rigid-transform.js.map +1 -1
- package/dist/mesh/stl-unit.d.ts +24 -0
- package/dist/mesh/stl-unit.d.ts.map +1 -0
- package/dist/mesh/stl-unit.js +17 -0
- package/dist/mesh/stl-unit.js.map +1 -0
- package/dist/mesh/threemf-bambu.d.ts +142 -0
- package/dist/mesh/threemf-bambu.d.ts.map +1 -0
- package/dist/mesh/threemf-bambu.js +334 -0
- package/dist/mesh/threemf-bambu.js.map +1 -0
- package/dist/mesh/threemf-loader.d.ts +42 -7
- package/dist/mesh/threemf-loader.d.ts.map +1 -1
- package/dist/mesh/threemf-loader.js +565 -100
- package/dist/mesh/threemf-loader.js.map +1 -1
- package/dist/mesh/threemf-view.d.ts +71 -0
- package/dist/mesh/threemf-view.d.ts.map +1 -0
- package/dist/mesh/threemf-view.js +100 -0
- package/dist/mesh/threemf-view.js.map +1 -0
- package/dist/node-host/cli.d.ts +44 -6
- package/dist/node-host/cli.d.ts.map +1 -1
- package/dist/node-host/cli.js +76 -26
- package/dist/node-host/cli.js.map +1 -1
- package/dist/node-host/font-family-index.d.ts +93 -0
- package/dist/node-host/font-family-index.d.ts.map +1 -0
- package/dist/node-host/font-family-index.js +273 -0
- package/dist/node-host/font-family-index.js.map +1 -0
- package/dist/node-host/fs-asset-resolver.d.ts +8 -3
- package/dist/node-host/fs-asset-resolver.d.ts.map +1 -1
- package/dist/node-host/fs-asset-resolver.js +13 -5
- package/dist/node-host/fs-asset-resolver.js.map +1 -1
- package/dist/node-host/index.d.ts +8 -0
- package/dist/node-host/index.d.ts.map +1 -1
- package/dist/node-host/index.js +1 -0
- package/dist/node-host/index.js.map +1 -1
- package/dist/node-host/node-font-provider.d.ts +28 -0
- package/dist/node-host/node-font-provider.d.ts.map +1 -1
- package/dist/node-host/node-font-provider.js +49 -0
- package/dist/node-host/node-font-provider.js.map +1 -1
- package/dist/node.d.ts +1 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +1 -0
- package/dist/node.js.map +1 -1
- package/dist/occt-kernel/occt-primitives.d.ts.map +1 -1
- package/dist/occt-kernel/occt-primitives.js +35 -2
- package/dist/occt-kernel/occt-primitives.js.map +1 -1
- package/dist/occt-kernel/occtKernel.d.ts +18 -13
- package/dist/occt-kernel/occtKernel.d.ts.map +1 -1
- package/dist/occt-kernel/occtKernel.js +18 -31
- package/dist/occt-kernel/occtKernel.js.map +1 -1
- package/dist/occt-kernel/stepColorParser.d.ts +18 -0
- package/dist/occt-kernel/stepColorParser.d.ts.map +1 -1
- package/dist/occt-kernel/stepColorParser.js +38 -0
- package/dist/occt-kernel/stepColorParser.js.map +1 -1
- package/dist/occt-kernel/topologyExt.d.ts +1 -1
- package/dist/occt-kernel/topologyExt.d.ts.map +1 -1
- package/dist/occt-kernel/topologyExt.js +4 -5
- package/dist/occt-kernel/topologyExt.js.map +1 -1
- package/dist/primitives/text/cjk-font.d.ts +2 -15
- package/dist/primitives/text/cjk-font.d.ts.map +1 -1
- package/dist/primitives/text/cjk-font.js +13 -1
- package/dist/primitives/text/cjk-font.js.map +1 -1
- package/dist/runtime-state.d.ts +85 -9
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +72 -2
- package/dist/runtime-state.js.map +1 -1
- package/dist/sdk.d.ts +3 -3
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +5 -5
- package/dist/sdk.js.map +1 -1
- package/dist/shape.d.ts +97 -2
- package/dist/shape.d.ts.map +1 -1
- package/dist/shape.js +126 -1
- package/dist/shape.js.map +1 -1
- package/dist/topology/naming/lineage.d.ts +6 -0
- package/dist/topology/naming/lineage.d.ts.map +1 -1
- package/dist/topology/naming/lineage.js +8 -0
- package/dist/topology/naming/lineage.js.map +1 -1
- package/dist/topology/naming/resolve-edge.d.ts +20 -1
- package/dist/topology/naming/resolve-edge.d.ts.map +1 -1
- package/dist/topology/naming/resolve-edge.js +54 -20
- package/dist/topology/naming/resolve-edge.js.map +1 -1
- package/dist/weapp.d.ts +6 -2
- package/dist/weapp.d.ts.map +1 -1
- package/dist/weapp.js +7 -1
- package/dist/weapp.js.map +1 -1
- package/package.json +18 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sketch-on-face.js","sourceRoot":"","sources":["../../src/api/sketch-on-face.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,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AAA;IACtE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IAC7E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,CAAA;QACnB,OAAO,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;IACxD,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;AACtE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;IACnC,YAAY,EAAE,CAAC,YAAY,CAAC;IAC5B,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,IAAI,CAAC,MAA+B;QAClC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QAC3B,OAAO,qBAAqB,CAAC,UAAU,EAAE,EAAE,MAAuC,CAAC,CAAA;IACrF,CAAC;IACD,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,EAAgB;CACtF,CAAC,CAAA","sourcesContent":["/**\n * `cad.sketchOnFace`: place 2D contours onto the UV parameter space of an\n * existing face (E3 placement).\n *\n * Unlike `sketchOnPlane` (which lifts a contour onto a whole plane *frame*),\n * `sketchOnFace` lays the contour on the surface of a specific face of a target\n * solid. Every 2D curve is sampled, the samples mapped into the face's `(u,v)`\n * domain under a scale mode (`original` / `bounds` / `native`), the surface\n * evaluated at those UVs, and a curve edge interpolated through the resulting\n * 3D points (see `geometry2d/bridge/on-surface.ts`). The placed wire then\n * becomes a face (`as:'face'`) ready to be extruded along the face normal, or\n * is returned raw (`as:'wire'`).\n *\n * v1 scope: the on-surface primitive is surface-type-independent, but the result\n * face is built with `makeFace` on the interpolated wire, so it is exact for\n * planar faces; embedding the wire into a genuinely curved host face\n * (`fixWireOnFace`) is a follow-up. The op declares `engines: ['occt']`\n * (surface sampling needs the BREP platform).\n * @module\n */\nimport type { Shape } from '../mesh/types'\nimport type { BrepEngineApi } from '../brep/engine/primitives'\nimport type { BrepHandle } from '../brep/engine/types'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { solidToShape } from '../brep/brep-ops'\nimport { fromBrep, fromBrepCurve, brepOf } from '../shape'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\nimport { TopoRefError, resolveTopoRef, type FaceTopoRef } from '../topology/naming'\nimport { buildEdgeResolutionContext } from './topo-resolve'\nimport { Blueprint } from '../geometry2d/blueprint'\nimport { CompoundBlueprint } from '../geometry2d/compound-blueprint'\nimport { organiseBlueprints } from '../geometry2d/organise'\nimport { assembleWireOnFace, type FaceScaleMode } from '../geometry2d/bridge/on-surface'\nimport { profileSegToCurve, type ProfileSegLike } from '../geometry2d/adapt'\nimport { assertProfileParams, type ProfileLoop } from './profile'\n\n/** A face selector on a target solid: a 1-based ordinal (FreeCAD `FaceN`) or a `cad.faceRef` result. */\nexport type FaceSelector = number | FaceTopoRef\n\n/** Contour loops + the target face for `cad.sketchOnFace`. */\nexport interface SketchOnFaceParams {\n /** Ordered 2D closed contours (same shape as `cad.profile` / `cad.sketchOnPlane`). */\n contours: ProfileLoop[]\n /** The target solid on which the host face lives. */\n on: Shape\n /** The host face: a 1-based face ordinal, or a `cad.faceRef(on, n)` result. */\n face: FaceSelector\n /** How 2D coords map onto the face UV space: `'original'` (identity) | `'bounds'`/`'native'` (affine-fit). */\n scaleMode?: FaceScaleMode\n /** Result shape: `'face'` (default) builds a face on the contour; `'wire'` returns the outer-loop wire only. */\n as?: 'face' | 'wire'\n}\n\n/**\n * Resolve a face on `on` to its live BREP handle (1-based ordinal or `cad.faceRef`).\n * @param kernel - the BREP engine surface.\n * @param on - the target solid shape.\n * @param selector - the face ordinal or `cad.faceRef` result.\n * @returns the live face handle.\n */\nexport function resolveFaceHandle(kernel: BrepEngineApi, on: Shape, selector: FaceSelector): BrepHandle {\n const solid = brepOf(on) as BrepHandle | undefined\n if (!solid) {\n throw new TopoRefError('E_TOPO_MESH_UNSUPPORTED', 'face', 'sketchOnFace: target `on` has no BREP solid')\n }\n if (typeof selector === 'number') {\n const faces = kernel.getSubShapes(solid, 'face')\n if (!Number.isInteger(selector) || selector < 1 || selector > faces.length) {\n throw new TopoRefError(\n 'E_TOPO_NOT_FOUND',\n 'face',\n `sketchOnFace: face ordinal ${selector} out of range [1, ${faces.length}]`,\n )\n }\n return faces[selector - 1] as BrepHandle\n }\n if (selector.kind !== 'face') {\n throw new TopoRefError('E_TOPO_NOT_FOUND', 'face', 'sketchOnFace: selector must be a face ordinal or a face ref')\n }\n const ctx = buildEdgeResolutionContext(kernel, on as object)\n if (!ctx) throw new TopoRefError('E_TOPO_NOT_FOUND', 'face', 'sketchOnFace: input has no naming context')\n const resolved = resolveTopoRef(selector, ctx)\n if (resolved.handle === undefined) {\n throw new TopoRefError('E_TOPO_NOT_FOUND', 'face', 'sketchOnFace: face ref resolved to no live handle')\n }\n return resolved.handle as BrepHandle\n}\n\n/**\n * Make the placed face inherit the host face's outward orientation: surface\n * normals must point the same way, otherwise the resulting face — and any prism\n * extruded from it — carries a reversed shell whose OCCT volume collapses to ~0.\n * @param kernel - the BREP engine surface.\n * @param host - the host face handle (its normal is the reference).\n * @param face - the face built on the host surface.\n * @returns a handle to the (possibly re-oriented) face.\n */\nfunction orientLikeHost(kernel: BrepEngineApi, host: BrepHandle, face: BrepHandle): BrepHandle {\n const a = kernel.surfaceNormal(host, 0, 0)\n const b = kernel.surfaceNormal(face, 0, 0)\n const dot = a.x * b.x + a.y * b.y + a.z * b.z\n return dot < 0 ? kernel.reverseShape(face) : face\n}\n\n/** Build one face (outer + optional holes) on the host face for an organised contour entry. */\nfunction buildOnFace(kernel: BrepEngineApi, host: BrepHandle, mode: FaceScaleMode, entry: Blueprint | CompoundBlueprint): BrepHandle {\n if (entry instanceof CompoundBlueprint) {\n let face = orientLikeHost(kernel, host, kernel.makeFace(assembleWireOnFace(kernel, host, mode, entry.blueprints[0]!).wire))\n const holes = entry.blueprints.slice(1).map((h) => assembleWireOnFace(kernel, host, mode, h).wire as never)\n if (holes.length > 0) face = kernel.addHolesInFace(face, holes)\n return face\n }\n return orientLikeHost(kernel, host, kernel.makeFace(assembleWireOnFace(kernel, host, mode, entry).wire))\n}\n\n/**\n * Place `contours` onto the UV space of the host face and return one BREP face\n * per classified contour (each outer + holes folded into a single face). Shared\n * by `cad.sketchOnFace` (wrap as a Shape) and `cad.punchHole` (extrude → cut).\n * @param kernel - the BREP engine surface.\n * @param host - the resolved live host face handle.\n * @param mode - the face-scale (UV mapping) mode.\n * @param contours - ordered 2D closed contour loops to place.\n * @returns the BREP faces built on the host face (one per organised entry).\n */\nexport function placeContoursOnFace(\n kernel: BrepEngineApi,\n host: BrepHandle,\n mode: FaceScaleMode,\n contours: ProfileLoop[],\n): BrepHandle[] {\n const blueprints = contours.map(\n (loop) => new Blueprint(loop.segments.map((s) => profileSegToCurve(s as ProfileSegLike))),\n )\n const organised = organiseBlueprints(blueprints)\n return organised.blueprints.map((entry) => buildOnFace(kernel, host, mode, entry))\n}\n\n/**\n * Build a 3D Shape from closed contours placed on the host face.\n * @param kernel - the BREP engine surface.\n * @param params - contour loops + target solid + face + scale mode.\n * @returns Shape on the target face (face, or the outer wire when `as:'wire'`).\n */\nexport function buildSketchOnFaceWith(kernel: BrepEngineApi, params: SketchOnFaceParams): Shape {\n const host = resolveFaceHandle(kernel, params.on, params.face)\n const mode = params.scaleMode ?? 'original'\n const blueprints = params.contours.map(\n (loop) => new Blueprint(loop.segments.map((s) => profileSegToCurve(s as ProfileSegLike))),\n )\n const organised = organiseBlueprints(blueprints)\n\n if (params.as === 'wire') {\n const outer =\n organised.blueprints[0] instanceof CompoundBlueprint\n ? organised.blueprints[0].blueprints[0]!\n : (organised.blueprints[0] as Blueprint)\n const { wire } = assembleWireOnFace(kernel, host, mode, outer)\n return fromBrepCurve(solidToShape(kernel, wire), { solid: wire })\n }\n\n const faces = placeContoursOnFace(kernel, host, mode, params.contours)\n if (faces.length === 0) throw new Error('sketchOnFace: no contours to place')\n if (faces.length === 1) {\n const f = faces[0]!\n return fromBrep(solidToShape(kernel, f), { solid: f })\n }\n const compound = kernel.makeCompound(faces)\n return fromBrep(solidToShape(kernel, compound), { solid: compound })\n}\n\n/**\n * `cad.sketchOnFace`: place 2D contours on a face of a solid and construct a Shape.\n * @group 创建\n * @inputs 0\n * @async false\n * @qual ok\n * @name sketchOnFace\n * @returns Shape on the target face (face, or a wire curve when `as:'wire'`).\n * @param params.contours - ordered 2D closed contours (same shape as `cad.profile`).type:any[] required:true\n * @param params.on - the target solid on which the face lives.type:Shape required:true\n * @param params.face - the host face: a 1-based ordinal or a `cad.faceRef(on, n)` result.type:any required:true\n * @param params.scaleMode - UV mapping: 'original' (identity) | 'bounds'/'native' (affine-fit).type:string required:false\n * @param params.as - `'face'` (default) or `'wire'` (outer loop only).type:string required:false\n */\nexport const sketchOnFace = defineOp({\n capabilities: ['directEdit'],\n engines: ['occt'],\n brep(params: Record<string, unknown>) {\n assertProfileParams(params)\n return buildSketchOnFaceWith(getBrepApi(), params as unknown as SketchOnFaceParams)\n },\n naming: { kind: 'construct', newFaces: { via: 'explicit', vocab: [] } } as Provenance,\n})"]}
|
|
1
|
+
{"version":3,"file":"sketch-on-face.js","sourceRoot":"","sources":["../../src/api/sketch-on-face.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE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C,UAAU,CAAC,MAAM,sBAAsB;YAClG,oGAAoG;YACpG,2EAA2E,EAC3E,cAAc,EAAE,CACjB,CAAA;IACH,CAAC;IAED,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,CAAA;IAC/E,OAAO,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACvC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;IACnC,YAAY,EAAE,CAAC,YAAY,CAAC;IAC5B,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,IAAI,CAAC,MAA+B;QAClC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QAC3B,OAAO,qBAAqB,CAAC,MAAuC,CAAC,CAAA;IACvE,CAAC;IACD,IAAI,CAAC,MAA+B;QAClC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QAC3B,OAAO,qBAAqB,CAAC,UAAU,EAAE,EAAE,MAAuC,CAAC,CAAA;IACrF,CAAC;IACD,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,EAAgB;CACtF,CAAC,CAAA","sourcesContent":["/**\n * `cad.sketchOnFace`: place 2D contours onto the UV parameter space of an\n * existing face (E3 placement).\n *\n * Unlike `sketchOnPlane` (which lifts a contour onto a whole plane *frame*),\n * `sketchOnFace` lays the contour on the surface of a specific face of a target\n * solid. Every 2D curve is sampled, the samples mapped into the face's `(u,v)`\n * domain under a scale mode (`original` / `bounds` / `native`), the surface\n * evaluated at those UVs, and a curve edge interpolated through the resulting\n * 3D points (see `geometry2d/bridge/on-surface.ts`). The placed wire then\n * becomes a face (`as:'face'`) ready to be extruded along the face normal, or\n * is returned raw (`as:'wire'`).\n *\n * v1 scope: the on-surface primitive is surface-type-independent, but the result\n * face is built with `makeFace` on the interpolated wire, so it is exact for\n * planar faces; embedding the wire into a genuinely curved host face\n * (`fixWireOnFace`) is a follow-up. The op declares `engines: ['occt']`\n * (surface sampling needs the BREP platform).\n *\n * **Two chains, two mechanisms** (plan 2026-10-01 §4 Phase 3). The BREP branch\n * above maps the contour into the host face's UV domain. The **mesh branch**\n * (`buildSketchOnFaceMesh`, `meshEngines: ['brepkit']`) works on a mesh solid's\n * approximate topology and deliberately does NOT use UV space: a brepkit plane's\n * domain is ±1e6 (an infinite domain), so \"place the sketch in the face's UV\n * range\" is meaningless there. It places the contour in the face's own plane\n * frame instead (origin = face bbox centre, normal = `surfaceNormal`), which\n * matches `cad.sketchOnPlane`'s semantics. The result is a **mesh-chain face**\n * (`ShapeSlot.meshFace`), ready for the mesh branch of `cad.extrude`.\n * @module\n */\nimport type { Shape } from '../mesh/types'\nimport type { BrepEngineApi } from '../brep/engine/primitives'\nimport type { BrepHandle } from '../brep/engine/types'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { solidToShape } from '../brep/brep-ops'\nimport { fromBrep, fromBrepCurve, brepOf } from '../shape'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\nimport { TopoRefError, resolveTopoRef, type FaceTopoRef } from '../topology/naming'\nimport { buildEdgeResolutionContext } from './topo-resolve'\nimport { Blueprint } from '../geometry2d/blueprint'\nimport { CompoundBlueprint } from '../geometry2d/compound-blueprint'\nimport { organiseBlueprints } from '../geometry2d/organise'\nimport { assembleWireOnFace, type FaceScaleMode } from '../geometry2d/bridge/on-surface'\nimport { assembleWire, type Plane, type Vec3 } from '../geometry2d/bridge/lift-on-plane'\nimport { profileSegToCurve, type ProfileSegLike } from '../geometry2d/adapt'\nimport { assertProfileParams, toContourBlueprints, type ProfileLoop } from './profile'\nimport { MeshUnsupportedError, getCurrentStmt } from '../runtime-state'\nimport {\n meshBackendOrThrow,\n meshFacePlane,\n meshFaceProduct,\n resolveMeshFaceHandle,\n} from './internal/mesh-solid-op'\n\n/** A face selector on a target solid: a 1-based ordinal (FreeCAD `FaceN`) or a `cad.faceRef` result. */\nexport type FaceSelector = number | FaceTopoRef\n\n/** Contour loops + the target face for `cad.sketchOnFace`. */\nexport interface SketchOnFaceParams {\n /** Ordered 2D closed contours (same shape as `cad.profile` / `cad.sketchOnPlane`). */\n contours: ProfileLoop[]\n /** The target solid on which the host face lives. */\n on: Shape\n /** The host face: a 1-based face ordinal, or a `cad.faceRef(on, n)` result. */\n face: FaceSelector\n /** How 2D coords map onto the face UV space: `'original'` (identity) | `'bounds'`/`'native'` (affine-fit). */\n scaleMode?: FaceScaleMode\n /** Result shape: `'face'` (default) builds a face on the contour; `'wire'` returns the outer-loop wire only. */\n as?: 'face' | 'wire'\n}\n\n/**\n * Resolve a face on `on` to its live BREP handle (1-based ordinal or `cad.faceRef`).\n * @param kernel - the BREP engine surface.\n * @param on - the target solid shape.\n * @param selector - the face ordinal or `cad.faceRef` result.\n * @returns the live face handle.\n */\nexport function resolveFaceHandle(kernel: BrepEngineApi, on: Shape, selector: FaceSelector): BrepHandle {\n const solid = brepOf(on) as BrepHandle | undefined\n if (!solid) {\n throw new TopoRefError('E_TOPO_MESH_UNSUPPORTED', 'face', 'sketchOnFace: target `on` has no BREP solid')\n }\n if (typeof selector === 'number') {\n const faces = kernel.getSubShapes(solid, 'face')\n if (!Number.isInteger(selector) || selector < 1 || selector > faces.length) {\n throw new TopoRefError(\n 'E_TOPO_NOT_FOUND',\n 'face',\n `sketchOnFace: face ordinal ${selector} out of range [1, ${faces.length}]`,\n )\n }\n return faces[selector - 1] as BrepHandle\n }\n if (selector.kind !== 'face') {\n throw new TopoRefError('E_TOPO_NOT_FOUND', 'face', 'sketchOnFace: selector must be a face ordinal or a face ref')\n }\n const ctx = buildEdgeResolutionContext(kernel, on as object)\n if (!ctx) throw new TopoRefError('E_TOPO_NOT_FOUND', 'face', 'sketchOnFace: input has no naming context')\n const resolved = resolveTopoRef(selector, ctx)\n if (resolved.handle === undefined) {\n throw new TopoRefError('E_TOPO_NOT_FOUND', 'face', 'sketchOnFace: face ref resolved to no live handle')\n }\n return resolved.handle as BrepHandle\n}\n\n/**\n * Make the placed face inherit the host face's outward orientation: surface\n * normals must point the same way, otherwise the resulting face — and any prism\n * extruded from it — carries a reversed shell whose OCCT volume collapses to ~0.\n * @param kernel - the BREP engine surface.\n * @param host - the host face handle (its normal is the reference).\n * @param face - the face built on the host surface.\n * @returns a handle to the (possibly re-oriented) face.\n */\nfunction orientLikeHost(kernel: BrepEngineApi, host: BrepHandle, face: BrepHandle): BrepHandle {\n const a = kernel.surfaceNormal(host, 0, 0)\n const b = kernel.surfaceNormal(face, 0, 0)\n const dot = a.x * b.x + a.y * b.y + a.z * b.z\n return dot < 0 ? kernel.reverseShape(face) : face\n}\n\n/** Build one face (outer + optional holes) on the host face for an organised contour entry. */\nfunction buildOnFace(kernel: BrepEngineApi, host: BrepHandle, mode: FaceScaleMode, entry: Blueprint | CompoundBlueprint): BrepHandle {\n if (entry instanceof CompoundBlueprint) {\n let face = orientLikeHost(kernel, host, kernel.makeFace(assembleWireOnFace(kernel, host, mode, entry.blueprints[0]!).wire))\n const holes = entry.blueprints.slice(1).map((h) => assembleWireOnFace(kernel, host, mode, h).wire as never)\n if (holes.length > 0) face = kernel.addHolesInFace(face, holes)\n return face\n }\n return orientLikeHost(kernel, host, kernel.makeFace(assembleWireOnFace(kernel, host, mode, entry).wire))\n}\n\n/**\n * Place `contours` onto the UV space of the host face and return one BREP face\n * per classified contour (each outer + holes folded into a single face). Shared\n * by `cad.sketchOnFace` (wrap as a Shape) and `cad.punchHole` (extrude → cut).\n * @param kernel - the BREP engine surface.\n * @param host - the resolved live host face handle.\n * @param mode - the face-scale (UV mapping) mode.\n * @param contours - ordered 2D closed contour loops to place.\n * @returns the BREP faces built on the host face (one per organised entry).\n */\nexport function placeContoursOnFace(\n kernel: BrepEngineApi,\n host: BrepHandle,\n mode: FaceScaleMode,\n contours: ProfileLoop[],\n): BrepHandle[] {\n const blueprints = contours.map(\n (loop) => new Blueprint(loop.segments.map((s) => profileSegToCurve(s as ProfileSegLike))),\n )\n const organised = organiseBlueprints(blueprints)\n return organised.blueprints.map((entry) => buildOnFace(kernel, host, mode, entry))\n}\n\n/**\n * Build a 3D Shape from closed contours placed on the host face.\n * @param kernel - the BREP engine surface.\n * @param params - contour loops + target solid + face + scale mode.\n * @returns Shape on the target face (face, or the outer wire when `as:'wire'`).\n */\nexport function buildSketchOnFaceWith(kernel: BrepEngineApi, params: SketchOnFaceParams): Shape {\n const host = resolveFaceHandle(kernel, params.on, params.face)\n const mode = params.scaleMode ?? 'original'\n const blueprints = params.contours.map(\n (loop) => new Blueprint(loop.segments.map((s) => profileSegToCurve(s as ProfileSegLike))),\n )\n const organised = organiseBlueprints(blueprints)\n\n if (params.as === 'wire') {\n const outer =\n organised.blueprints[0] instanceof CompoundBlueprint\n ? organised.blueprints[0].blueprints[0]!\n : (organised.blueprints[0] as Blueprint)\n const { wire } = assembleWireOnFace(kernel, host, mode, outer)\n return fromBrepCurve(solidToShape(kernel, wire), { solid: wire })\n }\n\n const faces = placeContoursOnFace(kernel, host, mode, params.contours)\n if (faces.length === 0) throw new Error('sketchOnFace: no contours to place')\n if (faces.length === 1) {\n const f = faces[0]!\n return fromBrep(solidToShape(kernel, f), { solid: f })\n }\n const compound = kernel.makeCompound(faces)\n return fromBrep(solidToShape(kernel, compound), { solid: compound })\n}\n\n/**\n * 把一张平面的法向对齐到参考方向(外部朝向)。网格链上的复制版:BREP 侧的\n * `orientLikeHost` 存在的原因是\"面朝向反了 → 由它拉出的棱柱壳反向 → 体积归零\",\n * 这里同一个道理,只是参考法向来自**平面本身**(`meshFacePlane` 的法向就是从宿主面\n * 的 `surfaceNormal` 取的),不必再回读宿主句柄。\n *\n * @param kernel - the mesh backend's L1 kernel.\n * @param reference - the outward normal the placed face must agree with.\n * @param face - the face built on the plane.\n * @returns a handle to the (possibly re-oriented) face.\n */\nfunction orientFaceTo(kernel: BrepEngineApi, reference: Vec3, face: BrepHandle): BrepHandle {\n const uv = kernel.uvBounds(face)\n const n = kernel.surfaceNormal(face, (uv.uMin + uv.uMax) / 2, (uv.vMin + uv.vMax) / 2)\n const dot = reference.x * n.x + reference.y * n.y + reference.z * n.z\n return dot < 0 ? kernel.reverseShape(face) : face\n}\n\n/** 一个已归类的轮廓条目(外环 + 可选孔)在平面坐标系里造一张面。 */\nfunction buildFaceOnPlane(\n kernel: BrepEngineApi,\n plane: Plane,\n outward: Vec3,\n entry: Blueprint | CompoundBlueprint,\n): BrepHandle {\n const outerBp = entry instanceof CompoundBlueprint ? entry.blueprints[0]! : entry\n let face = orientFaceTo(kernel, outward, kernel.makeFace(assembleWire(kernel, plane, outerBp)))\n if (entry instanceof CompoundBlueprint) {\n const holes = entry.blueprints.slice(1).map((h) => assembleWire(kernel, plane, h) as never)\n if (holes.length > 0) face = kernel.addHolesInFace(face, holes)\n }\n return face\n}\n\n/**\n * 网格链上的 `cad.sketchOnFace`:在**识别出的平面网格面**上铺 2D 轮廓,产出网格链面\n * (方案 2026-10-01 §4 Phase 3-2),可交给 `cad.extrude` 的网格路径拉伸出新实体。\n *\n * 与 BREP 侧的三点差别,每一点都是\"近似拓扑没有 UV 语义\"的直接后果:\n *\n * 1. **不走 UV 域**。BREP 侧 `assembleWireOnFace` 把 2D 采样点映射进面的 `(u,v)` 域;\n * 而平面在 brepkit 上的域是 ±1e6 的**无限域**(方案 §4 Phase 3-1 实测),拿它当\n * 草图范围毫无意义。这里改用面自己的平面框(原点 = 面包围盒中心、法向 = 面法向),\n * 2D 坐标直接落在平面坐标系里——与 `cad.sketchOnPlane` 的语义一致。\n * 2. **`scaleMode` 只接受 `'original'`**。`'bounds'` / `'native'` 的定义是\"拟合到面的\n * UV 域\",而那个域在这里要么是无限域、要么不存在。静默按 `'original'` 处理会造成\n * \"同一次调用在两条链上得到不同尺寸\"的隐性分歧,所以如实拒绝。\n * 3. **`as:'wire'` 不支持**。网格链上的一根 wire 没有身份槽(面才有),而 sketch 的\n * 下游用途(拉伸)要的正是面。需要 wire 的场景请走 BREP 链。\n *\n * 另外只支持**平面面**:曲面面(STL 圆柱的侧面片)上铺草图需要曲面嵌入,属未开的能力。\n *\n * @param params - contour loops + target mesh solid + face selector + scale mode.\n * @returns the mesh-chain face Shape on the target face.\n * @throws {MeshUnsupportedError} when the target is not a mesh solid, the face is not planar,\n * the scale mode is not `'original'`, `as:'wire'` was requested, or the sketch is multi-island.\n */\nexport function buildSketchOnFaceMesh(params: SketchOnFaceParams): Shape {\n const opLabel = 'sketchOnFace'\n const backend = meshBackendOrThrow(opLabel)\n const kernel = backend.kernel\n\n const mode = params.scaleMode ?? 'original'\n if (mode !== 'original') {\n throw new MeshUnsupportedError(\n `E_MESH_SOLID_UNSUPPORTED: ${opLabel} scaleMode '${mode}' is defined against the face's UV domain, ` +\n 'which a mesh-chain face does not have — use the default \\'original\\' (2D coords live in the face plane)',\n getCurrentStmt(),\n )\n }\n if (params.as === 'wire') {\n throw new MeshUnsupportedError(\n `E_MESH_SOLID_UNSUPPORTED: ${opLabel} as:'wire' has no mesh-chain representation — ` +\n 'a mesh-chain wire has no identity slot; ask for the default as:\\'face\\' instead',\n getCurrentStmt(),\n )\n }\n\n const host = resolveMeshFaceHandle(kernel, params.on, params.face, opLabel)\n const surface = kernel.surfaceType(host)\n if (surface !== 'plane') {\n throw new MeshUnsupportedError(\n `E_MESH_SOLID_UNSUPPORTED: ${opLabel} needs a planar mesh face to sketch on — this face reports ` +\n `surfaceType '${surface}'. Sketches on curved approximate faces are not implemented ` +\n '(an STL cylinder is 32 planar strips, each of which IS usable)',\n getCurrentStmt(),\n )\n }\n\n const plane = meshFacePlane(kernel, host)\n const outward: Vec3 = { x: plane.zDir.x, y: plane.zDir.y, z: plane.zDir.z }\n\n const organised = organiseBlueprints(toContourBlueprints(params.contours))\n if (organised.blueprints.length === 0) throw new Error('sketchOnFace: no contours to place')\n if (organised.blueprints.length > 1) {\n throw new MeshUnsupportedError(\n `E_MESH_SOLID_UNSUPPORTED: ${opLabel} produced ${organised.blueprints.length} disjoint islands — ` +\n 'the mesh backend can only extrude a single face (brepkit extrude takes one face, not a compound). ' +\n 'Sketch and extrude each island separately, then unite them with a boolean',\n getCurrentStmt(),\n )\n }\n\n const face = buildFaceOnPlane(kernel, plane, outward, organised.blueprints[0]!)\n return meshFaceProduct(backend, face)\n}\n\n/**\n * `cad.sketchOnFace`: place 2D contours on a face of a solid and construct a Shape.\n *\n * **网格链**(`meshEngines: ['brepkit']`,方案 2026-10-01 §4 Phase 3):`on` 是网格实体\n * 时,轮廓按面自己的**平面框**铺放(原点 = 面包围盒中心、法向 = 面法向),产物是一张\n * 网格链面,可直接交给 `cad.extrude` 拉伸。该分支只接受平面面、只接受默认\n * `scaleMode`(`'bounds'`/`'native'` 相对 UV 域定义,网格链上没有 UV 域)、只接受\n * `as:'face'`、且只接受单个轮廓岛——每一条越界都以 `E_MESH_SOLID_UNSUPPORTED` 说明原因。\n *\n * @group 创建\n * @inputs 0\n * @async false\n * @qual ok\n * @name sketchOnFace\n * @returns Shape on the target face (face, or a wire curve when `as:'wire'`).\n * @param params.contours - ordered 2D closed contours (same shape as `cad.profile`).type:any[] required:true\n * @param params.on - the target solid on which the face lives.type:Shape required:true\n * @param params.face - the host face: a 1-based ordinal or a `cad.faceRef(on, n)` result.type:any required:true\n * @param params.scaleMode - UV mapping: 'original' (identity) | 'bounds'/'native' (affine-fit).type:string required:false\n * @param params.as - `'face'` (default) or `'wire'` (outer loop only).type:string required:false\n */\nexport const sketchOnFace = defineOp({\n capabilities: ['directEdit'],\n engines: ['occt'],\n meshEngines: ['brepkit'],\n mesh(params: Record<string, unknown>) {\n assertProfileParams(params)\n return buildSketchOnFaceMesh(params as unknown as SketchOnFaceParams)\n },\n brep(params: Record<string, unknown>) {\n assertProfileParams(params)\n return buildSketchOnFaceWith(getBrepApi(), params as unknown as SketchOnFaceParams)\n },\n naming: { kind: 'construct', newFaces: { via: 'explicit', vocab: [] } } as Provenance,\n})"]}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* profile source (profile / draw / sketch) that describes contours as
|
|
6
6
|
* `ProfileLoop`s can be placed here, then extruded along the plane normal. The
|
|
7
7
|
* plane is a named plane (`'XY'` / `'XZ'` / `'top'` …) or an explicit frame
|
|
8
|
-
* `{ origin, normal, xAxis }`. The plane lift runs on the
|
|
9
|
-
*
|
|
8
|
+
* `{ origin, normal, xAxis }`. The plane lift runs on the geometry2d bridge,
|
|
9
|
+
* which builds exact analytic edges on BOTH engines: full circles via
|
|
10
|
+
* `makeCircleEdge`, arcs via `makeArcEdge` (brepkit's circumcircle defect fixed
|
|
11
|
+
* 2026-09-30). The op therefore carries no engine gate.
|
|
10
12
|
* @module
|
|
11
13
|
*/
|
|
12
14
|
import type { Shape } from '../mesh/types.js';
|
|
@@ -29,7 +31,7 @@ export interface PlaneSpec {
|
|
|
29
31
|
export interface SketchOnPlaneParams {
|
|
30
32
|
/**
|
|
31
33
|
* Contour source: segment loops (`{segments: […]}`) or already-drawn contours
|
|
32
|
-
* (a `
|
|
34
|
+
* (a `Blueprint`, or an array of them). The drawn form is what makes the
|
|
33
35
|
* "draw → place → extrude" pipeline real — see {@link DrawnContours}.
|
|
34
36
|
*/
|
|
35
37
|
contours: ProfileLoop[] | DrawnContours;
|
|
@@ -49,7 +51,7 @@ export declare function resolvePlane(planeSpec: PlaneSpec, fallbackOrigin?: Vec3
|
|
|
49
51
|
/**
|
|
50
52
|
* Build a 3D Shape (planar face, or outer-loop wire when `as:'wire'`) from a set
|
|
51
53
|
* of classified `Blueprint` contours on a plane. This is the shared placement
|
|
52
|
-
* core for every 2D profile source (`cad.profile` /
|
|
54
|
+
* core for every 2D profile source (`cad.profile` / a drawn contour / sketch): it
|
|
53
55
|
* organises the closed contours (holes vs islands), assembles edge wires on the
|
|
54
56
|
* plane via the geometry2d bridge, and wraps them as a BREP face — ready to be
|
|
55
57
|
* extruded along the plane normal.
|
|
@@ -77,7 +79,7 @@ export declare function buildSketchOnPlaneWith(kernel: BrepEngineApi, params: Sk
|
|
|
77
79
|
* @qual ok
|
|
78
80
|
* @name sketchOnPlane
|
|
79
81
|
* @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).
|
|
80
|
-
* @param params.contours - ordered 2D contours (same shape as `cad.profile`: segment loops, or a `
|
|
82
|
+
* @param params.contours - ordered 2D contours (same shape as `cad.profile`: segment loops, or a drawn `Blueprint`).type:any required:true
|
|
81
83
|
* @param params.plane - named plane (`'XY'` / `'XZ'`…) or `{ origin, normal, xAxis }`.type:any required:true
|
|
82
84
|
* @param params.as - `'face'` (default) or `'wire'` (outer loop only).type:string required:false
|
|
83
85
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sketch-on-plane.d.ts","sourceRoot":"","sources":["../../src/api/sketch-on-plane.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sketch-on-plane.d.ts","sourceRoot":"","sources":["../../src/api/sketch-on-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAM9D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,OAAO,EAAiC,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEtG,OAAO,EAA4C,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAA;AAE1G,wGAAwG;AACxG,MAAM,WAAW,SAAS;IACxB,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wEAAwE;IACxE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,yEAAyE;IACzE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,gFAAgF;IAChF,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,EAAE,WAAW,EAAE,GAAG,aAAa,CAAA;IACvC,iEAAiE;IACjE,KAAK,EAAE,SAAS,CAAA;IAChB,oGAAoG;IACpG,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,GAAE,SAAqB,GAAG,KAAK,CAK/F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,SAAS,EAAE,EACvB,EAAE,GAAE,MAAM,GAAG,MAAe,GAC3B,KAAK,CAgCP;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,KAAK,CAQhG;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;;CAQxB,CAAA"}
|
|
@@ -25,7 +25,7 @@ export function resolvePlane(planeSpec, fallbackOrigin = [0, 0, 0]) {
|
|
|
25
25
|
/**
|
|
26
26
|
* Build a 3D Shape (planar face, or outer-loop wire when `as:'wire'`) from a set
|
|
27
27
|
* of classified `Blueprint` contours on a plane. This is the shared placement
|
|
28
|
-
* core for every 2D profile source (`cad.profile` /
|
|
28
|
+
* core for every 2D profile source (`cad.profile` / a drawn contour / sketch): it
|
|
29
29
|
* organises the closed contours (holes vs islands), assembles edge wires on the
|
|
30
30
|
* plane via the geometry2d bridge, and wraps them as a BREP face — ready to be
|
|
31
31
|
* extruded along the plane normal.
|
|
@@ -75,10 +75,10 @@ export function buildShapeFromBlueprints(kernel, plane, blueprints, as = 'face')
|
|
|
75
75
|
*/
|
|
76
76
|
export function buildSketchOnPlaneWith(kernel, params) {
|
|
77
77
|
const plane = resolvePlane(params.plane);
|
|
78
|
-
// 2026-09-28:段环数据与「已绘制轮廓」(`
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
//
|
|
78
|
+
// 2026-09-28:段环数据与「已绘制轮廓」(`Blueprint`)在此归一。少了这一步,
|
|
79
|
+
// 「draw → sketchOnPlane → extrude」就断了 —— 已绘制轮廓没有 OCCT 句柄,
|
|
80
|
+
// 实测喂 `cad.extrude` 报 `argument carries no BREP handle`、喂 `cad.sweep`
|
|
81
|
+
// 报 `INVALID_SHAPE_ID`,全仓没有第二个能把它变成 Shape 的通道。
|
|
82
82
|
const blueprints = toContourBlueprints(params.contours);
|
|
83
83
|
return buildShapeFromBlueprints(kernel, plane, blueprints, params.as ?? 'face');
|
|
84
84
|
}
|
|
@@ -90,13 +90,12 @@ export function buildSketchOnPlaneWith(kernel, params) {
|
|
|
90
90
|
* @qual ok
|
|
91
91
|
* @name sketchOnPlane
|
|
92
92
|
* @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).
|
|
93
|
-
* @param params.contours - ordered 2D contours (same shape as `cad.profile`: segment loops, or a `
|
|
93
|
+
* @param params.contours - ordered 2D contours (same shape as `cad.profile`: segment loops, or a drawn `Blueprint`).type:any required:true
|
|
94
94
|
* @param params.plane - named plane (`'XY'` / `'XZ'`…) or `{ origin, normal, xAxis }`.type:any required:true
|
|
95
95
|
* @param params.as - `'face'` (default) or `'wire'` (outer loop only).type:string required:false
|
|
96
96
|
*/
|
|
97
97
|
export const sketchOnPlane = defineOp({
|
|
98
98
|
capabilities: ['directEdit'],
|
|
99
|
-
engines: ['occt'],
|
|
100
99
|
brep(params) {
|
|
101
100
|
assertProfileParams(params);
|
|
102
101
|
return buildSketchOnPlaneWith(getBrepApi(), params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sketch-on-plane.js","sourceRoot":"","sources":["../../src/api/sketch-on-plane.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,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(E2 placement).\n *\n * This is the shared \"placement\" step of the plan's unified 3D pipeline: any 2D\n * profile source (profile / draw / sketch) that describes contours as\n * `ProfileLoop`s can be placed here, then extruded along the plane normal. The\n * plane is a named plane (`'XY'` / `'XZ'` / `'top'` …) or an explicit frame\n * `{ origin, normal, xAxis }`. The plane lift runs on the occt platform surface\n * via the geometry2d bridge; the op declares `engines: ['occt']`.\n * @module\n */\nimport type { Shape } from '../mesh/types'\nimport type { BrepEngineApi } from '../brep/engine/primitives'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { solidToShape } from '../brep/brep-ops'\nimport { fromBrep, fromBrepCurve } from '../shape'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\nimport { Blueprint } from '../geometry2d/blueprint'\nimport { CompoundBlueprint } from '../geometry2d/compound-blueprint'\nimport { organiseBlueprints } from '../geometry2d/organise'\nimport { namedPlane, makePlane, toVec3, type Plane, type Vec3Input } from '../geometry2d/bridge/plane'\nimport { assembleWire } from '../geometry2d/bridge/lift-on-plane'\nimport { assertProfileParams, toContourBlueprints, type DrawnContours, type ProfileLoop } from './profile'\n\n/** A plane given by a named plane and/or an explicit frame (coords accept both array and `{x,y,z}`). */\nexport interface PlaneSpec {\n /** Named plane (`'XY'` / `'XZ'` / `'YZ'` / `'front'` / `'back'` / `'left'` / …). */\n name?: string\n /** The plane origin (default [0,0,0]; array `[x,y,z]` or `{x,y,z}`). */\n origin?: Vec3Input\n /** Explicit normal (used with an explicit frame; array or `{x,y,z}`). */\n normal?: Vec3Input\n /** Explicit in-plane X axis (auto-derived when omitted; array or `{x,y,z}`). */\n xAxis?: Vec3Input\n}\n\n/** Contour loops + a target plane (+ the result mode) for `cad.sketchOnPlane`. */\nexport interface SketchOnPlaneParams {\n /**\n * Contour source: segment loops (`{segments: […]}`) or already-drawn contours\n * (a `cad.draw` product, or an array of them). The drawn form is what makes the\n * \"draw → place → extrude\" pipeline real — see {@link DrawnContours}.\n */\n contours: ProfileLoop[] | DrawnContours\n /** Named plane or explicit `{ origin, normal, xAxis }` frame. */\n plane: PlaneSpec\n /** Result shape: 'face' (default) builds a planar face; 'wire' returns the outer-loop wire only. */\n as?: 'face' | 'wire'\n}\n\n/**\n * Resolve a `PlaneSpec` to a plane frame. A named plane wins over an explicit\n * frame; with neither, the XY plane is used.\n * @param planeSpec - the user-facing plane spec (named plane and/or explicit frame).\n * @param fallbackOrigin - the origin used when `planeSpec.origin` is absent (default [0,0,0]).\n * @returns the resolved plane frame.\n */\nexport function resolvePlane(planeSpec: PlaneSpec, fallbackOrigin: Vec3Input = [0, 0, 0]): Plane {\n const o = planeSpec.origin ?? toVec3(fallbackOrigin)\n if (planeSpec.name) return namedPlane(planeSpec.name, o)\n if (planeSpec.normal) return makePlane(o, planeSpec.normal, planeSpec.xAxis)\n return namedPlane('XY', o)\n}\n\n/**\n * Build a 3D Shape (planar face, or outer-loop wire when `as:'wire'`) from a set\n * of classified `Blueprint` contours on a plane. This is the shared placement\n * core for every 2D profile source (`cad.profile` / `cad.draw` / sketch): it\n * organises the closed contours (holes vs islands), assembles edge wires on the\n * plane via the geometry2d bridge, and wraps them as a BREP face — ready to be\n * extruded along the plane normal.\n * @param kernel - the BREP engine surface.\n * @param plane - the resolved target plane frame.\n * @param blueprints - ordered closed contours as `Blueprint`s (draw output).\n * @param as - `'face'` (default) or `'wire'` (outer loop only).\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n */\nexport function buildShapeFromBlueprints(\n kernel: BrepEngineApi,\n plane: Plane,\n blueprints: Blueprint[],\n as: 'face' | 'wire' = 'face',\n): Shape {\n const organised = organiseBlueprints(blueprints)\n\n if (as === 'wire') {\n const outerBp =\n organised.blueprints[0] instanceof CompoundBlueprint\n ? organised.blueprints[0].blueprints[0]!\n : (organised.blueprints[0] as Blueprint)\n const wire = assembleWire(kernel, plane, outerBp)\n return fromBrepCurve(solidToShape(kernel, wire), { solid: wire })\n }\n\n const faces: ReturnType<BrepEngineApi['makeFace']>[] = []\n for (const entry of organised.blueprints) {\n if (entry instanceof CompoundBlueprint) {\n let face = kernel.makeFace(assembleWire(kernel, plane, entry.blueprints[0]!))\n const holes = entry.blueprints.slice(1).map((h) => assembleWire(kernel, plane, h) as never)\n if (holes.length > 0) {\n face = kernel.addHolesInFace(face, holes)\n }\n faces.push(face)\n } else {\n faces.push(kernel.makeFace(assembleWire(kernel, plane, entry)))\n }\n }\n\n if (faces.length === 1) {\n const f = faces[0]!\n return fromBrep(solidToShape(kernel, f), { solid: f })\n }\n const compound = kernel.makeCompound(faces)\n return fromBrep(solidToShape(kernel, compound), { solid: compound })\n}\n\n/**\n * Build the 2D→3D placement: normalize the contour source (segment loops or a\n * drawn contour) to a classified Blueprint set, assemble a wire on the plane,\n * then wrap as a face (or the outer wire).\n * @param kernel - the BREP engine surface.\n * @param params - contour source + plane + mode.\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n */\nexport function buildSketchOnPlaneWith(kernel: BrepEngineApi, params: SketchOnPlaneParams): Shape {\n const plane = resolvePlane(params.plane)\n // 2026-09-28:段环数据与「已绘制轮廓」(`cad.draw` 产物)在此归一。少了这一步,\n // 计划 A4 的「draw → sketchOnPlane → extrude」就断了 —— `cad.draw` 的 Blueprint\n // 没有 OCCT 句柄,实测喂 `cad.extrude` 报 `argument carries no BREP handle`、\n // 喂 `cad.sweep` 报 `INVALID_SHAPE_ID`,全仓没有第二个能把它变成 Shape 的通道。\n const blueprints = toContourBlueprints(params.contours)\n return buildShapeFromBlueprints(kernel, plane, blueprints, params.as ?? 'face')\n}\n\n/**\n * `cad.sketchOnPlane`: place 2D contours on a plane and construct a Shape.\n * @group 创建\n * @inputs 0\n * @async false\n * @qual ok\n * @name sketchOnPlane\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n * @param params.contours - ordered 2D contours (same shape as `cad.profile`: segment loops, or a `cad.draw` product).type:any required:true\n * @param params.plane - named plane (`'XY'` / `'XZ'`…) or `{ origin, normal, xAxis }`.type:any required:true\n * @param params.as - `'face'` (default) or `'wire'` (outer loop only).type:string required:false\n */\nexport const sketchOnPlane = defineOp({\n capabilities: ['directEdit'],\n engines: ['occt'],\n brep(params: Record<string, unknown>) {\n assertProfileParams(params)\n return buildSketchOnPlaneWith(getBrepApi(), params as unknown as SketchOnPlaneParams)\n },\n naming: { kind: 'construct', newFaces: { via: 'explicit', vocab: [] } } as Provenance,\n})"]}
|
|
1
|
+
{"version":3,"file":"sketch-on-plane.js","sourceRoot":"","sources":["../../src/api/sketch-on-plane.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAA8B,MAAM,4BAA4B,CAAA;AACtG,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAwC,MAAM,WAAW,CAAA;AA4B1G;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,SAAoB,EAAE,iBAA4B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACtF,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,IAAI,MAAM,CAAC,cAAc,CAAC,CAAA;IACpD,IAAI,SAAS,CAAC,IAAI;QAAE,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACxD,IAAI,SAAS,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,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,IAAI,CAAC,MAA+B;QAClC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QAC3B,OAAO,sBAAsB,CAAC,UAAU,EAAE,EAAE,MAAwC,CAAC,CAAA;IACvF,CAAC;IACD,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,EAAgB;CACtF,CAAC,CAAA","sourcesContent":["/**\n * `cad.sketchOnPlane`: lift 2D contours onto an arbitrary plane (E2 placement).\n *\n * This is the shared \"placement\" step of the plan's unified 3D pipeline: any 2D\n * profile source (profile / draw / sketch) that describes contours as\n * `ProfileLoop`s can be placed here, then extruded along the plane normal. The\n * plane is a named plane (`'XY'` / `'XZ'` / `'top'` …) or an explicit frame\n * `{ origin, normal, xAxis }`. The plane lift runs on the geometry2d bridge,\n * which builds exact analytic edges on BOTH engines: full circles via\n * `makeCircleEdge`, arcs via `makeArcEdge` (brepkit's circumcircle defect fixed\n * 2026-09-30). The op therefore carries no engine gate.\n * @module\n */\nimport type { Shape } from '../mesh/types'\nimport type { BrepEngineApi } from '../brep/engine/primitives'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { solidToShape } from '../brep/brep-ops'\nimport { fromBrep, fromBrepCurve } from '../shape'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\nimport { Blueprint } from '../geometry2d/blueprint'\nimport { CompoundBlueprint } from '../geometry2d/compound-blueprint'\nimport { organiseBlueprints } from '../geometry2d/organise'\nimport { namedPlane, makePlane, toVec3, type Plane, type Vec3Input } from '../geometry2d/bridge/plane'\nimport { assembleWire } from '../geometry2d/bridge/lift-on-plane'\nimport { assertProfileParams, toContourBlueprints, type DrawnContours, type ProfileLoop } from './profile'\n\n/** A plane given by a named plane and/or an explicit frame (coords accept both array and `{x,y,z}`). */\nexport interface PlaneSpec {\n /** Named plane (`'XY'` / `'XZ'` / `'YZ'` / `'front'` / `'back'` / `'left'` / …). */\n name?: string\n /** The plane origin (default [0,0,0]; array `[x,y,z]` or `{x,y,z}`). */\n origin?: Vec3Input\n /** Explicit normal (used with an explicit frame; array or `{x,y,z}`). */\n normal?: Vec3Input\n /** Explicit in-plane X axis (auto-derived when omitted; array or `{x,y,z}`). */\n xAxis?: Vec3Input\n}\n\n/** Contour loops + a target plane (+ the result mode) for `cad.sketchOnPlane`. */\nexport interface SketchOnPlaneParams {\n /**\n * Contour source: segment loops (`{segments: […]}`) or already-drawn contours\n * (a `Blueprint`, or an array of them). The drawn form is what makes the\n * \"draw → place → extrude\" pipeline real — see {@link DrawnContours}.\n */\n contours: ProfileLoop[] | DrawnContours\n /** Named plane or explicit `{ origin, normal, xAxis }` frame. */\n plane: PlaneSpec\n /** Result shape: 'face' (default) builds a planar face; 'wire' returns the outer-loop wire only. */\n as?: 'face' | 'wire'\n}\n\n/**\n * Resolve a `PlaneSpec` to a plane frame. A named plane wins over an explicit\n * frame; with neither, the XY plane is used.\n * @param planeSpec - the user-facing plane spec (named plane and/or explicit frame).\n * @param fallbackOrigin - the origin used when `planeSpec.origin` is absent (default [0,0,0]).\n * @returns the resolved plane frame.\n */\nexport function resolvePlane(planeSpec: PlaneSpec, fallbackOrigin: Vec3Input = [0, 0, 0]): Plane {\n const o = planeSpec.origin ?? toVec3(fallbackOrigin)\n if (planeSpec.name) return namedPlane(planeSpec.name, o)\n if (planeSpec.normal) return makePlane(o, planeSpec.normal, planeSpec.xAxis)\n return namedPlane('XY', o)\n}\n\n/**\n * Build a 3D Shape (planar face, or outer-loop wire when `as:'wire'`) from a set\n * of classified `Blueprint` contours on a plane. This is the shared placement\n * core for every 2D profile source (`cad.profile` / a drawn contour / sketch): it\n * organises the closed contours (holes vs islands), assembles edge wires on the\n * plane via the geometry2d bridge, and wraps them as a BREP face — ready to be\n * extruded along the plane normal.\n * @param kernel - the BREP engine surface.\n * @param plane - the resolved target plane frame.\n * @param blueprints - ordered closed contours as `Blueprint`s (draw output).\n * @param as - `'face'` (default) or `'wire'` (outer loop only).\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n */\nexport function buildShapeFromBlueprints(\n kernel: BrepEngineApi,\n plane: Plane,\n blueprints: Blueprint[],\n as: 'face' | 'wire' = 'face',\n): Shape {\n const organised = organiseBlueprints(blueprints)\n\n if (as === 'wire') {\n const outerBp =\n organised.blueprints[0] instanceof CompoundBlueprint\n ? organised.blueprints[0].blueprints[0]!\n : (organised.blueprints[0] as Blueprint)\n const wire = assembleWire(kernel, plane, outerBp)\n return fromBrepCurve(solidToShape(kernel, wire), { solid: wire })\n }\n\n const faces: ReturnType<BrepEngineApi['makeFace']>[] = []\n for (const entry of organised.blueprints) {\n if (entry instanceof CompoundBlueprint) {\n let face = kernel.makeFace(assembleWire(kernel, plane, entry.blueprints[0]!))\n const holes = entry.blueprints.slice(1).map((h) => assembleWire(kernel, plane, h) as never)\n if (holes.length > 0) {\n face = kernel.addHolesInFace(face, holes)\n }\n faces.push(face)\n } else {\n faces.push(kernel.makeFace(assembleWire(kernel, plane, entry)))\n }\n }\n\n if (faces.length === 1) {\n const f = faces[0]!\n return fromBrep(solidToShape(kernel, f), { solid: f })\n }\n const compound = kernel.makeCompound(faces)\n return fromBrep(solidToShape(kernel, compound), { solid: compound })\n}\n\n/**\n * Build the 2D→3D placement: normalize the contour source (segment loops or a\n * drawn contour) to a classified Blueprint set, assemble a wire on the plane,\n * then wrap as a face (or the outer wire).\n * @param kernel - the BREP engine surface.\n * @param params - contour source + plane + mode.\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n */\nexport function buildSketchOnPlaneWith(kernel: BrepEngineApi, params: SketchOnPlaneParams): Shape {\n const plane = resolvePlane(params.plane)\n // 2026-09-28:段环数据与「已绘制轮廓」(`Blueprint`)在此归一。少了这一步,\n // 「draw → sketchOnPlane → extrude」就断了 —— 已绘制轮廓没有 OCCT 句柄,\n // 实测喂 `cad.extrude` 报 `argument carries no BREP handle`、喂 `cad.sweep`\n // 报 `INVALID_SHAPE_ID`,全仓没有第二个能把它变成 Shape 的通道。\n const blueprints = toContourBlueprints(params.contours)\n return buildShapeFromBlueprints(kernel, plane, blueprints, params.as ?? 'face')\n}\n\n/**\n * `cad.sketchOnPlane`: place 2D contours on a plane and construct a Shape.\n * @group 创建\n * @inputs 0\n * @async false\n * @qual ok\n * @name sketchOnPlane\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n * @param params.contours - ordered 2D contours (same shape as `cad.profile`: segment loops, or a drawn `Blueprint`).type:any required:true\n * @param params.plane - named plane (`'XY'` / `'XZ'`…) or `{ origin, normal, xAxis }`.type:any required:true\n * @param params.as - `'face'` (default) or `'wire'` (outer loop only).type:string required:false\n */\nexport const sketchOnPlane = defineOp({\n capabilities: ['directEdit'],\n\n brep(params: Record<string, unknown>) {\n assertProfileParams(params)\n return buildSketchOnPlaneWith(getBrepApi(), params as unknown as SketchOnPlaneParams)\n },\n naming: { kind: 'construct', newFaces: { via: 'explicit', vocab: [] } } as Provenance,\n})"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* api splitByPlane — 平面二分:把 solid 沿无限平面切成两半(手写中立 op,Phase 6.1)
|
|
3
3
|
*
|
|
4
4
|
* 中立 op:L1 `splitByPlane(shape, point, normal)` 在 occt 与 brepkit 两侧均有
|
|
5
5
|
* 真实现(occt-kernel/occt-primitives.ts / brepkit-kernel/brepkitKernel.ts)⇒
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-by-plane.d.ts","sourceRoot":"","sources":["../../src/api/split-by-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAQ1C,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAEpC,6BAA6B;AAC7B,MAAM,WAAW,kBAAkB;IACjC,iBAAiB;IACjB,KAAK,EAAE,IAAI,CAAA;IACX,mCAAmC;IACnC,MAAM,EAAE,IAAI,CAAA;CACb;AAuBD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY;;
|
|
1
|
+
{"version":3,"file":"split-by-plane.d.ts","sourceRoot":"","sources":["../../src/api/split-by-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAQ1C,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAEpC,6BAA6B;AAC7B,MAAM,WAAW,kBAAkB;IACjC,iBAAiB;IACjB,KAAK,EAAE,IAAI,CAAA;IACX,mCAAmC;IACnC,MAAM,EAAE,IAAI,CAAA;CACb;AAuBD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY;;CAQvB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* api splitByPlane — 平面二分:把 solid 沿无限平面切成两半(手写中立 op,Phase 6.1)
|
|
3
3
|
*
|
|
4
4
|
* 中立 op:L1 `splitByPlane(shape, point, normal)` 在 occt 与 brepkit 两侧均有
|
|
5
5
|
* 真实现(occt-kernel/occt-primitives.ts / brepkit-kernel/brepkitKernel.ts)⇒
|
|
@@ -52,6 +52,7 @@ function splitByPlaneBrep(input, params) {
|
|
|
52
52
|
export const splitByPlane = defineOp({
|
|
53
53
|
capabilities: ['directEdit'],
|
|
54
54
|
outputs: ['positive', 'negative'],
|
|
55
|
+
paramDims: { 'params.point': 'length', 'params.normal': 'length' },
|
|
55
56
|
brep(input, params) {
|
|
56
57
|
return splitByPlaneBrep(input, params);
|
|
57
58
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-by-plane.js","sourceRoot":"","sources":["../../src/api/split-by-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG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CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACxC,CAAC;IACD,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAgB;CAC5C,CAAC,CAAA","sourcesContent":["/**\n * api splitByPlane — 平面二分:把 solid 沿无限平面切成两半(手写中立 op,Phase 6.1)\n *\n * 中立 op:L1 `splitByPlane(shape, point, normal)` 在 occt 与 brepkit 两侧均有\n * 真实现(occt-kernel/occt-primitives.ts / brepkit-kernel/brepkitKernel.ts)⇒\n * 走 `getBrepApi()`(D12),不声明 engines(实现只经 L1 契约面)。\n *\n * 产物形态(设计原则 5):两半不是数组,是具名 `outputs: ['positive','negative']`\n * ——法向正侧 = positive(L1 契约 §3.7 口径,occt 适配器按质心投影分类)。\n * 先例:occt 适配器的 splitByPlane 直接返回 `{positive, negative}`。\n */\n\nimport type { Shape } from '../mesh/types'\nimport type { BrepHandle, BrepVec3 } from '../brep/engine/types'\nimport { solidToShape } from '../brep/brep-ops'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { brepOf, fromBrep } from '../shape'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\n\ntype Vec3 = [number, number, number]\n\n/** `cad.splitByPlane` 参数。 */\nexport interface SplitByPlaneParams {\n /** 平面上一点(mm)。 */\n point: Vec3\n /** 平面法向(不必单位化;其正侧为 `positive`)。 */\n normal: Vec3\n}\n\n/** 元组 → BrepVec3 对象(GOTCHA:L1 向量形参是 {x,y,z} 对象,元组会被读成零向量)。 */\nfunction toVec3(v: Vec3): BrepVec3 {\n if (!Array.isArray(v) || v.length !== 3 || v.some((n) => typeof n !== 'number' || !Number.isFinite(n))) {\n throw new Error('E_SPLIT_BY_PLANE_BAD_VEC: point/normal must be [x,y,z] finite numbers')\n }\n return { x: v[0], y: v[1], z: v[2] }\n}\n\n/** BREP 路径:L1 splitByPlane → 两半各自收养。 */\nfunction splitByPlaneBrep(input: Shape, params: SplitByPlaneParams): Record<string, Shape> {\n const { point, normal } = params ?? ({} as SplitByPlaneParams)\n const kernel = getBrepApi()\n const solid = brepOf(input) as BrepHandle | undefined\n if (!solid) throw new Error('E_SPLIT_BY_PLANE_NO_BREP: splitByPlane input is not BREP')\n const halves = kernel.splitByPlane(solid, toVec3(point), toVec3(normal))\n return {\n positive: fromBrep(solidToShape(kernel, halves.positive), { solid: halves.positive }),\n negative: fromBrep(solidToShape(kernel, halves.negative), { solid: halves.negative }),\n }\n}\n\n/**\n * 沿无限平面把实体切成两半,返回法向正/负两半(具名产物)。\n * @group 特征\n * @inputs 1\n * @async true\n * @qual ok\n * @name splitByPlane\n * @note 中立 op:L1 splitByPlane 两引擎同实现。产物是具名两半\n * `{ positive, negative }`(不是数组);法向正侧 = positive。\n * @returns 具名产物 positive/negative。\n * @param input - 目标实体。type:Shape required:true\n * @param params.point - 平面上一点 [x,y,z](mm)。type:Vec3 required:true\n * @param params.normal - 平面法向 [x,y,z]。type:Vec3 required:true\n * @example\n * const { positive, negative } = await cad.splitByPlane(part0, { point: [0,0,5], normal: [0,0,1] })\n */\nexport const splitByPlane = defineOp({\n capabilities: ['directEdit'],\n outputs: ['positive', 'negative'],\n paramDims: { 'params.point': 'length', 'params.normal': 'length' },\n brep(input: Shape, params: SplitByPlaneParams) {\n return splitByPlaneBrep(input, params)\n },\n naming: { kind: 'subdivide' } as Provenance,\n})\n"]}
|
package/dist/api/split.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* api split — split(手写覆盖生成投影,Phase 3: L4 `splinter(#j)` 角色表)
|
|
3
3
|
*
|
|
4
4
|
* @platform occt — 平台 op:内核原生 `split`(BRepAlgoAPI_Splitter)是 occt-only
|
|
5
5
|
* (engine-method-map `split` → occt-only;L1 只有 `splitByPlane`)。本文件
|
package/dist/api/split.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* api split — split(手写覆盖生成投影,Phase 3: L4 `splinter(#j)` 角色表)
|
|
3
3
|
*
|
|
4
4
|
* @platform occt — 平台 op:内核原生 `split`(BRepAlgoAPI_Splitter)是 occt-only
|
|
5
5
|
* (engine-method-map `split` → occt-only;L1 只有 `splitByPlane`)。本文件
|
|
@@ -29,7 +29,7 @@ function splitBrep(input, tools) {
|
|
|
29
29
|
const occtKernel = getOcctKernel();
|
|
30
30
|
const inputSolid = brepOf(input);
|
|
31
31
|
if (!inputSolid)
|
|
32
|
-
throw new Error('[
|
|
32
|
+
throw new Error('[api/split] input is not BREP');
|
|
33
33
|
const toolSolids = tools
|
|
34
34
|
.map((t) => brepOf(t))
|
|
35
35
|
.filter((s) => !!s);
|
package/dist/api/split.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split.js","sourceRoot":"","sources":["../../src/api/split.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAIjC,OAAO,EAAE,aAAa,EAAoB,MAAM,2BAA2B,CAAA;AAE3E,0DAA0D;AAC1D,SAAS,SAAS,CAAC,KAAY,EAAE,KAAc;IAC7C,8BAA8B;IAC9B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAA;IAC3B,8BAA8B;IAC9B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAA2B,CAAA;IAC1D,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC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cG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC5B,IAAI,CAAC,KAAY,EAAE,KAAc;QAC/B,OAAO,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAChC,CAAC;IACD,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAgB;CAC5C,CAAC,CAAA","sourcesContent":["/**\n * api split — split(手写覆盖生成投影,Phase 3: L4 `splinter(#j)` 角色表)\n *\n * @platform occt — 平台 op:内核原生 `split`(BRepAlgoAPI_Splitter)是 occt-only\n * (engine-method-map `split` → occt-only;L1 只有 `splitByPlane`)。本文件\n * 只取 L1 面做枚举/命名(getBrepApi),切分本身走平台面 getOcctKernel()(D3),\n * defineOp 声明 `engines: ['occt']`(D11),不声明 capabilities(互斥)。\n *\n * 生成投影是 brep-only compatOp,不带角色表;本文件手写 defineOp,BREP 路径\n * 用内核原生 split(BRepAlgoAPI_Splitter)切分,存活面(hash 逐字不变)回投原\n * role,新造面(截面 + 被切细的侧面片)记 `splinter(#j)`,片序按质心排序保证跨\n * 重放稳定。\n *\n * 机制(无 splitWithHistory,纯 hash 比对 + 几何排序):`subdivide` 类零声明,\n * 新造面不对应任何输入面的因果坐标,故挂消费它的那条语句、用稳定的片序 `#j` 区分。\n */\n\nimport type { Shape } from '../mesh/types'\nimport { solidToShape } from '../brep/brep-ops'\nimport { getFaceHashes } from '../brep/face-evolution'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { getCurrentStmt } from '../runtime-state'\nimport { fromBrep, brepOf, inputRoleTable } from '../shape'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\nimport type { RoleTable } from '../topology/naming/types'\nimport type { BrepHandle } from '../brep/engine/types'\nimport { getOcctKernel, type ShapeHandle } from '../occt-kernel/occtKernel'\n\n/** BREP 路径:用 tools 切分 input,存活面回投、新造面记 `splinter(#j)`。 */\nfunction splitBrep(input: Shape, tools: Shape[]): Shape {\n // L1 面:枚举/命名(getBrepApi,D12)。\n const kernel = getBrepApi()\n // 平台面:原生 split(occt-only,D3)。\n const occtKernel = getOcctKernel()\n const inputSolid = brepOf(input) as BrepHandle | undefined\n if (!inputSolid) throw new Error('[api/split] input is not BREP')\n const toolSolids = tools\n .map((t) => brepOf(t) as BrepHandle | undefined)\n .filter((s): s is BrepHandle => !!s)\n if (toolSolids.length === 0) return input\n\n // Phase 1.6:origin = 本次语句 StmtId。\n const outStmt = String(getCurrentStmt()?.id ?? '')\n const inputTable = inputRoleTable(input) as RoleTable | undefined\n\n const inputHashes = getFaceHashes(kernel, inputSolid)\n const inputHashSet = new Set(inputHashes)\n const inputHashToRole = new Map<number, string>()\n if (inputTable) {\n for (const roles of inputTable.values()) {\n for (const [role, hashes] of roles) for (const h of hashes) inputHashToRole.set(h, role)\n }\n }\n\n // 内核原生 split(BRepAlgoAPI_Splitter)返回包含所有碎片的 compound。\n // BrepHandle(branded number)与 occt-wasm ShapeHandle(branded number)运行时同构,\n // 品牌转换只发生在平台边界(occt-only 原生面,非跨引擎断言)。\n const resultSolid = occtKernel.split(\n inputSolid as unknown as ShapeHandle,\n toolSolids as unknown as ShapeHandle[],\n )\n\n const resultHashes = getFaceHashes(kernel, resultSolid as unknown as BrepHandle)\n const resultFaces = kernel.getSubShapes(resultSolid as unknown as BrepHandle, 'face')\n const resultCentroids = resultFaces.map((f) => kernel.surfaceCenterOfMass(f))\n\n const roleTable = new Map<string, Map<string, number[]>>()\n const inner = new Map<string, number[]>()\n\n // 存活面(hash 逐字不变)→ 回投原 role;其余 = 新造面 → splinter(#j)\n const newFaces: { hash: number; c: { x: number; y: number; z: number } }[] = []\n for (let i = 0; i < resultHashes.length; i++) {\n const h = resultHashes[i]!\n if (inputHashSet.has(h)) {\n const role = inputHashToRole.get(h)\n if (role) {\n if (!inner.has(role)) inner.set(role, [])\n inner.get(role)!.push(h)\n }\n } else {\n newFaces.push({ hash: h, c: resultCentroids[i]! })\n }\n }\n // 按质心 (x,y,z) 排序保证片序跨重放稳定\n newFaces.sort((a, b) => a.c.x - b.c.x || a.c.y - b.c.y || a.c.z - b.c.z)\n for (let j = 0; j < newFaces.length; j++) {\n const role = `splinter(#${j})`\n inner.set(role, [newFaces[j].hash])\n }\n roleTable.set(outStmt, inner)\n\n return fromBrep(solidToShape(kernel, resultSolid as unknown as BrepHandle), {\n solid: resultSolid as unknown as BrepHandle,\n roleTable,\n })\n}\n\n/**\n * 用工具几何切分目标几何(BRepAlgoAPI_Splitter),返回所有碎片组成的几何。\n * @group 特征\n * @inputs 2\n * @async true\n * @qual ok\n * @name split\n * @note BREP-only:非 BREP 输入抛 E_MESH_UNSUPPORTED。切分产生的截面 / 被切细的侧面\n * 片记 `splinter(#j)`(Phase 3 L4 抗重放词汇)。平台 op:仅 occt 引擎(原生 split)。\n * @returns Shape 切分后的几何(compound of pieces)。\n * @param input - 目标几何。type:Shape required:true\n * @param tools - 切刀几何(数组)。type:Shape[] required:true\n * @example\n * const pieces = await cad.split(part0, [part1])\n */\nexport const split = defineOp({\n brep(input: Shape, tools: Shape[]) {\n return splitBrep(input, tools)\n },\n engines: ['occt'],\n naming: { kind: 'subdivide' } as Provenance,\n})\n"]}
|
package/dist/api/sweep.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* api sweep — 扫掠:截面沿脊柱路径生成扫掠体(手写平台 op,Phase 4 → G5 core 直连)
|
|
3
3
|
*
|
|
4
4
|
* @platform occt — 实现走 core 自有 `brep-mirror/sweepFns.ts#sweepBrep`
|
|
5
5
|
* (occt-wasm simplePipe / sweepPipeShell;engine-method-map 里 `sweep` 为
|
package/dist/api/sweep.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* api sweep — 扫掠:截面沿脊柱路径生成扫掠体(手写平台 op,Phase 4 → G5 core 直连)
|
|
3
3
|
*
|
|
4
4
|
* @platform occt — 实现走 core 自有 `brep-mirror/sweepFns.ts#sweepBrep`
|
|
5
5
|
* (occt-wasm simplePipe / sweepPipeShell;engine-method-map 里 `sweep` 为
|
package/dist/api/sweep.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sweep.js","sourceRoot":"","sources":["../../src/api/sweep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAevD,+DAA+D;AAC/D,SAAS,SAAS,CAAC,OAAc,EAAE,KAAY,EAAE,IAAmB;IAClE,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAA;IAC7F,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IACpF,iCAAiC;IACjC,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAC1C,MAAM,CAAC,GAAG,eAAe,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,KAAK,CAAC,CAAA;IACpE,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,OAAO,CAAe,CAAA;IAChD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAA;IAC3B,IAAI,CAAC;QACH,OAA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AAC,CAAC;YAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC5B,IAAI,EAAE,OAAO;IACb,IAAI,CAAC,OAAc,EAAE,KAAY,EAAE,IAAmB;QACpD,OAAO,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;IACxC,CAAC;IACD,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,wCAAwC,EAAgB;CAC9F,CAAC,CAAA","sourcesContent":["/**\n * api sweep — 扫掠:截面沿脊柱路径生成扫掠体(手写平台 op,Phase 4 → G5 core 直连)\n *\n * @platform occt — 实现走 core 自有 `brep-mirror/sweepFns.ts#sweepBrep`\n * (occt-wasm simplePipe / sweepPipeShell;engine-method-map 里 `sweep` 为\n * occt-only)⇒ 平台 op:defineOp 声明 `engines: ['occt']`(D11)。\n *\n * 为什么手写而不走生成投影:与 `api/loft.ts` 同因——截面最常见来源是\n * `cad.profile(...)`(产出 **face**),需「面 → 外环」输入适配\n * (`internal/profile-wire.ts` 的唯一步径)。脊柱容忍 face(FCStd 翻译把\n * 脊柱基对象 sketch 整圈外廓当路径)。\n *\n * core-decouple G5:vendored `sweep`(brepjs)替换为 brep-mirror 自有实现直连,\n * 产物经 `fromBrep` 收养(替代 l3-bridge adoptEntity)。\n */\n\nimport type { Shape } from '../mesh/types'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { fromBrep } from '../shape'\nimport { solidToShape } from '../brep/brep-ops'\nimport { sweepBrep as selfhostedSweep } from './brep-mirror/sweepFns'\nimport { toProfileWireView } from './internal/profile-wire'\nimport { unwrapResult } from './internal/result-unwrap'\nimport type { BrepHandle } from '../brep/engine/types'\n\n/** 扫掠配置(与 vendored SweepOptions 同形;本文件自持,去 brepjs 依赖)。 */\nexport interface SweepOptions {\n /** Frenet 参考系(默认 false)。 */\n frenet?: boolean\n /** 扫掠模式:'simple'(MakePipe)或 undefined(PipeShell)。 */\n mode?: 'simple'\n /** 过渡模式:仅支持默认 'right'(selfhost 后限制,见 sweepFns)。 */\n transitionMode?: string\n /** 公差等其余 vendored 字段(保留以兼容调用方)。 */\n tolerance?: number\n}\n\n/** BREP 路径:截面沿脊柱扫掠(wire 视图 → brep-mirror 直连 → fromBrep 收养)。 */\nfunction sweepBrep(profile: Shape, spine: Shape, opts?: SweepOptions): Shape {\n if (!profile) throw new Error('E_SWEEP_NO_PROFILE: sweep requires a profile (section) shape')\n if (!spine) throw new Error('E_SWEEP_NO_SPINE: sweep requires a spine (path) shape')\n // 截面 / 脊柱:wire 直用;面取外环(孔环不参与扫掠)。\n const profileWire = toProfileWireView(profile)\n const spineWire = toProfileWireView(spine)\n const r = selfhostedSweep(profileWire, spineWire, opts ?? {}, false)\n const h = unwrapResult(r, 'sweep') as BrepHandle\n const kernel = getBrepApi()\n try {\n return fromBrep(solidToShape(kernel, h), { solid: h })\n } finally {\n // 面→外环产出的 wire 是 arena 新句柄(曲线借用不 release)\n if (!profileWire.borrowed) {\n try { kernel.release(profileWire.wrapped) } catch { /* 已释放 */ }\n }\n if (!spineWire.borrowed) {\n try { kernel.release(spineWire.wrapped) } catch { /* 已释放 */ }\n }\n }\n}\n\n/**\n * 扫掠:截面沿脊柱路径生成扫掠体。\n * @group 特征\n * @inputs 2\n * @async true\n * @qual ok\n * @name sweep\n * @note 平台 op:仅 occt 引擎(BRepOffsetAPI_MakePipeShell / MakePipe)。截面接受\n * wire 或面(面取其外环);脊柱必须为 wire。非 occt 引擎执行前报错;\n * brep_mock 不拦截。`shellMode` 不暴露(元组产物跨不过单产物边界)。\n * @returns Shape 扫掠体。\n * @param profile - 截面几何(wire 或面;面取其外环)。type:Shape required:true\n * @param spine - 脊柱路径(wire)。type:Shape required:true\n * @param opts - 扫掠配置(frenet / mode / tolerance 等)。type:SweepOptions required:false\n * @example\n * const path = cad.wire([[0, 0, 0], [0, 0, 50]])\n * const section = cad.profile({ contours: [{ segments: [\n * { kind: 'line', x1: -4, y1: -4, x2: 4, y2: -4 },\n * { kind: 'line', x1: 4, y1: -4, x2: 4, y2: 4 },\n * { kind: 'line', x1: 4, y1: 4, x2: -4, y2: 4 },\n * { kind: 'line', x1: -4, y1: 4, x2: -4, y2: -4 },\n * ] }] })\n * const body = await cad.sweep(section, path)\n */\nexport const sweep = defineOp({\n name: 'sweep',\n brep(profile: Shape, spine: Shape, opts?: SweepOptions) {\n return sweepBrep(profile, spine, opts)\n },\n engines: ['occt'],\n naming: { kind: 'unmodeled', reason: 'swept-body face vocabulary not defined' } as Provenance,\n})\n"]}
|
package/dist/api/thicken.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* api thicken — 加厚:把面(或壳)沿法向偏置成等厚实体(手写平台 op,Phase 4 → G5 core 直连)
|
|
3
3
|
*
|
|
4
4
|
* @platform occt — 实现走 occt-wasm 原生 `thicken`(BRepOffsetAPI_MakeThickSolid;
|
|
5
5
|
* engine-method-map 里 `thicken` 为 occt-only)⇒ 平台 op:defineOp 声明
|
package/dist/api/thicken.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* api thicken — 加厚:把面(或壳)沿法向偏置成等厚实体(手写平台 op,Phase 4 → G5 core 直连)
|
|
3
3
|
*
|
|
4
4
|
* @platform occt — 实现走 occt-wasm 原生 `thicken`(BRepOffsetAPI_MakeThickSolid;
|
|
5
5
|
* engine-method-map 里 `thicken` 为 occt-only)⇒ 平台 op:defineOp 声明
|
package/dist/api/thicken.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thicken.js","sourceRo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M,CAAC;IACjB,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,4CAA4C,EAAgB;CAClG,CAAC,CAAA","sourcesContent":["/**\n * api thicken — 加厚:把面(或壳)沿法向偏置成等厚实体(手写平台 op,Phase 4 → G5 core 直连)\n *\n * @platform occt — 实现走 occt-wasm 原生 `thicken`(BRepOffsetAPI_MakeThickSolid;\n * engine-method-map 里 `thicken` 为 occt-only)⇒ 平台 op:defineOp 声明\n * `engines: ['occt']`(D11)。\n *\n * core-decouple G5:vendored `thicken`(brepjs modifierFns,thickenWithHistory)\n * 替换为 occt-wasm 原生直连,产物经 `fromBrep` 收养(替代 l3-bridge adoptEntity)。\n */\n\nimport type { Shape } from '../mesh/types'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { brepOf, fromBrep } from '../shape'\nimport { solidToShape } from '../brep/brep-ops'\nimport { getOcctKernel } from '../occt-kernel/occtKernel'\nimport type { BrepHandle } from '../brep/engine/types'\n\n/**\n * 加厚:把面(或壳)沿法向偏置成等厚实体。\n * @group 特征\n * @inputs 1\n * @async true\n * @qual ok\n * @name thicken\n * @note 平台 op:仅 occt 引擎(BRepOffset)。输入为面/壳 Shape(如 cad.profile 产物);\n * 正厚度沿法向、负厚度反向。非 occt 引擎执行前报错;brep_mock 不拦截。\n * @returns Shape 加厚后的实体。\n * @param input - 面/壳几何(cad.profile 产物等)。type:Shape required:true\n * @param thickness - 厚度(mm,≠0;正沿法向,负反向)。type:number required:true\n * @example\n * const face = cad.profile({ contours: [{ segments: [\n * { kind: 'line', x1: -10, y1: -10, x2: 10, y2: -10 },\n * { kind: 'line', x1: 10, y1: -10, x2: 10, y2: 10 },\n * { kind: 'line', x1: 10, y1: 10, x2: -10, y2: 10 },\n * { kind: 'line', x1: -10, y1: 10, x2: -10, y2: -10 },\n * ] }] })\n * const solid = await cad.thicken(face, 2)\n */\nexport const thicken = defineOp({\n name: 'thicken',\n brep(input: Shape, thickness: number) {\n if (!input) throw new Error('E_THICKEN_NO_SHAPE: thicken requires a face/shell shape')\n if (typeof thickness !== 'number' || !Number.isFinite(thickness) || thickness === 0) {\n throw new Error('E_THICKEN_BAD_THICKNESS: thicken.thickness must be a non-zero number')\n }\n const kernel = getBrepApi()\n const handle = brepOf(input) as BrepHandle | undefined\n if (!handle) throw new Error('[thicken] input is not BREP')\n const h = getOcctKernel().thicken(handle as never, thickness, 1e-6) as unknown as BrepHandle\n return fromBrep(solidToShape(kernel, h), { solid: h }) as Shape\n },\n engines: ['occt'],\n naming: { kind: 'unmodeled', reason: 'thickened-body face vocabulary not defined' } as Provenance,\n})\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 与 core/topology/naming 的分工:
|
|
5
5
|
* - naming(core)负责纯解析:给 ReactsContext + FaceTopoRef → ordinal/handle;
|
|
6
|
-
* - 本模块(
|
|
6
|
+
* - 本模块(api 层)是「活 Shape → React块(ResolutionContext)」的引擎胶水:
|
|
7
7
|
* 从 Shape 身份槽读出运行期数据(BREP 活句柄 + RoleTable,或 setTopology 注入的
|
|
8
8
|
* 面 hint 快照),并把解析结果还原成求解需要的几何(center/normal/surfaceType)。
|
|
9
9
|
*
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import type { Shape } from '../mesh/types.js';
|
|
16
16
|
import type { BrepEngineApi } from '../brep/engine/primitives.js';
|
|
17
17
|
import type { BrepHandle } from '../brep/engine/types.js';
|
|
18
|
+
import { type PartName, type StmtId } from '../identity.js';
|
|
18
19
|
import { type FaceTopoRef, type ResolutionContext, type AxisHint, type RoleTable } from '../topology/naming/index.js';
|
|
19
20
|
/** 求解面需要的当前几何(执行期派生):与旧契约 fixedFace/movingFace 的 surfaceType/center/normal 同形。 */
|
|
20
21
|
export interface ResolvedFaceGeometry {
|
|
@@ -24,6 +25,40 @@ export interface ResolvedFaceGeometry {
|
|
|
24
25
|
/** 圆柱/回转面的轴(装配轴约束用;平面/球面缺省,mesh 行快照由宿主注入)。 */
|
|
25
26
|
axis?: AxisHint;
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* 边路径「无血统邻面」恢复(1.10 前置③ 推广到边路径)。
|
|
30
|
+
*
|
|
31
|
+
* `edgeRef` 正查 `findOriginRole(table, ordinalToHash, fo)`(面 hash → `(origin, role)`)
|
|
32
|
+
* 失败,通常因为**目标 part** 的 roleTable 缓存**残缺**(丢了该面的条目),而**根节点**
|
|
33
|
+
* (名字的诞生处)的表是完整的:该面的 `(origin, role)` 真实存在,只是没被缓存到目标 part
|
|
34
|
+
* 的表副本里(drift / 中间 op 原样带走旧 hash 表)。
|
|
35
|
+
*
|
|
36
|
+
* 与面路径 `recomputeViaLineage` 同构、方向相反——已知面 hash、不知道它属于哪个
|
|
37
|
+
* `(origin, role)`。恢复策略:遍历血缘图所有候选 `(origin, role)`,沿 DAG 从根走到目标
|
|
38
|
+
* part,把根序(该 role 的 hash 集)推进到目标序、换算成目标 hash 集,取**含该面当前 hash**
|
|
39
|
+
* 者,即该面的真实身份。
|
|
40
|
+
*
|
|
41
|
+
* 推进规则(自带,不依赖 `resolveViaLineage` 的严格契约):
|
|
42
|
+
* - 中间节点有 ordinal 演化(Map)→ 照用;
|
|
43
|
+
* - 中间节点是 identity 类(copy/place/transform)但**未挂演化**(既有缺口,见
|
|
44
|
+
* `place.ts` 经 compat 路径未 `attachEvolution`)→ 按 1:1 推进(语义正确:identity 不改
|
|
45
|
+
* 面序);
|
|
46
|
+
* - 其余无演化 → 放弃该候选(不乱猜)。
|
|
47
|
+
*
|
|
48
|
+
* 命中即回填 `{origin, role}` 让 `resolveEdgeTopo` 继续(exact 或几何兜底);未命中返回
|
|
49
|
+
* undefined,调用方保持原 `no role lineage` 报错——零回归。仅跑在 `findOriginRole` 失败
|
|
50
|
+
* 之后(错误路径),不进热路径。
|
|
51
|
+
*
|
|
52
|
+
* @param kernel - the OCCT kernel (hash 换算需要).
|
|
53
|
+
* @param part - the live part whose adjacent face we are recovering.
|
|
54
|
+
* @param faceOrdinal - the 1-based face ordinal whose role is missing.
|
|
55
|
+
* @param ordinalToHash - the part's current face ordinal → hash array.
|
|
56
|
+
* @returns the recovered `{origin, role}`, or undefined when no lineage walk matches.
|
|
57
|
+
*/
|
|
58
|
+
export declare function recoverEdgeFaceRole(kernel: BrepEngineApi, part: PartName, faceOrdinal: number, ordinalToHash: readonly number[]): {
|
|
59
|
+
origin: StmtId;
|
|
60
|
+
role: string;
|
|
61
|
+
} | undefined;
|
|
27
62
|
/**
|
|
28
63
|
* 从活 Shape 的组装槽构建 ResolutionContext(BREAK 或 mesh/primitive 两条路)。
|
|
29
64
|
*
|
|
@@ -54,6 +89,44 @@ export declare function buildShapeResolutionContext(kernel: BrepEngineApi | null
|
|
|
54
89
|
* no BREP naming slot.
|
|
55
90
|
*/
|
|
56
91
|
export declare function buildEdgeResolutionContext(kernel: BrepEngineApi, shape: object | undefined): ResolutionContext | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* 为**网格实体**构建带边候选的 ResolutionContext(近似拓扑的边解析入口)。
|
|
94
|
+
*
|
|
95
|
+
* 与 `buildEdgeResolutionContext` 的差别只有两点,两点都是"网格零件没有 role 层"
|
|
96
|
+
* 的直接后果:
|
|
97
|
+
* 1. 句柄来自 `slot.meshSolid`(网格实体句柄)而不是 `slot.solid`(BREP 句柄);
|
|
98
|
+
* 2. **刻意不给 `faceEdgeAdjacency` / `edgeFaceAdjacency`**。
|
|
99
|
+
*
|
|
100
|
+
* 第 2 点是有意的,不是省事:邻接表存在的意义是"两面之交 = 一条边",
|
|
101
|
+
* 而 `EdgeTopoRef.faces` 是两个 **RoleQualifier**——网格零件没有 role
|
|
102
|
+
* (Phase 1.8:primitive/mesh 行 origin/role 显式为 null),限定符只是占位。
|
|
103
|
+
* 带上邻接表反而会让 `resolveEdgeTopo` 走进"按角色取公共边"的分支并必然 not-found;
|
|
104
|
+
* 不带它,解析就走「无 role 层 → 整个边表的纯几何匹配」(resolve-edge.ts 明写)。
|
|
105
|
+
* 边身份只能几何,这是如实的能力边界。
|
|
106
|
+
*
|
|
107
|
+
* @param kernel - the mesh backend's L1 kernel (live edge handles come from it).
|
|
108
|
+
* @param shape - the live mesh-solid shape whose naming slot is read.
|
|
109
|
+
* @returns the edge-enabled resolution context, or undefined when the shape is not a mesh solid.
|
|
110
|
+
*/
|
|
111
|
+
export declare function buildMeshEdgeResolutionContext(kernel: BrepEngineApi, shape: object | undefined): ResolutionContext | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* 为**网格实体**构建面解析上下文(`sketchOnFace` 的网格链入口)。
|
|
114
|
+
*
|
|
115
|
+
* 面候选直接来自 `slot.meshSolid` 的 `getSubShapes(solid,'face')` 现场句柄——
|
|
116
|
+
* 与 `buildMeshEdgeResolutionContext` 的面表同源(同一枚举序)。**刻意不给
|
|
117
|
+
* `roleTable` / 邻接**:网格零件没有 role 层(Phase 1.8),带上 roleTable 只会让
|
|
118
|
+
* `resolveFaceTopo` 走进 exact 分支并必然落空;不带它,解析就走「全形状按 hint
|
|
119
|
+
* 几何打分」(resolve-face.ts 步骤 2),命中即 `geometric-fallback`。
|
|
120
|
+
*
|
|
121
|
+
* 也因此,网格链上的面只能用**几何**识别(法向 / 中心 / 面积)——这是如实的能力
|
|
122
|
+
* 边界,不是省事:同尺寸的两个平行面(如立方体的顶面与底面)在几何上无法区分,
|
|
123
|
+
* 调用方应改用序号。
|
|
124
|
+
*
|
|
125
|
+
* @param kernel - the mesh backend's L1 kernel (live face handles come from it).
|
|
126
|
+
* @param shape - the live mesh-solid shape whose naming slot is read.
|
|
127
|
+
* @returns the face resolution context, or undefined when the shape is not a mesh solid.
|
|
128
|
+
*/
|
|
129
|
+
export declare function buildMeshFaceResolutionContext(kernel: BrepEngineApi, shape: object | undefined): ResolutionContext | undefined;
|
|
57
130
|
/**
|
|
58
131
|
* 从 BREP 现场句柄建带边候选/邻接的 ResolutionContext(twoDistances 逐边重建用)。
|
|
59
132
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-resolve.d.ts","sourceRoot":"","sources":["../../src/api/topo-resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAG1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"topo-resolve.d.ts","sourceRoot":"","sources":["../../src/api/topo-resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAG1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAItD,OAAO,EAAY,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,iBAAiB,EAEtB,KAAK,QAAQ,EAEb,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAA;AAE3B,kFAAkF;AAClF,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,8CAA8C;IAC9C,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB;AA2CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,SA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