mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-02 09:48:14 -05:00
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.
This commit is contained in:
1 parent
74c98e197c
commit
d64e10f4dd
287 files changed
+40484
-16770
No files matched your search
@@ -1,121 +1,103 @@
|
||||
// Records what the G-code export does through its two routes, the export tool (format gcode) and the
|
||||
// export_gcode command run with run_action and a path: with no objects, on a plate not sliced, after a
|
||||
// slice that ended with an error, while a slice runs (started by slice_and_preview and slice_all, which return
|
||||
// at once), with a plate index the project lacks, a success, and two exports started back to back
|
||||
// through each route. A replay step returns once a short export has finished, so those two run one after the
|
||||
// other; overlapping calls need two clients. Every call it records is optional, so a refusal is kept in
|
||||
// result.json with its text, which both routes word alike, and each is followed by the reads that show what it
|
||||
// left; the run_script steps (fixtures/ops_undo.py) list the undo snapshots taken since the last one. An stl
|
||||
// export to a G-code's path with a plate the project lacks tells whether that file exists: it refuses with
|
||||
// "exists" when it does, with the plate when not. Each case waits for idle first, since an export right after an
|
||||
// edit is refused as slicing while the edit's background update is pending. Run it into a fresh --out directory
|
||||
// (the commands write without overwrite, so they refuse the files of an earlier run):
|
||||
// Records what the G-code export, project_export with format gcode and a path, does: with no objects, on a plate
|
||||
// not sliced, with a plate index the project lacks, after a slice that ended with an error, a success, two exports
|
||||
// started back to back, and while a slice runs (started by the slice_and_preview and slice_all tiles, which return
|
||||
// at once). Each case exports once, to a file named for it. A replay step returns once a short export has
|
||||
// finished, so the two started back to back run one after the other; overlapping calls need two clients. Every
|
||||
// call it records is optional, so a refusal is kept in result.json with its text, and each is followed by the
|
||||
// reads that show what it left; the script_run steps (fixtures/ops_undo.py) list the undo snapshots taken since
|
||||
// the last one. An stl export to a G-code's path with a plate the project lacks tells whether that file exists: it
|
||||
// refuses with "exists" when it does, with the plate when not. Each case waits for idle first, since an export
|
||||
// right after an edit is refused as slicing while the edit's background update is pending. Run it into a fresh
|
||||
// --out directory (an export without overwrite refuses the file of an earlier run):
|
||||
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_gcode.json --out <new dir>
|
||||
{
|
||||
"orca_replay_version": "0.1.0",
|
||||
"orca_replay_version": "0.2.0",
|
||||
"name": "ops export_gcode",
|
||||
"vars": {
|
||||
"benchy": "${replay_dir}/../../../resources/handy_models/3DBenchy.drc",
|
||||
"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()"}},
|
||||
{"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"}},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
|
||||
// ---- No objects ----
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/empty_tool.gcode", "overwrite": true}, "optional": true},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/empty_cmd.gcode"}}, "optional": true},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/empty.gcode"}, "optional": true},
|
||||
{"tool": "app_state"},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
|
||||
// ---- A plate that is not sliced ----
|
||||
{"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "args": {"size": [20, 20, 20]}}},
|
||||
{"tool": "list_objects", "expect": {"/total": {"eq": 1}}},
|
||||
{"tool": "wait", "args": {"for": "idle"}},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/unsliced_tool.gcode", "overwrite": true}, "optional": true},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/unsliced_cmd.gcode"}}, "optional": true},
|
||||
{"tool": "list_plates"},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
|
||||
{"tool": "object_list", "expect": {"/total": {"eq": 1}}},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/unsliced.gcode"}, "optional": true},
|
||||
{"tool": "plate_list"},
|
||||
{"tool": "app_state"},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
|
||||
// ---- A plate index the project lacks (the command takes no plate) ----
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/noplate_tool.gcode", "overwrite": true, "plates": 3}, "optional": true},
|
||||
{"tool": "get_app_state"},
|
||||
// ---- A plate index the project lacks ----
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/no_plate.gcode", "plates": 3}, "optional": true},
|
||||
{"tool": "app_state"},
|
||||
|
||||
// ---- A slice that ended with an error: spiral vase on a plate with two objects ----
|
||||
{"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": "slice", "expect": {"/plates/0/outcome": {"eq": "error"}}},
|
||||
{"tool": "wait", "args": {"for": "idle"}},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/error_tool.gcode", "overwrite": true}, "optional": true},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/error_cmd.gcode"}}, "optional": true},
|
||||
{"tool": "list_plates"},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "set_settings", "args": {"scope": "plate", "plate": 0, "values": {"spiral_mode": null}}},
|
||||
{"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": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "error"}}},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/slice_error.gcode"}, "optional": true},
|
||||
{"tool": "plate_list"},
|
||||
{"tool": "app_state"},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"spiral_mode": null}}},
|
||||
|
||||
// ---- Success, and whether the file is there when the reply comes ----
|
||||
{"tool": "slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
|
||||
{"tool": "wait", "args": {"for": "idle"}},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/ok_tool.gcode", "overwrite": true}, "optional": true},
|
||||
{"tool": "export", "args": {"format": "stl", "path": "${out_dir}/ok_tool.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/ok_cmd.gcode"}}, "optional": true},
|
||||
{"tool": "export", "args": {"format": "stl", "path": "${out_dir}/ok_cmd.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "list_plates"},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/ok.gcode"}, "optional": true},
|
||||
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/ok.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "plate_list"},
|
||||
{"tool": "app_state"},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
|
||||
// ---- Two exports back to back: tool and tool, command and command, tool then command ----
|
||||
// A modal error would show in get_app_state; answer_dialog closes it if one opened.
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/twice_tool_1.gcode", "overwrite": true}, "await": false, "save_as": "tool_1", "optional": true},
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/twice_tool_2.gcode", "overwrite": true}, "await": false, "save_as": "tool_2", "optional": true},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "answer_dialog", "args": {"button": "ok"}, "optional": true},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/twice_cmd_1.gcode"}}, "await": false, "save_as": "cmd_1", "optional": true},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/twice_cmd_2.gcode"}}, "await": false, "save_as": "cmd_2", "optional": true},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "answer_dialog", "args": {"button": "ok"}, "optional": true},
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/twice_mix_1.gcode", "overwrite": true}, "await": false, "save_as": "mix_1", "optional": true},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/twice_mix_2.gcode"}}, "await": false, "save_as": "mix_2", "optional": true},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "answer_dialog", "args": {"button": "ok"}, "optional": true},
|
||||
{"tool": "wait", "args": {"for": "idle"}},
|
||||
{"tool": "export", "args": {"format": "stl", "path": "${out_dir}/twice_tool_2.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "export", "args": {"format": "stl", "path": "${out_dir}/twice_cmd_2.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "export", "args": {"format": "stl", "path": "${out_dir}/twice_mix_2.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
// ---- Two exports back to back ----
|
||||
// A modal error would show in app_state; dialog_answer closes it if one opened.
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/twice_1.gcode"}, "await": false, "save_as": "twice_1", "optional": true},
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/twice_2.gcode"}, "await": false, "save_as": "twice_2", "optional": true},
|
||||
{"tool": "app_state"},
|
||||
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/twice_2.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
|
||||
// ---- While a slice runs: slice_and_preview, then slice_all, both return at once ----
|
||||
{"tool": "new_project", "args": {"discard_changes": true}},
|
||||
{"tool": "open_files", "args": {"paths": ["${vars.benchy}"]}, "expect": {"/added": {"eq": 1}}},
|
||||
{"tool": "wait", "args": {"for": "idle"}},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:slice_and_preview:orca"}},
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/busy_tool.gcode", "overwrite": true}, "optional": true},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/busy_cmd.gcode"}}, "optional": true},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "wait", "args": {"for": "idle"}},
|
||||
{"tool": "list_plates"},
|
||||
{"tool": "transform", "args": {"object": 0, "translate": [5, 0, 0]}},
|
||||
{"tool": "wait", "args": {"for": "idle"}},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:slice_all:orca"}},
|
||||
{"tool": "run_action", "args": {"id": "orca_command:export_gcode:orca", "args": {"path": "${out_dir}/busy2_cmd.gcode"}}, "optional": true},
|
||||
{"tool": "export", "args": {"format": "gcode", "path": "${out_dir}/busy2_tool.gcode", "overwrite": true}, "optional": true},
|
||||
{"tool": "get_app_state"},
|
||||
{"tool": "wait", "args": {"for": "idle"}},
|
||||
{"tool": "list_plates"},
|
||||
{"tool": "export", "args": {"format": "stl", "path": "${out_dir}/busy_cmd.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "export", "args": {"format": "stl", "path": "${out_dir}/busy2_cmd.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "run_script", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
// ---- While a slice runs: the slice_and_preview tile, then slice_all, both return at once ----
|
||||
{"tool": "project_new", "args": {"discard_changes": true}},
|
||||
{"tool": "project_import", "args": {"paths": ["${vars.benchy}"]}, "expect": {"/added": {"eq": 1}}},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "action_run", "args": {"id": "orca_command:slice_and_preview:orca"}},
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/slicing_preview.gcode"}, "optional": true},
|
||||
{"tool": "app_state"},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "plate_list"},
|
||||
{"tool": "object_transform", "args": {"object": 0, "translate": [5, 0, 0]}},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "action_run", "args": {"id": "orca_command:slice_all:orca"}},
|
||||
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/slicing_all.gcode"}, "optional": true},
|
||||
{"tool": "app_state"},
|
||||
{"tool": "app_wait", "args": {"for": "idle"}},
|
||||
{"tool": "plate_list"},
|
||||
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/slicing_preview.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/slicing_all.gcode", "plates": 999}, "optional": true},
|
||||
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
||||
|
||||
{"tool": "new_project", "args": {"discard_changes": true}}
|
||||
{"tool": "project_new", "args": {"discard_changes": true}}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user