@faicad/sheetmetal 0.13.0
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/allowanceFns.d.ts +42 -0
- package/dist/allowanceFns.d.ts.map +1 -0
- package/dist/allowanceFns.js +63 -0
- package/dist/allowanceFns.js.map +1 -0
- package/dist/api.d.ts +312 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +367 -0
- package/dist/api.js.map +1 -0
- package/dist/authorFns.d.ts +118 -0
- package/dist/authorFns.d.ts.map +1 -0
- package/dist/authorFns.js +562 -0
- package/dist/authorFns.js.map +1 -0
- package/dist/bendTableFns.d.ts +87 -0
- package/dist/bendTableFns.d.ts.map +1 -0
- package/dist/bendTableFns.js +345 -0
- package/dist/bendTableFns.js.map +1 -0
- package/dist/compat.d.ts +90 -0
- package/dist/compat.d.ts.map +1 -0
- package/dist/compat.js +99 -0
- package/dist/compat.js.map +1 -0
- package/dist/contourFlangeFns.d.ts +122 -0
- package/dist/contourFlangeFns.d.ts.map +1 -0
- package/dist/contourFlangeFns.js +403 -0
- package/dist/contourFlangeFns.js.map +1 -0
- package/dist/cutoutFns.d.ts +95 -0
- package/dist/cutoutFns.d.ts.map +1 -0
- package/dist/cutoutFns.js +300 -0
- package/dist/cutoutFns.js.map +1 -0
- package/dist/dxfFns.d.ts +48 -0
- package/dist/dxfFns.d.ts.map +1 -0
- package/dist/dxfFns.js +236 -0
- package/dist/dxfFns.js.map +1 -0
- package/dist/facade.d.ts +449 -0
- package/dist/facade.d.ts.map +1 -0
- package/dist/facade.js +535 -0
- package/dist/facade.js.map +1 -0
- package/dist/featureTreeFns.d.ts +76 -0
- package/dist/featureTreeFns.d.ts.map +1 -0
- package/dist/featureTreeFns.js +190 -0
- package/dist/featureTreeFns.js.map +1 -0
- package/dist/foldFns.d.ts +83 -0
- package/dist/foldFns.d.ts.map +1 -0
- package/dist/foldFns.js +744 -0
- package/dist/foldFns.js.map +1 -0
- package/dist/foreignUnfoldFns.d.ts +62 -0
- package/dist/foreignUnfoldFns.d.ts.map +1 -0
- package/dist/foreignUnfoldFns.js +854 -0
- package/dist/foreignUnfoldFns.js.map +1 -0
- package/dist/formFns.d.ts +58 -0
- package/dist/formFns.d.ts.map +1 -0
- package/dist/formFns.js +300 -0
- package/dist/formFns.js.map +1 -0
- package/dist/hemFns.d.ts +17 -0
- package/dist/hemFns.d.ts.map +1 -0
- package/dist/hemFns.js +212 -0
- package/dist/hemFns.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +38 -0
- package/dist/internal.js.map +1 -0
- package/dist/jogFns.d.ts +18 -0
- package/dist/jogFns.d.ts.map +1 -0
- package/dist/jogFns.js +180 -0
- package/dist/jogFns.js.map +1 -0
- package/dist/loftedFlangeFns.d.ts +23 -0
- package/dist/loftedFlangeFns.d.ts.map +1 -0
- package/dist/loftedFlangeFns.js +306 -0
- package/dist/loftedFlangeFns.js.map +1 -0
- package/dist/materials.d.ts +16 -0
- package/dist/materials.d.ts.map +1 -0
- package/dist/materials.js +44 -0
- package/dist/materials.js.map +1 -0
- package/dist/miterFns.d.ts +31 -0
- package/dist/miterFns.d.ts.map +1 -0
- package/dist/miterFns.js +128 -0
- package/dist/miterFns.js.map +1 -0
- package/dist/nestFns.d.ts +116 -0
- package/dist/nestFns.d.ts.map +1 -0
- package/dist/nestFns.js +517 -0
- package/dist/nestFns.js.map +1 -0
- package/dist/polygonFns.d.ts +144 -0
- package/dist/polygonFns.d.ts.map +1 -0
- package/dist/polygonFns.js +324 -0
- package/dist/polygonFns.js.map +1 -0
- package/dist/reliefFns.d.ts +44 -0
- package/dist/reliefFns.d.ts.map +1 -0
- package/dist/reliefFns.js +367 -0
- package/dist/reliefFns.js.map +1 -0
- package/dist/reportFns.d.ts +33 -0
- package/dist/reportFns.d.ts.map +1 -0
- package/dist/reportFns.js +71 -0
- package/dist/reportFns.js.map +1 -0
- package/dist/tabFns.d.ts +43 -0
- package/dist/tabFns.d.ts.map +1 -0
- package/dist/tabFns.js +179 -0
- package/dist/tabFns.js.map +1 -0
- package/dist/types.d.ts +629 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/unfoldFns.d.ts +120 -0
- package/dist/unfoldFns.d.ts.map +1 -0
- package/dist/unfoldFns.js +766 -0
- package/dist/unfoldFns.js.map +1 -0
- package/dist/validateFns.d.ts +18 -0
- package/dist/validateFns.d.ts.map +1 -0
- package/dist/validateFns.js +196 -0
- package/dist/validateFns.js.map +1 -0
- package/package.json +45 -0
package/dist/compat.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* compat — brepjs 同名兼容 shim(D12,批次一的桥接面)
|
|
3
|
+
*
|
|
4
|
+
* 设计:docs/plans/2026-09-01-layered-api-architecture.md §D12 / §7.3 / §7.5
|
|
5
|
+
*
|
|
6
|
+
* 移植的钣金源文件只改 import 来源行(`from 'brepjs'` → `from './compat.js'`),
|
|
7
|
+
* Result 消费点零改动。本文件是包内**唯一**桥接点(§9 验收白名单:src 中
|
|
8
|
+
* `kernel/`、`getBackends`、`getSlot` 零命中,compat.ts 除外)——
|
|
9
|
+
* 批次一(纯 2D/数据层)需要的符号以 vendored L1/L2 的同名形态提供:
|
|
10
|
+
*
|
|
11
|
+
* - Result 机制与类型:vendored `core/result.js` / `core/errors.js` /
|
|
12
|
+
* `core/shapeTypes.js` / `core/validityTypes.js` / `core/types.js`;
|
|
13
|
+
* - 2D/查询 op:直包 vendored L2(`primitiveFns.line/wire/wireLoop`、
|
|
14
|
+
* `topologyQueryFns.getEdges`、`curveFns.curveStartPoint/curveEndPoint`)——
|
|
15
|
+
* 产出的都是 brepjs 原样句柄形态(同一 occt-wasm 实例,D10),与 3D 批次
|
|
16
|
+
* 经 L3 `cad.*` 的路径不同:批次一不碰 3D 实体,无需 faijs Shape 包装。
|
|
17
|
+
*
|
|
18
|
+
* vec* 纯函数按 §7.5 ⑤ 不映射到 cad 命名空间;批次一各文件未消费 vec*,
|
|
19
|
+
* 待 3D 批次需要时从 vendored `utils/vec3.js` 在此 re-export。
|
|
20
|
+
*/
|
|
21
|
+
import { ok, err, isOk, isErr, type Result } from '@faicad/faijs-core/vendored/brepjs/core/result.js';
|
|
22
|
+
import { validationError, type BrepError } from '@faicad/faijs-core/vendored/brepjs/core/errors.js';
|
|
23
|
+
import type { Solid, Wire, Edge, Face, AnyShape } from '@faicad/faijs-core/vendored/brepjs/core/shapeTypes.js';
|
|
24
|
+
import { isSolid } from '@faicad/faijs-core/vendored/brepjs/core/shapeTypes.js';
|
|
25
|
+
import type { ClosedWire, ValidSolid } from '@faicad/faijs-core/vendored/brepjs/core/validityTypes.js';
|
|
26
|
+
import { isPlanarWire } from '@faicad/faijs-core/vendored/brepjs/core/validityTypes.js';
|
|
27
|
+
import type { Vec3 } from '@faicad/faijs-core/vendored/brepjs/core/types.js';
|
|
28
|
+
import type { Bounds3D } from '@faicad/faijs-core/vendored/brepjs/topology/topologyQueryFns.js';
|
|
29
|
+
import { getSolids, getFaces, getBounds } from '@faicad/faijs-core/vendored/brepjs/topology/topologyQueryFns.js';
|
|
30
|
+
import { line as brepjsLine, wire as brepjsWire, wireLoop as brepjsWireLoop, box as brepjsBox, cylinder as brepjsCylinder, sphere as brepjsSphere, face as brepjsFace, polygon as brepjsPolygon } from '@faicad/faijs-core/vendored/brepjs/topology/primitiveFns.js';
|
|
31
|
+
import { unwrap as brepjsUnwrap } from '@faicad/faijs-core/vendored/brepjs/core/result.js';
|
|
32
|
+
import { translate as brepjsTranslate } from '@faicad/faijs-core/vendored/brepjs/topology/transformFns.js';
|
|
33
|
+
import { extrude as brepjsExtrude } from '@faicad/faijs-core/vendored/brepjs/operations/extrudeFns.js';
|
|
34
|
+
import { getEdges as brepjsGetEdges } from '@faicad/faijs-core/vendored/brepjs/topology/topologyQueryFns.js';
|
|
35
|
+
import { curveStartPoint as brepjsCurveStartPoint, curveEndPoint as brepjsCurveEndPoint } from '@faicad/faijs-core/vendored/brepjs/topology/curveFns.js';
|
|
36
|
+
import { isValid } from '@faicad/faijs-core/vendored/brepjs/topology/healingFns.js';
|
|
37
|
+
import { measureVolume, measureArea } from '@faicad/faijs-core/vendored/brepjs/measurement/measureFns.js';
|
|
38
|
+
import { getSurfaceType, pointOnSurface, normalAt, faceCenter } from '@faicad/faijs-core/vendored/brepjs/topology/faceFns.js';
|
|
39
|
+
import { sharedEdges } from '@faicad/faijs-core/vendored/brepjs/topology/adjacencyFns.js';
|
|
40
|
+
import { outerWire as brepjsOuterWire } from '@faicad/faijs-core/vendored/brepjs/topology/faceFns.js';
|
|
41
|
+
import { vecAdd, vecSub, vecScale, vecDot, vecCross, vecNormalize, vecLength } from '@faicad/faijs-core/vendored/brepjs/core/vecOps.js';
|
|
42
|
+
export { ok, err, isOk, isErr, validationError, brepjsUnwrap as unwrap };
|
|
43
|
+
export type { Result, BrepError };
|
|
44
|
+
export type { Solid, Wire, Edge, Face, AnyShape, ClosedWire, ValidSolid, Vec3, Bounds3D };
|
|
45
|
+
export { brepjsLine as line, brepjsWire as wire, brepjsWireLoop as wireLoop };
|
|
46
|
+
export { brepjsGetEdges as getEdges, getSolids, getFaces, getBounds };
|
|
47
|
+
export { isSolid, isPlanarWire, isValid };
|
|
48
|
+
export { brepjsCurveStartPoint as curveStartPoint, brepjsCurveEndPoint as curveEndPoint };
|
|
49
|
+
export { brepjsBox as box, brepjsCylinder as cylinder, brepjsSphere as sphere, brepjsFace as face };
|
|
50
|
+
export { brepjsPolygon as polygon, brepjsOuterWire as outerWire };
|
|
51
|
+
export { brepjsExtrude as extrude };
|
|
52
|
+
export { brepjsTranslate as translate };
|
|
53
|
+
/**
|
|
54
|
+
* Rotate a shape by an angle in degrees around an axis.
|
|
55
|
+
* @param shape - The shape to rotate.
|
|
56
|
+
* @param angle - Rotation angle in degrees.
|
|
57
|
+
* @param options - Axis and pivot (`at`) for the rotation; defaults to the Z
|
|
58
|
+
* axis through the origin, matching upstream brepjs.
|
|
59
|
+
* @returns A new rotated shape.
|
|
60
|
+
*/
|
|
61
|
+
export declare function rotate<T extends AnyShape>(shape: T, angle: number, options?: {
|
|
62
|
+
at?: Vec3;
|
|
63
|
+
axis?: Vec3;
|
|
64
|
+
}): T;
|
|
65
|
+
/**
|
|
66
|
+
* Fuse two solids (union). Accepts plain `Solid` operands like upstream
|
|
67
|
+
* brepjs; the vendored `ValidSolid` brand is applied internally.
|
|
68
|
+
* @param a - First solid operand.
|
|
69
|
+
* @param b - Second solid operand.
|
|
70
|
+
* @returns `Ok` with the fused solid, or `Err` when the result is not 3D.
|
|
71
|
+
*/
|
|
72
|
+
export declare function fuse(a: Solid, b: Solid): Result<ValidSolid>;
|
|
73
|
+
/**
|
|
74
|
+
* Cut solid `b` out of solid `a` (difference).
|
|
75
|
+
* @param a - Solid to subtract from.
|
|
76
|
+
* @param b - Solid to subtract.
|
|
77
|
+
* @returns `Ok` with the result, or `Err` when the result is not 3D.
|
|
78
|
+
*/
|
|
79
|
+
export declare function cut(a: Solid, b: Solid): Result<ValidSolid>;
|
|
80
|
+
/**
|
|
81
|
+
* Intersect two solids (common volume).
|
|
82
|
+
* @param a - First solid operand.
|
|
83
|
+
* @param b - Second solid operand.
|
|
84
|
+
* @returns `Ok` with the intersection, or `Err` when the result is not 3D.
|
|
85
|
+
*/
|
|
86
|
+
export declare function intersect(a: Solid, b: Solid): Result<ValidSolid>;
|
|
87
|
+
export { measureVolume, measureArea };
|
|
88
|
+
export { getSurfaceType, pointOnSurface, normalAt, faceCenter, sharedEdges };
|
|
89
|
+
export { vecAdd, vecSub, vecScale, vecDot, vecCross, vecNormalize, vecLength };
|
|
90
|
+
//# sourceMappingURL=compat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat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的钣金源文件只改 import 来源行(`from 'brepjs'` → `from './compat.js'`),
|
|
7
|
+
* Result 消费点零改动。本文件是包内**唯一**桥接点(§9 验收白名单:src 中
|
|
8
|
+
* `kernel/`、`getBackends`、`getSlot` 零命中,compat.ts 除外)——
|
|
9
|
+
* 批次一(纯 2D/数据层)需要的符号以 vendored L1/L2 的同名形态提供:
|
|
10
|
+
*
|
|
11
|
+
* - Result 机制与类型:vendored `core/result.js` / `core/errors.js` /
|
|
12
|
+
* `core/shapeTypes.js` / `core/validityTypes.js` / `core/types.js`;
|
|
13
|
+
* - 2D/查询 op:直包 vendored L2(`primitiveFns.line/wire/wireLoop`、
|
|
14
|
+
* `topologyQueryFns.getEdges`、`curveFns.curveStartPoint/curveEndPoint`)——
|
|
15
|
+
* 产出的都是 brepjs 原样句柄形态(同一 occt-wasm 实例,D10),与 3D 批次
|
|
16
|
+
* 经 L3 `cad.*` 的路径不同:批次一不碰 3D 实体,无需 faijs Shape 包装。
|
|
17
|
+
*
|
|
18
|
+
* vec* 纯函数按 §7.5 ⑤ 不映射到 cad 命名空间;批次一各文件未消费 vec*,
|
|
19
|
+
* 待 3D 批次需要时从 vendored `utils/vec3.js` 在此 re-export。
|
|
20
|
+
*/
|
|
21
|
+
import { ok, err, isOk, isErr } from '@faicad/faijs-core/vendored/brepjs/core/result.js';
|
|
22
|
+
import { validationError } from '@faicad/faijs-core/vendored/brepjs/core/errors.js';
|
|
23
|
+
import { isSolid } from '@faicad/faijs-core/vendored/brepjs/core/shapeTypes.js';
|
|
24
|
+
import { isPlanarWire } from '@faicad/faijs-core/vendored/brepjs/core/validityTypes.js';
|
|
25
|
+
import { getSolids, getFaces, getBounds } from '@faicad/faijs-core/vendored/brepjs/topology/topologyQueryFns.js';
|
|
26
|
+
import { line as brepjsLine, wire as brepjsWire, wireLoop as brepjsWireLoop, box as brepjsBox, cylinder as brepjsCylinder, sphere as brepjsSphere, face as brepjsFace, polygon as brepjsPolygon, } from '@faicad/faijs-core/vendored/brepjs/topology/primitiveFns.js';
|
|
27
|
+
import { unwrap as brepjsUnwrap } from '@faicad/faijs-core/vendored/brepjs/core/result.js';
|
|
28
|
+
import { fuse as brepjsFuse, cut as brepjsCut, intersect as brepjsIntersect } from '@faicad/faijs-core/vendored/brepjs/topology/booleanFns.js';
|
|
29
|
+
import { rotate as brepjsRotate, translate as brepjsTranslate } from '@faicad/faijs-core/vendored/brepjs/topology/transformFns.js';
|
|
30
|
+
import { extrude as brepjsExtrude } from '@faicad/faijs-core/vendored/brepjs/operations/extrudeFns.js';
|
|
31
|
+
import { getEdges as brepjsGetEdges } from '@faicad/faijs-core/vendored/brepjs/topology/topologyQueryFns.js';
|
|
32
|
+
import { curveStartPoint as brepjsCurveStartPoint, curveEndPoint as brepjsCurveEndPoint, } from '@faicad/faijs-core/vendored/brepjs/topology/curveFns.js';
|
|
33
|
+
import { isValid } from '@faicad/faijs-core/vendored/brepjs/topology/healingFns.js';
|
|
34
|
+
import { measureVolume, measureArea } from '@faicad/faijs-core/vendored/brepjs/measurement/measureFns.js';
|
|
35
|
+
import { getSurfaceType, pointOnSurface, normalAt, faceCenter, } from '@faicad/faijs-core/vendored/brepjs/topology/faceFns.js';
|
|
36
|
+
import { sharedEdges } from '@faicad/faijs-core/vendored/brepjs/topology/adjacencyFns.js';
|
|
37
|
+
import { outerWire as brepjsOuterWire } from '@faicad/faijs-core/vendored/brepjs/topology/faceFns.js';
|
|
38
|
+
import { vecAdd, vecSub, vecScale, vecDot, vecCross, vecNormalize, vecLength, } from '@faicad/faijs-core/vendored/brepjs/core/vecOps.js';
|
|
39
|
+
// ── Result 机制(L1 core/result + core/errors,brepjs 同名) ──
|
|
40
|
+
export { ok, err, isOk, isErr, validationError, brepjsUnwrap as unwrap };
|
|
41
|
+
// ── 2D/查询 op(直 re-export vendored L2,保留 brepjs 同名同签名) ──
|
|
42
|
+
export { brepjsLine as line, brepjsWire as wire, brepjsWireLoop as wireLoop };
|
|
43
|
+
export { brepjsGetEdges as getEdges, getSolids, getFaces, getBounds };
|
|
44
|
+
export { isSolid, isPlanarWire, isValid };
|
|
45
|
+
export { brepjsCurveStartPoint as curveStartPoint, brepjsCurveEndPoint as curveEndPoint };
|
|
46
|
+
// ── 3D op(批次二/三:布尔/图元/变换/拉伸) ──
|
|
47
|
+
export { brepjsBox as box, brepjsCylinder as cylinder, brepjsSphere as sphere, brepjsFace as face };
|
|
48
|
+
export { brepjsPolygon as polygon, brepjsOuterWire as outerWire };
|
|
49
|
+
export { brepjsExtrude as extrude };
|
|
50
|
+
export { brepjsTranslate as translate };
|
|
51
|
+
// 上游 brepjs 18 的 rotate 以 `{ at, axis }` 选项对象接受轴;vendored 树是
|
|
52
|
+
// 四参数位置形态(P5 锁定 commit)。compat 包装对齐上游同名同签(D12)。
|
|
53
|
+
/**
|
|
54
|
+
* Rotate a shape by an angle in degrees around an axis.
|
|
55
|
+
* @param shape - The shape to rotate.
|
|
56
|
+
* @param angle - Rotation angle in degrees.
|
|
57
|
+
* @param options - Axis and pivot (`at`) for the rotation; defaults to the Z
|
|
58
|
+
* axis through the origin, matching upstream brepjs.
|
|
59
|
+
* @returns A new rotated shape.
|
|
60
|
+
*/
|
|
61
|
+
export function rotate(shape, angle, options = {}) {
|
|
62
|
+
return brepjsRotate(shape, angle, options.at ?? [0, 0, 0], options.axis ?? [0, 0, 1]);
|
|
63
|
+
}
|
|
64
|
+
// 上游 brepjs 18 的布尔接受任意 3D shape;vendored 首重载要求 ValidSolid
|
|
65
|
+
// 品牌(编译期幻影)。compat 以 Solid 形态导出、内部 cast(运行时无差异)。
|
|
66
|
+
/**
|
|
67
|
+
* Fuse two solids (union). Accepts plain `Solid` operands like upstream
|
|
68
|
+
* brepjs; the vendored `ValidSolid` brand is applied internally.
|
|
69
|
+
* @param a - First solid operand.
|
|
70
|
+
* @param b - Second solid operand.
|
|
71
|
+
* @returns `Ok` with the fused solid, or `Err` when the result is not 3D.
|
|
72
|
+
*/
|
|
73
|
+
export function fuse(a, b) {
|
|
74
|
+
return brepjsFuse(a, b);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Cut solid `b` out of solid `a` (difference).
|
|
78
|
+
* @param a - Solid to subtract from.
|
|
79
|
+
* @param b - Solid to subtract.
|
|
80
|
+
* @returns `Ok` with the result, or `Err` when the result is not 3D.
|
|
81
|
+
*/
|
|
82
|
+
export function cut(a, b) {
|
|
83
|
+
return brepjsCut(a, b);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Intersect two solids (common volume).
|
|
87
|
+
* @param a - First solid operand.
|
|
88
|
+
* @param b - Second solid operand.
|
|
89
|
+
* @returns `Ok` with the intersection, or `Err` when the result is not 3D.
|
|
90
|
+
*/
|
|
91
|
+
export function intersect(a, b) {
|
|
92
|
+
return brepjsIntersect(a, b);
|
|
93
|
+
}
|
|
94
|
+
// ── 度量 / 曲面查询(批次二/三) ──
|
|
95
|
+
export { measureVolume, measureArea };
|
|
96
|
+
export { getSurfaceType, pointOnSurface, normalAt, faceCenter, sharedEdges };
|
|
97
|
+
// ── 向量纯函数(§7.5 ⑤,不映射 cad 命名空间) ──
|
|
98
|
+
export { vecAdd, vecSub, vecScale, vecDot, vecCross, vecNormalize, vecLength };
|
|
99
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.js","sourceRoot":"","sources":["../src/compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAe,MAAM,mDAAmD,CAAA;AACrG,OAAO,EAAE,eAAe,EAAkB,MAAM,mDAAmD,CAAA;AAEnG,OAAO,EAAE,OAAO,EAAE,MAAM,uDAAuD,CAAA;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,0DAA0D,CAAA;AAGvF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iEAAiE,CAAA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;IACpC,OAAO,SAAS,CAAC,CAAe,EAAE,CAAe,CAAC,CAAC;AACrD,CAAC;AACD;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,CAAQ,EAAE,CAAQ;IAC1C,OAAO,eAAe,CAAC,CAAe,EAAE,CAAe,CAAC,CAAC;AAC3D,CAAC;AAED,yBAAyB;AACzB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AAE5E,mCAAmC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,CAAA","sourcesContent":["/**\n * compat — brepjs 同名兼容 shim(D12,批次一的桥接面)\n *\n * 设计:docs/plans/2026-09-01-layered-api-architecture.md §D12 / §7.3 / §7.5\n *\n * 移植的钣金源文件只改 import 来源行(`from 'brepjs'` → `from './compat.js'`),\n * Result 消费点零改动。本文件是包内**唯一**桥接点(§9 验收白名单:src 中\n * `kernel/`、`getBackends`、`getSlot` 零命中,compat.ts 除外)——\n * 批次一(纯 2D/数据层)需要的符号以 vendored L1/L2 的同名形态提供:\n *\n * - Result 机制与类型:vendored `core/result.js` / `core/errors.js` /\n * `core/shapeTypes.js` / `core/validityTypes.js` / `core/types.js`;\n * - 2D/查询 op:直包 vendored L2(`primitiveFns.line/wire/wireLoop`、\n * `topologyQueryFns.getEdges`、`curveFns.curveStartPoint/curveEndPoint`)——\n * 产出的都是 brepjs 原样句柄形态(同一 occt-wasm 实例,D10),与 3D 批次\n * 经 L3 `cad.*` 的路径不同:批次一不碰 3D 实体,无需 faijs Shape 包装。\n *\n * vec* 纯函数按 §7.5 ⑤ 不映射到 cad 命名空间;批次一各文件未消费 vec*,\n * 待 3D 批次需要时从 vendored `utils/vec3.js` 在此 re-export。\n */\n\nimport { ok, err, isOk, isErr, type Result } from '@faicad/faijs-core/vendored/brepjs/core/result.js'\nimport { validationError, type BrepError } from '@faicad/faijs-core/vendored/brepjs/core/errors.js'\nimport type { Solid, Wire, Edge, Face, AnyShape } from '@faicad/faijs-core/vendored/brepjs/core/shapeTypes.js'\nimport { isSolid } from '@faicad/faijs-core/vendored/brepjs/core/shapeTypes.js'\nimport type { ClosedWire, ValidSolid } from '@faicad/faijs-core/vendored/brepjs/core/validityTypes.js'\nimport { isPlanarWire } from '@faicad/faijs-core/vendored/brepjs/core/validityTypes.js'\nimport type { Vec3 } from '@faicad/faijs-core/vendored/brepjs/core/types.js'\nimport type { Bounds3D } from '@faicad/faijs-core/vendored/brepjs/topology/topologyQueryFns.js'\nimport { getSolids, getFaces, getBounds } from '@faicad/faijs-core/vendored/brepjs/topology/topologyQueryFns.js'\nimport {\n line as brepjsLine,\n wire as brepjsWire,\n wireLoop as brepjsWireLoop,\n box as brepjsBox,\n cylinder as brepjsCylinder,\n sphere as brepjsSphere,\n face as brepjsFace,\n polygon as brepjsPolygon,\n} from '@faicad/faijs-core/vendored/brepjs/topology/primitiveFns.js'\nimport { unwrap as brepjsUnwrap } from '@faicad/faijs-core/vendored/brepjs/core/result.js'\nimport { fuse as brepjsFuse, cut as brepjsCut, intersect as brepjsIntersect } from '@faicad/faijs-core/vendored/brepjs/topology/booleanFns.js'\nimport { rotate as brepjsRotate, translate as brepjsTranslate } from '@faicad/faijs-core/vendored/brepjs/topology/transformFns.js'\nimport { extrude as brepjsExtrude } from '@faicad/faijs-core/vendored/brepjs/operations/extrudeFns.js'\nimport { getEdges as brepjsGetEdges } from '@faicad/faijs-core/vendored/brepjs/topology/topologyQueryFns.js'\nimport {\n curveStartPoint as brepjsCurveStartPoint,\n curveEndPoint as brepjsCurveEndPoint,\n} from '@faicad/faijs-core/vendored/brepjs/topology/curveFns.js'\nimport { isValid } from '@faicad/faijs-core/vendored/brepjs/topology/healingFns.js'\nimport { measureVolume, measureArea } from '@faicad/faijs-core/vendored/brepjs/measurement/measureFns.js'\nimport {\n getSurfaceType,\n pointOnSurface,\n normalAt,\n faceCenter,\n} from '@faicad/faijs-core/vendored/brepjs/topology/faceFns.js'\nimport { sharedEdges } from '@faicad/faijs-core/vendored/brepjs/topology/adjacencyFns.js'\nimport { outerWire as brepjsOuterWire } from '@faicad/faijs-core/vendored/brepjs/topology/faceFns.js'\nimport {\n vecAdd,\n vecSub,\n vecScale,\n vecDot,\n vecCross,\n vecNormalize,\n vecLength,\n} from '@faicad/faijs-core/vendored/brepjs/core/vecOps.js'\n\n// ── Result 机制(L1 core/result + core/errors,brepjs 同名) ──\nexport { ok, err, isOk, isErr, validationError, brepjsUnwrap as unwrap }\nexport type { Result, BrepError }\n\n// ── 类型(L1,brepjs 同名;批次一消费的类型全集) ──\nexport type { Solid, Wire, Edge, Face, AnyShape, ClosedWire, ValidSolid, Vec3, Bounds3D }\n\n// ── 2D/查询 op(直 re-export vendored L2,保留 brepjs 同名同签名) ──\nexport { brepjsLine as line, brepjsWire as wire, brepjsWireLoop as wireLoop }\nexport { brepjsGetEdges as getEdges, getSolids, getFaces, getBounds }\nexport { isSolid, isPlanarWire, isValid }\nexport { brepjsCurveStartPoint as curveStartPoint, brepjsCurveEndPoint as curveEndPoint }\n\n// ── 3D op(批次二/三:布尔/图元/变换/拉伸) ──\nexport { brepjsBox as box, brepjsCylinder as cylinder, brepjsSphere as sphere, brepjsFace as face }\nexport { brepjsPolygon as polygon, brepjsOuterWire as outerWire }\nexport { brepjsExtrude as extrude }\nexport { brepjsTranslate as translate }\n\n// 上游 brepjs 18 的 rotate 以 `{ at, axis }` 选项对象接受轴;vendored 树是\n// 四参数位置形态(P5 锁定 commit)。compat 包装对齐上游同名同签(D12)。\n/**\n * Rotate a shape by an angle in degrees around an axis.\n * @param shape - The shape to rotate.\n * @param angle - Rotation angle in degrees.\n * @param options - Axis and pivot (`at`) for the rotation; defaults to the Z\n * axis through the origin, matching upstream brepjs.\n * @returns A new rotated shape.\n */\nexport function rotate<T extends AnyShape>(\n shape: T,\n angle: number,\n options: { at?: Vec3; axis?: Vec3 } = {}\n): T {\n return brepjsRotate(shape, angle, options.at ?? [0, 0, 0], options.axis ?? [0, 0, 1]);\n}\n\n// 上游 brepjs 18 的布尔接受任意 3D shape;vendored 首重载要求 ValidSolid\n// 品牌(编译期幻影)。compat 以 Solid 形态导出、内部 cast(运行时无差异)。\n/**\n * Fuse two solids (union). Accepts plain `Solid` operands like upstream\n * brepjs; the vendored `ValidSolid` brand is applied internally.\n * @param a - First solid operand.\n * @param b - Second solid operand.\n * @returns `Ok` with the fused solid, or `Err` when the result is not 3D.\n */\nexport function fuse(a: Solid, b: Solid): Result<ValidSolid> {\n return brepjsFuse(a as ValidSolid, b as ValidSolid);\n}\n/**\n * Cut solid `b` out of solid `a` (difference).\n * @param a - Solid to subtract from.\n * @param b - Solid to subtract.\n * @returns `Ok` with the result, or `Err` when the result is not 3D.\n */\nexport function cut(a: Solid, b: Solid): Result<ValidSolid> {\n return brepjsCut(a as ValidSolid, b as ValidSolid);\n}\n/**\n * Intersect two solids (common volume).\n * @param a - First solid operand.\n * @param b - Second solid operand.\n * @returns `Ok` with the intersection, or `Err` when the result is not 3D.\n */\nexport function intersect(a: Solid, b: Solid): Result<ValidSolid> {\n return brepjsIntersect(a as ValidSolid, b as ValidSolid);\n}\n\n// ── 度量 / 曲面查询(批次二/三) ──\nexport { measureVolume, measureArea }\nexport { getSurfaceType, pointOnSurface, normalAt, faceCenter, sharedEdges }\n\n// ── 向量纯函数(§7.5 ⑤,不映射 cad 命名空间) ──\nexport { vecAdd, vecSub, vecScale, vecDot, vecCross, vecNormalize, vecLength }\n"]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { type Result, type Vec3, type Solid } from '@faicad/faijs/brepjs-compat';
|
|
2
|
+
import type { ContourFlangeSpec, FlatSide, ProfileSegment, SheetMetalPart } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The local frame of one contour-flange segment: the contact origin plus the
|
|
5
|
+
* segment's run, normal and shared bend-axis directions.
|
|
6
|
+
*/
|
|
7
|
+
export interface SegmentFrame {
|
|
8
|
+
/** Origin of the −normal (bottom) surface at the start of this segment. */
|
|
9
|
+
origin: Vec3;
|
|
10
|
+
/** Outward run direction (the segment's local +X). */
|
|
11
|
+
run: Vec3;
|
|
12
|
+
/** Top-surface normal (+Z), n = bendAxis × run. */
|
|
13
|
+
n: Vec3;
|
|
14
|
+
/** Bend axis along the base edge (+Y), shared by every segment. */
|
|
15
|
+
axis: Vec3;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Author a contour flange: an OPEN 2D profile (alternating line/arc segments) swept
|
|
19
|
+
* along one straight edge of the base flat. Each arc is a cylindrical bend, each
|
|
20
|
+
* line a flat leg; consecutive segments chain frame-to-frame exactly as
|
|
21
|
+
* {@link authorPart} chains flanges, building one connected multi-bend cross-section
|
|
22
|
+
* (a return, a hat, a J). The recorded {@link ContourFlangeFeature} carries each
|
|
23
|
+
* segment's EXACT developed length (lines: `length`; arcs: the canonical
|
|
24
|
+
* {@link developedLength}) so the unfold lays the strip out straight with no error.
|
|
25
|
+
* Construction stays on the public, OCCT-WASM-safe API.
|
|
26
|
+
* @param part the sheet-metal part the contour flange is added to (must already carry a solid)
|
|
27
|
+
* @param spec the contour-flange specification: profile segments, side, offset, width and optional bend rule
|
|
28
|
+
* @returns a `Result<SheetMetalPart>` — `ok` with the part plus the fused solid and the recorded
|
|
29
|
+
* {@link ContourFlangeFeature}, or `err` with a `validationError` on invalid input
|
|
30
|
+
*/
|
|
31
|
+
export declare function authorContourFlange(part: SheetMetalPart, spec: ContourFlangeSpec): Result<SheetMetalPart>;
|
|
32
|
+
/**
|
|
33
|
+
* Result of building one contour-flange segment: the fused solid and the next
|
|
34
|
+
* segment's chained frame.
|
|
35
|
+
*/
|
|
36
|
+
export interface BuiltSegment {
|
|
37
|
+
solid: Solid;
|
|
38
|
+
frame: SegmentFrame;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Result of building a cylindrical bend: {@link BuiltSegment} plus the world-space
|
|
42
|
+
* origin of the bend axis.
|
|
43
|
+
*/
|
|
44
|
+
export interface BuiltArc extends BuiltSegment {
|
|
45
|
+
axisOrigin: Vec3;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Add one straight leg of `legLength` extending from `frame.origin` along
|
|
49
|
+
* `frame.run`, full thickness along `frame.n`, across `span` along `frame.axis`.
|
|
50
|
+
* The next segment's frame starts at the leg's far end.
|
|
51
|
+
* @param base the solid the new leg is fused onto
|
|
52
|
+
* @param frame the current segment frame the leg is built in
|
|
53
|
+
* @param span the flange width along the bend axis
|
|
54
|
+
* @param thickness the sheet thickness
|
|
55
|
+
* @param legLength the straight-run length of the leg
|
|
56
|
+
* @returns a `Result<BuiltSegment>` — `ok` with the fused solid and the next segment's
|
|
57
|
+
* frame, or `err` when the boolean fuse fails
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildLineLeg(base: Solid, frame: SegmentFrame, span: number, thickness: number, legLength: number): Result<BuiltSegment>;
|
|
60
|
+
/**
|
|
61
|
+
* Add one cylindrical bend turning the running direction by `angleDeg`. Mirrors
|
|
62
|
+
* {@link authorPart}'s bend patch: a hollow tube (outer R+T, inner R) intersected
|
|
63
|
+
* with the fold wedge, in a canonical frame mapped onto the current segment frame.
|
|
64
|
+
* The returned frame's run/normal are rotated by the fold so the next leg continues
|
|
65
|
+
* tangentially.
|
|
66
|
+
* @param base the solid the bend is fused onto
|
|
67
|
+
* @param frame the current segment frame the bend turns from
|
|
68
|
+
* @param span the flange width along the bend axis
|
|
69
|
+
* @param thickness the sheet thickness
|
|
70
|
+
* @param seg the arc profile segment: radius, angle and fold direction
|
|
71
|
+
* @returns a `Result<BuiltArc>` — `ok` with the fused solid, the rotated next frame and the
|
|
72
|
+
* world-space bend axis origin, or `err` with a `validationError` on invalid geometry
|
|
73
|
+
*/
|
|
74
|
+
export declare function buildArcBend(base: Solid, frame: SegmentFrame, span: number, thickness: number, seg: Extract<ProfileSegment, {
|
|
75
|
+
kind: 'arc';
|
|
76
|
+
}>): Result<BuiltArc>;
|
|
77
|
+
/**
|
|
78
|
+
* One of the four straight edges of a flat region, resolved into the start line a
|
|
79
|
+
* profile is chained from: edge direction, outward normal, start point and length.
|
|
80
|
+
*/
|
|
81
|
+
export interface BaseEdge {
|
|
82
|
+
dir: Vec3;
|
|
83
|
+
out: Vec3;
|
|
84
|
+
start: Vec3;
|
|
85
|
+
length: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolve one of the four edges of the base flat (the contour-flange root).
|
|
89
|
+
* @param part the sheet-metal part whose base flat edge is resolved
|
|
90
|
+
* @param side which of the four base-flat edges to resolve (`'xmax'`/`'xmin'`/`'ymax'`/`'ymin'`)
|
|
91
|
+
* @returns the resolved {@link BaseEdge} — edge direction, outward normal, start point and length
|
|
92
|
+
*/
|
|
93
|
+
export declare function baseEdge(part: SheetMetalPart, side: FlatSide): BaseEdge;
|
|
94
|
+
/**
|
|
95
|
+
* Resolve one of the four edges of an arbitrary flat region (its world top-surface
|
|
96
|
+
* frame), the region-aware generalization of {@link baseEdge}: the base is the
|
|
97
|
+
* special case where `origin = 0`, `u = +X`, `v = +Y`, `n = +Z`. Used by hems and
|
|
98
|
+
* jogs to chain their profile off a named flange (or the base) edge.
|
|
99
|
+
* @param frame the region's world top-surface frame (origin, u/v/n axes and extents)
|
|
100
|
+
* @param side which of the four region edges to resolve
|
|
101
|
+
* @returns the resolved {@link BaseEdge} — edge direction, outward normal, start point and length
|
|
102
|
+
*/
|
|
103
|
+
export declare function regionEdge(frame: {
|
|
104
|
+
origin: Vec3;
|
|
105
|
+
u: Vec3;
|
|
106
|
+
v: Vec3;
|
|
107
|
+
n: Vec3;
|
|
108
|
+
uLen: number;
|
|
109
|
+
vLen: number;
|
|
110
|
+
}, side: FlatSide): BaseEdge;
|
|
111
|
+
/**
|
|
112
|
+
* The starting {@link SegmentFrame} for a profile chained off `edge` at `offset`
|
|
113
|
+
* along it: contact at the edge, run pointing outward, normal = the region normal,
|
|
114
|
+
* bend axis along the edge. Shared by the contour-flange, hem and jog builders.
|
|
115
|
+
* @param edge the resolved region edge the profile starts from
|
|
116
|
+
* @param n the region normal, used as the frame's +Z
|
|
117
|
+
* @param offset the start position along the edge, measured from `edge.start`
|
|
118
|
+
* @returns the {@link SegmentFrame} with contact at the edge at `offset`, run pointing
|
|
119
|
+
* outward and axis along the edge
|
|
120
|
+
*/
|
|
121
|
+
export declare function initialSegmentFrame(edge: BaseEdge, n: Vec3, offset: number): SegmentFrame;
|
|
122
|
+
//# sourceMappingURL=contourFlangeFns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contourFlangeFns.d.ts","sourceRoot":"","sources":["../src/contourFlangeFns.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,KAAK,EAkBX,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAIV,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,cAAc,EACf,MAAM,YAAY,CAAC;AAIpB;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,MAAM,EAAE,IAAI,CAAC;IACb,sDAAsD;IACtD,GAAG,EAAE,IAAI,CAAC;IACV,mDAAmD;IACnD,CAAC,EAAE,IAAI,CAAC;IACR,mEAAmE;IACnE,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,iBAAiB,GACtB,MAAM,CAAC,cAAc,CAAC,CAuGxB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,UAAU,EAAE,IAA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