Files
OrcaSlicer/tools/mcp/tests/ops_show_layer_range.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

123 lines
7.6 KiB
JSON

// Records how the Preview's layers are set through its two routes, the go_to_layer tile run with
// action_run and its percent (0, 50, 100, a fraction, and refused: past 100, negative, not a number, none)
// and view_set's layer, layer_range and layer_z (in range, past the top, a layer_z above it): on plates the
// Preview has no layers for (one with no objects, one whose slice fails validation: spiral vase with two
// objects), then on a sliced one. A plate that could slice is left out of the first part, since showing the
// Preview slices it while the call runs, so what the call finds depends on timing. After each it reads
// app_state's tab and preview, and at the end of each part the undo snapshots taken
// (fixtures/ops_undo.py). Every call it records is optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_show_layer_range.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops show_layer_range",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Spiral mode only works", "button": "yes"}]}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
// The Preview's sliders keep the last slice's layers after a new project, so one known slice comes first:
// a 20 mm cube, 100 layers.
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "plate_slice", "expect": {"/plates/0/layers": {"eq": 100}}},
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- No objects ----
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 50}}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "view_set", "args": {"layer": 10}, "optional": true},
{"tool": "view_set", "args": {"layer_range": [2, 5]}, "optional": true},
{"tool": "view_set", "args": {"layer_z": 5.0}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A plate whose slice fails validation ----
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_arrange", "args": {"plates": "all"}},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"spiral_mode": true}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 50}}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "view_set", "args": {"layer": 10}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "view_set", "args": {"layer_range": [2, 5]}, "optional": true},
{"tool": "view_set", "args": {"layer_z": 5.0}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A sliced plate: the tile ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 0}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 50}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 100}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 25.5}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 150}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": -5}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": "abc"}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 10}}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca"}, "optional": true},
{"tool": "app_state"},
// the tile after view_set showed a range: does it keep the range's bottom?
{"tool": "view_set", "args": {"layer_range": [20, 60]}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 80}}, "optional": true},
{"tool": "app_state"},
// from the Prepare tab
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 30}}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A sliced plate: view_set ----
{"tool": "view_set", "args": {"layer": 1}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer": 50}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer": 100}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer": 9999}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer_range": [5, 20]}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer_range": [30, 10]}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer_range": [5]}, "optional": true},
{"tool": "view_set", "args": {"layer_z": 5.0}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer_z": 999}, "optional": true},
{"tool": "view_set", "args": {"layer": 3, "layer_z": 5.0}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "view_set", "args": {"layer": 40}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}