@faicad/faijs 0.29.3 → 0.29.5
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/appearance.d.ts +138 -0
- package/dist/api/appearance.d.ts.map +1 -0
- package/dist/api/appearance.js +230 -0
- package/dist/api/appearance.js.map +1 -0
- package/dist/api/import-step.d.ts.map +1 -1
- package/dist/api/import-step.js +28 -0
- package/dist/api/import-step.js.map +1 -1
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/meta.d.ts +93 -0
- package/dist/api/meta.d.ts.map +1 -0
- package/dist/api/meta.js +99 -0
- package/dist/api/meta.js.map +1 -0
- package/dist/api/primitives.d.ts.map +1 -1
- package/dist/api/primitives.js +117 -2
- package/dist/api/primitives.js.map +1 -1
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +28 -3
- package/dist/brep/brep-ops.js.map +1 -1
- package/dist/brep/engine/adapters/occt.js +1 -1
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/export/export-model.d.ts +40 -0
- package/dist/brep/export/export-model.d.ts.map +1 -1
- package/dist/brep/export/export-model.js +268 -25
- package/dist/brep/export/export-model.js.map +1 -1
- package/dist/brep/export/step-meta-header.d.ts +102 -0
- package/dist/brep/export/step-meta-header.d.ts.map +1 -0
- package/dist/brep/export/step-meta-header.js +225 -0
- package/dist/brep/export/step-meta-header.js.map +1 -0
- package/dist/brep/export/step.d.ts +5 -1
- package/dist/brep/export/step.d.ts.map +1 -1
- package/dist/brep/export/step.js +11 -2
- package/dist/brep/export/step.js.map +1 -1
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +63 -1
- package/dist/define-op.js.map +1 -1
- package/dist/lang/metadata-extractor.d.ts.map +1 -1
- package/dist/lang/metadata-extractor.js +2 -21
- package/dist/lang/metadata-extractor.js.map +1 -1
- package/dist/lang/types.d.ts +5 -6
- package/dist/lang/types.d.ts.map +1 -1
- package/dist/lang/types.js.map +1 -1
- package/dist/mesh/io.d.ts +6 -0
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +25 -1
- package/dist/mesh/io.js.map +1 -1
- package/dist/mesh/primitives.d.ts.map +1 -1
- package/dist/mesh/primitives.js +41 -6
- package/dist/mesh/primitives.js.map +1 -1
- package/dist/mesh/threemf-loader.d.ts +23 -0
- package/dist/mesh/threemf-loader.d.ts.map +1 -1
- package/dist/mesh/threemf-loader.js +182 -8
- package/dist/mesh/threemf-loader.js.map +1 -1
- package/dist/mesh/types.d.ts +38 -0
- package/dist/mesh/types.d.ts.map +1 -1
- package/dist/mesh/types.js.map +1 -1
- package/dist/occt-kernel/highLevelApi.d.ts +4 -1
- package/dist/occt-kernel/highLevelApi.d.ts.map +1 -1
- package/dist/occt-kernel/highLevelApi.js +4 -2
- package/dist/occt-kernel/highLevelApi.js.map +1 -1
- package/dist/occt-kernel/occt-primitives.js +1 -1
- package/dist/occt-kernel/occt-primitives.js.map +1 -1
- package/dist/occt-kernel/occtKernel.d.ts +1 -1
- package/dist/occt-kernel/occtKernel.js +1 -1
- package/dist/occt-kernel/occtKernel.js.map +1 -1
- package/dist/occt-kernel/stepMetaParser.d.ts +44 -0
- package/dist/occt-kernel/stepMetaParser.d.ts.map +1 -0
- package/dist/occt-kernel/stepMetaParser.js +166 -0
- package/dist/occt-kernel/stepMetaParser.js.map +1 -0
- package/dist/shape.d.ts +11 -3
- package/dist/shape.d.ts.map +1 -1
- package/dist/shape.js +4 -2
- package/dist/shape.js.map +1 -1
- package/dist/step/stepMetaParser.d.ts +55 -0
- package/dist/step/stepMetaParser.d.ts.map +1 -0
- package/dist/step/stepMetaParser.js +177 -0
- package/dist/step/stepMetaParser.js.map +1 -0
- package/package.json +2 -2
package/dist/mesh/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mesh/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mesh/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAI5C,oCAAoC;AACpC,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAI9B;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,KAAK;IACpB,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,WAAW,CAAA;IACpB,yDAAyD;IACzD,UAAU,CAAC,EAAE,aAAa,CAAA;IAC1B,gEAAgE;IAChE,cAAc,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,aAAa,CAAA;KAAE,CAAC,CAAA;IACnF,2EAA2E;IAC3E,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,CAElD;AAID,8DAA8D;AAC9D,e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AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA;AAE3B;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,CAAqB;IAC7C,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,YAAY,CAAA;IACxC,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9D,CAAC","sourcesContent":["/**\n * mesh 类型定义 — 纯数据几何 API 的类型契约\n *\n * 设计原则(§5.1):\n * - 全部纯数据:输入输出是 ManifoldMeshData 或 JSON 值,不碰 THREE 场景、不读 store\n * - 不可变:每个 API 返回新几何,不修改输入\n * - 坐标系:右手系 +Z 向上、毫米、角度用度\n * - 坐标空间:所有 API 输入/输出均为**世界空间** ManifoldMeshData\n * (局部↔世界变换由执行器负责,mesh 不感知 mesh.matrixWorld)\n *\n * P1 阶段 Shape = ManifoldMeshData(无 worker)。\n * P3+ 阶段 Shape 将变为 worker 内 Manifold 对象的句柄。\n */\n\n// ── 基础类型 ──\n\nexport type Vec3 = [number, number, number]\n\n/**\n * A JSON-serializable value: scalar, null, array, or plain object.\n */\nexport type JsonValue =\n | string\n | number\n | boolean\n | null\n | JsonValue[]\n | { [k: string]: JsonValue }\n\n// ── Shape ──\n\n/**\n * A mesh shape — the core data type of the mesh API.\n *\n * Shape is defined directly in mesh/types.ts rather than re-exported from\n * ops/types.ts; ops/types.ts imports it from here, removing the type cycle.\n */\nexport interface Shape {\n positions: Float32Array\n indices: Uint32Array\n}\n\n/**\n * Structural guard: returns true when the value looks like a mesh Shape\n * (duck-typed via positions/indices, with no requirements on third-party\n * types).\n *\n * Per the keep-syntax design, hosts use this guard to distinguish mesh Shapes\n * from compounds when consuming ExecutionResult.outputs, in the same style as\n * the runtime-internal isShapeLike.\n * @param v - the value to test.\n * @returns true when the value is a mesh Shape.\n */\nexport function isMeshShape(v: unknown): v is Shape {\n return !!v && typeof v === 'object' && 'positions' in v && 'indices' in v\n}\n\n// ── 创建参数 ──\n\n/** Default radial segment count used for rounded geometry. */\nexport const NRAD_DEFAULT = 64\n/** Minimum allowed radial segment count. */\nexport const NRAD_MIN = 3\n/** Maximum allowed radial segment count. */\nexport const NRAD_MAX = 128\n\n/**\n * Clamp an nRad value into the legal range [NRAD_MIN, NRAD_MAX], rounding to\n * the nearest integer; undefined falls back to NRAD_DEFAULT.\n * @param n - the requested radial segment count, or undefined.\n * @returns the clamped radial segment count.\n */\nexport function clampNRad(n: number | undefined): number {\n if (n === undefined) return NRAD_DEFAULT\n return Math.max(NRAD_MIN, Math.min(NRAD_MAX, Math.round(n)))\n}\n\n/**\n * Parameters for creating a box (brepjs `box(width, depth, height, {at?, centered?, segments?})`\n * contract, §4.1 A 决策). Default: min-corner at the origin. `centered: true` shifts so the\n * box is centered at the origin; `at` is CENTER semantics and takes precedence over `centered`.\n */\nexport interface BoxParams {\n /** Side length along X (mm). */\n width: number\n /** Side length along Y (mm). */\n depth: number\n /** Side length along Z (mm). */\n height: number\n /** Center position (brepjs `at`, CENTER semantics); takes precedence over `centered`. */\n at?: Vec3\n /** Center the box at the origin when `at` is absent. Default: false (min-corner at origin). */\n centered?: boolean\n /** Tessellation segment count (box: affects only brep/mesh tessellation, not topology). */\n segments?: number\n /** Internal historical alias for `segments` (accepted by clampNRad, §5.1). */\n nRad?: number\n}\n\n/** Parameters for creating a sphere. */\nexport interface SphereParams {\n radius: number\n segments?: number\n center?: Vec3\n nRad?: number\n}\n\n/** Parameters for creating a cylinder (brepjs contract, §4.3 A). */\nexport interface CylinderParams {\n /** Radius (mm). */\n radius: number\n /** Height along +Z (mm). */\n height: number\n /** Base circle center (brepjs `at`, BASE semantics; default [0, 0, 0]). */\n at?: Vec3\n /** Center the cylinder (base at −h/2 / center at `at`) instead of base at `at`/origin. */\n centered?: boolean\n /** Tessellation segment count (cylinder: affects only tessellation, not topology). */\n segments?: number\n /** Internal historical alias for `segments` (accepted by clampNRad, §5.1). */\n nRad?: number\n}\n\n/** Parameters for creating a cone (or a truncated cone). */\nexport interface ConeParams {\n /** Radius at the base (mm). */\n radiusBottom: number\n /** Radius at the top (mm); 0 for a pointed cone, === radiusBottom for a cylinder. */\n radiusTop: number\n /** Height along +Z (mm). */\n height: number\n /** Base circle center (brepjs `at`, BASE semantics; default [0, 0, 0]). */\n at?: Vec3\n /** Center the cone (base at −h/2 / center at `at`) instead of base at `at`/origin. */\n centered?: boolean\n /** Tessellation segment count (cone: affects only mere tessellation, not topology). */\n segments?: number\n /** Internal historical alias for `segments` (accepted by clampNRad, §5.1). */\n nRad?: number\n}\n\n/**\n * Parameters for creating a wedge (trapezoidal prism).\n */\nexport interface WedgeParams {\n /** Width of the base edge (mm), along the Y axis. */\n width: number\n /** Height of the trapezoid (mm), along the Z axis. */\n height: number\n /** Angle between the base edge and the slope (degrees). */\n angle: number\n /** Total extrusion length (mm), along the X axis. */\n length: number\n center?: Vec3\n nRad?: number\n}\n\n/** Parameters for creating 3D text. */\nexport interface TextParams {\n text: string\n size: number\n depth: number\n}\n\n/** Parameters for extruding an SVG into a solid. */\nexport interface SvgExtrudeParams {\n svg: string\n depth: number\n targetLongSide: number\n naturalWidth?: number\n naturalHeight?: number\n}\n\n/** Parameters for building a solid from an SDF (signed distance function). */\nexport interface SdfParams {\n code: string\n box?: [Vec3, Vec3]\n resolution?: number\n params?: Record<string, number>\n}\n\n// ── 变换参数 ──\n\n/** Parameters for translating a shape. */\nexport interface TranslateParams {\n offset: Vec3\n}\n\n/** Parameters for rotating a shape. */\nexport interface RotateParams {\n angles: Vec3\n pivot?: Vec3\n}\n\n/** Parameters for scaling a shape. */\nexport interface ScaleParams {\n factor: number | Vec3\n}\n\n// ── 布尔参数 ──\n\n/** Kinds of binary boolean operations. */\nexport type BooleanOperation = 'union' | 'subtract' | 'intersect'\n\n// ── 分割参数 ──\n\n/** A cutting plane defined by a unit normal and a signed offset. */\nexport interface SplitPlane {\n normal: Vec3\n offset: number\n}\n\n/** Parameters for a dovetail split, including the cutting plane setup. */\nexport interface DovetailSplitParams {\n plane: SplitPlane\n planeCenter: Vec3\n widthDir: Vec3\n bboxWidthOnWidthDir: number\n groove: {\n depth: number\n depthTolerance: number\n width: number\n widthTolerance: number\n flapsAngle: number\n }\n}\n\n/** Parameters for a dowel-pin split, including the cutting plane setup. */\nexport interface DowelSplitParams {\n plane: SplitPlane\n planeCenter: Vec3\n widthDir: Vec3\n dowel: {\n diameter: number\n diameterTolerance: number\n height: number\n heightTolerance: number\n }\n selectedSections?: number[] | null\n}\n\n/** Parameters for a straight-tenon split, including the cutting plane setup. */\nexport interface TenonSplitParams {\n plane: SplitPlane\n planeCenter: Vec3\n widthDir: Vec3\n tenon: {\n sideLength: number\n sideLengthTolerance: number\n height: number\n heightTolerance: number\n }\n selectedSections?: number[] | null\n}\n\n/** Result of a joinery split: the two halves plus the cut-out wedge. */\nexport interface SplitResult {\n front: Shape\n back: Shape\n wedge: Shape | null\n}\n\n// ── 钻孔参数 ──\n\n/** Parameters for drilling a hole. */\nexport interface DrillParams {\n diameter: number\n depth?: number\n type: 'through' | 'blind'\n position: Vec3\n direction: Vec3\n faceNormal: Vec3\n tolerance?: number\n holeType?: 'simple' | 'screw'\n screwSystem?: string\n screwSpecIdx?: number\n screwThread?: string\n screwHead?: string\n}\n\n// ── 拉伸参数 ──\n\n/** Parameters for extruding a face bounded by a plane. */\nexport interface ExtrudeParams {\n normal: Vec3\n planeDistance: number\n length: number\n mode?: 'centered' | 'forward' | 'backward'\n}\n\n// ── 雕刻参数 ──\n\n/** Parameters for engraving text or an SVG onto a face. */\nexport interface EngraveParams {\n mode: 'convex' | 'concave'\n depth: number\n face: {\n center: Vec3\n normal: Vec3\n }\n text?: string\n textSize?: number\n svg?: string\n svgNaturalWidth?: number\n svgNaturalHeight?: number\n svgSize?: number\n}\n\n/** Parameters for applying a knurl texture to a face. */\nexport interface KnurlParams {\n face: {\n center: Vec3\n normal: Vec3\n }\n knurlTextureHeight: number\n knurlInvertDisplacement: boolean\n knurlRefineLength: number\n knurlScaleU: number\n knurlScaleV: number\n knurlMappingMode: number\n}\n\n// ── 查询结果 ──\n\n/** Axis-aligned bounding box in world space. */\nexport interface BoundingBox {\n min: Vec3\n max: Vec3\n}\n\n/** Description of a face on a shape: center, normal and area. */\nexport interface FaceDescriptor {\n center: Vec3\n normal: Vec3\n area: number\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mesh/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA8DH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,WAAW,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,CAAA;AAC3E,CAAC;AAED,aAAa;AAEb,8DAA8D;AAC9D,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAA;AAC9B,4CAA4C;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAA;AACzB,4CAA4C;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA;AAE3B;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,CAAqB;IAC7C,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,YAAY,CAAA;IACxC,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9D,CAAC","sourcesContent":["/**\n * mesh 类型定义 — 纯数据几何 API 的类型契约\n *\n * 设计原则(§5.1):\n * - 全部纯数据:输入输出是 ManifoldMeshData 或 JSON 值,不碰 THREE 场景、不读 store\n * - 不可变:每个 API 返回新几何,不修改输入\n * - 坐标系:右手系 +Z 向上、毫米、角度用度\n * - 坐标空间:所有 API 输入/输出均为**世界空间** ManifoldMeshData\n * (局部↔世界变换由执行器负责,mesh 不感知 mesh.matrixWorld)\n *\n * P1 阶段 Shape = ManifoldMeshData(无 worker)。\n * P3+ 阶段 Shape 将变为 worker 内 Manifold 对象的句柄。\n */\n\nimport type { PbrAppearance } from '../api/appearance'\nimport type { ShapeMeta } from '../api/meta'\n\n// ── 基础类型 ──\n\n/** 三维坐标 / RGB 颜色元组(分量 sRGB 0–1)。 */\nexport type Vec3 = [number, number, number]\n\n/**\n * A JSON-serializable value: scalar, null, array, or plain object.\n */\nexport type JsonValue =\n | string\n | number\n | boolean\n | null\n | JsonValue[]\n | { [k: string]: JsonValue }\n\n// ── Shape ──\n\n/**\n * A mesh shape — the core data type of the mesh API.\n *\n * Shape is defined directly in mesh/types.ts rather than re-exported from\n * ops/types.ts; ops/types.ts imports it from here, removing the type cycle.\n *\n * 外观(PBR):`appearance` 为可选数据字段(设计文档 2026-10-05 v2 §4.2),\n * 双链路产物自解释、可序列化;外观设置是 Shape **方法**(非 op,见\n * `api/appearance.ts` 的 `ShapeAppearanceMethods` / `attachAppearanceMethods`),\n * 方法只挂载在产物构造点(solid/curve)返回的实例上,基础 Shape 保持纯数据\n * 契约——因此本接口**不** extends 方法接口,`isMeshShape` 鸭子判定不受影响。\n */\nexport interface Shape {\n positions: Float32Array\n indices: Uint32Array\n /** 可选:形状级外观(mesh/brep 双链路产物自解释;worker 序列化保留字段、不保留方法)。 */\n appearance?: PbrAppearance\n /** Phase 2:面级外观分组 [三角形起始, 数量, 外观];存在时优先于 appearance 作为未分组默认。 */\n materialGroups?: Array<{ start: number; count: number; appearance: PbrAppearance }>\n /** Phase 2:顶点颜色(3MF colorgroup / 面级 mesh 链),sRGB 0–1,长度 = positions 长度。 */\n vertexColors?: Float32Array\n /**\n * 零件级说明性元数据(设计文档 2026-10-05-meta §4.3):名称/描述/料号/自定义\n * 键值,随 Shape 走 mesh/brep 双链路、JSON 可序列化。设置方法是 Shape 实例\n * 方法(非 op,见 `api/meta.ts` 的 `ShapeMetaMethods` / `attachMetaMethods`),\n * 方法只挂载在产物构造点(solid/curve)返回的实例上,基础 Shape 保持纯数据\n * 契约——因此本接口**不** extends 方法接口,`isMeshShape` 鸭子判定不受影响。\n */\n meta?: ShapeMeta\n /**\n * 面结构元数据:面序号 → 三角形区间 [start, count)(start/count 为三角形索引,\n * 对应 positions/indices 焊接后的三角形序列)。仅参数化 primitives 构造时记录\n * (面结构构造时已知、三角形顺序固定);manifold 布尔/组合/导入后无 CAD 面\n * 概念,本字段不存在。`setFaceColor`/`setFaceMaterial` 依赖本字段把面序号映射\n * 到三角形区间并写入 materialGroups。\n */\n faceRanges?: Array<{ start: number; count: number }>\n}\n\n/**\n * Structural guard: returns true when the value looks like a mesh Shape\n * (duck-typed via positions/indices, with no requirements on third-party\n * types).\n *\n * Per the keep-syntax design, hosts use this guard to distinguish mesh Shapes\n * from compounds when consuming ExecutionResult.outputs, in the same style as\n * the runtime-internal isShapeLike.\n * @param v - the value to test.\n * @returns true when the value is a mesh Shape.\n */\nexport function isMeshShape(v: unknown): v is Shape {\n return !!v && typeof v === 'object' && 'positions' in v && 'indices' in v\n}\n\n// ── 创建参数 ──\n\n/** Default radial segment count used for rounded geometry. */\nexport const NRAD_DEFAULT = 64\n/** Minimum allowed radial segment count. */\nexport const NRAD_MIN = 3\n/** Maximum allowed radial segment count. */\nexport const NRAD_MAX = 128\n\n/**\n * Clamp an nRad value into the legal range [NRAD_MIN, NRAD_MAX], rounding to\n * the nearest integer; undefined falls back to NRAD_DEFAULT.\n * @param n - the requested radial segment count, or undefined.\n * @returns the clamped radial segment count.\n */\nexport function clampNRad(n: number | undefined): number {\n if (n === undefined) return NRAD_DEFAULT\n return Math.max(NRAD_MIN, Math.min(NRAD_MAX, Math.round(n)))\n}\n\n/**\n * Parameters for creating a box (brepjs `box(width, depth, height, {at?, centered?, segments?})`\n * contract, §4.1 A 决策). Default: min-corner at the origin. `centered: true` shifts so the\n * box is centered at the origin; `at` is CENTER semantics and takes precedence over `centered`.\n */\nexport interface BoxParams {\n /** Side length along X (mm). */\n width: number\n /** Side length along Y (mm). */\n depth: number\n /** Side length along Z (mm). */\n height: number\n /** Center position (brepjs `at`, CENTER semantics); takes precedence over `centered`. */\n at?: Vec3\n /** Center the box at the origin when `at` is absent. Default: false (min-corner at origin). */\n centered?: boolean\n /** Tessellation segment count (box: affects only brep/mesh tessellation, not topology). */\n segments?: number\n /** Internal historical alias for `segments` (accepted by clampNRad, §5.1). */\n nRad?: number\n}\n\n/** Parameters for creating a sphere. */\nexport interface SphereParams {\n radius: number\n segments?: number\n center?: Vec3\n nRad?: number\n}\n\n/** Parameters for creating a cylinder (brepjs contract, §4.3 A). */\nexport interface CylinderParams {\n /** Radius (mm). */\n radius: number\n /** Height along +Z (mm). */\n height: number\n /** Base circle center (brepjs `at`, BASE semantics; default [0, 0, 0]). */\n at?: Vec3\n /** Center the cylinder (base at −h/2 / center at `at`) instead of base at `at`/origin. */\n centered?: boolean\n /** Tessellation segment count (cylinder: affects only tessellation, not topology). */\n segments?: number\n /** Internal historical alias for `segments` (accepted by clampNRad, §5.1). */\n nRad?: number\n}\n\n/** Parameters for creating a cone (or a truncated cone). */\nexport interface ConeParams {\n /** Radius at the base (mm). */\n radiusBottom: number\n /** Radius at the top (mm); 0 for a pointed cone, === radiusBottom for a cylinder. */\n radiusTop: number\n /** Height along +Z (mm). */\n height: number\n /** Base circle center (brepjs `at`, BASE semantics; default [0, 0, 0]). */\n at?: Vec3\n /** Center the cone (base at −h/2 / center at `at`) instead of base at `at`/origin. */\n centered?: boolean\n /** Tessellation segment count (cone: affects only mere tessellation, not topology). */\n segments?: number\n /** Internal historical alias for `segments` (accepted by clampNRad, §5.1). */\n nRad?: number\n}\n\n/**\n * Parameters for creating a wedge (trapezoidal prism).\n */\nexport interface WedgeParams {\n /** Width of the base edge (mm), along the Y axis. */\n width: number\n /** Height of the trapezoid (mm), along the Z axis. */\n height: number\n /** Angle between the base edge and the slope (degrees). */\n angle: number\n /** Total extrusion length (mm), along the X axis. */\n length: number\n center?: Vec3\n nRad?: number\n}\n\n/** Parameters for creating 3D text. */\nexport interface TextParams {\n text: string\n size: number\n depth: number\n}\n\n/** Parameters for extruding an SVG into a solid. */\nexport interface SvgExtrudeParams {\n svg: string\n depth: number\n targetLongSide: number\n naturalWidth?: number\n naturalHeight?: number\n}\n\n/** Parameters for building a solid from an SDF (signed distance function). */\nexport interface SdfParams {\n code: string\n box?: [Vec3, Vec3]\n resolution?: number\n params?: Record<string, number>\n}\n\n// ── 变换参数 ──\n\n/** Parameters for translating a shape. */\nexport interface TranslateParams {\n offset: Vec3\n}\n\n/** Parameters for rotating a shape. */\nexport interface RotateParams {\n angles: Vec3\n pivot?: Vec3\n}\n\n/** Parameters for scaling a shape. */\nexport interface ScaleParams {\n factor: number | Vec3\n}\n\n// ── 布尔参数 ──\n\n/** Kinds of binary boolean operations. */\nexport type BooleanOperation = 'union' | 'subtract' | 'intersect'\n\n// ── 分割参数 ──\n\n/** A cutting plane defined by a unit normal and a signed offset. */\nexport interface SplitPlane {\n normal: Vec3\n offset: number\n}\n\n/** Parameters for a dovetail split, including the cutting plane setup. */\nexport interface DovetailSplitParams {\n plane: SplitPlane\n planeCenter: Vec3\n widthDir: Vec3\n bboxWidthOnWidthDir: number\n groove: {\n depth: number\n depthTolerance: number\n width: number\n widthTolerance: number\n flapsAngle: number\n }\n}\n\n/** Parameters for a dowel-pin split, including the cutting plane setup. */\nexport interface DowelSplitParams {\n plane: SplitPlane\n planeCenter: Vec3\n widthDir: Vec3\n dowel: {\n diameter: number\n diameterTolerance: number\n height: number\n heightTolerance: number\n }\n selectedSections?: number[] | null\n}\n\n/** Parameters for a straight-tenon split, including the cutting plane setup. */\nexport interface TenonSplitParams {\n plane: SplitPlane\n planeCenter: Vec3\n widthDir: Vec3\n tenon: {\n sideLength: number\n sideLengthTolerance: number\n height: number\n heightTolerance: number\n }\n selectedSections?: number[] | null\n}\n\n/** Result of a joinery split: the two halves plus the cut-out wedge. */\nexport interface SplitResult {\n front: Shape\n back: Shape\n wedge: Shape | null\n}\n\n// ── 钻孔参数 ──\n\n/** Parameters for drilling a hole. */\nexport interface DrillParams {\n diameter: number\n depth?: number\n type: 'through' | 'blind'\n position: Vec3\n direction: Vec3\n faceNormal: Vec3\n tolerance?: number\n holeType?: 'simple' | 'screw'\n screwSystem?: string\n screwSpecIdx?: number\n screwThread?: string\n screwHead?: string\n}\n\n// ── 拉伸参数 ──\n\n/** Parameters for extruding a face bounded by a plane. */\nexport interface ExtrudeParams {\n normal: Vec3\n planeDistance: number\n length: number\n mode?: 'centered' | 'forward' | 'backward'\n}\n\n// ── 雕刻参数 ──\n\n/** Parameters for engraving text or an SVG onto a face. */\nexport interface EngraveParams {\n mode: 'convex' | 'concave'\n depth: number\n face: {\n center: Vec3\n normal: Vec3\n }\n text?: string\n textSize?: number\n svg?: string\n svgNaturalWidth?: number\n svgNaturalHeight?: number\n svgSize?: number\n}\n\n/** Parameters for applying a knurl texture to a face. */\nexport interface KnurlParams {\n face: {\n center: Vec3\n normal: Vec3\n }\n knurlTextureHeight: number\n knurlInvertDisplacement: boolean\n knurlRefineLength: number\n knurlScaleU: number\n knurlScaleV: number\n knurlMappingMode: number\n}\n\n// ── 查询结果 ──\n\n/** Axis-aligned bounding box in world space. */\nexport interface BoundingBox {\n min: Vec3\n max: Vec3\n}\n\n/** Description of a face on a shape: center, normal and area. */\nexport interface FaceDescriptor {\n center: Vec3\n normal: Vec3\n area: number\n}\n"]}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Shape } from '../mesh/types.js';
|
|
11
11
|
import type { StepExportEntry } from '../brep/export/step.js';
|
|
12
|
+
import type { FileMeta } from '../api/meta.js';
|
|
12
13
|
import type { ShapeHandle, OcctKernel, WasmTessellatedMesh, Mesh, MeshDeflectionOptions } from './occtKernel.js';
|
|
13
14
|
/** Result of importing a single part from a multi-part STEP file. */
|
|
14
15
|
export interface ImportStepPartResult {
|
|
@@ -87,9 +88,11 @@ export declare function releaseSolid(solid: ShapeHandle): void;
|
|
|
87
88
|
* Hosts no longer need to operate the OCCT kernel directly.
|
|
88
89
|
*
|
|
89
90
|
* @param entries - parts to export; each becomes its own independent entity
|
|
91
|
+
* @param fileMeta - optional file-level metadata; mapped to the P21 header
|
|
92
|
+
* (`rewriteStepHeader`). No effect on geometry/DATA entities.
|
|
90
93
|
* @returns STEP file content as ArrayBuffer
|
|
91
94
|
*/
|
|
92
|
-
export declare function exportStepFromSolidsHighLevel(entries: StepExportEntry[]): Promise<ArrayBuffer>;
|
|
95
|
+
export declare function exportStepFromSolidsHighLevel(entries: StepExportEntry[], fileMeta?: FileMeta): Promise<ArrayBuffer>;
|
|
93
96
|
/**
|
|
94
97
|
* High-level: initialize the OCCT kernel.
|
|
95
98
|
* Returns the cached instance if already initialized.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highLevelApi.d.ts","sourceRoot":"","sources":["../../src/occt-kernel/highLevelApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EAEV,mBAAmB,EACnB,IAAI,EACJ,qBAAqB,EACtB,MAAM,cAAc,CAAA;AAMrB,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,KAAK,EAAE,KAAK,CAAA;IACZ,mFAAmF;IACnF,KAAK,EAAE,WAAW,CAAA;IAClB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,kEAAkE;IAClE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;CACvC;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,WA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;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC,CAE5D;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAGD,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAA"}
|
|
@@ -124,13 +124,15 @@ export function releaseSolid(solid) {
|
|
|
124
124
|
* Hosts no longer need to operate the OCCT kernel directly.
|
|
125
125
|
*
|
|
126
126
|
* @param entries - parts to export; each becomes its own independent entity
|
|
127
|
+
* @param fileMeta - optional file-level metadata; mapped to the P21 header
|
|
128
|
+
* (`rewriteStepHeader`). No effect on geometry/DATA entities.
|
|
127
129
|
* @returns STEP file content as ArrayBuffer
|
|
128
130
|
*/
|
|
129
|
-
export async function exportStepFromSolidsHighLevel(entries) {
|
|
131
|
+
export async function exportStepFromSolidsHighLevel(entries, fileMeta) {
|
|
130
132
|
// step.ts consumes the L1 contract — pass the adapter, not the raw kernel
|
|
131
133
|
// (no cross-layer assertion; narrowing plan §Phase 3).
|
|
132
134
|
const primitives = await createOcctPrimitives();
|
|
133
|
-
return exportStepFromSolids(primitives, entries);
|
|
135
|
+
return exportStepFromSolids(primitives, entries, fileMeta);
|
|
134
136
|
}
|
|
135
137
|
// ── 管理函数 ──
|
|
136
138
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highLevelApi.js","sourceRoot":"","sources":["../../src/occt-kernel/highLevelApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAW1D,OAAO,EAAE,oBAAoB,EAAE,MAAM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AAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,WAAW;QACzB,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAA;AACH,CAAC;AAUD;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,KAAY,EACZ,OAA2B;IAE3B,OAAO,YAAY,CACjB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,OAAO,EACb,OAAO,EAAE,SAAS,IAAI,IAAI,CAC3B,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAkB;IAC7C,YAAY,CAAC,KAAK,CAAC,CAAA;AACrB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAA0B;IAE1B,0EAA0E;IAC1E,uDAAuD;IACvD,MAAM,UAAU,GAAG,MAAM,oBAAoB,EAAE,CAAA;IAC/C,OAAO,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;AAClD,CAAC;AAED,aAAa;AAEb;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,YAAY,EAAoC,CAAA;AACzD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,eAAe,EAAE,CAAA;AACnB,CAAC","sourcesContent":["/**\n * OCCT 高层 API — E12.2\n *\n * 宿主不应再直接 import 底层 OCCT kernel 函数(initOcctWasm/importStepToMesh/meshesToStep 等),\n * 而是使用这些高层 API。\n *\n * 高层 API 封装了初始化、导入、导出的完整流程,\n * 返回标准化的 Shape / 拓扑数据 / STEP 字节流。\n */\n\nimport {\n initOcctWasm,\n disposeOcctWasm,\n importStepToMesh,\n importBrepToMesh,\n meshesToStep,\n releaseShape,\n importAssemblyFromStep,\n collectLeafParts,\n releaseAssemblyTree,\n computeEffectiveDeflection,\n} from './occtKernel'\nimport type { Shape } from '../mesh/types'\nimport { exportStepFromSolids } from '../brep/export/step'\nimport type { StepExportEntry } from '../brep/export/step'\nimport type {\n ShapeHandle,\n OcctKernel,\n WasmImportResult,\n WasmTessellatedMesh,\n Mesh,\n MeshDeflectionOptions,\n} from './occtKernel'\n\nimport { createOcctPrimitives } from './occt-primitives'\n\n// ── 导入 API ──\n\n/** Result of importing a single part from a multi-part STEP file. */\nexport interface ImportStepPartResult {\n /** The part's mesh (positions + indices). */\n shape: Shape\n /** OCCT solid handle (with location, for later BREP operations or STEP export). */\n solid: ShapeHandle\n /** Part name (from the XCAF label). */\n name: string\n /** Part color [r,g,b] in 0..1, or null when there is no color. */\n color: [number, number, number] | null\n}\n\n/**\n * High-level: import multi-part mesh + solid from a STEP file byte stream.\n *\n * Uses XCAF assembly-tree parsing, keeping each part's mesh and solid independent.\n * Unlike importStep, this does not merge meshes — each part returns its own shape.\n *\n * @param bytes - STEP file byte stream\n * @returns an array of per-part import results\n */\nexport async function importStepMultiPart(\n bytes: ArrayBuffer | Uint8Array,\n): Promise<ImportStepPartResult[]> {\n const kernel = await initOcctWasm()\n\n // XCAF 解析 → 装配树\n const nodes = await importAssemblyFromStep(bytes)\n const leaves = collectLeafParts(nodes)\n\n const results: ImportStepPartResult[] = []\n for (const leaf of leaves) {\n if (!leaf.shapeHandle) continue\n\n const eff = computeEffectiveDeflection(kernel, leaf.shapeHandle)\n const mesh = kernel.meshShape(leaf.shapeHandle, {\n linearDeflection: eff.linearDeflection,\n angularDeflection: eff.angularDeflection,\n })\n\n results.push({\n shape: {\n positions: mesh.positions,\n indices: mesh.indices,\n },\n solid: leaf.shapeHandle,\n name: leaf.name,\n color: leaf.color,\n })\n }\n\n // 释放装配树中非 leaf 的 shapeHandle(assembly 节点的已由 walkLabel 释放)\n // leaf 的 shapeHandle 由返回结果持有,调用方负责释放\n releaseAssemblyTree(kernel, nodes.filter(n => n.isAssembly))\n\n return results\n}\n\n/** Result of importing a STEP/BREP file. */\nexport interface ImportStepResult {\n /** The merged mesh (all parts' positions/indices combined). */\n shape: Shape\n /** Each part's mesh (for topology building). */\n meshes: WasmTessellatedMesh[]\n /** OCCT solid handle (for later BREP operations or STEP export). */\n solid: ShapeHandle\n /** Face-group information (for topology building). */\n meshWithGroups: Mesh\n}\n\n/**\n * High-level: import mesh + solid from a STEP/BREP file byte stream.\n *\n * Wraps the full importStepToMesh/importBrepToMesh + mesh merge flow.\n * Hosts no longer need to operate the OCCT kernel directly.\n *\n * @param bytes - STEP/BREP file byte stream\n * @param format - the file format: 'step' | 'brep'\n * @param options - optional mesh deflection options\n * @returns the import result\n */\nexport async function importStep(\n bytes: ArrayBuffer | Uint8Array | string,\n format: 'step' | 'brep' = 'step',\n options?: MeshDeflectionOptions,\n): Promise<ImportStepResult> {\n const result: WasmImportResult = format === 'brep'\n ? await importBrepToMesh(bytes as string, options)\n : await importStepToMesh(bytes as ArrayBuffer | Uint8Array, options)\n\n // 合并所有 mesh 的 positions/indices\n let totalPositions = 0\n let totalIndices = 0\n for (const mesh of result.meshes) {\n totalPositions += mesh.positions.length\n totalIndices += mesh.indices.length\n }\n\n const positions = new Float32Array(totalPositions)\n const indices = new Uint32Array(totalIndices)\n let posOffset = 0\n let idxOffset = 0\n let idxBase = 0\n for (const mesh of result.meshes) {\n positions.set(mesh.positions, posOffset)\n posOffset += mesh.positions.length\n // 需要偏移索引\n for (let i = 0; i < mesh.indices.length; i++) {\n indices[idxOffset + i] = mesh.indices[i] + idxBase\n }\n idxOffset += mesh.indices.length\n idxBase += mesh.positions.length / 3\n }\n\n return {\n shape: { positions, indices },\n meshes: result.meshes,\n solid: result.shapeHandle,\n meshWithGroups: result.meshWithGroups,\n }\n}\n\n// ── 导出 API ──\n\n/** Options for exporting mesh data to a STEP string. */\nexport interface ExportStepOptions {\n /** Sewing tolerance. */\n tolerance?: number\n}\n\n/**\n * High-level: export mesh data as a STEP string.\n *\n * Wraps the full meshesToStep flow. Hosts no longer need to operate the OCCT kernel directly.\n *\n * @param shape - mesh data (positions + indices)\n * @param options - optional export options (sewing tolerance)\n * @returns the STEP file text content\n */\nexport function exportStep(\n shape: Shape,\n options?: ExportStepOptions,\n): string {\n return meshesToStep(\n shape.positions,\n shape.indices,\n options?.tolerance ?? 0.01,\n )\n}\n\n/**\n * High-level: release an OCCT solid handle.\n *\n * Wraps the full releaseShape flow.\n *\n * @param solid - the solid handle to release\n */\nexport function releaseSolid(solid: ShapeHandle): void {\n releaseShape(solid)\n}\n\n/**\n * High-level: multi-solid STEP export (zero fuse).\n *\n * Each entry is exported as an independent entity in the STEP (independent XCAF\n * label / PRODUCT), preserving name and color. Multiple solids are never fused.\n *\n * Wraps the full ensureOcctKernel + exportStepFromSolids flow.\n * Hosts no longer need to operate the OCCT kernel directly.\n *\n * @param entries - parts to export; each becomes its own independent entity\n * @returns STEP file content as ArrayBuffer\n */\nexport async function exportStepFromSolidsHighLevel(\n entries: StepExportEntry[],\n): Promise<ArrayBuffer> {\n // step.ts consumes the L1 contract — pass the adapter, not the raw kernel\n // (no cross-layer assertion; narrowing plan §Phase 3).\n const primitives = await createOcctPrimitives()\n return exportStepFromSolids(primitives, entries)\n}\n\n// ── 管理函数 ──\n\n/**\n * High-level: initialize the OCCT kernel.\n * Returns the cached instance if already initialized.\n *\n * @returns the initialized OCCT kernel\n */\nexport async function ensureOcctKernel(): Promise<OcctKernel> {\n return initOcctWasm() as unknown as Promise<OcctKernel>\n}\n\n/**\n * High-level: dispose the OCCT kernel.\n * Call when unloading the page or releasing WASM memory.\n */\nexport function disposeOcct(): void {\n disposeOcctWasm()\n}\n\n// Re-export 底层类型供高层 API 用户使用\nexport type { OcctKernel, ShapeHandle, WasmTessellatedMesh, Mesh, MeshDeflectionOptions }\n"]}
|
|
1
|
+
{"version":3,"file":"highLevelApi.js","sourceRoot":"","sources":["../../src/occt-kernel/highLevelApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB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CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAA;QACpD,CAAC;QACD,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;QAChC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAA;IACtC,CAAC;IAED,OAAO;QACL,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,WAAW;QACzB,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAA;AACH,CAAC;AAUD;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,KAAY,EACZ,OAA2B;IAE3B,OAAO,YAAY,CACjB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,OAAO,EACb,OAAO,EAAE,SAAS,IAAI,IAAI,CAC3B,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAkB;IAC7C,YAAY,CAAC,KAAK,CAAC,CAAA;AACrB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAA0B,EAC1B,QAAmB;IAEnB,0EAA0E;IAC1E,uDAAuD;IACvD,MAAM,UAAU,GAAG,MAAM,oBAAoB,EAAE,CAAA;IAC/C,OAAO,oBAAoB,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AAC5D,CAAC;AAED,aAAa;AAEb;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,YAAY,EAAoC,CAAA;AACzD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,eAAe,EAAE,CAAA;AACnB,CAAC","sourcesContent":["/**\n * OCCT 高层 API — E12.2\n *\n * 宿主不应再直接 import 底层 OCCT kernel 函数(initOcctWasm/importStepToMesh/meshesToStep 等),\n * 而是使用这些高层 API。\n *\n * 高层 API 封装了初始化、导入、导出的完整流程,\n * 返回标准化的 Shape / 拓扑数据 / STEP 字节流。\n */\n\nimport {\n initOcctWasm,\n disposeOcctWasm,\n importStepToMesh,\n importBrepToMesh,\n meshesToStep,\n releaseShape,\n importAssemblyFromStep,\n collectLeafParts,\n releaseAssemblyTree,\n computeEffectiveDeflection,\n} from './occtKernel'\nimport type { Shape } from '../mesh/types'\nimport { exportStepFromSolids } from '../brep/export/step'\nimport type { StepExportEntry } from '../brep/export/step'\nimport type { FileMeta } from '../api/meta'\nimport type {\n ShapeHandle,\n OcctKernel,\n WasmImportResult,\n WasmTessellatedMesh,\n Mesh,\n MeshDeflectionOptions,\n} from './occtKernel'\n\nimport { createOcctPrimitives } from './occt-primitives'\n\n// ── 导入 API ──\n\n/** Result of importing a single part from a multi-part STEP file. */\nexport interface ImportStepPartResult {\n /** The part's mesh (positions + indices). */\n shape: Shape\n /** OCCT solid handle (with location, for later BREP operations or STEP export). */\n solid: ShapeHandle\n /** Part name (from the XCAF label). */\n name: string\n /** Part color [r,g,b] in 0..1, or null when there is no color. */\n color: [number, number, number] | null\n}\n\n/**\n * High-level: import multi-part mesh + solid from a STEP file byte stream.\n *\n * Uses XCAF assembly-tree parsing, keeping each part's mesh and solid independent.\n * Unlike importStep, this does not merge meshes — each part returns its own shape.\n *\n * @param bytes - STEP file byte stream\n * @returns an array of per-part import results\n */\nexport async function importStepMultiPart(\n bytes: ArrayBuffer | Uint8Array,\n): Promise<ImportStepPartResult[]> {\n const kernel = await initOcctWasm()\n\n // XCAF 解析 → 装配树\n const nodes = await importAssemblyFromStep(bytes)\n const leaves = collectLeafParts(nodes)\n\n const results: ImportStepPartResult[] = []\n for (const leaf of leaves) {\n if (!leaf.shapeHandle) continue\n\n const eff = computeEffectiveDeflection(kernel, leaf.shapeHandle)\n const mesh = kernel.meshShape(leaf.shapeHandle, {\n linearDeflection: eff.linearDeflection,\n angularDeflection: eff.angularDeflection,\n })\n\n results.push({\n shape: {\n positions: mesh.positions,\n indices: mesh.indices,\n },\n solid: leaf.shapeHandle,\n name: leaf.name,\n color: leaf.color,\n })\n }\n\n // 释放装配树中非 leaf 的 shapeHandle(assembly 节点的已由 walkLabel 释放)\n // leaf 的 shapeHandle 由返回结果持有,调用方负责释放\n releaseAssemblyTree(kernel, nodes.filter(n => n.isAssembly))\n\n return results\n}\n\n/** Result of importing a STEP/BREP file. */\nexport interface ImportStepResult {\n /** The merged mesh (all parts' positions/indices combined). */\n shape: Shape\n /** Each part's mesh (for topology building). */\n meshes: WasmTessellatedMesh[]\n /** OCCT solid handle (for later BREP operations or STEP export). */\n solid: ShapeHandle\n /** Face-group information (for topology building). */\n meshWithGroups: Mesh\n}\n\n/**\n * High-level: import mesh + solid from a STEP/BREP file byte stream.\n *\n * Wraps the full importStepToMesh/importBrepToMesh + mesh merge flow.\n * Hosts no longer need to operate the OCCT kernel directly.\n *\n * @param bytes - STEP/BREP file byte stream\n * @param format - the file format: 'step' | 'brep'\n * @param options - optional mesh deflection options\n * @returns the import result\n */\nexport async function importStep(\n bytes: ArrayBuffer | Uint8Array | string,\n format: 'step' | 'brep' = 'step',\n options?: MeshDeflectionOptions,\n): Promise<ImportStepResult> {\n const result: WasmImportResult = format === 'brep'\n ? await importBrepToMesh(bytes as string, options)\n : await importStepToMesh(bytes as ArrayBuffer | Uint8Array, options)\n\n // 合并所有 mesh 的 positions/indices\n let totalPositions = 0\n let totalIndices = 0\n for (const mesh of result.meshes) {\n totalPositions += mesh.positions.length\n totalIndices += mesh.indices.length\n }\n\n const positions = new Float32Array(totalPositions)\n const indices = new Uint32Array(totalIndices)\n let posOffset = 0\n let idxOffset = 0\n let idxBase = 0\n for (const mesh of result.meshes) {\n positions.set(mesh.positions, posOffset)\n posOffset += mesh.positions.length\n // 需要偏移索引\n for (let i = 0; i < mesh.indices.length; i++) {\n indices[idxOffset + i] = mesh.indices[i] + idxBase\n }\n idxOffset += mesh.indices.length\n idxBase += mesh.positions.length / 3\n }\n\n return {\n shape: { positions, indices },\n meshes: result.meshes,\n solid: result.shapeHandle,\n meshWithGroups: result.meshWithGroups,\n }\n}\n\n// ── 导出 API ──\n\n/** Options for exporting mesh data to a STEP string. */\nexport interface ExportStepOptions {\n /** Sewing tolerance. */\n tolerance?: number\n}\n\n/**\n * High-level: export mesh data as a STEP string.\n *\n * Wraps the full meshesToStep flow. Hosts no longer need to operate the OCCT kernel directly.\n *\n * @param shape - mesh data (positions + indices)\n * @param options - optional export options (sewing tolerance)\n * @returns the STEP file text content\n */\nexport function exportStep(\n shape: Shape,\n options?: ExportStepOptions,\n): string {\n return meshesToStep(\n shape.positions,\n shape.indices,\n options?.tolerance ?? 0.01,\n )\n}\n\n/**\n * High-level: release an OCCT solid handle.\n *\n * Wraps the full releaseShape flow.\n *\n * @param solid - the solid handle to release\n */\nexport function releaseSolid(solid: ShapeHandle): void {\n releaseShape(solid)\n}\n\n/**\n * High-level: multi-solid STEP export (zero fuse).\n *\n * Each entry is exported as an independent entity in the STEP (independent XCAF\n * label / PRODUCT), preserving name and color. Multiple solids are never fused.\n *\n * Wraps the full ensureOcctKernel + exportStepFromSolids flow.\n * Hosts no longer need to operate the OCCT kernel directly.\n *\n * @param entries - parts to export; each becomes its own independent entity\n * @param fileMeta - optional file-level metadata; mapped to the P21 header\n * (`rewriteStepHeader`). No effect on geometry/DATA entities.\n * @returns STEP file content as ArrayBuffer\n */\nexport async function exportStepFromSolidsHighLevel(\n entries: StepExportEntry[],\n fileMeta?: FileMeta,\n): Promise<ArrayBuffer> {\n // step.ts consumes the L1 contract — pass the adapter, not the raw kernel\n // (no cross-layer assertion; narrowing plan §Phase 3).\n const primitives = await createOcctPrimitives()\n return exportStepFromSolids(primitives, entries, fileMeta)\n}\n\n// ── 管理函数 ──\n\n/**\n * High-level: initialize the OCCT kernel.\n * Returns the cached instance if already initialized.\n *\n * @returns the initialized OCCT kernel\n */\nexport async function ensureOcctKernel(): Promise<OcctKernel> {\n return initOcctWasm() as unknown as Promise<OcctKernel>\n}\n\n/**\n * High-level: dispose the OCCT kernel.\n * Call when unloading the page or releasing WASM memory.\n */\nexport function disposeOcct(): void {\n disposeOcctWasm()\n}\n\n// Re-export 底层类型供高层 API 用户使用\nexport type { OcctKernel, ShapeHandle, WasmTessellatedMesh, Mesh, MeshDeflectionOptions }\n"]}
|
|
@@ -337,7 +337,7 @@ export async function createOcctPrimitives() {
|
|
|
337
337
|
// pass through the projection result; callers treat it as opaque (unknown).
|
|
338
338
|
k.projectEdges(asShape(shape), origin, direction, xAxis),
|
|
339
339
|
// ── measurement ──
|
|
340
|
-
getBoundingBox: (shape, useTriangulation) => k.getBoundingBox(asShape(shape), useTriangulation),
|
|
340
|
+
getBoundingBox: (shape, useTriangulation) => k.getBoundingBox(asShape(shape), useTriangulation ?? false),
|
|
341
341
|
getVolume: (shape) => k.getVolume(asShape(shape)),
|
|
342
342
|
getCenterOfMass: (shape) => v3(k.getCenterOfMass(asShape(shape))),
|
|
343
343
|
getSurfaceArea: (shape) => k.getSurfaceArea(asShape(shape)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"occt-primitives.js","sourceRoot":"","sources":["../../src/occt-kernel/occt-primitives.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAahE,MAAM,QAAQ,GAAG,CAAC,CAAuB,EAAc,EAAE,CAAC,CAAe,CAAA;AACzE,MAAM,OAAO,GAAG,CAAC,CAAa,EAAe,EAAE,CAAC,CAA2B,CAAA;AAC3E,MAAM,MAAM,GAAG,CAAC,EAAgB,EAAiB,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AACnE,MAAM,EAAE,GAAG,CAAC,CAAO,EAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,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AK,CAAC,CAAC;QACnD,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChD,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE9C,sCAAsC;QACtC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,CACxD,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;QACxF,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,CACzD,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;QACzF,oBAAoB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,CAC9D,WAAW,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;KAC/F,CAAA;IAED,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["/**\n * occt-kernel/occt-primitives — `createOcctPrimitives()`: the L1 contract\n * (`BrepEngineApi`) adapter over the raw occt-wasm `OcctKernel` singleton.\n *\n * Plan Phase 3.2 (docs/plans/2026-09-24-brep-engine-api-narrowing-native-access.md):\n * explicit object literal, one method per L1 contract member — no monkey\n * patching, no cross-layer assertion lies, no unsupported() stubs. Every member\n * here is either a direct pass-through to the native kernel or an adapter-side\n * dialect digestion, both honestly implementing the contract.\n *\n * Occt-only capabilities (loft family, tool-entity section/split, *WithHistory\n * beyond the L1 trio, XCAF, SVG projection …) are deliberately NOT here —\n * platform code reaches them through the native face: `getOcctKernel()` (D3).\n */\nimport type {\n EdgeData,\n EvolutionData,\n Mesh,\n OcctKernel,\n ShapeHandle,\n Vec3,\n} from 'occt-wasm'\nimport { initOcctWasm } from './occtKernel'\nimport { hullFromPoints as hullFromPointsCore } from './hullOps'\nimport type { AssertSatisfiesBrepEngineApi, BrepEngineApi } from '../brep/engine/primitives'\nimport type {\n BrepBoundingBox,\n BrepCurveParameters,\n BrepEdgeData,\n BrepEvolutionData,\n BrepHandle,\n BrepMeshResult,\n BrepUvBounds,\n BrepVec3,\n} from '../brep/engine/types'\n\nconst asHandle = (h: number | ShapeHandle): BrepHandle => h as BrepHandle\nconst asShape = (h: BrepHandle): ShapeHandle => h as unknown as ShapeHandle\nconst shapes = (hs: BrepHandle[]): ShapeHandle[] => hs.map(asShape)\nconst v3 = (v: Vec3): BrepVec3 => ({ x: v.x, y: v.y, z: v.z })\nconst rad = (deg: number): number => (deg * Math.PI) / 180\n\n/** brepjs topology layer uses this upper bound for face hashes (HASH_CODE_MAX). */\nconst HASH_UPPER_BOUND = 2 ** 24\n\n/** occt-wasm native linearPattern/circularPattern return ONE compound handle\n * containing all replicas (the wasm d.ts type lies by claiming a plain handle).\n * The adapter captures the native methods, then splits the compound via\n * getSubShapes('solid') into the BrepHandle[] the L1 contract promises. */\ntype OcctPatternRaw = {\n linearPattern(shape: ShapeHandle, direction: Vec3, spacing: number, count: number): ShapeHandle\n circularPattern(shape: ShapeHandle, center: Vec3, axis: Vec3, angle: number, count: number): ShapeHandle\n}\n\n/**\n * Build a large planar face (boolean tool) through `point`, oriented by\n * `normal`. The face is constructed directly in the plane's own basis\n * (u ⊥ v ⊥ normal, through point) — no post-rotation needed, any normal\n * direction works (the Phase 1 probe only pinned +Z; this generalizes it).\n */\nfunction makePlanarFaceTool(k: OcctKernel, point: BrepVec3, normal: BrepVec3): ShapeHandle {\n const size = 500 // large enough to fully cut any reasonable solid\n // Pick the axis component with the smallest magnitude to build a stable\n // perpendicular basis (avoids degeneracy when normal is axis-aligned).\n const ax = Math.abs(normal.x)\n const ay = Math.abs(normal.y)\n const az = Math.abs(normal.z)\n let u: BrepVec3\n if (ax <= ay && ax <= az) u = { x: 0, y: -normal.z, z: normal.y }\n else if (ay <= az) u = { x: -normal.z, y: 0, z: normal.x }\n else u = { x: normal.y, y: -normal.x, z: 0 }\n const ul = Math.hypot(u.x, u.y, u.z)\n u = { x: u.x / ul, y: u.y / ul, z: u.z / ul }\n const v: BrepVec3 = {\n x: normal.y * u.z - normal.z * u.y,\n y: normal.z * u.x - normal.x * u.z,\n z: normal.x * u.y - normal.y * u.x,\n }\n const corner = (a: number, b: number): Vec3 => ({\n x: point.x + (u.x * a + v.x * b) * size,\n y: point.y + (u.y * a + v.y * b) * size,\n z: point.z + (u.z * a + v.z * b) * size,\n })\n const e1 = k.makeLineEdge(corner(-1, -1), corner(1, -1))\n const e2 = k.makeLineEdge(corner(1, -1), corner(1, 1))\n const e3 = k.makeLineEdge(corner(1, 1), corner(-1, 1))\n const e4 = k.makeLineEdge(corner(-1, 1), corner(-1, -1))\n const wire = k.makeWire([e1, e2, e3, e4])\n const face = k.makeFace(wire)\n k.release(wire)\n return face\n}\n\n/**\n * Create the occt implementation of the L1 engine contract. Idempotent-friendly:\n * the wasm kernel is a process-level singleton (see initOcctWasm), each call\n * returns a fresh adapter object over the same kernel.\n *\n * @returns a BrepEngineApi implementation backed by the occt wasm kernel.\n */\nexport async function createOcctPrimitives(): Promise<BrepEngineApi> {\n const k = await initOcctWasm()\n const raw = k as unknown as OcctPatternRaw\n // Capture native pattern methods BEFORE any wiring so gridPattern composes\n // on true native semantics (old adapter GOTCHA: after overwriting, calling\n // the property again recurses into the wrapper).\n const nativeLinearPattern = raw.linearPattern.bind(k)\n // 2026-09-25 core-decouple Phase 2(§5.1):hull 最小闭包已移植进 occt-kernel/\n // (hullGeometry + hullOps,occt-wasm 原生直调),此处不再经 vendored\n // OcctWasmAdapter——core 自有引擎对 brepjs 适配器的最后一处依赖已拔除。\n\n const splitCompoundToArray = (compound: ShapeHandle): BrepHandle[] => {\n const parts = k.getSubShapes(compound, 'solid').map(asHandle)\n k.release(compound)\n return parts\n }\n\n const toEvolution = (e: EvolutionData): BrepEvolutionData => ({\n // occt-wasm's EvolutionData already carries the segmented\n // [inHash, count, outHash…] encoding pinned by phase0-kernel-probes\n // (its own docs claim flat maps — docs are wrong, data is segmented).\n result: asHandle(e.result),\n modified: e.modified,\n generated: e.generated,\n deleted: e.deleted,\n })\n\n const primitives: BrepEngineApi = {\n // ── lifecycle ──\n release: (shape) => k.release(asShape(shape)),\n dispose: (shape) => {\n if (shape !== undefined) k.release(asShape(shape))\n },\n\n // ── solids ──\n makeBox: (dx, dy, dz) => asHandle(k.makeBox(dx, dy, dz)),\n makeBoxFromCorners: (c1, c2) => asHandle(k.makeBoxFromCorners(c1, c2)),\n makeCylinder: (radius, height) => asHandle(k.makeCylinder(radius, height)),\n makeSphere: (radius) => asHandle(k.makeSphere(radius)),\n makeCone: (r1, r2, height) => asHandle(k.makeCone(r1, r2, height)),\n makeRectangle: (w, h) => asHandle(k.makeRectangle(w, h)),\n makeEllipsoid: (rx, ry, rz) => asHandle(k.makeEllipsoid(rx, ry, rz)),\n makeTorus: (major, minor) => asHandle(k.makeTorus(major, minor)),\n makeVertex: (x, y, z) => asHandle(k.makeVertex(x, y, z)),\n\n // ── shaping ──\n extrude: (shape, dx, dy, dz) => asHandle(k.extrude(asShape(shape), dx, dy, dz)),\n revolveVec: (shape, center, direction, angleDeg) =>\n asHandle(k.revolve(asShape(shape), { point: center, direction }, rad(angleDeg))),\n sew: (list, tolerance) => asHandle(k.sew(shapes(list), tolerance)),\n sewAndSolidify: (faces, tolerance) => asHandle(k.sewAndSolidify(shapes(faces), tolerance)),\n shell: (solid, facesToRemove, thickness, tolerance) =>\n asHandle(k.shell(asShape(solid), shapes(facesToRemove), thickness, tolerance)),\n hullFromPoints: (points, tolerance) => hullFromPointsCore(k, points as never, tolerance),\n\n // ── booleans & splitting ──\n fuse: (a, b) => asHandle(k.fuse(asShape(a), asShape(b))),\n cut: (a, b) => asHandle(k.cut(asShape(a), asShape(b))),\n common: (a, b) => asHandle(k.common(asShape(a), asShape(b))),\n intersect: (a, b) => asHandle(k.intersect(asShape(a), asShape(b))),\n fuseAll: (list) => asHandle(k.fuseAll(shapes(list))),\n sectionByPlane: (shape, point, normal) => {\n // Phase 1 probe A (phase1-semantic-probes.test.ts): a planar face used as\n // the section tool yields the plane-section geometry. Downcast the result\n // compound into edge/wire handles; a non-compound result passes through.\n const tool = makePlanarFaceTool(k, point, normal)\n try {\n const result = k.section(asShape(shape), tool)\n if (k.isNull(result)) return []\n const out: BrepHandle[] = []\n for (const t of ['edge', 'wire'] as const) {\n for (const part of k.getSubShapes(result, t)) out.push(asHandle(k.downcast(part, t)))\n }\n if (out.length === 0) {\n // No intersection: native section still yields an (empty) compound —\n // release it and return an empty list so callers can detect the miss\n // instead of adopting an empty compound as a \"curve\".\n k.release(result)\n return []\n }\n k.release(result)\n return out\n } finally {\n k.release(tool)\n }\n },\n splitByPlane: (shape, point, normal) => {\n // Phase 1 probe A: splitter with a planar face tool yields exactly 2 solids.\n const tool = makePlanarFaceTool(k, point, normal)\n try {\n const result = k.split(asShape(shape), [tool])\n if (k.isNull(result)) throw new Error('splitByPlane: splitter produced no result')\n const solids = k.getSubShapes(result, 'solid').map(asHandle)\n k.release(result)\n if (solids.length !== 2) {\n throw new Error(`splitByPlane: expected 2 solids, got ${solids.length}`)\n }\n // Classify sides by centroid projection onto the plane normal.\n const originDot = point.x * normal.x + point.y * normal.y + point.z * normal.z\n const side = (h: BrepHandle): number => {\n const c = k.getCenterOfMass(asShape(h))\n return c.x * normal.x + c.y * normal.y + c.z * normal.z - originDot\n }\n const [a, b] = solids\n return side(a) >= side(b)\n ? { positive: a, negative: b }\n : { positive: b, negative: a }\n } finally {\n k.release(tool)\n }\n },\n\n // ── chamfer & fillet ──\n chamfer: (solid, edgesList, distance) =>\n asHandle(k.chamfer(asShape(solid), shapes(edgesList), distance)),\n chamferDistAngle: (solid, edgesList, distance, angleDeg) =>\n asHandle(k.chamferDistAngle(asShape(solid), shapes(edgesList), distance, angleDeg)),\n fillet: (solid, edgesList, radius) =>\n asHandle(k.fillet(asShape(solid), shapes(edgesList), radius)),\n filletVariable: (solid, edge, startRadius, endRadius) =>\n asHandle(k.filletVariable(asShape(solid), asShape(edge), startRadius, endRadius)),\n filletWithHistory: (solid, edgesList, radius, inputFaceHashes, hashUpperBound) =>\n toEvolution(k.filletWithHistory(asShape(solid), shapes(edgesList), radius, inputFaceHashes, hashUpperBound)),\n\n // ── transforms (matrix convention: 3×4 row-major, 12 doubles) ──\n translate: (shape, dx, dy, dz) => asHandle(k.translate(asShape(shape), dx, dy, dz)),\n scale: (shape, center, factor) => asHandle(k.scale(asShape(shape), center, factor)),\n transform: (shape, matrix) => asHandle(k.transform(asShape(shape), matrix)),\n located: (shape, matrix) => asHandle(k.located(asShape(shape), matrix)),\n locate: (shape, matrix) => asHandle(k.located(asShape(shape), matrix)),\n generalTransform: (shape, matrix) => asHandle(k.generalTransform(asShape(shape), matrix)),\n copy: (shape) => asHandle(k.copy(asShape(shape))),\n copyShape: (shape) => asHandle(k.copy(asShape(shape))),\n composeTransform: (m1, m2) => k.composeTransform(m1, m2),\n mirror: (shape, point, normal) => asHandle(k.mirror(asShape(shape), point, normal)),\n\n // ── patterns ──\n // GOTCHA: occt-wasm native linearPattern/circularPattern return ONE compound\n // handle (their d.ts type lies). Split it into per-replica handles here.\n linearPattern: (shape, direction, spacing, count) => {\n const compound = nativeLinearPattern(asShape(shape), direction, spacing, count)\n return splitCompoundToArray(compound)\n },\n circularPattern: (shape, center, axis, angleStep, count) => {\n // Empirically validated (old adapter + engine-switch-p2 parity): the wasm\n // layer takes the angle in DEGREES here (unlike revolve's angleRad).\n const compound = (k as unknown as OcctPatternRaw).circularPattern.call(\n k, asShape(shape), center, axis, angleStep, count,\n )\n return splitCompoundToArray(compound)\n },\n gridPattern: (shape, directionX, directionY, spacingX, spacingY, countX, countY) => {\n // Composed: native linearPattern along X per column, then along Y per row,\n // fuse all replicas. Must use the CAPTURED native linearPattern (returns\n // compound) — the adapter property above now returns arrays.\n const colCompound = nativeLinearPattern(asShape(shape), directionX, spacingX, countX)\n const cols = k.getSubShapes(colCompound, 'solid')\n k.release(colCompound)\n const all: ShapeHandle[] = []\n try {\n for (const c of cols) {\n const rowCompound = nativeLinearPattern(c, directionY, spacingY, countY)\n try {\n all.push(...k.getSubShapes(rowCompound, 'solid'))\n } finally {\n k.release(rowCompound)\n }\n }\n } finally {\n for (const c of cols) k.release(c)\n }\n return asHandle(k.fuseAll(all))\n },\n\n // ── curve construction ──\n makeLineEdge: (start, end) => asHandle(k.makeLineEdge(start, end)),\n makeArcEdge: (start, mid, end) => asHandle(k.makeArcEdge(start, mid, end)),\n makeBezierEdge: (controlPoints) => asHandle(k.makeBezierEdge(controlPoints)),\n makeBSplineEdge: (poles, weights, knots, multiplicities, degree, periodic) =>\n asHandle(k.makeBSplineEdge(poles, weights, knots, multiplicities, degree, periodic ?? false)),\n makeCircleEdge: (center, normal, radius) =>\n asHandle(k.makeCircleEdge(center, normal, radius)),\n\n // ── topology construction ──\n makeWire: (edgesList) => asHandle(k.makeWire(shapes(edgesList))),\n makeFace: (wire) => asHandle(k.makeFace(asShape(wire))),\n makeCompound: (list) => asHandle(k.makeCompound(shapes(list))),\n addHolesInFace: (face, holeWires) =>\n asHandle(k.addHolesInFace(asShape(face), shapes(holeWires))),\n buildTriFace: (a, b, c) => asHandle(k.buildTriFace(a, b, c)),\n\n // ── tessellation (the only BREP→mesh exit) ──\n meshShape: (shape, options): BrepMeshResult => {\n const m: Mesh = k.meshShape(asShape(shape), options)\n return {\n positions: m.positions,\n normals: m.normals,\n indices: m.indices,\n vertexCount: m.vertexCount,\n triangleCount: m.triangleCount,\n faceGroups: m.faceGroups,\n faceCount: m.faceCount,\n }\n },\n wireframe: (shape, deflection): BrepEdgeData => {\n const e: EdgeData = k.wireframe(asShape(shape), deflection)\n return {\n points: e.points,\n edgeGroups: e.edgeGroups,\n pointCount: e.pointCount,\n edgeCount: e.edgeCount,\n }\n },\n\n // ── topology queries ──\n getSubShapes: (shape, type) => k.getSubShapes(asShape(shape), type).map(asHandle),\n subShapeHashes: (shape, type, hashUpperBound) =>\n k.subShapeHashes(asShape(shape), type, hashUpperBound),\n hashCode: (shape, upperBound) => k.hashCode(asShape(shape), upperBound),\n isSame: (a, b) => k.isSame(asShape(a), asShape(b)),\n isSolid: (shape) => k.isSolid(asShape(shape)),\n shapeType: (shape) => k.getShapeType(asShape(shape)),\n shapeOrientation: (shape) => String(k.shapeOrientation(asShape(shape))),\n edgeToFaceMap: (shape) => k.edgeToFaceMap(asShape(shape), HASH_UPPER_BOUND),\n adjacentFaces: (shape, face) =>\n k.adjacentFaces(asShape(shape), asShape(face)).map(asHandle),\n sharedEdges: (a, b) => k.sharedEdges(asShape(a), asShape(b)).map(asHandle),\n\n // ── geometry evaluation ──\n curveType: (edge) => String(k.curveType(asShape(edge))),\n curvePointAtParam: (edge, param) => v3(k.curvePointAtParam(asShape(edge), param)),\n curveTangent: (edge, param) => v3(k.curveTangent(asShape(edge), param)),\n curveParameters: (edge): BrepCurveParameters => k.curveParameters(asShape(edge)),\n curveIsClosed: (edge) => k.curveIsClosed(asShape(edge)),\n curveLength: (edge) => k.curveLength(asShape(edge)),\n surfaceType: (face) => String(k.surfaceType(asShape(face))),\n surfaceNormal: (face, u, vv) => v3(k.surfaceNormal(asShape(face), u, vv)),\n pointOnSurface: (face, u, vv) => v3(k.pointOnSurface(asShape(face), u, vv)),\n uvBounds: (face): BrepUvBounds => k.uvBounds(asShape(face)),\n surfaceCenterOfMass: (face) => v3(k.getSurfaceCenterOfMass(asShape(face))),\n getFaceCylinderData: (face) => {\n const d = k.getFaceCylinderData(asShape(face))\n return d ? { radius: d.radius } : null\n },\n getNurbsCurveData: (edge) => {\n const d = k.getNurbsCurveData(asShape(edge))\n return d\n ? {\n degree: d.degree,\n rational: d.rational,\n periodic: d.periodic,\n knots: Array.from(d.knots),\n multiplicities: Array.from(d.multiplicities),\n poles: Array.from(d.poles),\n weights: Array.from(d.weights),\n }\n : null\n },\n curveSplit: (edge, param) => {\n const parts = k.curveSplit(asShape(edge), param)\n return [asHandle(parts[0]), asHandle(parts[1])]\n },\n interpolatePoints: (points, degree) => {\n // L1 contract takes an explicit degree; occt-wasm interpolates a cubic\n // (or periodic) spline and ignores degree — honor only degree 3 and\n // reject others loudly rather than silently producing wrong geometry.\n if (degree !== 3) {\n throw new Error(`occt interpolatePoints: only degree 3 supported, got ${degree}`)\n }\n return asHandle(k.interpolatePoints(points))\n },\n\n defeature: (shape, facesList) => asHandle(k.defeature(asShape(shape), shapes(facesList), 0)),\n draft: (shape, facesList, pull, neutral, angleDeg) => {\n // Native draft is single-face + radians, and has NO neutral-plane argument\n // (occt-wasm index.d.ts:156 `draft(shape, face, angleRad, direction)`).\n // Silently dropping a caller-supplied neutral plane would draft against the\n // wrong plane, so reject loudly (same rule as `interpolatePoints` below).\n // brepkit's L1 draft does consume the neutral point (brepkitKernel.ts:669).\n if (neutral && (neutral.x !== 0 || neutral.y !== 0 || neutral.z !== 0)) {\n throw new Error(\n 'occt draft: neutral plane is not supported by the native kernel ' +\n `(got neutral=(${neutral.x},${neutral.y},${neutral.z})); only the origin neutral is representable`,\n )\n }\n // Native draft is single-face; fold N faces sequentially.\n let current = asShape(shape)\n for (const f of facesList) {\n current = k.draft(current, asShape(f), rad(angleDeg), pull)\n }\n return asHandle(current)\n },\n removeHolesFromFace: (face) => {\n // Native takes hole indices; removing ALL holes = all wires except outer.\n const wires = k.getSubShapes(asShape(face), 'wire')\n const indices = wires.map((_, i) => i).filter((i) => i > 0)\n return asHandle(k.removeHolesFromFace(asShape(face), indices))\n },\n reverseShape: (shape) => asHandle(k.reverseShape(asShape(shape))),\n projectEdges: (shape, origin, direction, xAxis, _hiddenLines, _deflection) =>\n // Native projection has no hiddenLines/deflection flags in its signature —\n // pass through the projection result; callers treat it as opaque (unknown).\n k.projectEdges(asShape(shape), origin, direction, xAxis),\n\n // ── measurement ──\n getBoundingBox: (shape, useTriangulation): BrepBoundingBox =>\n k.getBoundingBox(asShape(shape), useTriangulation),\n getVolume: (shape) => k.getVolume(asShape(shape)),\n getCenterOfMass: (shape) => v3(k.getCenterOfMass(asShape(shape))),\n getSurfaceArea: (shape) => k.getSurfaceArea(asShape(shape)),\n // getLength:唯一 edge 弧长之和(与 brepkit 适配器同口径,D5)。\n // OCC 原生 LinearProperties 默认 SkipShared=false,按**面**遍历、把每条共享边按\n // 相邻面各计一次 ⇒ 实体得到的是「Σ 面周长」而非弧长(20×10×5 盒 → 280 = 2×140)。\n // 归一化为 TopExp 去重后的边逐条求和。checkpoint/releaseSince 是 occt-wasm 为\n // 「枚举子形状句柄后批量回收」提供的 arena 机制(index.d.ts:274-279, 498-511);\n // h 在 checkpoint 之前产生,不会被回收。\n getLength: (shape) => {\n const h = asShape(shape)\n const mark = k.checkpoint()\n try {\n let total = 0\n for (const e of k.getSubShapes(h, 'edge')) total += k.getLength(e)\n return total\n } finally {\n k.releaseSince(mark)\n }\n },\n\n // ── validation & repair ──\n isValid: (shape) => k.isValid(asShape(shape)),\n unifySameDomain: (shape) => asHandle(k.unifySameDomain(asShape(shape))),\n healSolid: (shape, tolerance) => asHandle(k.healSolid(asShape(shape), tolerance)),\n fixShape: (shape) => asHandle(k.fixShape(asShape(shape))),\n fixFaceOrientations: (shape) => asHandle(k.fixFaceOrientations(asShape(shape))),\n removeDegenerateEdges: (shape, _tolerance) =>\n // Native takes no tolerance parameter (kernel-fixed tolerance).\n asHandle(k.removeDegenerateEdges(asShape(shape))),\n\n // ── IO ──\n importStep: (data) => asHandle(k.importStep(data)),\n exportStep: (shape) => k.exportStep(asShape(shape)),\n importStl: (data) => asHandle(k.importStl(data)),\n fromBREP: (data) => asHandle(k.fromBREP(data)),\n\n // ── face evolution (L1 trio only) ──\n cutWithHistory: (a, b, inputFaceHashes, hashUpperBound) =>\n toEvolution(k.cutWithHistory(asShape(a), asShape(b), inputFaceHashes, hashUpperBound)),\n fuseWithHistory: (a, b, inputFaceHashes, hashUpperBound) =>\n toEvolution(k.fuseWithHistory(asShape(a), asShape(b), inputFaceHashes, hashUpperBound)),\n intersectWithHistory: (a, b, inputFaceHashes, hashUpperBound) =>\n toEvolution(k.intersectWithHistory(asShape(a), asShape(b), inputFaceHashes, hashUpperBound)),\n }\n\n return primitives\n}\n\n/** The occt primitives type (BrepEngineApi implementation). */\nexport type OcctPrimitives = Awaited<ReturnType<typeof createOcctPrimitives>>\n\n// §7.8 compile-time guard: the explicit literal must satisfy the L1 contract\n// member-by-member (this now has real verification power — no `as` escape).\n/** Compile-time assertion that OcctPrimitives satisfies BrepEngineApi. */\nexport type _AssertOcctApi = AssertSatisfiesBrepEngineApi<OcctPrimitives>"]}
|
|
1
|
+
{"version":3,"file":"occt-primitives.js","sourceRoot":"","sources":["../../src/occt-kernel/occt-primitives.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAahE,MAAM,QAAQ,GAAG,CAAC,CAAuB,EAAc,EAAE,CAAC,CAAe,CAAA;AACzE,MAAM,OAAO,GAAG,CAAC,CAAa,EAAe,EAAE,CAAC,CAA2B,CAAA;AAC3E,MAAM,MAAM,GAAG,CAAC,EAAgB,EAAiB,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AACnE,MAAM,EAAE,GAAG,CAAC,CAAO,EAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,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AAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChD,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE9C,sCAAsC;QACtC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,CACxD,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;QACxF,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,CACzD,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;QACzF,oBAAoB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,CAC9D,WAAW,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;KAC/F,CAAA;IAED,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["/**\n * occt-kernel/occt-primitives — `createOcctPrimitives()`: the L1 contract\n * (`BrepEngineApi`) adapter over the raw occt-wasm `OcctKernel` singleton.\n *\n * Plan Phase 3.2 (docs/plans/2026-09-24-brep-engine-api-narrowing-native-access.md):\n * explicit object literal, one method per L1 contract member — no monkey\n * patching, no cross-layer assertion lies, no unsupported() stubs. Every member\n * here is either a direct pass-through to the native kernel or an adapter-side\n * dialect digestion, both honestly implementing the contract.\n *\n * Occt-only capabilities (loft family, tool-entity section/split, *WithHistory\n * beyond the L1 trio, XCAF, SVG projection …) are deliberately NOT here —\n * platform code reaches them through the native face: `getOcctKernel()` (D3).\n */\nimport type {\n EdgeData,\n EvolutionData,\n Mesh,\n OcctKernel,\n ShapeHandle,\n Vec3,\n} from 'occt-wasm'\nimport { initOcctWasm } from './occtKernel'\nimport { hullFromPoints as hullFromPointsCore } from './hullOps'\nimport type { AssertSatisfiesBrepEngineApi, BrepEngineApi } from '../brep/engine/primitives'\nimport type {\n BrepBoundingBox,\n BrepCurveParameters,\n BrepEdgeData,\n BrepEvolutionData,\n BrepHandle,\n BrepMeshResult,\n BrepUvBounds,\n BrepVec3,\n} from '../brep/engine/types'\n\nconst asHandle = (h: number | ShapeHandle): BrepHandle => h as BrepHandle\nconst asShape = (h: BrepHandle): ShapeHandle => h as unknown as ShapeHandle\nconst shapes = (hs: BrepHandle[]): ShapeHandle[] => hs.map(asShape)\nconst v3 = (v: Vec3): BrepVec3 => ({ x: v.x, y: v.y, z: v.z })\nconst rad = (deg: number): number => (deg * Math.PI) / 180\n\n/** brepjs topology layer uses this upper bound for face hashes (HASH_CODE_MAX). */\nconst HASH_UPPER_BOUND = 2 ** 24\n\n/** occt-wasm native linearPattern/circularPattern return ONE compound handle\n * containing all replicas (the wasm d.ts type lies by claiming a plain handle).\n * The adapter captures the native methods, then splits the compound via\n * getSubShapes('solid') into the BrepHandle[] the L1 contract promises. */\ntype OcctPatternRaw = {\n linearPattern(shape: ShapeHandle, direction: Vec3, spacing: number, count: number): ShapeHandle\n circularPattern(shape: ShapeHandle, center: Vec3, axis: Vec3, angle: number, count: number): ShapeHandle\n}\n\n/**\n * Build a large planar face (boolean tool) through `point`, oriented by\n * `normal`. The face is constructed directly in the plane's own basis\n * (u ⊥ v ⊥ normal, through point) — no post-rotation needed, any normal\n * direction works (the Phase 1 probe only pinned +Z; this generalizes it).\n */\nfunction makePlanarFaceTool(k: OcctKernel, point: BrepVec3, normal: BrepVec3): ShapeHandle {\n const size = 500 // large enough to fully cut any reasonable solid\n // Pick the axis component with the smallest magnitude to build a stable\n // perpendicular basis (avoids degeneracy when normal is axis-aligned).\n const ax = Math.abs(normal.x)\n const ay = Math.abs(normal.y)\n const az = Math.abs(normal.z)\n let u: BrepVec3\n if (ax <= ay && ax <= az) u = { x: 0, y: -normal.z, z: normal.y }\n else if (ay <= az) u = { x: -normal.z, y: 0, z: normal.x }\n else u = { x: normal.y, y: -normal.x, z: 0 }\n const ul = Math.hypot(u.x, u.y, u.z)\n u = { x: u.x / ul, y: u.y / ul, z: u.z / ul }\n const v: BrepVec3 = {\n x: normal.y * u.z - normal.z * u.y,\n y: normal.z * u.x - normal.x * u.z,\n z: normal.x * u.y - normal.y * u.x,\n }\n const corner = (a: number, b: number): Vec3 => ({\n x: point.x + (u.x * a + v.x * b) * size,\n y: point.y + (u.y * a + v.y * b) * size,\n z: point.z + (u.z * a + v.z * b) * size,\n })\n const e1 = k.makeLineEdge(corner(-1, -1), corner(1, -1))\n const e2 = k.makeLineEdge(corner(1, -1), corner(1, 1))\n const e3 = k.makeLineEdge(corner(1, 1), corner(-1, 1))\n const e4 = k.makeLineEdge(corner(-1, 1), corner(-1, -1))\n const wire = k.makeWire([e1, e2, e3, e4])\n const face = k.makeFace(wire)\n k.release(wire)\n return face\n}\n\n/**\n * Create the occt implementation of the L1 engine contract. Idempotent-friendly:\n * the wasm kernel is a process-level singleton (see initOcctWasm), each call\n * returns a fresh adapter object over the same kernel.\n *\n * @returns a BrepEngineApi implementation backed by the occt wasm kernel.\n */\nexport async function createOcctPrimitives(): Promise<BrepEngineApi> {\n const k = await initOcctWasm()\n const raw = k as unknown as OcctPatternRaw\n // Capture native pattern methods BEFORE any wiring so gridPattern composes\n // on true native semantics (old adapter GOTCHA: after overwriting, calling\n // the property again recurses into the wrapper).\n const nativeLinearPattern = raw.linearPattern.bind(k)\n // 2026-09-25 core-decouple Phase 2(§5.1):hull 最小闭包已移植进 occt-kernel/\n // (hullGeometry + hullOps,occt-wasm 原生直调),此处不再经 vendored\n // OcctWasmAdapter——core 自有引擎对 brepjs 适配器的最后一处依赖已拔除。\n\n const splitCompoundToArray = (compound: ShapeHandle): BrepHandle[] => {\n const parts = k.getSubShapes(compound, 'solid').map(asHandle)\n k.release(compound)\n return parts\n }\n\n const toEvolution = (e: EvolutionData): BrepEvolutionData => ({\n // occt-wasm's EvolutionData already carries the segmented\n // [inHash, count, outHash…] encoding pinned by phase0-kernel-probes\n // (its own docs claim flat maps — docs are wrong, data is segmented).\n result: asHandle(e.result),\n modified: e.modified,\n generated: e.generated,\n deleted: e.deleted,\n })\n\n const primitives: BrepEngineApi = {\n // ── lifecycle ──\n release: (shape) => k.release(asShape(shape)),\n dispose: (shape) => {\n if (shape !== undefined) k.release(asShape(shape))\n },\n\n // ── solids ──\n makeBox: (dx, dy, dz) => asHandle(k.makeBox(dx, dy, dz)),\n makeBoxFromCorners: (c1, c2) => asHandle(k.makeBoxFromCorners(c1, c2)),\n makeCylinder: (radius, height) => asHandle(k.makeCylinder(radius, height)),\n makeSphere: (radius) => asHandle(k.makeSphere(radius)),\n makeCone: (r1, r2, height) => asHandle(k.makeCone(r1, r2, height)),\n makeRectangle: (w, h) => asHandle(k.makeRectangle(w, h)),\n makeEllipsoid: (rx, ry, rz) => asHandle(k.makeEllipsoid(rx, ry, rz)),\n makeTorus: (major, minor) => asHandle(k.makeTorus(major, minor)),\n makeVertex: (x, y, z) => asHandle(k.makeVertex(x, y, z)),\n\n // ── shaping ──\n extrude: (shape, dx, dy, dz) => asHandle(k.extrude(asShape(shape), dx, dy, dz)),\n revolveVec: (shape, center, direction, angleDeg) =>\n asHandle(k.revolve(asShape(shape), { point: center, direction }, rad(angleDeg))),\n sew: (list, tolerance) => asHandle(k.sew(shapes(list), tolerance)),\n sewAndSolidify: (faces, tolerance) => asHandle(k.sewAndSolidify(shapes(faces), tolerance)),\n shell: (solid, facesToRemove, thickness, tolerance) =>\n asHandle(k.shell(asShape(solid), shapes(facesToRemove), thickness, tolerance)),\n hullFromPoints: (points, tolerance) => hullFromPointsCore(k, points as never, tolerance),\n\n // ── booleans & splitting ──\n fuse: (a, b) => asHandle(k.fuse(asShape(a), asShape(b))),\n cut: (a, b) => asHandle(k.cut(asShape(a), asShape(b))),\n common: (a, b) => asHandle(k.common(asShape(a), asShape(b))),\n intersect: (a, b) => asHandle(k.intersect(asShape(a), asShape(b))),\n fuseAll: (list) => asHandle(k.fuseAll(shapes(list))),\n sectionByPlane: (shape, point, normal) => {\n // Phase 1 probe A (phase1-semantic-probes.test.ts): a planar face used as\n // the section tool yields the plane-section geometry. Downcast the result\n // compound into edge/wire handles; a non-compound result passes through.\n const tool = makePlanarFaceTool(k, point, normal)\n try {\n const result = k.section(asShape(shape), tool)\n if (k.isNull(result)) return []\n const out: BrepHandle[] = []\n for (const t of ['edge', 'wire'] as const) {\n for (const part of k.getSubShapes(result, t)) out.push(asHandle(k.downcast(part, t)))\n }\n if (out.length === 0) {\n // No intersection: native section still yields an (empty) compound —\n // release it and return an empty list so callers can detect the miss\n // instead of adopting an empty compound as a \"curve\".\n k.release(result)\n return []\n }\n k.release(result)\n return out\n } finally {\n k.release(tool)\n }\n },\n splitByPlane: (shape, point, normal) => {\n // Phase 1 probe A: splitter with a planar face tool yields exactly 2 solids.\n const tool = makePlanarFaceTool(k, point, normal)\n try {\n const result = k.split(asShape(shape), [tool])\n if (k.isNull(result)) throw new Error('splitByPlane: splitter produced no result')\n const solids = k.getSubShapes(result, 'solid').map(asHandle)\n k.release(result)\n if (solids.length !== 2) {\n throw new Error(`splitByPlane: expected 2 solids, got ${solids.length}`)\n }\n // Classify sides by centroid projection onto the plane normal.\n const originDot = point.x * normal.x + point.y * normal.y + point.z * normal.z\n const side = (h: BrepHandle): number => {\n const c = k.getCenterOfMass(asShape(h))\n return c.x * normal.x + c.y * normal.y + c.z * normal.z - originDot\n }\n const [a, b] = solids\n return side(a) >= side(b)\n ? { positive: a, negative: b }\n : { positive: b, negative: a }\n } finally {\n k.release(tool)\n }\n },\n\n // ── chamfer & fillet ──\n chamfer: (solid, edgesList, distance) =>\n asHandle(k.chamfer(asShape(solid), shapes(edgesList), distance)),\n chamferDistAngle: (solid, edgesList, distance, angleDeg) =>\n asHandle(k.chamferDistAngle(asShape(solid), shapes(edgesList), distance, angleDeg)),\n fillet: (solid, edgesList, radius) =>\n asHandle(k.fillet(asShape(solid), shapes(edgesList), radius)),\n filletVariable: (solid, edge, startRadius, endRadius) =>\n asHandle(k.filletVariable(asShape(solid), asShape(edge), startRadius, endRadius)),\n filletWithHistory: (solid, edgesList, radius, inputFaceHashes, hashUpperBound) =>\n toEvolution(k.filletWithHistory(asShape(solid), shapes(edgesList), radius, inputFaceHashes, hashUpperBound)),\n\n // ── transforms (matrix convention: 3×4 row-major, 12 doubles) ──\n translate: (shape, dx, dy, dz) => asHandle(k.translate(asShape(shape), dx, dy, dz)),\n scale: (shape, center, factor) => asHandle(k.scale(asShape(shape), center, factor)),\n transform: (shape, matrix) => asHandle(k.transform(asShape(shape), matrix)),\n located: (shape, matrix) => asHandle(k.located(asShape(shape), matrix)),\n locate: (shape, matrix) => asHandle(k.located(asShape(shape), matrix)),\n generalTransform: (shape, matrix) => asHandle(k.generalTransform(asShape(shape), matrix)),\n copy: (shape) => asHandle(k.copy(asShape(shape))),\n copyShape: (shape) => asHandle(k.copy(asShape(shape))),\n composeTransform: (m1, m2) => k.composeTransform(m1, m2),\n mirror: (shape, point, normal) => asHandle(k.mirror(asShape(shape), point, normal)),\n\n // ── patterns ──\n // GOTCHA: occt-wasm native linearPattern/circularPattern return ONE compound\n // handle (their d.ts type lies). Split it into per-replica handles here.\n linearPattern: (shape, direction, spacing, count) => {\n const compound = nativeLinearPattern(asShape(shape), direction, spacing, count)\n return splitCompoundToArray(compound)\n },\n circularPattern: (shape, center, axis, angleStep, count) => {\n // Empirically validated (old adapter + engine-switch-p2 parity): the wasm\n // layer takes the angle in DEGREES here (unlike revolve's angleRad).\n const compound = (k as unknown as OcctPatternRaw).circularPattern.call(\n k, asShape(shape), center, axis, angleStep, count,\n )\n return splitCompoundToArray(compound)\n },\n gridPattern: (shape, directionX, directionY, spacingX, spacingY, countX, countY) => {\n // Composed: native linearPattern along X per column, then along Y per row,\n // fuse all replicas. Must use the CAPTURED native linearPattern (returns\n // compound) — the adapter property above now returns arrays.\n const colCompound = nativeLinearPattern(asShape(shape), directionX, spacingX, countX)\n const cols = k.getSubShapes(colCompound, 'solid')\n k.release(colCompound)\n const all: ShapeHandle[] = []\n try {\n for (const c of cols) {\n const rowCompound = nativeLinearPattern(c, directionY, spacingY, countY)\n try {\n all.push(...k.getSubShapes(rowCompound, 'solid'))\n } finally {\n k.release(rowCompound)\n }\n }\n } finally {\n for (const c of cols) k.release(c)\n }\n return asHandle(k.fuseAll(all))\n },\n\n // ── curve construction ──\n makeLineEdge: (start, end) => asHandle(k.makeLineEdge(start, end)),\n makeArcEdge: (start, mid, end) => asHandle(k.makeArcEdge(start, mid, end)),\n makeBezierEdge: (controlPoints) => asHandle(k.makeBezierEdge(controlPoints)),\n makeBSplineEdge: (poles, weights, knots, multiplicities, degree, periodic) =>\n asHandle(k.makeBSplineEdge(poles, weights, knots, multiplicities, degree, periodic ?? false)),\n makeCircleEdge: (center, normal, radius) =>\n asHandle(k.makeCircleEdge(center, normal, radius)),\n\n // ── topology construction ──\n makeWire: (edgesList) => asHandle(k.makeWire(shapes(edgesList))),\n makeFace: (wire) => asHandle(k.makeFace(asShape(wire))),\n makeCompound: (list) => asHandle(k.makeCompound(shapes(list))),\n addHolesInFace: (face, holeWires) =>\n asHandle(k.addHolesInFace(asShape(face), shapes(holeWires))),\n buildTriFace: (a, b, c) => asHandle(k.buildTriFace(a, b, c)),\n\n // ── tessellation (the only BREP→mesh exit) ──\n meshShape: (shape, options): BrepMeshResult => {\n const m: Mesh = k.meshShape(asShape(shape), options)\n return {\n positions: m.positions,\n normals: m.normals,\n indices: m.indices,\n vertexCount: m.vertexCount,\n triangleCount: m.triangleCount,\n faceGroups: m.faceGroups,\n faceCount: m.faceCount,\n }\n },\n wireframe: (shape, deflection): BrepEdgeData => {\n const e: EdgeData = k.wireframe(asShape(shape), deflection)\n return {\n points: e.points,\n edgeGroups: e.edgeGroups,\n pointCount: e.pointCount,\n edgeCount: e.edgeCount,\n }\n },\n\n // ── topology queries ──\n getSubShapes: (shape, type) => k.getSubShapes(asShape(shape), type).map(asHandle),\n subShapeHashes: (shape, type, hashUpperBound) =>\n k.subShapeHashes(asShape(shape), type, hashUpperBound),\n hashCode: (shape, upperBound) => k.hashCode(asShape(shape), upperBound),\n isSame: (a, b) => k.isSame(asShape(a), asShape(b)),\n isSolid: (shape) => k.isSolid(asShape(shape)),\n shapeType: (shape) => k.getShapeType(asShape(shape)),\n shapeOrientation: (shape) => String(k.shapeOrientation(asShape(shape))),\n edgeToFaceMap: (shape) => k.edgeToFaceMap(asShape(shape), HASH_UPPER_BOUND),\n adjacentFaces: (shape, face) =>\n k.adjacentFaces(asShape(shape), asShape(face)).map(asHandle),\n sharedEdges: (a, b) => k.sharedEdges(asShape(a), asShape(b)).map(asHandle),\n\n // ── geometry evaluation ──\n curveType: (edge) => String(k.curveType(asShape(edge))),\n curvePointAtParam: (edge, param) => v3(k.curvePointAtParam(asShape(edge), param)),\n curveTangent: (edge, param) => v3(k.curveTangent(asShape(edge), param)),\n curveParameters: (edge): BrepCurveParameters => k.curveParameters(asShape(edge)),\n curveIsClosed: (edge) => k.curveIsClosed(asShape(edge)),\n curveLength: (edge) => k.curveLength(asShape(edge)),\n surfaceType: (face) => String(k.surfaceType(asShape(face))),\n surfaceNormal: (face, u, vv) => v3(k.surfaceNormal(asShape(face), u, vv)),\n pointOnSurface: (face, u, vv) => v3(k.pointOnSurface(asShape(face), u, vv)),\n uvBounds: (face): BrepUvBounds => k.uvBounds(asShape(face)),\n surfaceCenterOfMass: (face) => v3(k.getSurfaceCenterOfMass(asShape(face))),\n getFaceCylinderData: (face) => {\n const d = k.getFaceCylinderData(asShape(face))\n return d ? { radius: d.radius } : null\n },\n getNurbsCurveData: (edge) => {\n const d = k.getNurbsCurveData(asShape(edge))\n return d\n ? {\n degree: d.degree,\n rational: d.rational,\n periodic: d.periodic,\n knots: Array.from(d.knots),\n multiplicities: Array.from(d.multiplicities),\n poles: Array.from(d.poles),\n weights: Array.from(d.weights),\n }\n : null\n },\n curveSplit: (edge, param) => {\n const parts = k.curveSplit(asShape(edge), param)\n return [asHandle(parts[0]), asHandle(parts[1])]\n },\n interpolatePoints: (points, degree) => {\n // L1 contract takes an explicit degree; occt-wasm interpolates a cubic\n // (or periodic) spline and ignores degree — honor only degree 3 and\n // reject others loudly rather than silently producing wrong geometry.\n if (degree !== 3) {\n throw new Error(`occt interpolatePoints: only degree 3 supported, got ${degree}`)\n }\n return asHandle(k.interpolatePoints(points))\n },\n\n defeature: (shape, facesList) => asHandle(k.defeature(asShape(shape), shapes(facesList), 0)),\n draft: (shape, facesList, pull, neutral, angleDeg) => {\n // Native draft is single-face + radians, and has NO neutral-plane argument\n // (occt-wasm index.d.ts:156 `draft(shape, face, angleRad, direction)`).\n // Silently dropping a caller-supplied neutral plane would draft against the\n // wrong plane, so reject loudly (same rule as `interpolatePoints` below).\n // brepkit's L1 draft does consume the neutral point (brepkitKernel.ts:669).\n if (neutral && (neutral.x !== 0 || neutral.y !== 0 || neutral.z !== 0)) {\n throw new Error(\n 'occt draft: neutral plane is not supported by the native kernel ' +\n `(got neutral=(${neutral.x},${neutral.y},${neutral.z})); only the origin neutral is representable`,\n )\n }\n // Native draft is single-face; fold N faces sequentially.\n let current = asShape(shape)\n for (const f of facesList) {\n current = k.draft(current, asShape(f), rad(angleDeg), pull)\n }\n return asHandle(current)\n },\n removeHolesFromFace: (face) => {\n // Native takes hole indices; removing ALL holes = all wires except outer.\n const wires = k.getSubShapes(asShape(face), 'wire')\n const indices = wires.map((_, i) => i).filter((i) => i > 0)\n return asHandle(k.removeHolesFromFace(asShape(face), indices))\n },\n reverseShape: (shape) => asHandle(k.reverseShape(asShape(shape))),\n projectEdges: (shape, origin, direction, xAxis, _hiddenLines, _deflection) =>\n // Native projection has no hiddenLines/deflection flags in its signature —\n // pass through the projection result; callers treat it as opaque (unknown).\n k.projectEdges(asShape(shape), origin, direction, xAxis),\n\n // ── measurement ──\n getBoundingBox: (shape, useTriangulation): BrepBoundingBox =>\n k.getBoundingBox(asShape(shape), useTriangulation ?? false),\n getVolume: (shape) => k.getVolume(asShape(shape)),\n getCenterOfMass: (shape) => v3(k.getCenterOfMass(asShape(shape))),\n getSurfaceArea: (shape) => k.getSurfaceArea(asShape(shape)),\n // getLength:唯一 edge 弧长之和(与 brepkit 适配器同口径,D5)。\n // OCC 原生 LinearProperties 默认 SkipShared=false,按**面**遍历、把每条共享边按\n // 相邻面各计一次 ⇒ 实体得到的是「Σ 面周长」而非弧长(20×10×5 盒 → 280 = 2×140)。\n // 归一化为 TopExp 去重后的边逐条求和。checkpoint/releaseSince 是 occt-wasm 为\n // 「枚举子形状句柄后批量回收」提供的 arena 机制(index.d.ts:274-279, 498-511);\n // h 在 checkpoint 之前产生,不会被回收。\n getLength: (shape) => {\n const h = asShape(shape)\n const mark = k.checkpoint()\n try {\n let total = 0\n for (const e of k.getSubShapes(h, 'edge')) total += k.getLength(e)\n return total\n } finally {\n k.releaseSince(mark)\n }\n },\n\n // ── validation & repair ──\n isValid: (shape) => k.isValid(asShape(shape)),\n unifySameDomain: (shape) => asHandle(k.unifySameDomain(asShape(shape))),\n healSolid: (shape, tolerance) => asHandle(k.healSolid(asShape(shape), tolerance)),\n fixShape: (shape) => asHandle(k.fixShape(asShape(shape))),\n fixFaceOrientations: (shape) => asHandle(k.fixFaceOrientations(asShape(shape))),\n removeDegenerateEdges: (shape, _tolerance) =>\n // Native takes no tolerance parameter (kernel-fixed tolerance).\n asHandle(k.removeDegenerateEdges(asShape(shape))),\n\n // ── IO ──\n importStep: (data) => asHandle(k.importStep(data)),\n exportStep: (shape) => k.exportStep(asShape(shape)),\n importStl: (data) => asHandle(k.importStl(data)),\n fromBREP: (data) => asHandle(k.fromBREP(data)),\n\n // ── face evolution (L1 trio only) ──\n cutWithHistory: (a, b, inputFaceHashes, hashUpperBound) =>\n toEvolution(k.cutWithHistory(asShape(a), asShape(b), inputFaceHashes, hashUpperBound)),\n fuseWithHistory: (a, b, inputFaceHashes, hashUpperBound) =>\n toEvolution(k.fuseWithHistory(asShape(a), asShape(b), inputFaceHashes, hashUpperBound)),\n intersectWithHistory: (a, b, inputFaceHashes, hashUpperBound) =>\n toEvolution(k.intersectWithHistory(asShape(a), asShape(b), inputFaceHashes, hashUpperBound)),\n }\n\n return primitives\n}\n\n/** The occt primitives type (BrepEngineApi implementation). */\nexport type OcctPrimitives = Awaited<ReturnType<typeof createOcctPrimitives>>\n\n// §7.8 compile-time guard: the explicit literal must satisfy the L1 contract\n// member-by-member (this now has real verification power — no `as` escape).\n/** Compile-time assertion that OcctPrimitives satisfies BrepEngineApi. */\nexport type _AssertOcctApi = AssertSatisfiesBrepEngineApi<OcctPrimitives>"]}
|
|
@@ -36,7 +36,7 @@ export declare function setOcctWasmInitFn(fn: (() => Promise<OcctKernel>) | null
|
|
|
36
36
|
/**
|
|
37
37
|
* Resolve the occt-wasm WASM file path (linker-agnostic).
|
|
38
38
|
*
|
|
39
|
-
* Walks the package exports (occt-wasm@
|
|
39
|
+
* Walks the package exports (occt-wasm@5.6.0 exports "./dist/occt-wasm.wasm"),
|
|
40
40
|
* independent of cwd / hoisting / pnpm|npm linker (verified pattern C).
|
|
41
41
|
* Replaces the old 4-level `..` path guessing + process.cwd() fallback.
|
|
42
42
|
*
|
|
@@ -67,7 +67,7 @@ export function setOcctWasmInitFn(fn) {
|
|
|
67
67
|
/**
|
|
68
68
|
* Resolve the occt-wasm WASM file path (linker-agnostic).
|
|
69
69
|
*
|
|
70
|
-
* Walks the package exports (occt-wasm@
|
|
70
|
+
* Walks the package exports (occt-wasm@5.6.0 exports "./dist/occt-wasm.wasm"),
|
|
71
71
|
* independent of cwd / hoisting / pnpm|npm linker (verified pattern C).
|
|
72
72
|
* Replaces the old 4-level `..` path guessing + process.cwd() fallback.
|
|
73
73
|
*
|