@faicad/faijs 0.30.9 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/align/index.d.ts +64 -0
- package/dist/api/align/index.d.ts.map +1 -0
- package/dist/api/align/index.js +101 -0
- package/dist/api/align/index.js.map +1 -0
- package/dist/api/api-namespace.d.ts +5 -4
- package/dist/api/api-namespace.d.ts.map +1 -1
- package/dist/api/api-namespace.js +36 -4
- package/dist/api/api-namespace.js.map +1 -1
- package/dist/api/boolean-op/index.d.ts +65 -0
- package/dist/api/boolean-op/index.d.ts.map +1 -0
- package/dist/api/boolean-op/index.js +113 -0
- package/dist/api/boolean-op/index.js.map +1 -0
- package/dist/api/boolean.d.ts.map +1 -1
- package/dist/api/boolean.js +15 -27
- package/dist/api/boolean.js.map +1 -1
- package/dist/api/brep-operations/healingFns.d.ts +13 -0
- package/dist/api/brep-operations/healingFns.d.ts.map +1 -1
- package/dist/api/brep-operations/healingFns.js +28 -1
- package/dist/api/brep-operations/healingFns.js.map +1 -1
- package/dist/api/brep-operations/topologyFns.d.ts +27 -6
- package/dist/api/brep-operations/topologyFns.d.ts.map +1 -1
- package/dist/api/brep-operations/topologyFns.js +46 -22
- package/dist/api/brep-operations/topologyFns.js.map +1 -1
- package/dist/api/chamfer.d.ts +5 -4
- package/dist/api/chamfer.d.ts.map +1 -1
- package/dist/api/chamfer.js +12 -11
- package/dist/api/chamfer.js.map +1 -1
- package/dist/api/curve-sketch/index.d.ts.map +1 -1
- package/dist/api/curve-sketch/index.js +9 -3
- package/dist/api/curve-sketch/index.js.map +1 -1
- package/dist/api/draft.d.ts.map +1 -1
- package/dist/api/draft.js +1 -3
- package/dist/api/draft.js.map +1 -1
- package/dist/api/engrave.d.ts.map +1 -1
- package/dist/api/engrave.js +3 -13
- package/dist/api/engrave.js.map +1 -1
- package/dist/api/export-3mf.d.ts +73 -0
- package/dist/api/export-3mf.d.ts.map +1 -0
- package/dist/api/export-3mf.js +121 -0
- package/dist/api/export-3mf.js.map +1 -0
- package/dist/api/export-brep.d.ts +6 -0
- package/dist/api/export-brep.d.ts.map +1 -1
- package/dist/api/export-brep.js +11 -2
- package/dist/api/export-brep.js.map +1 -1
- package/dist/api/export-step.d.ts +67 -0
- package/dist/api/export-step.d.ts.map +1 -0
- package/dist/api/export-step.js +98 -0
- package/dist/api/export-step.js.map +1 -0
- package/dist/api/export-stl.d.ts +8 -0
- package/dist/api/export-stl.d.ts.map +1 -1
- package/dist/api/export-stl.js +23 -8
- package/dist/api/export-stl.js.map +1 -1
- package/dist/api/feature-repair.d.ts +1 -1
- package/dist/api/feature-repair.d.ts.map +1 -1
- package/dist/api/feature-repair.js +1 -7
- package/dist/api/feature-repair.js.map +1 -1
- package/dist/api/fillet-variable.d.ts.map +1 -1
- package/dist/api/fillet-variable.js +0 -1
- package/dist/api/fillet-variable.js.map +1 -1
- package/dist/api/fillet.d.ts +3 -3
- package/dist/api/fillet.d.ts.map +1 -1
- package/dist/api/fillet.js +3 -4
- package/dist/api/fillet.js.map +1 -1
- package/dist/api/generated/operations.js +6 -6
- package/dist/api/generated/operations.js.map +1 -1
- package/dist/api/generated/script-face-manifest.d.ts +1 -1
- package/dist/api/generated/script-face-manifest.js +3 -3
- package/dist/api/generated/script-face-manifest.js.map +1 -1
- package/dist/api/generated/script-face.d.ts +1 -1
- package/dist/api/generated/script-face.js +1 -1
- package/dist/api/generated/script-face.js.map +1 -1
- package/dist/api/generated/sketching.js +1 -1
- package/dist/api/generated/sketching.js.map +1 -1
- package/dist/api/generated/topology.js +10 -10
- package/dist/api/generated/topology.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/index.d.ts +4 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +16 -4
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/compat-op.d.ts +6 -6
- package/dist/api/internal/compat-op.d.ts.map +1 -1
- package/dist/api/internal/compat-op.js +7 -9
- package/dist/api/internal/compat-op.js.map +1 -1
- package/dist/api/internal/export-members.d.ts +80 -0
- package/dist/api/internal/export-members.d.ts.map +1 -0
- package/dist/api/internal/export-members.js +104 -0
- package/dist/api/internal/export-members.js.map +1 -0
- package/dist/api/internal/l3-bridge.d.ts +17 -0
- package/dist/api/internal/l3-bridge.d.ts.map +1 -1
- package/dist/api/internal/l3-bridge.js +23 -1
- package/dist/api/internal/l3-bridge.js.map +1 -1
- package/dist/api/measure-query/index.d.ts +262 -0
- package/dist/api/measure-query/index.d.ts.map +1 -0
- package/dist/api/measure-query/index.js +390 -0
- package/dist/api/measure-query/index.js.map +1 -0
- package/dist/api/pattern.d.ts.map +1 -1
- package/dist/api/pattern.js +0 -3
- package/dist/api/pattern.js.map +1 -1
- package/dist/api/primitives.d.ts +6 -6
- package/dist/api/primitives.d.ts.map +1 -1
- package/dist/api/primitives.js +12 -11
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/profile.d.ts.map +1 -1
- package/dist/api/profile.js +0 -1
- package/dist/api/profile.js.map +1 -1
- package/dist/api/punch-hole.d.ts.map +1 -1
- package/dist/api/punch-hole.js +0 -1
- package/dist/api/punch-hole.js.map +1 -1
- package/dist/api/replicate.d.ts +5 -7
- package/dist/api/replicate.d.ts.map +1 -1
- package/dist/api/replicate.js +18 -56
- package/dist/api/replicate.js.map +1 -1
- package/dist/api/section-by-plane.d.ts.map +1 -1
- package/dist/api/section-by-plane.js +0 -1
- package/dist/api/section-by-plane.js.map +1 -1
- package/dist/api/shell.d.ts +1 -1
- package/dist/api/shell.d.ts.map +1 -1
- package/dist/api/shell.js +11 -2
- package/dist/api/shell.js.map +1 -1
- package/dist/api/sketch-on-face.d.ts +3 -3
- package/dist/api/sketch-on-face.d.ts.map +1 -1
- package/dist/api/sketch-on-face.js +6 -4
- package/dist/api/sketch-on-face.js.map +1 -1
- package/dist/api/sketch-on-plane.d.ts.map +1 -1
- package/dist/api/sketch-on-plane.js +0 -1
- package/dist/api/sketch-on-plane.js.map +1 -1
- package/dist/api/split-by-plane.d.ts.map +1 -1
- package/dist/api/split-by-plane.js +0 -1
- package/dist/api/split-by-plane.js.map +1 -1
- package/dist/api/split.d.ts +1 -1
- package/dist/api/split.js +1 -1
- package/dist/api/split.js.map +1 -1
- package/dist/api/surface/arg-spec.d.ts +3 -12
- package/dist/api/surface/arg-spec.d.ts.map +1 -1
- package/dist/api/surface/arg-spec.js +19 -26
- package/dist/api/surface/arg-spec.js.map +1 -1
- package/dist/api/sweep.d.ts +15 -3
- package/dist/api/sweep.d.ts.map +1 -1
- package/dist/api/sweep.js +5 -3
- package/dist/api/sweep.js.map +1 -1
- package/dist/api/thicken.d.ts.map +1 -1
- package/dist/api/thicken.js +11 -2
- package/dist/api/thicken.js.map +1 -1
- package/dist/api/transform.d.ts +3 -3
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +47 -17
- package/dist/api/transform.js.map +1 -1
- package/dist/boolean/index.d.ts +23 -0
- package/dist/boolean/index.d.ts.map +1 -0
- package/dist/boolean/index.js +27 -0
- package/dist/boolean/index.js.map +1 -0
- package/dist/brep/brep-chain.d.ts +1 -19
- package/dist/brep/brep-chain.d.ts.map +1 -1
- package/dist/brep/brep-chain.js +0 -1
- package/dist/brep/brep-chain.js.map +1 -1
- package/dist/brep/brep-ops.d.ts +4 -1
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +9 -5
- package/dist/brep/brep-ops.js.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.js +0 -3
- package/dist/brep/engine/adapters/brep-mock.js.map +1 -1
- package/dist/brep/engine/adapters/brepkit.d.ts +4 -3
- package/dist/brep/engine/adapters/brepkit.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brepkit.js +4 -98
- package/dist/brep/engine/adapters/brepkit.js.map +1 -1
- package/dist/brep/engine/adapters/occt.d.ts.map +1 -1
- package/dist/brep/engine/adapters/occt.js +0 -144
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/engine/native-history.d.ts +27 -0
- package/dist/brep/engine/native-history.d.ts.map +1 -0
- package/dist/brep/engine/native-history.js +54 -0
- package/dist/brep/engine/native-history.js.map +1 -0
- package/dist/brep/engine/registry.d.ts +2 -4
- package/dist/brep/engine/registry.d.ts.map +1 -1
- package/dist/brep/engine/registry.js +1 -1
- package/dist/brep/engine/registry.js.map +1 -1
- package/dist/brep/engine/types.d.ts +35 -77
- package/dist/brep/engine/types.d.ts.map +1 -1
- package/dist/brep/engine/types.js.map +1 -1
- package/dist/brep/export/export-model.d.ts +21 -0
- package/dist/brep/export/export-model.d.ts.map +1 -1
- package/dist/brep/export/export-model.js +171 -73
- package/dist/brep/export/export-model.js.map +1 -1
- package/dist/brep/export/step.d.ts +17 -1
- package/dist/brep/export/step.d.ts.map +1 -1
- package/dist/brep/export/step.js +133 -0
- package/dist/brep/export/step.js.map +1 -1
- package/dist/brep/export/stl.d.ts +22 -1
- package/dist/brep/export/stl.d.ts.map +1 -1
- package/dist/brep/export/stl.js +58 -10
- package/dist/brep/export/stl.js.map +1 -1
- package/dist/brep/export/transform12.d.ts +47 -0
- package/dist/brep/export/transform12.d.ts.map +1 -0
- package/dist/brep/export/transform12.js +87 -0
- package/dist/brep/export/transform12.js.map +1 -0
- package/dist/brep/face-evolution.d.ts +53 -0
- package/dist/brep/face-evolution.d.ts.map +1 -1
- package/dist/brep/face-evolution.js +65 -0
- package/dist/brep/face-evolution.js.map +1 -1
- package/dist/browser-host/index.d.ts +4 -1
- package/dist/browser-host/index.d.ts.map +1 -1
- package/dist/browser-host/index.js +7 -1
- package/dist/browser-host/index.js.map +1 -1
- package/dist/browser.d.ts +4 -8
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +4 -26
- package/dist/browser.js.map +1 -1
- package/dist/cad-runtime/backend-dispatch.d.ts +13 -58
- package/dist/cad-runtime/backend-dispatch.d.ts.map +1 -1
- package/dist/cad-runtime/backend-dispatch.js +22 -80
- package/dist/cad-runtime/backend-dispatch.js.map +1 -1
- package/dist/cad-runtime/content-key.d.ts +3 -3
- package/dist/cad-runtime/content-key.js +3 -3
- package/dist/cad-runtime/content-key.js.map +1 -1
- package/dist/cad-runtime/ports.d.ts +28 -0
- package/dist/cad-runtime/ports.d.ts.map +1 -1
- package/dist/cad-runtime/ports.js.map +1 -1
- package/dist/cad-runtime/runtime.d.ts +33 -12
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +44 -48
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +6 -11
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +3 -20
- 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/index.d.ts +13 -64
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -75
- package/dist/index.js.map +1 -1
- package/dist/lang/symbol-table.generated.d.ts +17 -0
- package/dist/lang/symbol-table.generated.d.ts.map +1 -1
- package/dist/lang/symbol-table.generated.js +17 -0
- package/dist/lang/symbol-table.generated.js.map +1 -1
- package/dist/mesh/index.d.ts +18 -23
- package/dist/mesh/index.d.ts.map +1 -1
- package/dist/mesh/index.js +18 -20
- package/dist/mesh/index.js.map +1 -1
- package/dist/mesh/io.d.ts +42 -14
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +77 -13
- package/dist/mesh/io.js.map +1 -1
- package/dist/mesh/threemf-loader.d.ts +38 -4
- package/dist/mesh/threemf-loader.d.ts.map +1 -1
- package/dist/mesh/threemf-loader.js +115 -34
- package/dist/mesh/threemf-loader.js.map +1 -1
- package/dist/mesh/types.d.ts +30 -0
- package/dist/mesh/types.d.ts.map +1 -1
- package/dist/mesh/types.js.map +1 -1
- package/dist/node-host/execute-script.d.ts +2 -1
- package/dist/node-host/execute-script.d.ts.map +1 -1
- package/dist/node-host/execute-script.js +5 -4
- package/dist/node-host/execute-script.js.map +1 -1
- package/dist/node-host/index.d.ts +1 -0
- package/dist/node-host/index.d.ts.map +1 -1
- package/dist/node-host/index.js +4 -0
- package/dist/node-host/index.js.map +1 -1
- package/dist/primitives/index.d.ts +19 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +21 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/runtime-state.d.ts +63 -29
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +57 -0
- package/dist/runtime-state.js.map +1 -1
- package/dist/sdf/index.d.ts +12 -0
- package/dist/sdf/index.d.ts.map +1 -0
- package/dist/sdf/index.js +13 -0
- package/dist/sdf/index.js.map +1 -0
- package/dist/sdk.d.ts +0 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js.map +1 -1
- package/dist/weapp.d.ts +2 -2
- package/dist/weapp.d.ts.map +1 -1
- package/dist/weapp.js +1 -1
- package/dist/weapp.js.map +1 -1
- package/package.json +276 -35
|
@@ -1 +1 @@
|
|
|
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,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;A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vC,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})"]}
|
|
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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S,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IAC5F,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,oBAAoB,CAC5B,6BAA6B,OAAO,aAAa,SAAS,CAAC,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,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; for curved host faces the wire is snapped to the surface via\n * `fixWireOnFace` (occt-wasm 5.6) before `makeFace`. The op declares\n * `engines: ['occt']` (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 { fixWireOnFaceBrep } from './brep-operations/healingFns'\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 const outerWire = fixWireOnFaceBrep(assembleWireOnFace(kernel, host, mode, entry.blueprints[0]!).wire, host)\n let face = orientLikeHost(kernel, host, kernel.makeFace(outerWire))\n const holes = entry.blueprints.slice(1).map((h) => fixWireOnFaceBrep(assembleWireOnFace(kernel, host, mode, h).wire, host) as never)\n if (holes.length > 0) face = kernel.addHolesInFace(face, holes)\n return face\n }\n const wire = fixWireOnFaceBrep(assembleWireOnFace(kernel, host, mode, entry).wire, host)\n return orientLikeHost(kernel, host, kernel.makeFace(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 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})"]}
|
|
@@ -1 +1 @@
|
|
|
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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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;;CAOxB,CAAA"}
|
|
@@ -95,7 +95,6 @@ export function buildSketchOnPlaneWith(kernel, params) {
|
|
|
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
|
-
capabilities: ['directEdit'],
|
|
99
98
|
brep(params) {
|
|
100
99
|
assertProfileParams(params);
|
|
101
100
|
return buildSketchOnPlaneWith(getBrepApi(), params);
|
|
@@ -1 +1 @@
|
|
|
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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AM,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;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAqB,EAAE,MAA2B;IACvF,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACxC,kDAAkD;IAClD,0DAA0D;IAC1D,sEAAsE;IACtE,+CAA+C;IAC/C,MAAM,UAAU,GAAG,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACvD,OAAO,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,CAAA;AACjF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;IACpC,YAAY,EAAE,CAAC,YAAY,CAAC;IAE5B,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
|
+
{"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,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;IAC5E,OAAO,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AAC5B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAqB,EACrB,KAAY,EACZ,UAAuB,EAC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,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\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 +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;;CAOvB,CAAA"}
|
|
@@ -50,7 +50,6 @@ function splitByPlaneBrep(input, params) {
|
|
|
50
50
|
* const { positive, negative } = await cad.splitByPlane(part0, { point: [0,0,5], normal: [0,0,1] })
|
|
51
51
|
*/
|
|
52
52
|
export const splitByPlane = defineOp({
|
|
53
|
-
capabilities: ['directEdit'],
|
|
54
53
|
outputs: ['positive', 'negative'],
|
|
55
54
|
paramDims: { 'params.point': 'length', 'params.normal': 'length' },
|
|
56
55
|
brep(input, params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-by-plane.js","sourceRoot":"","sources":["../../src/api/split-by-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAajC,8DAA8D;AAC9D,SAAS,MAAM,CAAC,CAAO;IACrB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvG,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAA;IAC1F,CAAC;IACD,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACtC,CAAC;AAED,wCAAwC;AACxC,SAAS,gBAAgB,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AC,UAAU,EAAE,UAAU,CAAC;IACjC,SAAS,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE;IAClE,IAAI,CAAC,KAAY,EAAE,MAA0B;QAC3C,OAAO,gBAAgB,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 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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @platform occt — 平台 op:内核原生 `split`(BRepAlgoAPI_Splitter)是 occt-only
|
|
5
5
|
* (engine-method-map `split` → occt-only;L1 只有 `splitByPlane`)。本文件
|
|
6
6
|
* 只取 L1 面做枚举/命名(getBrepApi),切分本身走平台面 getOcctKernel()(D3),
|
|
7
|
-
* defineOp 声明 `engines: ['occt']`(D11
|
|
7
|
+
* defineOp 声明 `engines: ['occt']`(D11),不声明其它收窄。
|
|
8
8
|
*
|
|
9
9
|
* 生成投影是 brep-only compatOp,不带角色表;本文件手写 defineOp,BREP 路径
|
|
10
10
|
* 用内核原生 split(BRepAlgoAPI_Splitter)切分,存活面(hash 逐字不变)回投原
|
package/dist/api/split.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @platform occt — 平台 op:内核原生 `split`(BRepAlgoAPI_Splitter)是 occt-only
|
|
5
5
|
* (engine-method-map `split` → occt-only;L1 只有 `splitByPlane`)。本文件
|
|
6
6
|
* 只取 L1 面做枚举/命名(getBrepApi),切分本身走平台面 getOcctKernel()(D3),
|
|
7
|
-
* defineOp 声明 `engines: ['occt']`(D11
|
|
7
|
+
* defineOp 声明 `engines: ['occt']`(D11),不声明其它收窄。
|
|
8
8
|
*
|
|
9
9
|
* 生成投影是 brep-only compatOp,不带角色表;本文件手写 defineOp,BREP 路径
|
|
10
10
|
* 用内核原生 split(BRepAlgoAPI_Splitter)切分,存活面(hash 逐字不变)回投原
|
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;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C,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACxE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAA;QAC9B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACrC,CAAC;IACD,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAE7B,OAAO,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,WAAoC,CAAC,EAAE;QAC1E,KAAK,EAAE,WAAoC;QAC3C,SAAS;KACV,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;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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;;;;;;;GAcG;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),不声明其它收窄。\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"]}
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
export type ProjectionKind = 'brep-op' | 'query' | 'pure' | 'type' | 'skip' | 'faijs';
|
|
32
32
|
import type { Provenance } from '../../topology/naming/lineage.js';
|
|
33
33
|
import type { BrepEngineId } from '../../brep/engine/types.js';
|
|
34
|
-
import type { BrepCapabilityName } from '../../cad-runtime/backend-dispatch.js';
|
|
35
34
|
export type { Provenance } from '../../topology/naming/lineage.js';
|
|
36
35
|
/** brep-op / query 的时间线消费声明(透传 defineOp 元数据,G3/G4)。 */
|
|
37
36
|
/**
|
|
@@ -97,17 +96,9 @@ export interface ArgSpecEntry {
|
|
|
97
96
|
/** P20: 机器参数名表(按位置顺序),供 dual-form-args resolveArgs 映射对象形态→位置数组。 */
|
|
98
97
|
params?: string[];
|
|
99
98
|
/**
|
|
100
|
-
* Phase
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* (api/surface/capability-map.json)逐条填写。
|
|
104
|
-
*/
|
|
105
|
-
capabilities?: BrepCapabilityName[];
|
|
106
|
-
/**
|
|
107
|
-
* Phase 5(narrowing plan D11):平台身份声明——该 brep-op 只在列出的引擎上
|
|
108
|
-
* 实现(如 compat op 调 occt-only 方法 isNull/section/loft → ['occt'])。
|
|
109
|
-
* 缺省 = 全平台中立。可与 capabilities 并存(2026-09-24 撤销 D11-7 互斥):
|
|
110
|
-
* engines 是引擎白名单,capabilities 是能力依赖,判定 engines 在先(D11-2)。
|
|
99
|
+
* Phase 5(narrowing plan D11):平台身份声明——该 brep-op 只在列出的引擎上实现
|
|
100
|
+
* (如 compat op 调 occt-only 方法 isNull/section/loft → ['occt'])。
|
|
101
|
+
* 缺省 = 全平台中立。这是 op 侧唯一的收窄轴:引擎能做什么由引擎实现本身决定,
|
|
111
102
|
* 生成器透传给 compatOp → defineOp engines,并写进 script-face-manifest。
|
|
112
103
|
*/
|
|
113
104
|
engines?: readonly BrepEngineId[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arg-spec.d.ts","sourceRoot":"","sources":["../../../src/api/surface/arg-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,kBAAkB;AAClB,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"arg-spec.d.ts","sourceRoot":"","sources":["../../../src/api/surface/arg-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;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AE,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IACjC,iDAAiD;IACjD,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IAEnB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,mCAAmC,EAAE,OAAO,CAAA;IAC7D;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,aAAa,EAAE,OAAO,CAAC,CAAA;IACzD,kDAAkD;IAClD,MAAM,CAAC,EAAE,OAAO,aAAa,EAAE,OAAO,CAAA;IACtC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,YAAY,EAqzHlC,CAAA"}
|
|
@@ -42,7 +42,6 @@ export const ARG_SPEC = [
|
|
|
42
42
|
name: 'torus',
|
|
43
43
|
source: 'brep-operations/primitiveFns.ts#torusBrep',
|
|
44
44
|
kind: 'brep-op',
|
|
45
|
-
capabilities: ["dispose", "makeTorus"],
|
|
46
45
|
args: '(majorRadius: number, minorRadius: number, options?: TorusOptions)',
|
|
47
46
|
// 构造类:无几何输入(纯数值参数),来源实现返回裸 ValidSolid(非 Result)。
|
|
48
47
|
geometryArgs: [],
|
|
@@ -66,9 +65,8 @@ export const ARG_SPEC = [
|
|
|
66
65
|
params: ['a', 'b', 'options'],
|
|
67
66
|
formClass: 'A',
|
|
68
67
|
scriptFace: true,
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
// 2026-09-24 撤销,两条轴可并存,届时按 capability-map.json 实证补回依赖清单。
|
|
68
|
+
// 依赖声明(诚实原则):来源实现 fuse 依赖 kernel.isNull / kernel.dispose(occt
|
|
69
|
+
// 平台面)→ 平台 op,声明 engines: ['occt'],在 brepkit / 其它引擎下执行前报错(D11-4)。
|
|
72
70
|
engines: ['occt'],
|
|
73
71
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
74
72
|
},
|
|
@@ -1707,7 +1705,7 @@ export const ARG_SPEC = [
|
|
|
1707
1705
|
naming: { kind: 'replicate', k: 0 },
|
|
1708
1706
|
},
|
|
1709
1707
|
{
|
|
1710
|
-
name: 'roof', source: 'brep-operations/roofFns.ts#roofBrep', kind: 'brep-op',
|
|
1708
|
+
name: 'roof', source: 'brep-operations/roofFns.ts#roofBrep', kind: 'brep-op', engines: ['occt'], module: 'operations',
|
|
1711
1709
|
geometryArgs: [0], reason: 'wire → Result(ValidSolid)→solid,brep-op',
|
|
1712
1710
|
args: 'roof(wire: Shape, options?: RoofOptions): Shape',
|
|
1713
1711
|
params: ['wire', 'options'], formClass: 'A',
|
|
@@ -1715,8 +1713,7 @@ export const ARG_SPEC = [
|
|
|
1715
1713
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
1716
1714
|
},
|
|
1717
1715
|
{
|
|
1718
|
-
name: 'drill', source: 'brep-operations/compoundFns.ts#drillBrep', kind: 'brep-op',
|
|
1719
|
-
capabilities: ["makeCylinder", "located", "getBoundingBox", "cut"], module: 'operations',
|
|
1716
|
+
name: 'drill', source: 'brep-operations/compoundFns.ts#drillBrep', kind: 'brep-op', module: 'operations',
|
|
1720
1717
|
geometryArgs: [0], reason: 'Shapeable<Shape3D> → Result<T>,brep-op',
|
|
1721
1718
|
args: 'drill(shape: Shape, options: DrillOptions): Shape',
|
|
1722
1719
|
params: ['shape', 'options'], formClass: 'A',
|
|
@@ -1724,8 +1721,7 @@ export const ARG_SPEC = [
|
|
|
1724
1721
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
1725
1722
|
},
|
|
1726
1723
|
{
|
|
1727
|
-
name: 'pocket', source: 'brep-operations/compoundFns.ts#pocketBrep', kind: 'brep-op',
|
|
1728
|
-
capabilities: ["getSubShapes", "surfaceCenterOfMass", "uvBounds", "surfaceNormal", "makeFace", "translate", "extrude", "cut"], module: 'operations',
|
|
1724
|
+
name: 'pocket', source: 'brep-operations/compoundFns.ts#pocketBrep', kind: 'brep-op', module: 'operations',
|
|
1729
1725
|
geometryArgs: [0], reason: 'Shapeable<Shape3D> → Result<T>,brep-op',
|
|
1730
1726
|
args: 'pocket(shape: Shape, options: PocketOptions): Shape',
|
|
1731
1727
|
params: ['shape', 'options'], formClass: 'A',
|
|
@@ -1733,8 +1729,7 @@ export const ARG_SPEC = [
|
|
|
1733
1729
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
1734
1730
|
},
|
|
1735
1731
|
{
|
|
1736
|
-
name: 'boss', source: 'brep-operations/compoundFns.ts#bossBrep', kind: 'brep-op',
|
|
1737
|
-
capabilities: ["getSubShapes", "surfaceCenterOfMass", "uvBounds", "surfaceNormal", "makeFace", "translate", "extrude", "fuse"], module: 'operations',
|
|
1732
|
+
name: 'boss', source: 'brep-operations/compoundFns.ts#bossBrep', kind: 'brep-op', module: 'operations',
|
|
1738
1733
|
geometryArgs: [0], reason: 'Shapeable<Shape3D> → Result<T>,brep-op',
|
|
1739
1734
|
args: 'boss(shape: Shape, options: BossOptions): Shape',
|
|
1740
1735
|
params: ['shape', 'options'], formClass: 'A',
|
|
@@ -1742,8 +1737,7 @@ export const ARG_SPEC = [
|
|
|
1742
1737
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
1743
1738
|
},
|
|
1744
1739
|
{
|
|
1745
|
-
name: 'mirrorJoin', source: 'brep-operations/compoundFns.ts#mirrorJoinBrep', kind: 'brep-op',
|
|
1746
|
-
capabilities: ["mirror", "fuse"], module: 'operations',
|
|
1740
|
+
name: 'mirrorJoin', source: 'brep-operations/compoundFns.ts#mirrorJoinBrep', kind: 'brep-op', module: 'operations',
|
|
1747
1741
|
geometryArgs: [0], reason: 'Shapeable<Shape3D> → Result<T>,brep-op',
|
|
1748
1742
|
args: 'mirrorJoin(shape: Shape, options?: MirrorJoinOptions): Shape',
|
|
1749
1743
|
params: ['shape', 'options'], formClass: 'A',
|
|
@@ -1767,7 +1761,7 @@ export const ARG_SPEC = [
|
|
|
1767
1761
|
scriptFace: true,
|
|
1768
1762
|
},
|
|
1769
1763
|
{
|
|
1770
|
-
name: 'convexHull', source: 'brep-operations/hullFns.ts#convexHullBrep', kind: 'brep-op',
|
|
1764
|
+
name: 'convexHull', source: 'brep-operations/hullFns.ts#convexHullBrep', kind: 'brep-op', module: 'operations',
|
|
1771
1765
|
geometryArgs: [], reason: '点集构造 → Result(Solid),单产物,brep-op',
|
|
1772
1766
|
args: 'convexHull(points: Vec3[]): Shape',
|
|
1773
1767
|
params: ['points'], formClass: 'A',
|
|
@@ -2462,7 +2456,7 @@ export const ARG_SPEC = [
|
|
|
2462
2456
|
},
|
|
2463
2457
|
// 1 × brep-op(构造类:纯数值参数 → Shape3D,无几何输入)
|
|
2464
2458
|
{
|
|
2465
|
-
name: 'makeBaseBox', source: 'brep-operations/primitiveFns.ts#makeBaseBoxBrep', kind: 'brep-op',
|
|
2459
|
+
name: 'makeBaseBox', source: 'brep-operations/primitiveFns.ts#makeBaseBoxBrep', kind: 'brep-op', module: 'sketching',
|
|
2466
2460
|
args: '(xLength: number, yLength: number, zLength: number) -> Shape3D',
|
|
2467
2461
|
geometryArgs: [],
|
|
2468
2462
|
returnsResult: false,
|
|
@@ -2745,7 +2739,7 @@ export const ARG_SPEC = [
|
|
|
2745
2739
|
reason: 'overridden by handwritten api/primitives.ts (cone dual-op, mesh+brep)',
|
|
2746
2740
|
},
|
|
2747
2741
|
{
|
|
2748
|
-
name: 'ellipsoid', source: 'brep-operations/primitiveFns.ts#ellipsoidBrep', kind: 'brep-op',
|
|
2742
|
+
name: 'ellipsoid', source: 'brep-operations/primitiveFns.ts#ellipsoidBrep', kind: 'brep-op',
|
|
2749
2743
|
geometryArgs: [], returnsResult: false,
|
|
2750
2744
|
args: 'ellipsoid(rx: number, ry: number, rz: number, options?: EllipsoidOptions): Shape',
|
|
2751
2745
|
reason: '纯数值整件构造(rx/ry/rz → ValidSolid),brep-op',
|
|
@@ -2844,7 +2838,7 @@ export const ARG_SPEC = [
|
|
|
2844
2838
|
reason: 'faijs 同名 translate(§5.1 双形态:对象形态手写面覆盖 + v:Vec3 位置形态并入),生成层不重复投影',
|
|
2845
2839
|
},
|
|
2846
2840
|
{
|
|
2847
|
-
name: 'rotate', source: 'brep-operations/topologyFns.ts#rotateBrep', kind: 'brep-op',
|
|
2841
|
+
name: 'rotate', source: 'brep-operations/topologyFns.ts#rotateBrep', kind: 'brep-op',
|
|
2848
2842
|
geometryArgs: [0], returnsResult: false,
|
|
2849
2843
|
args: 'rotate(shape: Shape, angle: number, options?: { at?, axis? }): Shape',
|
|
2850
2844
|
reason: 'faijs rotate 已更名 rotate_euler(faijs 面只导出 rotate_euler),上游轴角 rotate 空出 → brep-op 进脚本面'
|
|
@@ -2860,7 +2854,7 @@ export const ARG_SPEC = [
|
|
|
2860
2854
|
reason: 'overridden by handwritten api/transform.ts (scale dual-op, mesh+brep)',
|
|
2861
2855
|
},
|
|
2862
2856
|
{
|
|
2863
|
-
name: 'mirror', source: 'brep-operations/topologyFns.ts#mirrorBrep', kind: 'brep-op',
|
|
2857
|
+
name: 'mirror', source: 'brep-operations/topologyFns.ts#mirrorBrep', kind: 'brep-op',
|
|
2864
2858
|
geometryArgs: [0], returnsResult: false,
|
|
2865
2859
|
args: 'mirror(shape: Shape, options?: MirrorOptions): Shape',
|
|
2866
2860
|
reason: 'faijs 无同名 mirror,整件反射 → brep-op',
|
|
@@ -2869,16 +2863,16 @@ export const ARG_SPEC = [
|
|
|
2869
2863
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
2870
2864
|
},
|
|
2871
2865
|
{
|
|
2872
|
-
name: 'clone', source: 'brep-operations/topologyFns.ts#cloneBrep', kind: 'brep-op',
|
|
2866
|
+
name: 'clone', source: 'brep-operations/topologyFns.ts#cloneBrep', kind: 'brep-op',
|
|
2873
2867
|
geometryArgs: [0], returnsResult: true,
|
|
2874
2868
|
args: 'clone(shape: Shape): Shape',
|
|
2875
|
-
reason: 'faijs 用 copy(不同名),整件克隆(Result<T>)→ brep-op;纯 copyShape 调用、无 occt 特有 API(
|
|
2869
|
+
reason: 'faijs 用 copy(不同名),整件克隆(Result<T>)→ brep-op;纯 copyShape 调用、无 occt 特有 API(brepkit 亦有 copyShape)',
|
|
2876
2870
|
params: ['shape'], formClass: 'A',
|
|
2877
2871
|
scriptFace: true,
|
|
2878
2872
|
naming: { kind: 'identity' },
|
|
2879
2873
|
},
|
|
2880
2874
|
{
|
|
2881
|
-
name: 'applyMatrix', source: 'brep-operations/topologyFns.ts#applyMatrixBrep', kind: 'brep-op',
|
|
2875
|
+
name: 'applyMatrix', source: 'brep-operations/topologyFns.ts#applyMatrixBrep', kind: 'brep-op',
|
|
2882
2876
|
geometryArgs: [0], returnsResult: true,
|
|
2883
2877
|
args: 'applyMatrix(shape: Shape, matrix: unknown): Shape',
|
|
2884
2878
|
reason: 'faijs 用 applyTransform(不同名),整件矩阵变换 → brep-op',
|
|
@@ -2896,7 +2890,7 @@ export const ARG_SPEC = [
|
|
|
2896
2890
|
naming: { kind: 'identity' },
|
|
2897
2891
|
},
|
|
2898
2892
|
{
|
|
2899
|
-
name: 'locate', source: 'brep-operations/topologyFns.ts#locateBrep', kind: 'brep-op',
|
|
2893
|
+
name: 'locate', source: 'brep-operations/topologyFns.ts#locateBrep', kind: 'brep-op', engines: ['occt'],
|
|
2900
2894
|
geometryArgs: [0], returnsResult: false,
|
|
2901
2895
|
args: 'locate(shape: Shape, placement: unknown): Shape',
|
|
2902
2896
|
reason: 'faijs 无同名,整件定位变换 → brep-op',
|
|
@@ -2934,7 +2928,6 @@ export const ARG_SPEC = [
|
|
|
2934
2928
|
},
|
|
2935
2929
|
{
|
|
2936
2930
|
name: 'section', source: 'brep-operations/booleanFns.ts#sectionBrep', kind: 'brep-op',
|
|
2937
|
-
capabilities: ["sectionByPlane", "makeCompound"],
|
|
2938
2931
|
geometryArgs: [0], returnsResult: true,
|
|
2939
2932
|
args: 'section(shape: Shape, plane: PlaneInput): Shape',
|
|
2940
2933
|
params: ['shape', 'plane'], formClass: 'A',
|
|
@@ -2969,7 +2962,7 @@ export const ARG_SPEC = [
|
|
|
2969
2962
|
{
|
|
2970
2963
|
name: 'shell', source: 'brep-operations/topologyFns.ts#shellBrep', kind: 'brep-op', engines: ['occt'],
|
|
2971
2964
|
geometryArgs: [0], returnsResult: true,
|
|
2972
|
-
reason: 'faijs 侧 cad.shell 由手写中立 op 覆盖(api/shell.ts:选面走 FaceTopoRef
|
|
2965
|
+
reason: 'faijs 侧 cad.shell 由手写中立 op 覆盖(api/shell.ts:选面走 FaceTopoRef,两引擎同走 L1 shell ⇒ 相对来源实现的 occt 平台版是能力升级,brepkit 的 L1 shell 亦可用)。本投影保留为引擎记录(capability-map),生成模块符号不直接进 cad 命名空间 by design(同 extrude / sweep 口径)。',
|
|
2973
2966
|
args: 'shell(shape: Shape, faces?: Shape[], thickness: number): Shape',
|
|
2974
2967
|
params: ['shape', 'faces', 'thickness'], formClass: 'A',
|
|
2975
2968
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
@@ -3318,7 +3311,7 @@ export const ARG_SPEC = [
|
|
|
3318
3311
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
3319
3312
|
},
|
|
3320
3313
|
{
|
|
3321
|
-
name: 'fixShape', source: 'brep-operations/healingFns.ts#fixShapeBrep', kind: 'brep-op',
|
|
3314
|
+
name: 'fixShape', source: 'brep-operations/healingFns.ts#fixShapeBrep', kind: 'brep-op',
|
|
3322
3315
|
geometryArgs: [0], returnsResult: true,
|
|
3323
3316
|
args: 'fixShape(shape: Shape): Shape',
|
|
3324
3317
|
reason: '整件修复(Result<Shape>),brep-op',
|
|
@@ -3327,7 +3320,7 @@ export const ARG_SPEC = [
|
|
|
3327
3320
|
naming: { kind: 'kernel', newFaces: { via: 'byAdjacency' } },
|
|
3328
3321
|
},
|
|
3329
3322
|
{
|
|
3330
|
-
name: 'healSolid', source: 'brep-operations/healingFns.ts#healSolidBrep', kind: 'brep-op',
|
|
3323
|
+
name: 'healSolid', source: 'brep-operations/healingFns.ts#healSolidBrep', kind: 'brep-op',
|
|
3331
3324
|
geometryArgs: [0], returnsResult: true,
|
|
3332
3325
|
args: 'healSolid(solid: Shape): Shape',
|
|
3333
3326
|
reason: 'Solid 修复(Result<ValidSolid>),brep-op',
|