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

59 lines
3.7 KiB
JSON

// Records what saving the project under a name, project_save with a path, does: with no objects, to a .3mf path,
// to a .gcode.3mf path, into a folder that does not exist, and to a file that exists, without overwrite and then
// with it. After each it reads the project's name, file and unsaved state, the recent projects and the undo
// snapshots taken since the last read (fixtures/ops_undo.py), and whether the file is there: an stl export to the
// same path with a plate the project lacks refuses with "exists" when it is, with the plate when not (for the file
// saved with no objects, once a cube is added). Every call it records is optional. Run it into a fresh --out
// directory (a save without overwrite refuses the file of an earlier run):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_save_project_as.json --out <new dir>
{
"orca_replay_version": "0.2.0",
"name": "ops save_project_as",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
// ---- No objects (the probe comes once there is one) ----
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_save", "args": {"path": "${out_dir}/empty.3mf"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A .3mf path ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/empty.3mf", "plates": 999}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_save", "args": {"path": "${out_dir}/saved.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/saved.3mf", "plates": 999}, "optional": true},
{"tool": "app_state"},
{"tool": "action_search", "args": {"group": "Recent Projects"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A .gcode.3mf path ----
{"tool": "object_transform", "args": {"object": 0, "translate": [5, 0, 0]}},
{"tool": "project_save", "args": {"path": "${out_dir}/saved.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/saved.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A folder that does not exist ----
{"tool": "project_save", "args": {"path": "${out_dir}/missing/saved.3mf"}, "optional": true},
{"tool": "app_state"},
// ---- A file that exists: without overwrite, then with it ----
{"tool": "project_save", "args": {"path": "${out_dir}/saved.3mf"}, "optional": true},
{"tool": "app_state"},
{"tool": "project_save", "args": {"path": "${out_dir}/saved.3mf", "overwrite": true}, "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}}
]
}