Files
OrcaSlicer/tools/mcp/tests/dialogs_canvas_input.json
T
SoftFever 8bb18e84bf List objects by plate over MCP and call a part "part" in every tool
list_objects replies as the Objects panel is laid out: each plate with the
objects on it, then the objects on no plate. list_plates gives how many
objects a plate has, and every tool refuses a plate the project lacks in the
same words.
2026-11-11 18:31:00 +08:00

60 lines
4.0 KiB
JSON

// Auto-answered dialogs run their buttons' handlers, a toolbar item reads the state a selection just
// gave it, and model points on a negative part or seen through the bed from below are click targets.
// Run it on a fresh datadir set up with the default printer (Bambu Lab X1 Carbon 0.4):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/dialogs_canvas_input.json --out /tmp/dialogs
// Refusals (a point or an ImGui item under a panel or notification) are unit tests in
// tests/slic3rutils/test_mcp_results.cpp, since a replay step cannot expect an error.
{
"orca_replay": 1,
"name": "auto-answers and canvas input",
"vars": {"standard": "0.20mm Standard @BBL X1C", "fine": "0.16mm High Quality @BBL X1C"},
"steps": [
{"tool": "wait", "args": {"for": "ready"}},
{"tool": "auto_answer_dialogs", "args": {"rules": [
{"match": "Uniform scale", "button": "ok"},
{"match": "unsaved changes", "button": "no"},
{"match": "Transfer or discard", "button": "Transfer"}]}},
{"tool": "new_project", "args": {"discard_changes": true}},
{"tool": "set_window", "args": {"size": [1920, 1200]}},
{"tool": "set_view", "args": {"tab": "prepare"}},
// ---- An auto-answered Transfer keeps the edit on the newly selected process preset ----
{"tool": "select_preset", "args": {"type": "process", "name": "${vars.standard}"}},
{"tool": "set_settings", "args": {"scope": "process", "values": {"wall_loops": 5}}},
{"tool": "select_preset", "args": {"type": "process", "name": "${vars.fine}"}, "expect": {"/selected": {"eq": "0.16mm High Quality @BBL X1C"}}},
{"tool": "get_settings", "args": {"scope": "process", "keys": ["wall_loops"]}, "expect": {"/items/0/value": {"eq": "5"}}},
// ---- An auto-answered Discard drops it ----
{"tool": "auto_answer_dialogs", "args": {"rules": [{"match": "Transfer or discard", "button": "Discard"}]}},
{"tool": "select_preset", "args": {"type": "process", "name": "${vars.standard}"}, "expect": {"/selected": {"eq": "0.20mm Standard @BBL X1C"}}},
{"tool": "get_settings", "args": {"scope": "process", "keys": ["wall_loops"]}, "expect": {"/items/0/value": {"ne": "5"}}},
{"tool": "get_app_state", "expect": {"/project/dirty": {"eq": false}}},
// ---- A toolbar item a selection just enabled takes the click at once ----
{"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca"}},
{"tool": "wait", "args": {"for": "idle"}},
{"tool": "select_objects", "args": {"none": true}},
{"tool": "list_widgets", "args": {"query": "layersediting"}},
{"tool": "select_objects", "args": {"objects": [0]}},
{"tool": "click", "args": {"target": {"gltoolbar": "layersediting"}}, "expect": {"/pressed": {"eq": true}}},
{"tool": "click", "args": {"target": {"gltoolbar": "layersediting"}}, "expect": {"/pressed": {"eq": false}}},
// ---- A negative part is a surface target (the text lands on the cube's top) ----
{"tool": "set_view", "args": {"camera": "iso"}},
{"tool": "set_view", "args": {"camera": "fit_objects"}},
{"tool": "click", "args": {"target": {"gizmo": "Text"}}, "expect": {"/created": {"eq": true}}},
{"tool": "wait", "args": {"for": "idle"}},
{"tool": "click", "args": {"target": {"imgui": "Cut"}}},
{"tool": "click", "args": {"target": {"imgui": "Done"}}},
{"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "negative"}}},
// The text's size, and so which of its ends the cube hides, differs between platforms; the step is
// about the part resolving as a target, so it skips the visibility check.
{"tool": "mouse_gesture", "args": {"action": "move", "at": {"object": 0, "part": 1, "spot": "right"}, "check": "point"}},
// ---- From below, the bed hides nothing ----
{"tool": "set_view", "args": {"camera": "bottom"}},
{"tool": "set_view", "args": {"camera": "fit_objects"}},
{"tool": "mouse_gesture", "args": {"action": "move", "at": {"object": 0, "spot": "bottom"}}},
{"tool": "mouse_gesture", "args": {"action": "move", "at": {"object": 0, "point": [5, 5, -12.8]}}}
]
}