mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-27 15:49:52 -05:00
Thirty-four Design commands were bare verbs (extrude, fillet, measure), so an agent could not tell from a name where a command acts or find a place's commands together. Every Design command now starts with its place: design_, sketch_, solid_, surface_, construct_, body_ or feature_. Replacing objects when committing a design to the plate deletes them as Prepare's Delete does, and the guide to making a feature reachable covers Design commands.
159 lines
14 KiB
JSON
159 lines
14 KiB
JSON
// Reads and edits a Design-tab feature as its card does: a variable bound to an extrude, the
|
|
// binding and the variable removed, then literal edits through feature_edit, checked by volume, also
|
|
// under the names agents often give its params (index, params, values).
|
|
// Then hands the design off: Commit to Plate, a recommit that replaces the first object (one
|
|
// Prepare undo step), a STEP export read back into a new design, and two bodies committed both ways.
|
|
// Last, the Design history and the tree: undo / redo of an edit and of a rename (its own step),
|
|
// suppressing, moving and deleting features, naming, hiding and colouring bodies (a hidden body stays
|
|
// off the plate, a named one names its object), and a save and reopen that keeps the colour.
|
|
// Needs the CAD feature on:
|
|
// tools/mcp/orca_mcp.py launch --cad
|
|
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/cad_doc.json --out /tmp/out
|
|
{
|
|
"orca_replay_version": "0.2.0",
|
|
"name": "cad document",
|
|
"steps": [
|
|
{"tool": "app_wait", "args": {"for": "ready"}},
|
|
// The Generic Klipper Printer, whose plate the bodies are sent to and whose project is saved and reopened.
|
|
{"tool": "preset_select", "args": {"type": "printer", "name": "MyKlipper 0.4 nozzle", "preset_changes": "discard"}},
|
|
{"tool": "project_new", "args": {"discard_changes": true}},
|
|
{"tool": "window_set", "args": {"size": [1600, 900]}},
|
|
{"tool": "tool_call", "args": {"tool": "design_new"}, "expect": {"/ok": {"exists": false}, "/cleared/features": {"eq": 0}}},
|
|
{"tool": "tool_describe", "args": {"tool": "feature_describe"}, "expect": {"/group": {"eq": "Design"}, "/access/read_only": {"eq": true}}},
|
|
{"tool": "tool_describe", "args": {"tool": "feature_edit"}, "expect": {"/group": {"eq": "Design"}, "/access/read_only": {"eq": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "solid_extrude", "args": {"width": 20, "height": 20, "distance": 10}},
|
|
"expect": {"/ok": {"exists": false}, "/extrude_index": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_set_variable", "args": {"name": "h", "expr": "12"}},
|
|
"expect": {"/ok": {"exists": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_set_expression", "args": {"feature": 1, "field": "distance", "expr": "h"}},
|
|
"expect": {"/ok": {"exists": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"},
|
|
"expect": {"/variables/0/name": {"eq": "h"}, "/variables/0/value": {"eq": 12.0},
|
|
"/features/1/bound/0": {"eq": "distance"}, "/bodies/0/source_feature": {"eq": 1},
|
|
"/bodies/0/visible": {"eq": true}, "/bodies/0/moved": {"eq": false},
|
|
"/bodies/0/color": {"regex": "^#[0-9A-F]{6}$"}, "/undo_depth": {"eq": 3}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_describe", "args": {"feature": 1}},
|
|
"expect": {"/type": {"eq": "Extrude"}, "/params/distance": {"eq": 12.0}, "/expr/distance": {"eq": "h"},
|
|
"/refs/sketch_ref": {"eq": 0}, "/bodies_made/0": {"eq": 0}, "/editable": {"contains": "distance"}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_describe", "args": {"feature": 0}},
|
|
"expect": {"/type": {"eq": "Sketch"}, "/params/width": {"eq": 20.0}, "/plane/base": {"eq": "XY"},
|
|
"/used_by/0": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_set_expression", "args": {"feature": 1, "field": "distance", "expr": ""}},
|
|
"expect": {"/ok": {"exists": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_set_variable", "args": {"name": "h", "expr": ""}},
|
|
"expect": {"/ok": {"exists": false}, "/removed": {"eq": true}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"},
|
|
"expect": {"/variables": {"empty": true}, "/features/1/bound": {"exists": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_edit", "args": {"feature": 1, "fields": {"distance": 15}}},
|
|
"expect": {"/ok": {"exists": false}, "/changed/distance/0": {"eq": 12.0}, "/changed/distance/1": {"eq": 15.0}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_mass_properties", "args": {"body": 0}},
|
|
"expect": {"/volume": {"ge": 5999.99, "le": 6000.01}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_edit", "args": {"feature": 0, "fields": {"width": 30}}},
|
|
"expect": {"/changed/width/1": {"eq": 30.0}}},
|
|
// The names agents often use: index for feature, params or values for fields.
|
|
{"tool": "tool_call", "args": {"tool": "feature_edit", "args": {"index": 0, "params": {"width": 20}}},
|
|
"expect": {"/changed/width/1": {"eq": 20.0}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_edit", "args": {"feature": 0, "values": {"width": 30}}},
|
|
"expect": {"/changed/width/1": {"eq": 30.0}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_describe", "args": {"index": 1}}, "expect": {"/params/distance": {"eq": 15.0}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_mass_properties", "args": {"body": 0}},
|
|
"expect": {"/volume": {"ge": 8999.99, "le": 9000.01}}},
|
|
{"tool": "tool_call", "args": {"tool": "sketch_create", "args": {"plane": "XY"}}},
|
|
{"tool": "tool_call", "args": {"tool": "sketch_draw", "args": {"type": "rectangle_2_point", "p0": [40, 0], "p1": [60, 10]}}},
|
|
{"tool": "tool_call", "args": {"tool": "sketch_repair"}},
|
|
{"tool": "tool_call", "args": {"tool": "sketch_finish"}, "expect": {"/features": {"eq": 3}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_describe", "args": {"feature": 2}},
|
|
"expect": {"/entities/0/type": {"eq": "line"}, "/entities/3/type": {"eq": "line"},
|
|
"/editable": {"empty": true}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_commit_to_plate"},
|
|
"expect": {"/objects/0/index": {"eq": 0}, "/objects/0/name": {"eq": "Design Body"},
|
|
"/objects/0/parts": {"eq": 1}, "/bodies_sent/0": {"eq": 0}, "/tab": {"eq": "prepare"}}},
|
|
{"tool": "object_list", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/name": {"eq": "Design Body"},
|
|
"/plates/0/objects/0/size/2": {"ge": 14.99, "le": 15.01}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_edit", "args": {"feature": 1, "fields": {"distance": 20}}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_commit_to_plate", "args": {"replace": [0]}},
|
|
"expect": {"/objects/0/index": {"eq": 0}, "/replaced/0/index": {"eq": 0}, "/replaced/0/name": {"eq": "Design Body"}}},
|
|
{"tool": "object_list", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/size/2": {"ge": 19.99, "le": 20.01}}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
|
|
{"tool": "object_list", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/size/2": {"ge": 14.99, "le": 15.01}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_export_step", "args": {"path": "${out_dir}/design.step", "overwrite": true}},
|
|
"expect": {"/bytes": {"gt": 0}, "/bodies": {"eq": 1}, "/moved_bodies": {"empty": true}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_new", "args": {"discard_changes": true}},
|
|
"expect": {"/cleared/features": {"eq": 3}, "/cleared/bodies": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_import_step", "args": {"path": "${out_dir}/design.step"}},
|
|
"expect": {"/ok": {"exists": false}, "/bodies": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_mass_properties", "args": {"body": 0}},
|
|
"expect": {"/volume": {"ge": 11998.8, "le": 12001.2}}},
|
|
{"tool": "tool_call", "args": {"tool": "solid_extrude", "args": {"profile": [[40, 0], [50, 0], [50, 10], [40, 10]], "distance": 5}},
|
|
"expect": {"/bodies": {"eq": 2}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_commit_to_plate", "args": {"mode": "bodies"}},
|
|
"expect": {"/mode": {"eq": "bodies"}, "/objects/0/index": {"eq": 1}, "/objects/1/index": {"eq": 2},
|
|
"/objects/1/name": {"eq": "Design Body 2"}, "/bodies_sent/1": {"eq": 1}, "/bodies_hidden": {"empty": true}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_commit_to_plate", "args": {"mode": "assembly"}},
|
|
"expect": {"/objects/0/index": {"eq": 3}, "/objects/0/name": {"eq": "Design Assembly"}, "/objects/0/parts": {"eq": 2}}},
|
|
{"tool": "object_list", "expect": {"/total": {"eq": 4}}},
|
|
|
|
{"tool": "tool_call", "args": {"tool": "design_new", "args": {"discard_changes": true}}},
|
|
{"tool": "tool_call", "args": {"tool": "solid_extrude", "args": {"width": 20, "height": 20, "distance": 10}},
|
|
"expect": {"/extrude_index": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_edit", "args": {"feature": 1, "fields": {"distance": 15}}}},
|
|
{"tool": "tool_call", "args": {"tool": "undo", "args": {"history": "design"}},
|
|
"expect": {"/result/scope": {"eq": "design"}, "/result/undo_depth": {"eq": 1}, "/result/redo_depth": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_describe", "args": {"feature": 1}}, "expect": {"/params/distance": {"eq": 10.0}}},
|
|
{"tool": "tool_call", "args": {"tool": "redo", "args": {"history": "design"}}, "expect": {"/result/redo_depth": {"eq": 0}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_describe", "args": {"feature": 1}}, "expect": {"/params/distance": {"eq": 15.0}}},
|
|
{"tool": "tool_call", "args": {"tool": "solid_extrude", "args": {"profile": [[40, 0], [50, 0], [50, 10], [40, 10]], "distance": 5}},
|
|
"expect": {"/extrude_index": {"eq": 3}, "/bodies": {"eq": 2}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_rename", "args": {"feature": 1, "name": " Base "}},
|
|
"expect": {"/name": {"eq": "Base"}, "/changed": {"eq": true}, "/undo_depth": {"eq": 4}}},
|
|
{"tool": "tool_call", "args": {"tool": "undo", "args": {"history": "design"}}, "expect": {"/result/undo_depth": {"eq": 3}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"},
|
|
"expect": {"/features/1/name": {"regex": "^Extrude \\d+$"}, "/features/3": {"exists": true}, "/features/4": {"exists": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_describe", "args": {"feature": 1}}, "expect": {"/params/distance": {"eq": 15.0}}},
|
|
{"tool": "tool_call", "args": {"tool": "redo", "args": {"history": "design"}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"}, "expect": {"/features/1/name": {"eq": "Base"}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_suppress", "args": {"feature": 3, "suppressed": true}},
|
|
"expect": {"/changed": {"eq": true}, "/bodies": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_suppress", "args": {"feature": 3, "suppressed": true}},
|
|
"expect": {"/changed": {"eq": false}, "/bodies": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_suppress", "args": {"feature": 3, "suppressed": false}},
|
|
"expect": {"/bodies": {"eq": 2}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_move", "args": {"feature": 2, "delta": -1}},
|
|
"expect": {"/feature": {"eq": 1}, "/from": {"eq": 2}, "/bodies": {"eq": 2}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"},
|
|
"expect": {"/features/1/type": {"eq": "Sketch"}, "/features/2/name": {"eq": "Base"}}},
|
|
{"tool": "tool_call", "args": {"tool": "undo", "args": {"history": "design"}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"}, "expect": {"/features/1/name": {"eq": "Base"}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_set", "args": {"body": 1, "name": "Lid", "visible": false}},
|
|
"expect": {"/name": {"eq": "Lid"}, "/visible": {"eq": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"},
|
|
"expect": {"/bodies/1/name": {"eq": "Lid"}, "/bodies/1/user_name": {"eq": true}, "/bodies/1/visible": {"eq": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_commit_to_plate"},
|
|
"expect": {"/bodies_sent/1": {"exists": false}, "/bodies_sent/0": {"eq": 0}, "/bodies_hidden/0": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_set", "args": {"body": 1, "visible": true}}, "expect": {"/visible": {"eq": true}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_set", "args": {"body": 0, "visible": false}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_commit_to_plate", "args": {"mode": "bodies"}},
|
|
"expect": {"/objects/0/name": {"eq": "Lid"}, "/bodies_sent/0": {"eq": 1}, "/bodies_hidden/0": {"eq": 0}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_set", "args": {"body": 0, "visible": true}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_delete", "args": {"body": 1}},
|
|
"expect": {"/deleted_feature/index": {"eq": 3}, "/deleted_feature/type": {"eq": "Extrude"},
|
|
"/removed": {"eq": 1}, "/features": {"eq": 3}, "/bodies": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "undo", "args": {"history": "design"}}, "expect": {"/result/bodies": {"eq": 2}}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"}, "expect": {"/bodies/1/source_feature": {"eq": 3}}},
|
|
{"tool": "tool_call", "args": {"tool": "feature_delete", "args": {"feature": 0}},
|
|
"expect": {"/removed": {"eq": 2}, "/features": {"eq": 2}, "/bodies": {"eq": 1}}},
|
|
{"tool": "tool_call", "args": {"tool": "undo", "args": {"history": "design"}}, "expect": {"/result/features": {"eq": 4}, "/result/bodies": {"eq": 2}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_set", "args": {"body": 1, "name": "Lid"}}},
|
|
{"tool": "tool_call", "args": {"tool": "body_set", "args": {"body": 1, "color": "#3080ff"}},
|
|
"expect": {"/color": {"eq": "#3080FF"}}},
|
|
{"tool": "project_save", "args": {"path": "${out_dir}/design.3mf", "overwrite": true}},
|
|
{"tool": "project_new", "args": {"discard_changes": true}},
|
|
// Presets an earlier session modified make loading a project ask about them; the rule ends with the replay.
|
|
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Load project: unsaved changes", "button": "Discard"}]}},
|
|
{"tool": "project_open", "args": {"path": "${out_dir}/design.3mf"}},
|
|
{"tool": "tool_call", "args": {"tool": "design_describe"},
|
|
"expect": {"/features/3": {"exists": true}, "/features/4": {"exists": false}, "/bodies/1/name": {"eq": "Lid"},
|
|
"/bodies/1/has_color": {"eq": true}, "/bodies/1/color": {"eq": "#3080FF"}}}
|
|
]
|
|
}
|