Files
OrcaSlicer/tools/mcp/tests/plates.json
T
SoftFever d64e10f4dd Regroup the slicer's MCP commands and let each run from its arguments
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.
2026-11-18 16:50:32 +08:00

137 lines
11 KiB
JSON

// Sets plate settings through plate_set_settings, as the Plate Settings dialog does, and a plate's lock
// and name through plate_lock and plate_rename, as its icons do, and reads them back with plate_list and
// plate_get_settings: a plate type and print sequence on one plate only, undone and redone, the first and
// other layers' filament orders, spiral vase after its question, the lock set twice and a name. It starts
// by bringing the filament list to two slots with the filament_add and filament_delete commands, checks
// the refusals that leave everything as it was, and ends with a mixed filament: its slot cannot be
// deleted, a new slot goes ahead of it, and the custom filament orders are refused meanwhile. It starts
// from the harness's default printer (Bambu Lab X1 Carbon) and reruns on the same datadir. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/plates.json --out /tmp/plates
{
"orca_replay_version": "0.2.0",
"name": "plate settings and filament slots",
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "unsaved changes", "button": "no"},
{"match": "restore", "button": "no"},
{"match": "Uniform scale", "button": "ok"},
{"match": "Spiral mode only works", "button": "yes"}]}},
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "window_set", "args": {"size": [1600, 900]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
// ---- Filament slots: down to one with the - button's command, then a second ----
// The only slot is not deleted: a delete past it is refused (test_additions_refusals.py checks that), so these steps
// are optional.
{"tool": "action_run", "args": {"id": "orca_command:filament_delete:orca"}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:filament_delete:orca"}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:filament_delete:orca"}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:filament_delete:orca"}, "optional": true},
{"tool": "app_state", "expect": {"/presets/filaments/0": {"exists": true}, "/presets/filaments/1": {"exists": false}}},
{"tool": "action_run", "args": {"id": "orca_command:filament_delete:orca"}, "optional": true},
{"tool": "app_state", "expect": {"/presets/filaments/0": {"exists": true}, "/presets/filaments/1": {"exists": false}}},
{"tool": "action_run", "args": {"id": "orca_command:filament_add:orca"},
"expect": {"/level": {"eq": "success"}, "/message": {"eq": "Added filament slot 2."}}},
{"tool": "action_run", "args": {"id": "orca_command:filament_add:orca"}, "expect": {"/message": {"eq": "Added filament slot 3."}}},
// A slot past the last is refused; slot 2 by number.
{"tool": "filament_delete", "args": {"filament_slot": 4}, "optional": true},
{"tool": "filament_delete", "args": {"filament_slot": 2}, "expect": {"/message": {"eq": "Deleted filament slot 2."}}},
{"tool": "project_get_settings", "args": {"keys": ["filament_is_mixed"]}, "expect": {"/items/0/value": {"eq": "0,0"}}},
// ---- A cube on each of two plates ----
{"tool": "action_run", "args": {"id": "orca_command:add_primitive_cube:orca"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "action_run", "args": {"id": "orca_command:plate_add:orca"}},
{"tool": "plate_select", "args": {"plate": 1}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "action_run", "args": {"id": "orca_command:add_primitive_cube:orca"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_list", "save_as": "start",
"expect": {"/total": {"eq": 2}, "/items/0/objects": {"eq": 1}, "/items/1/objects": {"eq": 1},
"/items/0/overrides": {"empty": true}, "/items/1/overrides": {"empty": true}, "/items/1/current": {"eq": true},
"/items/0/locked": {"eq": false}, "/items/0/print_sequence": {"eq": "by layer"}, "/items/0/spiral_mode": {"eq": false},
"/items/0/first_layer_print_sequence": {"eq": null}, "/items/0/layer_gcode": {"empty": true},
"/items/0/wipe_tower": {"exists": true}}},
// ---- Plate 1's own plate type and print sequence; plate 0 keeps the global ones ----
{"tool": "plate_select", "args": {"plate": 0}},
{"tool": "plate_set_settings", "args": {"plate": 1, "values": {"curr_bed_type": "Textured PEI Plate", "print_sequence": "by object"}},
"expect": {"/plate": {"eq": 1}, "/applied/curr_bed_type": {"eq": "Textured PEI Plate"}, "/applied/print_sequence": {"eq": "by object"},
"/changed/curr_bed_type": {"eq": "Textured PEI Plate"}}},
{"tool": "plate_list",
"expect": {"/items/1/curr_bed_type": {"eq": "Textured PEI Plate"}, "/items/1/print_sequence": {"eq": "by object"},
"/items/1/overrides": {"eq": ["curr_bed_type", "print_sequence"]}, "/items/1/current": {"eq": true},
"/items/0/overrides": {"empty": true}, "/items/0/print_sequence": {"eq": "by layer"}}},
{"tool": "plate_get_settings", "args": {"plate": 1, "keys": ["curr_bed_type", "spiral_mode"]},
"expect": {"/plate": {"eq": 1}, "/items/0/value": {"eq": "Textured PEI Plate"}, "/items/0/meta/offered": {"contains": "Cool Plate"},
"/items/1/value": {"eq": null}, "/items/1/effective": {"eq": false}}},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "plate_list", "expect": {"/items/1/overrides": {"empty": true}}},
{"tool": "action_run", "args": {"id": "orca_command:redo:orca"}},
{"tool": "plate_list", "expect": {"/items/1/print_sequence": {"eq": "by object"}}},
// null is "Same as Global".
{"tool": "plate_set_settings", "args": {"plate": 1, "values": {"print_sequence": null}},
"expect": {"/applied/print_sequence": {"eq": null}, "/effective/print_sequence": {"eq": "by layer"}}},
// ---- Refusals, each leaving the plate as it was ----
{"tool": "plate_set_settings", "args": {"plate": 1, "values": {"curr_bed_type": "Glass Plate", "print_sequence": "by object"}},
"optional": true},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"first_layer_print_sequence": [1, 1]}}, "optional": true},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"other_layers_print_sequence": [{"from": 2, "order": [1, 2]}, {"from": 5, "to": 9, "order": [2, 1]}]}}, "optional": true},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"skirt_start_angle": 90}}, "optional": true},
{"tool": "plate_lock", "args": {"plate": 2, "locked": true}, "optional": true},
{"tool": "plate_list",
"expect": {"/items/1/locked": {"eq": false}, "/items/1/overrides": {"eq": ["curr_bed_type"]}, "/items/0/overrides": {"empty": true}}},
// ---- The first and the other layers' filament orders ----
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"first_layer_print_sequence": [2, 1], "other_layers_print_sequence": [{"from": 10, "order": [1, 2]}, {"from": 2, "to": 9, "order": [2, 1]}]}},
"expect": {"/applied/first_layer_print_sequence": {"eq": [2, 1]},
"/applied/other_layers_print_sequence": {"eq": [{"from": 2, "to": 9, "order": [2, 1]}, {"from": 10, "order": [1, 2]}]}}},
{"tool": "plate_list",
"expect": {"/items/0/current": {"eq": true}, "/items/0/first_layer_print_sequence": {"eq": [2, 1]},
"/items/0/other_layers_print_sequence/1/to": {"exists": false},
"/items/0/overrides": {"eq": ["first_layer_print_sequence", "other_layers_print_sequence"]}}},
{"tool": "plate_set_settings", "args": {"values": {"first_layer_print_sequence": null, "other_layers_print_sequence": null}},
"expect": {"/plate": {"eq": 0}, "/changed/first_layer_print_sequence": {"eq": null}}},
// ---- Spiral vase on one plate, after its question ----
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"spiral_mode": true}},
"expect": {"/applied/spiral_mode": {"eq": true}, "/effective/spiral_mode": {"eq": true}}},
{"tool": "plate_list", "expect": {"/items/0/spiral_mode": {"eq": true}, "/items/1/spiral_mode": {"eq": false}}},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"spiral_mode": null}}, "expect": {"/applied/spiral_mode": {"eq": null}}},
// ---- The lock is set, not toggled: twice leaves it locked ----
{"tool": "plate_lock", "args": {"plate": 1, "locked": true},
"expect": {"/plate": {"eq": 1}, "/locked": {"eq": true}, "/changed": {"eq": true}}},
{"tool": "plate_lock", "args": {"plate": 1, "locked": true}, "expect": {"/locked": {"eq": true}, "/changed": {"eq": false}}},
{"tool": "plate_list", "expect": {"/items/1/locked": {"eq": true}, "/items/0/locked": {"eq": false}, "/items/1/name": {"eq": ""}}},
{"tool": "plate_lock", "args": {"plate": 1, "locked": false}, "expect": {"/locked": {"eq": false}, "/changed": {"eq": true}}},
// ---- A name without the name dialog ----
{"tool": "plate_rename", "args": {"plate": 1, "name": "Batch"}, "expect": {"/plate": {"eq": 1}, "/name": {"eq": "Batch"}}},
{"tool": "plate_list", "expect": {"/items/1/name": {"eq": "Batch"}, "/items/1/current": {"eq": true}}},
// ---- Sliced, with no layer G-codes ----
{"tool": "plate_slice", "args": {"plates": 1}, "expect": {"/plates/0/outcome": {"eq": "ok"}}},
{"tool": "plate_list", "expect": {"/items/1/sliced": {"eq": true}, "/items/1/layer_gcode": {"empty": true}}},
// ---- A mixed filament: its slot is refused, a new slot goes ahead of it, custom orders wait ----
{"tool": "widget_click", "args": {"target": {"label": "Add Mixed Filament"}}, "await": false, "save_as": "mix"},
{"tool": "app_wait", "args": {"for": "dialog"}},
{"tool": "app_state", "expect": {"/dialogs/0/title": {"eq": "Add Mixed Filament"}}},
{"tool": "dialog_answer", "args": {"button": "OK"}},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.mix}"}},
{"tool": "project_get_settings", "args": {"keys": ["filament_is_mixed"]}, "expect": {"/items/0/value": {"eq": "0,0,1"}}},
{"tool": "filament_delete", "args": {"filament_slot": 3}, "optional": true},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"first_layer_print_sequence": [2, 1]}}, "optional": true},
{"tool": "plate_list", "expect": {"/items/0/first_layer_print_sequence": {"eq": null}}},
{"tool": "action_run", "args": {"id": "orca_command:filament_add:orca"}, "expect": {"/message": {"eq": "Added filament slot 3."}}},
{"tool": "project_get_settings", "args": {"keys": ["filament_is_mixed"]}, "expect": {"/items/0/value": {"eq": "0,0,0,1"}}},
{"tool": "action_run", "args": {"id": "orca_command:filament_delete:orca"}, "expect": {"/message": {"eq": "Deleted filament slot 3."}}},
{"tool": "widget_click", "args": {"target": {"label": "Remove last mixed filament"}}},
{"tool": "project_get_settings", "args": {"keys": ["filament_is_mixed"]}, "expect": {"/items/0/value": {"eq": "0,0"}}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}