@faicad/faijs 0.19.0 → 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/brep-mirror/joinery-brep.d.ts.map +1 -1
- package/dist/api/brep-mirror/joinery-brep.js +3 -1
- package/dist/api/brep-mirror/joinery-brep.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/generated/script-face-manifest.d.ts +4 -0
- package/dist/api/generated/script-face-manifest.d.ts.map +1 -1
- package/dist/api/generated/script-face-manifest.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.d.ts.map +1 -1
- package/dist/api/knurl.js +3 -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 +5 -4
- package/dist/api/primitives.d.ts.map +1 -1
- package/dist/api/primitives.js +11 -5
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/profile.d.ts +64 -8
- package/dist/api/profile.d.ts.map +1 -1
- package/dist/api/profile.js +61 -10
- package/dist/api/profile.js.map +1 -1
- package/dist/api/punch-hole.d.ts +3 -0
- package/dist/api/punch-hole.d.ts.map +1 -1
- package/dist/api/punch-hole.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 +17 -9
- package/dist/api/sketch-on-plane.d.ts.map +1 -1
- package/dist/api/sketch-on-plane.js +12 -10
- 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/surface/arg-spec.d.ts +8 -0
- package/dist/api/surface/arg-spec.d.ts.map +1 -1
- package/dist/api/surface/arg-spec.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 +10 -6
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +74 -21
- 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/api/xml-dom.d.ts +27 -0
- package/dist/api/xml-dom.d.ts.map +1 -0
- package/dist/api/xml-dom.js +45 -0
- package/dist/api/xml-dom.js.map +1 -0
- package/dist/brep/brep-ops.d.ts +13 -11
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +31 -30
- 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 +9 -6
- 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 +79 -0
- package/dist/brep/export/export-model.d.ts.map +1 -0
- package/dist/brep/export/export-model.js +336 -0
- package/dist/brep/export/export-model.js.map +1 -0
- 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/primitives-brep.d.ts.map +1 -1
- package/dist/brep/primitives-brep.js +3 -1
- package/dist/brep/primitives-brep.js.map +1 -1
- 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 +453 -125
- 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 +19 -3
- package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
- package/dist/cad-runtime/direct-executor.js +49 -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 +66 -8
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +121 -8
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +37 -1
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +25 -1
- package/dist/define-op.js.map +1 -1
- package/dist/env-agnostic.d.ts +7 -7
- package/dist/env-agnostic.d.ts.map +1 -1
- package/dist/env-agnostic.js +3 -3
- 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 +71 -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/geometry2d/pen-sketcher.d.ts +25 -0
- package/dist/geometry2d/pen-sketcher.d.ts.map +1 -1
- package/dist/geometry2d/pen-sketcher.js +43 -0
- package/dist/geometry2d/pen-sketcher.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 +30 -4
- package/dist/lang/code-to-args.d.ts.map +1 -1
- package/dist/lang/code-to-args.js +42 -3
- package/dist/lang/code-to-args.js.map +1 -1
- package/dist/lang/codegen.d.ts +45 -1
- package/dist/lang/codegen.d.ts.map +1 -1
- package/dist/lang/codegen.js +135 -6
- package/dist/lang/codegen.js.map +1 -1
- package/dist/lang/host-arg.d.ts +6 -0
- package/dist/lang/host-arg.d.ts.map +1 -1
- package/dist/lang/host-arg.js.map +1 -1
- package/dist/lang/metadata-extractor.d.ts +25 -0
- package/dist/lang/metadata-extractor.d.ts.map +1 -1
- package/dist/lang/metadata-extractor.js +289 -25
- package/dist/lang/metadata-extractor.js.map +1 -1
- package/dist/lang/parse-error.d.ts +7 -1
- package/dist/lang/parse-error.d.ts.map +1 -1
- package/dist/lang/parse-error.js.map +1 -1
- package/dist/lang/security-scanner.d.ts +9 -1
- package/dist/lang/security-scanner.d.ts.map +1 -1
- package/dist/lang/security-scanner.js +38 -1
- package/dist/lang/security-scanner.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 +69 -9
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +121 -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 +50 -0
- package/dist/mesh/threemf-loader.d.ts.map +1 -0
- package/dist/mesh/threemf-loader.js +628 -0
- package/dist/mesh/threemf-loader.js.map +1 -0
- 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/mesh/transform.d.ts +2 -2
- package/dist/mesh/transform.d.ts.map +1 -1
- package/dist/mesh/transform.js +3 -3
- package/dist/mesh/transform.js.map +1 -1
- package/dist/mesh/types.d.ts +1 -1
- package/dist/mesh/types.d.ts.map +1 -1
- package/dist/mesh/types.js.map +1 -1
- 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 +127 -50
- 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 +20 -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 +8 -6
- 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 +103 -9
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +95 -2
- package/dist/runtime-state.js.map +1 -1
- package/dist/sdk.d.ts +4 -4
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +6 -6
- 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/tolerance.d.ts +38 -0
- package/dist/tolerance.d.ts.map +1 -0
- package/dist/tolerance.js +40 -0
- package/dist/tolerance.js.map +1 -0
- 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/topology/naming/score.js +3 -3
- package/dist/topology/naming/score.js.map +1 -1
- package/dist/units.d.ts +248 -0
- package/dist/units.d.ts.map +1 -0
- package/dist/units.js +397 -0
- package/dist/units.js.map +1 -0
- 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 +28 -3
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cadquery-selectors/borrow-bridge — compatOp 提升边界归一(等价搬运自 cq-compat)
|
|
3
|
+
*
|
|
4
|
+
* 原实现位于 `packages/faijs-cadquery/src/workplane.ts` 的 `asBrepShape`,本文件为
|
|
5
|
+
* 原样搬运(仅 import 路径改为 core 内部相对路径),零逻辑改动。
|
|
6
|
+
*/
|
|
7
|
+
import { fromHandle } from '../../sdk.js';
|
|
8
|
+
import { isShape } from '../../shape.js';
|
|
9
|
+
// ── compatOp 提升边界归一(GOTCHA:borrowDeep 把实参 Shape 换成借用视图)──
|
|
10
|
+
//
|
|
11
|
+
// 当 cq-compat 命名空间被 registerLib 提升(无 dual-op → autoLift=true)时,
|
|
12
|
+
// 每个裸导出函数的实参先经 borrowDeep:faijs Shape → 借用 brepjs 视图
|
|
13
|
+
// `{ wrapped, disposed, delete, onDispose }`(`isShape=false`、`brepOf=undefined`)。
|
|
14
|
+
// 直接调用(测试进程内)拿到的则是真实 Shape。两个形态都必须能消费:
|
|
15
|
+
//
|
|
16
|
+
// asBrepShape(v) —
|
|
17
|
+
// - 真实 Shape → 原样返回;
|
|
18
|
+
// - 借用视图(有 `.wrapped`)→ 提取原始 OCCT 句柄,fromHandle 还原为真实
|
|
19
|
+
// Shape(mesh 三角化 + BREP 身份槽登记,brepOf 可恢复),按视图对象缓存
|
|
20
|
+
// (同句柄多次调用不重复三角化);
|
|
21
|
+
// - 其余 → 原样返回(调用方自行判空/报错)。
|
|
22
|
+
//
|
|
23
|
+
// 所有权:归一出的新 Shape 与原 part Shape 的 slot 指向同一 OCCT 句柄,但 slot
|
|
24
|
+
// 按 Shape 对象各自持有(fromBrep 写的是新 Shape 的 slot),无共享释放路径——
|
|
25
|
+
// 与 core fromHandle 收编模式同构,不引入双重释放。
|
|
26
|
+
// 视图 `.wrapped` 是 OcctWasmHandle 对象({ id, type, __occtWasm }),内核只收
|
|
27
|
+
// 数字 id → 解包方式与 core fromHandle 一致。
|
|
28
|
+
const borrowedShapeCache = new WeakMap();
|
|
29
|
+
/**
|
|
30
|
+
* 把可能是借用视图的几何输入归一为真实 faijs Shape(见上方注释)。
|
|
31
|
+
* @param v 真实 Shape、借用视图(`{ wrapped }`)或其他原样透传的输入。
|
|
32
|
+
* @returns 真实 faijs `Shape`(借用视图经 `fromHandle` 还原并缓存)。
|
|
33
|
+
*/
|
|
34
|
+
export function asBrepShape(v) {
|
|
35
|
+
if (isShape(v))
|
|
36
|
+
return v;
|
|
37
|
+
if (v !== null && typeof v === 'object' && 'wrapped' in v) {
|
|
38
|
+
const view = v;
|
|
39
|
+
const hit = borrowedShapeCache.get(view);
|
|
40
|
+
if (hit)
|
|
41
|
+
return hit;
|
|
42
|
+
const wrappedAny = view.wrapped;
|
|
43
|
+
const handle = typeof wrappedAny === 'object' && wrappedAny !== null && 'id' in wrappedAny
|
|
44
|
+
? wrappedAny.id
|
|
45
|
+
: wrappedAny;
|
|
46
|
+
const s = fromHandle(handle);
|
|
47
|
+
borrowedShapeCache.set(view, s);
|
|
48
|
+
return s;
|
|
49
|
+
}
|
|
50
|
+
return v;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=borrow-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"borrow-bridge.js","sourceRoot":"","sources":["../../../src/api/cadquery-selectors/borrow-bridge.ts"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/borrow-bridge — compatOp 提升边界归一(等价搬运自 cq-compat)\n *\n * 原实现位于 `packages/faijs-cadquery/src/workplane.ts` 的 `asBrepShape`,本文件为\n * 原样搬运(仅 import 路径改为 core 内部相对路径),零逻辑改动。\n */\n\nimport { fromHandle } from '../../sdk'\nimport { isShape } from '../../shape'\nimport type { Shape } from '../../mesh/types'\n\n// ── compatOp 提升边界归一(GOTCHA:borrowDeep 把实参 Shape 换成借用视图)──\n//\n// 当 cq-compat 命名空间被 registerLib 提升(无 dual-op → autoLift=true)时,\n// 每个裸导出函数的实参先经 borrowDeep:faijs Shape → 借用 brepjs 视图\n// `{ wrapped, disposed, delete, onDispose }`(`isShape=false`、`brepOf=undefined`)。\n// 直接调用(测试进程内)拿到的则是真实 Shape。两个形态都必须能消费:\n//\n// asBrepShape(v) —\n// - 真实 Shape → 原样返回;\n// - 借用视图(有 `.wrapped`)→ 提取原始 OCCT 句柄,fromHandle 还原为真实\n// Shape(mesh 三角化 + BREP 身份槽登记,brepOf 可恢复),按视图对象缓存\n// (同句柄多次调用不重复三角化);\n// - 其余 → 原样返回(调用方自行判空/报错)。\n//\n// 所有权:归一出的新 Shape 与原 part Shape 的 slot 指向同一 OCCT 句柄,但 slot\n// 按 Shape 对象各自持有(fromBrep 写的是新 Shape 的 slot),无共享释放路径——\n// 与 core fromHandle 收编模式同构,不引入双重释放。\n// 视图 `.wrapped` 是 OcctWasmHandle 对象({ id, type, __occtWasm }),内核只收\n// 数字 id → 解包方式与 core fromHandle 一致。\nconst borrowedShapeCache = new WeakMap<object, Shape>()\n\n/**\n * 把可能是借用视图的几何输入归一为真实 faijs Shape(见上方注释)。\n * @param v 真实 Shape、借用视图(`{ wrapped }`)或其他原样透传的输入。\n * @returns 真实 faijs `Shape`(借用视图经 `fromHandle` 还原并缓存)。\n */\nexport function asBrepShape(v: unknown): Shape {\n if (isShape(v)) return v as Shape\n if (v !== null && typeof v === 'object' && 'wrapped' in v) {\n const view = v as { wrapped: unknown }\n const hit = borrowedShapeCache.get(view)\n if (hit) return hit\n const wrappedAny = view.wrapped\n const handle =\n typeof wrappedAny === 'object' && wrappedAny !== null && 'id' in wrappedAny\n ? (wrappedAny as { id: number }).id\n : wrappedAny\n const s = fromHandle(handle) as Shape\n borrowedShapeCache.set(view, s)\n return s\n }\n return v as Shape\n}"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Shape } from '../../mesh/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a CadQuery EDGE selector string to concrete edge handles, using ONLY
|
|
4
|
+
* the new selector engine (upstream `selectors.py` semantics):
|
|
5
|
+
*
|
|
6
|
+
* · `|Z` — ParallelDirSelector (edges whose tangent is parallel to the axis)
|
|
7
|
+
* · `#Z` — PerpendicularDirSelector (edges whose tangent is perpendicular)
|
|
8
|
+
* · `X` / `+X` / `-X` — DirectionSelector (signed tangent angle≈0)
|
|
9
|
+
* · `>Z` / `<Z` — DirectionMinMaxSelector (extremal edge center along axis)
|
|
10
|
+
* · `%LINE` / `%CIRCLE` — TypeSelector
|
|
11
|
+
* · `and` / `or` / `except` / `not` — set algebra
|
|
12
|
+
* · empty / missing — all edges (CadQuery `.edges()`)
|
|
13
|
+
*
|
|
14
|
+
* @param shape - Shape whose BREP edges are enumerated for selection.
|
|
15
|
+
* @param sel - CadQuery edge selector, or empty/null/undefined for all edges.
|
|
16
|
+
* @returns the matched edge handles (kernel identity space; cast to unknown).
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveEdgeSelection(shape: Shape, sel: string | null | undefined): unknown[];
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the edges belonging to the face picked by `sel` — upstream
|
|
21
|
+
* `.faces(">Z").edges()` semantics. The face selector runs first over the
|
|
22
|
+
* face candidate set, then the survivors' edges are collected (chain widening
|
|
23
|
+
* to edges, no filter): the selected face's own edges.
|
|
24
|
+
*
|
|
25
|
+
* @param shape - the shape whose BREP faces/edges are enumerated.
|
|
26
|
+
* @param sel - a face direction / type selector (">Z", "+Y", "%PLANE", etc.).
|
|
27
|
+
* @returns the handles of the edges belonging to the selected face(s).
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveFaceEdgeSelection(shape: Shape, sel: string): unknown[];
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a CadQuery vertex selector string to vertex handles (upstream `.vertices()`).
|
|
32
|
+
* Mirrors the narrowing semantics of the engine: direction-less selectors drop,
|
|
33
|
+
* cluster-based (`>`, `<`, `>>`, `<<`, `(x,y,z)`) apply.
|
|
34
|
+
*
|
|
35
|
+
* @param shape - the shape whose BREP vertices are enumerated.
|
|
36
|
+
* @param sel - the vertex selector string, or empty/undefined for all vertices.
|
|
37
|
+
* @returns the matched vertex handles.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveVertexSelection(shape: Shape, sel: string | null | undefined): unknown[];
|
|
40
|
+
//# sourceMappingURL=edge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../../src/api/cadquery-selectors/edge.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAO7C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,EAAE,CAG5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAM7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,EAAE,CAE9F"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cadquery-selectors/edge — CadQuery edge/vertex 选择器(hoild core 引擎 adapter)
|
|
3
|
+
*
|
|
4
|
+
* These are thin projections over the selector engine (plan §4.6). The heavy
|
|
5
|
+
* lifting (direction rules, Nth clustering, set algebra, type filtering) lives
|
|
6
|
+
* in `resolve.ts`; this file only bridges a faijs `Shape` into the engine's
|
|
7
|
+
* kernel-handle space and adapts the result back to the cq-compat-consumed
|
|
8
|
+
* `unknown[]` handle form.
|
|
9
|
+
*
|
|
10
|
+
* The legacy bbox-heuristic implementations (edn.g. `#Z` interpreted as "max
|
|
11
|
+
* along axis", `|Z` from relative extents) were removed in favour of the
|
|
12
|
+
* upstream `cadquery/selectors.py` semantics validated by
|
|
13
|
+
* `selectors.test.ts`.
|
|
14
|
+
*/
|
|
15
|
+
import { resolveSelection, resolveStepHandles } from './resolve.js';
|
|
16
|
+
import { brepOf } from '../../shape.js';
|
|
17
|
+
/** faijs BREP handle for a shape (numeric id space shared with occt-wasm). */
|
|
18
|
+
function ownerHandle(shape) {
|
|
19
|
+
return brepOf(shape);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a CadQuery EDGE selector string to concrete edge handles, using ONLY
|
|
23
|
+
* the new selector engine (upstream `selectors.py` semantics):
|
|
24
|
+
*
|
|
25
|
+
* · `|Z` — ParallelDirSelector (edges whose tangent is parallel to the axis)
|
|
26
|
+
* · `#Z` — PerpendicularDirSelector (edges whose tangent is perpendicular)
|
|
27
|
+
* · `X` / `+X` / `-X` — DirectionSelector (signed tangent angle≈0)
|
|
28
|
+
* · `>Z` / `<Z` — DirectionMinMaxSelector (extremal edge center along axis)
|
|
29
|
+
* · `%LINE` / `%CIRCLE` — TypeSelector
|
|
30
|
+
* · `and` / `or` / `except` / `not` — set algebra
|
|
31
|
+
* · empty / missing — all edges (CadQuery `.edges()`)
|
|
32
|
+
*
|
|
33
|
+
* @param shape - Shape whose BREP edges are enumerated for selection.
|
|
34
|
+
* @param sel - CadQuery edge selector, or empty/null/undefined for all edges.
|
|
35
|
+
* @returns the matched edge handles (kernel identity space; cast to unknown).
|
|
36
|
+
*/
|
|
37
|
+
export function resolveEdgeSelection(shape, sel) {
|
|
38
|
+
const selStr = sel ?? '';
|
|
39
|
+
return resolveStepHandles(ownerHandle(shape), 'edge', selStr);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve the edges belonging to the face picked by `sel` — upstream
|
|
43
|
+
* `.faces(">Z").edges()` semantics. The face selector runs first over the
|
|
44
|
+
* face candidate set, then the survivors' edges are collected (chain widening
|
|
45
|
+
* to edges, no filter): the selected face's own edges.
|
|
46
|
+
*
|
|
47
|
+
* @param shape - the shape whose BREP faces/edges are enumerated.
|
|
48
|
+
* @param sel - a face direction / type selector (">Z", "+Y", "%PLANE", etc.).
|
|
49
|
+
* @returns the handles of the edges belonging to the selected face(s).
|
|
50
|
+
*/
|
|
51
|
+
export function resolveFaceEdgeSelection(shape, sel) {
|
|
52
|
+
const owner = ownerHandle(shape);
|
|
53
|
+
return resolveSelection(owner, [
|
|
54
|
+
{ kind: 'face', sel },
|
|
55
|
+
{ kind: 'edge', sel: '' },
|
|
56
|
+
]).handles;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolve a CadQuery vertex selector string to vertex handles (upstream `.vertices()`).
|
|
60
|
+
* Mirrors the narrowing semantics of the engine: direction-less selectors drop,
|
|
61
|
+
* cluster-based (`>`, `<`, `>>`, `<<`, `(x,y,z)`) apply.
|
|
62
|
+
*
|
|
63
|
+
* @param shape - the shape whose BREP vertices are enumerated.
|
|
64
|
+
* @param sel - the vertex selector string, or empty/undefined for all vertices.
|
|
65
|
+
* @returns the matched vertex handles.
|
|
66
|
+
*/
|
|
67
|
+
export function resolveVertexSelection(shape, sel) {
|
|
68
|
+
return resolveStepHandles(ownerHandle(shape), 'vertex', sel ?? '');
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=edge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.js","sourceRoot":"","sources":["../../../src/api/cadquery-selectors/edge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,8EAA8E;AAC9E,SAAS,WAAW,CAAC,KAAY;IAC/B,OAAO,MAAM,CAAC,KAAK,CAAY,CAAA;AACjC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAY,EAAE,GAA8B;IAC/E,MAAM,MAAM,GAAG,GAAG,IAAI,EAAE,CAAA;IACxB,OAAO,kBAAkB,CAAC,WAAW,CAAC,KAAK,CAAU,EAAE,MAAM,EAAE,MAAM,CAAc,CAAA;AACrF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAY,EAAE,GAAW;IAChE,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAU,CAAA;IACzC,OAAO,gBAAgB,CAAC,KAAK,EAAE;QAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;QACrB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE;KAC1B,CAAC,CAAC,OAAoB,CAAA;AACzB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAY,EAAE,GAA8B;IACjF,OAAO,kBAAkB,CAAC,WAAW,CAAC,KAAK,CAAU,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAc,CAAA;AAC1F,CAAC","sourcesContent":["/**\n * cadquery-selectors/edge — CadQuery edge/vertex 选择器(hoild core 引擎 adapter)\n *\n * These are thin projections over the selector engine (plan §4.6). The heavy\n * lifting (direction rules, Nth clustering, set algebra, type filtering) lives\n * in `resolve.ts`; this file only bridges a faijs `Shape` into the engine's\n * kernel-handle space and adapts the result back to the cq-compat-consumed\n * `unknown[]` handle form.\n *\n * The legacy bbox-heuristic implementations (edn.g. `#Z` interpreted as \"max\n * along axis\", `|Z` from relative extents) were removed in favour of the\n * upstream `cadquery/selectors.py` semantics validated by\n * `selectors.test.ts`.\n */\nimport { resolveSelection, resolveStepHandles } from './resolve'\nimport { brepOf } from '../../shape'\nimport type { Shape } from '../../mesh/types'\n\n/** faijs BREP handle for a shape (numeric id space shared with occt-wasm). */\nfunction ownerHandle(shape: Shape): unknown {\n return brepOf(shape) as unknown\n}\n\n/**\n * Resolve a CadQuery EDGE selector string to concrete edge handles, using ONLY\n * the new selector engine (upstream `selectors.py` semantics):\n *\n * · `|Z` — ParallelDirSelector (edges whose tangent is parallel to the axis)\n * · `#Z` — PerpendicularDirSelector (edges whose tangent is perpendicular)\n * · `X` / `+X` / `-X` — DirectionSelector (signed tangent angle≈0)\n * · `>Z` / `<Z` — DirectionMinMaxSelector (extremal edge center along axis)\n * · `%LINE` / `%CIRCLE` — TypeSelector\n * · `and` / `or` / `except` / `not` — set algebra\n * · empty / missing — all edges (CadQuery `.edges()`)\n *\n * @param shape - Shape whose BREP edges are enumerated for selection.\n * @param sel - CadQuery edge selector, or empty/null/undefined for all edges.\n * @returns the matched edge handles (kernel identity space; cast to unknown).\n */\nexport function resolveEdgeSelection(shape: Shape, sel: string | null | undefined): unknown[] {\n const selStr = sel ?? ''\n return resolveStepHandles(ownerHandle(shape) as never, 'edge', selStr) as unknown[]\n}\n\n/**\n * Resolve the edges belonging to the face picked by `sel` — upstream\n * `.faces(\">Z\").edges()` semantics. The face selector runs first over the\n * face candidate set, then the survivors' edges are collected (chain widening\n * to edges, no filter): the selected face's own edges.\n *\n * @param shape - the shape whose BREP faces/edges are enumerated.\n * @param sel - a face direction / type selector (\">Z\", \"+Y\", \"%PLANE\", etc.).\n * @returns the handles of the edges belonging to the selected face(s).\n */\nexport function resolveFaceEdgeSelection(shape: Shape, sel: string): unknown[] {\n const owner = ownerHandle(shape) as never\n return resolveSelection(owner, [\n { kind: 'face', sel },\n { kind: 'edge', sel: '' },\n ]).handles as unknown[]\n}\n\n/**\n * Resolve a CadQuery vertex selector string to vertex handles (upstream `.vertices()`).\n * Mirrors the narrowing semantics of the engine: direction-less selectors drop,\n * cluster-based (`>`, `<`, `>>`, `<<`, `(x,y,z)`) apply.\n *\n * @param shape - the shape whose BREP vertices are enumerated.\n * @param sel - the vertex selector string, or empty/undefined for all vertices.\n * @returns the matched vertex handles.\n */\nexport function resolveVertexSelection(shape: Shape, sel: string | null | undefined): unknown[] {\n return resolveStepHandles(ownerHandle(shape) as never, 'vertex', sel ?? '') as unknown[]\n}"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cadquery-selectors/entity — projection of kernel handles into the geometric
|
|
3
|
+
* quantities the selector predicates need.
|
|
4
|
+
*
|
|
5
|
+
* Each helper mirrors the CadQuery shape method it stands in for (plan §4.3):
|
|
6
|
+
* · `Vertex.Center()` → vertex position
|
|
7
|
+
* · `Edge.Center()` → linear centre of mass (LinearProperties centroid)
|
|
8
|
+
* · `Face.Center()` → surface centre of mass (SurfaceProperties centroid)
|
|
9
|
+
* · `Face.normalAt(None)` → parametric surface normal at the uv midpoint,
|
|
10
|
+
* oriented outward via `containsPoint` on the owner
|
|
11
|
+
* · `Edge.tangentAt()` → curve tangent at the parameter midpoint,
|
|
12
|
+
* oriented along the edge parameter direction
|
|
13
|
+
* · `Face/Edge.geomType()` → kernel surface/curve kind mapped to the CadQuery
|
|
14
|
+
* geom_LUT uppercased names
|
|
15
|
+
*
|
|
16
|
+
* These are deliberately decoupled from any single entity type so the
|
|
17
|
+
* predicates (predicates.ts) and the narrowing engine (resolve.ts) stay
|
|
18
|
+
* type-agnostic. All quantities are computed lazily by the caller via the
|
|
19
|
+
* projection object below.
|
|
20
|
+
*
|
|
21
|
+
* @platform occt — the projection resolves occt-wasm `ShapeHandle`s via the
|
|
22
|
+
* native kernel (`getKernel()`: getSubShapes / hashCode / isSame / bounds /
|
|
23
|
+
* surface & curve queries), so this module is occt-coupled by nature.
|
|
24
|
+
*/
|
|
25
|
+
import type { OcctKernel, ShapeHandle } from 'occt-wasm';
|
|
26
|
+
/** Resolve the kernel geometry-kind → CadQuery LUT upcased name. */
|
|
27
|
+
export interface GeomKindMap {
|
|
28
|
+
surface: Record<string, string>;
|
|
29
|
+
curve: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Map a kernel surface-kind string to the CadQuery `geomType()` name.
|
|
33
|
+
*
|
|
34
|
+
* @param kind - The kernel surface kind (e.g. `plane`, `cylinder`, `torus`).
|
|
35
|
+
* @returns The uppercased CadQuery geometry name, or `OTHER` when unmapped.
|
|
36
|
+
*/
|
|
37
|
+
export declare function faceGeomType(kind: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Map a kernel curve-kind string to the CadQuery `geomType()` name.
|
|
40
|
+
*
|
|
41
|
+
* @param kind - The kernel curve kind (e.g. `line`, `circle`, `bspline`).
|
|
42
|
+
* @returns The uppercased CadQuery geometry name, or `OTHER` when unmapped.
|
|
43
|
+
*/
|
|
44
|
+
export declare function edgeGeomType(kind: string): string;
|
|
45
|
+
/** World-space cartesian coordinates of an entity center point. */
|
|
46
|
+
export interface EntityCenter {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
z: number;
|
|
50
|
+
}
|
|
51
|
+
/** Plain 3-D vector in faijs' internal convention. */
|
|
52
|
+
export type P3 = {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
z: number;
|
|
56
|
+
};
|
|
57
|
+
export type { ShapeHandle };
|
|
58
|
+
/**
|
|
59
|
+
* The lazily-evaluable geometry of one candidate entity. Predicates only access
|
|
60
|
+
* the fields they need so the heavy computation (surface normal, etc.) is only
|
|
61
|
+
* paid for when a direction/parallel filter is actually applied.
|
|
62
|
+
*/
|
|
63
|
+
export interface EntityGeom {
|
|
64
|
+
kind: 'face' | 'edge' | 'vertex';
|
|
65
|
+
/** Internal kernel handle for identity comparison (not part of the public surface). */
|
|
66
|
+
_handle: ShapeHandle;
|
|
67
|
+
/** Kernel handle box-identity hash (stable key across narrowing). */
|
|
68
|
+
hash(): number;
|
|
69
|
+
/** Kernel handle `isSame(...)` equality predicate. */
|
|
70
|
+
same(other: EntityGeom): boolean;
|
|
71
|
+
/** CadQuery `Shape.Center()` for this entity kind. */
|
|
72
|
+
center(): P3;
|
|
73
|
+
/**
|
|
74
|
+
* The direction used by direction-motivated selectors: the outward normal for
|
|
75
|
+
* a face (requires the owning shape for orientation) or the mid-parameter
|
|
76
|
+
* tangent for an edge. Null for vertices (no usable direction, upstream
|
|
77
|
+
* `BaseSelector` drops them).
|
|
78
|
+
*/
|
|
79
|
+
direction(owner: ShapeHandle): P3 | null;
|
|
80
|
+
/** Face/Edge geometry type (upcased LUT name), or undefined for vertices. */
|
|
81
|
+
geomType(): string | undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Project a face handle into its `EntityGeom`.
|
|
85
|
+
*
|
|
86
|
+
* @param face - The kernel face handle to project.
|
|
87
|
+
* @returns The lazily-evaluable face geometry (normal oriented on demand).
|
|
88
|
+
*/
|
|
89
|
+
export declare function faceGeom(face: ShapeHandle): EntityGeom;
|
|
90
|
+
/**
|
|
91
|
+
* Orient a parametric face normal outward: offset probe → inside ⇒ flip.
|
|
92
|
+
*
|
|
93
|
+
* @param k - The active kernel instance used for surface/containment queries.
|
|
94
|
+
* @param face - The kernel face handle whose normal is oriented.
|
|
95
|
+
* @param owner - The owning shape handle used for the containment probe.
|
|
96
|
+
* @returns The outward-facing unit normal of `face`.
|
|
97
|
+
*/
|
|
98
|
+
export declare function orientedFaceNormal(k: OcctKernel, face: ShapeHandle, owner: ShapeHandle): P3;
|
|
99
|
+
/**
|
|
100
|
+
* Project an edge handle into its `EntityGeom`.
|
|
101
|
+
*
|
|
102
|
+
* @param edge - The kernel edge handle to project.
|
|
103
|
+
* @returns The lazily-evaluable edge geometry (mid-parameter tangent).
|
|
104
|
+
*/
|
|
105
|
+
export declare function edgeGeom(edge: ShapeHandle): EntityGeom;
|
|
106
|
+
/**
|
|
107
|
+
* Project a vertex handle into its `EntityGeom`.
|
|
108
|
+
*
|
|
109
|
+
* @param vertex - The kernel vertex handle to project.
|
|
110
|
+
* @returns The lazily-evaluable vertex geometry (no direction / type).
|
|
111
|
+
*/
|
|
112
|
+
export declare function vertexGeom(vertex: ShapeHandle): EntityGeom;
|
|
113
|
+
/**
|
|
114
|
+
* Get the sub-entity handles of the given topological type from a shape.
|
|
115
|
+
*
|
|
116
|
+
* @param shape - The kernel handle to query.
|
|
117
|
+
* @param type - The topological type to enumerate.
|
|
118
|
+
* @returns The ordered kernel sub-shape handles of that type.
|
|
119
|
+
*/
|
|
120
|
+
export declare function subShapeHandles(shape: ShapeHandle, type: 'face' | 'edge' | 'vertex'): ShapeHandle[];
|
|
121
|
+
//# sourceMappingURL=entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/api/cadquery-selectors/entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAQ,MAAM,WAAW,CAAA;AAE9D,oEAAoE;AACpE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B;AA2BD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM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|
3
|
+
* quantities the selector predicates need.
|
|
4
|
+
*
|
|
5
|
+
* Each helper mirrors the CadQuery shape method it stands in for (plan §4.3):
|
|
6
|
+
* · `Vertex.Center()` → vertex position
|
|
7
|
+
* · `Edge.Center()` → linear centre of mass (LinearProperties centroid)
|
|
8
|
+
* · `Face.Center()` → surface centre of mass (SurfaceProperties centroid)
|
|
9
|
+
* · `Face.normalAt(None)` → parametric surface normal at the uv midpoint,
|
|
10
|
+
* oriented outward via `containsPoint` on the owner
|
|
11
|
+
* · `Edge.tangentAt()` → curve tangent at the parameter midpoint,
|
|
12
|
+
* oriented along the edge parameter direction
|
|
13
|
+
* · `Face/Edge.geomType()` → kernel surface/curve kind mapped to the CadQuery
|
|
14
|
+
* geom_LUT uppercased names
|
|
15
|
+
*
|
|
16
|
+
* These are deliberately decoupled from any single entity type so the
|
|
17
|
+
* predicates (predicates.ts) and the narrowing engine (resolve.ts) stay
|
|
18
|
+
* type-agnostic. All quantities are computed lazily by the caller via the
|
|
19
|
+
* projection object below.
|
|
20
|
+
*
|
|
21
|
+
* @platform occt — the projection resolves occt-wasm `ShapeHandle`s via the
|
|
22
|
+
* native kernel (`getKernel()`: getSubShapes / hashCode / isSame / bounds /
|
|
23
|
+
* surface & curve queries), so this module is occt-coupled by nature.
|
|
24
|
+
*/
|
|
25
|
+
import { getKernel } from '../../occt-kernel/occtKernel.js';
|
|
26
|
+
const NAMED_GEOM = {
|
|
27
|
+
surface: {
|
|
28
|
+
plane: 'PLANE',
|
|
29
|
+
cylinder: 'CYLINDER',
|
|
30
|
+
cone: 'CONE',
|
|
31
|
+
sphere: 'SPHERE',
|
|
32
|
+
torus: 'TORUS',
|
|
33
|
+
bspline: 'BSPLINE',
|
|
34
|
+
bezier: 'BEZIER',
|
|
35
|
+
offset: 'OFFSET',
|
|
36
|
+
revolution: 'REVOLUTION',
|
|
37
|
+
extrusion: 'EXTRUSION',
|
|
38
|
+
},
|
|
39
|
+
curve: {
|
|
40
|
+
line: 'LINE',
|
|
41
|
+
circle: 'CIRCLE',
|
|
42
|
+
ellipse: 'ELLIPSE',
|
|
43
|
+
hyperbola: 'HYPERBOLA',
|
|
44
|
+
parabola: 'PARABOLA',
|
|
45
|
+
bspline: 'BSPLINE',
|
|
46
|
+
bezier: 'BEZIER',
|
|
47
|
+
offset: 'OFFSET',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Map a kernel surface-kind string to the CadQuery `geomType()` name.
|
|
52
|
+
*
|
|
53
|
+
* @param kind - The kernel surface kind (e.g. `plane`, `cylinder`, `torus`).
|
|
54
|
+
* @returns The uppercased CadQuery geometry name, or `OTHER` when unmapped.
|
|
55
|
+
*/
|
|
56
|
+
export function faceGeomType(kind) {
|
|
57
|
+
return NAMED_GEOM.surface[kind] ?? 'OTHER';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Map a kernel curve-kind string to the CadQuery `geomType()` name.
|
|
61
|
+
*
|
|
62
|
+
* @param kind - The kernel curve kind (e.g. `line`, `circle`, `bspline`).
|
|
63
|
+
* @returns The uppercased CadQuery geometry name, or `OTHER` when unmapped.
|
|
64
|
+
*/
|
|
65
|
+
export function edgeGeomType(kind) {
|
|
66
|
+
return NAMED_GEOM.curve[kind] ?? 'OTHER';
|
|
67
|
+
}
|
|
68
|
+
function v(v) {
|
|
69
|
+
return { x: v.x, y: v.y, z: v.z };
|
|
70
|
+
}
|
|
71
|
+
const kern = () => getKernel();
|
|
72
|
+
/**
|
|
73
|
+
* Project a face handle into its `EntityGeom`.
|
|
74
|
+
*
|
|
75
|
+
* @param face - The kernel face handle to project.
|
|
76
|
+
* @returns The lazily-evaluable face geometry (normal oriented on demand).
|
|
77
|
+
*/
|
|
78
|
+
export function faceGeom(face) {
|
|
79
|
+
const k = kern();
|
|
80
|
+
return {
|
|
81
|
+
kind: 'face',
|
|
82
|
+
_handle: face,
|
|
83
|
+
hash: () => k.hashCode(face, 1e9),
|
|
84
|
+
same: (other) => k.isSame(face, other._handle),
|
|
85
|
+
center: () => v(k.getSurfaceCenterOfMass(face)),
|
|
86
|
+
direction: (owner) => orientedFaceNormal(k, face, owner),
|
|
87
|
+
geomType: () => faceGeomType(k.surfaceType(face)),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Orient a parametric face normal outward: offset probe → inside ⇒ flip.
|
|
92
|
+
*
|
|
93
|
+
* @param k - The active kernel instance used for surface/containment queries.
|
|
94
|
+
* @param face - The kernel face handle whose normal is oriented.
|
|
95
|
+
* @param owner - The owning shape handle used for the containment probe.
|
|
96
|
+
* @returns The outward-facing unit normal of `face`.
|
|
97
|
+
*/
|
|
98
|
+
export function orientedFaceNormal(k, face, owner) {
|
|
99
|
+
const uv = k.uvBounds(face);
|
|
100
|
+
const u = (uv.uMin + uv.uMax) / 2;
|
|
101
|
+
const vv = (uv.vMin + uv.vMax) / 2;
|
|
102
|
+
const n = k.surfaceNormal(face, u, vv);
|
|
103
|
+
const db = k.getBoundingBox(face);
|
|
104
|
+
const ext = [db.xmax - db.xmin, db.ymax - db.ymin, db.zmax - db.zmin];
|
|
105
|
+
const minExt = Math.min(...ext, 1);
|
|
106
|
+
const eps = minExt * 1e-3 + 1e-6;
|
|
107
|
+
const center = k.pointOnSurface(face, u, vv);
|
|
108
|
+
const probe = { x: center.x + n.x * eps, y: center.y + n.y * eps, z: center.z + n.z * eps };
|
|
109
|
+
// inside owner ⇒ the candidate normal points inward, so flip it.
|
|
110
|
+
if (k.containsPoint(owner, probe, 1e-9)) {
|
|
111
|
+
return { x: -n.x, y: -n.y, z: -n.z };
|
|
112
|
+
}
|
|
113
|
+
return v(n);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Project an edge handle into its `EntityGeom`.
|
|
117
|
+
*
|
|
118
|
+
* @param edge - The kernel edge handle to project.
|
|
119
|
+
* @returns The lazily-evaluable edge geometry (mid-parameter tangent).
|
|
120
|
+
*/
|
|
121
|
+
export function edgeGeom(edge) {
|
|
122
|
+
const k = kern();
|
|
123
|
+
const midParams = () => {
|
|
124
|
+
const cp = k.curveParameters(edge);
|
|
125
|
+
return (cp.first + cp.last) / 2;
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
kind: 'edge',
|
|
129
|
+
_handle: edge,
|
|
130
|
+
hash: () => k.hashCode(edge, 1e9),
|
|
131
|
+
same: (other) => k.isSame(edge, other._handle),
|
|
132
|
+
center: () => v(k.curvePointAtParam(edge, midParams())),
|
|
133
|
+
direction: () => v(k.curveTangent(edge, midParams())),
|
|
134
|
+
geomType: () => edgeGeomType(k.curveType(edge)),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Project a vertex handle into its `EntityGeom`.
|
|
139
|
+
*
|
|
140
|
+
* @param vertex - The kernel vertex handle to project.
|
|
141
|
+
* @returns The lazily-evaluable vertex geometry (no direction / type).
|
|
142
|
+
*/
|
|
143
|
+
export function vertexGeom(vertex) {
|
|
144
|
+
const k = kern();
|
|
145
|
+
const p = k.vertexPosition(vertex);
|
|
146
|
+
return {
|
|
147
|
+
kind: 'vertex',
|
|
148
|
+
_handle: vertex,
|
|
149
|
+
hash: () => k.hashCode(vertex, 1e9),
|
|
150
|
+
same: (other) => k.isSame(vertex, other._handle),
|
|
151
|
+
center: () => v(p),
|
|
152
|
+
direction: () => null,
|
|
153
|
+
geomType: () => undefined,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get the sub-entity handles of the given topological type from a shape.
|
|
158
|
+
*
|
|
159
|
+
* @param shape - The kernel handle to query.
|
|
160
|
+
* @param type - The topological type to enumerate.
|
|
161
|
+
* @returns The ordered kernel sub-shape handles of that type.
|
|
162
|
+
*/
|
|
163
|
+
export function subShapeHandles(shape, type) {
|
|
164
|
+
const k = kern();
|
|
165
|
+
return k.getSubShapes(shape, type);
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=entity.js.map
|
|
@@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;IAChB,OAAO,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAkB,CAAA;AACrD,CAAC","sourcesContent":["/**\n * cadquery-selectors/entity — projection of kernel handles into the geometric\n * quantities the selector predicates need.\n *\n * Each helper mirrors the CadQuery shape method it stands in for (plan §4.3):\n * · `Vertex.Center()` → vertex position\n * · `Edge.Center()` → linear centre of mass (LinearProperties centroid)\n * · `Face.Center()` → surface centre of mass (SurfaceProperties centroid)\n * · `Face.normalAt(None)` → parametric surface normal at the uv midpoint,\n * oriented outward via `containsPoint` on the owner\n * · `Edge.tangentAt()` → curve tangent at the parameter midpoint,\n * oriented along the edge parameter direction\n * · `Face/Edge.geomType()` → kernel surface/curve kind mapped to the CadQuery\n * geom_LUT uppercased names\n *\n * These are deliberately decoupled from any single entity type so the\n * predicates (predicates.ts) and the narrowing engine (resolve.ts) stay\n * type-agnostic. All quantities are computed lazily by the caller via the\n * projection object below.\n *\n * @platform occt — the projection resolves occt-wasm `ShapeHandle`s via the\n * native kernel (`getKernel()`: getSubShapes / hashCode / isSame / bounds /\n * surface & curve queries), so this module is occt-coupled by nature.\n */\n\nimport { getKernel } from '../../occt-kernel/occtKernel'\nimport type { OcctKernel, ShapeHandle, Vec3 } from 'occt-wasm'\n\n/** Resolve the kernel geometry-kind → CadQuery LUT upcased name. */\nexport interface GeomKindMap {\n surface: Record<string, string>\n curve: Record<string, string>\n}\n\nconst NAMED_GEOM: { surface: Record<string, string>; curve: Record<string, string> } = {\n surface: {\n plane: 'PLANE',\n cylinder: 'CYLINDER',\n cone: 'CONE',\n sphere: 'SPHERE',\n torus: 'TORUS',\n bspline: 'BSPLINE',\n bezier: 'BEZIER',\n offset: 'OFFSET',\n revolution: 'REVOLUTION',\n extrusion: 'EXTRUSION',\n },\n curve: {\n line: 'LINE',\n circle: 'CIRCLE',\n ellipse: 'ELLIPSE',\n hyperbola: 'HYPERBOLA',\n parabola: 'PARABOLA',\n bspline: 'BSPLINE',\n bezier: 'BEZIER',\n offset: 'OFFSET',\n },\n}\n\n/**\n * Map a kernel surface-kind string to the CadQuery `geomType()` name.\n *\n * @param kind - The kernel surface kind (e.g. `plane`, `cylinder`, `torus`).\n * @returns The uppercased CadQuery geometry name, or `OTHER` when unmapped.\n */\nexport function faceGeomType(kind: string): string {\n return NAMED_GEOM.surface[kind] ?? 'OTHER'\n}\n\n/**\n * Map a kernel curve-kind string to the CadQuery `geomType()` name.\n *\n * @param kind - The kernel curve kind (e.g. `line`, `circle`, `bspline`).\n * @returns The uppercased CadQuery geometry name, or `OTHER` when unmapped.\n */\nexport function edgeGeomType(kind: string): string {\n return NAMED_GEOM.curve[kind] ?? 'OTHER'\n}\n\n/** World-space cartesian coordinates of an entity center point. */\nexport interface EntityCenter {\n x: number\n y: number\n z: number\n}\n\n/** Plain 3-D vector in faijs' internal convention. */\nexport type P3 = { x: number; y: number; z: number }\n\nexport type { ShapeHandle }\n\nfunction v(v: Vec3 | P3): P3 {\n return { x: v.x, y: v.y, z: v.z }\n}\n\n/**\n * The lazily-evaluable geometry of one candidate entity. Predicates only access\n * the fields they need so the heavy computation (surface normal, etc.) is only\n * paid for when a direction/parallel filter is actually applied.\n */\nexport interface EntityGeom {\n kind: 'face' | 'edge' | 'vertex'\n /** Internal kernel handle for identity comparison (not part of the public surface). */\n _handle: ShapeHandle\n /** Kernel handle box-identity hash (stable key across narrowing). */\n hash(): number\n /** Kernel handle `isSame(...)` equality predicate. */\n same(other: EntityGeom): boolean\n /** CadQuery `Shape.Center()` for this entity kind. */\n center(): P3\n /**\n * The direction used by direction-motivated selectors: the outward normal for\n * a face (requires the owning shape for orientation) or the mid-parameter\n * tangent for an edge. Null for vertices (no usable direction, upstream\n * `BaseSelector` drops them).\n */\n direction(owner: ShapeHandle): P3 | null\n /** Face/Edge geometry type (upcased LUT name), or undefined for vertices. */\n geomType(): string | undefined\n}\n\nconst kern = (): OcctKernel => getKernel() as unknown as OcctKernel\n\n/**\n * Project a face handle into its `EntityGeom`.\n *\n * @param face - The kernel face handle to project.\n * @returns The lazily-evaluable face geometry (normal oriented on demand).\n */\nexport function faceGeom(face: ShapeHandle): EntityGeom {\n const k = kern()\n return {\n kind: 'face',\n _handle: face,\n hash: () => k.hashCode(face, 1e9),\n same: (other: EntityGeom) => k.isSame(face, other._handle),\n center: () => v(k.getSurfaceCenterOfMass(face)),\n direction: (owner: ShapeHandle) => orientedFaceNormal(k, face, owner),\n geomType: () => faceGeomType(k.surfaceType(face)),\n }\n}\n\n/**\n * Orient a parametric face normal outward: offset probe → inside ⇒ flip.\n *\n * @param k - The active kernel instance used for surface/containment queries.\n * @param face - The kernel face handle whose normal is oriented.\n * @param owner - The owning shape handle used for the containment probe.\n * @returns The outward-facing unit normal of `face`.\n */\nexport function orientedFaceNormal(\n k: OcctKernel,\n face: ShapeHandle,\n owner: ShapeHandle,\n): P3 {\n const uv = k.uvBounds(face)\n const u = (uv.uMin + uv.uMax) / 2\n const vv = (uv.vMin + uv.vMax) / 2\n const n = k.surfaceNormal(face, u, vv)\n const db = k.getBoundingBox(face)\n const ext = [db.xmax - db.xmin, db.ymax - db.ymin, db.zmax - db.zmin]\n const minExt = Math.min(...ext, 1)\n const eps = minExt * 1e-3 + 1e-6\n const center = k.pointOnSurface(face, u, vv)\n const probe = { x: center.x + n.x * eps, y: center.y + n.y * eps, z: center.z + n.z * eps }\n // inside owner ⇒ the candidate normal points inward, so flip it.\n if (k.containsPoint(owner, probe, 1e-9)) {\n return { x: -n.x, y: -n.y, z: -n.z }\n }\n return v(n)\n}\n\n/**\n * Project an edge handle into its `EntityGeom`.\n *\n * @param edge - The kernel edge handle to project.\n * @returns The lazily-evaluable edge geometry (mid-parameter tangent).\n */\nexport function edgeGeom(edge: ShapeHandle): EntityGeom {\n const k = kern()\n const midParams = () => {\n const cp = k.curveParameters(edge)\n return (cp.first + cp.last) / 2\n }\n return {\n kind: 'edge',\n _handle: edge,\n hash: () => k.hashCode(edge, 1e9),\n same: (other: EntityGeom) => k.isSame(edge, other._handle),\n center: () => v(k.curvePointAtParam(edge, midParams())),\n direction: () => v(k.curveTangent(edge, midParams())),\n geomType: () => edgeGeomType(k.curveType(edge)),\n }\n}\n\n/**\n * Project a vertex handle into its `EntityGeom`.\n *\n * @param vertex - The kernel vertex handle to project.\n * @returns The lazily-evaluable vertex geometry (no direction / type).\n */\nexport function vertexGeom(vertex: ShapeHandle): EntityGeom {\n const k = kern()\n const p = k.vertexPosition(vertex)\n return {\n kind: 'vertex',\n _handle: vertex,\n hash: () => k.hashCode(vertex, 1e9),\n same: (other: EntityGeom) => k.isSame(vertex, other._handle),\n center: () => v(p),\n direction: () => null,\n geomType: () => undefined,\n }\n}\n\n/**\n * Get the sub-entity handles of the given topological type from a shape.\n *\n * @param shape - The kernel handle to query.\n * @param type - The topological type to enumerate.\n * @returns The ordered kernel sub-shape handles of that type.\n */\nexport function subShapeHandles(shape: ShapeHandle, type: 'face' | 'edge' | 'vertex'): ShapeHandle[] {\n const k = kern()\n return k.getSubShapes(shape, type) as ShapeHandle[]\n}"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cadquery-selectors/face — CadQuery face 字符串选择器
|
|
3
|
+
*
|
|
4
|
+
* 等价搬运自 `packages/faijs-cadquery/src/workplane.ts` 的 `resolveFaceSelector`
|
|
5
|
+
* (含其私有 `NAMED_VIEW_TO_AXIS`、`bboxMax`/`bboxMin`、`cad` 单例)。仅 import
|
|
6
|
+
* 路径改为 core 内部相对路径,逻辑逐行不变,零功能增减。
|
|
7
|
+
*
|
|
8
|
+
* @platform occt — face 选择对 BREP 面做枚举/比较,经 `getKernel()` 与
|
|
9
|
+
* `getBrepApi()` 访问 occt 原生内核(getSubShapes / surface 查询等)。
|
|
10
|
+
*/
|
|
11
|
+
import type { Shape } from '../../mesh/types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a CadQuery-style face selector string to the selected face's center
|
|
14
|
+
* point and outward normal.
|
|
15
|
+
*
|
|
16
|
+
* Supported forms: ">Z", "<Z", ">X", "<X", ">Y", "<Y", each with an optional
|
|
17
|
+
* CadQuery-style index suffix like ">Z[-2]", plus the six named views
|
|
18
|
+
* ("front"/"back"/"left"/"right"/"top"/"bottom") which are aliases for the
|
|
19
|
+
* corresponding axis selectors per cadquery/selectors.py:687-694.
|
|
20
|
+
* @param shape - Shape whose BREP faces are enumerated for selection.
|
|
21
|
+
* @param sel - Selector string, e.g. ">Z", "front", ">Z[-2]".
|
|
22
|
+
* @param centerOption - Optional center computation option forwarded to the
|
|
23
|
+
* face-center evaluation.
|
|
24
|
+
* @returns Promise resolving to the selected face's center point and outward
|
|
25
|
+
* normal.
|
|
26
|
+
* @throws Error when the selector matches no face or has unknown syntax
|
|
27
|
+
* (never falls back silently).
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveFaceSelector(shape: Shape, sel: string, centerOption?: string): Promise<{
|
|
30
|
+
center: [number, number, number];
|
|
31
|
+
normal: [number, number, number];
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=face.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../../../src/api/cadquery-selectors/face.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAuE7C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC;IAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CAsQjF"}
|