@faicad/faijs-fcstd 0.17.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/LICENSE +29 -0
- package/NOTICE +20 -0
- package/dist/attachment.d.ts +72 -0
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +93 -0
- package/dist/attachment.js.map +1 -0
- package/dist/bspline.d.ts +58 -0
- package/dist/bspline.d.ts.map +1 -0
- package/dist/bspline.js +93 -0
- package/dist/bspline.js.map +1 -0
- package/dist/build-fai-zip.d.ts +40 -0
- package/dist/build-fai-zip.d.ts.map +1 -0
- package/dist/build-fai-zip.js +111 -0
- package/dist/build-fai-zip.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +37 -0
- package/dist/cli.js.map +1 -0
- package/dist/codegen.d.ts +83 -0
- package/dist/codegen.d.ts.map +1 -0
- package/dist/codegen.js +618 -0
- package/dist/codegen.js.map +1 -0
- package/dist/container.d.ts +75 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +36 -0
- package/dist/container.js.map +1 -0
- package/dist/contour.d.ts +43 -0
- package/dist/contour.d.ts.map +1 -0
- package/dist/contour.js +132 -0
- package/dist/contour.js.map +1 -0
- package/dist/convert.d.ts +69 -0
- package/dist/convert.d.ts.map +1 -0
- package/dist/convert.js +303 -0
- package/dist/convert.js.map +1 -0
- package/dist/document.d.ts +48 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/document.js +140 -0
- package/dist/document.js.map +1 -0
- package/dist/expressions.d.ts +79 -0
- package/dist/expressions.d.ts.map +1 -0
- package/dist/expressions.js +162 -0
- package/dist/expressions.js.map +1 -0
- package/dist/external-geo.d.ts +49 -0
- package/dist/external-geo.d.ts.map +1 -0
- package/dist/external-geo.js +140 -0
- package/dist/external-geo.js.map +1 -0
- package/dist/feature-translate.d.ts +193 -0
- package/dist/feature-translate.d.ts.map +1 -0
- package/dist/feature-translate.js +1441 -0
- package/dist/feature-translate.js.map +1 -0
- package/dist/fillet-edges.d.ts +26 -0
- package/dist/fillet-edges.d.ts.map +1 -0
- package/dist/fillet-edges.js +36 -0
- package/dist/fillet-edges.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/placement.d.ts +93 -0
- package/dist/placement.d.ts.map +1 -0
- package/dist/placement.js +117 -0
- package/dist/placement.js.map +1 -0
- package/dist/planegcs-backend.d.ts +34 -0
- package/dist/planegcs-backend.d.ts.map +1 -0
- package/dist/planegcs-backend.js +665 -0
- package/dist/planegcs-backend.js.map +1 -0
- package/dist/sketch-parse.d.ts +199 -0
- package/dist/sketch-parse.d.ts.map +1 -0
- package/dist/sketch-parse.js +263 -0
- package/dist/sketch-parse.js.map +1 -0
- package/dist/sketch-solver.d.ts +63 -0
- package/dist/sketch-solver.d.ts.map +1 -0
- package/dist/sketch-solver.js +28 -0
- package/dist/sketch-solver.js.map +1 -0
- package/dist/sketch-verify.d.ts +53 -0
- package/dist/sketch-verify.d.ts.map +1 -0
- package/dist/sketch-verify.js +71 -0
- package/dist/sketch-verify.js.map +1 -0
- package/dist/structural-types.d.ts +96 -0
- package/dist/structural-types.d.ts.map +1 -0
- package/dist/structural-types.js +155 -0
- package/dist/structural-types.js.map +1 -0
- package/dist/unpack.d.ts +44 -0
- package/dist/unpack.d.ts.map +1 -0
- package/dist/unpack.js +64 -0
- package/dist/unpack.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sketch-parse.js","sourceRoot":"","sources":["../src/sketch-parse.ts"],"names":[],"mappings":"AAeA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CA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KAAK,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI;gBAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC;IACD,OAAO;QACL,KAAK;QACL,WAAW;QACX,gBAAgB;QAChB,cAAc,EAAE,CAAC,GAAG,cAAc,CAAC;KACpC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * M3.1 — FCStd sketch parsing: <GeometryList> → SketchGeom[],\n * <ConstraintList> → SketchCon[].\n *\n * Field format per plan §5.2/§5.3:\n * - geometry coordinates are 3D (X/Y/Z); sketch-local Z is usually 0\n * - <Constrain> (singular) carries Type as the ConstraintType enum integer\n * (Constraint.h:52-77)\n * - ElementIds/ElementPositions (new) take precedence over First/Second/Third\n * (old); 47.5% of sample constraints lack the new format (§5.3.1)\n * - IsDriving defaults to true when missing (Constraint.h:240)\n * - geoId: >= 0 own geometry; -1 HAxis/RtPnt; -2 VAxis; <= -3 external (D4)\n */\nimport type { FcstdProperty } from './document.js';\n\n/** ConstraintType enum values (src/Mod/Sketcher/App/Constraint.h:52-77) */\nexport const ConstraintType = {\n Coincident: 1,\n Horizontal: 2,\n Vertical: 3,\n Parallel: 4,\n Tangent: 5,\n Distance: 6,\n DistanceX: 7,\n DistanceY: 8,\n Angle: 9,\n Perpendicular: 10,\n Radius: 11,\n Equal: 12,\n PointOnObject: 13,\n Symmetric: 14,\n InternalAlignment: 15,\n SnellsLaw: 16,\n Block: 17,\n Diameter: 18,\n Weight: 19,\n Group: 20,\n Text: 21,\n} as const;\n\n/**\n * Human-readable names for the ConstraintType enum integers (debugging/\n * diagnostics only).\n */\nexport const CONSTRAINT_NAMES: Record<number, string> = {\n 1: 'Coincident', 2: 'Horizontal', 3: 'Vertical', 4: 'Parallel', 5: 'Tangent',\n 6: 'Distance', 7: 'DistanceX', 8: 'DistanceY', 9: 'Angle', 10: 'Perpendicular',\n 11: 'Radius', 12: 'Equal', 13: 'PointOnObject', 14: 'Symmetric',\n 15: 'InternalAlignment', 16: 'SnellsLaw', 17: 'Block', 18: 'Diameter',\n 19: 'Weight', 20: 'Group', 21: 'Text',\n};\n\n/** GeoEnum (src/Mod/Sketcher/App/GeoEnum.h:71-78) */\nexport const GeoId = {\n RtPnt: -1,\n HAxis: -1,\n VAxis: -2,\n RefExt: -3,\n} as const;\n\n/** PointPos (GeoEnum.h:88-94) */\nexport const PointPos = {\n none: 0, // edge itself\n start: 1,\n end: 2,\n mid: 3, // center of circle/ellipse\n} as const;\n\n/**\n * One parsed sketch geometry element (point, line, circle, arc or ellipse),\n * in 3D sketch-local coordinates.\n */\nexport type SketchGeom =\n | { kind: 'point'; index: number; x: number; y: number; z: number }\n | { kind: 'line'; index: number; x1: number; y1: number; z1: number; x2: number; y2: number; z2: number }\n | { kind: 'circle'; index: number; cx: number; cy: number; cz: number; radius: number }\n | {\n kind: 'arc';\n index: number;\n cx: number;\n cy: number;\n cz: number;\n radius: number;\n startAngle: number; // radians\n endAngle: number;\n /** arc endpoints derived from angles (kept for solver wiring) */\n x1: number;\n y1: number;\n z1: number;\n x2: number;\n y2: number;\n z2: number;\n }\n | {\n kind: 'ellipse';\n index: number;\n cx: number;\n cy: number;\n cz: number;\n majorRadius: number;\n minorRadius: number;\n /** rotation of major axis, radians */\n angleXU: number;\n /** first focus (computed) */\n fx1: number;\n fy1: number;\n fx2: number;\n fy2: number;\n }\n | {\n /** P4: Part::GeomBSplineCurve (Poles/Knots/Degree/IsPeriodic) */\n kind: 'bspline';\n index: number;\n poles: { x: number; y: number }[];\n knots: number[];\n degree: number;\n periodic: boolean;\n /** curve start/end (exact for clamped splines; solver wiring + chaining) */\n x1: number;\n y1: number;\n z1: number;\n x2: number;\n y2: number;\n z2: number;\n };\n\n/**\n * One (geometry, point) reference inside a constraint: a geoId plus a\n * PointPos selector.\n */\nexport interface GeoRef {\n /** geometry id: >= 0 own geometry; -1 HAxis/RtPnt; -2 VAxis; <= -3 external */\n geoId: number;\n /** PointPos selector (0 = edge itself, 1/2 = start/end, 3 = center) */\n pos: number; // PointPos\n}\n\n/**\n * One parsed sketch constraint (`<Constrain>` element).\n */\nexport interface SketchCon {\n /** index in the ConstraintList */\n index: number;\n /** ConstraintType integer */\n type: number;\n /** resolved element refs (ElementIds or First/Second/Third fallback) */\n refs: GeoRef[];\n /** driving dimension value (Distance/Angle/Radius/...) */\n value: number;\n /** IsDriving; missing means true (§5.3.1) */\n isDriving: boolean;\n /** raw name attribute */\n name: string;\n /** InternalAlignmentType when type === 15 */\n internalAlignmentType?: number;\n}\n\n/**\n * The fully parsed sketch: geometry, constraints, constrainedness and the set\n * of referenced external geoIds.\n */\nexport interface ParsedSketch {\n geoms: SketchGeom[];\n constraints: SketchCon[];\n fullyConstrained: boolean;\n /** geoIds <= -3 referenced by constraints (D4 external geometry) */\n externalGeoIds: number[];\n}\n\nfunction num(attrs: Record<string, string>, key: string): number {\n const v = attrs[key];\n return v === undefined ? 0 : Number(v);\n}\n\n/**\n * Parse a sketch's `<GeometryList>` property into typed geometry elements.\n *\n * @param prop - the sketch's Geometry property.\n * @returns the parsed geometry list; unsupported element kinds degrade to a\n * NaN point so the caller can downgrade the sketch.\n */\nexport function parseGeometryList(prop: FcstdProperty): SketchGeom[] {\n // <GeometryList count=\"N\"><Geometry type=\"...\">...</Geometry>...</GeometryList>\n const listEl = prop.children[0];\n if (!listEl) return [];\n const geoms: SketchGeom[] = [];\n let index = 0;\n for (const child of listEl.children) {\n const gtype = child.attributes['type'] ?? '';\n // <Geometry> may carry <Construction/>, <GeoExtensions/> or <UID/>\n // siblings before the actual geometry element — pick the first real\n // geometry child.\n const inner = child.children.find(\n (c) => c.tagName !== 'Construction' && c.tagName !== 'GeoExtensions' && c.tagName !== 'UID',\n );\n if (!inner) continue;\n const a = inner.attributes;\n const tag = inner.tagName;\n switch (true) {\n case tag === 'LineSegment' || gtype.includes('GeomLineSegment'): {\n geoms.push({\n kind: 'line',\n index,\n x1: num(a, 'StartX'), y1: num(a, 'StartY'), z1: num(a, 'StartZ'),\n x2: num(a, 'EndX'), y2: num(a, 'EndY'), z2: num(a, 'EndZ'),\n });\n break;\n }\n case tag === 'Circle' || gtype.includes('GeomCircle'): {\n geoms.push({\n kind: 'circle',\n index,\n cx: num(a, 'CenterX'), cy: num(a, 'CenterY'), cz: num(a, 'CenterZ'),\n radius: num(a, 'Radius'),\n });\n break;\n }\n case tag === 'ArcOfCircle' || gtype.includes('GeomArcOfCircle'): {\n const cx = num(a, 'CenterX');\n const cy = num(a, 'CenterY');\n const cz = num(a, 'CenterZ');\n const r = num(a, 'Radius');\n const sa = num(a, 'StartAngle');\n const ea = num(a, 'EndAngle');\n geoms.push({\n kind: 'arc',\n index, cx, cy, cz, radius: r, startAngle: sa, endAngle: ea,\n x1: cx + r * Math.cos(sa), y1: cy + r * Math.sin(sa), z1: cz,\n x2: cx + r * Math.cos(ea), y2: cy + r * Math.sin(ea), z2: cz,\n });\n break;\n }\n case tag === 'GeomPoint' || tag === 'Point' || gtype.includes('GeomPoint'): {\n geoms.push({ kind: 'point', index, x: num(a, 'X'), y: num(a, 'Y'), z: num(a, 'Z') });\n break;\n }\n case tag === 'Ellipse' || gtype.includes('GeomEllipse'): {\n const cx = num(a, 'CenterX');\n const cy = num(a, 'CenterY');\n const major = num(a, 'MajorRadius');\n const minor = num(a, 'MinorRadius');\n const ang = num(a, 'AngleXU');\n const f = Math.sqrt(Math.max(0, major * major - minor * minor));\n const ca = Math.cos(ang);\n const sa2 = Math.sin(ang);\n geoms.push({\n kind: 'ellipse', index, cx, cy, cz: num(a, 'CenterZ'),\n majorRadius: major, minorRadius: minor, angleXU: ang,\n fx1: cx + f * ca, fy1: cy + f * sa2,\n fx2: cx - f * ca, fy2: cy - f * sa2,\n });\n break;\n }\n case tag === 'BSplineCurve' || gtype.includes('GeomBSplineCurve'): {\n // P4: poles are child <Pole X= Y= Z=/> elements, knots child\n // <Knot Value= Multiplicity=/> (attributes only carry counts).\n const poles = inner.children\n .filter((c) => c.tagName === 'Pole')\n .map((c) => ({ x: num(c.attributes, 'X'), y: num(c.attributes, 'Y') }));\n const knots: number[] = [];\n for (const c of inner.children) {\n if (c.tagName !== 'Knot') continue;\n const m = num(c.attributes, 'Multiplicity');\n const v = num(c.attributes, 'Value');\n const mult = Number.isFinite(m) && m >= 1 ? m : 1;\n for (let k = 0; k < mult; k++) knots.push(v);\n }\n const degree = num(a, 'Degree');\n const periodic = num(a, 'IsPeriodic') !== 0;\n const first = poles[0];\n const last = poles[poles.length - 1];\n geoms.push({\n kind: 'bspline',\n index,\n poles,\n knots,\n degree,\n periodic,\n x1: first ? first.x : NaN,\n y1: first ? first.y : NaN,\n z1: 0,\n x2: last ? last.x : NaN,\n y2: last ? last.y : NaN,\n z2: 0,\n });\n break;\n }\n default:\n // ArcOfEllipse / hyperbola / parabola: not supported in M3\n // (sample set: 0 occurrences, plan §5.5.3); caller downgrades to L2.\n geoms.push({ kind: 'point', index, x: NaN, y: NaN, z: NaN });\n break;\n }\n index++;\n }\n return geoms;\n}\n\nfunction parseGeoRef(attrs: Record<string, string>, prefix: string): GeoRef {\n return { geoId: Math.trunc(num(attrs, prefix)), pos: Math.trunc(num(attrs, `${prefix}Pos`)) };\n}\n\n/**\n * Parse a sketch's `<ConstraintList>` property into constraint records.\n *\n * @param prop - the sketch's Constraints property.\n * @returns the parsed constraints, with element refs resolved from\n * ElementIds/ElementPositions or the old First/Second/Third fallback.\n */\nexport function parseConstraintList(prop: FcstdProperty): SketchCon[] {\n // <ConstraintList count=\"N\"><Constrain .../>...</ConstraintList>\n const listEl = prop.children[0];\n if (!listEl) return [];\n const cons: SketchCon[] = [];\n let index = 0;\n for (const child of listEl.children) {\n if (child.tagName !== 'Constrain') continue;\n const a = child.attributes;\n const type = Math.trunc(num(a, 'Type'));\n\n // ElementIds (new, space-separated) takes precedence; fallback First/Second/Third\n const refs: GeoRef[] = [];\n const eids = a['ElementIds']?.trim();\n const eposs = a['ElementPositions']?.trim();\n if (eids && eposs) {\n const ids = eids.split(/\\s+/).map(Number);\n const poss = eposs.split(/\\s+/).map(Number);\n for (let i = 0; i < ids.length; i++) {\n refs.push({ geoId: ids[i]!, pos: poss[i] ?? 0 });\n }\n } else {\n // old-style triple; Third=GeoUndef(-2000) means unused\n for (const prefix of ['First', 'Second', 'Third']) {\n const geoId = Math.trunc(num(a, prefix));\n if (geoId === -2000) continue;\n refs.push(parseGeoRef(a, prefix));\n }\n }\n\n const isDriving = a['IsDriving'] === undefined ? true : a['IsDriving'] === '1';\n\n cons.push({\n index,\n type,\n refs,\n value: num(a, 'Value'),\n isDriving,\n name: a['Name'] ?? '',\n internalAlignmentType: type === 15 ? Math.trunc(num(a, 'InternalAlignmentType')) : undefined,\n });\n index++;\n }\n return cons;\n}\n\n/**\n * Parse a sketch object's geometry and constraint properties (M3.1 entry).\n *\n * @param geometryProp - the sketch's Geometry property (may be undefined).\n * @param constraintsProp - the sketch's Constraints property (may be undefined).\n * @param fullyConstrained - the sketch's FullyConstrained flag.\n * @returns the parsed sketch, including external geoIds referenced by constraints.\n */\nexport function parseSketchObject(\n geometryProp: FcstdProperty | undefined,\n constraintsProp: FcstdProperty | undefined,\n fullyConstrained: boolean,\n): ParsedSketch {\n const geoms = geometryProp ? parseGeometryList(geometryProp) : [];\n const constraints = constraintsProp ? parseConstraintList(constraintsProp) : [];\n const externalGeoIds = new Set<number>();\n for (const c of constraints) {\n for (const r of c.refs) {\n // GeoUndef (-2000) is an unused-slot placeholder in old-format triples\n // and ElementIds — it is NOT external geometry. External refs are the\n // small negative range starting at RefExt (-3).\n if (r.geoId <= GeoId.RefExt && r.geoId > -2000) externalGeoIds.add(r.geoId);\n }\n }\n return {\n geoms,\n constraints,\n fullyConstrained,\n externalGeoIds: [...externalGeoIds],\n };\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M3.2 — SketchSolver interface (D5) with the planegcs WASM backend.
|
|
3
|
+
*
|
|
4
|
+
* faijs depends only on this interface; the WASM implementation is swappable
|
|
5
|
+
* (前文 B R2/R3). Input: parsed sketch geometry + constraints (M3.1 types).
|
|
6
|
+
* Output: solved geometry or a structured failure — the caller (M3.5) decides
|
|
7
|
+
* between solution and initial-value fallback (D2).
|
|
8
|
+
*/
|
|
9
|
+
import type { Result } from '@faicad/faijs/api/result';
|
|
10
|
+
import type { SketchGeom, SketchCon } from './sketch-parse.js';
|
|
11
|
+
/**
|
|
12
|
+
* Result of one solver run: the solved geometry plus convergence status and
|
|
13
|
+
* diagnostics for the caller's L0/L1/L2 decision (D2).
|
|
14
|
+
*/
|
|
15
|
+
export interface SolveOutcome {
|
|
16
|
+
/** geometry after solve, same order/index as input */
|
|
17
|
+
geoms: SketchGeom[];
|
|
18
|
+
/** true when the solver reports Success with no conflicts */
|
|
19
|
+
converged: boolean;
|
|
20
|
+
/** diagnostics when not converged */
|
|
21
|
+
reason?: 'conflicting' | 'redundant' | 'failed' | 'unsupported-constraint';
|
|
22
|
+
/** constraint indices the solver flagged */
|
|
23
|
+
problemConstraints: number[];
|
|
24
|
+
/** constraint indices dropped because their GCS shape could not be pushed */
|
|
25
|
+
droppedConstraints: number[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One pre-projected external geometry segment passed to the solver as fixed
|
|
29
|
+
* (immutable) geometry.
|
|
30
|
+
*/
|
|
31
|
+
export interface ExternalFixedSeg {
|
|
32
|
+
/** negative geoId in link order: -3, -4, ... (GeoEnum.RefExt downward) */
|
|
33
|
+
geoId: number;
|
|
34
|
+
/** the projected sketch-local 2D polyline (immutable to the solver) */
|
|
35
|
+
polyline: [number, number][];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Solver abstraction (D5): faijs depends only on this interface; the WASM
|
|
39
|
+
* implementation is swappable.
|
|
40
|
+
*/
|
|
41
|
+
export interface SketchSolver {
|
|
42
|
+
/**
|
|
43
|
+
* Solve constraints against the given geometry. The input geometry's stored
|
|
44
|
+
* coordinates are used as the initial guess (D2 — they are FreeCAD's last
|
|
45
|
+
* solution and the ideal starting point).
|
|
46
|
+
*
|
|
47
|
+
* `external` carries pre-projected fixed geometry (M6.3): immutable 2D
|
|
48
|
+
* polylines that constraints may reference by negative geoId. When a
|
|
49
|
+
* constraint references an external geoId not present here, the solver
|
|
50
|
+
* drops that constraint (recorded in droppedConstraints).
|
|
51
|
+
*/
|
|
52
|
+
solve(geoms: SketchGeom[], constraints: SketchCon[], external?: ExternalFixedSeg[]): Promise<Result<SolveOutcome, never>>;
|
|
53
|
+
}
|
|
54
|
+
/** Constraint types the planegcs backend can express (P0 set, plan §7 M3.4). */
|
|
55
|
+
export declare const SUPPORTED_CONSTRAINT_TYPES: Set<number>;
|
|
56
|
+
/**
|
|
57
|
+
* Check whether every constraint in a sketch is expressible by the backend.
|
|
58
|
+
*
|
|
59
|
+
* @param constraints - the parsed sketch constraints.
|
|
60
|
+
* @returns true when every constraint's type is in SUPPORTED_CONSTRAINT_TYPES.
|
|
61
|
+
*/
|
|
62
|
+
export declare function allConstraintsSupported(constraints: SketchCon[]): boolean;
|
|
63
|
+
//# sourceMappingURL=sketch-solver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sketch-solver.d.ts","sourceRoot":"","sources":["../src/sketch-solver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,6DAA6D;IAC7D,SAAS,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,MAAM,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,wBAAwB,CAAC;IAC3E,4CAA4C;IAC5C,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,6EAA6E;IAC7E,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;OASG;IACH,KAAK,CACH,KAAK,EAAE,UAAU,EAAE,EACnB,WAAW,EAAE,SAAS,EAAE,EACxB,QAAQ,CAAC,EAAE,gBAAgB,EAAE,GAC5B,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;CACzC;AAED,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,aAgBrC,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAEzE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Constraint types the planegcs backend can express (P0 set, plan §7 M3.4). */
|
|
2
|
+
export const SUPPORTED_CONSTRAINT_TYPES = new Set([
|
|
3
|
+
1, // Coincident
|
|
4
|
+
2, // Horizontal
|
|
5
|
+
3, // Vertical
|
|
6
|
+
4, // Parallel
|
|
7
|
+
5, // Tangent
|
|
8
|
+
6, // Distance
|
|
9
|
+
7, // DistanceX
|
|
10
|
+
8, // DistanceY
|
|
11
|
+
9, // Angle
|
|
12
|
+
10, // Perpendicular
|
|
13
|
+
11, // Radius
|
|
14
|
+
12, // Equal
|
|
15
|
+
13, // PointOnObject
|
|
16
|
+
14, // Symmetric
|
|
17
|
+
18, // Diameter
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* Check whether every constraint in a sketch is expressible by the backend.
|
|
21
|
+
*
|
|
22
|
+
* @param constraints - the parsed sketch constraints.
|
|
23
|
+
* @returns true when every constraint's type is in SUPPORTED_CONSTRAINT_TYPES.
|
|
24
|
+
*/
|
|
25
|
+
export function allConstraintsSupported(constraints) {
|
|
26
|
+
return constraints.every((c) => SUPPORTED_CONSTRAINT_TYPES.has(c.type));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=sketch-solver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sketch-solver.js","sourceRoot":"","sources":["../src/sketch-solver.ts"],"names":[],"mappings":"AA6DA,gFAAgF;AAChF,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAS;IACxD,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,QAAQ;IACX,EAAE,EAAE,gBAAgB;IACpB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,gBAAgB;IACpB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,WAAW;CAChB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAwB;IAC9D,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * M3.2 — SketchSolver interface (D5) with the planegcs WASM backend.\n *\n * faijs depends only on this interface; the WASM implementation is swappable\n * (前文 B R2/R3). Input: parsed sketch geometry + constraints (M3.1 types).\n * Output: solved geometry or a structured failure — the caller (M3.5) decides\n * between solution and initial-value fallback (D2).\n */\nimport type { Result } from '@faicad/faijs/api/result';\nimport type { SketchGeom, SketchCon } from './sketch-parse.js';\n\n/**\n * Result of one solver run: the solved geometry plus convergence status and\n * diagnostics for the caller's L0/L1/L2 decision (D2).\n */\nexport interface SolveOutcome {\n /** geometry after solve, same order/index as input */\n geoms: SketchGeom[];\n /** true when the solver reports Success with no conflicts */\n converged: boolean;\n /** diagnostics when not converged */\n reason?: 'conflicting' | 'redundant' | 'failed' | 'unsupported-constraint';\n /** constraint indices the solver flagged */\n problemConstraints: number[];\n /** constraint indices dropped because their GCS shape could not be pushed */\n droppedConstraints: number[];\n}\n\n/**\n * One pre-projected external geometry segment passed to the solver as fixed\n * (immutable) geometry.\n */\nexport interface ExternalFixedSeg {\n /** negative geoId in link order: -3, -4, ... (GeoEnum.RefExt downward) */\n geoId: number;\n /** the projected sketch-local 2D polyline (immutable to the solver) */\n polyline: [number, number][];\n}\n\n/**\n * Solver abstraction (D5): faijs depends only on this interface; the WASM\n * implementation is swappable.\n */\nexport interface SketchSolver {\n /**\n * Solve constraints against the given geometry. The input geometry's stored\n * coordinates are used as the initial guess (D2 — they are FreeCAD's last\n * solution and the ideal starting point).\n *\n * `external` carries pre-projected fixed geometry (M6.3): immutable 2D\n * polylines that constraints may reference by negative geoId. When a\n * constraint references an external geoId not present here, the solver\n * drops that constraint (recorded in droppedConstraints).\n */\n solve(\n geoms: SketchGeom[],\n constraints: SketchCon[],\n external?: ExternalFixedSeg[],\n ): Promise<Result<SolveOutcome, never>>;\n}\n\n/** Constraint types the planegcs backend can express (P0 set, plan §7 M3.4). */\nexport const SUPPORTED_CONSTRAINT_TYPES = new Set<number>([\n 1, // Coincident\n 2, // Horizontal\n 3, // Vertical\n 4, // Parallel\n 5, // Tangent\n 6, // Distance\n 7, // DistanceX\n 8, // DistanceY\n 9, // Angle\n 10, // Perpendicular\n 11, // Radius\n 12, // Equal\n 13, // PointOnObject\n 14, // Symmetric\n 18, // Diameter\n]);\n\n/**\n * Check whether every constraint in a sketch is expressible by the backend.\n *\n * @param constraints - the parsed sketch constraints.\n * @returns true when every constraint's type is in SUPPORTED_CONSTRAINT_TYPES.\n */\nexport function allConstraintsSupported(constraints: SketchCon[]): boolean {\n return constraints.every((c) => SUPPORTED_CONSTRAINT_TYPES.has(c.type));\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M3.5 — solved-vs-stored comparison (D2/V2).
|
|
3
|
+
*
|
|
4
|
+
* The on-disk coordinates ARE FreeCAD's last solution, so a correct pipeline
|
|
5
|
+
* re-derives (nearly) the same geometry. maxPointDistance is the V2 metric;
|
|
6
|
+
* its tolerance T1 is calibrated from the sample-set distribution, not
|
|
7
|
+
* pre-set (plan §8).
|
|
8
|
+
*/
|
|
9
|
+
import type { SketchGeom } from './sketch-parse.js';
|
|
10
|
+
import type { SolveOutcome } from './sketch-solver.js';
|
|
11
|
+
/**
|
|
12
|
+
* P4: exported for testability — anchor points used by maxPointDistance.
|
|
13
|
+
*
|
|
14
|
+
* @param g - the sketch geometry element (point/line/circle/arc/ellipse/bspline).
|
|
15
|
+
* @returns the element's comparison anchor points (center/endpoints as applicable).
|
|
16
|
+
*/
|
|
17
|
+
export declare function anchorPoints(g: SketchGeom): {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}[];
|
|
21
|
+
/**
|
|
22
|
+
* Maximum anchor-point distance between two geometry lists (same indexing).
|
|
23
|
+
*
|
|
24
|
+
* @param a - first geometry list (e.g. the solver result).
|
|
25
|
+
* @param b - second geometry list (e.g. the stored geometry).
|
|
26
|
+
* @returns the maximum Euclidean distance between corresponding anchor points
|
|
27
|
+
* (0 when the lists have no comparable points).
|
|
28
|
+
*/
|
|
29
|
+
export declare function maxPointDistance(a: SketchGeom[], b: SketchGeom[]): number;
|
|
30
|
+
/**
|
|
31
|
+
* Three-level downgrade verdict (D3) for one sketch.
|
|
32
|
+
*/
|
|
33
|
+
export interface SketchVerdict {
|
|
34
|
+
/** solved quality level: L0 = solved & matches, L1 = flagged, L2 = baked */
|
|
35
|
+
level: 'L0' | 'L1' | 'L2';
|
|
36
|
+
/** human-readable reason for a non-L0 verdict */
|
|
37
|
+
reason?: string;
|
|
38
|
+
/** max anchor distance between re-solved and stored geometry */
|
|
39
|
+
maxDelta?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Three-level downgrade (D3). L0 = solved & matches stored (delta <= T1).
|
|
43
|
+
* L1 = solver result kept but flagged, stored coords used instead.
|
|
44
|
+
* L2 = baked (unsupported geometry/constraints, external geometry).
|
|
45
|
+
*
|
|
46
|
+
* @param outcome - the solver result, or undefined when none was produced.
|
|
47
|
+
* @param stored - the on-disk (stored) geometry to compare against.
|
|
48
|
+
* @param t1 - the calibrated distance tolerance for the L0/L1 split.
|
|
49
|
+
* @param preBlocked - pre-solve downgrade reason; when set the sketch is L2.
|
|
50
|
+
* @returns the classification verdict for the sketch.
|
|
51
|
+
*/
|
|
52
|
+
export declare function classifySketch(outcome: SolveOutcome | undefined, stored: SketchGeom[], t1: number, preBlocked?: string): SketchVerdict;
|
|
53
|
+
//# sourceMappingURL=sketch-verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sketch-verify.d.ts","sourceRoot":"","sources":["../src/sketch-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,CAgBtE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,MAAM,CAazE;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,MAAM,EAAE,UAAU,EAAE,EACpB,EAAE,EAAE,MAAM,EACV,UAAU,CAAC,EAAE,MAAM,GAClB,aAAa,CASf"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P4: exported for testability — anchor points used by maxPointDistance.
|
|
3
|
+
*
|
|
4
|
+
* @param g - the sketch geometry element (point/line/circle/arc/ellipse/bspline).
|
|
5
|
+
* @returns the element's comparison anchor points (center/endpoints as applicable).
|
|
6
|
+
*/
|
|
7
|
+
export function anchorPoints(g) {
|
|
8
|
+
switch (g.kind) {
|
|
9
|
+
case 'point':
|
|
10
|
+
return [{ x: g.x, y: g.y }];
|
|
11
|
+
case 'line':
|
|
12
|
+
return [{ x: g.x1, y: g.y1 }, { x: g.x2, y: g.y2 }];
|
|
13
|
+
case 'circle':
|
|
14
|
+
return [{ x: g.cx, y: g.cy }];
|
|
15
|
+
case 'arc':
|
|
16
|
+
return [{ x: g.cx, y: g.cy }, { x: g.x1, y: g.y1 }, { x: g.x2, y: g.y2 }];
|
|
17
|
+
case 'ellipse':
|
|
18
|
+
return [{ x: g.cx, y: g.cy }];
|
|
19
|
+
case 'bspline':
|
|
20
|
+
// P4: spline anchors are its exact endpoints (poles move with them)
|
|
21
|
+
return [{ x: g.x1, y: g.y1 }, { x: g.x2, y: g.y2 }];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Maximum anchor-point distance between two geometry lists (same indexing).
|
|
26
|
+
*
|
|
27
|
+
* @param a - first geometry list (e.g. the solver result).
|
|
28
|
+
* @param b - second geometry list (e.g. the stored geometry).
|
|
29
|
+
* @returns the maximum Euclidean distance between corresponding anchor points
|
|
30
|
+
* (0 when the lists have no comparable points).
|
|
31
|
+
*/
|
|
32
|
+
export function maxPointDistance(a, b) {
|
|
33
|
+
let max = 0;
|
|
34
|
+
const n = Math.min(a.length, b.length);
|
|
35
|
+
for (let i = 0; i < n; i++) {
|
|
36
|
+
const pa = anchorPoints(a[i]);
|
|
37
|
+
const pb = anchorPoints(b[i]);
|
|
38
|
+
const m = Math.min(pa.length, pb.length);
|
|
39
|
+
for (let k = 0; k < m; k++) {
|
|
40
|
+
const d = Math.hypot(pa[k].x - pb[k].x, pa[k].y - pb[k].y);
|
|
41
|
+
if (Number.isFinite(d) && d > max)
|
|
42
|
+
max = d;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return max;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Three-level downgrade (D3). L0 = solved & matches stored (delta <= T1).
|
|
49
|
+
* L1 = solver result kept but flagged, stored coords used instead.
|
|
50
|
+
* L2 = baked (unsupported geometry/constraints, external geometry).
|
|
51
|
+
*
|
|
52
|
+
* @param outcome - the solver result, or undefined when none was produced.
|
|
53
|
+
* @param stored - the on-disk (stored) geometry to compare against.
|
|
54
|
+
* @param t1 - the calibrated distance tolerance for the L0/L1 split.
|
|
55
|
+
* @param preBlocked - pre-solve downgrade reason; when set the sketch is L2.
|
|
56
|
+
* @returns the classification verdict for the sketch.
|
|
57
|
+
*/
|
|
58
|
+
export function classifySketch(outcome, stored, t1, preBlocked) {
|
|
59
|
+
if (preBlocked)
|
|
60
|
+
return { level: 'L2', reason: preBlocked };
|
|
61
|
+
if (!outcome)
|
|
62
|
+
return { level: 'L2', reason: 'no-solver-result' };
|
|
63
|
+
if (!outcome.converged) {
|
|
64
|
+
return { level: 'L1', reason: outcome.reason ?? 'solve-failed' };
|
|
65
|
+
}
|
|
66
|
+
const maxDelta = maxPointDistance(outcome.geoms, stored);
|
|
67
|
+
if (maxDelta <= t1)
|
|
68
|
+
return { level: 'L0', maxDelta };
|
|
69
|
+
return { level: 'L1', reason: 'delta-exceeds-t1', maxDelta };
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=sketch-verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sketch-verify.js","sourceRoot":"","sources":["../src/sketch-verify.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,CAAa;IACxC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,OAAO;YACV,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9B,KAAK,MAAM;YACT,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACtD,KAAK,QAAQ;YACX,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChC,KAAK,KAAK;YACR,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5E,KAAK,SAAS;YACZ,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChC,KAAK,SAAS;YACZ,oEAAoE;YACpE,O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;AAcD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAiC,EACjC,MAAoB,EACpB,EAAU,EACV,UAAmB;IAEnB,IAAI,UAAU;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAC3D,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,cAAc,EAAE,CAAC;IACnE,CAAC;IACD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACzD,IAAI,QAAQ,IAAI,EAAE;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACrD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC;AAC/D,CAAC","sourcesContent":["/**\n * M3.5 — solved-vs-stored comparison (D2/V2).\n *\n * The on-disk coordinates ARE FreeCAD's last solution, so a correct pipeline\n * re-derives (nearly) the same geometry. maxPointDistance is the V2 metric;\n * its tolerance T1 is calibrated from the sample-set distribution, not\n * pre-set (plan §8).\n */\nimport type { SketchGeom } from './sketch-parse.js';\nimport type { SolveOutcome } from './sketch-solver.js';\n\n/**\n * P4: exported for testability — anchor points used by maxPointDistance.\n *\n * @param g - the sketch geometry element (point/line/circle/arc/ellipse/bspline).\n * @returns the element's comparison anchor points (center/endpoints as applicable).\n */\nexport function anchorPoints(g: SketchGeom): { x: number; y: number }[] {\n switch (g.kind) {\n case 'point':\n return [{ x: g.x, y: g.y }];\n case 'line':\n return [{ x: g.x1, y: g.y1 }, { x: g.x2, y: g.y2 }];\n case 'circle':\n return [{ x: g.cx, y: g.cy }];\n case 'arc':\n return [{ x: g.cx, y: g.cy }, { x: g.x1, y: g.y1 }, { x: g.x2, y: g.y2 }];\n case 'ellipse':\n return [{ x: g.cx, y: g.cy }];\n case 'bspline':\n // P4: spline anchors are its exact endpoints (poles move with them)\n return [{ x: g.x1, y: g.y1 }, { x: g.x2, y: g.y2 }];\n }\n}\n\n/**\n * Maximum anchor-point distance between two geometry lists (same indexing).\n *\n * @param a - first geometry list (e.g. the solver result).\n * @param b - second geometry list (e.g. the stored geometry).\n * @returns the maximum Euclidean distance between corresponding anchor points\n * (0 when the lists have no comparable points).\n */\nexport function maxPointDistance(a: SketchGeom[], b: SketchGeom[]): number {\n let max = 0;\n const n = Math.min(a.length, b.length);\n for (let i = 0; i < n; i++) {\n const pa = anchorPoints(a[i]!);\n const pb = anchorPoints(b[i]!);\n const m = Math.min(pa.length, pb.length);\n for (let k = 0; k < m; k++) {\n const d = Math.hypot(pa[k]!.x - pb[k]!.x, pa[k]!.y - pb[k]!.y);\n if (Number.isFinite(d) && d > max) max = d;\n }\n }\n return max;\n}\n\n/**\n * Three-level downgrade verdict (D3) for one sketch.\n */\nexport interface SketchVerdict {\n /** solved quality level: L0 = solved & matches, L1 = flagged, L2 = baked */\n level: 'L0' | 'L1' | 'L2';\n /** human-readable reason for a non-L0 verdict */\n reason?: string;\n /** max anchor distance between re-solved and stored geometry */\n maxDelta?: number;\n}\n\n/**\n * Three-level downgrade (D3). L0 = solved & matches stored (delta <= T1).\n * L1 = solver result kept but flagged, stored coords used instead.\n * L2 = baked (unsupported geometry/constraints, external geometry).\n *\n * @param outcome - the solver result, or undefined when none was produced.\n * @param stored - the on-disk (stored) geometry to compare against.\n * @param t1 - the calibrated distance tolerance for the L0/L1 split.\n * @param preBlocked - pre-solve downgrade reason; when set the sketch is L2.\n * @returns the classification verdict for the sketch.\n */\nexport function classifySketch(\n outcome: SolveOutcome | undefined,\n stored: SketchGeom[],\n t1: number,\n preBlocked?: string,\n): SketchVerdict {\n if (preBlocked) return { level: 'L2', reason: preBlocked };\n if (!outcome) return { level: 'L2', reason: 'no-solver-result' };\n if (!outcome.converged) {\n return { level: 'L1', reason: outcome.reason ?? 'solve-failed' };\n }\n const maxDelta = maxPointDistance(outcome.geoms, stored);\n if (maxDelta <= t1) return { level: 'L0', maxDelta };\n return { level: 'L1', reason: 'delta-exceeds-t1', maxDelta };\n}\n"]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Non-modeling FCStd object types — the single source of truth shared by the
|
|
3
|
+
* C4 disposition audit (`convert.ts`) and the code generator (`codegen.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Why a separate module: `codegen.ts` must skip these objects BEFORE it calls
|
|
6
|
+
* the translator (a datum plane must never enter a Body's feature chain), and
|
|
7
|
+
* `convert.ts` must reclassify them after translation. Keeping the sets in
|
|
8
|
+
* `convert.ts` would make `codegen.ts` import it back (convert → codegen), so
|
|
9
|
+
* the knowledge lives here with zero dependencies.
|
|
10
|
+
*
|
|
11
|
+
* C4 contract: an object in these sets is never a translation gap, and its
|
|
12
|
+
* geometry is never emitted as a modeling call. See the per-set docs below for
|
|
13
|
+
* the evidence behind each classification.
|
|
14
|
+
*/
|
|
15
|
+
/** Non-modeling structural/datum types: never translation gaps. They carry
|
|
16
|
+
* no feature semantics (containers, datum planes/lines/origins, groups) —
|
|
17
|
+
* their semantics are consumed by the translator (Body.Group ordering,
|
|
18
|
+
* datum-plane UpToFace anchors), not emitted as cad calls.
|
|
19
|
+
*
|
|
20
|
+
* GOTCHA (PadTest, 2026-09-21): a `PartDesign::Plane` also stores a `Shape`
|
|
21
|
+
* `.brp` member — the plane FACE. The generic "any object with shape evidence
|
|
22
|
+
* is a shape asset" rule therefore imported it and fed it into the Body's
|
|
23
|
+
* union chain, which both corrupts the solid and fails at run time
|
|
24
|
+
* (`[loadBrep] imported shape contains no solid sub-shapes`). Datum shapes are
|
|
25
|
+
* SUPPORT geometry for attachment/up-to resolution, never modeling solids. */
|
|
26
|
+
export declare const STRUCTURAL_TYPES: Set<string>;
|
|
27
|
+
/**
|
|
28
|
+
* 2026-09-20 sweep triage: assembly/import container types — links, assembly
|
|
29
|
+
* containers, import placeholders (Inventor/VRML). They reference or embed
|
|
30
|
+
* external/other geometry but produce no modeling semantics of their own;
|
|
31
|
+
* preserved-only. Modeling features (Part::Mirroring,
|
|
32
|
+
* PartDesign::AdditiveSphere, …) are deliberately NOT here — they stay
|
|
33
|
+
* explicit H7 gaps until translated.
|
|
34
|
+
*/
|
|
35
|
+
export declare const STRUCTURAL_TYPES_EXTENDED: Set<string>;
|
|
36
|
+
/**
|
|
37
|
+
* H7 companion (2026-09-20): FEM workbench objects carry SIMULATION semantics
|
|
38
|
+
* (analysis containers, meshes, solver settings, boundary conditions, result
|
|
39
|
+
* objects, post-processing filters) — no modeling geometry. They used to fall
|
|
40
|
+
* into `type-not-whitelisted` and block whole files whose modeling part was a
|
|
41
|
+
* single box. Like structural types they are `preserved-only`; their
|
|
42
|
+
* regenerable field data (FemMesh / result Data properties) is deliberately NOT
|
|
43
|
+
* carried into the container.
|
|
44
|
+
*
|
|
45
|
+
* DECISION (2026-09-21): the rule is the NAMESPACE, not an enumerated list.
|
|
46
|
+
* Census of the 56-sample corpus (fcstd-port `out/probe-fem-types.mjs`): 29
|
|
47
|
+
* distinct `Fem::` types, **every one** an analysis / mesh / solver / result /
|
|
48
|
+
* constraint / filter object, zero modeling features; and the 3,201-file
|
|
49
|
+
* FreeCAD library contains **0** `Fem::` objects, so the rule's blast radius is
|
|
50
|
+
* exactly the FEM workbench. The previous enumerated list cost four
|
|
51
|
+
* whack-a-mole rounds (each fix uncovered the next layer, because the sweep
|
|
52
|
+
* report records only the first 4 reasons per file: fixed
|
|
53
|
+
* FluidBoundary/Gear/Heatflux/InitialTemperature, then
|
|
54
|
+
* PlaneRotation/Pulley/Temperature/Transform, then three more). The namespace
|
|
55
|
+
* closes the family permanently.
|
|
56
|
+
*
|
|
57
|
+
* Note this classification is a LAST resort: an object with shape evidence is
|
|
58
|
+
* taken by the shape-asset path and a Python object by `python-opaque` long
|
|
59
|
+
* before `auditMapping` consults this predicate.
|
|
60
|
+
*
|
|
61
|
+
* Remote task on record (user decision, 2026-09-20): faijs will port FreeCAD's
|
|
62
|
+
* FEM analysis capability in the future — separate feature; this classification
|
|
63
|
+
* only stops simulation objects from blocking conversion.
|
|
64
|
+
*
|
|
65
|
+
* @param type - the FCStd object type, e.g. "Fem::ConstraintFixed".
|
|
66
|
+
* @returns true when the type belongs to the FEM (simulation) workbench.
|
|
67
|
+
*/
|
|
68
|
+
export declare function isFemStructural(type: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* P1-3 (2026-09-23, fcstd-gap-dev-plan): TechDraw/Drawing are FreeCAD's 2D
|
|
71
|
+
* DRAWING workbenches — pages, templates, views, dimensions, projection
|
|
72
|
+
* groups are documentation OUTPUT rendering a shape onto a sheet and own no
|
|
73
|
+
* modeling geometry (same evidence as the enumerated TechDraw entries in
|
|
74
|
+
* STRUCTURAL_TYPES). The batch-report census had 81 `TechDraw::*` + 20
|
|
75
|
+
* `Drawing::*` objects in `type-not-whitelisted`; a namespace rule (same
|
|
76
|
+
* decision as FEM above) closes the family instead of whack-a-mole.
|
|
77
|
+
*
|
|
78
|
+
* @param type - the FCStd object type, e.g. "TechDraw::DrawViewSection".
|
|
79
|
+
* @returns true when the type belongs to a 2D drawing workbench.
|
|
80
|
+
*/
|
|
81
|
+
export declare function isDrawingStructural(type: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* True when the type carries no modeling semantics — structural/datum/
|
|
84
|
+
* container/drawing/documentation or FEM simulation.
|
|
85
|
+
*
|
|
86
|
+
* `codegen.ts` uses this to short-circuit such objects to `preserved-only`
|
|
87
|
+
* before translation, which is what keeps datum planes out of Body feature
|
|
88
|
+
* chains and keeps their `.brp` face assets out of the shape-asset import path.
|
|
89
|
+
* `convert.ts` uses it for the C4 post-translation reclassification, so the two
|
|
90
|
+
* can never disagree.
|
|
91
|
+
*
|
|
92
|
+
* @param type - the FCStd object type, e.g. "PartDesign::Plane".
|
|
93
|
+
* @returns true when the object must never produce a modeling call or be a shape asset.
|
|
94
|
+
*/
|
|
95
|
+
export declare function isNonModelingType(type: string): boolean;
|
|
96
|
+
//# sourceMappingURL=structural-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural-types.d.ts","sourceRoot":"","sources":["../src/structural-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;8EAU8E;AAC9E,eAAO,MAAM,gBAAgB,aAyB3B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,aAyBpC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKvD"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Non-modeling FCStd object types — the single source of truth shared by the
|
|
3
|
+
* C4 disposition audit (`convert.ts`) and the code generator (`codegen.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Why a separate module: `codegen.ts` must skip these objects BEFORE it calls
|
|
6
|
+
* the translator (a datum plane must never enter a Body's feature chain), and
|
|
7
|
+
* `convert.ts` must reclassify them after translation. Keeping the sets in
|
|
8
|
+
* `convert.ts` would make `codegen.ts` import it back (convert → codegen), so
|
|
9
|
+
* the knowledge lives here with zero dependencies.
|
|
10
|
+
*
|
|
11
|
+
* C4 contract: an object in these sets is never a translation gap, and its
|
|
12
|
+
* geometry is never emitted as a modeling call. See the per-set docs below for
|
|
13
|
+
* the evidence behind each classification.
|
|
14
|
+
*/
|
|
15
|
+
/** Non-modeling structural/datum types: never translation gaps. They carry
|
|
16
|
+
* no feature semantics (containers, datum planes/lines/origins, groups) —
|
|
17
|
+
* their semantics are consumed by the translator (Body.Group ordering,
|
|
18
|
+
* datum-plane UpToFace anchors), not emitted as cad calls.
|
|
19
|
+
*
|
|
20
|
+
* GOTCHA (PadTest, 2026-09-21): a `PartDesign::Plane` also stores a `Shape`
|
|
21
|
+
* `.brp` member — the plane FACE. The generic "any object with shape evidence
|
|
22
|
+
* is a shape asset" rule therefore imported it and fed it into the Body's
|
|
23
|
+
* union chain, which both corrupts the solid and fails at run time
|
|
24
|
+
* (`[loadBrep] imported shape contains no solid sub-shapes`). Datum shapes are
|
|
25
|
+
* SUPPORT geometry for attachment/up-to resolution, never modeling solids. */
|
|
26
|
+
export const STRUCTURAL_TYPES = new Set([
|
|
27
|
+
'PartDesign::Body', 'App::Origin', 'App::Plane', 'App::Line',
|
|
28
|
+
'App::DocumentObjectGroup', 'App::Part', 'PartDesign::Plane', 'PartDesign::Line',
|
|
29
|
+
'PartDesign::CoordinateSystem',
|
|
30
|
+
// H10 companion fix (plan §3.5): datum/annotation types, not modeling
|
|
31
|
+
// features — previously misclassified as translation gaps.
|
|
32
|
+
'App::Point', 'App::Annotation',
|
|
33
|
+
// 2026-09-20 sweep regression triage: Part workbench datum plane (same
|
|
34
|
+
// semantics as App::Plane) and a document text record — non-modeling.
|
|
35
|
+
'Part::Plane', 'App::TextDocument',
|
|
36
|
+
// Part workbench datum line (FEMExample) — same semantics as App::Line.
|
|
37
|
+
'Part::Line',
|
|
38
|
+
// 2026-09-21 triage (ArchDetail corpus): TechDraw is FreeCAD's 2D DRAWING
|
|
39
|
+
// workbench. A page, an SVG template and a projected view are documentation
|
|
40
|
+
// output — they render a shape onto a sheet and own no modeling geometry
|
|
41
|
+
// (probe: none of the three carries a Shape .brp; DrawViewDraft only links
|
|
42
|
+
// its source via `Source`, and a page links its template + views). Same
|
|
43
|
+
// category as App::TextDocument/App::Annotation above. Their modeling
|
|
44
|
+
// content is translated independently through the objects they reference.
|
|
45
|
+
'TechDraw::DrawPage', 'TechDraw::DrawSVGTemplate', 'TechDraw::DrawViewDraft',
|
|
46
|
+
// P1-1(2026-09-23, B2 §3.9):Spreadsheet::Sheet / App::VarSet 是**被引用的
|
|
47
|
+
// 参数数据源**(<<Label>>.Alias 表达式绑定指向它的别名单元格),不是建模对象
|
|
48
|
+
// 也因此不是翻译缺口。preserved-only;其数值经 expressions.evalWithDoc 的
|
|
49
|
+
// 三跳解析进入下游属性(pad-length-expression-non-constant 的真根因)。
|
|
50
|
+
'Spreadsheet::Sheet', 'App::VarSet',
|
|
51
|
+
]);
|
|
52
|
+
/**
|
|
53
|
+
* 2026-09-20 sweep triage: assembly/import container types — links, assembly
|
|
54
|
+
* containers, import placeholders (Inventor/VRML). They reference or embed
|
|
55
|
+
* external/other geometry but produce no modeling semantics of their own;
|
|
56
|
+
* preserved-only. Modeling features (Part::Mirroring,
|
|
57
|
+
* PartDesign::AdditiveSphere, …) are deliberately NOT here — they stay
|
|
58
|
+
* explicit H7 gaps until translated.
|
|
59
|
+
*/
|
|
60
|
+
export const STRUCTURAL_TYPES_EXTENDED = new Set([
|
|
61
|
+
'App::Link',
|
|
62
|
+
'App::LinkElement',
|
|
63
|
+
'Assembly::AssemblyObject',
|
|
64
|
+
'Assembly::JointGroup',
|
|
65
|
+
'App::InventorObject',
|
|
66
|
+
'App::VRMLObject',
|
|
67
|
+
// P1-3 (2026-09-23, fcstd-gap-dev-plan): non-geometric types found in the
|
|
68
|
+
// batch-report `type-not-whitelisted` census (801 objects). None carries
|
|
69
|
+
// modeling geometry: TechDraw::*/Drawing::* are 2D drawing outputs,
|
|
70
|
+
// Image::ImagePlane is a raster backdrop, Mesh::Feature is an imported
|
|
71
|
+
// triangle mesh (regenerable data, not BREP), App::MeasureDistance is a
|
|
72
|
+
// measurement annotation, App::LinkGroup is a link container (same
|
|
73
|
+
// semantics as App::Link above).
|
|
74
|
+
'App::LinkGroup',
|
|
75
|
+
'App::MeasureDistance',
|
|
76
|
+
'Image::ImagePlane',
|
|
77
|
+
'Mesh::Feature',
|
|
78
|
+
'Drawing::DrawPage',
|
|
79
|
+
'Drawing::DrawSVGTemplate',
|
|
80
|
+
'Drawing::DrawViewPart',
|
|
81
|
+
'Drawing::DrawProjGroup',
|
|
82
|
+
'Drawing::DrawProjGroupItem',
|
|
83
|
+
'Drawing::DrawViewDimension',
|
|
84
|
+
'Drawing::DrawViewAnnotation',
|
|
85
|
+
]);
|
|
86
|
+
/**
|
|
87
|
+
* H7 companion (2026-09-20): FEM workbench objects carry SIMULATION semantics
|
|
88
|
+
* (analysis containers, meshes, solver settings, boundary conditions, result
|
|
89
|
+
* objects, post-processing filters) — no modeling geometry. They used to fall
|
|
90
|
+
* into `type-not-whitelisted` and block whole files whose modeling part was a
|
|
91
|
+
* single box. Like structural types they are `preserved-only`; their
|
|
92
|
+
* regenerable field data (FemMesh / result Data properties) is deliberately NOT
|
|
93
|
+
* carried into the container.
|
|
94
|
+
*
|
|
95
|
+
* DECISION (2026-09-21): the rule is the NAMESPACE, not an enumerated list.
|
|
96
|
+
* Census of the 56-sample corpus (fcstd-port `out/probe-fem-types.mjs`): 29
|
|
97
|
+
* distinct `Fem::` types, **every one** an analysis / mesh / solver / result /
|
|
98
|
+
* constraint / filter object, zero modeling features; and the 3,201-file
|
|
99
|
+
* FreeCAD library contains **0** `Fem::` objects, so the rule's blast radius is
|
|
100
|
+
* exactly the FEM workbench. The previous enumerated list cost four
|
|
101
|
+
* whack-a-mole rounds (each fix uncovered the next layer, because the sweep
|
|
102
|
+
* report records only the first 4 reasons per file: fixed
|
|
103
|
+
* FluidBoundary/Gear/Heatflux/InitialTemperature, then
|
|
104
|
+
* PlaneRotation/Pulley/Temperature/Transform, then three more). The namespace
|
|
105
|
+
* closes the family permanently.
|
|
106
|
+
*
|
|
107
|
+
* Note this classification is a LAST resort: an object with shape evidence is
|
|
108
|
+
* taken by the shape-asset path and a Python object by `python-opaque` long
|
|
109
|
+
* before `auditMapping` consults this predicate.
|
|
110
|
+
*
|
|
111
|
+
* Remote task on record (user decision, 2026-09-20): faijs will port FreeCAD's
|
|
112
|
+
* FEM analysis capability in the future — separate feature; this classification
|
|
113
|
+
* only stops simulation objects from blocking conversion.
|
|
114
|
+
*
|
|
115
|
+
* @param type - the FCStd object type, e.g. "Fem::ConstraintFixed".
|
|
116
|
+
* @returns true when the type belongs to the FEM (simulation) workbench.
|
|
117
|
+
*/
|
|
118
|
+
export function isFemStructural(type) {
|
|
119
|
+
return type.startsWith('Fem::');
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* P1-3 (2026-09-23, fcstd-gap-dev-plan): TechDraw/Drawing are FreeCAD's 2D
|
|
123
|
+
* DRAWING workbenches — pages, templates, views, dimensions, projection
|
|
124
|
+
* groups are documentation OUTPUT rendering a shape onto a sheet and own no
|
|
125
|
+
* modeling geometry (same evidence as the enumerated TechDraw entries in
|
|
126
|
+
* STRUCTURAL_TYPES). The batch-report census had 81 `TechDraw::*` + 20
|
|
127
|
+
* `Drawing::*` objects in `type-not-whitelisted`; a namespace rule (same
|
|
128
|
+
* decision as FEM above) closes the family instead of whack-a-mole.
|
|
129
|
+
*
|
|
130
|
+
* @param type - the FCStd object type, e.g. "TechDraw::DrawViewSection".
|
|
131
|
+
* @returns true when the type belongs to a 2D drawing workbench.
|
|
132
|
+
*/
|
|
133
|
+
export function isDrawingStructural(type) {
|
|
134
|
+
return type.startsWith('TechDraw::') || type.startsWith('Drawing::');
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* True when the type carries no modeling semantics — structural/datum/
|
|
138
|
+
* container/drawing/documentation or FEM simulation.
|
|
139
|
+
*
|
|
140
|
+
* `codegen.ts` uses this to short-circuit such objects to `preserved-only`
|
|
141
|
+
* before translation, which is what keeps datum planes out of Body feature
|
|
142
|
+
* chains and keeps their `.brp` face assets out of the shape-asset import path.
|
|
143
|
+
* `convert.ts` uses it for the C4 post-translation reclassification, so the two
|
|
144
|
+
* can never disagree.
|
|
145
|
+
*
|
|
146
|
+
* @param type - the FCStd object type, e.g. "PartDesign::Plane".
|
|
147
|
+
* @returns true when the object must never produce a modeling call or be a shape asset.
|
|
148
|
+
*/
|
|
149
|
+
export function isNonModelingType(type) {
|
|
150
|
+
return STRUCTURAL_TYPES.has(type)
|
|
151
|
+
|| STRUCTURAL_TYPES_EXTENDED.has(type)
|
|
152
|
+
|| isFemStructural(type)
|
|
153
|
+
|| isDrawingStructural(type);
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=structural-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural-types.js","sourceRoot":"","sources":["../src/structural-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;8EAU8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IACtC,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW;IAC5D,0BAA0B,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB;IAChF,8BAA8B;IAC9B,sEAAsE;IACtE,2DAA2D;IAC3D,YAAY,EAAE,iBAAiB;IAC/B,uEAAuE;IACvE,sEAAsE;IACtE,aAAa,EAAE,mBAAmB;IAClC,wEAAwE;IACxE,YAAY;IACZ,0EAA0E;IAC1E,4EAA4E;IAC5E,yEAAyE;IACzE,2EAA2E;IAC3E,wEAAwE;IACxE,sEAAsE;IACtE,0EAA0E;IAC1E,oBAAoB,EAAE,2BAA2B,EAAE,yBAAyB;IAC5E,qEAAqE;IACrE,iDAAiD;IACjD,0DAA0D;IAC1D,uDAAuD;IACvD,oBAAoB,EAAE,aAAa;CACpC,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IAC/C,WAAW;IACX,kBAAkB;IAClB,0BAA0B;IAC1B,sBAAsB;IACtB,qBAAqB;IACrB,iBAAiB;IACjB,0EAA0E;IAC1E,yEAAyE;IACzE,oEAAoE;IACpE,uEAAuE;IACvE,wEAAwE;IACxE,mEAAmE;IACnE,iCAAiC;IACjC,gBAAgB;IAChB,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,mBAAmB;IACnB,0BAA0B;IAC1B,uBAAuB;IACvB,wBAAwB;IACxB,4BAA4B;IAC5B,4BAA4B;IAC5B,6BAA6B;CAC9B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC;WAC5B,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC;WACnC,eAAe,CAAC,IAAI,CAAC;WACrB,mBAAmB,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC","sourcesContent":["/**\n * Non-modeling FCStd object types — the single source of truth shared by the\n * C4 disposition audit (`convert.ts`) and the code generator (`codegen.ts`).\n *\n * Why a separate module: `codegen.ts` must skip these objects BEFORE it calls\n * the translator (a datum plane must never enter a Body's feature chain), and\n * `convert.ts` must reclassify them after translation. Keeping the sets in\n * `convert.ts` would make `codegen.ts` import it back (convert → codegen), so\n * the knowledge lives here with zero dependencies.\n *\n * C4 contract: an object in these sets is never a translation gap, and its\n * geometry is never emitted as a modeling call. See the per-set docs below for\n * the evidence behind each classification.\n */\n\n/** Non-modeling structural/datum types: never translation gaps. They carry\n * no feature semantics (containers, datum planes/lines/origins, groups) —\n * their semantics are consumed by the translator (Body.Group ordering,\n * datum-plane UpToFace anchors), not emitted as cad calls.\n *\n * GOTCHA (PadTest, 2026-09-21): a `PartDesign::Plane` also stores a `Shape`\n * `.brp` member — the plane FACE. The generic \"any object with shape evidence\n * is a shape asset\" rule therefore imported it and fed it into the Body's\n * union chain, which both corrupts the solid and fails at run time\n * (`[loadBrep] imported shape contains no solid sub-shapes`). Datum shapes are\n * SUPPORT geometry for attachment/up-to resolution, never modeling solids. */\nexport const STRUCTURAL_TYPES = new Set([\n 'PartDesign::Body', 'App::Origin', 'App::Plane', 'App::Line',\n 'App::DocumentObjectGroup', 'App::Part', 'PartDesign::Plane', 'PartDesign::Line',\n 'PartDesign::CoordinateSystem',\n // H10 companion fix (plan §3.5): datum/annotation types, not modeling\n // features — previously misclassified as translation gaps.\n 'App::Point', 'App::Annotation',\n // 2026-09-20 sweep regression triage: Part workbench datum plane (same\n // semantics as App::Plane) and a document text record — non-modeling.\n 'Part::Plane', 'App::TextDocument',\n // Part workbench datum line (FEMExample) — same semantics as App::Line.\n 'Part::Line',\n // 2026-09-21 triage (ArchDetail corpus): TechDraw is FreeCAD's 2D DRAWING\n // workbench. A page, an SVG template and a projected view are documentation\n // output — they render a shape onto a sheet and own no modeling geometry\n // (probe: none of the three carries a Shape .brp; DrawViewDraft only links\n // its source via `Source`, and a page links its template + views). Same\n // category as App::TextDocument/App::Annotation above. Their modeling\n // content is translated independently through the objects they reference.\n 'TechDraw::DrawPage', 'TechDraw::DrawSVGTemplate', 'TechDraw::DrawViewDraft',\n // P1-1(2026-09-23, B2 §3.9):Spreadsheet::Sheet / App::VarSet 是**被引用的\n // 参数数据源**(<<Label>>.Alias 表达式绑定指向它的别名单元格),不是建模对象\n // 也因此不是翻译缺口。preserved-only;其数值经 expressions.evalWithDoc 的\n // 三跳解析进入下游属性(pad-length-expression-non-constant 的真根因)。\n 'Spreadsheet::Sheet', 'App::VarSet',\n]);\n\n/**\n * 2026-09-20 sweep triage: assembly/import container types — links, assembly\n * containers, import placeholders (Inventor/VRML). They reference or embed\n * external/other geometry but produce no modeling semantics of their own;\n * preserved-only. Modeling features (Part::Mirroring,\n * PartDesign::AdditiveSphere, …) are deliberately NOT here — they stay\n * explicit H7 gaps until translated.\n */\nexport const STRUCTURAL_TYPES_EXTENDED = new Set([\n 'App::Link',\n 'App::LinkElement',\n 'Assembly::AssemblyObject',\n 'Assembly::JointGroup',\n 'App::InventorObject',\n 'App::VRMLObject',\n // P1-3 (2026-09-23, fcstd-gap-dev-plan): non-geometric types found in the\n // batch-report `type-not-whitelisted` census (801 objects). None carries\n // modeling geometry: TechDraw::*/Drawing::* are 2D drawing outputs,\n // Image::ImagePlane is a raster backdrop, Mesh::Feature is an imported\n // triangle mesh (regenerable data, not BREP), App::MeasureDistance is a\n // measurement annotation, App::LinkGroup is a link container (same\n // semantics as App::Link above).\n 'App::LinkGroup',\n 'App::MeasureDistance',\n 'Image::ImagePlane',\n 'Mesh::Feature',\n 'Drawing::DrawPage',\n 'Drawing::DrawSVGTemplate',\n 'Drawing::DrawViewPart',\n 'Drawing::DrawProjGroup',\n 'Drawing::DrawProjGroupItem',\n 'Drawing::DrawViewDimension',\n 'Drawing::DrawViewAnnotation',\n]);\n\n/**\n * H7 companion (2026-09-20): FEM workbench objects carry SIMULATION semantics\n * (analysis containers, meshes, solver settings, boundary conditions, result\n * objects, post-processing filters) — no modeling geometry. They used to fall\n * into `type-not-whitelisted` and block whole files whose modeling part was a\n * single box. Like structural types they are `preserved-only`; their\n * regenerable field data (FemMesh / result Data properties) is deliberately NOT\n * carried into the container.\n *\n * DECISION (2026-09-21): the rule is the NAMESPACE, not an enumerated list.\n * Census of the 56-sample corpus (fcstd-port `out/probe-fem-types.mjs`): 29\n * distinct `Fem::` types, **every one** an analysis / mesh / solver / result /\n * constraint / filter object, zero modeling features; and the 3,201-file\n * FreeCAD library contains **0** `Fem::` objects, so the rule's blast radius is\n * exactly the FEM workbench. The previous enumerated list cost four\n * whack-a-mole rounds (each fix uncovered the next layer, because the sweep\n * report records only the first 4 reasons per file: fixed\n * FluidBoundary/Gear/Heatflux/InitialTemperature, then\n * PlaneRotation/Pulley/Temperature/Transform, then three more). The namespace\n * closes the family permanently.\n *\n * Note this classification is a LAST resort: an object with shape evidence is\n * taken by the shape-asset path and a Python object by `python-opaque` long\n * before `auditMapping` consults this predicate.\n *\n * Remote task on record (user decision, 2026-09-20): faijs will port FreeCAD's\n * FEM analysis capability in the future — separate feature; this classification\n * only stops simulation objects from blocking conversion.\n *\n * @param type - the FCStd object type, e.g. \"Fem::ConstraintFixed\".\n * @returns true when the type belongs to the FEM (simulation) workbench.\n */\nexport function isFemStructural(type: string): boolean {\n return type.startsWith('Fem::');\n}\n\n/**\n * P1-3 (2026-09-23, fcstd-gap-dev-plan): TechDraw/Drawing are FreeCAD's 2D\n * DRAWING workbenches — pages, templates, views, dimensions, projection\n * groups are documentation OUTPUT rendering a shape onto a sheet and own no\n * modeling geometry (same evidence as the enumerated TechDraw entries in\n * STRUCTURAL_TYPES). The batch-report census had 81 `TechDraw::*` + 20\n * `Drawing::*` objects in `type-not-whitelisted`; a namespace rule (same\n * decision as FEM above) closes the family instead of whack-a-mole.\n *\n * @param type - the FCStd object type, e.g. \"TechDraw::DrawViewSection\".\n * @returns true when the type belongs to a 2D drawing workbench.\n */\nexport function isDrawingStructural(type: string): boolean {\n return type.startsWith('TechDraw::') || type.startsWith('Drawing::');\n}\n\n/**\n * True when the type carries no modeling semantics — structural/datum/\n * container/drawing/documentation or FEM simulation.\n *\n * `codegen.ts` uses this to short-circuit such objects to `preserved-only`\n * before translation, which is what keeps datum planes out of Body feature\n * chains and keeps their `.brp` face assets out of the shape-asset import path.\n * `convert.ts` uses it for the C4 post-translation reclassification, so the two\n * can never disagree.\n *\n * @param type - the FCStd object type, e.g. \"PartDesign::Plane\".\n * @returns true when the object must never produce a modeling call or be a shape asset.\n */\nexport function isNonModelingType(type: string): boolean {\n return STRUCTURAL_TYPES.has(type)\n || STRUCTURAL_TYPES_EXTENDED.has(type)\n || isFemStructural(type)\n || isDrawingStructural(type);\n}\n"]}
|
package/dist/unpack.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type Result } from '@faicad/faijs/api/result';
|
|
2
|
+
/**
|
|
3
|
+
* One raw file inside the FCStd ZIP container.
|
|
4
|
+
*/
|
|
5
|
+
export interface FcstdMember {
|
|
6
|
+
/** path inside the ZIP, e.g. "Document.xml", "PartShape.brp" */
|
|
7
|
+
path: string;
|
|
8
|
+
/** the member's raw bytes */
|
|
9
|
+
bytes: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The unpacked FCStd container: all ZIP members plus the advisory comment.
|
|
13
|
+
*/
|
|
14
|
+
export interface FcstdArchive {
|
|
15
|
+
members: Map<string, Uint8Array>;
|
|
16
|
+
/** advisory ZIP comment; may be empty (2/56 samples have empty comments) */
|
|
17
|
+
zipComment: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Structured unpack failure: not a valid ZIP, or missing root `Document.xml`.
|
|
21
|
+
*/
|
|
22
|
+
export type UnpackError = {
|
|
23
|
+
kind: 'not-zip';
|
|
24
|
+
message: string;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'no-document-xml';
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Unpack an FCStd file. Only requirement: valid ZIP + root `Document.xml`.
|
|
31
|
+
*
|
|
32
|
+
* @param data - the raw FCStd file bytes.
|
|
33
|
+
* @returns the unpacked archive, or a structured UnpackError.
|
|
34
|
+
*/
|
|
35
|
+
export declare function unpackFcstd(data: Uint8Array): Result<FcstdArchive, UnpackError>;
|
|
36
|
+
/**
|
|
37
|
+
* UTF-8 text decode helper for XML members.
|
|
38
|
+
*
|
|
39
|
+
* @param archive - the unpacked FCStd container.
|
|
40
|
+
* @param path - member path inside the ZIP, e.g. "Document.xml".
|
|
41
|
+
* @returns the member decoded as UTF-8 text, or undefined when absent.
|
|
42
|
+
*/
|
|
43
|
+
export declare function memberText(archive: FcstdArchive, path: string): string | undefined;
|
|
44
|
+
//# sourceMappingURL=unpack.d.ts.map
|