mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-28 08:09:55 -05:00
Every command takes JSON arguments and has one function for a person and for automation: with no arguments it does what a person's pick does, and with arguments it runs silently. The Design tab's CAD tools are commands that call_tool runs, and they show as Speed Dial tiles on the Design tab.
123 lines
7.3 KiB
JSON
123 lines
7.3 KiB
JSON
// Records what starting a slice does through its routes, the slice_and_preview and slice_all commands run with
|
|
// run_action (they return at once) and the slice tool (the current plate, all, an index): with no objects, on
|
|
// one plate, on two plates, and with objects that fail validation (spiral vase on a plate with two objects).
|
|
// Each call starts from the Prepare tab; after it, the replay waits for idle and reads the plates' slice state,
|
|
// the tab, the notifications and the undo snapshots taken since the last read (fixtures/ops_undo.py). Every call
|
|
// it records is optional. Run it with
|
|
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_start_slice.json --out <dir>
|
|
{
|
|
"orca_replay": 1,
|
|
"name": "ops start_slice",
|
|
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
|
|
"steps": [
|
|
{"tool": "wait", "args": {"for": "ready"}},
|
|
{"tool": "auto_answer_dialogs", "args": {"rules": [{"match": "Spiral mode only works", "button": "yes"}]}},
|
|
{"tool": "new_project", "args": {"discard_changes": true, "preset_changes": "discard"}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
|
|
// ---- No objects ----
|
|
{"tool": "run_action", "args": {"id": "orca_command:slice_and_preview:orca"}, "optional": true},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:slice_all:orca"}, "optional": true},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "slice", "args": {}, "optional": true},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "slice", "args": {"plates": "all"}, "optional": true},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
|
|
// ---- One plate ----
|
|
{"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "args": {"size": [20, 20, 20]}}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:slice_and_preview:orca"}, "optional": true},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "transform", "args": {"object": 0, "translate": [5, 0, 0]}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "slice", "args": {}, "optional": true},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
|
|
// ---- Two plates, a cube on each ----
|
|
{"tool": "run_action", "args": {"id": "orca_command:plate_add:orca"}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:plate_goto:orca", "args": {"plate": 1}}},
|
|
{"tool": "select_objects", "args": {"none": true}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "args": {"size": [20, 20, 20]}}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:plate_goto:orca", "args": {"plate": 0}}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "list_plates", "expect": {"/total": {"eq": 2}, "/items/1/objects": {"eq": 1}}},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:slice_and_preview:orca"}, "optional": true},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "transform", "args": {"object": 0, "translate": [5, 0, 0]}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:slice_all:orca"}, "optional": true},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "transform", "args": {"object": 0, "translate": [5, 0, 0]}},
|
|
{"tool": "transform", "args": {"object": 1, "translate": [5, 0, 0]}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "slice", "args": {"plates": "all"}, "optional": true},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "transform", "args": {"object": 1, "translate": [5, 0, 0]}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:plate_goto:orca", "args": {"plate": 0}}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "slice", "args": {"plates": 1}, "optional": true},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
|
|
// ---- Objects that fail validation: spiral vase on a plate with two objects ----
|
|
{"tool": "new_project", "args": {"discard_changes": true}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "args": {"size": [20, 20, 20]}}},
|
|
{"tool": "select_objects", "args": {"none": true}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "args": {"size": [20, 20, 20]}}},
|
|
{"tool": "arrange", "args": {}},
|
|
{"tool": "set_settings", "args": {"scope": "plate", "plate": 0, "values": {"spiral_mode": true}}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:slice_and_preview:orca"}, "optional": true},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "run_action", "args": {"id": "orca_command:slice_all:orca"}, "optional": true},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "slice", "args": {}, "optional": true},
|
|
{"tool": "get_app_state"},
|
|
{"tool": "list_plates"},
|
|
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
|
|
{"tool": "new_project", "args": {"discard_changes": true}}
|
|
]
|
|
}
|