From 0604f25fd978182cc3e33517aedabf161d85d7c8 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sun, 15 Nov 2026 15:32:53 +0800 Subject: [PATCH] Make the MCP tool descriptions say what the tools do, and rename four misleading names --- docs/HLSD/mcp-server.md | 8 +- scripts/CAD/tool_atlas.json | 10 +- src/slic3r/GUI/CAD/DesignOffer.hpp | 59 +++--- src/slic3r/GUI/Mcp/McpServerInfo.cpp | 2 +- src/slic3r/GUI/Mcp/McpToolsActions.cpp | 3 +- src/slic3r/GUI/Mcp/McpToolsApp.cpp | 3 +- src/slic3r/GUI/Mcp/McpToolsCad.cpp | 31 ++-- src/slic3r/GUI/Mcp/McpToolsCad.hpp | 12 +- src/slic3r/GUI/Mcp/McpToolsConfig.cpp | 59 +++--- src/slic3r/GUI/Mcp/McpToolsLayers.cpp | 5 +- src/slic3r/GUI/Mcp/McpToolsProject.cpp | 51 ++++-- src/slic3r/GUI/Mcp/McpToolsPython.cpp | 14 +- src/slic3r/GUI/Mcp/McpToolsRecord.cpp | 18 +- src/slic3r/GUI/Mcp/McpToolsReplay.cpp | 17 +- src/slic3r/GUI/Mcp/McpToolsScene.cpp | 31 ++-- src/slic3r/GUI/Mcp/McpToolsUi.cpp | 63 ++++--- src/slic3r/GUI/Mcp/McpToolsView.cpp | 4 +- src/slic3r/GUI/Mcp/RecordingSettings.cpp | 4 +- src/slic3r/GUI/NativeCommands.cpp | 51 ++++-- src/slic3r/GUI/RecordingDialog.cpp | 2 +- tests/data/command_catalog.json | 201 +++++++++++---------- tests/slic3rutils/test_action_source.cpp | 2 +- tests/slic3rutils/test_command_catalog.cpp | 2 +- tests/slic3rutils/test_mcp_cad.cpp | 45 +++++ tests/slic3rutils/test_mcp_recording.cpp | 6 +- tests/slic3rutils/test_mcp_scene.cpp | 19 +- tools/mcp/test_action_replay_hidden.py | 4 +- tools/mcp/test_worker_admission.py | 2 +- tools/mcp/tests/calibration.json | 2 +- tools/mcp/tests/plates.json | 6 +- tools/mcp/tests/scene.json | 8 +- 31 files changed, 454 insertions(+), 290 deletions(-) diff --git a/docs/HLSD/mcp-server.md b/docs/HLSD/mcp-server.md index b332c6172d..3558b7927f 100644 --- a/docs/HLSD/mcp-server.md +++ b/docs/HLSD/mcp-server.md @@ -851,13 +851,13 @@ camera looks. `arrange` runs what the GUI runs: with `plates: "all"`, `set_prepare_state(PREPARE_STATE_DEFAULT)` and `Plater::arrange()`, as the toolbar does; with a plate index or `"current"`, `select_plate()`, `PREPARE_STATE_MENU` and `arrange()`, as the plate's Arrange icon does, without its -`last_arrange_job_is_finished()` flag, which a cancelled job never clears; with `fill`, the object's +`last_arrange_job_is_finished()` flag, which a cancelled job never clears; with `fill_object`, the object's row selected and `fill_bed_with_instances()` or `fill_bed_with_copies()`, which fill the object's own plate. Each takes one "Arrange" undo snapshot. An arrangement shows the Prepare view first and runs with a gizmo open, as the toolbar's does (`Ops::start_arrange()`, which the `obj_arrange` command calls too), and is refused while another job runs. Fill bed selects the object's row, so it refuses the assemble view and an open gizmo as the tools that select do. The tool also refuses a locked or -empty plate given by index, `fill` with `plates`, and an object Fill bed refuses +empty plate given by index, `fill_object` with `plates`, and an object Fill bed refuses (`can_increase_instances()`). `spacing`, `rotate`, `align_y` and `multi_material` go into the current print mode's `GLCanvas3D::ArrangeSettings`, which both jobs read, by the panel's rules (`apply_arrange_args()`: @@ -1949,7 +1949,7 @@ name without one. buttons show, for printers that take several filaments through one extruder, and not on a G-code file; elsewhere, and at the slot limit or with one slot left, they return Info. A new slot goes after the physical slots, so mixed filaments move up by one with the objects on them; the message names the new -slot. `filament_delete` takes a 1-based `slot`, the last physical one without it, and remaps the objects on +slot. `filament_delete` takes a 1-based `filament_slot`, the last physical one without it, and remaps the objects on it as the GUI does. A mixed filament is refused (an Error): it is deleted from the mixed filament list. `import_configs` with a path imports presets as the Import Configs dialog does, through @@ -3732,7 +3732,7 @@ matrix arrays need and which the bundled Python lacks unless a file run's PEP 72 ### Run Script panel File › Run Script (the Global shortcut Ctrl+Shift+T, ⌘⇧T on macOS) and the Speed Dial command -`toggle_run_script` show or hide the Run Script panel (`RunScriptPanel`, page `resources/web/dialog/RunScript/`), +`toggle_run_script_panel` show or hide the Run Script panel (`RunScriptPanel`, page `resources/web/dialog/RunScript/`), a dock pane of the Plater under the 3D view and the sidebar, where a person edits a `.py` file in `# %%` cells and runs a cell, the whole file or a console line in a live session. Showing it selects Prepare when the current tab is neither Prepare nor Preview; the menu item's check mark is whether it is on screen. diff --git a/scripts/CAD/tool_atlas.json b/scripts/CAD/tool_atlas.json index f247a534a0..e0f5ba893d 100644 --- a/scripts/CAD/tool_atlas.json +++ b/scripts/CAD/tool_atlas.json @@ -1519,7 +1519,7 @@ "access": "change", "ok_false": true, "summary": "Move and/or rotate a body (B-rep transform).", - "details": "copy=true keeps the source and appends the transformed copy as a new body.", + "details": "copy=true keeps the source and appends the transformed copy as a new body. The rotation is angle about the axis (axis_x, axis_y, axis_z) through the pivot, a world point that defaults to the world origin.", "params": [ {"name": "body", "type": "integer", "default": -1, "description": "target body; omit for the last body"}, {"name": "dx", "type": "number", "unit": "mm", "default": 0}, @@ -3364,8 +3364,8 @@ "details": "Returns ordered world contours, each flagged closed/open.", "params": [ {"name": "body", "type": "integer", "default": 0}, - {"name": "plane", "type": "string", "default": "XY", "enum": ["XY", "XZ", "YZ"]}, - {"name": "offset", "type": "number", "unit": "mm", "default": 0} + {"name": "plane", "type": "string", "default": "XY", "enum": ["XY", "XZ", "YZ"], "description": "the base plane through the world origin, not through modeling_origin as the other commands' planes are"}, + {"name": "offset", "type": "number", "unit": "mm", "default": 0, "description": "along the plane's normal, from the world origin"} ], "examples": [ { @@ -4282,9 +4282,9 @@ "gui": false, "tool": { "access": "sketch", - "ok_false": true, + "ok_false": false, "summary": "Toggle construction on sketch entities.", - "details": "Reply: changed.", + "details": "Reply: changed, how many, and ok, false when none did.", "params": [ {"name": "entities", "type": "array", "default": [], "description": "entity indices; omit for the selection"} ], diff --git a/src/slic3r/GUI/CAD/DesignOffer.hpp b/src/slic3r/GUI/CAD/DesignOffer.hpp index dc8ac4da15..01202a5bcb 100644 --- a/src/slic3r/GUI/CAD/DesignOffer.hpp +++ b/src/slic3r/GUI/CAD/DesignOffer.hpp @@ -540,18 +540,19 @@ static const DesignTool kDesignTools[] = { "\":false}"}, {"body_transform", L_CONTEXT("Move", "Design"), 5, "Shift+Y", "key:S+Y", L("Transform needs a body — add or import one first"), 0x000021feu, 1, 0, false, false, nullptr, "design_move", L("Move and/or rotate an existing body"), false, CadAccess::Change, true, "{\"summary\":\"Move and/or rotate a body (B-rep transform).\",\"details\":\"copy=true keeps the source " - "and appends the transformed copy as a new body.\",\"params\":[{\"name\":\"body\",\"type\":\"integer\",\"defa" - "ult\":-1,\"description\":\"target body; omit for the last body\"},{\"name\":\"dx\",\"type\":\"number\",\"unit\"" - ":\"mm\",\"default\":0},{\"name\":\"dy\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0},{\"name\":\"dz\",\"type\":\"nu" - "mber\",\"unit\":\"mm\",\"default\":0},{\"name\":\"axis_x\",\"type\":\"number\",\"default\":0},{\"name\":\"axis_y\",\"t" - "ype\":\"number\",\"default\":0},{\"name\":\"axis_z\",\"type\":\"number\",\"default\":1},{\"name\":\"pivot_x\",\"type" - "\":\"number\",\"unit\":\"mm\",\"default\":0},{\"name\":\"pivot_y\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0},{" - "\"name\":\"pivot_z\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0},{\"name\":\"angle\",\"type\":\"number\",\"unit\"" - ":\"deg\",\"default\":0},{\"name\":\"copy\",\"type\":\"boolean\",\"default\":false}],\"examples\":[{\"title\":\"A pl" - "ate moved 30 mm along X\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width\":20}" - "},{\"tool\":\"body_transform\",\"args\":{\"dx\":30}}]},{\"title\":\"A copy of a plate 10 mm above it\",\"call" - "s\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width\":20}},{\"tool\":\"body_transform\",\"ar" - "gs\":{\"copy\":true,\"dz\":10}}]}],\"ids\":false}"}, + "and appends the transformed copy as a new body. The rotation is angle about the axis (axis_x, ax" + "is_y, axis_z) through the pivot, a world point that defaults to the world origin.\",\"params\":[{\"n" + "ame\":\"body\",\"type\":\"integer\",\"default\":-1,\"description\":\"target body; omit for the last body\"},{" + "\"name\":\"dx\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0},{\"name\":\"dy\",\"type\":\"number\",\"unit\":\"mm\",\"d" + "efault\":0},{\"name\":\"dz\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0},{\"name\":\"axis_x\",\"type\":\"number" + "\",\"default\":0},{\"name\":\"axis_y\",\"type\":\"number\",\"default\":0},{\"name\":\"axis_z\",\"type\":\"number\",\"d" + "efault\":1},{\"name\":\"pivot_x\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0},{\"name\":\"pivot_y\",\"type\":\"" + "number\",\"unit\":\"mm\",\"default\":0},{\"name\":\"pivot_z\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0},{\"na" + "me\":\"angle\",\"type\":\"number\",\"unit\":\"deg\",\"default\":0},{\"name\":\"copy\",\"type\":\"boolean\",\"default\":" + "false}],\"examples\":[{\"title\":\"A plate moved 30 mm along X\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"d" + "istance\":5,\"height\":20,\"width\":20}},{\"tool\":\"body_transform\",\"args\":{\"dx\":30}}]},{\"title\":\"A cop" + "y of a plate 10 mm above it\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width\"" + ":20}},{\"tool\":\"body_transform\",\"args\":{\"copy\":true,\"dz\":10}}]}],\"ids\":false}"}, {"mate", L_CONTEXT("Mate", "Design"), 5, nullptr, "fly:placement#2", L("Mate needs two coordinate systems — create them first"), 0x00001202u, 2, 0, false, false, nullptr, "design_c_coincident", L("Assembly: align two coordinate systems (fastened, planar, revolute, slider, cylindrical)"), false, CadAccess::Change, true, "{\"summary\":\"Mate two bodies: transform the moving body (cs_b) so its connector lands on the fixe" "d one (cs_a).\",\"details\":\"kind: 0=Fastened, 1=Planar, 2=Revolute, 3=Slider, 4=Cylindrical.\",\"par" @@ -890,15 +891,16 @@ static const DesignTool kDesignTools[] = { {"slice_body", L_CONTEXT("Slice body", "Design"), -1, nullptr, nullptr, nullptr, 0x00000000u, 0, 0, false, false, nullptr, nullptr, nullptr, false, CadAccess::Read, false, "{\"summary\":\"Cross-section of a body by a base plane at an offset (sections-as-evidence).\",\"detai" "ls\":\"Returns ordered world contours, each flagged closed/open.\",\"params\":[{\"name\":\"body\",\"type\":" - "\"integer\",\"default\":0},{\"name\":\"plane\",\"type\":\"string\",\"default\":\"XY\",\"enum\":[\"XY\",\"XZ\",\"YZ\"]},{" - "\"name\":\"offset\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0}],\"examples\":[{\"title\":\"A plate's cross-" - "section halfway up\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width\":20}},{\"t" - "ool\":\"slice_body\",\"args\":{\"body\":0,\"offset\":2.5,\"plane\":\"XY\"}}]},{\"title\":\"The two contours thro" - "ugh a plate with a bore\",\"calls\":[{\"tool\":\"sketch_begin\",\"args\":{\"plane\":\"XY\"}},{\"tool\":\"sketch_" - "add\",\"args\":{\"rect\":[-15,-10,15,10]}},{\"tool\":\"sketch_add\",\"args\":{\"entities\":[{\"center\":[0,0],\"" - "radius\":4,\"type\":\"circle\"}]}},{\"tool\":\"sketch_commit\",\"args\":{}},{\"tool\":\"extrude\",\"args\":{\"dist" - "ance\":5,\"sketch\":0}},{\"tool\":\"slice_body\",\"args\":{\"body\":0,\"offset\":2.5,\"plane\":\"XY\"}}]}],\"ids\":" - "true}"}, + "\"integer\",\"default\":0},{\"name\":\"plane\",\"type\":\"string\",\"default\":\"XY\",\"enum\":[\"XY\",\"XZ\",\"YZ\"],\"d" + "escription\":\"the base plane through the world origin, not through modeling_origin as the other c" + "ommands' planes are\"},{\"name\":\"offset\",\"type\":\"number\",\"unit\":\"mm\",\"default\":0,\"description\":\"al" + "ong the plane's normal, from the world origin\"}],\"examples\":[{\"title\":\"A plate's cross-section h" + "alfway up\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width\":20}},{\"tool\":\"sli" + "ce_body\",\"args\":{\"body\":0,\"offset\":2.5,\"plane\":\"XY\"}}]},{\"title\":\"The two contours through a pla" + "te with a bore\",\"calls\":[{\"tool\":\"sketch_begin\",\"args\":{\"plane\":\"XY\"}},{\"tool\":\"sketch_add\",\"arg" + "s\":{\"rect\":[-15,-10,15,10]}},{\"tool\":\"sketch_add\",\"args\":{\"entities\":[{\"center\":[0,0],\"radius\":4" + ",\"type\":\"circle\"}]}},{\"tool\":\"sketch_commit\",\"args\":{}},{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"" + "sketch\":0}},{\"tool\":\"slice_body\",\"args\":{\"body\":0,\"offset\":2.5,\"plane\":\"XY\"}}]}],\"ids\":true}"}, {"validate_against", L_CONTEXT("Validate against", "Design"), -1, nullptr, nullptr, nullptr, 0x00000000u, 0, 0, false, false, nullptr, nullptr, nullptr, false, CadAccess::Read, false, "{\"summary\":\"Compare a body with a reference: volume, bbox, centroid and surface deviation (the R" "E acceptance metric).\",\"details\":\"The reference is {step:path|body:id}; the surface deviation is" @@ -1199,13 +1201,14 @@ static const DesignTool kDesignTools[] = { "entities\":[2]}}]},{\"title\":\"Delete the selected sides\",\"calls\":[{\"tool\":\"sketch_begin\",\"args\":{\"" "plane\":\"XY\"}},{\"tool\":\"sketch_add\",\"args\":{\"rect\":[-15,-10,15,10]}},{\"tool\":\"sketch_select\",\"arg" "s\":{\"entities\":[1,3]}},{\"tool\":\"sketch_delete\",\"args\":{}}]}],\"ids\":false}"}, - {"sketch_construction", L_CONTEXT("Sketch construction", "Design"), -1, nullptr, nullptr, nullptr, 0x00000000u, 0, 0, false, false, nullptr, nullptr, nullptr, false, CadAccess::Sketch, true, - "{\"summary\":\"Toggle construction on sketch entities.\",\"details\":\"Reply: changed.\",\"params\":[{\"nam" - "e\":\"entities\",\"type\":\"array\",\"default\":[],\"description\":\"entity indices; omit for the selection\"" - "}],\"examples\":[{\"title\":\"A centre line across a rectangle, made construction so it splits no loo" - "p\",\"calls\":[{\"tool\":\"sketch_begin\",\"args\":{\"plane\":\"XY\"}},{\"tool\":\"sketch_add\",\"args\":{\"rect\":[-" - "15,-10,15,10]}},{\"tool\":\"sketch_add\",\"args\":{\"entities\":[{\"p0\":[0,-10],\"p1\":[0,10],\"type\":\"line\"" - "}]}},{\"tool\":\"sketch_construction\",\"args\":{\"entities\":[4]}}]}],\"ids\":false}"}, + {"sketch_construction", L_CONTEXT("Sketch construction", "Design"), -1, nullptr, nullptr, nullptr, 0x00000000u, 0, 0, false, false, nullptr, nullptr, nullptr, false, CadAccess::Sketch, false, + "{\"summary\":\"Toggle construction on sketch entities.\",\"details\":\"Reply: changed, how many, and ok" + ", false when none did.\",\"params\":[{\"name\":\"entities\",\"type\":\"array\",\"default\":[],\"description\":\"" + "entity indices; omit for the selection\"}],\"examples\":[{\"title\":\"A centre line across a rectangle" + ", made construction so it splits no loop\",\"calls\":[{\"tool\":\"sketch_begin\",\"args\":{\"plane\":\"XY\"}}" + ",{\"tool\":\"sketch_add\",\"args\":{\"rect\":[-15,-10,15,10]}},{\"tool\":\"sketch_add\",\"args\":{\"entities\":[" + "{\"p0\":[0,-10],\"p1\":[0,10],\"type\":\"line\"}]}},{\"tool\":\"sketch_construction\",\"args\":{\"entities\":[4]" + "}}]}],\"ids\":false}"}, {"sketch_offset", L_CONTEXT("Sketch offset", "Design"), -1, nullptr, nullptr, nullptr, 0x00000000u, 0, 0, false, false, nullptr, nullptr, nullptr, false, CadAccess::Sketch, false, "{\"summary\":\"Add an offset copy of sketch lines, arcs and circles.\",\"details\":\"Reply: first_index" ", added, dof.\",\"params\":[{\"name\":\"distance\",\"type\":\"number\",\"unit\":\"mm\",\"description\":\"signed of" diff --git a/src/slic3r/GUI/Mcp/McpServerInfo.cpp b/src/slic3r/GUI/Mcp/McpServerInfo.cpp index 9941bb5282..3087055a43 100644 --- a/src/slic3r/GUI/Mcp/McpServerInfo.cpp +++ b/src/slic3r/GUI/Mcp/McpServerInfo.cpp @@ -45,7 +45,7 @@ const char* kInstructions = "Driving the GUI itself, for what those do not reach or to see what a person sees:\n" "- run_action runs every Speed Dial command (search_actions finds them): prefer it to GUI clicks.\n" "- list_widgets lists widgets, menus, 3D toolbar items, gizmos, ImGui items and web page elements with refs; click " - "/ set_widget_value / press_keys / mouse_gesture act on refs from the latest list_widgets call, or on locators, which " + "/ set_widget_value / press_keys / mouse_gesture act on its refs, good across later listings, or on locators, which " "its description lists.\n" "- list_windows lists the open windows, modal or not, with refs: a window's ref as screenshot's target captures " "that window, as list_widgets's target lists it alone, and as set_window's target sizes, moves or raises it.\n" diff --git a/src/slic3r/GUI/Mcp/McpToolsActions.cpp b/src/slic3r/GUI/Mcp/McpToolsActions.cpp index d6bafe6fd6..97a3d63159 100644 --- a/src/slic3r/GUI/Mcp/McpToolsActions.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsActions.cpp @@ -198,7 +198,8 @@ void register_action_tools(CommandCatalog& catalog) "auto_answer_dialogs before the call. An export_gcode with a path completes when the file is written; an action " "that starts a background job (obj_arrange, obj_orient) when the job ends. An action that does nothing (no object " "selected) is an error. Some commands add what they did to the reply (the obj_order_by_* order, the object " - "obj_assemble made).", + "obj_assemble made). A command's action runs that command, as call_tool {tool: its name} does; the other actions " + "(plates, recent projects, plugin scripts and pages, settings) run only here.", object_schema({{"id", prop("string", "Action id from search_actions, or the name inside it.")}, {"args", {{"type", "object"}, {"description", "The command's arguments, as its input_schema gives them."}}}}, {"id"}), diff --git a/src/slic3r/GUI/Mcp/McpToolsApp.cpp b/src/slic3r/GUI/Mcp/McpToolsApp.cpp index c81e8a1236..724c60e9d6 100644 --- a/src/slic3r/GUI/Mcp/McpToolsApp.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsApp.cpp @@ -284,7 +284,8 @@ void register_app_tools(CommandCatalog& catalog) "Block until a condition holds or timeout_s passes (max 50). for: \"ready\" (startup finished), \"idle\" (no dialog, " "no running job, nothing slicing or arranging, no gizmo working in the background; a run_script run counts only " "through the calls it makes), \"dialog\" / \"no_dialog\", or \"job\" with a job id an earlier call returned, whose " - "result is then the reply. On timeout the reply is {satisfied: false}: call it again.", + "result is then the reply. On timeout the reply is {satisfied: false}, or for a job {status: \"running\", job, " + "note}: call it again.", object_schema({{"for", enum_prop({"ready", "idle", "dialog", "no_dialog", "job"}, "What to wait for; default job when job " "is given, else idle.")}, {"job", prop("string", "Job id, for \"job\".")}, diff --git a/src/slic3r/GUI/Mcp/McpToolsCad.cpp b/src/slic3r/GUI/Mcp/McpToolsCad.cpp index 3d937aec71..4c954f20a6 100644 --- a/src/slic3r/GUI/Mcp/McpToolsCad.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsCad.cpp @@ -1661,20 +1661,10 @@ json action_set_feature(DesignPanel* panel, const json& params) {"generation", doc.topo_generation}, {"error", doc.error}}; } -// Which entities a verb acts on: an explicit "entities" array, else the current selection, -// else — only where the verb says so — everything. Same precedence the menu uses: what you -// pointed at wins, and the menu never silently acts on the whole sketch. +// Which entities a verb acts on in the open sketch (sketch_target_indices()). std::vector sketch_targets(const json& params, DesignSketchTool& t, bool all_if_empty) { - std::vector out; - if (params.contains("entities")) { - for (const auto& v : params.at("entities")) out.push_back(v.get()); - return out; - } - out = t.selection(); - if (out.empty() && all_if_empty) - for (int i = 0; i < int(t.entities().size()); ++i) out.push_back(i); - return out; + return sketch_target_indices(params, t.selection(), int(t.entities().size()), all_if_empty); } // The open sketch's degrees of freedom, as a reply's dof. The sketch tool keeps -1 while it has no @@ -3563,6 +3553,8 @@ NativeCommand design_command(const DesignTool& t) description += ' ' + details; if (t.ok_false) description += std::string(" ") + kFailureNote; c.read_only = t.access == CadAccess::Read; + // A read answers the same however often it is asked, as the listed read-only tools say of themselves. + c.idempotent = c.read_only; c.description = std::move(description); c.examples = doc.at("examples"); return c; @@ -3777,6 +3769,21 @@ void leave_out_cad_commands(CommandCatalog& catalog) catalog.leave_out(t.id, kCadOffAtStartup); } +std::vector sketch_target_indices(const json& params, const std::vector& selection, int entity_count, bool all_if_empty) +{ + std::vector out; + // An empty list names nothing, so it reads as left out, as the schema's default [] says and as + // entity_picks() reads it. Anything else that is given names what it holds. + if (const auto given = params.find("entities"); given != params.end() && !(given->is_array() && given->empty())) { + for (const auto& v : *given) out.push_back(v.get()); + return out; + } + out = selection; + if (out.empty() && all_if_empty) + for (int i = 0; i < entity_count; ++i) out.push_back(i); + return out; +} + std::string design_command_index() { std::string from_arguments, menu_row; diff --git a/src/slic3r/GUI/Mcp/McpToolsCad.hpp b/src/slic3r/GUI/Mcp/McpToolsCad.hpp index 02e532e938..135072ddba 100644 --- a/src/slic3r/GUI/Mcp/McpToolsCad.hpp +++ b/src/slic3r/GUI/Mcp/McpToolsCad.hpp @@ -78,10 +78,18 @@ void leave_out_cad_commands(CommandCatalog& catalog); // What search_tools' description says of the Design commands, which tools/list does not show, so that an agent // learns without a search that they exist and are CAD: what they cover, that one is looked up before it is // called, and every key in the table's order, in two lists by what a call does: the entries with a tool block, -// which run from their arguments, then those with an action only, which take none and do what their menu row -// does. It starts with a space, to follow the description's last sentence. +// which run from their arguments (one with an action too runs its menu row when a call gives none, which the +// first list's lead says), then those with an action only, which take none and do what their menu row does. It +// starts with a space, to follow the description's last sentence. std::string design_command_index(); +// The entities a sketch command acts on: those `params` lists in "entities", else `selection`, else, where the +// command says so (`all_if_empty`), every one of the sketch's `entity_count`: what was pointed at wins, as in +// the menu, which never acts on the whole sketch unasked. Only an empty list, the schema's default, reads as left +// out: anything else that is given names what it holds, a null nothing. +std::vector sketch_target_indices(const nlohmann::json& params, const std::vector& selection, int entity_count, + bool all_if_empty); + // The input schema of a tool block: an object whose properties are the block's params, a type written "a|b" // as the list of both, min, exclusive_min and max as minimum, exclusiveMinimum and maximum, enum and default // as written, and the unit joined to the description; a param with no default is required. `generation`, the diff --git a/src/slic3r/GUI/Mcp/McpToolsConfig.cpp b/src/slic3r/GUI/Mcp/McpToolsConfig.cpp index 6c1b949a3d..aaa1363479 100644 --- a/src/slic3r/GUI/Mcp/McpToolsConfig.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsConfig.cpp @@ -1835,11 +1835,12 @@ void register_config_tools(CommandCatalog& catalog) catalog.add(inspect_tool( "api", "list_presets", L("List presets"), - "Printer, process or filament presets with flags: system or user, selected (and modified), compatible with the " - "selected printer, and for filaments the slots using them. Only compatible, visible presets unless asked: a fresh " - "install hides most system filaments and printers (visible: false), and select_preset takes those too.", + "Printer, process or filament presets, each with its name, alias (the name its selector shows, when another), " + "system, user, project (kept inside the project), inherits, selected (and modified), compatible: false or " + "visible: false when so, and for a filament the slots using it (filament_slots). Only compatible, visible presets " + "unless asked: a fresh install hides most system filaments and printers, and select_preset takes a hidden one too.", object_schema({{"type", enum_prop({"printer", "process", "filament"}, "Preset category.")}, - {"query", prop("string", "Case-insensitive part of the name.")}, + {"query", prop("string", "Case-insensitive part of the name or alias.")}, {"include_incompatible", prop("boolean", "Also list presets incompatible with the printer.")}, {"include_hidden", prop("boolean", "Also list hidden presets.")}, {"limit", {{"type", "integer"}, {"minimum", 1}, {"maximum", 500}, {"description", "Default 100."}}}, @@ -1850,9 +1851,11 @@ void register_config_tools(CommandCatalog& catalog) catalog.add(reaching({"resolve_preset", "select_preset", "assign_filament_preset"}, mutate_tool( "api", "select_preset", L("Select a preset"), "Select a printer, process or filament preset by the name its selector shows (or its internal name), as a person " - "would. A hidden one (list_presets include_hidden) is shown in the selectors first, until the app restarts. With " - "unsaved changes the Transfer-or-discard prompt opens (blocked_by_dialog) unless preset_changes answers it. A " - "filament is assigned to filament_slot (1-based, default 1). Reply: selected, shown (a hidden preset it showed); " + "would. A hidden one (list_presets include_hidden) is shown in the selectors first, until the app restarts; one " + "the selector leaves out as incompatible with the printer is refused. With unsaved changes the Transfer-or-discard prompt opens " + "(blocked_by_dialog) unless preset_changes answers it. A filament is assigned to filament_slot (1-based, default " + "1); with several slots the filament tab keeps the preset and the changes it has, so nothing is asked. Reply: " + "selected, shown (a hidden preset it showed); " "when presets had or have unsaved changes, discarded and modified list per preset the keys dropped and the keys " "still unsaved.", object_schema({{"type", enum_prop({"printer", "process", "filament"}, "Preset category.")}, @@ -1860,7 +1863,9 @@ void register_config_tools(CommandCatalog& catalog) {"filament_slot", {{"type", "integer"}, {"minimum", 1}, {"description", "Filament slot, 1-based."}}}, {"preset_changes", enum_prop({"transfer", "discard"}, "Unsaved changes of the presets the switch replaces: move " "them to the new preset or drop them, as the prompt's " - "buttons do. Omitted: the prompt opens.")}}, + "buttons do; transfer is refused where the prompt does " + "not offer it (a printer's changes, a filament of " + "another type). Omitted: the prompt opens.")}}, {"type", "name"}), [](const json& args, ToolContext& ctx) { const Preset::Type type = preset_type(arg_string(args, "type")); @@ -1913,14 +1918,15 @@ void register_config_tools(CommandCatalog& catalog) "Save the printer, process or filament preset being edited, with its unsaved changes, as a preset called name, " "which is then selected: what the tab's Save button does through its dialog. A filament is filament_slot's " "(default 1), and every slot using the old preset takes the new one. Replacing another existing preset needs " - "overwrite (pass it in replays and scripts meant to be rerun). Reply: saved, user, project, inherits, filament_slots. A " + "overwrite (pass it in replays and scripts meant to be rerun). Reply: saved, selected, user, project, inherits, " + "filament_slots. A " "temperature warning or an unsaved-changes prompt makes it blocked_by_dialog. To keep only some edits, set_settings " "{reset_all: true, values} first.", object_schema({{"type", enum_prop({"printer", "process", "filament"}, "Preset category.")}, {"name", prop("string", "Name to save under.")}, {"filament_slot", {{"type", "integer"}, {"minimum", 1}, {"description", "Filament slot, 1-based."}}}, {"inside_project", prop("boolean", "Keep it inside the project, not as a user preset. Default: where the " - "edited preset is.")}, + "edited preset is. A preset of that name stays where it is.")}, {"detach", prop("boolean", "Copy inherited values and drop the parent (Developer mode).")}, {"overwrite", prop("boolean", "Replace another preset of that name.")}}, {"type", "name"}), @@ -1973,14 +1979,16 @@ void register_config_tools(CommandCatalog& catalog) "Delete a user preset or one inside the project, its file and its cloud copy, as the tab's Delete does, without " "asking. A selected preset is replaced as the tab does (its parent or the next preset). Another filament is deleted " "without changing the selection, and slots using it take the selected one; another process is selected, deleted " - "and the selection restored; a printer must be selected first. Refused: system presets, presets others inherit from, " - "another preset while the edited one of its type has unsaved changes. Deleting a selected printer or process can " + "and the selection restored; a printer must be selected first, and the physical printers that use only it are " + "deleted with it. Refused: system, default and bundle presets, presets others inherit from, another preset while " + "the edited one of its type has unsaved changes. Deleting a selected printer or process can " "ask about other presets' unsaved changes (blocked_by_dialog). Reply: deleted, selected, filaments (per slot), " "attached, and discarded/modified as select_preset's.", object_schema({{"type", enum_prop({"printer", "process", "filament"}, "Preset category.")}, {"name", prop("string", "Preset name as list_presets shows it.")}, - {"delete_attached", prop("boolean", "A custom printer: also delete the process and filament presets made " - "for it alone, which the GUI deletes with it.")}}, + {"delete_attached", prop("boolean", "A custom printer with process or filament presets made for it alone is " + "refused without this: they are deleted with it, as the GUI " + "deletes them.")}}, {"type", "name"}), [](const json& args, ToolContext& ctx) { const std::string type_name = arg_string(args, "type"); @@ -2048,7 +2056,8 @@ void register_config_tools(CommandCatalog& catalog) "Read settings: each item has its value, as OrcaSlicer writes it, and meta: label, description (what the setting " "does, when to change it), where (its settings page and group), type, unit, range, allowed values and mode. Choose " "them by keys; by query, a few words matched in keys, labels and descriptions, best matches first; by where, a page " - "or group (an unknown one lists them all); or by none of these, for the whole scope, paged and, in a preset scope, " + "or \"Page > Group\" (an unknown one is refused with the list of them); or by none of these, for the whole scope, " + "paged and, in a preset scope, " "without meta. Keys the scope lacks are listed in unknown_keys, and scope_of gives the scope of those another " "scope has.\n" "- No scope: keys and query look through the process, filament and printer settings, and each item names its " @@ -2056,7 +2065,8 @@ void register_config_tools(CommandCatalog& catalog) "- process, filament, printer: the preset being edited, or with preset a saved one; compare lists only " "the keys that differ from another preset (value and other). A per-variant value lists in meta its variants (what " "each entry is for) and active (the entry each extruder prints with).\n" - "- object, part: the overrides that object or part carries, each with effective (the value it prints with) and " + "- object, part: listed whole, the overrides that object or part carries; keys, query and where read any process " + "setting there. Each has effective (the value it prints with) and " "source (part, object, process or default); an object's item lists in parts the parts and modifiers that override " "the key inside their own volume.\n" "- project: the plate type, slot colours, flushing volumes, purge mode, prime tower position per plate, mixed slots " @@ -2075,7 +2085,9 @@ void register_config_tools(CommandCatalog& catalog) {"object", {{"type", "integer"}, {"minimum", 0}, {"description", "Object index (object/part scope)."}}}, {"part", {{"type", "integer"}, {"minimum", 0}, {"description", "Part index (part scope)."}}}, {"plate", plate_prop}, - {"filament_slot", {{"type", "integer"}, {"minimum", 1}, {"description", "Filament slot, 1-based."}}}, + {"filament_slot", {{"type", "integer"}, {"minimum", 1}, + {"description", "Filament scope: the slot whose preset is read, 1-based (default 1), with " + "its unsaved changes when the filament tab is editing it."}}}, {"preset", prop("string", "Preset scopes: read this saved preset (a name from list_presets) instead of the " "one being edited.")}, {"compare", prop("string", "Preset scopes: a preset name, \":saved\" (the unsaved changes) or \":parent\" " @@ -2097,8 +2109,8 @@ void register_config_tools(CommandCatalog& catalog) "in OrcaSlicer's format (\"15%\", \"0.2\", \"1,2\") or JSON numbers, booleans and arrays (a point as [x, y]). All are " "parsed strictly first and applied together, so nothing changes if one is invalid, and a key of another scope is " "refused with that scope named. Reply: applied, and changed, every setting the call changed, including those the " - "app adjusted in turn. One undo step. Spiral vase and a few others confirm their adjustments in a dialog " - "(blocked_by_dialog).\n" + "app adjusted in turn. An object's, part's or plate's change is one undo step; a preset's is not in the undo " + "history. Spiral vase and a few others confirm their adjustments in a dialog (blocked_by_dialog).\n" "- process, filament, printer: null takes a key back to its saved value, or with reset_to parent to the " "parent's; reset_all first discards every unsaved change, as the tab's undo button does (reply: reverted). A " "per-variant value (get_settings meta.variants) takes one value for the entries in use (meta.active), {index, " @@ -2108,8 +2120,8 @@ void register_config_tools(CommandCatalog& catalog) "- project, as the sidebar's controls write them: curr_bed_type, filament_colour (#RRGGBB per slot), " "flush_multiplier, flush_volumes_matrix, prime_volume_mode, and wipe_tower_x/y (mm from the plate's origin, one per " "plate). flush_volumes_matrix is per nozzle, slots x slots from row to column, in config order over every slot, " - "before the multiplier; mixed slots' entries are left as they are, and a colour change can recalculate it, so set " - "it last.\n" + "before the multiplier; a mixed slot's entries must be given as they are, and a colour change can recalculate it, " + "so set it last.\n" "- plate, which it selects and writes as the Plate Settings dialog's OK does: curr_bed_type, print_sequence (\"by " "layer\", \"by object\"), spiral_mode (true asks for confirmation), first_layer_print_sequence (every slot once, " "e.g. [2, 1]), other_layers_print_sequence ([{from: layer >= 2, to, order}], to omitted for the last layer), name " @@ -2124,7 +2136,10 @@ void register_config_tools(CommandCatalog& catalog) {"object_id", expected_id_prop("object")}, {"part_id", expected_id_prop("part")}, {"plate", plate_prop}, - {"filament_slot", {{"type", "integer"}, {"minimum", 1}, {"description", "Filament slot, 1-based."}}}}), + {"filament_slot", {{"type", "integer"}, {"minimum", 1}, + {"description", "Filament scope: the slot whose preset is changed, 1-based (default 1). " + "The filament tab switches to it, which can ask about the unsaved " + "changes it holds (blocked_by_dialog)."}}}}), [](const json& args, ToolContext& ctx) { // A preference's control carries its effects (theme, language, network, this server's own port), which // writing the key would skip. diff --git a/src/slic3r/GUI/Mcp/McpToolsLayers.cpp b/src/slic3r/GUI/Mcp/McpToolsLayers.cpp index 325668958b..f2090376ab 100644 --- a/src/slic3r/GUI/Mcp/McpToolsLayers.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsLayers.cpp @@ -642,8 +642,9 @@ void register_layer_tools(CommandCatalog& catalog) "Add or remove pauses, custom G-code, custom templates and filament changes at the start of a layer, as the Preview " "layer slider's menu does; they are saved per plate in the project. They go on the plate's sliced layers, so the " "plate needs an up-to-date slice, or must be the one the Preview still shows after an earlier edit; the call selects " - "it and shows the Preview. Applies clear, then remove, then add, all checked first. One code per layer: a custom " - "code or filament change where there is one replaces it. Not undoable, as in the slider. A change invalidates the " + "it and shows the Preview. Applies clear, then remove, then add, all checked first. One code per layer: adding " + "where a code of the same type is replaces it, and where another type is, is refused (remove it first). Not " + "undoable, as in the slider. A change invalidates the " "plate's slice: slice again before exporting. Reply: the plate's codes as list_plates' layer_gcode lists them, " "each with z and layer.", object_schema({{"plate", {{"type", "integer"}, {"minimum", 0}, {"description", "Default: the current plate."}}}, diff --git a/src/slic3r/GUI/Mcp/McpToolsProject.cpp b/src/slic3r/GUI/Mcp/McpToolsProject.cpp index 58deb37e0c..57b7f57b96 100644 --- a/src/slic3r/GUI/Mcp/McpToolsProject.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsProject.cpp @@ -395,12 +395,15 @@ void register_project_tools(CommandCatalog& catalog) catalog.add(reaching({"open_project", "import_models"}, mutate_tool( "api", "open_files", L("Open files"), "Open model files (STL, 3MF, STEP, OBJ, AMF, SVG...), a project (.3mf) or G-code by absolute path, without a file " - "dialog. Models are added to the current project. A .3mf opens as a project, replacing the current one, unless as " - "is \"geometry\"; when the current project has unsaved changes that fails, changing nothing, unless " - "discard_changes. Importing can open a dialog (STEP mesh options, for instance); the reply is then " - "blocked_by_dialog.", + "dialog. Models are added to the current project. A .3mf given alone opens as a project, replacing the current " + "one, unless as is \"geometry\"; when the current project has unsaved changes that fails, changing nothing, unless " + "discard_changes. Given with other paths, a .3mf adds its models only. A G-code given alone replaces the project " + "too, to show its toolpaths: with unsaved changes the app asks first (blocked_by_dialog), whatever discard_changes " + "says. Importing can open a dialog (STEP mesh options, for instance); the reply is then blocked_by_dialog.", object_schema({{"paths", array_prop({{"type", "string"}}, "Absolute paths.")}, - {"as", enum_prop({"auto", "geometry", "project"}, "How to open .3mf files. Default auto (= project).")}, + {"as", enum_prop({"auto", "geometry", "project"}, "How a .3mf given alone opens: as a project (auto, the " + "default, and project) or adding its models only " + "(geometry).")}, {"discard_changes", prop("boolean", "Drop the project's unsaved changes rather than fail when a .3mf " "replaces it.")}}, {"paths"}), @@ -457,8 +460,9 @@ void register_project_tools(CommandCatalog& catalog) "if there are any: the reply is then blocked_by_dialog, and answer_dialog answers it. With arguments, or silent: " "true, it asks nothing: it fails, changing nothing, when the current project has unsaved changes, unless " "discard_changes. The presets' unsaved changes carry over to the new project unless preset_changes is \"discard\", as " - "New Project's prompt offers. Reply: objects, names, plates; when presets had or have unsaved changes, discarded " - "and modified list per preset the keys dropped and the keys still unsaved.", + "New Project's prompt offers. Reply, with arguments: objects, names, plates; when presets had or have unsaved " + "changes, discarded and modified list per preset the keys dropped and the keys still unsaved. With no arguments " + "the reply is ran and level, also once a prompt is answered, whatever the answer: Cancel keeps the project.", object_schema({{"discard_changes", prop("boolean", "Drop the project's unsaved changes rather than fail; for the " "presets', see preset_changes.")}, {"preset_changes", enum_prop({"keep", "discard"}, "The presets' unsaved changes, not the project's: keep " @@ -527,7 +531,7 @@ void register_project_tools(CommandCatalog& catalog) {"top_surface_pattern", enum_prop({"archimedeanchords", "monotonic"}, "flow_ratio (default archimedeanchords).")}, {"auto_scale", prop("boolean", "temperature, vfa: scale the model to the nozzle (default true).")}, {"auto_adjust", prop("boolean", "vfa: lower the layer height, else the end speed, to stay within the filament's " - "maximum volumetric speed (default true).")}, + "maximum volumetric speed (default true); only with auto_scale.")}, {"discard_changes", prop("boolean", "Drop the project's unsaved changes rather than fail; for the presets', " "see preset_changes.")}, {"preset_changes", enum_prop({"keep", "discard"}, "The presets' unsaved changes, not the project's: keep them for the " @@ -640,12 +644,15 @@ void register_project_tools(CommandCatalog& catalog) })); // The Speed Dial's Save Project too: with no arguments it saves as the tile does. - catalog.add(NativeCommands::with_person_form(reaching({"save_project_as"}, mutate_tool( + NativeCommand save = NativeCommands::with_person_form(reaching({"save_project_as"}, mutate_tool( {}, "save_project", {}, - "Save the project. Called with no arguments, it saves as Save Project does: to the project's file, or, when it has " - "none, through a file dialog (blocked_by_dialog; a native picker needs auto_answer_dialogs registered first). With " - "path, it saves a .3mf there without a dialog, and the file becomes the project's. A save that writes nothing (a " - "dialog cancelled, the file not written) fails with project_not_saved, and a file already there stays as it was.", + "Save the project. Called with no arguments, it saves as Save Project does: to the project's file (reply: ran, " + "level), or, when it has none, through a file dialog (blocked_by_dialog; a native picker needs auto_answer_dialogs " + "registered first). With path, it saves a .3mf there without the file dialog, and the file becomes the project's " + "(reply: path, bytes); a name ending in .gcode.3mf is refused (export writes that). Either way the save can still " + "open a dialog (blocked_by_dialog): a warning when settings name a plugin OrcaSlicer cannot identify, or an error " + "when the file cannot be written. A save that writes nothing, its file dialog or that warning cancelled or the " + "write failed, fails with project_not_saved, and a file already there stays as it was.", object_schema({{"path", prop("string", "Absolute .3mf path.")}, {"overwrite", prop("boolean", "Replace an existing file.")}}, {"path"}), [](const json& args, ToolContext& ctx) { std::string err; @@ -669,19 +676,25 @@ void register_project_tools(CommandCatalog& catalog) if (Plater* plater = wxGetApp().plater()) return NativeCommands::project_save_result(plater->save_project(false)); return AppActionRunResult{AppActionRunResult::Level::Succeeded}; - })); + }); + // Any argument makes path required, and a call with path skips the file dialog: silent has nothing to add here. + save.input_schema["properties"]["silent"]["description"] = + "Goes with path, which any argument makes required, and adds nothing to it: a call with path skips the file dialog already."; + catalog.add(save); catalog.add(reaching({"start_gcode_export", "export_sliced_3mf", "export_model_3mf", "export_stl"}, mutate_tool( "api", "export", L("Export"), "Write the project to a file without a dialog. gcode: the plate's G-code (slice first; it is written in the " - "background, and the call returns once it is). sliced_3mf: the sliced plate, or all plates, as .gcode.3mf. 3mf: " - "the model without slicing data. stl: all objects as one STL. Without format, the path's extension (.gcode, " - ".gcode.3mf, .3mf, .stl) says which.", + "background, and the call returns once it is). sliced_3mf: the sliced plate, or all plates, as .gcode.3mf (slice " + "first: a plate that is not sliced is written without G-code). 3mf: the model without slicing data. stl: all " + "objects as one STL. Both hold every plate's objects. Without format, the path's extension (.gcode, .gcode.3mf, " + ".3mf, .stl) says which. Reply: path and bytes; for gcode, path and export (ok, or superseded with a note when the " + "project changed while it was written).", object_schema({{"format", enum_prop({"gcode", "sliced_3mf", "3mf", "stl"}, "What to write; default from the path's extension.")}, {"path", prop("string", "Absolute output path.")}, {"plates", {{"type", {"string", "integer"}}, - {"description", "\"current\" (default), a plate index, which is selected first, or \"all\" " - "(sliced_3mf only)."}}}, + {"description", "\"current\" (default), a plate index, which is selected first and is the plate " + "gcode and sliced_3mf write, or \"all\" (sliced_3mf only)."}}}, {"overwrite", prop("boolean", "Replace an existing file.")}}, {"path"}), [](const json& args, ToolContext& ctx) { diff --git a/src/slic3r/GUI/Mcp/McpToolsPython.cpp b/src/slic3r/GUI/Mcp/McpToolsPython.cpp index fc38011336..3e4335e448 100644 --- a/src/slic3r/GUI/Mcp/McpToolsPython.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsPython.cpp @@ -340,17 +340,18 @@ void register_python_tools(CommandCatalog& catalog) "core", "run_script", L("Run a Python script"), "Run Python code inside OrcaSlicer as its main program (__name__ == \"__main__\") against orca.host, the whole plugin " "API (search_python_api searches it): read objects, meshes and settings, compute, use orca.host.ui and the preset " - "API, and call these same tools, with their guards and undo, through orca.host.tools.call(name, args), from the code " - "and from the threads and pool tasks it starts while the run lasts. Mesh and matrix arrays need numpy, which " + "API, and call these same tools, with their guards and undo, through orca.host.tools.call(name, args). Mesh and " + "matrix arrays need numpy, which " "search_python_api says is installed or not; a file run's PEP 723 block can install it. The code runs on a worker " "thread, where calls documented as UI thread only raise RuntimeError. The run ends once its code and the non-daemon " "threads and pool tasks it started are done; its windows close with it. `args` holds the args you pass; set `result` " "to a JSON value to return it; print() output comes back as output. Reply: {status: finished | raised | cancelled | " "timed_out, result, output, traceback?, message?}; a script that raised changed what it changed before. The code's " - "own file access is held to OrcaSlicer's folders (its data and resources folders, and for a file run the file's " - "folder, read only), and it starts no programs or threads and reaches no network: such an access raises " + "own file access is held to OrcaSlicer's folders (its data folder, and read only its resources folder and, for a " + "file run, the file's folder), and it starts no programs or threads and reaches no network: such an access raises " "PermissionError, unless a person has let Python scripts run unrestricted in Preferences " - "(get_app_state.python.scripts_unrestricted); the tools it calls work as they do for you. Recorded " + "(get_app_state.python.scripts_unrestricted), when the threads and pool tasks it starts call the tools too while " + "the run lasts; the tools it calls work as they do for you. Recorded " "by export_replay as one step with its code, which a replay runs again against the project as it is then.", object_schema({{"code", prop("string", "Python source, run as a module body.")}, {"args", {{"type", "object"}, {"description", "Bound to the name `args` in the code."}}}, @@ -358,7 +359,8 @@ void register_python_tools(CommandCatalog& catalog) {"description", "The run is stopped as timed_out after this many seconds (default 300)."}}}, {"filename", prop("string", "The name tracebacks show for the code (default ). An existing file's " "path makes it a file run, as `python file.py` runs it: __file__, sys.argv, imports " - "from its folder and its PEP 723 dependencies; any other name only names it.")}}, + "from its folder and its PEP 723 dependencies; any other name only names it. " + "What runs is still `code`: pass the file's text there.")}}, {"code"}), [](const json& args, ToolContext& ctx) { AutomationRuntime& runtime = ctx.runtime(); diff --git a/src/slic3r/GUI/Mcp/McpToolsRecord.cpp b/src/slic3r/GUI/Mcp/McpToolsRecord.cpp index 8a5ef41b18..66e001927d 100644 --- a/src/slic3r/GUI/Mcp/McpToolsRecord.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsRecord.cpp @@ -128,7 +128,7 @@ void register_record_tools(CommandCatalog& catalog) object_schema({{"target", enum_prop({"main", "canvas"}, "main (default): the main window and its dialogs; canvas: the 3D view shown.")}, {"fps", int_prop(1, 30, "Frames per second at most (default 10).")}, {"max_dim", int_prop(320, 3840, "Long edge of the video in pixels (default 1920).")}, - {"quality", int_prop(30, 95, "JPEG quality of the frames (default 80).")}, + {"jpeg_quality", int_prop(30, 95, "JPEG quality of the frames (default 80).")}, {"max_seconds", int_prop(1, 3600, "The recording ends on its own after this long (default 3600).")}, {"captions", prop("boolean", "Caption the tool call acting on the app (default false).")}, {"pointer", prop("boolean", "Highlight the pointer and show its clicks (default false).")}, @@ -151,7 +151,7 @@ void register_record_tools(CommandCatalog& catalog) o.target = arg_string(args, "target", "main"); o.fps = arg_int(args, "fps", 10); o.max_dim = arg_int(args, "max_dim", 1920); - o.quality = arg_int(args, "quality", 80); + o.quality = arg_int(args, "jpeg_quality", 80); o.max_seconds = arg_int(args, "max_seconds", 3600); o.captions = arg_bool(args, "captions", false); o.pointer = arg_bool(args, "pointer", false); @@ -229,15 +229,16 @@ void register_record_tools(CommandCatalog& catalog) L("Start Recording"), L("Commands"), "recording_start", NativeCommands::start_person_recording)); // The Speed Dial's Stop Recording too: with no arguments it stops as the tile does. - catalog.add(NativeCommands::with_person_form(record_tool({}, "stop_recording", {}, - "Stop the running recording and return its file once it is written: seconds, frames captured and " + NativeCommand stop = NativeCommands::with_person_form(record_tool({}, "stop_recording", {}, + "Stop the running recording. Call it with silent: true for the report: it waits for the file and " + "returns it with its seconds, frames captured and " "written, frames dropped when encoding fell behind, failed when they could not be encoded, or " "skipped when the window could not be captured, " "the size, the mean UI-thread time a capture took (capture_ms), and why it ended. A recording that ended on its own (max_seconds, the replay or script that started it ended, a " "write error) is reported once by the next stop_recording. For a recording started with encode, it then " "starts the MP4 encode and returns it under encode: a job, whose wait {for: \"job\"} returns " "encode_recording's result, whose raw_video_file_deleted says whether the .mkv was deleted. " - "This is the call with silent: true. Called with no arguments, it stops " + "Called with no arguments, it stops " "the recording as the Stop Recording command does, whoever started it: without waiting for its " "file, it shows the person a notification naming it and replies with its path; the next " "stop_recording with silent: true reports it as ended stopped_in_app.", @@ -263,7 +264,12 @@ void register_record_tools(CommandCatalog& catalog) return ToolResult::ok(report); }), // The person's stop opens nothing: like the silent one, it stops a recording behind a dialog. - L("Stop Recording"), L("Commands"), "recording_stop", NativeCommands::stop_recording_in_app, /*person_form_behind_dialogs=*/true)); + L("Stop Recording"), L("Commands"), "recording_stop", NativeCommands::stop_recording_in_app, /*person_form_behind_dialogs=*/true); + // It has no other argument, and neither form asks: silent picks the form that waits and reports. + stop.input_schema["properties"]["silent"]["description"] = + "true waits for the file and returns the report, and the encode job when the recording has one; a call with no " + "arguments stops as the Stop Recording command does."; + catalog.add(stop); NativeCommand encode = record_tool( "ui", "encode_recording", L("Encode a recording"), diff --git a/src/slic3r/GUI/Mcp/McpToolsReplay.cpp b/src/slic3r/GUI/Mcp/McpToolsReplay.cpp index 80261c1490..5ab5a6b94f 100644 --- a/src/slic3r/GUI/Mcp/McpToolsReplay.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsReplay.cpp @@ -117,8 +117,9 @@ void register_replay_tools(CommandCatalog& catalog) "${vars.NAME} and ${jobs.NAME}. A step that returns a job is awaited unless await:false, which stores the job under " "save_as so later steps can answer the dialog it opened. expect maps a JSON pointer into the step's result to " "matchers (eq ne gt ge lt le contains regex exists empty); the first failed step or expectation stops the run unless " - "the step is optional. Writes result.json to out_dir (default: .out next to a replay file). " - "auto_answer_dialogs rules a replay registers end with it. export_replay turns this session into one.", + "the step is optional. Writes result.json to out_dir (default: the replay file's name with .out, beside it; for an " + "inline replay, replay- in the session's output folder). Reply: passed, steps, failed_step, out_dir and " + "result_file. auto_answer_dialogs rules a replay registers end with it. export_replay turns this session into one.", object_schema({{"path", prop("string", "Absolute path of a replay file.")}, {"replay", {{"type", json::array({"object", "string"})}, {"description", "The replay itself, as an object or as its JSON text, instead of path."}}}, @@ -175,11 +176,13 @@ void register_replay_tools(CommandCatalog& catalog) NativeCommand exp = inspect_tool( "core", "export_replay", L("Export this session as a replay"), - "Turn the calls this session made into a replay that run_replay runs: mutating calls, wait and screenshot, in order, " - "with refs replaced by locators, job replies replayed with await:false, and screenshot paths moved under ${out_dir}. " - "Calls that failed, at once or as a job later, are left out; so is a call whose job is still running (unless it " + "Turn the calls this session made into a replay that run_replay runs: mutating calls, wait, screenshot and the " + "recording tools, in order, with refs replaced by locators, job replies replayed with await:false, and screenshot " + "and recording paths moved under ${out_dir}. " + "Calls that failed, at once or as a job later, are left out (a run_script that raised or timed out replied, so it " + "stays); so is a call whose job is still running (unless it " "waits on a dialog), which left_out_running lists as {tool, job}. " - "Reply: the replay, which with path is also written there. clear:true starts a new recording afterwards.", + "Reply: the replay, which with path is also written there. clear:true then forgets the calls made so far.", object_schema({{"name", prop("string", "Replay name.")}, {"path", prop("string", "Absolute .json path to write.")}, {"overwrite", prop("boolean", "Replace an existing file.")}, @@ -207,7 +210,7 @@ void register_replay_tools(CommandCatalog& catalog) return ToolResult::ok(std::move(out)); }); exp.read_only = false; - // clear empties the recording, so a second call exports less. + // clear empties the journal, so a second call exports less. exp.idempotent = false; catalog.add(exp); } diff --git a/src/slic3r/GUI/Mcp/McpToolsScene.cpp b/src/slic3r/GUI/Mcp/McpToolsScene.cpp index 936f5a51f1..d1c7383530 100644 --- a/src/slic3r/GUI/Mcp/McpToolsScene.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsScene.cpp @@ -433,7 +433,7 @@ std::set> shown_notifications(Plater& plater) // plate's Arrange icon or Fill bed starts. UI thread. ArrangeStart start_arrange(Plater& plater, const json& args) { - const bool fill = args.contains("fill"); + const bool fill = args.contains("fill_object"); // Fill bed selects its object first, so it needs what every tool that selects needs. An arrangement // runs from whatever view and with whatever gizmo is open, as the toolbar's Arrange does. GLCanvas3D& canvas = fill ? require_prepare_scene(plater) : shown_prepare_canvas(plater); @@ -441,14 +441,14 @@ ArrangeStart start_arrange(Plater& plater, const json& args) const ModelObjectPtrs& objects = plater.model().objects; ArrangeStart start; if (fill && args.contains("plates")) - throw ToolFailure("fill fills the object's own plate; leave plates out"); + throw ToolFailure("fill_object fills the object's own plate; leave plates out"); if (!fill && args.contains("fill_with")) - throw ToolFailure("fill_with goes with fill"); + throw ToolFailure("fill_with goes with fill_object"); if (const std::optional refusal = Ops::arrange_refusal({})) throw refused(*refusal); int plate = -1; // every unlocked plate if (fill) { - start.fill_object = arg_int(args, "fill", 0); + start.fill_object = arg_int(args, "fill_object", 0); if (start.fill_object >= int(objects.size())) throw ToolFailure("object index out of range"); select_rows(objects[size_t(start.fill_object)], nullptr); @@ -975,7 +975,8 @@ void register_scene_tools(CommandCatalog& catalog) "The project as the Objects panel lists it. plates: each {index, name, objects}, with the objects that have an " "instance on it; outside: the objects with an instance on no plate. An object with instances on two plates is " "listed under both, each time with that plate's instances. An object has its filament, auto_drop, bounding box " - "(instance 0), brim ear count and the settings it overrides; its instances (offset, rotation in degrees, scale, " + "(instance 0), brim ear count and overrides, the keys of the settings it overrides (get_settings scope object " + "reads them); its instances (offset, rotation in degrees, scale, " "mirrored, bbox); its parts, one or more: parts, negative parts, modifiers, support blockers and enforcers and " "precise seams (type, with subtype for a precise seam; filament: a part's own or its object's, a modifier's only when it sets " "one; position, bbox and scaled_volume in mm3 on the bed, measured on instance 0; rotation_deg and scale in the " @@ -1000,7 +1001,8 @@ void register_scene_tools(CommandCatalog& catalog) "ui", "select_objects", L("Select objects"), "Select objects, instances or parts in the 3D view (the assemble view while it is shown, else Prepare, switching to it), as clicking them would. Give objects, " "instances ([[object, instance], ...]) or parts ([[object, part], ...]); add keeps the current selection; all / " - "none select everything or nothing. The reply is the selection as get_app_state.selection gives it.", + "none select everything or nothing, whatever else is given. The reply is the selection as get_app_state.selection " + "gives it.", object_schema({{"objects", array_prop({{"type", "integer"}}, "Object indices.")}, {"instances", array_prop({{"type", "array"}}, "[[object, instance], ...]")}, {"parts", array_prop({{"type", "array"}}, "[[object, part], ...]")}, @@ -1111,8 +1113,10 @@ void register_scene_tools(CommandCatalog& catalog) "Change one instance's placement, or one part's with part. translate is in mm, position where it goes (mm, as " "the Move panel shows it, whatever mode says), rotate in degrees about X/Y/Z, " "scale a factor (one number or [x, y, z]), size [x, y, z] mm along the object's or part's own axes, plate moves " - "the instance onto that plate at the same place. mode \"relative\" (default) adds to the current placement, " - "\"absolute\" sets it. An instance is dropped back onto the bed unless drop_to_bed is false. A part moves as the " + "the instance onto that plate at the same place. mode \"relative\" (default) adds to the current placement (a scale " + "multiplies it), \"absolute\" sets it. An instance is dropped back onto the bed, unless its object's auto_drop is " + "off; drop_to_bed false lets it sink into the bed, but an object of one part left above the bed still drops. A part " + "moves as the " "Object manipulation panel moves it: translate and rotate along the bed's axes, measured on instance 0, scale and " "size along its own axes; every instance shows the change, and Auto Drop may lower the object afterwards. One " "undo step. Reply: the instance's offset, scale and plate, or the part's size along its own axes and its " @@ -1180,8 +1184,8 @@ void register_scene_tools(CommandCatalog& catalog) catalog.add(reaching({"start_arrange"}, mutate_tool( "api", "arrange", L("Arrange objects or fill the bed"), "Arrange the objects of every unlocked plate as the toolbar's Arrange does, or of one plate (plates: an index or " - "\"current\") as its Arrange icon does. With fill, fill that object's plate with more of it instead, as Fill bed " - "with instances (or copies, by fill_with) does. spacing, rotate, align_y and multi_material are the Arrange options " + "\"current\") as its Arrange icon does. With fill_object, fill that object's plate with more of it instead, as Fill " + "bed with instances (or copies, by fill_with) does (reply: added, how many). spacing, rotate, align_y and multi_material are the Arrange options " "panel's settings: the values given stay in the panel, so later arranges use them too. Waits for the arrangement " "(a longer one replies with a job). Reply: the settings in force, instances left off every plate, plates the " "all-plates arrange skipped and the job's notifications. An arrange may reorder objects, so list_objects again. " @@ -1191,7 +1195,7 @@ void register_scene_tools(CommandCatalog& catalog) {"rotate", prop("boolean", "Auto rotate for arrangement.")}, {"align_y", prop("boolean", "Align to Y axis (off while rotate is on).")}, {"multi_material", prop("boolean", "Allow multiple materials on same plate.")}, - {"fill", {{"type", "integer"}, {"minimum", 0}, {"description", "Instead of arranging, fill this object's plate with more of it."}}}, + {"fill_object", {{"type", "integer"}, {"minimum", 0}, {"description", "An object index: instead of arranging, fill that object's plate with more of it."}}}, {"fill_with", enum_prop({"instances", "copies"}, "Default instances.")}, {"timeout_s", {{"type", "integer"}, {"minimum", 10}, {"maximum", 1800}, {"description", "Cancel it after this long (default 300)."}}}}), [](const json& args, ToolContext& ctx) { @@ -1235,7 +1239,7 @@ void register_scene_tools(CommandCatalog& catalog) "slot i+1 with m, g and the grams of model_g, support_g, flush_g and tower_g. Other changes are refused until it " "finishes; cancel_job stops it.", object_schema({{"plates", {{"type", {"string", "integer"}}, {"description", "\"current\" (default), \"all\", or a plate index."}}}, - {"timeout_s", {{"type", "integer"}, {"minimum", 10}, {"maximum", 7200}, {"description", "Give up after this long (default 1800)."}}}}), + {"timeout_s", {{"type", "integer"}, {"minimum", 10}, {"maximum", 7200}, {"description", "Stop waiting after this long (default 1800): the call fails, and the slice goes on unless cancel_job stops it."}}}}), [](const json& args, ToolContext& ctx) { const json plates_arg = args.value("plates", json("current")); auto ticket = std::make_shared(); @@ -1355,7 +1359,8 @@ void register_scene_tools(CommandCatalog& catalog) "Stop the running operation: a slice or G-code export, as the slicing progress's cancel button does, or a " "background job an MCP call started (an arrange, orient or fill bed). Its job then reports cancelled; a background " "job keeps other changes out until it has really stopped. With job, only that job is stopped: the running " - "operation, a run_script run or an encode_recording. Allowed while an operation holds the project.", + "operation, a run_script run or an encode_recording. Allowed while an operation holds the project. Reply: " + "was_running, and job when one was stopped.", object_schema({{"job", prop("string", "The operation's job to cancel, e.g. \"j12\".")}}), [](const json& args, ToolContext& ctx) { AutomationRuntime& runtime = ctx.runtime(); diff --git a/src/slic3r/GUI/Mcp/McpToolsUi.cpp b/src/slic3r/GUI/Mcp/McpToolsUi.cpp index f5b20d7e8c..bdbec16a23 100644 --- a/src/slic3r/GUI/Mcp/McpToolsUi.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsUi.cpp @@ -70,9 +70,16 @@ namespace { // The locator grammar is spelled out once, in list_widgets's description, which hands out the refs. const json kTargetSchema = {{"type", json::array({"string", "object"})}, - {"description", "A ref from the latest list_widgets call (\"w12\") or a locator, such as {label: \"OK\", " - "within: \"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's " - "description lists every kind."}}; + {"description", "A ref list_widgets gave (\"w12\"), which later listings leave good (one refused as stale or " + "unknown needs a new listing), or a locator, such as {label: \"OK\", within: " + "\"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's description " + "lists every kind."}}; + +// run_javascript's target: a web view or an element of its page, not a widget. +const json kPageTargetSchema = {{"type", json::array({"string", "object"})}, + {"description", "A web view (its ref; list_widgets lists it as kind webview) or an element of its " + "page (its ref or a {web} / {css} locator), which the code gets as `el`. Default: " + "the topmost dialog's web view, else the only one shown."}}; const json kPageTimeoutSchema = {{"type", "integer"}, {"minimum", 1}, @@ -81,7 +88,7 @@ const json kPageTimeoutSchema = {{"type", "integer"}, const json kModifiersSchema = {{"type", "array"}, {"items", {{"type", "string"}, {"enum", {"ctrl", "cmd", "rawctrl", "shift", "alt"}}}}, - {"description", "Modifier keys held during the click, as in press_keys: ctrl and cmd are both Command on macOS " + {"description", "Modifier keys held during the input, as in press_keys: ctrl and cmd are both Command on macOS " "and Ctrl elsewhere; rawctrl is the macOS Control key."}}; bool in_top_dialog(AutomationRuntime& runtime, wxWindow* window) @@ -1356,7 +1363,7 @@ void register_ui_tools(CommandCatalog& catalog) { NativeCommand def = recover_input_tool( - "ui", "set_window", L("Size or move a window"), + "ui", "set_window", L("Size, move or raise a window"), "Size, move, maximize, minimize or raise a window: the main window (default), the topmost modal dialog, or one " "list_windows lists, also while a modal dialog is open. Size the main window before set_view fits the camera and " "before start_recording, as a recording keeps its first frame's size. size and position are in the units " @@ -1482,8 +1489,12 @@ void register_ui_tools(CommandCatalog& catalog) "selected as a click on its cell selects it (ctrl adds, shift extends; in the object list the named column acts, as " "Printable toggles), double activates it and a right click opens its menu; a drop-down list's row is picked. A " "plate icon does what it does in the Prepare view: lock replies locked, arrange and orient reply done once their " - "job ends, settings and filament_map list the dialog they open (dialogs). Modifiers reach the 3D canvas, the object " - "list and handlers that read them. A menu the click opens is never shown: the reply lists it as popup_menu, or " + "job ends, settings and filament_map list the dialog they open (dialogs). A button, checkbox, toggle or radio " + "button is activated so by a plain left click only: with modifiers, double or another button it gets a mouse " + "click, which a native control ignores. A menu item runs whatever those options are, a toolbar item takes a " + "left or a right click, and a gizmo a single left one. Modifiers reach the 3D canvas, the object list and " + "handlers that read them. To click a point of the model, drag, scroll or hold a press, use mouse_gesture. A menu the click opens is " + "never shown: the reply lists it as popup_menu, or " "popup_item runs one of its items (ran). A click that opens a dialog replies blocked_by_dialog.\n" "A web page's element gets the pointer and mouse events of a click at its centre (or x/y) once scrolled into view, " "refused when something else covers that point. The reply reads back checked, and has closed when the click closed " @@ -1628,7 +1639,10 @@ void register_ui_tools(CommandCatalog& catalog) "browser's default actions: typing, Backspace/Delete, Enter (submits a form, activates a button), Space, Tab moving " "the focus, arrows stepping a select, range or radio group; page says what they changed, as for click.", object_schema({{"target", kTargetSchema}, - {"keys", prop("string", "Key chord.")}, + {"keys", prop("string", "One chord: a key, after any modifiers joined by +. Keys: one character, Enter, Esc, " + "Tab, Space, Backspace, Delete, Insert, Home, End, PageUp, PageDown, Left, Right, " + "Up, Down, F1 to F24. Modifiers: Ctrl, Cmd, RawCtrl, Shift, Alt. With text, the " + "chord goes first.")}, {"text", prop("string", "Characters to type.")}, {"popup_item", kPopupItemSchema}, {"timeout_s", kPageTimeoutSchema}}), @@ -1696,15 +1710,15 @@ void register_ui_tools(CommandCatalog& catalog) mouse_canvases.insert(mouse_canvases.end() - 1, "design"); #endif catalog.add(recover_input_tool( - "ui", "mouse_gesture", L("Mouse gesture on the 3D view"), + "ui", "mouse_gesture", L("Mouse gesture on a 3D view or page element"), "Make a mouse gesture on a 3D canvas as a person would: move, down, up, click, drag or wheel. It starts at `at`, a " "point of the model, which is projected through the camera and by default checked to land on that part (check " "\"point\" only projects it), or at x/y, logical pixels from the canvas's top left. A drag goes through `waypoints` to " "`to`, `steps` moves per leg: on an object it moves the object, in a painting gizmo it paints from a press on the " "object being painted (waypoints zigzagging over an area paint all of it), and elsewhere it turns or pans the camera " "as this install's mouse settings say, so turn the camera with set_view camera or orbit instead. A wheel turns delta " - "notches; positive zooms in or scrolls a panel up. Modifiers are held as keys for the gesture (shift for Measure's " - "point picking, alt for erasing). A down keeps its button and modifiers held, so moves drag, until an up or another " + "notches; positive zooms in (out with the Reverse mouse zoom preference on) or scrolls a panel up. Modifiers are " + "held as keys for the gesture (shift picks points in Measure and erases in a painting gizmo). A down keeps its button and modifiers held, so moves drag, until an up or another " "gesture. Grabbers are set through the gizmo's panel fields or transform, not dragged. A menu a right click opens " "is listed as popup_menu, or popup_item (with click or up) runs one of its items. The reply's camera_moved says the " "gesture moved the camera, so earlier screenshots and pixels no longer match the view.\n" @@ -1724,7 +1738,7 @@ void register_ui_tools(CommandCatalog& catalog) {"steps", {{"type", "integer"}, {"minimum", 1}, {"maximum", 200}, {"description", "Moves per drag leg (default 10)."}}}, {"button", enum_prop({"left", "right", "middle"}, "Default left.")}, {"double", prop("boolean", "Double click.")}, - {"delta", prop("integer", "Wheel notches.")}, + {"delta", prop("integer", "Wheel notches (default 1 on a canvas; a page element needs it given).")}, {"modifiers", kModifiersSchema}, {"popup_item", kPopupItemSchema}, {"target", {{"type", json::array({"string", "object"})}, @@ -1781,7 +1795,7 @@ void register_ui_tools(CommandCatalog& catalog) })); catalog.add(mutate_tool( - "ui", "pick_gizmo_file", L("Pick a file for the open gizmo"), + "ui", "pick_gizmo_file", L("Load or save the open gizmo's SVG or texture file"), "Do what a file picker inside the open gizmo does, with a path instead of its dialog: svg_change loads another SVG " "file into the SVG part being edited, svg_save_as writes that part's SVG to a new file (an existing one only with " "overwrite), texture_import imports a height-map image into the texture library and puts it on Texture " @@ -1831,12 +1845,16 @@ void register_ui_tools(CommandCatalog& catalog) "core", "answer_dialog", L("Answer a dialog"), "Press a button of the topmost modal dialog: yes, no, ok, cancel, close, apply, a button's label, or a numeric id. " "A disabled button (enabled: false) is refused, the dialog's message showing what it still needs, and so is one on " - "a page the dialog does not show, except a hidden cancel or close, which ends the dialog. The label of an option of a " + "a page the dialog does not show, except a hidden cancel or close, which ends the dialog. On a dialog that is " + "neither native nor a web dialog, a standard name or id it has no button for ends it with that answer too, " + "without a handler running (pressed: false). The label of an option of a " "selector made of buttons (Orca's radio groups, tab bars and multi-switches, shown as (*) / ( ) in the message) " "selects that option and leaves the dialog open; set other radio buttons and switches with click or set_widget_value " "true, and notebook tabs with click. " "dialog.title, text the dialog's title contains, makes sure which dialog that is; it must be the topmost. Reply: " - "closed: true when it closed, and dialogs, those still open. A native message box (native: true) is pressed through " + "dialog, button, pressed, and id, the wx id pressed or ended with, or web: true for a button on a web dialog's " + "page, with what the page did as click reports it; closed: true when it closed, and dialogs, those still open. A " + "native message box (native: true) is pressed through " "the OS, by one of the buttons get_app_state.dialogs lists for it; a file or folder picker can't be answered here, nor " "any native dialog on macOS (its buttons list is empty): register auto_answer_dialogs before opening them. A web " "dialog's buttons are on its page: a label is pressed there, waiting up to 3 s for it to show, so the page's own " @@ -2005,12 +2023,14 @@ void register_ui_tools(CommandCatalog& catalog) NativeCommand def = recover_input_tool( "core", "auto_answer_dialogs", L("Answer dialogs automatically"), "Answer modal dialogs automatically when their title or message matches a rule's regex (case-insensitive). " - "get_app_state.auto_answer_rules lists the rules in force. Called from a replay or script, the rules last until it " - "ends; otherwise they replace the ones this session set before, and an empty list clears them. A native dialog " + "get_app_state.auto_answer_rules lists the rules in force. Called from a replay or script, the rules join those " + "it set before and last until it ends, and a plugin's likewise until it unloads; an MCP client's replace the " + "ones MCP clients set before and last until the MCP server stops, and an empty list clears them. Reply: scope (run, plugin or session), rules (uses counts " + "a rule's answers) and answered_open_dialog. A native dialog " "returns the rule's button at once and never shows. A file or folder picker takes button ok with an absolute path " "and returns it without showing (on Linux such a rule cancels it); without a path a picker can only be cancelled, " - "and a multi-select picker takes no path. A wx dialog has the button pressed as answer_dialog does, so its " - "handler runs. A matching dialog already open is answered too " + "and a multi-select picker takes no path. A wx dialog is answered as answer_dialog does. A matching dialog " + "already open is answered too " "(answered_open_dialog), so a prompt that shows around the same time, such as the restore prompt after startup, " "is caught either way. A web dialog is matched by its title: a button that names one of its shown wx buttons (by " "label, standard name or id) is pressed as for a wx dialog, any other on its page once it shows there, for up to " @@ -2092,8 +2112,9 @@ void register_ui_tools(CommandCatalog& catalog) "the code closed its dialog, navigated: true when it changed the page, dialogs when it opened another. Messages " "the page posts to OrcaSlicer reach it once the code has returned. It runs through eval, which a page whose " "Content-Security-Policy forbids it may refuse (list_widgets and the input tools still work there).", - object_schema({{"code", prop("string", "JavaScript to run.")}, - {"target", kTargetSchema}, + object_schema({{"code", prop("string", "JavaScript statements, run through eval: the last expression's value is the " + "result. No top-level return or await; a Promise or a DOM node comes back as {}.")}, + {"target", kPageTargetSchema}, {"timeout_s", {{"type", "integer"}, {"minimum", 1}, {"maximum", 120}, {"description", "Seconds the code gets (default 10)."}}}}, {"code"}), [](const json& args, ToolContext& ctx) { diff --git a/src/slic3r/GUI/Mcp/McpToolsView.cpp b/src/slic3r/GUI/Mcp/McpToolsView.cpp index 25f370d3dc..869ab7ddd1 100644 --- a/src/slic3r/GUI/Mcp/McpToolsView.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsView.cpp @@ -666,13 +666,13 @@ void register_view_tools(CommandCatalog& catalog) #endif catalog.add(reaching({"show_layer_range"}, mutate_tool( - "ui", "set_view", L("Point the view"), + "ui", "set_view", L("Set up the view"), "Set up what the window shows, for screenshots and GUI work: the main tab, the 3D view (canvas: Prepare's, the " "preview or the assemble view, which has its own gizmos), the camera of the 3D view shown (a named direction, the " "default view, or fit to bed / objects / selection, then look_at, the point it looks at, an orbit to look from " "between the named directions, and the zoom), the preview's color scheme (picked as in the legend's combo, which " "shows every feature type again), legend rows, time estimate and layers (1-based, or up to a height). Only the given " - "fields change. On the Design tab the camera points its view (default is its Home view; no fit_bed). The reply " + "fields change, but a preview field given without tab or canvas shows the Preview tab. On the Design tab the camera points its view (default is its Home view; no fit_bed). The reply " "echoes them; preview layers as [first, last, count] with z, the heights of first and last; with any camera field, " "camera_state, the camera it leaves as get_app_state.camera gives it, and adjusted: [\"zoom\"] when the zoom was " "held to its limits.", diff --git a/src/slic3r/GUI/Mcp/RecordingSettings.cpp b/src/slic3r/GUI/Mcp/RecordingSettings.cpp index a5e3057cad..78997d5059 100644 --- a/src/slic3r/GUI/Mcp/RecordingSettings.cpp +++ b/src/slic3r/GUI/Mcp/RecordingSettings.cpp @@ -85,7 +85,7 @@ RecordingSettings load_recording_settings(const AppConfig& config) } catch (const std::exception&) { } }; - number("quality", kMinQuality, kMaxQuality, s.quality); + number("jpeg_quality", kMinQuality, kMaxQuality, s.quality); number("crf", 0, kMaxCrf, s.crf); s.captions = config.get(kSection, "captions") == "true"; s.pointer = config.get(kSection, "pointer") == "true"; @@ -104,7 +104,7 @@ RecordingSettings load_recording_settings(const AppConfig& config) void save_recording_settings(AppConfig& config, const RecordingSettings& settings) { - config.set(kSection, "quality", std::to_string(settings.quality)); + config.set(kSection, "jpeg_quality", std::to_string(settings.quality)); config.set(kSection, "captions", settings.captions); config.set(kSection, "pointer", settings.pointer); config.set(kSection, "encode", settings.encode); diff --git a/src/slic3r/GUI/NativeCommands.cpp b/src/slic3r/GUI/NativeCommands.cpp index 34c938735d..fccc9503c9 100644 --- a/src/slic3r/GUI/NativeCommands.cpp +++ b/src/slic3r/GUI/NativeCommands.cpp @@ -480,7 +480,7 @@ AppActionRunResult NativeCommands::start_person_recording() return {AppActionRunResult::Level::Error, format_wxstr(_L("The recording could not start: %1%"), e.what()), false}; } nlohmann::json reply = Mcp::encode_arguments(settings, Mcp::path_to_utf8(options.path)); - reply["quality"] = settings.quality; + reply["jpeg_quality"] = settings.quality; reply["captions"] = settings.captions; reply["pointer"] = settings.pointer; reply["encode"] = settings.encode; @@ -601,8 +601,8 @@ void describe_commands(std::vector& commands) "as undo's."}, {"open_action_replay", "Open the Action Replay window, where a person opens a replay file (an orca_replay), reads its steps " "and replays them. Agents run replays with the run_replay tool instead."}, - {"toggle_run_script", "Show or hide the Run Script panel, where a person writes and runs Python scripts cell by cell. Agents " - "run Python with the run_script tool instead."}, + {"toggle_run_script_panel", "Show or hide the Run Script panel, where a person writes and runs Python scripts cell by cell. " + "Agents run Python with the run_script tool instead."}, {"take_screenshot", "Save a PNG of the main window in the folder Start Recording saves in (the person's Downloads unless " "they chose another) and show the person a notification naming it; the reply has its path. Agents use " "the screenshot tool, which returns the image."}, @@ -613,8 +613,9 @@ void describe_commands(std::vector& commands) {"mode_advanced", "Switch the settings view to Advanced mode."}, {"mode_expert", "Switch the settings view to Expert mode."}, {"toggle_developer_mode", "Turn Developer mode on or off."}, - {"export_gcode", "Export the current plate's G-code. With a path, exports there without a dialog once the plate is sliced, in the " - "background, and the call returns when the file is written; with no arguments, it opens the export dialog."}, + {"export_gcode", "Export the current plate's G-code. With a path, exports the sliced plate there without a dialog, in the " + "background, and the call returns when the file is written; a plate that is not sliced is refused " + "(slice first). With no arguments, it opens the export dialog."}, {"export_stl", "Export all objects as one STL. With a path, writes there without a dialog."}, {"export_3mf", "Export the model as a .3mf without slicing data. With a path, writes there without a dialog."}, {"export_sliced_file", "Export the current plate's sliced file (.gcode.3mf). With a path, writes there without a dialog."}, @@ -671,6 +672,8 @@ void describe_commands(std::vector& commands) {"obj_order_by_height", "Order the current plate's objects by height, which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending."}, {"obj_order_by_size", "Order the current plate's objects by size (bounding box volume), which sets the object list and print order, as the plate menu's Order By does. Choosing the order they already have reverses it. Object indices change; the reply lists the new order (order: [{object, name, plate}]) and descending."}, {"add_primitive_svg", "Add an SVG as a new object, or as a part of the selected object. With a path, uses that file without a dialog; the part is created in the background (wait for idle), and the SVG gizmo opens on it."}, + {"add_primitive_text", "Add a text: a part on the selected object, or a new object when nothing is selected. It is created " + "in the background (wait for idle), and the Text gizmo opens on it."}, // Shapes: a size skips the Primitive size dialog. {"add_primitive_cube", "Add a cube object to the current plate; fails while an object is selected. With a size, skips the size dialog."}, {"add_primitive_cylinder", "Add a cylinder object to the current plate; fails while an object is selected. With a size, skips the size dialog. The shape may then be turned toward the part-cooling fan, so the size is along its own axes before that turn."}, @@ -678,6 +681,11 @@ void describe_commands(std::vector& commands) {"add_primitive_cone", "Add a cone object to the current plate; fails while an object is selected. With a size, skips the size dialog. The shape may then be turned toward the part-cooling fan, so the size is along its own axes before that turn."}, {"add_primitive_disc", "Add a disc object to the current plate; fails while an object is selected. With a size, skips the size dialog. The shape may then be turned toward the part-cooling fan, so the size is along its own axes before that turn."}, {"add_primitive_torus", "Add a torus object to the current plate; fails while an object is selected. With a size, skips the size dialog. The shape may then be turned toward the part-cooling fan, so the size is along its own axes before that turn."}, + // The two handy models of several files, which the menu arranges once they are loaded. + {"add_handy_orca_cube", "Add the Orca Cube and its plug to the current plate, then arrange the objects as the toolbar's " + "Arrange does, which moves the others too."}, + {"add_handy_orcasliced_combo", "Add the OrcaSliced Combo (the OrcaSliced model, the Orca Cube and its plug) to the current " + "plate, then arrange the objects as the toolbar's Arrange does, which moves the others too."}, {"plate_add", "Add a plate."}, {"plate_duplicate", "Duplicate the current plate."}, {"plate_delete", "Delete the current plate."}, @@ -693,7 +701,9 @@ void describe_commands(std::vector& commands) {"help_migrate_filament_presets", "Migrate legacy user filament presets."}, {"help_troubleshoot", "Open the troubleshooting center."}, {"help_network_test", "Open the network test dialog."}, - {"help_benchmark_3d_scene", "Benchmark rendering of the current 3D scene."}, + {"help_benchmark_3d_scene", "Time the 3D views on a test model. It asks first (Start or Cancel), then replaces the project " + "with the OrcaSliced Combo as New Project does, which may ask about unsaved changes, slices it " + "and shows the results."}, {"help_tip_of_the_day", "Show a tip of the day."}, {"help_check_updates", "Check for a newer OrcaSlicer."}, {"help_about", "Show the About dialog."}, @@ -701,7 +711,8 @@ void describe_commands(std::vector& commands) {"open_youtube", "Open the OrcaSlicer YouTube channel in the browser."}, {"open_plugins", "Open the plugins dialog."}, {"refresh_plugins", "Reload plugins."}, - {"install_plugin", "Open the plugin hub to install a plugin."}, + {"install_plugin", "Open the plugin hub's page in the default web browser, where a person picks a plugin to install; " + "nothing opens in OrcaSlicer."}, {"install_local_plugin", "Install a plugin from a .py or .whl file, as the Plugins dialog's Install local plugin does. With a " "path, installs that file without a dialog. Replacing a plugin installed already asks first " "(answer with answer_dialog); the message names the plugin installed, or why it was not."}, @@ -743,9 +754,13 @@ void describe_commands(std::vector& commands) c.description = "Open the " + c.title + " dialog; the generate_calibration_test tool runs the same test with typed parameters and no dialog."; } else if (c.key.rfind("view_", 0) == 0) { - c.description = "Point the 3D camera: " + c.title + "."; + // A named direction, which set_view's camera takes by the same name. The command points the view of + // Prepare, Preview or the assemble view; the Design view is set_view's alone. + const std::string direction = c.key.substr(5); + c.description = "Turn the 3D camera of Prepare, Preview or the assemble view to the " + direction + + " view, as set_view {camera: \"" + direction + "\"} does there."; } else if (c.key.rfind("add_primitive_", 0) == 0 || c.key.rfind("add_handy_", 0) == 0) { - c.description = "Add a " + c.title + " object to the current plate."; + c.description = "Add the " + c.title + " model to the current plate."; } } } @@ -842,7 +857,9 @@ void NativeCommands::register_all_commands(CommandCatalog& catalog, [[maybe_unus }, "tab") .input_schema = Mcp::object_schema( - {{"tab", Mcp::prop("string", "The tab's id: home, prepare, preview, monitor, project, calibration, or a plugin page's id.")}}, + {{"tab", Mcp::prop("string", "The tab's id: home, prepare, preview, monitor (the Device tab, which set_view calls device), " + "monitor_web (the web Device page, where the app shows one), multi_device, project, " + "calibration, design, or a plugin page's id.")}}, {"tab"}); add_with_icon("load_project", L("Load Project"), L("Commands"), "menu_open", [](const json& args) { @@ -922,7 +939,7 @@ void NativeCommands::register_all_commands(CommandCatalog& catalog, [[maybe_unus {"tool": "undo", "args": {"history": "design"}}, {"tool": "redo", "args": {"history": "design"}}]}])json"); #endif - add_with_icon("toggle_run_script", L("Run Script"), L("Commands"), "media_play", [](const json&) { + add_with_icon("toggle_run_script_panel", L("Run Script"), L("Commands"), "media_play", [](const json&) { if (wxGetApp().mainframe != nullptr) wxGetApp().run_script_panel().toggle(); return AppActionRunResult{AppActionRunResult::Level::Succeeded}; @@ -958,7 +975,7 @@ void NativeCommands::register_all_commands(CommandCatalog& catalog, [[maybe_unus return AppActionRunResult{AppActionRunResult::Level::Succeeded}; }).input_schema = Mcp::object_schema( {{"tab", Mcp::enum_prop(preferences_tab_names, "The tab to show.")}, - {"key", Mcp::prop("string", "A preference on that tab, e.g. auto_arrange on behaviour: its control is scrolled into view and focused.")}}); + {"key", Mcp::prop("string", "With tab: a preference on that tab, e.g. auto_arrange on behaviour: its control is scrolled into view and focused.")}}); // ---- Screenshots and recordings ---- (the MCP screenshot and recording tools' defaults, for the person) add_with_icon("take_screenshot", L("Take Screenshot"), L("Commands"), "screenshot", [](const json&) { @@ -1513,8 +1530,8 @@ void NativeCommands::register_all_commands(CommandCatalog& catalog, [[maybe_unus return AppActionRunResult{AppActionRunResult::Level::Info, _L("The only filament slot cannot be deleted.")}; // Without a slot, the last physical one, as the - button. size_t slot = physical; - if (args.contains("slot")) { - slot = args.at("slot").get(); + if (args.contains("filament_slot")) { + slot = args.at("filament_slot").get(); if (slot < 1 || slot > bundle.filament_presets.size()) return AppActionRunResult{AppActionRunResult::Level::Error, format_wxstr(_L("Filament slot must be 1 to %1%."), bundle.filament_presets.size())}; @@ -1526,9 +1543,9 @@ void NativeCommands::register_all_commands(CommandCatalog& catalog, [[maybe_unus plater->sidebar().update_filaments_counter(); return AppActionRunResult{AppActionRunResult::Level::Succeeded, format_wxstr(_L("Deleted filament slot %1%."), slot)}; }).input_schema = Mcp::object_schema( - {{"slot", {{"type", "integer"}, - {"minimum", 1}, - {"description", "The 1-based filament slot. Default: the last physical slot, as the - button."}}}}); + {{"filament_slot", {{"type", "integer"}, + {"minimum", 1}, + {"description", "The 1-based filament slot. Default: the last physical slot, as the - button."}}}}); // ---- Presets / cloud ---- add_with_icon("preset_bundle", L("Open Preset Bundle"), L("Presets"), "menu_edit_preset", [](const json&) { diff --git a/src/slic3r/GUI/RecordingDialog.cpp b/src/slic3r/GUI/RecordingDialog.cpp index 5367fbca32..b8e33eac96 100644 --- a/src/slic3r/GUI/RecordingDialog.cpp +++ b/src/slic3r/GUI/RecordingDialog.cpp @@ -231,7 +231,7 @@ RecordingDialog::RecordingDialog(wxWindow* parent, const Mcp::RecordingSettings& wxTOP | wxBOTTOM, FromDIP(4)); m_quality = new SpinInput(this, wxEmptyString, "", wxDefaultPosition, wxSize(FromDIP(140), -1), wxSP_ARROW_KEYS, 30, 95, settings.quality); - m_quality->SetName("quality"); + m_quality->SetName("jpeg_quality"); auto* quality = new wxBoxSizer(wxVERTICAL); quality->Add(field_label(_L("JPEG quality")), 0, wxBOTTOM, FromDIP(4)); quality->Add(m_quality, 0); diff --git a/tests/data/command_catalog.json b/tests/data/command_catalog.json index 575930b223..970748796f 100644 --- a/tests/data/command_catalog.json +++ b/tests/data/command_catalog.json @@ -88,7 +88,7 @@ "additionalProperties": false, "properties": { "tab": { - "description": "The tab's id: home, prepare, preview, monitor, project, calibration, or a plugin page's id.", + "description": "The tab's id: home, prepare, preview, monitor (the Device tab, which set_view calls device), monitor_web (the web Device page, where the app shows one), multi_device, project, calibration, design, or a plugin page's id.", "type": "string" } }, @@ -371,7 +371,7 @@ "properties": {}, "type": "object" }, - "key": "toggle_run_script", + "key": "toggle_run_script_panel", "listed": false, "open_world": false, "operations": [], @@ -410,7 +410,7 @@ "additionalProperties": false, "properties": { "key": { - "description": "A preference on that tab, e.g. auto_arrange on behaviour: its control is scrolled into view and focused.", + "description": "With tab: a preference on that tab, e.g. auto_arrange on behaviour: its control is scrolled into view and focused.", "type": "string" }, "tab": { @@ -538,7 +538,7 @@ }, { "completion": "deferred", - "description": "Export the current plate's G-code. With a path, exports there without a dialog once the plate is sliced, in the background, and the call returns when the file is written; with no arguments, it opens the export dialog.", + "description": "Export the current plate's G-code. With a path, exports the sliced plate there without a dialog, in the background, and the call returns when the file is written; a plate that is not sliced is refused (slice first). With no arguments, it opens the export dialog.", "destructive": false, "group": "Slice & Export", "guard": "mutate", @@ -895,7 +895,7 @@ }, { "completion": "immediate", - "description": "Point the 3D camera: View: Top.", + "description": "Turn the 3D camera of Prepare, Preview or the assemble view to the top view, as set_view {camera: \"top\"} does there.", "destructive": false, "group": "View", "guard": "mutate", @@ -915,7 +915,7 @@ }, { "completion": "immediate", - "description": "Point the 3D camera: View: Bottom.", + "description": "Turn the 3D camera of Prepare, Preview or the assemble view to the bottom view, as set_view {camera: \"bottom\"} does there.", "destructive": false, "group": "View", "guard": "mutate", @@ -935,7 +935,7 @@ }, { "completion": "immediate", - "description": "Point the 3D camera: View: Front.", + "description": "Turn the 3D camera of Prepare, Preview or the assemble view to the front view, as set_view {camera: \"front\"} does there.", "destructive": false, "group": "View", "guard": "mutate", @@ -955,7 +955,7 @@ }, { "completion": "immediate", - "description": "Point the 3D camera: View: Rear.", + "description": "Turn the 3D camera of Prepare, Preview or the assemble view to the rear view, as set_view {camera: \"rear\"} does there.", "destructive": false, "group": "View", "guard": "mutate", @@ -975,7 +975,7 @@ }, { "completion": "immediate", - "description": "Point the 3D camera: View: Left.", + "description": "Turn the 3D camera of Prepare, Preview or the assemble view to the left view, as set_view {camera: \"left\"} does there.", "destructive": false, "group": "View", "guard": "mutate", @@ -995,7 +995,7 @@ }, { "completion": "immediate", - "description": "Point the 3D camera: View: Right.", + "description": "Turn the 3D camera of Prepare, Preview or the assemble view to the right view, as set_view {camera: \"right\"} does there.", "destructive": false, "group": "View", "guard": "mutate", @@ -1015,7 +1015,7 @@ }, { "completion": "immediate", - "description": "Point the 3D camera: View: Isometric.", + "description": "Turn the 3D camera of Prepare, Preview or the assemble view to the iso view, as set_view {camera: \"iso\"} does there.", "destructive": false, "group": "View", "guard": "mutate", @@ -1918,7 +1918,7 @@ }, { "completion": "immediate", - "description": "Add a Text object to the current plate.", + "description": "Add a text: a part on the selected object, or a new object when nothing is selected. It is created in the background (wait for idle), and the Text gizmo opens on it.", "destructive": false, "group": "Add Primitive", "guard": "mutate", @@ -1963,7 +1963,7 @@ }, { "completion": "immediate", - "description": "Add a Orca Cube object to the current plate.", + "description": "Add the Orca Cube and its plug to the current plate, then arrange the objects as the toolbar's Arrange does, which moves the others too.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -1983,7 +1983,7 @@ }, { "completion": "immediate", - "description": "Add a OrcaSliced Combo object to the current plate.", + "description": "Add the OrcaSliced Combo (the OrcaSliced model, the Orca Cube and its plug) to the current plate, then arrange the objects as the toolbar's Arrange does, which moves the others too.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2003,7 +2003,7 @@ }, { "completion": "immediate", - "description": "Add a Orca Badge object to the current plate.", + "description": "Add the Orca Badge model to the current plate.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2023,7 +2023,7 @@ }, { "completion": "immediate", - "description": "Add a Orca Tolerance Test object to the current plate.", + "description": "Add the Orca Tolerance Test model to the current plate.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2043,7 +2043,7 @@ }, { "completion": "immediate", - "description": "Add a 3DBenchy object to the current plate.", + "description": "Add the 3DBenchy model to the current plate.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2063,7 +2063,7 @@ }, { "completion": "immediate", - "description": "Add a Cali Cat object to the current plate.", + "description": "Add the Cali Cat model to the current plate.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2083,7 +2083,7 @@ }, { "completion": "immediate", - "description": "Add a Autodesk FDM Test object to the current plate.", + "description": "Add the Autodesk FDM Test model to the current plate.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2103,7 +2103,7 @@ }, { "completion": "immediate", - "description": "Add a Voron Cube object to the current plate.", + "description": "Add the Voron Cube model to the current plate.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2123,7 +2123,7 @@ }, { "completion": "immediate", - "description": "Add a Stanford Bunny object to the current plate.", + "description": "Add the Stanford Bunny model to the current plate.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2143,7 +2143,7 @@ }, { "completion": "immediate", - "description": "Add a Orca String Hell object to the current plate.", + "description": "Add the Orca String Hell model to the current plate.", "destructive": false, "group": "Add Handy models", "guard": "mutate", @@ -2341,7 +2341,7 @@ "input_schema": { "additionalProperties": false, "properties": { - "slot": { + "filament_slot": { "description": "The 1-based filament slot. Default: the last physical slot, as the - button.", "minimum": 1, "type": "integer" @@ -2710,7 +2710,7 @@ }, { "completion": "immediate", - "description": "Benchmark rendering of the current 3D scene.", + "description": "Time the 3D views on a test model. It asks first (Start or Cancel), then replaces the project with the OrcaSliced Combo as New Project does, which may ask about unsaved changes, slices it and shows the results.", "destructive": false, "group": "Help", "guard": "mutate", @@ -2870,7 +2870,7 @@ }, { "completion": "immediate", - "description": "Open the plugin hub to install a plugin.", + "description": "Open the plugin hub's page in the default web browser, where a person picks a plugin to install; nothing opens in OrcaSlicer.", "destructive": false, "group": "Plugins", "guard": "mutate", @@ -2935,7 +2935,7 @@ }, { "completion": "immediate", - "description": "Block until a condition holds or timeout_s passes (max 50). for: \"ready\" (startup finished), \"idle\" (no dialog, no running job, nothing slicing or arranging, no gizmo working in the background; a run_script run counts only through the calls it makes), \"dialog\" / \"no_dialog\", or \"job\" with a job id an earlier call returned, whose result is then the reply. On timeout the reply is {satisfied: false}: call it again.", + "description": "Block until a condition holds or timeout_s passes (max 50). for: \"ready\" (startup finished), \"idle\" (no dialog, no running job, nothing slicing or arranging, no gizmo working in the background; a run_script run counts only through the calls it makes), \"dialog\" / \"no_dialog\", or \"job\" with a job id an earlier call returned, whose result is then the reply. On timeout the reply is {satisfied: false}, or for a job {status: \"running\", job, note}: call it again.", "destructive": false, "group": "core", "guard": "inspect", @@ -3087,7 +3087,7 @@ }, { "completion": "immediate", - "description": "Open model files (STL, 3MF, STEP, OBJ, AMF, SVG...), a project (.3mf) or G-code by absolute path, without a file dialog. Models are added to the current project. A .3mf opens as a project, replacing the current one, unless as is \"geometry\"; when the current project has unsaved changes that fails, changing nothing, unless discard_changes. Importing can open a dialog (STEP mesh options, for instance); the reply is then blocked_by_dialog.", + "description": "Open model files (STL, 3MF, STEP, OBJ, AMF, SVG...), a project (.3mf) or G-code by absolute path, without a file dialog. Models are added to the current project. A .3mf given alone opens as a project, replacing the current one, unless as is \"geometry\"; when the current project has unsaved changes that fails, changing nothing, unless discard_changes. Given with other paths, a .3mf adds its models only. A G-code given alone replaces the project too, to show its toolpaths: with unsaved changes the app asks first (blocked_by_dialog), whatever discard_changes says. Importing can open a dialog (STEP mesh options, for instance); the reply is then blocked_by_dialog.", "destructive": false, "group": "api", "guard": "mutate", @@ -3097,7 +3097,7 @@ "additionalProperties": false, "properties": { "as": { - "description": "How to open .3mf files. Default auto (= project).", + "description": "How a .3mf given alone opens: as a project (auto, the default, and project) or adding its models only (geometry).", "enum": [ "auto", "geometry", @@ -3134,7 +3134,7 @@ }, { "completion": "immediate", - "description": "Start a new, empty project. Called with no arguments, it asks as New Project does, about the unsaved changes if there are any: the reply is then blocked_by_dialog, and answer_dialog answers it. With arguments, or silent: true, it asks nothing: it fails, changing nothing, when the current project has unsaved changes, unless discard_changes. The presets' unsaved changes carry over to the new project unless preset_changes is \"discard\", as New Project's prompt offers. Reply: objects, names, plates; when presets had or have unsaved changes, discarded and modified list per preset the keys dropped and the keys still unsaved.", + "description": "Start a new, empty project. Called with no arguments, it asks as New Project does, about the unsaved changes if there are any: the reply is then blocked_by_dialog, and answer_dialog answers it. With arguments, or silent: true, it asks nothing: it fails, changing nothing, when the current project has unsaved changes, unless discard_changes. The presets' unsaved changes carry over to the new project unless preset_changes is \"discard\", as New Project's prompt offers. Reply, with arguments: objects, names, plates; when presets had or have unsaved changes, discarded and modified list per preset the keys dropped and the keys still unsaved. With no arguments the reply is ran and level, also once a prompt is answered, whatever the answer: Cancel keeps the project.", "destructive": false, "group": "Commands", "guard": "mutate", @@ -3194,7 +3194,7 @@ "type": "array" }, "auto_adjust": { - "description": "vfa: lower the layer height, else the end speed, to stay within the filament's maximum volumetric speed (default true).", + "description": "vfa: lower the layer height, else the end speed, to stay within the filament's maximum volumetric speed (default true); only with auto_scale.", "type": "boolean" }, "auto_scale": { @@ -3323,7 +3323,7 @@ }, { "completion": "immediate", - "description": "Save the project. Called with no arguments, it saves as Save Project does: to the project's file, or, when it has none, through a file dialog (blocked_by_dialog; a native picker needs auto_answer_dialogs registered first). With path, it saves a .3mf there without a dialog, and the file becomes the project's. A save that writes nothing (a dialog cancelled, the file not written) fails with project_not_saved, and a file already there stays as it was.", + "description": "Save the project. Called with no arguments, it saves as Save Project does: to the project's file (reply: ran, level), or, when it has none, through a file dialog (blocked_by_dialog; a native picker needs auto_answer_dialogs registered first). With path, it saves a .3mf there without the file dialog, and the file becomes the project's (reply: path, bytes); a name ending in .gcode.3mf is refused (export writes that). Either way the save can still open a dialog (blocked_by_dialog): a warning when settings name a plugin OrcaSlicer cannot identify, or an error when the file cannot be written. A save that writes nothing, its file dialog or that warning cancelled or the write failed, fails with project_not_saved, and a file already there stays as it was.", "destructive": false, "group": "Commands", "guard": "mutate", @@ -3344,7 +3344,7 @@ "type": "string" }, "silent": { - "description": "true runs the command without asking, with the defaults of what the call leaves out. A call with no arguments does what a person's pick does.", + "description": "Goes with path, which any argument makes required, and adds nothing to it: a call with path skips the file dialog already.", "enum": [ true ], @@ -3369,7 +3369,7 @@ }, { "completion": "immediate", - "description": "Write the project to a file without a dialog. gcode: the plate's G-code (slice first; it is written in the background, and the call returns once it is). sliced_3mf: the sliced plate, or all plates, as .gcode.3mf. 3mf: the model without slicing data. stl: all objects as one STL. Without format, the path's extension (.gcode, .gcode.3mf, .3mf, .stl) says which.", + "description": "Write the project to a file without a dialog. gcode: the plate's G-code (slice first; it is written in the background, and the call returns once it is). sliced_3mf: the sliced plate, or all plates, as .gcode.3mf (slice first: a plate that is not sliced is written without G-code). 3mf: the model without slicing data. stl: all objects as one STL. Both hold every plate's objects. Without format, the path's extension (.gcode, .gcode.3mf, .3mf, .stl) says which. Reply: path and bytes; for gcode, path and export (ok, or superseded with a note when the project changed while it was written).", "destructive": false, "group": "api", "guard": "mutate", @@ -3397,7 +3397,7 @@ "type": "string" }, "plates": { - "description": "\"current\" (default), a plate index, which is selected first, or \"all\" (sliced_3mf only).", + "description": "\"current\" (default), a plate index, which is selected first and is the plate gcode and sliced_3mf write, or \"all\" (sliced_3mf only).", "type": [ "string", "integer" @@ -3423,7 +3423,7 @@ }, { "completion": "immediate", - "description": "Printer, process or filament presets with flags: system or user, selected (and modified), compatible with the selected printer, and for filaments the slots using them. Only compatible, visible presets unless asked: a fresh install hides most system filaments and printers (visible: false), and select_preset takes those too.", + "description": "Printer, process or filament presets, each with its name, alias (the name its selector shows, when another), system, user, project (kept inside the project), inherits, selected (and modified), compatible: false or visible: false when so, and for a filament the slots using it (filament_slots). Only compatible, visible presets unless asked: a fresh install hides most system filaments and printers, and select_preset takes a hidden one too.", "destructive": false, "group": "api", "guard": "inspect", @@ -3451,7 +3451,7 @@ "type": "integer" }, "query": { - "description": "Case-insensitive part of the name.", + "description": "Case-insensitive part of the name or alias.", "type": "string" }, "type": { @@ -3478,7 +3478,7 @@ }, { "completion": "immediate", - "description": "Select a printer, process or filament preset by the name its selector shows (or its internal name), as a person would. A hidden one (list_presets include_hidden) is shown in the selectors first, until the app restarts. With unsaved changes the Transfer-or-discard prompt opens (blocked_by_dialog) unless preset_changes answers it. A filament is assigned to filament_slot (1-based, default 1). Reply: selected, shown (a hidden preset it showed); when presets had or have unsaved changes, discarded and modified list per preset the keys dropped and the keys still unsaved.", + "description": "Select a printer, process or filament preset by the name its selector shows (or its internal name), as a person would. A hidden one (list_presets include_hidden) is shown in the selectors first, until the app restarts; one the selector leaves out as incompatible with the printer is refused. With unsaved changes the Transfer-or-discard prompt opens (blocked_by_dialog) unless preset_changes answers it. A filament is assigned to filament_slot (1-based, default 1); with several slots the filament tab keeps the preset and the changes it has, so nothing is asked. Reply: selected, shown (a hidden preset it showed); when presets had or have unsaved changes, discarded and modified list per preset the keys dropped and the keys still unsaved.", "destructive": false, "group": "api", "guard": "mutate", @@ -3497,7 +3497,7 @@ "type": "string" }, "preset_changes": { - "description": "Unsaved changes of the presets the switch replaces: move them to the new preset or drop them, as the prompt's buttons do. Omitted: the prompt opens.", + "description": "Unsaved changes of the presets the switch replaces: move them to the new preset or drop them, as the prompt's buttons do; transfer is refused where the prompt does not offer it (a printer's changes, a filament of another type). Omitted: the prompt opens.", "enum": [ "transfer", "discard" @@ -3533,7 +3533,7 @@ }, { "completion": "immediate", - "description": "Save the printer, process or filament preset being edited, with its unsaved changes, as a preset called name, which is then selected: what the tab's Save button does through its dialog. A filament is filament_slot's (default 1), and every slot using the old preset takes the new one. Replacing another existing preset needs overwrite (pass it in replays and scripts meant to be rerun). Reply: saved, user, project, inherits, filament_slots. A temperature warning or an unsaved-changes prompt makes it blocked_by_dialog. To keep only some edits, set_settings {reset_all: true, values} first.", + "description": "Save the printer, process or filament preset being edited, with its unsaved changes, as a preset called name, which is then selected: what the tab's Save button does through its dialog. A filament is filament_slot's (default 1), and every slot using the old preset takes the new one. Replacing another existing preset needs overwrite (pass it in replays and scripts meant to be rerun). Reply: saved, selected, user, project, inherits, filament_slots. A temperature warning or an unsaved-changes prompt makes it blocked_by_dialog. To keep only some edits, set_settings {reset_all: true, values} first.", "destructive": false, "group": "api", "guard": "mutate", @@ -3552,7 +3552,7 @@ "type": "integer" }, "inside_project": { - "description": "Keep it inside the project, not as a user preset. Default: where the edited preset is.", + "description": "Keep it inside the project, not as a user preset. Default: where the edited preset is. A preset of that name stays where it is.", "type": "boolean" }, "name": { @@ -3588,7 +3588,7 @@ }, { "completion": "immediate", - "description": "Delete a user preset or one inside the project, its file and its cloud copy, as the tab's Delete does, without asking. A selected preset is replaced as the tab does (its parent or the next preset). Another filament is deleted without changing the selection, and slots using it take the selected one; another process is selected, deleted and the selection restored; a printer must be selected first. Refused: system presets, presets others inherit from, another preset while the edited one of its type has unsaved changes. Deleting a selected printer or process can ask about other presets' unsaved changes (blocked_by_dialog). Reply: deleted, selected, filaments (per slot), attached, and discarded/modified as select_preset's.", + "description": "Delete a user preset or one inside the project, its file and its cloud copy, as the tab's Delete does, without asking. A selected preset is replaced as the tab does (its parent or the next preset). Another filament is deleted without changing the selection, and slots using it take the selected one; another process is selected, deleted and the selection restored; a printer must be selected first, and the physical printers that use only it are deleted with it. Refused: system, default and bundle presets, presets others inherit from, another preset while the edited one of its type has unsaved changes. Deleting a selected printer or process can ask about other presets' unsaved changes (blocked_by_dialog). Reply: deleted, selected, filaments (per slot), attached, and discarded/modified as select_preset's.", "destructive": true, "group": "api", "guard": "mutate", @@ -3598,7 +3598,7 @@ "additionalProperties": false, "properties": { "delete_attached": { - "description": "A custom printer: also delete the process and filament presets made for it alone, which the GUI deletes with it.", + "description": "A custom printer with process or filament presets made for it alone is refused without this: they are deleted with it, as the GUI deletes them.", "type": "boolean" }, "name": { @@ -3630,7 +3630,7 @@ }, { "completion": "immediate", - "description": "Read settings: each item has its value, as OrcaSlicer writes it, and meta: label, description (what the setting does, when to change it), where (its settings page and group), type, unit, range, allowed values and mode. Choose them by keys; by query, a few words matched in keys, labels and descriptions, best matches first; by where, a page or group (an unknown one lists them all); or by none of these, for the whole scope, paged and, in a preset scope, without meta. Keys the scope lacks are listed in unknown_keys, and scope_of gives the scope of those another scope has.\n- No scope: keys and query look through the process, filament and printer settings, and each item names its scope, the one set_settings takes; anything else reads the process.\n- process, filament, printer: the preset being edited, or with preset a saved one; compare lists only the keys that differ from another preset (value and other). A per-variant value lists in meta its variants (what each entry is for) and active (the entry each extruder prints with).\n- object, part: the overrides that object or part carries, each with effective (the value it prints with) and source (part, object, process or default); an object's item lists in parts the parts and modifiers that override the key inside their own volume.\n- project: the plate type, slot colours, flushing volumes, purge mode, prime tower position per plate, mixed slots and, with several extruders, the filament grouping; meta.offered lists the choices this printer has.\n- plate: a plate's curr_bed_type, print_sequence, spiral_mode, first_layer_print_sequence, other_layers_print_sequence, name and locked, each with value (the plate's own, null where it follows the global setting or Auto) and effective.\n- preferences: the named keys of the app configuration (the Preferences dialog's settings, keys as its controls are named), as stored; it lists none unasked.", + "description": "Read settings: each item has its value, as OrcaSlicer writes it, and meta: label, description (what the setting does, when to change it), where (its settings page and group), type, unit, range, allowed values and mode. Choose them by keys; by query, a few words matched in keys, labels and descriptions, best matches first; by where, a page or \"Page > Group\" (an unknown one is refused with the list of them); or by none of these, for the whole scope, paged and, in a preset scope, without meta. Keys the scope lacks are listed in unknown_keys, and scope_of gives the scope of those another scope has.\n- No scope: keys and query look through the process, filament and printer settings, and each item names its scope, the one set_settings takes; anything else reads the process.\n- process, filament, printer: the preset being edited, or with preset a saved one; compare lists only the keys that differ from another preset (value and other). A per-variant value lists in meta its variants (what each entry is for) and active (the entry each extruder prints with).\n- object, part: listed whole, the overrides that object or part carries; keys, query and where read any process setting there. Each has effective (the value it prints with) and source (part, object, process or default); an object's item lists in parts the parts and modifiers that override the key inside their own volume.\n- project: the plate type, slot colours, flushing volumes, purge mode, prime tower position per plate, mixed slots and, with several extruders, the filament grouping; meta.offered lists the choices this printer has.\n- plate: a plate's curr_bed_type, print_sequence, spiral_mode, first_layer_print_sequence, other_layers_print_sequence, name and locked, each with value (the plate's own, null where it follows the global setting or Auto) and effective.\n- preferences: the named keys of the app configuration (the Preferences dialog's settings, keys as its controls are named), as stored; it lists none unasked.", "destructive": false, "group": "api", "guard": "inspect", @@ -3644,7 +3644,7 @@ "type": "string" }, "filament_slot": { - "description": "Filament slot, 1-based.", + "description": "Filament scope: the slot whose preset is read, 1-based (default 1), with its unsaved changes when the filament tab is editing it.", "minimum": 1, "type": "integer" }, @@ -3722,7 +3722,7 @@ }, { "completion": "immediate", - "description": "Change settings of one scope (default the process) as typing them into its settings tab would. Values are strings in OrcaSlicer's format (\"15%\", \"0.2\", \"1,2\") or JSON numbers, booleans and arrays (a point as [x, y]). All are parsed strictly first and applied together, so nothing changes if one is invalid, and a key of another scope is refused with that scope named. Reply: applied, and changed, every setting the call changed, including those the app adjusted in turn. One undo step. Spiral vase and a few others confirm their adjustments in a dialog (blocked_by_dialog).\n- process, filament, printer: null takes a key back to its saved value, or with reset_to parent to the parent's; reset_all first discards every unsaved change, as the tab's undo button does (reply: reverted). A per-variant value (get_settings meta.variants) takes one value for the entries in use (meta.active), {index, value} for one entry, or an array of all.\n- object, part: overrides of the keys the object list offers there; null removes one. extruder is the object's or part's filament (1-based; 0 or null for Default), set as the Change Filament menu does.\n- project, as the sidebar's controls write them: curr_bed_type, filament_colour (#RRGGBB per slot), flush_multiplier, flush_volumes_matrix, prime_volume_mode, and wipe_tower_x/y (mm from the plate's origin, one per plate). flush_volumes_matrix is per nozzle, slots x slots from row to column, in config order over every slot, before the multiplier; mixed slots' entries are left as they are, and a colour change can recalculate it, so set it last.\n- plate, which it selects and writes as the Plate Settings dialog's OK does: curr_bed_type, print_sequence (\"by layer\", \"by object\"), spiral_mode (true asks for confirmation), first_layer_print_sequence (every slot once, e.g. [2, 1]), other_layers_print_sequence ([{from: layer >= 2, to, order}], to omitted for the last layer), name and locked; null returns a value to the global setting or Auto.", + "description": "Change settings of one scope (default the process) as typing them into its settings tab would. Values are strings in OrcaSlicer's format (\"15%\", \"0.2\", \"1,2\") or JSON numbers, booleans and arrays (a point as [x, y]). All are parsed strictly first and applied together, so nothing changes if one is invalid, and a key of another scope is refused with that scope named. Reply: applied, and changed, every setting the call changed, including those the app adjusted in turn. An object's, part's or plate's change is one undo step; a preset's is not in the undo history. Spiral vase and a few others confirm their adjustments in a dialog (blocked_by_dialog).\n- process, filament, printer: null takes a key back to its saved value, or with reset_to parent to the parent's; reset_all first discards every unsaved change, as the tab's undo button does (reply: reverted). A per-variant value (get_settings meta.variants) takes one value for the entries in use (meta.active), {index, value} for one entry, or an array of all.\n- object, part: overrides of the keys the object list offers there; null removes one. extruder is the object's or part's filament (1-based; 0 or null for Default), set as the Change Filament menu does.\n- project, as the sidebar's controls write them: curr_bed_type, filament_colour (#RRGGBB per slot), flush_multiplier, flush_volumes_matrix, prime_volume_mode, and wipe_tower_x/y (mm from the plate's origin, one per plate). flush_volumes_matrix is per nozzle, slots x slots from row to column, in config order over every slot, before the multiplier; a mixed slot's entries must be given as they are, and a colour change can recalculate it, so set it last.\n- plate, which it selects and writes as the Plate Settings dialog's OK does: curr_bed_type, print_sequence (\"by layer\", \"by object\"), spiral_mode (true asks for confirmation), first_layer_print_sequence (every slot once, e.g. [2, 1]), other_layers_print_sequence ([{from: layer >= 2, to, order}], to omitted for the last layer), name and locked; null returns a value to the global setting or Auto.", "destructive": false, "group": "api", "guard": "mutate", @@ -3732,7 +3732,7 @@ "additionalProperties": false, "properties": { "filament_slot": { - "description": "Filament slot, 1-based.", + "description": "Filament scope: the slot whose preset is changed, 1-based (default 1). The filament tab switches to it, which can ask about the unsaved changes it holds (blocked_by_dialog).", "minimum": 1, "type": "integer" }, @@ -3836,7 +3836,7 @@ }, { "completion": "immediate", - "description": "The project as the Objects panel lists it. plates: each {index, name, objects}, with the objects that have an instance on it; outside: the objects with an instance on no plate. An object with instances on two plates is listed under both, each time with that plate's instances. An object has its filament, auto_drop, bounding box (instance 0), brim ear count and the settings it overrides; its instances (offset, rotation in degrees, scale, mirrored, bbox); its parts, one or more: parts, negative parts, modifiers, support blockers and enforcers and precise seams (type, with subtype for a precise seam; filament: a part's own or its object's, a modifier's only when it sets one; position, bbox and scaled_volume in mm3 on the bed, measured on instance 0; rotation_deg and scale in the object's frame; mirrored; triangle count; mesh_volume, the unscaled mesh's mm3; painted facets: supports and seam enforcers/blockers, fuzzy_skin, mmu per filament, texture per layer; a text part's text and font, an SVG part's file); its height range modifiers when it has any (layer_config_ranges: [{min_z, max_z, values}], as set_height_ranges takes them) and its variable layer height profile when it has one (layer_height_profile: {points, min_height, max_height}). A bbox is {min, max, size} in mm of model parts only, so unlike the panel's Size it leaves out modifiers. An object's index numbers it in the project and a part's in its object, whatever the plate: they are what select_objects, transform, mouse_gesture targets and the object/part settings scopes take. Each object and part also has an id, which stays with it when a delete, split or assemble shifts the indices: pass it as object_id / part_id to transform, add_part, set_settings, set_height_ranges and set_variable_layer_height (object_ids, part_ids and instance_object_ids to select_objects), and a call whose index names another one now is refused instead of acting on it. limit and offset page the objects and total counts them, each once.", + "description": "The project as the Objects panel lists it. plates: each {index, name, objects}, with the objects that have an instance on it; outside: the objects with an instance on no plate. An object with instances on two plates is listed under both, each time with that plate's instances. An object has its filament, auto_drop, bounding box (instance 0), brim ear count and overrides, the keys of the settings it overrides (get_settings scope object reads them); its instances (offset, rotation in degrees, scale, mirrored, bbox); its parts, one or more: parts, negative parts, modifiers, support blockers and enforcers and precise seams (type, with subtype for a precise seam; filament: a part's own or its object's, a modifier's only when it sets one; position, bbox and scaled_volume in mm3 on the bed, measured on instance 0; rotation_deg and scale in the object's frame; mirrored; triangle count; mesh_volume, the unscaled mesh's mm3; painted facets: supports and seam enforcers/blockers, fuzzy_skin, mmu per filament, texture per layer; a text part's text and font, an SVG part's file); its height range modifiers when it has any (layer_config_ranges: [{min_z, max_z, values}], as set_height_ranges takes them) and its variable layer height profile when it has one (layer_height_profile: {points, min_height, max_height}). A bbox is {min, max, size} in mm of model parts only, so unlike the panel's Size it leaves out modifiers. An object's index numbers it in the project and a part's in its object, whatever the plate: they are what select_objects, transform, mouse_gesture targets and the object/part settings scopes take. Each object and part also has an id, which stays with it when a delete, split or assemble shifts the indices: pass it as object_id / part_id to transform, add_part, set_settings, set_height_ranges and set_variable_layer_height (object_ids, part_ids and instance_object_ids to select_objects), and a call whose index names another one now is refused instead of acting on it. limit and offset page the objects and total counts them, each once.", "destructive": false, "group": "api", "guard": "inspect", @@ -3876,7 +3876,7 @@ }, { "completion": "immediate", - "description": "Select objects, instances or parts in the 3D view (the assemble view while it is shown, else Prepare, switching to it), as clicking them would. Give objects, instances ([[object, instance], ...]) or parts ([[object, part], ...]); add keeps the current selection; all / none select everything or nothing. The reply is the selection as get_app_state.selection gives it.", + "description": "Select objects, instances or parts in the 3D view (the assemble view while it is shown, else Prepare, switching to it), as clicking them would. Give objects, instances ([[object, instance], ...]) or parts ([[object, part], ...]); add keeps the current selection; all / none select everything or nothing, whatever else is given. The reply is the selection as get_app_state.selection gives it.", "destructive": false, "group": "ui", "guard": "mutate", @@ -3951,7 +3951,7 @@ }, { "completion": "immediate", - "description": "Change one instance's placement, or one part's with part. translate is in mm, position where it goes (mm, as the Move panel shows it, whatever mode says), rotate in degrees about X/Y/Z, scale a factor (one number or [x, y, z]), size [x, y, z] mm along the object's or part's own axes, plate moves the instance onto that plate at the same place. mode \"relative\" (default) adds to the current placement, \"absolute\" sets it. An instance is dropped back onto the bed unless drop_to_bed is false. A part moves as the Object manipulation panel moves it: translate and rotate along the bed's axes, measured on instance 0, scale and size along its own axes; every instance shows the change, and Auto Drop may lower the object afterwards. One undo step. Reply: the instance's offset, scale and plate, or the part's size along its own axes and its list_objects entry (part_info).", + "description": "Change one instance's placement, or one part's with part. translate is in mm, position where it goes (mm, as the Move panel shows it, whatever mode says), rotate in degrees about X/Y/Z, scale a factor (one number or [x, y, z]), size [x, y, z] mm along the object's or part's own axes, plate moves the instance onto that plate at the same place. mode \"relative\" (default) adds to the current placement (a scale multiplies it), \"absolute\" sets it. An instance is dropped back onto the bed, unless its object's auto_drop is off; drop_to_bed false lets it sink into the bed, but an object of one part left above the bed still drops. A part moves as the Object manipulation panel moves it: translate and rotate along the bed's axes, measured on instance 0, scale and size along its own axes; every instance shows the change, and Auto Drop may lower the object afterwards. One undo step. Reply: the instance's offset, scale and plate, or the part's size along its own axes and its list_objects entry (part_info).", "destructive": false, "group": "api", "guard": "mutate", @@ -4132,7 +4132,7 @@ }, { "completion": "immediate", - "description": "Arrange the objects of every unlocked plate as the toolbar's Arrange does, or of one plate (plates: an index or \"current\") as its Arrange icon does. With fill, fill that object's plate with more of it instead, as Fill bed with instances (or copies, by fill_with) does. spacing, rotate, align_y and multi_material are the Arrange options panel's settings: the values given stay in the panel, so later arranges use them too. Waits for the arrangement (a longer one replies with a job). Reply: the settings in force, instances left off every plate, plates the all-plates arrange skipped and the job's notifications. An arrange may reorder objects, so list_objects again. One undo step.", + "description": "Arrange the objects of every unlocked plate as the toolbar's Arrange does, or of one plate (plates: an index or \"current\") as its Arrange icon does. With fill_object, fill that object's plate with more of it instead, as Fill bed with instances (or copies, by fill_with) does (reply: added, how many). spacing, rotate, align_y and multi_material are the Arrange options panel's settings: the values given stay in the panel, so later arranges use them too. Waits for the arrangement (a longer one replies with a job). Reply: the settings in force, instances left off every plate, plates the all-plates arrange skipped and the job's notifications. An arrange may reorder objects, so list_objects again. One undo step.", "destructive": false, "group": "api", "guard": "mutate", @@ -4145,8 +4145,8 @@ "description": "Align to Y axis (off while rotate is on).", "type": "boolean" }, - "fill": { - "description": "Instead of arranging, fill this object's plate with more of it.", + "fill_object": { + "description": "An object index: instead of arranging, fill that object's plate with more of it.", "minimum": 0, "type": "integer" }, @@ -4215,7 +4215,7 @@ ] }, "timeout_s": { - "description": "Give up after this long (default 1800).", + "description": "Stop waiting after this long (default 1800): the call fails, and the slice goes on unless cancel_job stops it.", "maximum": 7200, "minimum": 10, "type": "integer" @@ -4234,7 +4234,7 @@ }, { "completion": "immediate", - "description": "Stop the running operation: a slice or G-code export, as the slicing progress's cancel button does, or a background job an MCP call started (an arrange, orient or fill bed). Its job then reports cancelled; a background job keeps other changes out until it has really stopped. With job, only that job is stopped: the running operation, a run_script run or an encode_recording. Allowed while an operation holds the project.", + "description": "Stop the running operation: a slice or G-code export, as the slicing progress's cancel button does, or a background job an MCP call started (an arrange, orient or fill bed). Its job then reports cancelled; a background job keeps other changes out until it has really stopped. With job, only that job is stopped: the running operation, a run_script run or an encode_recording. Allowed while an operation holds the project. Reply: was_running, and job when one was stopped.", "destructive": false, "group": "core", "guard": "recover", @@ -4382,7 +4382,7 @@ }, { "completion": "immediate", - "description": "Add or remove pauses, custom G-code, custom templates and filament changes at the start of a layer, as the Preview layer slider's menu does; they are saved per plate in the project. They go on the plate's sliced layers, so the plate needs an up-to-date slice, or must be the one the Preview still shows after an earlier edit; the call selects it and shows the Preview. Applies clear, then remove, then add, all checked first. One code per layer: a custom code or filament change where there is one replaces it. Not undoable, as in the slider. A change invalidates the plate's slice: slice again before exporting. Reply: the plate's codes as list_plates' layer_gcode lists them, each with z and layer.", + "description": "Add or remove pauses, custom G-code, custom templates and filament changes at the start of a layer, as the Preview layer slider's menu does; they are saved per plate in the project. They go on the plate's sliced layers, so the plate needs an up-to-date slice, or must be the one the Preview still shows after an earlier edit; the call selects it and shows the Preview. Applies clear, then remove, then add, all checked first. One code per layer: adding where a code of the same type is replaces it, and where another type is, is refused (remove it first). Not undoable, as in the slider. A change invalidates the plate's slice: slice again before exporting. Reply: the plate's codes as list_plates' layer_gcode lists them, each with z and layer.", "destructive": false, "group": "api", "guard": "mutate", @@ -4570,7 +4570,7 @@ }, { "completion": "immediate", - "description": "Set up what the window shows, for screenshots and GUI work: the main tab, the 3D view (canvas: Prepare's, the preview or the assemble view, which has its own gizmos), the camera of the 3D view shown (a named direction, the default view, or fit to bed / objects / selection, then look_at, the point it looks at, an orbit to look from between the named directions, and the zoom), the preview's color scheme (picked as in the legend's combo, which shows every feature type again), legend rows, time estimate and layers (1-based, or up to a height). Only the given fields change. On the Design tab the camera points its view (default is its Home view; no fit_bed). The reply echoes them; preview layers as [first, last, count] with z, the heights of first and last; with any camera field, camera_state, the camera it leaves as get_app_state.camera gives it, and adjusted: [\"zoom\"] when the zoom was held to its limits.", + "description": "Set up what the window shows, for screenshots and GUI work: the main tab, the 3D view (canvas: Prepare's, the preview or the assemble view, which has its own gizmos), the camera of the 3D view shown (a named direction, the default view, or fit to bed / objects / selection, then look_at, the point it looks at, an orbit to look from between the named directions, and the zoom), the preview's color scheme (picked as in the legend's combo, which shows every feature type again), legend rows, time estimate and layers (1-based, or up to a height). Only the given fields change, but a preview field given without tab or canvas shows the Preview tab. On the Design tab the camera points its view (default is its Home view; no fit_bed). The reply echoes them; preview layers as [first, last, count] with z, the heights of first and last; with any camera field, camera_state, the camera it leaves as get_app_state.camera gives it, and adjusted: [\"zoom\"] when the zoom was held to its limits.", "destructive": false, "group": "ui", "guard": "mutate", @@ -4702,11 +4702,11 @@ "show_layer_range" ], "read_only": false, - "title": "Point the view" + "title": "Set up the view" }, { "completion": "immediate", - "description": "Replay a list of tool calls in order and report each step: {orca_replay:1, name, vars, steps:[{tool, args, expect, optional, await, save_as, timeout_s}]}, JSON with comments. Strings may use ${replay_dir}, ${out_dir}, ${env:NAME}, ${vars.NAME} and ${jobs.NAME}. A step that returns a job is awaited unless await:false, which stores the job under save_as so later steps can answer the dialog it opened. expect maps a JSON pointer into the step's result to matchers (eq ne gt ge lt le contains regex exists empty); the first failed step or expectation stops the run unless the step is optional. Writes result.json to out_dir (default: .out next to a replay file). auto_answer_dialogs rules a replay registers end with it. export_replay turns this session into one.", + "description": "Replay a list of tool calls in order and report each step: {orca_replay:1, name, vars, steps:[{tool, args, expect, optional, await, save_as, timeout_s}]}, JSON with comments. Strings may use ${replay_dir}, ${out_dir}, ${env:NAME}, ${vars.NAME} and ${jobs.NAME}. A step that returns a job is awaited unless await:false, which stores the job under save_as so later steps can answer the dialog it opened. expect maps a JSON pointer into the step's result to matchers (eq ne gt ge lt le contains regex exists empty); the first failed step or expectation stops the run unless the step is optional. Writes result.json to out_dir (default: the replay file's name with .out, beside it; for an inline replay, replay- in the session's output folder). Reply: passed, steps, failed_step, out_dir and result_file. auto_answer_dialogs rules a replay registers end with it. export_replay turns this session into one.", "destructive": false, "group": "core", "guard": "mutate", @@ -4746,7 +4746,7 @@ }, { "completion": "immediate", - "description": "Turn the calls this session made into a replay that run_replay runs: mutating calls, wait and screenshot, in order, with refs replaced by locators, job replies replayed with await:false, and screenshot paths moved under ${out_dir}. Calls that failed, at once or as a job later, are left out; so is a call whose job is still running (unless it waits on a dialog), which left_out_running lists as {tool, job}. Reply: the replay, which with path is also written there. clear:true starts a new recording afterwards.", + "description": "Turn the calls this session made into a replay that run_replay runs: mutating calls, wait, screenshot and the recording tools, in order, with refs replaced by locators, job replies replayed with await:false, and screenshot and recording paths moved under ${out_dir}. Calls that failed, at once or as a job later, are left out (a run_script that raised or timed out replied, so it stays); so is a call whose job is still running (unless it waits on a dialog), which left_out_running lists as {tool, job}. Reply: the replay, which with path is also written there. clear:true then forgets the calls made so far.", "destructive": false, "group": "core", "guard": "inspect", @@ -4783,7 +4783,7 @@ }, { "completion": "immediate", - "description": "Run Python code inside OrcaSlicer as its main program (__name__ == \"__main__\") against orca.host, the whole plugin API (search_python_api searches it): read objects, meshes and settings, compute, use orca.host.ui and the preset API, and call these same tools, with their guards and undo, through orca.host.tools.call(name, args), from the code and from the threads and pool tasks it starts while the run lasts. Mesh and matrix arrays need numpy, which search_python_api says is installed or not; a file run's PEP 723 block can install it. The code runs on a worker thread, where calls documented as UI thread only raise RuntimeError. The run ends once its code and the non-daemon threads and pool tasks it started are done; its windows close with it. `args` holds the args you pass; set `result` to a JSON value to return it; print() output comes back as output. Reply: {status: finished | raised | cancelled | timed_out, result, output, traceback?, message?}; a script that raised changed what it changed before. The code's own file access is held to OrcaSlicer's folders (its data and resources folders, and for a file run the file's folder, read only), and it starts no programs or threads and reaches no network: such an access raises PermissionError, unless a person has let Python scripts run unrestricted in Preferences (get_app_state.python.scripts_unrestricted); the tools it calls work as they do for you. Recorded by export_replay as one step with its code, which a replay runs again against the project as it is then.", + "description": "Run Python code inside OrcaSlicer as its main program (__name__ == \"__main__\") against orca.host, the whole plugin API (search_python_api searches it): read objects, meshes and settings, compute, use orca.host.ui and the preset API, and call these same tools, with their guards and undo, through orca.host.tools.call(name, args). Mesh and matrix arrays need numpy, which search_python_api says is installed or not; a file run's PEP 723 block can install it. The code runs on a worker thread, where calls documented as UI thread only raise RuntimeError. The run ends once its code and the non-daemon threads and pool tasks it started are done; its windows close with it. `args` holds the args you pass; set `result` to a JSON value to return it; print() output comes back as output. Reply: {status: finished | raised | cancelled | timed_out, result, output, traceback?, message?}; a script that raised changed what it changed before. The code's own file access is held to OrcaSlicer's folders (its data folder, and read only its resources folder and, for a file run, the file's folder), and it starts no programs or threads and reaches no network: such an access raises PermissionError, unless a person has let Python scripts run unrestricted in Preferences (get_app_state.python.scripts_unrestricted), when the threads and pool tasks it starts call the tools too while the run lasts; the tools it calls work as they do for you. Recorded by export_replay as one step with its code, which a replay runs again against the project as it is then.", "destructive": false, "group": "core", "guard": "mutate", @@ -4801,7 +4801,7 @@ "type": "string" }, "filename": { - "description": "The name tracebacks show for the code (default ). An existing file's path makes it a file run, as `python file.py` runs it: __file__, sys.argv, imports from its folder and its PEP 723 dependencies; any other name only names it.", + "description": "The name tracebacks show for the code (default ). An existing file's path makes it a file run, as `python file.py` runs it: __file__, sys.argv, imports from its folder and its PEP 723 dependencies; any other name only names it. What runs is still `code`: pass the file's text there.", "type": "string" }, "timeout_s": { @@ -4907,6 +4907,12 @@ "minimum": 1, "type": "integer" }, + "jpeg_quality": { + "description": "JPEG quality of the frames (default 80).", + "maximum": 95, + "minimum": 30, + "type": "integer" + }, "keep_raw_video_file": { "description": "With encode: keep the .mkv beside the MP4 (default false: the encode deletes it once the MP4 is written).", "type": "boolean" @@ -4941,12 +4947,6 @@ ], "type": "string" }, - "quality": { - "description": "JPEG quality of the frames (default 80).", - "maximum": 95, - "minimum": 30, - "type": "integer" - }, "save_path": { "description": "Absolute .mkv path; default the session's output folder.", "type": "string" @@ -4993,7 +4993,7 @@ }, { "completion": "immediate", - "description": "Stop the running recording and return its file once it is written: seconds, frames captured and written, frames dropped when encoding fell behind, failed when they could not be encoded, or skipped when the window could not be captured, the size, the mean UI-thread time a capture took (capture_ms), and why it ended. A recording that ended on its own (max_seconds, the replay or script that started it ended, a write error) is reported once by the next stop_recording. For a recording started with encode, it then starts the MP4 encode and returns it under encode: a job, whose wait {for: \"job\"} returns encode_recording's result, whose raw_video_file_deleted says whether the .mkv was deleted. This is the call with silent: true. Called with no arguments, it stops the recording as the Stop Recording command does, whoever started it: without waiting for its file, it shows the person a notification naming it and replies with its path; the next stop_recording with silent: true reports it as ended stopped_in_app.", + "description": "Stop the running recording. Call it with silent: true for the report: it waits for the file and returns it with its seconds, frames captured and written, frames dropped when encoding fell behind, failed when they could not be encoded, or skipped when the window could not be captured, the size, the mean UI-thread time a capture took (capture_ms), and why it ended. A recording that ended on its own (max_seconds, the replay or script that started it ended, a write error) is reported once by the next stop_recording. For a recording started with encode, it then starts the MP4 encode and returns it under encode: a job, whose wait {for: \"job\"} returns encode_recording's result, whose raw_video_file_deleted says whether the .mkv was deleted. Called with no arguments, it stops the recording as the Stop Recording command does, whoever started it: without waiting for its file, it shows the person a notification naming it and replies with its path; the next stop_recording with silent: true reports it as ended stopped_in_app.", "destructive": false, "group": "Commands", "guard": "inspect", @@ -5003,7 +5003,7 @@ "additionalProperties": false, "properties": { "silent": { - "description": "true runs the command without asking, with the defaults of what the call leaves out. A call with no arguments does what a person's pick does.", + "description": "true waits for the file and returns the report, and the encode job when the recording has one; a call with no arguments stops as the Stop Recording command does.", "enum": [ true ], @@ -8386,7 +8386,7 @@ }, { "completion": "immediate", - "description": "Move and/or rotate a body (B-rep transform). copy=true keeps the source and appends the transformed copy as a new body. A rejected rebuild is reported in the reply: ok is false or error is not empty.", + "description": "Move and/or rotate a body (B-rep transform). copy=true keeps the source and appends the transformed copy as a new body. The rotation is angle about the axis (axis_x, axis_y, axis_z) through the pivot, a world point that defaults to the world origin. A rejected rebuild is reported in the reply: ok is false or error is not empty.", "destructive": false, "examples": [ { @@ -9518,7 +9518,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -9581,7 +9581,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": true, "input_schema": { "properties": { @@ -9647,7 +9647,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": true, "input_schema": { "properties": { @@ -10965,7 +10965,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -11043,7 +11043,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -11144,7 +11144,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -11319,7 +11319,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -11334,11 +11334,12 @@ }, "offset": { "default": 0, - "description": "In mm.", + "description": "along the plane's normal, from the world origin (mm)", "type": "number" }, "plane": { "default": "XY", + "description": "the base plane through the world origin, not through modeling_origin as the other commands' planes are", "enum": [ "XY", "XZ", @@ -11418,7 +11419,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -11528,7 +11529,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -11618,7 +11619,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -11708,7 +11709,7 @@ ], "group": "Design", "guard": "mutate", - "idempotent": false, + "idempotent": true, "in_palette": false, "input_schema": { "properties": { @@ -13789,7 +13790,7 @@ }, { "completion": "immediate", - "description": "Toggle construction on sketch entities. Reply: changed. A rejected rebuild is reported in the reply: ok is false or error is not empty.", + "description": "Toggle construction on sketch entities. Reply: changed, how many, and ok, false when none did.", "destructive": false, "examples": [ { @@ -15057,7 +15058,7 @@ }, { "completion": "immediate", - "description": "Run one action by the id search_actions returned (orca_command:view_front:orca, or the name inside it, view_front), with args, the command's arguments, when it takes some (its input_schema). A command that asks in a dialog asks when it is given no args, as a person's pick does, and runs without asking when given them: an absolute path skips a file dialog, and an output needs {\"path\": ..., \"overwrite\": true} to replace a file. Go to layer and Go to tab need their value ({\"percent\": 50}, {\"tab\": \"preview\"}). Actions that open a dialog return blocked_by_dialog; answer it with answer_dialog, or, for a native one it can't press (a file picker), register auto_answer_dialogs before the call. An export_gcode with a path completes when the file is written; an action that starts a background job (obj_arrange, obj_orient) when the job ends. An action that does nothing (no object selected) is an error. Some commands add what they did to the reply (the obj_order_by_* order, the object obj_assemble made).", + "description": "Run one action by the id search_actions returned (orca_command:view_front:orca, or the name inside it, view_front), with args, the command's arguments, when it takes some (its input_schema). A command that asks in a dialog asks when it is given no args, as a person's pick does, and runs without asking when given them: an absolute path skips a file dialog, and an output needs {\"path\": ..., \"overwrite\": true} to replace a file. Go to layer and Go to tab need their value ({\"percent\": 50}, {\"tab\": \"preview\"}). Actions that open a dialog return blocked_by_dialog; answer it with answer_dialog, or, for a native one it can't press (a file picker), register auto_answer_dialogs before the call. An export_gcode with a path completes when the file is written; an action that starts a background job (obj_arrange, obj_orient) when the job ends. An action that does nothing (no object selected) is an error. Some commands add what they did to the reply (the obj_order_by_* order, the object obj_assemble made). A command's action runs that command, as call_tool {tool: its name} does; the other actions (plates, recent projects, plugin scripts and pages, settings) run only here.", "destructive": false, "group": "ui", "guard": "mutate", @@ -15171,7 +15172,7 @@ "open_world": false, "operations": [], "read_only": false, - "title": "Size or move a window" + "title": "Size, move or raise a window" }, { "completion": "immediate", @@ -15228,7 +15229,7 @@ }, { "completion": "immediate", - "description": "Click a GUI element as a person would. Menu items, buttons, checkboxes, toggles, radio buttons, toolbar items and gizmos are activated the way their owners expect: a gizmo opens and a second click closes it (Text on an object without text creates a text part: created). Other widgets and ImGui items get a mouse click once scrolled into view; with x/y, at that point of a 3D canvas or custom-drawn widget, in logical pixels from its top left. A row is selected as a click on its cell selects it (ctrl adds, shift extends; in the object list the named column acts, as Printable toggles), double activates it and a right click opens its menu; a drop-down list's row is picked. A plate icon does what it does in the Prepare view: lock replies locked, arrange and orient reply done once their job ends, settings and filament_map list the dialog they open (dialogs). Modifiers reach the 3D canvas, the object list and handlers that read them. A menu the click opens is never shown: the reply lists it as popup_menu, or popup_item runs one of its items (ran). A click that opens a dialog replies blocked_by_dialog.\nA web page's element gets the pointer and mouse events of a click at its centre (or x/y) once scrolled into view, refused when something else covers that point. The reply reads back checked, and has closed when the click closed its dialog (with dialogs, those still open under it, which still need an answer), navigated (with url) when it changed the page, or dialogs when it opened another. Otherwise page says what changed on the page within 300 ms: changed (false when its lines are as before), the list_widgets lines added and removed, partial when a plugin configuration frame could not be compared, and posted, how many messages the page sent OrcaSlicer.", + "description": "Click a GUI element as a person would. Menu items, buttons, checkboxes, toggles, radio buttons, toolbar items and gizmos are activated the way their owners expect: a gizmo opens and a second click closes it (Text on an object without text creates a text part: created). Other widgets and ImGui items get a mouse click once scrolled into view; with x/y, at that point of a 3D canvas or custom-drawn widget, in logical pixels from its top left. A row is selected as a click on its cell selects it (ctrl adds, shift extends; in the object list the named column acts, as Printable toggles), double activates it and a right click opens its menu; a drop-down list's row is picked. A plate icon does what it does in the Prepare view: lock replies locked, arrange and orient reply done once their job ends, settings and filament_map list the dialog they open (dialogs). A button, checkbox, toggle or radio button is activated so by a plain left click only: with modifiers, double or another button it gets a mouse click, which a native control ignores. A menu item runs whatever those options are, a toolbar item takes a left or a right click, and a gizmo a single left one. Modifiers reach the 3D canvas, the object list and handlers that read them. To click a point of the model, drag, scroll or hold a press, use mouse_gesture. A menu the click opens is never shown: the reply lists it as popup_menu, or popup_item runs one of its items (ran). A click that opens a dialog replies blocked_by_dialog.\nA web page's element gets the pointer and mouse events of a click at its centre (or x/y) once scrolled into view, refused when something else covers that point. The reply reads back checked, and has closed when the click closed its dialog (with dialogs, those still open under it, which still need an answer), navigated (with url) when it changed the page, or dialogs when it opened another. Otherwise page says what changed on the page within 300 ms: changed (false when its lines are as before), the list_widgets lines added and removed, partial when a plugin configuration frame could not be compared, and posted, how many messages the page sent OrcaSlicer.", "destructive": false, "group": "ui", "guard": "recover", @@ -15251,7 +15252,7 @@ "type": "boolean" }, "modifiers": { - "description": "Modifier keys held during the click, as in press_keys: ctrl and cmd are both Command on macOS and Ctrl elsewhere; rawctrl is the macOS Control key.", + "description": "Modifier keys held during the input, as in press_keys: ctrl and cmd are both Command on macOS and Ctrl elsewhere; rawctrl is the macOS Control key.", "items": { "enum": [ "ctrl", @@ -15269,7 +15270,7 @@ "type": "string" }, "target": { - "description": "A ref from the latest list_widgets call (\"w12\") or a locator, such as {label: \"OK\", within: \"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's description lists every kind.", + "description": "A ref list_widgets gave (\"w12\"), which later listings leave good (one refused as stale or unknown needs a new listing), or a locator, such as {label: \"OK\", within: \"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's description lists every kind.", "type": [ "string", "object" @@ -15318,7 +15319,7 @@ "type": "boolean" }, "target": { - "description": "A ref from the latest list_widgets call (\"w12\") or a locator, such as {label: \"OK\", within: \"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's description lists every kind.", + "description": "A ref list_widgets gave (\"w12\"), which later listings leave good (one refused as stale or unknown needs a new listing), or a locator, such as {label: \"OK\", within: \"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's description lists every kind.", "type": [ "string", "object" @@ -15364,7 +15365,7 @@ "additionalProperties": false, "properties": { "keys": { - "description": "Key chord.", + "description": "One chord: a key, after any modifiers joined by +. Keys: one character, Enter, Esc, Tab, Space, Backspace, Delete, Insert, Home, End, PageUp, PageDown, Left, Right, Up, Down, F1 to F24. Modifiers: Ctrl, Cmd, RawCtrl, Shift, Alt. With text, the chord goes first.", "type": "string" }, "popup_item": { @@ -15372,7 +15373,7 @@ "type": "string" }, "target": { - "description": "A ref from the latest list_widgets call (\"w12\") or a locator, such as {label: \"OK\", within: \"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's description lists every kind.", + "description": "A ref list_widgets gave (\"w12\"), which later listings leave good (one refused as stale or unknown needs a new listing), or a locator, such as {label: \"OK\", within: \"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's description lists every kind.", "type": [ "string", "object" @@ -15400,7 +15401,7 @@ }, { "completion": "immediate", - "description": "Make a mouse gesture on a 3D canvas as a person would: move, down, up, click, drag or wheel. It starts at `at`, a point of the model, which is projected through the camera and by default checked to land on that part (check \"point\" only projects it), or at x/y, logical pixels from the canvas's top left. A drag goes through `waypoints` to `to`, `steps` moves per leg: on an object it moves the object, in a painting gizmo it paints from a press on the object being painted (waypoints zigzagging over an area paint all of it), and elsewhere it turns or pans the camera as this install's mouse settings say, so turn the camera with set_view camera or orbit instead. A wheel turns delta notches; positive zooms in or scrolls a panel up. Modifiers are held as keys for the gesture (shift for Measure's point picking, alt for erasing). A down keeps its button and modifiers held, so moves drag, until an up or another gesture. Grabbers are set through the gizmo's panel fields or transform, not dragged. A menu a right click opens is listed as popup_menu, or popup_item (with click or up) runs one of its items. The reply's camera_moved says the gesture moved the camera, so earlier screenshots and pixels no longer match the view.\nWith target, the gesture is on a web page's element instead (a canvas such as the colour picker's spectrum, a slider, a sortable or scrolled list): x/y, to and waypoints are logical pixels from its top left, a drag keeps the pointer captured where the page asks for it, and a wheel scrolls what is under the pointer unless the page takes it; page says what the gesture changed there, as for click.", + "description": "Make a mouse gesture on a 3D canvas as a person would: move, down, up, click, drag or wheel. It starts at `at`, a point of the model, which is projected through the camera and by default checked to land on that part (check \"point\" only projects it), or at x/y, logical pixels from the canvas's top left. A drag goes through `waypoints` to `to`, `steps` moves per leg: on an object it moves the object, in a painting gizmo it paints from a press on the object being painted (waypoints zigzagging over an area paint all of it), and elsewhere it turns or pans the camera as this install's mouse settings say, so turn the camera with set_view camera or orbit instead. A wheel turns delta notches; positive zooms in (out with the Reverse mouse zoom preference on) or scrolls a panel up. Modifiers are held as keys for the gesture (shift picks points in Measure and erases in a painting gizmo). A down keeps its button and modifiers held, so moves drag, until an up or another gesture. Grabbers are set through the gizmo's panel fields or transform, not dragged. A menu a right click opens is listed as popup_menu, or popup_item (with click or up) runs one of its items. The reply's camera_moved says the gesture moved the camera, so earlier screenshots and pixels no longer match the view.\nWith target, the gesture is on a web page's element instead (a canvas such as the colour picker's spectrum, a slider, a sortable or scrolled list): x/y, to and waypoints are logical pixels from its top left, a drag keeps the pointer captured where the page asks for it, and a wheel scrolls what is under the pointer unless the page takes it; page says what the gesture changed there, as for click.", "destructive": false, "group": "ui", "guard": "recover", @@ -15499,7 +15500,7 @@ "type": "string" }, "delta": { - "description": "Wheel notches.", + "description": "Wheel notches (default 1 on a canvas; a page element needs it given).", "type": "integer" }, "double": { @@ -15507,7 +15508,7 @@ "type": "boolean" }, "modifiers": { - "description": "Modifier keys held during the click, as in press_keys: ctrl and cmd are both Command on macOS and Ctrl elsewhere; rawctrl is the macOS Control key.", + "description": "Modifier keys held during the input, as in press_keys: ctrl and cmd are both Command on macOS and Ctrl elsewhere; rawctrl is the macOS Control key.", "items": { "enum": [ "ctrl", @@ -15582,7 +15583,7 @@ "open_world": false, "operations": [], "read_only": false, - "title": "Mouse gesture on the 3D view" + "title": "Mouse gesture on a 3D view or page element" }, { "completion": "immediate", @@ -15624,11 +15625,11 @@ "open_world": false, "operations": [], "read_only": false, - "title": "Pick a file for the open gizmo" + "title": "Load or save the open gizmo's SVG or texture file" }, { "completion": "immediate", - "description": "Press a button of the topmost modal dialog: yes, no, ok, cancel, close, apply, a button's label, or a numeric id. A disabled button (enabled: false) is refused, the dialog's message showing what it still needs, and so is one on a page the dialog does not show, except a hidden cancel or close, which ends the dialog. The label of an option of a selector made of buttons (Orca's radio groups, tab bars and multi-switches, shown as (*) / ( ) in the message) selects that option and leaves the dialog open; set other radio buttons and switches with click or set_widget_value true, and notebook tabs with click. dialog.title, text the dialog's title contains, makes sure which dialog that is; it must be the topmost. Reply: closed: true when it closed, and dialogs, those still open. A native message box (native: true) is pressed through the OS, by one of the buttons get_app_state.dialogs lists for it; a file or folder picker can't be answered here, nor any native dialog on macOS (its buttons list is empty): register auto_answer_dialogs before opening them. A web dialog's buttons are on its page: a label is pressed there, waiting up to 3 s for it to show, so the page's own handler runs. With no such page button, or a page busy for those 3 s, cancel and close end the dialog, and ok, yes, no and apply are refused rather than skip the page's commit; page_buttons then lists the page's buttons.", + "description": "Press a button of the topmost modal dialog: yes, no, ok, cancel, close, apply, a button's label, or a numeric id. A disabled button (enabled: false) is refused, the dialog's message showing what it still needs, and so is one on a page the dialog does not show, except a hidden cancel or close, which ends the dialog. On a dialog that is neither native nor a web dialog, a standard name or id it has no button for ends it with that answer too, without a handler running (pressed: false). The label of an option of a selector made of buttons (Orca's radio groups, tab bars and multi-switches, shown as (*) / ( ) in the message) selects that option and leaves the dialog open; set other radio buttons and switches with click or set_widget_value true, and notebook tabs with click. dialog.title, text the dialog's title contains, makes sure which dialog that is; it must be the topmost. Reply: dialog, button, pressed, and id, the wx id pressed or ended with, or web: true for a button on a web dialog's page, with what the page did as click reports it; closed: true when it closed, and dialogs, those still open. A native message box (native: true) is pressed through the OS, by one of the buttons get_app_state.dialogs lists for it; a file or folder picker can't be answered here, nor any native dialog on macOS (its buttons list is empty): register auto_answer_dialogs before opening them. A web dialog's buttons are on its page: a label is pressed there, waiting up to 3 s for it to show, so the page's own handler runs. With no such page button, or a page busy for those 3 s, cancel and close end the dialog, and ok, yes, no and apply are refused rather than skip the page's commit; page_buttons then lists the page's buttons.", "destructive": false, "group": "core", "guard": "recover", @@ -15667,7 +15668,7 @@ }, { "completion": "immediate", - "description": "Answer modal dialogs automatically when their title or message matches a rule's regex (case-insensitive). get_app_state.auto_answer_rules lists the rules in force. Called from a replay or script, the rules last until it ends; otherwise they replace the ones this session set before, and an empty list clears them. A native dialog returns the rule's button at once and never shows. A file or folder picker takes button ok with an absolute path and returns it without showing (on Linux such a rule cancels it); without a path a picker can only be cancelled, and a multi-select picker takes no path. A wx dialog has the button pressed as answer_dialog does, so its handler runs. A matching dialog already open is answered too (answered_open_dialog), so a prompt that shows around the same time, such as the restore prompt after startup, is caught either way. A web dialog is matched by its title: a button that names one of its shown wx buttons (by label, standard name or id) is pressed as for a wx dialog, any other on its page once it shows there, for up to 10 s after the page loads; past that, cancel and close end the dialog and any other button gives up.", + "description": "Answer modal dialogs automatically when their title or message matches a rule's regex (case-insensitive). get_app_state.auto_answer_rules lists the rules in force. Called from a replay or script, the rules join those it set before and last until it ends, and a plugin's likewise until it unloads; an MCP client's replace the ones MCP clients set before and last until the MCP server stops, and an empty list clears them. Reply: scope (run, plugin or session), rules (uses counts a rule's answers) and answered_open_dialog. A native dialog returns the rule's button at once and never shows. A file or folder picker takes button ok with an absolute path and returns it without showing (on Linux such a rule cancels it); without a path a picker can only be cancelled, and a multi-select picker takes no path. A wx dialog is answered as answer_dialog does. A matching dialog already open is answered too (answered_open_dialog), so a prompt that shows around the same time, such as the restore prompt after startup, is caught either way. A web dialog is matched by its title: a button that names one of its shown wx buttons (by label, standard name or id) is pressed as for a wx dialog, any other on its page once it shows there, for up to 10 s after the page loads; past that, cancel and close end the dialog and any other button gives up.", "destructive": false, "group": "core", "guard": "recover", @@ -15731,11 +15732,11 @@ "additionalProperties": false, "properties": { "code": { - "description": "JavaScript to run.", + "description": "JavaScript statements, run through eval: the last expression's value is the result. No top-level return or await; a Promise or a DOM node comes back as {}.", "type": "string" }, "target": { - "description": "A ref from the latest list_widgets call (\"w12\") or a locator, such as {label: \"OK\", within: \"Preferences\"} or {menu: \"File>Export>Export G-code\"}; list_widgets's description lists every kind.", + "description": "A web view (its ref; list_widgets lists it as kind webview) or an element of its page (its ref or a {web} / {css} locator), which the code gets as `el`. Default: the topmost dialog's web view, else the only one shown.", "type": [ "string", "object" diff --git a/tests/slic3rutils/test_action_source.cpp b/tests/slic3rutils/test_action_source.cpp index 5dc4ba1978..c242dcbaff 100644 --- a/tests/slic3rutils/test_action_source.cpp +++ b/tests/slic3rutils/test_action_source.cpp @@ -395,7 +395,7 @@ TEST_CASE("Native command catalog has the Run Script panel and Action Replay com const Slic3r::GUI::NativeCommand* replay = Slic3r::GUI::NativeCommands::find("open_action_replay"); REQUIRE(replay != nullptr); CHECK(std::string(replay->title) == "Action Replay"); - const Slic3r::GUI::NativeCommand* panel = Slic3r::GUI::NativeCommands::find("toggle_run_script"); + const Slic3r::GUI::NativeCommand* panel = Slic3r::GUI::NativeCommands::find("toggle_run_script_panel"); REQUIRE(panel != nullptr); CHECK(panel->group == replay->group); CHECK(panel->input.empty()); diff --git a/tests/slic3rutils/test_command_catalog.cpp b/tests/slic3rutils/test_command_catalog.cpp index 3d25d16029..6c19c2b884 100644 --- a/tests/slic3rutils/test_command_catalog.cpp +++ b/tests/slic3rutils/test_command_catalog.cpp @@ -216,7 +216,7 @@ TEST_CASE("no typed tool is in the palette", "[CommandCatalog]") "open_preferences", "open_wiki", "open_youtube", "plate_add", "plate_delete", "plate_duplicate", "plate_goto", "plate_rename", "plate_toggle_lock", "preset_bundle", "redo", "refresh_plugins", "reset_window_layout", "save_project", "save_project_as", "select_all", "send_gcode", "slice_all", "slice_and_preview", "start_recording", "stop_recording", - "sync_ams", "sync_presets", "take_screenshot", "toggle_developer_mode", "toggle_run_script", "undo", "view_bottom", + "sync_ams", "sync_presets", "take_screenshot", "toggle_developer_mode", "toggle_run_script_panel", "undo", "view_bottom", "view_default", "view_fit_bed", "view_front", "view_iso", "view_left", "view_rear", "view_right", "view_toggle_perspective", "view_top"}; REQUIRE(tiles.size() == 129); diff --git a/tests/slic3rutils/test_mcp_cad.cpp b/tests/slic3rutils/test_mcp_cad.cpp index 0de0238b8d..5007230ce2 100644 --- a/tests/slic3rutils/test_mcp_cad.cpp +++ b/tests/slic3rutils/test_mcp_cad.cpp @@ -759,6 +759,51 @@ TEST_CASE("a Design command with a person's form says which mode it runs in", "[ ContainsSubstring("opens nothing")); } +TEST_CASE("an empty entities list names the selection, as leaving it out does", "[Mcp][CAD]") +{ + using nlohmann::json; + const std::vector selection{2, 4}; + const std::vector none, listed{1, 3}, every{0, 1, 2}; + const json left_out = json::object(), empty{{"entities", json::array()}}, list{{"entities", {1, 3}}}; + // all_if_empty is what sketch_offset and sketch_mirror pass, and sketch_delete and sketch_construction do not. + const bool all_if_empty = GENERATE(false, true); + CAPTURE(all_if_empty); + + // A list names its entities, whatever is selected. + CHECK(GUI::Mcp::sketch_target_indices(list, selection, 6, all_if_empty) == listed); + CHECK(GUI::Mcp::sketch_target_indices(list, none, 6, all_if_empty) == listed); + // The schema gives [] as the default, so it reads as left out: the selection. + CHECK(GUI::Mcp::sketch_target_indices(left_out, selection, 6, all_if_empty) == selection); + CHECK(GUI::Mcp::sketch_target_indices(empty, selection, 6, all_if_empty) == selection); + // With nothing selected, only a command that says so takes every entity. + CHECK(GUI::Mcp::sketch_target_indices(left_out, none, 3, all_if_empty) == (all_if_empty ? every : none)); + CHECK(GUI::Mcp::sketch_target_indices(empty, none, 3, all_if_empty) == (all_if_empty ? every : none)); + // Only an empty list is read so: anything else that is given names what it holds, a null nothing. + CHECK(GUI::Mcp::sketch_target_indices({{"entities", nullptr}}, selection, 6, all_if_empty).empty()); +} + +TEST_CASE("a Design command that only reads is marked idempotent", "[Mcp][CAD]") +{ + const GUI::CommandCatalog catalog = catalog_with_cad(); + std::size_t reads = 0; + for (const GUI::NativeCommand& c : catalog.commands()) + if (c.group == "Design" && c.read_only) { + INFO(c.key); + CHECK(c.idempotent); + ++reads; + } + CHECK(reads > 0); +} + +TEST_CASE("a sketch command that rebuilds nothing promises no rejected rebuild", "[Mcp][CAD]") +{ + const GUI::CommandCatalog catalog = catalog_with_cad(); + // It toggles flags on the open sketch's entities: its reply says how many changed, and has no error. + const std::string& description = command_of(catalog, "sketch_construction").description; + CHECK_THAT(description, !ContainsSubstring("rebuild")); + CHECK_THAT(description, ContainsSubstring("changed")); +} + TEST_CASE("no CAD command exists with the feature off", "[Mcp][CAD]") { const auto design_commands = [](bool cad) { diff --git a/tests/slic3rutils/test_mcp_recording.cpp b/tests/slic3rutils/test_mcp_recording.cpp index f630199a13..d8b8045bcb 100644 --- a/tests/slic3rutils/test_mcp_recording.cpp +++ b/tests/slic3rutils/test_mcp_recording.cpp @@ -1052,7 +1052,7 @@ TEST_CASE("a burst of quick steps never pushes out the replay still running", "[ const auto t0 = CaptionBoard::Clock::now(); board.call_started(1, "Run a replay", "long.json", t0); for (uint64_t id = 2; id <= 101; ++id) { - board.call_started(id, "Mouse gesture on the 3D view", "drag", t0 + 10ms * id); + board.call_started(id, "Mouse gesture on a 3D view or page element", "drag", t0 + 10ms * id); board.call_ended(id, true, "", t0 + 10ms * id + 5ms); } REQUIRE(board.current(t0 + 1100ms).has_value()); @@ -1242,7 +1242,7 @@ TEST_CASE("remembered recording settings come back, and a bad value keeps its de save_recording_settings(config, s); CHECK(load_recording_settings(config) == s); - config.set("recording", "quality", "200"); + config.set("recording", "jpeg_quality", "200"); config.set("recording", "crf", "x"); config.set("recording", "codec", "vp9"); config.set("recording", "speed", "warp"); @@ -1260,7 +1260,7 @@ TEST_CASE("start_recording's encode arguments override the settings, a preset be { RecordingSettings s; // The tool's other arguments are left to it. - const json args_given{{"encode_preset", "compatible"}, {"crf", 18}, {"encode", true}, {"quality", 60}, {"silent", true}}; + const json args_given{{"encode_preset", "compatible"}, {"crf", 18}, {"encode", true}, {"jpeg_quality", 60}, {"silent", true}}; CHECK(apply_recording_overrides(s, args_given).empty()); CHECK(s.codec == "h264"); CHECK(s.profile == "high"); diff --git a/tests/slic3rutils/test_mcp_scene.cpp b/tests/slic3rutils/test_mcp_scene.cpp index 1da8d0b8ae..df09cc0ca1 100644 --- a/tests/slic3rutils/test_mcp_scene.cpp +++ b/tests/slic3rutils/test_mcp_scene.cpp @@ -136,7 +136,7 @@ TEST_CASE("the commands that replace a dialog take the arguments the table gives return out; }; const Names path{"path"}, output{"path", "overwrite"}, all{"all"}, size{"size"}; - const Names recording{"target", "fps", "max_dim", "quality", "max_seconds", "captions", "pointer", "encode", + const Names recording{"target", "fps", "max_dim", "jpeg_quality", "max_seconds", "captions", "pointer", "encode", "encode_preset", "codec", "crf", "speed", "profile", "keep_raw_video_file", "save_path", "overwrite", "silent"}; REQUIRE(names("go_to_layer") == Names{"percent"}); @@ -157,8 +157,11 @@ TEST_CASE("the commands that replace a dialog take the arguments the table gives "add_primitive_disc", "add_primitive_torus"}) REQUIRE(names(key) == size); REQUIRE(names("plate_goto") == Names{"plate"}); - REQUIRE(names("filament_delete") == Names{"slot"}); + REQUIRE(names("filament_delete") == Names{"filament_slot"}); REQUIRE(names("start_recording") == recording); + // The object arrange fills a plate with is named as an object, not as a count. + CHECK(names("arrange").count("fill_object") == 1); + CHECK(names("arrange").count("fill") == 0); // Of the tiles, only the two values of the second phase are required; every other tile does its person's // form when it is given no arguments. @@ -168,6 +171,18 @@ TEST_CASE("the commands that replace a dialog take the arguments the table gives } } +TEST_CASE("the view, window and gesture tools are titled by all they do", "[Mcp][Scene]") +{ + const auto title = [](const char* key) { + const NativeCommand* c = NativeCommands::find(key); + return c != nullptr ? c->title : std::string(); + }; + CHECK(title("set_view") == "Set up the view"); + CHECK(title("set_window") == "Size, move or raise a window"); + CHECK(title("mouse_gesture") == "Mouse gesture on a 3D view or page element"); + CHECK(title("pick_gizmo_file") == "Load or save the open gizmo's SVG or texture file"); +} + // The app opens on Home, so a slice or arrange an agent starts at once updates its progress // notification before any ImGui frame has built the font. That used to dereference a null font. TEST_CASE("a progress notification updated before the first ImGui frame does not measure text", "[Mcp][Scene]") diff --git a/tools/mcp/test_action_replay_hidden.py b/tools/mcp/test_action_replay_hidden.py index b323f4e2c1..18b81155b7 100755 --- a/tools/mcp/test_action_replay_hidden.py +++ b/tools/mcp/test_action_replay_hidden.py @@ -67,7 +67,7 @@ def main(): client.call("set_view", tab="prepare") nodes_before = webview_nodes() prepare_eval = eval_outcome() - client.call("run_action", id="orca_command:toggle_run_script:orca") + client.call("run_action", id="orca_command:toggle_run_script_panel:orca") time.sleep(1.0) # let its web view load check("list_widgets lists no node of the Run Script panel", webview_nodes() == nodes_before, f"{nodes_before} / {webview_nodes()}") check("run_javascript without a target behaves as before the panel", eval_outcome() == prepare_eval, f"{prepare_eval} / {eval_outcome()}") @@ -76,7 +76,7 @@ def main(): check("a window screenshot works with the panel shown", client.call("screenshot", target="main").get("path")) python = client.await_job(client.call("run_script", code="print('agent run')")) check("an agent's run_script finishes while the panel is shown", python.get("status") == "finished", python) - client.call("run_action", id="orca_command:toggle_run_script:orca") # hidden again + client.call("run_action", id="orca_command:toggle_run_script_panel:orca") # hidden again out = tempfile.mkdtemp(prefix="orca-runner-") smoke = client.await_job(client.call("run_replay", path=os.path.join(HERE, "smoke_test.json"), out_dir=out)) diff --git a/tools/mcp/test_worker_admission.py b/tools/mcp/test_worker_admission.py index dfc6ea5864..6ac6a46a49 100755 --- a/tools/mcp/test_worker_admission.py +++ b/tools/mcp/test_worker_admission.py @@ -57,7 +57,7 @@ def main(): c.call("select_objects", none=True) c.call("run_action", id="orca_command:add_primitive_cube:orca", args={"size": size}) for o in range(3): - c.call("arrange", fill=o, spacing=0, rotate=False) + c.call("arrange", fill_object=o, spacing=0, rotate=False) for name, (tool, args) in STARTERS.items(): if name == "click" and c.call("list_widgets", query="Arrange options", include_menus=False).get("nodes", 0) == 0: diff --git a/tools/mcp/tests/calibration.json b/tools/mcp/tests/calibration.json index eb9bcc8457..1808c52f19 100644 --- a/tools/mcp/tests/calibration.json +++ b/tools/mcp/tests/calibration.json @@ -129,7 +129,7 @@ {"tool": "get_settings", "args": {"scope": "filament", "keys": ["slow_down_layer_time"]}, "expect": {"/items/0/value": {"eq": "4"}}}, // ---- Back to one slot and no MCP presets ---- - {"tool": "run_action", "args": {"id": "orca_command:filament_delete:orca", "args": {"slot": 2}}, "expect": {"/level": {"eq": "success"}}}, + {"tool": "run_action", "args": {"id": "orca_command:filament_delete:orca", "args": {"filament_slot": 2}}, "expect": {"/level": {"eq": "success"}}}, {"tool": "delete_preset", "args": {"type": "filament", "name": "MCP Calib PLA"}, "expect": {"/deleted": {"eq": "MCP Calib PLA"}}}, {"tool": "list_presets", "args": {"type": "filament"}, "expect": {"/total": {"eq": 1}, "/items/0/modified": {"exists": false}}} ] diff --git a/tools/mcp/tests/plates.json b/tools/mcp/tests/plates.json index 5bb00b1d59..1951d8b1cb 100644 --- a/tools/mcp/tests/plates.json +++ b/tools/mcp/tests/plates.json @@ -31,8 +31,8 @@ "expect": {"/level": {"eq": "success"}, "/message": {"eq": "Added filament slot 2."}}}, {"tool": "run_action", "args": {"id": "orca_command:filament_add:orca"}, "expect": {"/message": {"eq": "Added filament slot 3."}}}, // A slot past the last is refused; slot 2 by number. - {"tool": "run_action", "args": {"id": "orca_command:filament_delete:orca", "args": {"slot": 4}}, "optional": true}, - {"tool": "run_action", "args": {"id": "orca_command:filament_delete:orca", "args": {"slot": 2}}, "expect": {"/message": {"eq": "Deleted filament slot 2."}}}, + {"tool": "run_action", "args": {"id": "orca_command:filament_delete:orca", "args": {"filament_slot": 4}}, "optional": true}, + {"tool": "run_action", "args": {"id": "orca_command:filament_delete:orca", "args": {"filament_slot": 2}}, "expect": {"/message": {"eq": "Deleted filament slot 2."}}}, {"tool": "get_settings", "args": {"scope": "project", "keys": ["filament_is_mixed"]}, "expect": {"/items/0/value": {"eq": "0,0"}}}, // ---- A cube on each of two plates ---- @@ -122,7 +122,7 @@ {"tool": "answer_dialog", "args": {"button": "OK"}}, {"tool": "wait", "args": {"for": "job", "job": "${jobs.mix}"}}, {"tool": "get_settings", "args": {"scope": "project", "keys": ["filament_is_mixed"]}, "expect": {"/items/0/value": {"eq": "0,0,1"}}}, - {"tool": "run_action", "args": {"id": "orca_command:filament_delete:orca", "args": {"slot": 3}}, "optional": true}, + {"tool": "run_action", "args": {"id": "orca_command:filament_delete:orca", "args": {"filament_slot": 3}}, "optional": true}, {"tool": "set_settings", "args": {"scope": "plate", "plate": 0, "values": {"first_layer_print_sequence": [2, 1]}}, "optional": true}, {"tool": "list_plates", "expect": {"/items/0/first_layer_print_sequence": {"eq": null}}}, {"tool": "run_action", "args": {"id": "orca_command:filament_add:orca"}, "expect": {"/message": {"eq": "Added filament slot 3."}}}, diff --git a/tools/mcp/tests/scene.json b/tools/mcp/tests/scene.json index 9813228020..558a57c98b 100644 --- a/tools/mcp/tests/scene.json +++ b/tools/mcp/tests/scene.json @@ -110,18 +110,18 @@ // ---- Fill bed fills the object's own plate, in one undo step ---- // The shapes were added on the current plate, plate 1; the cube goes back to plate 0. {"tool": "transform", "args": {"object": 1, "plate": 0}, "expect": {"/plate": {"eq": 0}}}, - {"tool": "arrange", "args": {"fill": 2}, "expect": {"/added": {"gt": 0}, "/plate": {"eq": 1}, "/off_plate": {"empty": true}}}, + {"tool": "arrange", "args": {"fill_object": 2}, "expect": {"/added": {"gt": 0}, "/plate": {"eq": 1}, "/off_plate": {"empty": true}}}, // The new instances are listed on the plate they fill. {"tool": "list_objects", "expect": {"/plates/1/objects/0/instances/1": {"exists": true}, "/outside": {"empty": true}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, {"tool": "list_objects", "expect": {"/plates/1/objects/0/instances/1": {"exists": false}, "/outside": {"empty": true}}}, - // refused: a locked plate, a plate that does not exist, fill with plates + // refused: a locked plate, a plate that does not exist, fill_object with plates {"tool": "run_action", "args": {"id": "orca_command:plate_goto:orca", "args": {"plate": 1}}}, {"tool": "run_action", "args": {"id": "orca_command:plate_toggle_lock:orca"}}, {"tool": "arrange", "args": {"plates": 1}, "optional": true}, {"tool": "run_action", "args": {"id": "orca_command:plate_toggle_lock:orca"}}, {"tool": "arrange", "args": {"plates": 7}, "optional": true}, - {"tool": "arrange", "args": {"fill": 0, "plates": 0}, "optional": true}, + {"tool": "arrange", "args": {"fill_object": 0, "plates": 0}, "optional": true}, {"tool": "list_objects", "expect": {"/plates/1": {"exists": true}, "/plates/2": {"exists": false}, "/plates/1/objects/0/instances/0/index": {"eq": 0}, "/plates/1/objects/0/instances/1": {"exists": false}}}, @@ -331,7 +331,7 @@ "/plates/1/objects/3/instances/0/mirrored": {"eq": true}}}, {"tool": "run_action", "args": {"id": "orca_command:obj_order_by_name:orca", "args": {"all": true}}, "expect": {"/descending": {"eq": false}, "/order/0/name": {"eq": "Assembly"}, "/order/4/plate": {"eq": 1}}}, - {"tool": "arrange", "args": {"fill": 1}, "expect": {"/added": {"gt": 0}, "/plate": {"eq": 1}, "/off_plate": {"empty": true}}}, + {"tool": "arrange", "args": {"fill_object": 1}, "expect": {"/added": {"gt": 0}, "/plate": {"eq": 1}, "/off_plate": {"empty": true}}}, {"tool": "slice", "args": {"plates": 1}, "expect": {"/plates/0/outcome": {"eq": "ok"}}}, {"tool": "set_view", "args": {"tab": "prepare"}}, {"tool": "screenshot","args": {"target": "canvas", "save_path": "${out_dir}/scene.png", "overwrite": true, "include_image": false}}