mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-28 08:09:55 -05:00
The MCP command descriptions, docs and code called an entry of the app's menus a "row", the word they also use for the rows of the object list and the app's other lists. They now say "menu item", so a row is only ever a row of a list or table. Command names, arguments and Speed Dial tile ids are unchanged.
108 lines
8.7 KiB
JSON
108 lines
8.7 KiB
JSON
// The placement commands made from menu items, called by index: object_add_primitive on a plate, at a position and with a
|
|
// name while another object is selected, in one undo step (the snapshots read from the log, fixtures/ops_undo.py);
|
|
// object_mirror, object_drop, object_center (each plate's objects on their own plate, then all on one),
|
|
// object_scale_to_fit and object_auto_orient (a cube on its edge laid on a face), each read back through object_list;
|
|
// and the Center, Drop, Scale to Fit and Auto-Orient tiles on the selection. Plate positions are those of the sweep's printer, a
|
|
// Bambu Lab X1 Carbon (a 256 mm bed): with three plates, plate 1's centre is at x 435.2, y 128 and plate 2's at x 128,
|
|
// y -179.2. Run it with
|
|
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/menu_items_placement.json --out <dir>
|
|
{
|
|
"orca_replay_version": "0.2.0",
|
|
"name": "placement menu items by index",
|
|
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
|
|
"steps": [
|
|
{"tool": "app_wait", "args": {"for": "ready"}},
|
|
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
|
|
{"tool": "view_set", "args": {"tab": "prepare"}},
|
|
{"tool": "plate_add", "args": {}},
|
|
{"tool": "plate_add", "args": {}},
|
|
{"tool": "plate_select", "args": {"plate": 1}},
|
|
|
|
// ---- A cube added on plate 1, then a second at a position on plate 1 while the first is selected ----
|
|
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20], "plate": 1, "name": "first"},
|
|
"expect": {"/object": {"eq": 0}, "/plate": {"eq": 1}, "/objects/0/name": {"eq": "first"}}},
|
|
{"tool": "app_state", "expect": {"/selection/objects": {"eq": [0]}}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20], "position": [420, 110, 0], "name": "second"},
|
|
"expect": {"/object": {"eq": 1}, "/plate": {"eq": 1}, "/offset/0": {"ge": 419.99, "le": 420.01}, "/offset/1": {"ge": 109.99, "le": 110.01}}},
|
|
// added, named and placed in one undo step
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"},
|
|
"expect": {"/result/count": {"eq": 1}, "/result/taken/0": {"eq": "Add Primitive"}}},
|
|
{"tool": "object_list", "expect": {"/total": {"eq": 2}, "/plates/1/objects/0/name": {"eq": "first"}, "/plates/1/objects/1/name": {"eq": "second"},
|
|
"/plates/1/objects/1/bbox/min/2": {"ge": -0.001, "le": 0.001}}},
|
|
|
|
// ---- Mirror by index ----
|
|
{"tool": "object_mirror", "args": {"objects": [0], "axis": "x"}, "expect": {"/objects/0/index": {"eq": 0}}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/0/instances/0/mirrored": {"eq": true},
|
|
"/plates/1/objects/1/instances/0/mirrored": {"eq": false}}},
|
|
|
|
// ---- Drop by index: an object of two parts stays above the bed where it is moved without a drop ----
|
|
{"tool": "part_add", "args": {"object": 1, "type": "part", "shape": "cube", "size": [5, 5, 5]}},
|
|
{"tool": "object_transform", "args": {"object": 1, "translate": [0, 0, 15], "drop_to_bed": false}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/1/bbox/min/2": {"ge": 10}}},
|
|
{"tool": "object_drop", "args": {"objects": [1]}, "expect": {"/moved": {"eq": true}, "/objects/0/index": {"eq": 1}}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/1/bbox/min/2": {"ge": -0.001, "le": 0.001}}},
|
|
{"tool": "object_drop", "args": {"objects": [1]}, "expect": {"/moved": {"eq": false}}},
|
|
// the Drop to Bed tile on the selection
|
|
{"tool": "object_transform", "args": {"object": 1, "translate": [0, 0, 15], "drop_to_bed": false}},
|
|
{"tool": "object_select", "args": {"objects": [1]}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:obj_drop:orca"}, "expect": {"/moved": {"eq": true}}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/1/bbox/min/2": {"ge": -0.001, "le": 0.001}}},
|
|
|
|
// ---- Centre by index on its plate ----
|
|
{"tool": "object_center", "args": {"objects": [0]}, "expect": {"/plates/0/plate": {"eq": 1}, "/plates/1": {"exists": false}}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/0/instances/0/offset/0": {"ge": 435.1, "le": 435.3},
|
|
"/plates/1/objects/0/instances/0/offset/1": {"ge": 127.9, "le": 128.1}}},
|
|
|
|
// ---- A third object on plate 2, off its centre; plate 1 stays current ----
|
|
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20], "position": [60, -120, 0], "name": "third"},
|
|
"expect": {"/object": {"eq": 2}, "/plate": {"eq": 2}}},
|
|
// each object centred on the plate it stands on: the third moves to plate 2's centre and stays there
|
|
{"tool": "object_center", "args": {"objects": [0, 2]},
|
|
"expect": {"/plates/0/plate": {"eq": 1}, "/plates/0/objects": {"eq": [0]}, "/plates/1/plate": {"eq": 2}, "/plates/1/objects": {"eq": [2]}}},
|
|
{"tool": "object_list", "expect": {"/plates/2/objects/0/name": {"eq": "third"},
|
|
"/plates/2/objects/0/instances/0/offset/0": {"ge": 127.9, "le": 128.1},
|
|
"/plates/2/objects/0/instances/0/offset/1": {"ge": -179.3, "le": -179.1},
|
|
"/plates/1/objects/0/instances/0/offset/0": {"ge": 435.1, "le": 435.3}}},
|
|
// a second call moves nothing
|
|
{"tool": "object_center", "args": {"objects": [0, 2]}},
|
|
{"tool": "object_list", "expect": {"/plates/2/objects/0/instances/0/offset/0": {"ge": 127.9, "le": 128.1},
|
|
"/plates/2/objects/0/instances/0/offset/1": {"ge": -179.3, "le": -179.1},
|
|
"/plates/1/objects/0/instances/0/offset/0": {"ge": 435.1, "le": 435.3}}},
|
|
// all three on plate 1, as one group, whose box goes to the plate's centre: the third first moves to the corner of
|
|
// plate 2 nearest plate 1, so that the group fits on one bed
|
|
{"tool": "object_transform", "args": {"object": 2, "position": [240, -66, 10]}},
|
|
{"tool": "object_list", "expect": {"/plates/2/objects/0/name": {"eq": "third"}}},
|
|
{"tool": "object_center", "args": {"objects": [0, 1, 2], "plate": 1}, "expect": {"/plates/0/plate": {"eq": 1}, "/plates/0/objects": {"eq": [0, 1, 2]}}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/2/name": {"eq": "third"}, "/plates/2/objects/0": {"exists": false}, "/outside": {"empty": true}}},
|
|
|
|
// ---- The Center tile on the one selected: the current plate's centre ----
|
|
{"tool": "object_transform", "args": {"object": 2, "translate": [30, 0, 0]}},
|
|
{"tool": "object_select", "args": {"objects": [2]}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:obj_center:orca"}, "expect": {"/plates/0/plate": {"eq": 1}, "/objects/0/index": {"eq": 2}}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/2/instances/0/offset/0": {"ge": 435.1, "le": 435.3},
|
|
"/plates/1/objects/2/instances/0/offset/1": {"ge": 127.9, "le": 128.1}}},
|
|
|
|
// ---- Scale to fit by index, and the tile on the selection ----
|
|
{"tool": "object_scale_to_fit", "args": {"objects": [0]}, "expect": {"/scales/0/object": {"eq": 0}, "/scales/0/scale/0": {"gt": 5}}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/0/instances/0/scale/0": {"gt": 5}}},
|
|
{"tool": "object_select", "args": {"objects": [2]}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:obj_fit_volume:orca"}, "expect": {"/scales/0/object": {"eq": 2}, "/scales/0/scale/0": {"gt": 5}}},
|
|
|
|
// ---- Auto-orient two objects by index; the reply is read once the job has ended: the cube on its edge lies on a face ----
|
|
{"tool": "object_transform", "args": {"object": 2, "rotate": [45, 0, 0], "mode": "absolute"}},
|
|
{"tool": "object_auto_orient", "args": {"objects": [1, 2]},
|
|
"expect": {"/objects/0/index": {"eq": 1}, "/objects/1/index": {"eq": 2}, "/objects/2": {"exists": false},
|
|
"/rotations/0/object": {"eq": 1}, "/rotations/1/object": {"eq": 2},
|
|
"/rotations/1/rotation_deg/0": {"ge": 89.9, "le": 90.1}}},
|
|
{"tool": "object_list", "expect": {"/plates/1/objects/2/instances/0/rotation_deg/0": {"ge": 89.9, "le": 90.1}}},
|
|
{"tool": "app_state", "expect": {"/selection/objects": {"eq": [1, 2]}}},
|
|
// the Auto-Orient tile with nothing selected orients every object
|
|
{"tool": "object_select", "args": {"none": true}},
|
|
{"tool": "app_state", "expect": {"/selection/empty": {"eq": true}}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:obj_orient:orca"}, "expect": {"/rotations/2/object": {"eq": 2}, "/rotations/3": {"exists": false}}},
|
|
|
|
{"tool": "project_new", "args": {"discard_changes": true}}
|
|
]
|
|
}
|