Files
OrcaSlicer/tools/mcp/tests/cad_features.json
T
SoftFever 9d7778ec86 Make the full MCP sweep finish in about 11 minutes
A full sweep on six jobs took 17 to 19 minutes, too long to run often. Its 66 tests are
now 40 that cover the same areas with each scenario run once, and the sweep finishes in
about 11 minutes. The Speed Dial test checks a handful of commands no other test reaches,
and the sweep runs only test_*.py files; smoke_test.json and the Design replays are
played by the tests that use them.
2026-11-20 21:38:12 +08:00

100 lines
8.5 KiB
JSON

// Threads, sweeps, lofts and plane splits through the Design commands. The bench's M5 hex standoff tapped on its
// bore (the size inferred from the bore, as the Thread card infers it) and again on the XY plane; a
// spring swept along a helix, round and square wire; a square-to-circle loft between the XY plane and
// a datum plane, then split by that datum and by XY turned over. Refused calls change nothing. Face
// ids are this build's; no step reads a world position that depends on the printer's bed.
// Needs the CAD feature on:
// tools/mcp/orca_mcp.py launch --cad
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/cad_features.json --out /tmp/out
{
"orca_replay_version": "0.2.0",
"name": "cad thread sweep loft split",
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "window_set", "args": {"size": [1600, 900]}},
{"tool": "tool_call", "args": {"tool": "new_design", "args": {"discard_changes": true}}},
// M5 hex standoff: 8 mm across flats, 15 long, M5's 4.134 mm tap drill through it.
{"tool": "tool_call", "args": {"tool": "extrude", "args": {"distance": 15,
"profile": [[4.618802, 0], [2.309401, 4], [-2.309401, 4], [-4.618802, 0], [-2.309401, -4], [2.309401, -4]]}},
"expect": {"/result/ok": {"eq": true}}},
{"tool": "tool_call", "args": {"tool": "hole", "args": {"diameter": 4.134, "through": true}}, "expect": {"/result/ok": {"eq": true}}},
{"tool": "tool_call", "args": {"tool": "body_describe", "args": {"kinds": ["cylindrical"]}},
"expect": {"/result/faces_total": {"eq": 1}, "/result/faces/0/id": {"eq": 8}, "/result/faces/0/internal": {"eq": true}}},
// A planar face cannot be threaded, and a designation not in the tables names the close ones.
{"tool": "tool_call", "args": {"tool": "thread", "args": {"face": 0}}, "optional": true},
{"tool": "tool_call", "args": {"tool": "thread", "args": {"face": 8, "designation": "M5x1"}}, "optional": true},
// The bore: M5 inferred from its 4.134 mm minor diameter, internal, the bore's whole 15 mm.
{"tool": "tool_call", "args": {"tool": "thread", "args": {"face": 8}},
"expect": {"/result/thread_index": {"eq": 3}, "/result/designation": {"eq": "M5"}, "/result/internal": {"eq": true},
"/result/pitch": {"ge": 0.7999, "le": 0.8001}, "/result/length": {"ge": 14.9999, "le": 15.0001},
"/result/body": {"eq": 0}, "/result/bodies": {"eq": 1}}},
// The bench case's bounds.
{"tool": "tool_call", "args": {"tool": "body_mass_properties", "args": {"body": 0}},
"expect": {"/result/is_solid": {"eq": true}, "/result/volume": {"gt": 600.0, "lt": 614.0}}},
{"tool": "tool_call", "args": {"tool": "describe_design"}, "expect": {"/result/features/3/type": {"eq": "Thread"}, "/result/undo_depth": {"eq": 3}}},
// The same thread placed on the XY plane, on the bore's axis.
{"tool": "tool_call", "args": {"tool": "undo", "args": {"history": "design"}}, "expect": {"/result/features": {"eq": 3}}},
{"tool": "tool_call", "args": {"tool": "thread", "args": {"plane": "XY", "designation": "M5", "internal": true, "length": 15}},
"expect": {"/result/x": {"eq": 0.0}, "/result/y": {"eq": 0.0}, "/result/body": {"eq": 0}, "/result/designation": {"eq": "M5"}}},
{"tool": "tool_call", "args": {"tool": "body_mass_properties", "args": {"body": 0}},
"expect": {"/result/volume": {"gt": 600.0, "lt": 614.0}}},
// A spring: a helix of radius 10, pitch 5, six turns; a 1.5 mm wire drawn across its start on XZ, and a square
// wire, 2 x 2, beside it. Both wires are sketched before the first sweep, whose seconds of rebuild each commit
// after it would repeat.
{"tool": "tool_call", "args": {"tool": "new_design", "args": {"discard_changes": true}}},
{"tool": "tool_call", "args": {"tool": "helix", "args": {"radius": 10, "pitch": 5, "height": 30}},
"expect": {"/result/helix_index": {"eq": 0}, "/result/tangent/1": {"ge": 0.9968, "le": 0.9969}, "/result/tangent/2": {"ge": 0.0793, "le": 0.0794}}},
{"tool": "tool_call", "args": {"tool": "sketch_create", "args": {"plane": "XZ"}}},
{"tool": "tool_call", "args": {"tool": "sketch_draw", "args": {"type": "circle_center", "center": [10, 0], "radius": 1.5}}},
{"tool": "tool_call", "args": {"tool": "sketch_finish"}, "expect": {"/result/sketch_index": {"eq": 1}}},
{"tool": "tool_call", "args": {"tool": "sketch_create", "args": {"plane": "XZ"}}},
{"tool": "tool_call", "args": {"tool": "sketch_draw", "args": {"type": "rectangle_2_point", "p0": [9, -1], "p1": [11, 1]}}},
{"tool": "tool_call", "args": {"tool": "sketch_finish"}, "expect": {"/result/sketch_index": {"eq": 2}}},
{"tool": "tool_call", "args": {"tool": "sweep", "args": {"sketch": 1, "path": 0}},
"expect": {"/result/sweep_index": {"eq": 3}, "/result/body": {"eq": 0}, "/result/operation": {"eq": "new_body"}}},
// pi 1.5^2 x the helix's 378.19 mm x 0.99685, the XZ plane's tilt off the helix's normal plane.
{"tool": "tool_call", "args": {"tool": "body_mass_properties", "args": {"body": 0}},
"expect": {"/result/is_solid": {"eq": true}, "/result/volume": {"gt": 2638.0, "lt": 2691.0}}},
// A sweep is not a path.
{"tool": "tool_call", "args": {"tool": "sweep", "args": {"sketch": 2, "path": 3}}, "optional": true},
{"tool": "tool_call", "args": {"tool": "sweep", "args": {"sketch": 2, "path": 0}},
"expect": {"/result/sweep_index": {"eq": 4}, "/result/body": {"eq": 1}, "/result/bodies": {"eq": 2}}},
{"tool": "tool_call", "args": {"tool": "body_mass_properties", "args": {"body": 1}},
"expect": {"/result/is_solid": {"eq": true}, "/result/volume": {"gt": 1492.0, "lt": 1524.0}}},
// A loft from a 20 mm square on XY to an 8 mm circle on a datum plane 40 above it.
{"tool": "tool_call", "args": {"tool": "new_design", "args": {"discard_changes": true}}},
{"tool": "tool_call", "args": {"tool": "construct_plane", "args": {"type": "offset", "base": "XY", "offset": 40}}, "expect": {"/result/plane_index": {"eq": 0}}},
{"tool": "tool_call", "args": {"tool": "sketch_create", "args": {"plane": "XY"}}},
{"tool": "tool_call", "args": {"tool": "sketch_draw", "args": {"type": "rectangle_2_point", "p0": [-10, -10], "p1": [10, 10]}}},
{"tool": "tool_call", "args": {"tool": "sketch_finish"}, "expect": {"/result/sketch_index": {"eq": 1}}},
{"tool": "tool_call", "args": {"tool": "sketch_create", "args": {"plane": {"datum": 0}}}},
{"tool": "tool_call", "args": {"tool": "sketch_draw", "args": {"type": "circle_center", "center": [0, 0], "radius": 8}}},
{"tool": "tool_call", "args": {"tool": "sketch_finish"}, "expect": {"/result/sketch_index": {"eq": 2}}},
{"tool": "tool_call", "args": {"tool": "loft", "args": {"profiles": [1]}}, "optional": true},
{"tool": "tool_call", "args": {"tool": "loft", "args": {"profiles": [1, 0]}}, "optional": true},
{"tool": "tool_call", "args": {"tool": "loft", "args": {"profiles": [1, 2]}},
"expect": {"/result/loft_index": {"eq": 3}, "/result/body": {"eq": 0}, "/result/bodies": {"eq": 1}}},
{"tool": "tool_call", "args": {"tool": "body_mass_properties", "args": {"body": 0}},
"expect": {"/result/is_solid": {"eq": true}, "/result/volume": {"gt": 11850.0, "lt": 11861.0}}},
// Split by the datum plane 20 below it: the upper half stays body 0, the lower one is body 1.
{"tool": "tool_call", "args": {"tool": "split", "args": {"plane": {"datum": 0}, "offset": 60}}, "optional": true},
{"tool": "tool_call", "args": {"tool": "split", "args": {"plane": {"datum": 0}, "offset": -20}},
"expect": {"/result/split_index": {"eq": 4}, "/result/upper_body": {"eq": 0}, "/result/lower_body": {"eq": 1},
"/result/bodies": {"eq": 2}, "/result/frame/normal/2": {"eq": 1.0}}},
{"tool": "tool_call", "args": {"tool": "describe_design"},
"expect": {"/result/features/4/type": {"eq": "Cut"}, "/result/bodies/0/bbox/min/2": {"ge": 19.999, "le": 20.001},
"/result/bodies/1/bbox/max/2": {"ge": 19.999, "le": 20.001}}},
// The lower half, by XY at 10 turned over, keeping only the side toward the bed.
{"tool": "tool_call", "args": {"tool": "split", "args": {"body": 1, "plane": "XY", "offset": 10, "flip": true, "keep_lower": false}},
"expect": {"/result/upper_body": {"eq": 1}, "/result/bodies": {"eq": 2}, "/result/frame/normal/2": {"eq": -1.0}}},
{"tool": "tool_call", "args": {"tool": "describe_design"},
"expect": {"/result/bodies/1/bbox/min/2": {"ge": -0.001, "le": 0.001}, "/result/bodies/1/bbox/max/2": {"ge": 9.999, "le": 10.001},
"/result/undo_depth": {"eq": 6}}}
]
}