Files
make-cad/test/cadquery_traces/hexnut.trace.json
T
NiJingzhe 216a7ed625 feat: CadQuery→FTC translator toolset under tools/research (cadqueryftc)
Port the runtime-tracer half of PR #30 (feat/cadquery_converter) and rewrite
its emission layer to the current Feature Tree Convention, following the
tools/research/histjson four-stage pattern (trace / translate / validate /
profile + responsibility wall: the translator only translates).

- tracer/ (instrument, fingerprint, cq_runner, worker) ported near-verbatim:
  runs under .venv-cq (Python 3.11 + cadquery 2.8); records resolved plane
  frames, serialized args, selector strings, and geometric fingerprints of
  actually-selected faces/edges plus ground-truth volume/bbox per program.
- emission rewritten for FTC: block headers with closed role vocabulary and
  no positional slugs; transcribed planar profiles authored through the
  sketch API (local coords, pooled points, three-point arcs via
  circumcenter) annotated profile=geometry; booleans in list form over a
  histjson-shaped bodies dataflow; fillet/chamfer/shell selections
  synthesized as QL predicate bands from trace fingerprints with
  take/exactly cardinality; through-cut depths derived from the trace
  bbox; zero in-source verification; literal numbers only.
- unknown ops become untranslated notes, never silent drops; static-AST
  path and exploratory scoring/edit-bench from the PR intentionally not
  ported.
- directory named cadqueryftc so it can never shadow `import cadquery`.
- fixtures are real traces captured with cadquery 2.8; 13 tests pin format
  contracts + volume reconciliation (all four reconcile at <=2.2e-12 rel
  err) with no cadquery required in CI; full test/ suite 1516 passed.
2026-09-08 15:53:51 +08:00

348 lines
5.5 KiB
JSON

{
"cq_status": "ok",
"error": "",
"cq_volume": 45.891956489991564,
"cq_bbox": [
-3.175,
-2.7496306570155937,
0.0,
3.1750000000000003,
2.749630657015593,
2.4
],
"steps": [
{
"op": "Workplane",
"args": [
"XY"
],
"plane_name": "XY",
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": false
},
{
"op": "polygon",
"args": [
6,
6.35
],
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": false
},
{
"op": "Workplane",
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": false
},
{
"op": "extrude",
"args": [
2.4
],
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": false
},
{
"op": "Workplane",
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": true
},
{
"op": "faces",
"args": [
">Z"
],
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"selector": ">Z",
"produced_solid": false
},
{
"op": "Workplane",
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"selector": ">Z",
"selections": [
{
"kind": "face",
"index": 7,
"geom_type": "PLANE",
"center": [
-1.0496337872862338e-16,
-1.356503324485757e-16,
2.4
],
"normal": [
0.0,
0.0,
1.0
],
"area": 26.19023200807352,
"bbox": {
"min": [
-3.175,
-2.7496306570155937,
2.4
],
"max": [
3.1750000000000003,
2.749630657015593,
2.4
]
}
}
],
"produced_solid": false
},
{
"op": "workplane",
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"selections": [
{
"kind": "face",
"index": 7,
"geom_type": "PLANE",
"center": [
-1.0496337872862338e-16,
-1.356503324485757e-16,
2.4
],
"normal": [
0.0,
0.0,
1.0
],
"area": 26.19023200807352,
"bbox": {
"min": [
-3.175,
-2.7496306570155937,
2.4
],
"max": [
3.1750000000000003,
2.749630657015593,
2.4
]
}
}
],
"produced_solid": false
},
{
"op": "Workplane",
"args": [
"Plane(origin=(0.0, 0.0, 2.4), xDir=(1.0, 0.0, 0.0), normal=(0.0, 0.0, 1.0))"
],
"plane_name": "Plane(origin=(0.0, 0.0, 2.4), xDir=(1.0, 0.0, 0.0), normal=(0.0, 0.0, 1.0))",
"plane_origin": [
0.0,
0.0,
2.4
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": false
},
{
"op": "circle",
"args": [
1.5
],
"plane_origin": [
0.0,
0.0,
2.4
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": false
},
{
"op": "Workplane",
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": false
},
{
"op": "cutThruAll",
"plane_origin": [
0.0,
0.0,
2.4
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": false
},
{
"op": "Workplane",
"plane_origin": [
0.0,
0.0,
0.0
],
"plane_normal": [
0.0,
0.0,
1.0
],
"plane_x_dir": [
1.0,
0.0,
0.0
],
"produced_solid": true
}
],
"stem": "hexnut",
"family": ""
}