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

60 lines
3.3 KiB
JSON

// plate_slice's reply's statistics: layers and max Z, filament changes, the totals with the flush, and
// every filament slot split into model, support, flush and prime tower. A 25.6 mm cube on filament 1
// of two, then a second cube on filament 2, so every layer changes filament. Run it on a fresh
// datadir set up with the default printer (Bambu Lab X1 Carbon 0.4, prime tower on):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/slice_stats.json --out /tmp/slice_stats
// The sums (filament_g as the slots' g, a slot's g as its four uses) are unit tests in
// tests/slic3rutils/test_mcp_results.cpp, since a replay step cannot add values up.
{
"orca_replay_version": "0.2.0",
"name": "slice statistics",
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Uniform scale", "button": "ok"}]}},
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "window_set", "args": {"size": [1600, 900]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "widget_click", "args": {"target": {"label": "Add one filament"}}},
{"tool": "app_state", "expect": {"/presets/filaments/1": {"exists": true}}},
{"tool": "action_run", "args": {"id": "orca_command:add_primitive_cube:orca"}},
{"tool": "app_wait", "args": {"for": "idle"}},
// ---- One colour: no flush, tower or change; the unused slot 2 is listed with zeros ----
{"tool": "plate_slice", "expect": {
"/plates/0/outcome": {"eq": "ok"},
"/plates/0/layers": {"eq": 128},
"/plates/0/max_z": {"gt": 25.5, "lt": 25.7},
"/plates/0/filament_changes": {"eq": 0},
"/plates/0/filament_g": {"gt": 0},
"/plates/0/filaments/2": {"exists": false},
"/plates/0/filaments/0/slot": {"eq": 1},
"/plates/0/filaments/0/model_g": {"gt": 0},
"/plates/0/filaments/0/flush_g": {"eq": 0},
"/plates/0/filaments/0/tower_g": {"eq": 0},
"/plates/0/filaments/1/slot": {"eq": 2},
"/plates/0/filaments/1/g": {"eq": 0}}},
// ---- Two colours: the second cube on filament 2 ----
{"tool": "object_select", "args": {"none": true}},
{"tool": "action_run", "args": {"id": "orca_command:add_primitive_cube:orca"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "action_run", "args": {"id": "orca_command:obj_arrange:orca"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "object_select", "args": {"objects": [1]}},
// To the canvas by name: without a target the key goes to whatever has focus.
{"tool": "keyboard_press", "args": {"target": {"name": "OrcaSceneCanvas"}, "keys": "2"}, "expect": {"/to": {"eq": "wxGLCanvas"}}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "plate_slice", "expect": {
"/plates/0/outcome": {"eq": "ok"},
"/plates/0/layers": {"eq": 128},
"/plates/0/filament_changes": {"gt": 100},
"/plates/0/filaments/0/model_g": {"gt": 0},
"/plates/0/filaments/1/model_g": {"gt": 0},
"/plates/0/filaments/0/flush_g": {"gt": 0},
"/plates/0/filaments/1/flush_g": {"gt": 0},
"/plates/0/filaments/0/tower_g": {"gt": 0},
"/plates/0/filaments/1/tower_g": {"gt": 0},
"/plates/0/filaments/1/support_g": {"eq": 0}}}
]
}