mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-02 09:48:14 -05:00
Outside the Design tab an agent had 175 commands, 50 of them in the tool list. There are now 118, named by what they act on (`object_`, `plate_`, `preset_`, `filament_`, `plugin_` and so on), and 115 are listed. Each takes its target and values in the call, acts on the selection when it names no target and says what it acted on; an old name is refused. Printers and system filaments install and uninstall, preferences read and write, plugins enable, reload, uninstall and refresh, and objects reorder, with no dialog to drive. The Speed Dial keeps its 129 tiles under the same ids. Eight defects in the rows these commands share with the menus are fixed. For a person: an object row that cannot run says why instead of "Select an object first.", rows that failed no longer claim success, Duplicate Plate can be undone, and Refresh Plugins picked while a refresh runs now runs after it instead of beside it.
108 lines
8.7 KiB
JSON
108 lines
8.7 KiB
JSON
// The placement commands made from rows, 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/rows_placement.json --out <dir>
|
|
{
|
|
"orca_replay_version": "0.2.0",
|
|
"name": "placement rows 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}}
|
|
]
|
|
}
|