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

65 lines
4.8 KiB
JSON

// The object structure commands made from rows, called by index: object_split into objects and into parts,
// object_assemble, part_change_type and object_order name what they made or renumbered in their replies, which
// object_list reads back; the Split to Objects tile splits the selected object. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/rows_structure.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "object structure rows by index",
"vars": {"two_shells": "${replay_dir}/../../../tests/data/two_hollow_squares.obj"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
// ---- A model of two shells, split into objects by index; both rest on the bed, so nothing is asked ----
{"tool": "project_import", "args": {"paths": ["${vars.two_shells}"]}, "expect": {"/added": {"eq": 1}}},
{"tool": "object_list", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/parts/1": {"exists": false}}},
{"tool": "object_split", "args": {"object": 0, "into": "objects"},
"expect": {"/objects/0/index": {"eq": 0}, "/objects/1/index": {"eq": 1}, "/objects/2": {"exists": false}, "/object_count": {"eq": 2}}},
{"tool": "object_list", "expect": {"/total": {"eq": 2}, "/plates/0/objects/1/parts/1": {"exists": false}}},
// ---- Another, split into parts by index: the part becomes one part per shell ----
{"tool": "project_import", "args": {"paths": ["${vars.two_shells}"]}, "expect": {"/added": {"eq": 1}}},
{"tool": "object_split", "args": {"object": 2, "into": "parts"},
"expect": {"/parts/0/object": {"eq": 2}, "/parts/0/part": {"eq": 0}, "/parts/1/part": {"eq": 1}, "/parts/2": {"exists": false},
"/object_count": {"eq": 3}}},
{"tool": "object_list", "expect": {"/total": {"eq": 3}, "/plates/0/objects/2/parts/1/type": {"eq": "part"},
"/plates/0/objects/2/parts/2": {"exists": false}}},
// ---- The first two assembled by index: they go, and the assembly is added last ----
{"tool": "object_assemble", "args": {"objects": [0, 1]},
"expect": {"/object": {"eq": 1}, "/name": {"eq": "Assembly"}, "/objects/0/index": {"eq": 1}, "/objects/0/name": {"eq": "Assembly"}}},
{"tool": "object_list", "expect": {"/total": {"eq": 2}, "/plates/0/objects/1/name": {"eq": "Assembly"},
"/plates/0/objects/1/parts/1": {"exists": true}, "/plates/0/objects/0/parts/1": {"exists": true}}},
// ---- Part 0 of object 0 made a modifier: parts are listed by type, so it moves after the solid part, to 1 ----
{"tool": "part_change_type", "args": {"parts": [[0, 0]], "type": "modifier"},
"expect": {"/parts/0/object": {"eq": 0}, "/parts/0/part": {"eq": 1}, "/parts/0/type": {"eq": "modifier"}}},
{"tool": "object_list", "expect": {"/plates/0/objects/0/parts/0/type": {"eq": "part"}, "/plates/0/objects/0/parts/1/type": {"eq": "modifier"}}},
// ---- The plate ordered by height, then descending; the order read back ----
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 30]}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 10]}},
{"tool": "object_order", "args": {"by": "height", "plate": 0},
"expect": {"/descending": {"eq": false}, "/order/3/plate": {"eq": 0}, "/order/4": {"exists": false}}},
{"tool": "object_list", "expect": {"/plates/0/objects/2/bbox/size/2": {"ge": 9.99, "le": 10.01},
"/plates/0/objects/3/bbox/size/2": {"ge": 29.99, "le": 30.01}}},
// the same call again keeps the order: only the tile's call reverses it
{"tool": "object_order", "args": {"by": "height", "plate": 0}, "expect": {"/descending": {"eq": false}}},
{"tool": "object_order", "args": {"by": "height", "descending": true}, "expect": {"/descending": {"eq": true}}},
{"tool": "object_list", "expect": {"/plates/0/objects/0/bbox/size/2": {"ge": 29.99, "le": 30.01},
"/plates/0/objects/1/bbox/size/2": {"ge": 9.99, "le": 10.01}}},
// ---- The Split to Objects tile on the selected object of two shells ----
{"tool": "project_import", "args": {"paths": ["${vars.two_shells}"]}, "expect": {"/added": {"eq": 1}}},
{"tool": "object_select", "args": {"objects": [4]}},
{"tool": "action_run", "args": {"id": "orca_command:obj_split_objects:orca"},
"expect": {"/objects/0/index": {"eq": 4}, "/objects/1/index": {"eq": 5}, "/object_count": {"eq": 6}}},
{"tool": "object_list", "expect": {"/total": {"eq": 6}}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}