Files
OrcaSlicer/tools/mcp/tests/menu_items_structure.json
T
SoftFever bbda030f4d Say menu item, not menu row, in the MCP commands and docs
The MCP command descriptions, docs and code called an entry of the app's
menus a "row", the word they also use for the rows of the object list and
the app's other lists. They now say "menu item", so a row is only ever a row
of a list or table. Command names, arguments and Speed Dial tile ids are
unchanged.
2026-11-19 00:35:28 +08:00

65 lines
4.8 KiB
JSON

// The object structure commands made from menu items, 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/menu_items_structure.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "object structure menu items 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}}
]
}