Say menu item, not menu row, in the MCP commands and docs

The MCP command descriptions, docs and code called an entry of the app's
menus a "row", the word they also use for the rows of the object list and
the app's other lists. They now say "menu item", so a row is only ever a row
of a list or table. Command names, arguments and Speed Dial tile ids are
unchanged.
This commit is contained in:
SoftFever committed 2026-11-19 00:35:28 +08:00
1 parent ba02e96c27
commit bbda030f4d
68 files changed
+1270 -1258

No files matched your search

+30 -30
View File
@@ -370,26 +370,26 @@ one would be unreachable, and a table in which an entry's name is not marked for
the mark compiles to the bare string, so nothing at run time could tell it is missing.
The same table is the Design tab's Speed Dial tiles and its automation commands, so the three cannot drift
apart. The header's `kDesignTools` holds 127 entries: the 92 verbs with a menu row, and 35 commands with no row
(`row` -1), such as `describe_design`, `sketch_draw` or `commit_to_plate`. An entry with an `action` or a
`tool` block is a command of the catalog, whose key is the entry's id and whose title is its name, unless it is
a folded row: 88 commands. An entry with an `action` does what its menu row does when it is called with no
arguments, and has a tile. An entry with a `tool` block also runs silently, with arguments: the block is that
apart. The header's `kDesignTools` holds 127 entries: the 92 verbs with a menu item, and 35 commands with no
menu item (`row` -1), such as `describe_design`, `sketch_draw` or `commit_to_plate`. An entry with an `action`
or a `tool` block is a command of the catalog, whose key is the entry's id and whose title is its name, unless
it is a folded item: 88 commands. An entry with an `action` does what its menu item does when it is called with
no arguments, and has a tile. An entry with a `tool` block also runs silently, with arguments: the block is that
form's access, params, examples, whether it reports a rejected rebuild in its reply and whether its schema
refuses an argument it does not name (`closed`), which the header carries as JSON text (`doc`) beside the
entry's `access` and `ok_false`. A row whose tool is a variant of a command is folded into it
entry's `access` and `ok_false`. An item whose tool is a variant of a command is folded into it
(`"fold": {"into", "args"}`): it is no command, keeps its id, its place in the menu, its key and its tile, and
the command opens its tool when called with exactly the row's arguments, as Polar array is
`sketch_pattern {type: "circular"}` and the Corner rectangle `sketch_draw {type: "rectangle_2_point"}`. 37 rows
fold into eight commands, the 24 shape rows into `sketch_draw` among them. An entry with an action and a block
may name the arguments that choose its own row (`args`), as Boolean's Join row is `boolean {operation: "join"}`,
so that each of a command's variants opens the same way. Two rows have neither an action nor a block, Pattern
on Curve and Align to, and are shown greyed: they are no command. Every command has a `section`, its heading in
the names index the MCP server's `tool_search` gives, and `feature_row` marks the four rows whose action works
on the Feature tree's selected row (Edit, Rename, Delete and Constrain sketch). `modal` marks the three
entries whose action opens a dialog that waits for an answer: a modal one for SVG (a file picker) and Color,
which holds the call that opened it until it is answered, and the Design tab's own modeless dialog for Text,
which does not.
the command opens its tool when called with exactly the item's arguments, as Polar array is
`sketch_pattern {type: "circular"}` and the Corner rectangle `sketch_draw {type: "rectangle_2_point"}`. 37 items
fold into eight commands, the 24 shape items into `sketch_draw` among them. An entry with an action and a block
may name the arguments that choose its own item (`args`), as Boolean's Join item is
`boolean {operation: "join"}`, so that each of a command's variants opens the same way. Two items have neither
an action nor a block, Pattern on Curve and Align to, and are shown greyed: they are no command. Every command
has a `section`, its heading in the names index the MCP server's `tool_search` gives, and `feature_row` marks
the four items whose action works on the Feature tree's selected row (Edit, Rename, Delete and Constrain
sketch). `modal` marks the three entries whose action opens a dialog that waits for an answer: a modal one for
SVG (a file picker) and Color, which holds the call that opened it until it is answered, and the Design tab's
own modeless dialog for Text, which does not.
`kDesignSelectionIds` names the selection kinds in `OfferSel`'s order, the ids the verbs' `accepts` use.
The atlas and its generator sit in `scripts/CAD/` rather than in `docs/`: they are build inputs
@@ -405,18 +405,18 @@ as Fusion 360, Onshape and SolidWorks use it, with a prefix for where each works
`construct_`, `feature_`, `body_`, and none for the model), and one argument for a variant: `type` for which
kind of thing it makes, `operation` for what the result does to the bodies already there. A person picks the
same commands from the Speed Dial: while the Design tab is shown with the CAD feature on, it has a tile for
each entry with an action of the mode the tab is in, a folded row's included, the sketch's tools in a sketch
each entry with an action of the mode the tab is in, a folded item's included, the sketch's tools in a sketch
and the model's outside one, titled as the right-click menu names it and with its icon, and on any other tab,
or once the feature is turned off, none; a pinned Design tile stays pinned while it is not shown, and takes no
place on the favourites bar meanwhile. A folded row's tile runs its command with the row's arguments. A call
whose arguments are exactly those that choose a row (none for an entry's own row) does what the menu's row
does, only in the mode the row belongs to, and replies `{"result": {"interactive": true, ...}}` with what the
place on the favourites bar meanwhile. A folded item's tile runs its command with the item's arguments. A call
whose arguments are exactly those that choose an item (none for an entry's own item) does what the menu item
does, only in the mode the item belongs to, and replies `{"result": {"interactive": true, ...}}` with what the
tab shows then (its busy reason and status line); with other arguments, or `silent: true`, the commands
(`Mcp/McpToolsCad.*`) describe the design, read topology, measure, and run the same verbs the offer does —
they re-implement nothing, so a scripted action and a clicked one cannot diverge. Where a GUI action is bound
to a selection, a card or a dialog, its work is split into a function both callers share, and the command
calls that function with explicit arguments instead of driving the widgets. The command set, what each command
does and takes and which menu rows call it, is in [mcp-tools.md](mcp-tools.md), The Design tab's commands.
does and takes and which menu items call it, is in [mcp-tools.md](mcp-tools.md), The Design tab's commands.
An agent's call needs the MCP server on (`--mcp`, or Preferences), and every command, a person's tile included,
needs the CAD feature on (Preferences > Features, or `--cad` for one run). The catalog holds them only when the
@@ -428,14 +428,14 @@ document, `change` and `sketch` commands do not run under an open feature card,
or a body Move, and a `change` one does not run under a sketch session, which `sketch` ones drive. `read`
commands are refused only during a rebuild, and so are `confirm_tool` and `cancel_tool`, which confirm or cancel
what is open as its Confirm and Cancel do, the Text dialog's OK and Cancel among them, and the opening of a
tool, which is also refused in the mode its row does not belong to (a model tool in a sketch, a sketch tool
tool, which is also refused in the mode its item does not belong to (a model tool in a sketch, a sketch tool
outside one): the tab's right-click menu offers a tool only in its mode and refuses it for nothing else, and
each tool decides what an open card means to it. For the menu, and so for the commands, a sketch in Constrain
mode is open, while the tab's keys there are the model's: there a command does what its menu row does, not what
its key does. A tool whose menu row only the right-click menu reaches (a `btn:` or `fly:` action) is refused for
a selection its row does not accept, saying so and naming the selections it takes. `undo` and `redo` are the
shared commands of the Speed Dial and act on the history of the tab shown, the Design tab's while it is shown;
`history: "design"` names the Design tab's from any tab.
mode is open, while the tab's keys there are the model's: there a command does what its menu item does, not what
its key does. A tool whose menu item only the right-click menu reaches (a `btn:` or `fly:` action) is refused
for a selection its item does not accept, saying so and naming the selections it takes. `undo` and `redo` are
the shared commands of the Speed Dial and act on the history of the tab shown, the Design tab's while it is
shown; `history: "design"` names the Design tab's from any tab.
Face and edge ids name faces and edges of the current model, and a rebuild renumbers them while a
stale id still names a real face or edge, so the replies carry the model's `generation`: a call that
@@ -560,8 +560,8 @@ The kernel is covered by Catch2 suites in `tests/libslic3r/` (`test_caddocument`
The automation surface has its own checks. `slic3rutils_tests "[Mcp][CAD]"`
(`tests/slic3rutils/test_mcp_cad.cpp`) runs the commands' argument checks and kernel calls on a
`CadDocument` or a bare `DesignSketchTool`, with no panel, and checks the table and the commands the
catalog holds: one per command entry and none for a folded or a greyed row, a silent form for every tool
block and a block for every silent form, the folded rows' tiles, which call opens a tool and which runs, their
catalog holds: one per command entry and none for a folded or a greyed item, a silent form for every tool
block and a block for every silent form, the folded items' tiles, which call opens a tool and which runs, their
schemas and summaries, and examples that call only real commands with arguments their schemas take;
`scripts/CAD/test_gen_offer_table.py` checks the generator's refusals. On a live application launched with `tools/mcp/orca_mcp.py launch --cad`, the replays
`tools/mcp/tests/cad_*.json` drive the commands through `tool_call`, the live tests `tools/mcp/test_cad_replay.py`,
+138 -137
View File
@@ -106,7 +106,7 @@ point to `settings_get {query}` and its meta for what a setting does, say how a
(and that `gizmo_pick_file` only stands in for a file picker inside one, since its name draws agents to it
for any gizmo work), that the camera turns with `view_set` rather than a drag, and which indices are 0-based.
They also point to `tool_search {query}` as the one search across every catalog an agent calls into:
the commands, among them those `tools/list` never shows (the three menu rows that take no arguments, the
the commands, among them those `tools/list` never shows (the three menu items that take no arguments, the
Design tab's and the operations plugins offer, so nothing else tells an agent they exist), the Speed Dial's
other actions, settings and the Python API. An agent rarely
knows which catalog answers "how do I add a brim", and each catalog has its own search with its own
@@ -590,7 +590,7 @@ A check only one route makes stays with that route, as a step of its own before
`NativeCommands::instance()` and requires every command outside the Design tab that is not read-only
to name an operation or to be on the test's one exception list (`kExceptions`), with the reason: it
runs what its arguments name, it drives the GUI, it changes the session and not the project, its
function has one entry point, it runs its menu row's function (which adds a shape, opens a window or
function has one entry point, it runs its menu item's function (which adds a shape, opens a window or
changes a setting of the app), or it calls the undo and redo of a history (`undo`, `redo`). An entry
that names operations fails the test, so a new command has to say which it is.
- `scripts/check_operation_calls.py`, run by the `Check operation calls` workflow, bans in the callers' files
@@ -605,11 +605,11 @@ getters. That is for review: a caller's handler converts, calls, and shapes the
## Tool catalog
The command set, how its commands are named and grouped, what each does and takes, which menu rows call it and
The command set, how its commands are named and grouped, what each does and takes, which menu items call it and
which calls open a dialog or a tool, is in [mcp-tools.md](mcp-tools.md), with the Design tab's commands in a
section of their own. A command's group is the heading of its place, the first word of its name, and
`tools/list` gives the places in the order that document lists them. Every command that runs from its
arguments is `listed`, so `tools/list` shows it. The menu rows that take no arguments are not: `tool_search`
arguments is `listed`, so `tools/list` shows it. The menu items that take no arguments are not: `tool_search`
finds them and `tool_call` runs them, as it does the Design tab's commands, which no listing shows.
The commands are the process's command catalog (`CommandCatalog`, `NativeCommands::instance()`). Startup
@@ -623,21 +623,21 @@ Design tab's commands come before Driving the GUI, in a CAD build with the CAD f
(`register_cad_commands()`; see Design tab), and the source of the operations plugins offer is added beside
them. A command is made with `inspect_tool()`, `mutate_tool()`, `record_tool()` or `recover_input_tool()`,
which build it through `long_command()` with its function unchanged, so it runs where its call does, or, for
one made from menu rows, with `row_command()`, which builds it through `ui_command()` with the rows as its
tiles; a row's function is in namespace `Rows` (`NativeCommandRows.hpp`), beside the helpers the rows share
in `NativeCommands.cpp`. `reaching()` names the operations a command reaches. A function reaches the
automation runtime through its call's context, `ToolContext::runtime()`: the core gives the runtime that
owns it (`McpCore::set_runtime()`), a person's pick starts the runtime without the endpoint, and a core
built on its own, as in a unit test, refuses, which ends the call in an error. Every key is unique across
the catalog.
one made from menu items, with `menu_command()`, which builds it through `ui_command()` with the items as its
tiles; a menu item's function is in namespace `MenuItems` (`NativeCommandMenuItems.hpp`), beside the helpers
the items share in `NativeCommands.cpp`. `reaching()` names the operations a command reaches. A function
reaches the automation runtime through its call's context, `ToolContext::runtime()`: the core gives the
runtime that owns it (`McpCore::set_runtime()`), a person's pick starts the runtime without the endpoint, and
a core built on its own, as in a unit test, refuses, which ends the call in an error. Every key is unique
across the catalog.
Every command is called by its key: `tools/call`, `tool_call`, a replay step and a script's call reach every
command alike and journal it as its own call. `tools/list` and the editors' tool list
(`editor_tool_catalog()`) read the listed commands, in the catalog's order. `tool_search` reads every
command, then the plugin operations of the catalog's source (`search_commands()`; see Plugins and the
tools), so its one inventory finds an unlisted row's key or a Design command's as it finds a listed one's.
command, then the plugin operations of the catalog's source (`search_commands()`; see Plugins and the tools),
so its one inventory finds an unlisted menu item's key or a Design command's as it finds a listed one's.
A command's tiles are its menu rows, which a person picks in the Speed Dial (see Speed Dial catalog). A
A command's tiles are its menu items, which a person picks in the Speed Dial (see Speed Dial catalog). A
call whose arguments are exactly those of one of its tiles, a command's own tile being `{}`, is the person's
form: it does what a person's pick of that tile does, so it may ask in a dialog, which an agent's call
replies as `blocked_by_dialog`, or act on the selection. Any other call runs from its arguments and opens
@@ -668,8 +668,8 @@ are refused. With none of them the targets are what is selected in the Prepare v
(`Ops::shown_prepare_canvas()` shows that view and loads its scene first): every instance of an object
selected is the object, and an instance or a part stands for its object only where the command says so.
Nothing selected is refused ("Nothing is selected: name the objects, or select them first.",
`nothing_selected`), so is a selection of a kind the command does not take (`wrong_selection`), and a
command of one target refuses a selection of several (`one_object_only`). Where a row acted on the object
`nothing_selected`), so is a selection of a kind the command does not take (`wrong_selection`), and a command
of one target refuses a selection of several (`one_object_only`). Where a menu item acted on the object
list's own rows, a call that names no targets reads those rows too (`object_assemble`, `part_change_type`,
`object_split`, and `object_delete`'s person's form), since the list and the 3D selection disagree when
every instance, or every part, of an object is selected. The reply names what the command acted on
@@ -700,10 +700,10 @@ MP4 has replaced it, nor a command whose deletion has undo (`object_delete`, `pl
command that runs what its arguments name: the input commands (`widget_click`, `widget_set_value`,
`keyboard_press`, `mouse_gesture`), which press whatever is on screen, a Delete button included,
`action_run`, `tool_call`, `replay_run` and `script_run`. What they run may be destructive, but the client
sees both in the arguments, and the label would ask on every call. A command made from menu rows is neither
sees both in the arguments, and the label would ask on every call. A command made from menu items is neither
read-only nor destructive. `open_world` (`openWorldHint`): the command can reach outside OrcaSlicer, to a
printer, the cloud account or the network: `preset_save` (user presets sync), `preset_delete` (the cloud
copy), `webview_run_javascript` (the page's own reach); of the commands made from rows `printer_send`,
copy), `webview_run_javascript` (the page's own reach); of the commands made from menu items `printer_send`,
`preset_sync`, `filament_sync_ams`, `app_check_for_updates`, `app_open_web_page` and `plugin_refresh`;
`plugin_enable` and `plugin_reload`, which run a plugin's code and download a cloud plugin, and
`plugin_uninstall`, whose Unsubscribe reaches the account; and through what they run `action_run`,
@@ -747,7 +747,7 @@ any of them. Where a tool takes two unlike things of one word, each says
whose it is: `discard_changes` drops the project's unsaved changes, `preset_changes` keeps, transfers
or discards the presets'.
An agent calls into two catalogs by name: the commands (those `tools/list` shows, the three menu rows it
An agent calls into two catalogs by name: the commands (those `tools/list` shows, the three menu items it
does not, the Design tab's and the operations plugins offer) and the Speed Dial's actions, which
`action_run` runs.
`tool_search {query}` finds a name in either, and a command runs by its key through `tools/call` and
@@ -1440,7 +1440,7 @@ version) save from a handler on their drop-down list, where a person's pick arri
pressure advance as tower, line or pattern, flow ratio in its four passes, retraction, VFA, cornering, input
shaping frequency and damping) one level below its dialog: it calls the same `Plater::calib_*` the dialog's
OK calls, with the `Calib_Params` the dialog would build. Called with `test` alone, the call of its tile
(one per menu row, whose ids are the rows' ids: `calib_temperature` and the rest), it opens that test's
(one per menu item, whose ids are the items' ids: `calib_temperature` and the rest), it opens that test's
dialog, as the Calibration menu does (`blocked_by_dialog`), and the dialog's OK runs the test; any value of
the test, or `silent: true`, runs it without the dialog. The dialogs only collect and check numbers, so
their rules are shared with the command in `libslic3r/calib.cpp`: `calib_default_params()` (the values each
@@ -1487,11 +1487,11 @@ and saves it with `preset_save`; staying in the test project, `settings_set {"re
### Object commands
Each object command does one menu row's job, or a few rows' with the argument that picks the variant, and
Each object command does one menu item's job, or a few items' with the argument that picks the variant, and
takes its targets as Tool catalog says, so a call names what to act on and a tile acts on the selection,
as its row does. What it does is an operation of `ObjectOps` (see The operations layer), which the row's
own GUI function calls where it has one, so a pick and a call cannot differ. A few have more to say than
their descriptions:
as its menu item does. What it does is an operation of `ObjectOps` (see The operations layer), which the
item's own GUI function calls where it has one, so a pick and a call cannot differ. A few have more to say
than their descriptions:
- `object_order` orders a plate's objects (the current plate, or `plate`, or with `all` every plate), which
sets the object list and print order. With `by` (name, filament, height, size) it does what the plate
@@ -1630,10 +1630,10 @@ never open the Design tab pay in `tools/list` for their names alone. The command
are named and what each takes, is in [mcp-tools.md](mcp-tools.md), The Design tab's commands. The names end
`tool_search`' description while the catalog holds the commands (`design_command_index()`): that they are the
Design tab's CAD commands and what those cover, that one is looked up before it is called, that a command
whose schema has `silent` does what its menu row does when called with no arguments unless `silent` is true,
whose schema has `silent` does what its menu item does when called with no arguments unless `silent` is true,
so `interference {}` with a body selected opens the tool and `interference {silent: true}` returns the result,
and then every key under its heading, in the table's order: Document, Sketch, Solid, Surface, Construct,
Inspect, Bodies, History, and Menu rows, the commands that take no arguments and do what their row of the
Inspect, Bodies, History, and Menu items, the commands that take no arguments and do what their item in the
right-click menu does. The headings are the generator's (`SECTIONS` in `gen_offer_table.py`, `kDesignSections`
in the header), and a command's is its entry's `section`. So an agent learns without a search that the
commands exist, that they are CAD and where each works, and reads a command's description and schema only when
@@ -1642,7 +1642,7 @@ commands that open a tool are in the palette, whose tiles for them the Speed Dia
shown (see Speed Dial catalog). `register_all_commands()` adds them through `register_cad_commands()` only
when the catalog is built with the CAD feature on (`CatalogOptions::cad`, which startup takes in the editor
from the value in force: the `enable_cad_feature` preference, or `--cad` for the run). With it off the catalog
holds none, and records that it leaves them out (`leave_out_cad_commands()`), a folded row's id among them,
holds none, and records that it leaves them out (`leave_out_cad_commands()`), a folded item's id among them,
which names a tile: `tool_call {tool: "hole"}` is an unknown command whose error says the feature was off when
OrcaSlicer started and how a person turns it on, and `app_state` carries `cad_note`, how a person turns the
feature on (`cad_note()`, in the editor while the catalog holds no Design command or the feature is off). The
@@ -1662,7 +1662,7 @@ and feature. No prefix means the 3D model: the commands that build and change th
body as an object, named and coloured, deleted, placed, described and measured, and `body_transform`, since
bare `object_transform` is Prepare's. A name is whole words, never an abbreviation.
One command does one operation: a menu row and the argument command for its job are one command, and a row
One command does one operation: a menu item and the argument command for its job are one command, and an item
that only picks a variant is a way of calling its command. One argument picks the variant. `type` says which
kind of thing the command makes, or which way it makes it: a shape (`sketch_draw`, where a shape drawn more
than one way names the way, `rectangle_3_point`), a pattern's layout, a hole's kind, how a plane is defined.
@@ -1684,34 +1684,34 @@ this one (`align_index`, `align_conflicts`), and a feature's type name (`Mate`,
One table, the Design tab's, declares every command: `kDesignTools` in `CAD/DesignOffer.hpp`, generated from
`scripts/CAD/tool_atlas.json`, which is also the right-click menu (`docs/HLSD/design-tab.md`). An entry with an
action or a tool block is a command, unless it is a folded row (`is_design_command()`): its id is the key and
action or a tool block is a command, unless it is a folded item (`is_design_command()`): its id is the key and
its name the title. Of the 127 entries, 88 are commands, in five kinds:
- A merged entry is a menu row and the argument command for its job as one entry under the command's name: the
row's slot, key, action, accepts, mode, name, icon and hint, with the command's tool block (47:
`sketch_trim`, `extrude`, `feature_edit`). Called with no arguments it does what its row does.
- A merged entry is a menu item and the argument command for its job as one entry under the command's name:
the item's slot, key, action, accepts, mode, name, icon and hint, with the command's tool block (47:
`sketch_trim`, `extrude`, `feature_edit`). Called with no arguments it does what its menu item does.
- A menu-only command has an action and no block (5: `rename_selected`, `zoom_to_selection`,
`sketch_polygon_inscribed`, `sketch_polygon_circumscribed`, `sketch_constrain_selected`). It takes no
argument at all (`additionalProperties: false`), `silent` included.
- An argument-only command has a block and no action (36: `describe_design`, `sketch_draw`,
`select_geometry`); all but `measure`, whose row has no GUI path, have no menu row (`row` -1).
- A folded row (`"fold": {"into": "sketch_pattern", "args": {"type": "linear"}}`) is a row whose tool is a
variant of the command it names: calling that command with the row's arguments opens it, so Linear array
is `sketch_pattern {type: "linear"}` and Color `body_set {}`. It is no command, and keeps its entry and its
id, which the menu, the keys, the toolbar, its tile and the GUI tests use. 37 rows fold into eight
commands: `sketch_draw` (24 shapes), `sketch_set_value` (the three value rows, one action under three
`select_geometry`); all but `measure`, whose menu item has no GUI path, have no menu item (`row` -1).
- A folded item (`"fold": {"into": "sketch_pattern", "args": {"type": "linear"}}`) is a menu item whose tool
is a variant of the command it names: calling that command with the item's arguments opens it, so Linear
array is `sketch_pattern {type: "linear"}` and Color `body_set {}`. It is no command, and keeps its entry
and its id, which the menu, the keys, the toolbar, its tile and the GUI tests use. 37 items fold into eight
commands: `sketch_draw` (24 shapes), `sketch_set_value` (the three value items, one action under three
labels, each `{}`), `sketch_transform` (3), `sketch_pattern` (2), `boolean` (2), and `thicken`, `pattern`
and `body_set` (one each).
- A greyed row has a slot and neither an action nor a block (`pat_curve`, `align_to`): shown disabled, and no
- A greyed item has a slot and neither an action nor a block (`pat_curve`, `align_to`): shown disabled, and no
command.
An entry with an action and a block may also name the arguments that choose its own row (`args`): `boolean`'s
Join row is `{operation: "join"}`, `thicken`'s `{type: "face"}` and `pattern`'s `{type: "linear"}`, so that
each of a command's variants opens the same way. The generator refuses a table in which a fold names no entry,
another folded row or an entry with no block, a folded row has a block of its own or another mode than its
command's row, two rows of a command have the same arguments under different actions, a row's arguments are
its command's own, own `args` sit on an entry without an action and a block or are `{}`, or a command has no
`section` (and a folded or greyed row has one).
An entry with an action and a block may also name the arguments that choose its own menu item (`args`):
`boolean`'s Join item is `{operation: "join"}`, `thicken`'s `{type: "face"}` and `pattern`'s
`{type: "linear"}`, so that each of a command's variants opens the same way. The generator refuses a table in
which a fold names no entry, another folded item or an entry with no block, a folded item has a block of its
own or another mode than its command's item, two items of a command have the same arguments under different
actions, an item's arguments are its command's own, own `args` sit on an entry without an action and a block
or are `{}`, or a command has no `section` (and a folded or greyed item has one).
An entry with a tool block has a silent form, whose function `kSilentForms` binds by the entry's id; a unit
test fails for a block with no function and a function with no block. The block gives the silent form's
@@ -1720,15 +1720,15 @@ limits, one to three examples, whether it reports a rejected rebuild in its repl
schema is closed (`closed`); the header carries it as JSON text (`doc`). `register_cad_commands()` makes a
command of each entry that is one (`design_command()`, through `cad_command()`), in the table's order. It is
`read_only` and `idempotent` for a `read` block, and has the entry's icon. Its description is the summary, the
details, with `ok_false` how a rejected rebuild shows, and, for a command whose rows a call's arguments choose,
those argument sets each with its rows' names (`opening_calls()`), so that a search for "polar array" or
"rounded rectangle" finds `sketch_pattern` or `sketch_draw` (`tool_search` matches keys, titles and
details, with `ok_false` how a rejected rebuild shows, and, for a command whose menu items a call's arguments
choose, those argument sets each with its items' names (`opening_calls()`), so that a search for "polar array"
or "rounded rectangle" finds `sketch_pattern` or `sketch_draw` (`tool_search` matches keys, titles and
descriptions, not schemas). A menu-only command's description is its hint and what its call does: what its
right-click menu row does, which may open a tool, start a sketch tool, act at once or tell the person why it
right-click menu item does, which may open a tool, start a sketch tool, act at once or tell the person why it
cannot, with the status line in the reply, and the mode it runs in, "only in an open sketch" or "only outside
a sketch" by its row. Its examples are the block's, each `{title, calls: [{tool, args}], needs?}` ending with
the command it documents, where an argument `{"from_call": i, "key": k}` is the value under `k` in the result
of call `i`, and a call that gives nothing else of a command that opens a tool with no arguments is
a sketch" by its menu item. Its examples are the block's, each `{title, calls: [{tool, args}], needs?}` ending
with the command it documents, where an argument `{"from_call": i, "key": k}` is the value under `k` in the
result of call `i`, and a call that gives nothing else of a command that opens a tool with no arguments is
`{"silent": true}`. Its input
schema (`cad_input_schema()`) is built from the params: a type written `"a|b"` is the list of both, `min`,
`exclusive_min` and `max` are `minimum`, `exclusiveMinimum` and `maximum`, `enum` and `default` carry over,
@@ -1758,46 +1758,47 @@ read more than they name (a param in radians also in degrees under its name with
reads `index` as `feature` and `params` or `values` as `fields` (`normalize_arguments()`), the names `feature_describe`, `feature_edit` and
the tree edits also read.
One rule decides what a call of a Design command does (`opened_row()`): **a call whose arguments are exactly
those that choose one of its rows opens that row's tool for a person, as a pick of the row does; any other
call runs its silent form.** No arguments choose the entry's own row where it has an action (`sketch_trim {}`,
`boolean {}`); where it has none, the rows folded into it with `{}` (`body_set {}` the Color row,
`sketch_set_value {}` the first of the value rows). A row's own or folded `args` choose that row:
`boolean {operation: "cut"}` opens the Subtract row, `sketch_draw {type: "circle_3_point"}` arms the 3-point
One rule decides what a call of a Design command does (`opened_item()`): **a call whose arguments are exactly
those that choose one of its menu items opens that item's tool for a person, as a pick of the item does; any other
call runs its silent form.** No arguments choose the entry's own item where it has an action (`sketch_trim {}`,
`boolean {}`); where it has none, the items folded into it with `{}` (`body_set {}` the Color item,
`sketch_set_value {}` the first of the value items). An item's own or folded `args` choose that item:
`boolean {operation: "cut"}` opens the Subtract item, `sketch_draw {type: "circle_3_point"}` arms the 3-point
circle, and with entities selected `sketch_pattern {type: "circular"}` the Polar array. The arguments are
compared as JSON values after `normalize_arguments()`, so `boolean {type: "cut"}` opens it too, and anything
beside them, `generation` or `silent: true` among them, makes the call run. `silent: true` runs the silent
form with the defaults of what the call leaves out, beside the choosing arguments as beside none. A command has
`silent` where a call with no arguments opens a tool; `sketch_draw`, `sketch_transform` and `sketch_pattern` have
none, since a call of them with no arguments opens nothing, and their closed schemas refuse `silent` beside their
choosing arguments. So a call meant to run that gives only a row's arguments opens the tool, and its reply says so.
choosing arguments. So a call meant to run that gives only an item's arguments opens the tool, and its
reply says so.
A call that opens a tool, an agent's or a tile's, is the person's form (`open_tool()`, on the row's entry). It
A call that opens a tool, an agent's or a tile's, is the person's form (`open_tool()`, on the item's entry). It
passes `cad_gate()` with `CadAccess::None`, whose only busy rule is the rebuild's, so the recipe is loaded and
the call refused while the model is being rebuilt, and runs the row's action in place
(`DesignPanel::mcp_run_verb()`), as the menu's row and the tab's keys do: an open card does not refuse it,
the call refused while the model is being rebuilt, and runs the item's action in place
(`DesignPanel::mcp_run_verb()`), as the menu item and the tab's keys do: an open card does not refuse it,
since each tool decides what that means to it. Before the action, `open_refusal()` refuses it in two cases
(`-32000`). An entry runs only in the mode its row belongs to, where the right-click menu offers it
(`-32000`). An entry runs only in the mode its menu item belongs to, where the right-click menu offers it
(`offered_in_mode()`, by the menu's `sketch_map_applies()`, for which a sketch in Constrain mode is open too): a
model tool such as Shell in an open sketch is refused with "This tool works on the model: finish or cancel the
sketch first" (`mode: "model"`), a sketch tool outside a sketch with "This tool works in a sketch: open a
sketch first" (`mode: "sketch"`). No entry is offered in both modes, and the only keys read in both, the
Ctrl+Shift ones, are no entry's action. The tab's keys take the sketch's entries only in Sketch mode, so in
Constrain mode they reach the model's while the menu offers the sketch's: there a command does what its menu
row does, not what its key does. And an action that only the right-click menu reaches (`btn:`, `fly:`),
whose row the menu greys for a selection it does not accept, is refused for one with "This tool does not apply
item does, not what its key does. And an action that only the right-click menu reaches (`btn:`, `fly:`),
whose item the menu greys for a selection it does not accept, is refused for one with "This tool does not apply
to what is selected", its details naming the selection (`selection_kind`, `selection`) and the atlas ids of
those the row accepts (`accepts`). Only a row that accepts a kind the tab can report in its mode is greyed so
(`reported_kinds()`): Boolean's rows take two bodies and Rib's a sketch line, which the tab never reports as
those the item accepts (`accepts`). Only an item that accepts a kind the tab can report in its mode is greyed so
(`reported_kinds()`): Boolean's items take two bodies and Rib's a sketch line, which the tab never reports as
what is selected, so `boolean {}` opens the Boolean card as its toolbar button does, whatever is selected. It
never gives the row's refusal, which is about the document (no body yet) and which the menu shows only for a
row that takes the selection. A `key:` action runs whatever is selected, as its key does. A call that is not a
never gives the item's refusal, which is about the document (no body yet) and which the menu shows only for an
item that takes the selection. A `key:` action runs whatever is selected, as its key does. A call that is not a
person's pick, made while a row of the Feature list is selected and nothing is picked in the view, takes that
row as what four rows act on (`feature_row` in the atlas): `feature_edit`, `rename_selected`, `feature_delete`
and `sketch_constrain_selected` are not refused for the selection then, and their action says itself what it
cannot do with the row; `zoom_to_selection` acts on what is picked in the view. A person's pick keeps the
menu's rule, which greys those rows for that selection. The reply is `{"result": {"interactive": true,
"tool", "applies", "modal", "selection_kind", "busy", "status"}}`: the command called, whether the row accepts
row as what four menu items act on (`feature_row` in the atlas): `feature_edit`, `rename_selected`,
`feature_delete` and `sketch_constrain_selected` are not refused for the selection then, and their action says
itself what it cannot do with the row; `zoom_to_selection` acts on what is picked in the view. A person's pick
keeps the menu's rule, which greys those items for that selection. The reply is `{"result": {"interactive": true,
"tool", "applies", "modal", "selection_kind", "busy", "status"}}`: the command called, whether the item accepts
the selection, whether a dialog the action opened held the call until it was answered (the atlas's `modal`
entries but Text, whose dialog is modeless: `DesignPanel::mcp_text_dialog_open()` tells it), the selection's
kind, `mcp_busy()`'s reason after the action (a card, a dialog or a sketch now open) or null, and the text of
@@ -1930,9 +1931,9 @@ reach the same fields. `feature_set_expression {feature, field, expr}` binds a f
removes a binding, as `set_variable`'s removes a variable, as the Variables panel's Clear and Remove do; a
binding on a field the evaluator does not know, or removing one that is not there, is refused.
A sketch goes from a session to a solid in typed calls. `sketch_create {plane}` opens the session
through `DesignPanel::begin_sketch_session()`, the code a plane or face pick runs, without the tool
menu that follows the click; `sketch_create {}` is the Sketch row, which with nothing picked waits for a plane.
A sketch goes from a session to a solid in typed calls. `sketch_create {plane}` opens the session through
`DesignPanel::begin_sketch_session()`, the code a plane or face pick runs, without the tool menu that
follows the click; `sketch_create {}` is the Sketch menu item, which with nothing picked waits for a plane.
`sketch_finish` is the sketch's ✓, whose commit handler adds the Sketch feature and solves its dimensions; the
reply reads the committed feature back: `sketch_index`, its name and its loops. A new sketch left empty is
refused before anything changes and the session stays open, because an exported replay leaves the failed call
@@ -2075,7 +2076,7 @@ binormal), as a spring's or a thread's wire is drawn. `helix` replies with its `
`tangent`, where a profile is drawn across the curve. `loft` takes two or more sketches in order.
`split {plane}` is the Cut card's feature (`add_cut`) with the card's plane forms plus a face plane,
`offset`, `flip` and the kernel's `keep_upper`/`keep_lower`, which the card always leaves both on;
`split {face}` splits along a face's plane, and `split {}` is the Cut row. A plane clear of the body is
`split {face}` splits along a face's plane, and `split {}` is the Cut menu item. A plane clear of the body is
refused, since the kernel would leave one piece empty. The reply names the pieces: the upper one keeps the
body's index and the lower one follows it.
@@ -2091,7 +2092,7 @@ rebuilding call ("Busy: thread is still running"), and `mcp_busy()` refuses ever
a rebuild's worker owns the document, the GUI's own rebuilds included. A call past the reply budget
becomes a running job.
`select_geometry` sets the selection a click would set, in the view and in the lists, so that a row's call
`select_geometry` sets the selection a click would set, in the view and in the lists, so that a menu item's call
with no arguments, `zoom_to_selection` and `rename_selected` have something to act on: a body as a click on
its Bodies row selects it, a face, edges or a vertex of a body as a click in the view picks them, a reference
plane while a click could pick one (the Origin row shows the planes, or Sketch waits for its plane, where
@@ -2209,8 +2210,8 @@ show. A project holding only a design loads no objects, and `Plater::load_projec
its file all the same, since a loaded recipe counts as a loaded project.
`tests/slic3rutils/test_mcp_cad.cpp` (`[Mcp][CAD]`) checks the Design commands as the catalog holds
them (one per command entry of the Design table, none for a folded or greyed row, a silent form for every
block and a block for every silent form, which entries have a tile and an icon, the folded rows' tiles, their
them (one per command entry of the Design table, none for a folded or greyed item, a silent form for every
block and a block for every silent form, which entries have a tile and an icon, the folded items' tiles, their
schemas, descriptions, sections and access, and every example's calls against their commands' schemas), that
none is registered with the feature off, which call opens a tool and which runs, how a call is journaled, the
plane resolver, the rollbacks, and the tools through their public seams (`cad_sketch_extrude()`,
@@ -2229,7 +2230,7 @@ and fails an example when a call fails or its result has `ok` false, an error, o
`tools/mcp/test_cad_commands.py` checks in the running app what the commands' arguments do where the Design
panel's own functions answer: the words, `sketch_draw` against each shape's tool, `sketch_edit`, the
gaps' argument forms, `feature_edit`'s `refs`, `select_geometry`, `confirm_tool` and `cancel_tool`,
`body_place`, the Boolean card a call opens, and a folded row's tile picked from the Speed Dial and
`body_place`, the Boolean card a call opens, and a folded item's tile picked from the Speed Dial and
replayed. `tools/mcp/test_cad_sketching.py`, `test_cad_context_menu.py`
and `test_cad_click_edit.py` drive the Design tab through the GUI tools as a person does (canvas gestures,
typed values, the offer menu, file pickers answered by path rules) and read the result back with `read`
@@ -2238,25 +2239,25 @@ Design commands.
## Speed Dial catalog
`action_search` and `action_run` serve the Speed Dial's `ActionRegistry`: the commands' tiles, plates,
recent projects, plugin scripts and pages, and, on request, settings. A tile is a menu row a person picks:
recent projects, plugin scripts and pages, and, on request, settings. A tile is a menu item a person picks:
one of a command's `tiles` (`NativeCommand::tiles`, made with `NativeCommands::tile()`: `{key, title,
group, icon, description, args, input?, input_arg?}`, which the command reference writes), or a command's
own tile (`in_palette`), whose key is the command's. A menu row and the command that does its job are one
command, so the rows of one job are tiles of one command, each with the arguments that pick its variant:
own tile (`in_palette`), whose key is the command's. A menu item and the command that does its job are one
command, so the items of one job are tiles of one command, each with the arguments that pick its variant:
Mirror > Along X Axis is `object_mirror {axis: "x"}` under the id `obj_mirror_x`, Export G-code is
`project_export {format: "gcode"}` under `export_gcode`, and the nine view directions are `view_set {camera}`
tiles. Eight commands, whose names are their rows' ids, have a tile of their own: `plate_add`,
tiles. Eight commands, whose names are their menu items' ids, have a tile of their own: `plate_add`,
`plate_delete`, `plate_duplicate`, `plate_rename`, `filament_add`, `filament_delete`, `undo` and `redo`.
A tile keeps what a person sees of its row: its id (`orca_command:<key>:orca`, the row's id as the key,
A tile keeps what a person sees of its menu item: its id (`orca_command:<key>:orca`, the item's id as the key,
whatever its command is named), its title, its Speed Dial section (the item's `group`, or the command's
`tile_group` for its own tile, since a command's `group` is its place's heading and one command's tiles come
from several sections: `export_gcode` is in Slice & Export, `export_stl_multi` in Export), its icon and the
value its second phase collects (`input`). A person's pins and run counts are stored under the id, so the
ids of the rows a released build stored stay the ids of tiles. `tests/data/speed_dial_tiles.json` holds the
129 tiles (key, title, section, icon, input), and the unit test "every Speed Dial tile of today is still a
tile" finds each in the palette with that presentation and no other; "a row's id is a tile's key, not a
command" holds that no row's id is a command's name.
ids of the menu items a released build stored stay the ids of tiles. `tests/data/speed_dial_tiles.json` holds
the 129 tiles (key, title, section, icon, input), and the unit test "every Speed Dial tile of today is still a
tile" finds each in the palette with that presentation and no other; "a menu item's id is a tile's key, not
a command" holds that no menu item's id is a command's name.
The commands live in one `CommandCatalog` (`CommandCatalog.hpp`, which includes no wx), built once at startup
by `NativeCommands::build()` before the automation runtime starts, and sealed: from then on it never changes and
@@ -2281,10 +2282,10 @@ Design table with an action that is offered in the tab's mode, in the table's or
none otherwise, so the Speed Dial has the sketch's tiles in an open sketch, the model's outside one, and no
Design tile on another tab, nor once the feature is turned off: the tab stays until the restart, but
`cad_gate()` would refuse every pick of its tiles. A Design command with an action of its own has its tile
under its key (`orca_command:sketch_trim:orca`); a menu row folded into a Design command keeps its tile under
the row's id (`orca_command:sk_array:orca`), one of the command's `tiles`, with the row's title and icon, and
a pick runs the command with the row's arguments, as `tool_call {"tool": "sketch_pattern", "args": {"type":
"linear"}}` does. 89 Design tiles in all: 52 commands' own and 37 folded rows'. A Design command's own tile,
under its key (`orca_command:sketch_trim:orca`); a menu item folded into a Design command keeps its tile under
the item's id (`orca_command:sk_array:orca`), one of the command's `tiles`, with the item's title and icon, and
a pick runs the command with the item's arguments, as `tool_call {"tool": "sketch_pattern", "args": {"type":
"linear"}}` does. 89 Design tiles in all: 52 commands' own and 37 folded items'. A Design command's own tile,
unlike any other command's, takes its command's arguments. For a Design command, a tile's title is the
entry's name translated with the `Design` context (`title_context()`), as the right-click menu translates it,
and its icon is the entry's. Every place that shows a person a command's title translates it so: the Action
@@ -2295,10 +2296,10 @@ shown it (`call_title()`, `tile_with_args()`, which skips a tile that collects a
(`McpRecorder::call_started()`, through `shown_title()`, which also titles `action_run` of a tile as the
tile) and an Action Replay step, whose description names the tile (`describe_step()`'s `what` has `tile`,
which `replay_what_text()` titles). Every Design entry's name is marked for translation in that context
(`gen_offer_table.py` writes it as `L_CONTEXT`), also an entry's with no menu row, which has no tile but is
(`gen_offer_table.py` writes it as `L_CONTEXT`), also an entry's with no menu item, which has no tile but is
shown in these places. A pin of a Design tile stays in the stored favourites while its tile is not live, and
only leaves the bar that is shown (`prune_favourites()`, `is_design_tile_id()`, which goes by the Design
table's entries with an action, a folded row's among them, so also when the CAD feature was off at startup).
table's entries with an action, a folded item's among them, so also when the CAD feature was off at startup).
Every other pin with no live action is dropped, a pin stored under an id the table does not have among them,
and the pins around it are kept. A build without CAD has no Design tile, and drops such a pin as any other.
The bar's limit of ten is on what it shows: the first ten live pins in their stored order. A pin is refused
@@ -2333,8 +2334,8 @@ Helpers wrap the function a command's author writes and place it on the thread i
carries that result as its `notice`. Called by automation, it runs in one `ctx.run_ui()` closure, then
`settle()`, and `from_run_result()` makes the reply: `{ran, level, message?}` with the fields of the
result's `reply`; an error for an Error or Busy level and for a command that did nothing, worded from an
operation's refusal in English with `{code, names?}` as details. A command made from menu rows is one
(`row_command()`): `fn` runs the row its variant argument names, on the targets the call names, else on
operation's refusal in English with `{code, names?}` as details. A command made from menu items is one
(`menu_command()`): `fn` runs the item its variant argument names, on the targets the call names, else on
what is selected.
- `long_command(key, title, group, schema, fn, inline_call)`: `fn(args, ctx)` runs where its call does,
on the job's thread for an automated call. Picked by a person it is started as a job and returns at
@@ -2346,21 +2347,21 @@ Helpers wrap the function a command's author writes and place it on the thread i
command's title, or an Error when no job started (another operation holds the project, the app is
closing); the job's result shows as a notification when it ends. So a pick of Slice and Preview or Slice
All Plates, tiles of `plate_slice`, starts the slice as a job, where a call waits for its result.
- `with_row_forms(tool, person, ...)` and `with_person_form(tool, person, ...)`: a typed command whose tiles
are rows that ask, or that act on what a person selected. Its person's forms are `{}` for its own tile
and the `args` of each item that collects no value (`Mcp::person_forms()`); a call that is one of them
(`Mcp::person_form(command, args)`) runs `person` with those arguments on the UI thread, as `ui_command()`
runs a function, and any other call is the command's own function. `with_person_form()` is for a command
whose own function needs what its person's forms leave out (a path a dialog asks for): `Mcp::with_silent()`
adds `silent` to the schema, which only `true` fits, and moves the own function's `required` list under
`"if": {"not": {"enum": [<the person's forms>]}}, "then": {"required": [...]}` (or `"if":
{"minProperties": 1}` where the only person's form is `{}`), which the validator reads as "required unless
the call is a person's form"; it reads no other use of `if`. A call with `silent` is the own function,
given `silent` with the other arguments, so the journal records the call as silent. Where a row does what
the command does (the nine camera tiles of `view_set`, Select All and Deselect All of `object_select`,
Auto-Arrange, Auto-Orient, Refresh Plugins), its tile is one of the command's `own_forms`: an automated call
of it runs the command's own function and replies as any call,
and a person's pick runs the same function in place, on the UI thread, showing what the row showed. A
- `with_menu_item_forms(tool, person, ...)` and `with_person_form(tool, person, ...)`: a typed command whose
tiles are menu items that ask, or that act on what a person selected. Its person's forms are `{}` for its
own tile and the `args` of each item that collects no value (`Mcp::person_forms()`); a call that is one of
them (`Mcp::person_form(command, args)`) runs `person` with those arguments on the UI thread, as
`ui_command()` runs a function, and any other call is the command's own function. `with_person_form()` is
for a command whose own function needs what its person's forms leave out (a path a dialog asks for):
`Mcp::with_silent()` adds `silent` to the schema, which only `true` fits, and moves the own function's
`required` list under `"if": {"not": {"enum": [<the person's forms>]}}, "then": {"required": [...]}` (or
`"if": {"minProperties": 1}` where the only person's form is `{}`), which the validator reads as "required
unless the call is a person's form"; it reads no other use of `if`. A call with `silent` is the own
function, given `silent` with the other arguments, so the journal records the call as silent. Where a menu
item does what the command does (the nine camera tiles of `view_set`, Select All and Deselect All of
`object_select`, Auto-Arrange, Auto-Orient, Refresh Plugins), its tile is one of the command's `own_forms`:
an automated call of it runs the command's own function and replies as any call,
and a person's pick runs the same function in place, on the UI thread, showing what the item showed. A
person's pick of a tile that collects a value (Go to layer, Go to tab) runs in place too, given the tile's
call; an automated call of it is the command's own.
@@ -2377,7 +2378,7 @@ the value under the token, and the tile passes it on under its command's argumen
`layer_percent` for `percent`; `tab` keeps its name), so `{"percent": 50}` runs `view_set {layer_percent:
50}`; a page id that a word of `view_set`'s `tab` names (`kTabWords`) is given as that word, the Device tab's
`monitor` as `device`. Go to Plate is the tile `plate_goto` of `plate_select`, with `{plate: 0}`: the first
plate, as the row did when given none, and the plate family of the Speed Dial calls the command with each
plate, as the menu item did when given none, and the plate family of the Speed Dial calls the command with each
plate.
### action_search and action_run
@@ -2413,7 +2414,7 @@ close ids, scored by edit distance against both the full id and its key, a key t
(`delete_all` in the tile id `obj_delete_all`) counting as closest, and says where to find an action or a
command (see Tool catalog); the id or key of a Design tile that is not live says instead that the tile is
there only while the Design tab is shown in its mode with the CAD feature on, and names the call that runs its
command from any tab, with a folded row's arguments (`tool_call {"tool": "sketch_pattern", "args": {"type":
command from any tab, with a folded item's arguments (`tool_call {"tool": "sketch_pattern", "args": {"type":
"linear"}}`), or, in a run started with the feature off, that it was off then and how a person turns it on, as
`tool_call` does (`unknown_action()`).
@@ -2436,11 +2437,11 @@ command does.
### Commands that replace a dialog
A call with exactly a tile's arguments is the person's form and asks as the row does; any other call runs
A call with exactly a tile's arguments is the person's form and asks as the menu item does; any other call runs
from its arguments and opens nothing. Which tiles ask, what each asks, the call that does the same without
asking, and the commands that open a dialog whatever their arguments are in [mcp-tools.md](mcp-tools.md),
When a call opens a dialog or a tool. A path is absolute, and an output takes
`overwrite: true` to replace a file that exists; `path_argument()` resolves `{"path", "overwrite"?}` for the rows that take one and turns
`overwrite: true` to replace a file that exists; `path_argument()` resolves `{"path", "overwrite"?}` for the menu items that take one and turns
a bad or missing path into an Error result.
`preset_import` with a path imports presets as the Import Configs dialog does, through
@@ -2456,8 +2457,8 @@ preset names before and after; a call that changes nothing is an Error with the
the printer first. A `.gcode` loads the settings it was sliced with through
`MainFrame::load_config_file(path)`.
A command made from rows that refuses says why, each refusal in its own words (an `Ops::Refusal`, shown in
the UI's language to a person and read in English by a call): a pick shows it at its level, Info for most,
A command made from menu items that refuses says why, each refusal in its own words (an `Ops::Refusal`, shown
in the UI's language to a person and read in English by a call): a pick shows it at its level, Info for most,
and an automated call replies `isError`. `filament_add` and `filament_delete` are the filament list's + and -
buttons and a slot's Delete and Merge with menu items (`Ops::add_filament_slot()`,
`Ops::delete_filament_slot()`):
@@ -2469,7 +2470,7 @@ objects on them. `filament_delete` takes a 1-based `filament_slot`, the last phy
signed in, and `filament_sync_ams` with no printer, no AMS or no filament.
A command whose effect its message does not carry sets `AppActionRunResult::reply`, a JSON object whose
fields an automated call's reply has and the palette never shows (`row_reply()`): `object_order` replies with
fields an automated call's reply has and the palette never shows (`menu_reply()`): `object_order` replies with
the new order (`order: [{object, name, plate}]`) and `descending`, `object_assemble` with the new object's
`object` and `name`, `object_separate_instances` with the `objects` the instances are in, and
`object_set_instances` with `object` and `instances`. A refusal after a dialog the person answered or read,
@@ -2503,11 +2504,11 @@ declared in the `McpTools*.cpp` of its place beside the commands of that place:
For work that finishes later, call `ctx.begin_operation()`, wait with `poll_ui()`, and give the work an
identity, as slicing and export do. Work on the UI job worker needs none of that: the call that starts it
holds it as its operation (see Worker jobs).
3. Where a menu row does the job, the row is a tile of the command (`NativeCommands::tile()`), with the
arguments that pick its variant and the section, title and icon the row has, and the command takes its
person's form for it (`row_command()`, `with_row_forms()` or `with_person_form()`). A row that asks keeps
its owner's asking path for that form; the call with arguments must not prompt, and refuses instead. A row
with no argument form is a command that is not `listed`.
3. Where a menu item does the job, the item is a tile of the command (`NativeCommands::tile()`), with the
arguments that pick its variant and the section, title and icon the item has, and the command takes its
person's form for it (`menu_command()`, `with_menu_item_forms()` or `with_person_form()`). An item that
asks keeps its owner's asking path for that form; the call with arguments must not prompt, and refuses
instead. An item with no argument form is a command that is not `listed`.
The command then appears in `tools/list`, in `tool_search`, its tiles in the palette, `action_search` and
`action_run`, and its calls in replays.
@@ -4414,13 +4415,13 @@ plugin unloads runs to its end; its own tool calls are refused from then on.
**`tool_search` and `tool_call`.** `tool_search` reads one inventory (`search_commands()`): every
command of the catalog and the operations its source holds. `{tool}` gives any command's description,
schema, group, `read_only` and `listed`, and its examples when it has some (the Design commands, `undo` and
`redo`, and the commands that close a gap the menu rows left, such as `object_fix`, `printer_install` and
`redo`, and the commands that close a gap the menu items left, such as `object_fix`, `printer_install` and
`plugin_enable`), and a call with neither `tool` nor `query` lists every name. Its `group` narrows the names and
the command matches to one group (see Tool catalog); the other catalogs' matches beside them are not
narrowed.
Its search by words is the one search across catalogs: the best five commands that match (more with
`limit`), each `{name, group, summary, listed}`, the summary the first sentence of its description. A
listed command's schema is in `tools/list`; one that is not listed, a menu row with no arguments, a Design
listed command's schema is in `tools/list`; one that is not listed, a menu item with no arguments, a Design
command or a
plugin's operation, also carries its `input_schema`, and its description where that says more than the
summary, which nothing else shows (an operation's first
@@ -4580,7 +4581,7 @@ In `tests/slic3rutils/`, the files of the same name hold the cases that need the
process catalog's `tools/list` and the tool families the stdio bridge lists; `test_command_catalog` the
process catalog itself: unique keys, the commands under their places' headings in the tool list's order,
which are listed, the Speed Dial's 129 tiles held as data in `tests/data/speed_dial_tiles.json` (tagged
`[SpeedDial]`: each found with its id, title, section, icon and input, every row's id a tile's key and no
`[SpeedDial]`: each found with its id, title, section, icon and input, every menu item's id a tile's key and no
command, every tile's arguments fitting its command's schema), the person's forms of the commands with tiles
and what a pick of a tile runs in place, the names of `retired_names.hpp`, which no command has, the
access labels (`preset_delete` and `plugin_uninstall` alone destructive), a tool list built without a runtime,
@@ -4674,17 +4675,17 @@ instruments going off with the server,
`tools/mcp/test_recovery_under_load.py` answering a dialog while stalled clients hold every
connection. See `tools/mcp/README.md`.
The commands that do a menu row's job by index, and the gaps they close, have their checks on the app. The
replays `tools/mcp/tests/rows_objects.json`, `rows_structure.json`, `rows_placement.json` and
`rows_plates.json` call the commands made from rows by index and on the selection, and read each back;
`objects_state.json` (printable, Fix Model, Auto Drop), `objects_files.json` (clone, reload, replace),
The commands that do a menu item's job by index, and the gaps they close, have their checks on the app. The
replays `tools/mcp/tests/menu_items_objects.json`, `menu_items_structure.json`, `menu_items_placement.json` and
`menu_items_plates.json` call the commands made from menu items by index and on the selection, and read each
back; `objects_state.json` (printable, Fix Model, Auto Drop), `objects_files.json` (clone, reload, replace),
`objects_order.json` (`object_order {order}`), `filaments_and_files.json` (slots merged and mixed, exports of
some objects, a ZIP's entries), `settings_targets.json` (`settings_list` and the targets of the settings
commands), `presets_and_plate_map.json` (`preset_list`'s filters, a plate's filament map, a nozzle variant),
`view_switches.json` (`view_set`'s switches, the sidebar and the legend, a plate's origin and size) and
`tiles_ask.json` (a call with a tile's arguments, the two tiles that collect a value, and the tiles whose row
is the command's function). The Python tests check what a replay cannot, a refusal:
`tools/mcp/test_rows_refusals.py` and `test_additions_refusals.py` each refusal's reason,
`tiles_ask.json` (a call with a tile's arguments, the two tiles that collect a value, and the tiles
whose menu item is the command's function). The Python tests check what a replay cannot, a refusal:
`tools/mcp/test_menu_items_refusals.py` and `test_additions_refusals.py` each refusal's reason,
`test_person_forms.py` the person's forms and a pick that runs in place, `test_preferences.py` the
preferences against the dialog, `test_install_printers.py` and `test_install_filaments.py` the installs, also
after a restart, `test_plugin_commands.py` the plugin commands against the Plugins window,
+84 -83
View File
@@ -6,25 +6,25 @@ OrcaSlicer's MCP server gives a client 118 commands, its MCP tools: for the app,
parts and plates, presets and settings, filaments, printers, plugins, the view and windows, recordings,
replays and scripts, and for driving the GUI itself. An agent calls them by name. A person's Speed Dial tiles
run them, Action Replay and recordings show them, and the journal records and replays them. A client that
knows the app's menus can guess the command that does a row's job and the argument that picks the row, and
can do from arguments what a person does through the row and its dialog.
knows the app's menus can guess the command that does a menu item's job and the argument that picks the
item, and can do from arguments what a person does through the item and its dialog.
This document is that command set: how the commands are named and grouped, what each does and takes, which
menu rows are tiles of which command, which calls ask in a dialog, and the behaviour a caller relies on
menu items are tiles of which command, which calls ask in a dialog, and the behaviour a caller relies on
across the commands. How the server serves them (the catalog, the guards, jobs, the journal, the operations
layer) is in [mcp-server.md](mcp-server.md).
The Design tab, OrcaSlicer's optional CAD component, adds 88 commands of its own while the CAD feature is
on. They run on the same server and keep the same rule for menu rows, but are named and grouped as CAD
on. They run on the same server and keep the same rule for menu items, but are named and grouped as CAD
programs name theirs, so they have a section of their own at the end, The Design tab's commands.
Each place's commands are written in its family's file, `src/slic3r/GUI/Mcp/McpTools*.cpp`, and gathered by
`register_all_commands()`. A menu row's function is in namespace `Rows` (`NativeCommandRows.hpp`), and what a
command does that a dialog or another interface does too is an operation of `src/slic3r/GUI/Operations/`.
What every command takes and replies is in its description and input schema, which `tools/list` gives a
client and `tool_search {tool}` gives for any command. `tests/data/command_catalog.json` holds every command's
schema, tiles, labels and examples as an agent sees them, and `tests/data/speed_dial_tiles.json` the tiles as
a person sees them.
`register_all_commands()`. A menu item's function is in namespace `MenuItems` (`NativeCommandMenuItems.hpp`),
and what a command does that a dialog or another interface does too is an operation of
`src/slic3r/GUI/Operations/`. What every command takes and replies is in its description and input schema,
which `tools/list` gives a client and `tool_search {tool}` gives for any command.
`tests/data/command_catalog.json` holds every command's schema, tiles, labels and examples as an agent sees
them, and `tests/data/speed_dial_tiles.json` the tiles as a person sees them.
## Naming
@@ -38,9 +38,9 @@ a person sees them.
runs the Variable layer height panel, and `replay_run` runs what Action Replay calls a replay file. Where
the GUI has no name for the thing, the words are plain (`widget_list`, `dialog_answer`). A word the GUI
uses for something else is avoided: the `script_` commands run Python, as the Run Script panel does.
3. **One job, one command, and one argument for its variants.** A menu row and the command that does its job
are one command, and the row is a tile of it. Where the GUI has a row for each variant, one argument picks
it: `format`, `shape`, `axis`, `type`, `mode`, `window`, `page`, `camera`.
3. **One job, one command, and one argument for its variants.** A menu item and the command that does its job
are one command, and the item is a tile of it. Where the GUI has an item for each variant, one argument
picks it: `format`, `shape`, `axis`, `type`, `mode`, `window`, `page`, `camera`.
4. **An argument's name means one thing across the commands**, so what an agent learns from one holds for
the next:
@@ -89,7 +89,7 @@ only; every argument, its default and its range are in the command's schema. "Ta
targets of a command of several (`objects`, `instances`, `parts`), which default to the selection (see
Targets and the selection).
Every command is in `tools/list` but three, the menu rows that take no arguments:
Every command is in `tools/list` but three, the menu items that take no arguments:
`settings_toggle_developer_mode`, `window_save_screenshot` and `script_toggle_panel`. `tool_search` finds
them and `tool_call` runs them.
@@ -204,7 +204,7 @@ them and `tool_call` runs them.
| `preset_sync` | Synchronize user presets with the cloud account | |
| `preset_migrate_filaments` | Migrate legacy user filament presets | |
| `settings_set_mode` | Switch the settings view to Simple, Advanced or Expert | `mode`: simple, advanced, expert |
| `settings_toggle_developer_mode` | Turn Developer mode on or off; a menu row, not listed | |
| `settings_toggle_developer_mode` | Turn Developer mode on or off; a menu item, not listed | |
### Filaments
@@ -242,7 +242,7 @@ them and `tool_call` runs them.
| Command | What it does | Variants and main arguments |
|---|---|---|
| `view_set` | Set what the window shows: the tab, the 3D view and its camera, the Preview's colour scheme, legend and layers, the section view, the display switches and the sidebar | `tab`, `canvas`; `camera`, `look_at`, `orbit`, `zoom`, `projection`; `view_type`, `time_mode`, `layer`, `layer_range`, `layer_z`, `layer_percent`; `section`; the switches; `layout` |
| `window_open` | Open one of the app's windows or dialogs for a person, as its menu row does | `window`: preferences, plugins, action_replay, preset_bundle, keyboard_shortcuts, setup_wizard, network_test, troubleshoot, tip_of_the_day, about; `tab` and `key` for preferences |
| `window_open` | Open one of the app's windows or dialogs for a person, as its menu item does | `window`: preferences, plugins, action_replay, preset_bundle, keyboard_shortcuts, setup_wizard, network_test, troubleshoot, tip_of_the_day, about; `tab` and `key` for preferences |
| `window_list` | The open windows: the main window, then those that don't block the app, then the modal dialogs, the topmost last | |
| `window_set` | Size, move, maximize, minimize or raise a window | `target`; `size`, `position`; `state`: normal, maximized, minimized; `raise` |
@@ -251,12 +251,12 @@ them and `tool_call` runs them.
| Command | What it does | Variants and main arguments |
|---|---|---|
| `window_screenshot` | Capture the main window, the 3D view as rendered, the topmost dialog or one window, as an image and a PNG | `target`, `max_dim`; `save_path`, `overwrite` |
| `window_save_screenshot` | Save a PNG of the main window where recordings are saved, and tell the person; a menu row, not listed | |
| `window_save_screenshot` | Save a PNG of the main window where recordings are saved, and tell the person; a menu item, not listed | |
| `replay_run` | Run a replay, a list of calls, and report each step | `path` or `replay`; `vars`, `out_dir` |
| `replay_export` | Turn this session's calls into a replay | `path`, `overwrite`, `name`; `clear` |
| `script_run` | Run Python inside the app as its main program, against the orca API | `code`; `args`, `filename`, `timeout_s` |
| `script_search_api` | Search the orca Python API of the running build | `query` |
| `script_toggle_panel` | Show or hide the Run Script panel; a menu row, not listed | |
| `script_toggle_panel` | Show or hide the Run Script panel; a menu item, not listed | |
| `recording_start` | Record a video of the main window or the 3D view | `target`: main, canvas; `captions`, `pointer`; `max_seconds`, `fps`, `max_dim`; `encode` and the encoder's options; `save_path`, `overwrite` |
| `recording_stop` | Stop the recording; with `silent: true`, wait for its file and report it | `silent` |
| `recording_encode` | Encode a recording into an H.265 or H.264 MP4 with the system ffmpeg | `path`, `save_path`, `overwrite`; `codec`, `crf`, `speed`, `profile`; `keep_raw_video_file` |
@@ -330,7 +330,7 @@ for every command (`Mcp::resolve_targets()`, `McpTargets.hpp`):
Every instance of an object selected is the object, and an instance or a part stands for its object only
where the command says so. Nothing selected is refused (`nothing_selected`), a selection of a kind the
command does not take is refused (`wrong_selection`), and a command of one target refuses a selection of
several (`one_object_only`). Where a row acts on the object list's own rows (`object_assemble`,
several (`one_object_only`). Where a menu item acts on the object list's own rows (`object_assemble`,
`part_change_type`, `object_split`, and `object_delete`'s person's form), a call that names no targets
reads those rows, since the list and the 3D selection disagree when every instance, or every part, of an
object is selected.
@@ -384,8 +384,8 @@ One rule holds for every command: **a call whose arguments are exactly those of
is the person's form, and does what a person's pick of that tile does; any other call runs from its arguments
and opens nothing.** A command's own tile is `{}`.
- The person's form may ask in a dialog, as the row does, or act on the selection. An agent's call of it
replies `blocked_by_dialog` where the row asks.
- The person's form may ask in a dialog, as the menu item does, or act on the selection. An agent's call of it
replies `blocked_by_dialog` where the item asks.
- Where the command's own function needs nothing more than a tile gives, `silent: true` runs it from its
arguments without asking, with its defaults: `object_add_primitive {shape: "cube", silent: true}` adds the
cube at its built-in size, where `{shape: "cube"}` asks for the size. Sixteen commands take `silent`:
@@ -393,13 +393,13 @@ and opens nothing.** A command's own tile is `{}`.
`object_delete`, `object_rename`, `object_set_instances`, `object_split`, `calibration_generate_test`,
`plate_rename`, `preset_import`, `plugin_install_local`, `recording_start` and `recording_stop`. The
journal keeps `silent`, so a replay of such a call asks nothing either.
- A call that runs from its arguments and meets on its way the question a row asks takes the answer as an
argument, or refuses with the question as its reason: Split's Auto-Drop question (`keep_z`, else
- A call that runs from its arguments and meets on its way the question a menu item asks takes the answer as
an argument, or refuses with the question as its reason: Split's Auto-Drop question (`keep_z`, else
`auto_drop_question`), deleting part of a cut object, replacing an installed plugin (`overwrite`), the
presets' unsaved changes (`preset_changes`).
- Where a row does just what the command does, its tile is the command's own form and a call of it replies
as any call: the camera tiles of `view_set`, Select All and Deselect All, Auto-Arrange, Auto-Orient and
Refresh Plugins.
- Where a menu item does just what the command does, its tile is the command's own form and a call of it
replies as any call: the camera tiles of `view_set`, Select All and Deselect All, Auto-Arrange, Auto-Orient
and Refresh Plugins.
- A call of the person's form is refused while a modal dialog is open or another call's nested loop runs,
unless that form opens nothing: `recording_stop {}` stops the recording wherever the command runs.
@@ -438,9 +438,9 @@ These open a dialog or a gizmo whatever their arguments, and the caller answers
### Every tile and the call it makes
56 commands have tiles, 129 in all. A tile's id is `orca_command:<key>:orca`, under the key of the row it
was: a command's own tile under the command's key (eight: `undo`, `redo`, `plate_add`, `plate_delete`,
`plate_duplicate`, `plate_rename`, `filament_add`, `filament_delete`), any other under the row's id, which
56 commands have tiles, 129 in all. A tile's id is `orca_command:<key>:orca`, under the key of the menu item
it was: a command's own tile under the command's key (eight: `undo`, `redo`, `plate_add`, `plate_delete`,
`plate_duplicate`, `plate_rename`, `filament_add`, `filament_delete`), any other under the item's id, which
`tests/data/speed_dial_tiles.json` lists.
| Command | Its tiles, and the call each makes |
@@ -503,15 +503,15 @@ was: a command's own tile under the command's key (eight: `undo`, `redo`, `plate
| `recording_stop` | Stop Recording `{}` |
Go to tab and Go to layer collect a value in the Speed Dial's second phase, which the tile passes on under
`tab` or `layer_percent`; `action_run` takes it under the tile's own name for it, `tab` or `percent`. Go to Plate goes to the first plate, as its row did, and the Speed Dial's plate
`tab` or `layer_percent`; `action_run` takes it under the tile's own name for it, `tab` or `percent`. Go to Plate goes to the first plate, as its menu item did, and the Speed Dial's plate
family calls `plate_select` with each plate. A tile of `object_order` reverses the order the objects already
have, as Order By does; `descending` says which way.
## Tiles, titles, the journal and replays
- A tile's id is what a person's pins and run counts are stored under, and the ids of the rows a released
build stored stay the ids of tiles, whatever their command is called. The unit test "every Speed Dial tile
of today is still a tile" holds each one to its title, section, icon and value.
- A tile's id is what a person's pins and run counts are stored under, and the ids of the menu items a
released build stored stay the ids of tiles, whatever their command is called. The unit test "every Speed
Dial tile of today is still a tile" holds each one to its title, section, icon and value.
- A tile runs its command with its arguments, with the MCP server on or off. `action_run` takes no `args` for
a tile, or exactly the tile's, or the value of a tile that collects one, and journals the step as that
`action_run`, so a replay runs it again.
@@ -633,7 +633,7 @@ what the journal records and replays. No listing shows them: `tool_search`' desc
heading, `tool_search {tool}` gives its schema, and `tool_call` runs it.
This section is their command set: how they are named and grouped, what each does and takes, how a call
opens a tool for a person instead of running, and how the commands relate to the right-click menu's rows.
opens a tool for a person instead of running, and how the commands relate to the right-click menu's items.
How the server holds them (the catalog with the CAD feature on, the gate) is in
[mcp-server.md](mcp-server.md), "Design tab: the Design commands", and the tab itself in
[design-tab.md](design-tab.md).
@@ -667,8 +667,8 @@ variable, body and feature.
3. **`operation` says what the result does to the bodies already there**, in four words: `new_body`,
`join`, `cut`, `intersect`. `extrude`, `revolve`, `sweep`, `loft`, `mirror` and `boolean` take it.
4. **Full words**: no abbreviations such as `sk_`, `surf_` or `props`.
5. **A menu row is a way to call a command, not a second command.** A call that gives only the arguments
choosing a row opens that row's tool for a person; a call that gives more runs it.
5. **A menu item is a way to call a command, not a second command.** A call that gives only the arguments
choosing an item opens that item's tool for a person; a call that gives more runs it.
**Body, solid and sheet.** A body is what the Bodies list shows: a solid body, which encloses a volume, or a
sheet body, which is open faces. "Solid" and "Surface" in the headings below are groups of commands, not
@@ -678,7 +678,7 @@ whole bodies.
### The command set
The commands are listed under the headings `tool_search`' description names them under, in its order:
Document, Sketch, Solid, Surface, Construct, Inspect, Bodies, History and Menu rows. Main arguments only;
Document, Sketch, Solid, Surface, Construct, Inspect, Bodies, History and Menu items. Main arguments only;
every argument, its default and its range are in the command's schema.
#### Document
@@ -692,7 +692,7 @@ every argument, its default and its range are in the command's schema.
| `export_step` | Write every body to a STEP file, at its placement | `path`, `overwrite` |
| `commit_to_plate` | Send the visible bodies to Prepare at their placement, in one Prepare undo step | `mode`: assembly, bodies (left out, the Commit button's mode); `replace` |
| `set_variable` | Set a design variable to an expression, or remove it | `name`, `expr` |
| `select_geometry` | Select a body, a face, edges, a vertex, a reference plane, a sketch's loop or a feature by id, as a click selects it, for the menu-row forms to act on | one of: `body`; `body` with `face`, `edges` or `vertex`; `plane`; `sketch` with `loop`; `feature`; nothing, which clears |
| `select_geometry` | Select a body, a face, edges, a vertex, a reference plane, a sketch's loop or a feature by id, as a click selects it, for the menu-item forms to act on | one of: `body`; `body` with `face`, `edges` or `vertex`; `plane`; `sketch` with `loop`; `feature`; nothing, which clears |
| `confirm_tool` | Confirm what is open, as its Confirm button and Enter do | |
| `cancel_tool` | Cancel what is open, as its Cancel button does | |
@@ -828,9 +828,9 @@ every argument, its default and its range are in the command's schema.
| `feature_rename` | Rename a feature | `feature`, `name` |
| `feature_delete` | Delete a feature, with what is built on it | `feature` |
#### Menu rows
#### Menu items
These take no arguments and do what their row of the right-click menu does.
These take no arguments and do what their right-click menu item does.
| Command | What it does |
|---|---|
@@ -939,11 +939,11 @@ and a pattern's layout as `type` in the commands' words. A feature's type name (
`feature_suppress`, `fillet`, `hole`, `loft`, `mirror`, `pattern`, `revolve`, `select_geometry`,
`sketch_constrain`, `sketch_dimension`, `sketch_draw`, `sketch_extend`, `sketch_insert_svg`,
`sketch_pattern`, `sketch_text`, `sketch_transform`, `sketch_trim`, `sweep`, `thicken`, and the five
menu-row commands (`closed` in the tool block). The others have open schemas.
- **`generation`.** Every command but the menu-row ones takes `generation`, the generation (`describe_design`,
`body_describe`) the face and edge ids it passes were read at. Ids expire when a feature rebuilds the model,
and a stale id can still name a real face or edge, so a call whose ids were read before the model changed
is refused.
menu-item commands (`closed` in the tool block). The others have open schemas.
- **`generation`.** Every command but the menu-item ones takes `generation`, the generation
(`describe_design`, `body_describe`) the face and edge ids it passes were read at. Ids expire when a feature
rebuilds the model, and a stale id can still name a real face or edge, so a call whose ids were read before
the model changed is refused.
#### How a failure shows
@@ -958,36 +958,37 @@ description.
### When a call opens a tool
One rule holds for every Design command: **a call whose arguments are exactly those that choose a menu row
opens that row's tool for a person, as a pick of the row does; any other call runs from its arguments.**
One rule holds for every Design command: **a call whose arguments are exactly those that choose a menu item
opens that item's tool for a person, as a pick of the item does; any other call runs from its arguments.**
- No arguments choose the command's own row. A command with no row of its own is chosen with no arguments
by the rows folded into it with `{}`: Color for `body_set`, and the three value rows for
- No arguments choose the command's own menu item. A command with no menu item of its own is chosen with no
arguments by the items folded into it with `{}`: Color for `body_set`, and the three value items for
`sketch_set_value`.
- A row may be chosen by arguments: `boolean {operation: "join"}`, `pattern {type: "circular"}`,
- A menu item may be chosen by arguments: `boolean {operation: "join"}`, `pattern {type: "circular"}`,
`sketch_draw {type: "slot"}`, `sketch_draw {type: "polygon", sides: 6}`. All of a command's variants open
the same way.
- A command that a call with no arguments opens has `silent` in its schema. `silent: true` beside the
choosing arguments, or beside none, runs the command with its defaults. `sketch_draw`, `sketch_transform`
and `sketch_pattern` have no `silent`: their rows are chosen by `type`, and `silent` beside it is refused.
and `sketch_pattern` have no `silent`: their items are chosen by `type`, and `silent` beside it is refused.
- Arguments are compared after the server normalizes them, as JSON values. `generation`, or anything else
beside the choosing arguments, makes the call run.
- The tool opens through `open_tool()` on the row's entry, only in the mode the row belongs to (a sketch row
in a sketch, a model row outside one); in the other the call is refused, naming the mode. A row the menu
greys for the selection is refused for it, naming the selection and the kinds the row accepts. A call made
while a row of the Feature list is selected and nothing is picked in the view takes that row as what four
rows act on: `feature_edit`, `rename_selected`, `feature_delete` and `sketch_constrain_selected`.
- The tool opens through `open_tool()` on the menu item's entry, only in the mode the item belongs to (a
sketch item in a sketch, a model item outside one); in the other the call is refused, naming the mode. An
item the menu greys for the selection is refused for it, naming the selection and the kinds the item
accepts. A call made while a row of the Feature list is selected and nothing is picked in the view takes
that row as what four menu items act on: `feature_edit`, `rename_selected`, `feature_delete` and
`sketch_constrain_selected`.
- The reply is `{"result": {"interactive": true, "tool", "applies", "modal", "selection_kind", "busy",
"status"}}`: the command called, whether the row accepts the selection, whether a dialog the action
"status"}}`: the command called, whether the menu item accepts the selection, whether a dialog the action
opened held the call until it was answered, the selection's kind, what the tab has open after the action,
and its status line. It claims nothing about what the action did, which may be to open a card, arm a
sketch tool, act at once, or say on the status line why it cannot.
- A command's description ends with the calls that open a tool, each with its row's name, so that a search
for "rounded rectangle" or "polar array" finds the command.
- A command's description ends with the calls that open a tool, each with its menu item's name, so that a
search for "rounded rectangle" or "polar array" finds the command.
#### The menu rows and the calls they make
#### The menu items and the calls they make
| Command | Mode | Its rows, and the call each makes |
| Command | Mode | Its items, and the call each makes |
|---|---|---|
| `sketch_create` | model | Sketch `{}` |
| `extrude` | model | Extrude `{}` |
@@ -1047,25 +1048,25 @@ opens that row's tool for a person, as a pick of the row does; any other call ru
| `sketch_pattern` | sketch | Linear array `{"type": "linear"}`; Polar array `{"type": "circular"}` |
| `sketch_draw` | sketch | Line `{"type": "line"}`; Polyline `{"type": "polyline"}`; Corner rectangle `{"type": "rectangle_2_point"}`; Center rectangle `{"type": "rectangle_center"}`; Oblique rectangle `{"type": "rectangle_3_point"}`; Rounded rectangle `{"type": "rectangle_rounded"}`; Center circle `{"type": "circle_center"}`; 2-point circle `{"type": "circle_2_point"}`; 3-point circle `{"type": "circle_3_point"}`; 3-point arc `{"type": "arc_3_point"}`; Tangent arc `{"type": "arc_tangent"}`; Center-point arc `{"type": "arc_center"}`; Slot `{"type": "slot"}`; Arc slot `{"type": "slot_arc"}`; Ellipse `{"type": "ellipse"}`; Elliptical arc `{"type": "ellipse_arc"}`; Spline `{"type": "spline"}`; Triangle `{"type": "polygon", "sides": 3}`; Square `{"type": "polygon", "sides": 4}`; Pentagon `{"type": "polygon", "sides": 5}`; Hexagon `{"type": "polygon", "sides": 6}`; Octagon `{"type": "polygon", "sides": 8}`; Dodecagon `{"type": "polygon", "sides": 12}`; Point `{"type": "point"}` |
`sketch_text {}` opens the Text dialog in a sketch, where its row is; its argument form runs on the model
and is refused while a sketch is open.
`sketch_text {}` opens the Text dialog in a sketch, where its menu item is; its argument form runs on the
model and is refused while a sketch is open.
### The Design table's entries
`tool_atlas.json` has 127 entries. Each is one of these:
- **A command with a row**: the row's slot, key, action, accepts, mode, name, icon and hint, and the
- **A command with a menu item**: the item's slot, key, action, accepts, mode, name, icon and hint, and the
command's tool block, under the command's name. 47 commands.
- **An argument-only command**: a tool block and no action. 36 commands: 35 have no row, and `measure`'s
row, which has no action, is shown disabled.
- **A menu-only command**: an action and no tool block. Five, under Menu rows.
- **A folded row**: a row that is no command. It keeps its id, which the menu, the keys, the toolbar, the
tiles and the GUI tests use, and names its command and the arguments that choose it: `"fold": {"into":
"sketch_draw", "args": {"type": "circle_center"}}`. 37 rows, folded into eight commands.
- **A greyed row**: a row with neither, shown disabled. Two: Pattern on Curve (`pat_curve`), whose function
- **An argument-only command**: a tool block and no action. 36 commands: 35 have no menu item, and `measure`'s
item, which has no action, is shown disabled.
- **A menu-only command**: an action and no tool block. Five, under Menu items.
- **A folded item**: a menu item that is no command. It keeps its id, which the menu, the keys, the toolbar,
the tiles and the GUI tests use, and names its command and the arguments that choose it: `"fold": {"into":
"sketch_draw", "args": {"type": "circle_center"}}`. 37 items, folded into eight commands.
- **A greyed item**: an item with neither, shown disabled. Two: Pattern on Curve (`pat_curve`), whose function
is `pattern {type: "curve"}`, and Align to (`align_to`), which is not built.
That is 88 commands and 89 rows with an action, each of which has a Speed Dial tile.
That is 88 commands and 89 menu items with an action, each of which has a Speed Dial tile.
The right-click menu's rows and their order are ratified (`_ratified` in the atlas): a row's index is its
address, and changing one is a breaking change.
@@ -1073,13 +1074,13 @@ address, and changing one is a breaking change.
### Tiles, titles, the journal and replays
- Every entry with an action has a Speed Dial tile while the Design tab is shown, in its mode. A command's
own row's tile is under the command's key (`orca_command:sketch_trim:orca`); a folded row keeps its tile
under its own id (`orca_command:sk_array:orca`) with its row's title and icon.
- A pick of a folded row's tile runs its command with the row's arguments, with the MCP server on or off.
Its action shows an agent no arguments, and `action_run` takes none for it, or exactly the row's; that is
own menu item's tile is under the command's key (`orca_command:sketch_trim:orca`); a folded item keeps its
tile under its own id (`orca_command:sk_array:orca`) with the item's title and icon.
- A pick of a folded item's tile runs its command with the item's arguments, with the MCP server on or off.
Its action shows an agent no arguments, and `action_run` takes none for it, or exactly the item's; that is
what the journal records, so a replay runs it again.
- A call of a command with a row's arguments is titled as that row's tile wherever a person is shown the
call: a job notice, a recording's caption, an Action Replay step (`replay_what_text()`).
- A call of a command with a menu item's arguments is titled as that item's tile wherever a person is shown
the call: a job notice, a recording's caption, an Action Replay step (`replay_what_text()`).
- A folded tile that is not shown is named, when a call asks for it, with the call that runs it from any
tab: `tool_call {"tool": "sketch_pattern", "args": {"type": "linear"}}`.
- The MCP skill's reference (`tools/mcp/gen_skill_reference.py`) gives a command a row of its own only when
@@ -1149,12 +1150,12 @@ command a call names.
| Where | The app says | Command |
|---|---|---|
| Sketch, Repeat row | Linear array, Polar array | `sketch_pattern {type: linear}`, `{type: circular}` |
| Remove row | Cut, which divides a body with a plane | `split` |
| Boolean card and rows | Join, Subtract, Intersect | `boolean {operation: join}`, `{operation: cut}`, `{operation: intersect}` |
| Sketch, Repeat submenu | Linear array, Polar array | `sketch_pattern {type: linear}`, `{type: circular}` |
| Remove submenu | Cut, which divides a body with a plane | `split` |
| Boolean card and menu items | Join, Subtract, Intersect | `boolean {operation: join}`, `{operation: cut}`, `{operation: intersect}` |
| Surface flyout | Surface Fill | `surface_patch` |
| Reference row | Volume and area | `body_mass_properties` |
| Reference submenu | Volume and area | `body_mass_properties` |
| Rectangle flyout | Corner rectangle, Oblique rectangle | `sketch_draw {type: rectangle_2_point}`, `{type: rectangle_3_point}` |
| Transform row | Move on the menu row, Transform on the toolbar and the card | `body_transform` |
| Transform submenu | Move in the menu, Transform on the toolbar and the card | `body_transform` |
| Placement flyout | Mate | `align` |
| Feature row | the eye, show or hide | `feature_suppress` |
+4 -4
View File
@@ -49,10 +49,10 @@ compiled against it cannot drift apart:
| `gen_offer_table.py` | `tool_atlas.json` — the Design tab's table: every offer verb with its row, key, icon, accepted selections and refusal string, and every Design command's silent form (a `tool` block) | `src/slic3r/GUI/CAD/DesignOffer.hpp` |
| `mate-glyph/emit_glyph_table.py` | `mate-glyph/bear_outline.json`, measured off `mate-glyph/bear.step` by `extract_outline.py` | the `kBear…` tables in `DesignSketchTool.cpp` |
The atlas's `verbs` are one table for three things: the right-click menu (a verb with a `slot` has a
row there), the Speed Dial's Design tiles and the Design commands. Every verb but `align` is a command
whose key is its `id`. A verb with an `action` does what its menu row does when called with no
arguments, in the mode the row belongs to, and has a tile; one with a `tool` block also runs silently
The atlas's `verbs` are one table for three things: the right-click menu (a verb with a `slot` has an
item there), the Speed Dial's Design tiles and the Design commands. Every verb but `align` is a command
whose key is its `id`. A verb with an `action` does what its menu item does when called with no
arguments, in the mode the item belongs to, and has a tile; one with a `tool` block also runs silently
with arguments, and the block holds what that form takes and does: its `access` (`read`, `change` or
`sketch`, which decides what a busy Design tab lets through), `ok_false` (it reports a rejected rebuild
in its reply), a `summary` of one sentence,
+45 -45
View File
@@ -34,9 +34,9 @@ ENUM = {
ACCESS = {"read": "Read", "change": "Change", "sketch": "Sketch", "ui": "Ui"}
# The headings of tool_search's index of the Design commands (Mcp::design_command_index()), in its order: every
# command's `section` is one of them. Menu rows holds the commands that take no arguments and only do what their row
# command's `section` is one of them. Menu items holds the commands that take no arguments and only do what their menu item
# does.
SECTIONS = ("Document", "Sketch", "Solid", "Surface", "Construct", "Inspect", "Bodies", "History", "Menu rows")
SECTIONS = ("Document", "Sketch", "Solid", "Surface", "Construct", "Inspect", "Bodies", "History", "Menu items")
# The keys of a tool block that its command's description, schema and examples are made from.
DOC_KEYS = ("summary", "details", "params", "examples", "ids")
@@ -90,9 +90,9 @@ def doc_literal(block, indent):
def arg_faults(vid, args, into):
"""Why `args`, the arguments that choose entry `vid`'s row, are not arguments `into`'s block takes."""
"""Why `args`, the arguments that choose entry `vid`'s item, are not arguments `into`'s block takes."""
if not isinstance(args, dict):
return [f"{vid}: args must be an object of the arguments that choose its row, not {args!r}"]
return [f"{vid}: args must be an object of the arguments that choose its item, not {args!r}"]
params = {p.get("name"): p for p in into["tool"].get("params", [])}
out = []
for name, value in args.items():
@@ -106,27 +106,27 @@ def arg_faults(vid, args, into):
def faults(A):
"""Every fault of the atlas A, each naming its entry: what the header cannot represent, and what would leave
a call of a command unable to tell which of its rows it opens.
a call of a command unable to tell which of its items it opens.
An unknown slot or selection would surface as a bare ValueError from .index() below, and a
duplicate verb id would not surface at all: a verb is looked up by id (DesignPanel::mcp_run_verb,
the catalog's command keys) and the first match taken, so the second row would be unreachable.
An entry with no row, no action and no tool block is nothing; a row with neither is greyed (Align to,
the catalog's command keys) and the first match taken, so the second item would be unreachable.
An entry with no menu item, no action and no tool block is nothing; an item with neither is greyed (Align to,
until it has a GUI path), and no command.
A folded row (`fold`) is a way of calling the command `into` names with `args`: it keeps its row and
A folded item (`fold`) is a way of calling the command `into` names with `args`: it keeps its row and
its action and has no block of its own, and its command is an entry with a block that is no folded
row. An entry with an action and a block may name the `args` that choose its own row. The arguments
that choose a row are ones its command takes, and choose that row only (Mcp::opened_row()): no two
rows of one command with equal args and different actions, and no folded row with the args its
command's own row takes, which a call with none also gives. A command's rows are in one mode.
item. An entry with an action and a block may name the `args` that choose its own item. The arguments
that choose an item are ones its command takes, and choose that item only (Mcp::opened_item()): no two
items of one command with equal args and different actions, and no folded item with the args its
command's own item takes, which a call with none also gives. A command's items are in one mode.
Every command, an entry with an action or a block that is no folded row, has a `section`, its heading in
tool_search's index (SECTIONS); a folded or greyed row, which is no command, has none.
Every command, an entry with an action or a block that is no folded item, has a `section`, its heading in
tool_search's index (SECTIONS); a folded or greyed item, which is no command, has none.
`feature_row` marks a row whose action acts on the selected row of the Feature list, which a call of its
command takes as its target when nothing is picked in the view (Mcp::open_refusal()): only a command with a row
of its own has one, an entry with an action that is no folded row.
`feature_row` marks an item whose action acts on the selected row of the Feature list, which a call of its
command takes as its target when nothing is picked in the view (Mcp::open_refusal()): only a command with a menu item
of its own has one, an entry with an action that is no folded item.
"""
slot_ids = {s["id"] for s in A["slots"]}
sel_ids = {s["id"] for s in A["selections"]}
@@ -134,7 +134,7 @@ def faults(A):
for v in A["verbs"]:
vid = v["id"]
if v["slot"] is None:
# A command only: no menu row, so no action the menu could run either.
# A command only: no menu item, so no action the menu could run either.
if v.get("action"):
errs.append(f"{vid}: an action needs a slot")
elif v["slot"] not in slot_ids:
@@ -147,18 +147,18 @@ def faults(A):
seen.add(vid)
block = v.get("tool")
if v["slot"] is None and not v.get("action") and block is None:
errs.append(f"{vid}: neither a row, an action nor a tool block")
errs.append(f"{vid}: neither a menu item, an action nor a tool block")
if v.get("modal") and not v.get("action"):
errs.append(f"{vid}: modal without an action")
command = (v.get("action") or block is not None) and "fold" not in v
if not command and "section" in v:
errs.append(f"{vid}: a folded or greyed row is no command and has no section")
errs.append(f"{vid}: a folded or greyed item is no command and has no section")
elif command and "section" not in v:
errs.append(f"{vid}: a command needs a section, its heading in tool_search's index: one of {list(SECTIONS)}")
elif command and v["section"] not in SECTIONS:
errs.append(f'{vid}: section {v["section"]!r} is not one of {list(SECTIONS)}')
if v.get("feature_row") and (not v.get("action") or "fold" in v):
errs.append(f"{vid}: feature_row needs a row of its own: an action, and no fold")
errs.append(f"{vid}: feature_row needs a menu item of its own: an action, and no fold")
if block is not None:
if block.get("access") not in ACCESS:
errs.append(f'{vid}: tool access {block.get("access")!r} is not one of {sorted(ACCESS)}')
@@ -184,7 +184,7 @@ def faults(A):
by_id = {}
for v in A["verbs"]:
by_id.setdefault(v["id"], v)
folded = {} # a command's id -> the rows folded into it so far
folded = {} # a command's id -> the items folded into it so far
for v in A["verbs"]:
if "fold" not in v:
continue
@@ -193,15 +193,15 @@ def faults(A):
errs.append(f"{vid}: fold must be an object {{into, args}}, not {fold!r}")
continue
if not v.get("action"):
errs.append(f"{vid}: a fold needs an action, the row's own")
errs.append(f"{vid}: a fold needs an action, the item's own")
if v.get("tool") is not None:
errs.append(f"{vid}: a folded row has no tool block: its command has it")
errs.append(f"{vid}: a folded item has no tool block: its command has it")
into = by_id.get(fold.get("into"))
if into is None:
errs.append(f"{vid}: fold's into {fold.get('into')!r} names no entry")
continue
if "fold" in into:
errs.append(f"{vid}: fold's into {into['id']} is itself a folded row")
errs.append(f"{vid}: fold's into {into['id']} is itself a folded item")
continue
if into.get("tool") is None:
errs.append(f"{vid}: fold's into {into['id']} has no tool block")
@@ -212,9 +212,9 @@ def faults(A):
if bad:
continue
if into.get("action") and (same(args, {}) or ("args" in into and same(args, into["args"]))):
errs.append(f"{vid}: its args are the args {into['id']}'s own row takes")
errs.append(f"{vid}: its args are the args {into['id']}'s own item takes")
if into["slot"] is not None and mode_of(v) != mode_of(into):
errs.append(f"{vid}: in another mode than {into['id']}'s own row")
errs.append(f"{vid}: in another mode than {into['id']}'s own item")
for other in folded.get(into["id"], []):
if mode_of(other) != mode_of(v):
errs.append(f"{vid}: in another mode than {other['id']}, folded into {into['id']} too")
@@ -249,11 +249,11 @@ def main():
"// ratified 2026-07-31; changing an index is a breaking change to every user's muscle memory.",
"// An entry with an action or a tool block, and no fold_into, is a command of the catalog's group Design",
"// (Mcp::register_cad_commands(), Mcp::is_design_command()), under its section in tool_search's index. A",
"// call whose arguments are exactly those that choose one of its rows opens that row's tool for a person",
"// (Mcp::opened_row()): none choose the entry's own row where it has an action, else the rows folded into it",
"// with {}; a folded row's args, or the entry's own, choose that row. Any other call runs its tool block's",
"// silent form. A folded row (fold_into) is no command: it is a way of calling the command it names. A row",
"// with neither an action nor a tool block is greyed, and no command. An entry with no row is a command only.",
"// call whose arguments are exactly those that choose one of its items opens that item's tool for a person",
"// (Mcp::opened_item()): none choose the entry's own item where it has an action, else the items folded into it",
"// with {}; a folded item's args, or the entry's own, choose that item. Any other call runs its tool block's",
"// silent form. A folded item (fold_into) is no command: it is a way of calling the command it names. An item",
"// with neither an action nor a tool block is greyed, and no command. An entry with no menu item is a command only.",
"#ifndef slic3r_GUI_DesignOffer_hpp_",
"#define slic3r_GUI_DesignOffer_hpp_",
"",
@@ -303,15 +303,15 @@ def main():
'// "key:L" -> m_keys_sketch[\'L\']',
'// "fly:material#4" -> row 4 of the "material" feature flyout',
'// "btn:delete" -> a standalone toolbar button',
"// nullptr -> no GUI path (the row, if it has one, shows disabled)",
"// nullptr -> no GUI path (the item, if it has one, shows disabled)",
"struct DesignTool {",
" const char* id; // also the key of its Design command",
" const char* name; // drawing-office word (L10); msgctxt \"Design\", translated at use",
" int row; // index into kOfferRowNames, the ratified address — NEVER reorder;",
" // -1: no menu row, a command only",
" const char* key; // shortcut shown in the row, or nullptr",
" // -1: no menu item, a command only",
" const char* key; // shortcut shown in the item, or nullptr",
" const char* action;",
" const char* refusal; // why this row is greyed, in the product's own words",
" const char* refusal; // why this item is greyed, in the product's own words",
" uint32_t accepts; // bitmask over OfferSel",
" int need_bodies;",
" int need_sketches;",
@@ -322,7 +322,7 @@ def main():
" // address fixed (L4.1) while the variants hang one level below it, mirroring the toolbar's",
" // grouping instead of flattening 19 create tools into one wall.",
" const char* family;",
" const char* icon; // resources/images name, or nullptr — the offer draws it beside the row",
" const char* icon; // resources/images name, or nullptr — the offer draws it beside the item",
" const char* hint; // what the verb does / what to click; shown on hover",
" bool modal; // its action opens a dialog that waits for an answer: a modal one, which holds",
" // the call until it is answered, or Text's, which is modeless and does not",
@@ -330,22 +330,22 @@ def main():
" bool ok_false; // its silent form reports a rejected rebuild in its reply (ok false)",
" // Its silent form's summary, details, params, examples and ids as JSON text, the parameter",
" // schema of record, and closed when its schema refuses an argument it does not name; nullptr for an",
" // entry whose command only does what its row does.",
" // entry whose command only does what its menu item does.",
" const char* doc;",
" const char* fold_into; // the id of the command this row is a variant of, or nullptr",
" // The arguments that choose this row, as JSON text: a folded row's, or those that choose the own row of",
" const char* fold_into; // the id of the command this item is a variant of, or nullptr",
" // The arguments that choose this item, as JSON text: a folded item's, or those that choose the own item of",
" // an entry with an action and a tool block as a call with none does; nullptr for none.",
" const char* args;",
" // The heading its command is listed under in tool_search's index (kDesignSections,",
" // Mcp::design_command_index()); nullptr for an entry that is no command.",
" const char* section;",
" // Its action acts on the selected row of the Feature list, which a call of its command, not a person's",
" // pick, takes as what the row is for while nothing is picked in the view (Mcp::open_refusal()).",
" // pick, takes as what the item is for while nothing is picked in the view (Mcp::open_refusal()).",
" bool feature_row;",
"};",
"",
"// The headings of tool_search's index of the Design commands, in its order. Menu rows holds the commands",
"// that take no arguments and only do what their row does.",
"// The headings of tool_search's index of the Design commands, in its order. Menu items holds the commands",
"// that take no arguments and only do what their menu item does.",
"static const char* const kDesignSections[] = {",
]
for s in SECTIONS:
@@ -391,9 +391,9 @@ def main():
n = v.get("needs") or {}
block = v.get("tool")
in_menu = v["slot"] is not None
# Every name is marked, an entry's with no row too: it is its command's title, which a person
# Every name is marked, an entry's with no menu item too: it is its command's title, which a person
# sees translated in the Design context in the Action Replay window and a recording's caption,
# and on the tile of an entry with a row. A table with an unmarked name is refused, written or
# and on the tile of an entry with a menu item. A table with an unmarked name is refused, written or
# checked, since nothing at run time can tell (L_CONTEXT compiles to the bare string).
name = tstr_design(v["name"])
if not (name.startswith('L_CONTEXT("') and name.endswith('", "Design")')):
+32 -32
View File
@@ -28,7 +28,7 @@ def block(params=None, **extra):
def atlas():
"""One slot, two selections, a command with a block and a row (paint), and a second row (tint), a command with
"""One slot, two selections, a command with a block and a menu item (paint), and a second item (tint), a command with
an action only; each under its heading."""
return {
"slots": [{"id": "make", "label": "Make"}],
@@ -37,7 +37,7 @@ def atlas():
{"id": "paint", "name": "Paint", "section": "Solid", "slot": "make", "key": None,
"accepts": ["none", "body_solid"], "action": "btn:paint", "icon": "paint", "hint": "Paint the body",
"tool": block()},
{"id": "tint", "name": "Tint", "section": "Menu rows", "slot": "make", "key": None, "accepts": ["body_solid"],
{"id": "tint", "name": "Tint", "section": "Menu items", "slot": "make", "key": None, "accepts": ["body_solid"],
"action": "btn:tint", "icon": "tint", "hint": "Tint the body"},
],
}
@@ -47,7 +47,7 @@ def entry(A, vid):
return next(v for v in A["verbs"] if v["id"] == vid)
def row(vid, action, **extra):
def item(vid, action, **extra):
v = {"id": vid, "name": vid.title(), "slot": "make", "key": None, "accepts": ["body_solid"],
"action": action, "icon": vid, "hint": "Do " + vid}
v.update(extra)
@@ -70,25 +70,25 @@ class Faults(unittest.TestCase):
with open(gen.ATLAS, encoding="utf-8") as f:
self.assertEqual(gen.faults(json.load(f)), [])
def test_a_folded_row_with_args_its_command_takes_passes(self):
def test_a_folded_item_with_args_its_command_takes_passes(self):
A = atlas()
entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}}
del entry(A, "tint")["section"]
entry(A, "paint")["args"] = {"shade": "red"}
self.assertEqual(gen.faults(A), [])
def test_a_greyed_row_passes_whatever_its_id(self):
def test_a_greyed_item_passes_whatever_its_id(self):
A = atlas()
del entry(A, "tint")["action"]
del entry(A, "tint")["section"]
entry(A, "tint")["id"] = "anything"
self.assertEqual(gen.faults(A), [])
def test_rows_of_one_command_with_equal_args_and_one_action_pass(self):
def test_items_of_one_command_with_equal_args_and_one_action_pass(self):
A = atlas()
entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}}
del entry(A, "tint")["section"]
A["verbs"].append(row("tint_again", "btn:tint", fold={"into": "paint", "args": {"shade": "blue"}}))
A["verbs"].append(item("tint_again", "btn:tint", fold={"into": "paint", "args": {"shade": "blue"}}))
self.assertEqual(gen.faults(A), [])
def test_a_block_with_access_ui_passes(self):
@@ -115,7 +115,7 @@ class Faults(unittest.TestCase):
A = atlas()
entry(A, "tint")["tool"] = block()
entry(A, "tint")["fold"] = {"into": "paint", "args": {}}
self.assertFault(A, "tint", "a folded row has no tool block")
self.assertFault(A, "tint", "a folded item has no tool block")
def test_a_fold_that_is_no_object(self):
A = atlas()
@@ -129,16 +129,16 @@ class Faults(unittest.TestCase):
def test_an_into_that_names_an_entry_with_no_block(self):
A = atlas()
A["verbs"].append(row("wash", "btn:wash", fold={"into": "tint", "args": {}}))
A["verbs"].append(item("wash", "btn:wash", fold={"into": "tint", "args": {}}))
self.assertFault(A, "wash", "has no tool block")
def test_an_into_that_names_a_folded_row(self):
def test_an_into_that_names_a_folded_item(self):
A = atlas()
entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}}
A["verbs"].append(row("wash", "btn:wash", fold={"into": "tint", "args": {}}))
self.assertFault(A, "wash", "is itself a folded row")
A["verbs"].append(item("wash", "btn:wash", fold={"into": "tint", "args": {}}))
self.assertFault(A, "wash", "is itself a folded item")
# --- the arguments that choose a row ---------------------------------------------------------
# --- the arguments that choose an item -------------------------------------------------------
def test_a_folds_args_that_are_no_object(self):
A = atlas()
@@ -170,23 +170,23 @@ class Faults(unittest.TestCase):
entry(A, "paint")["args"] = {"shade": "green"}
self.assertFault(A, "paint", "'green'")
def test_two_rows_of_one_command_with_equal_args_and_different_actions(self):
def test_two_items_of_one_command_with_equal_args_and_different_actions(self):
A = atlas()
entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}}
A["verbs"].append(row("wash", "btn:wash", fold={"into": "paint", "args": {"shade": "blue"}}))
A["verbs"].append(item("wash", "btn:wash", fold={"into": "paint", "args": {"shade": "blue"}}))
self.assertFault(A, "wash", "the same args as tint")
def test_a_rows_args_equal_to_its_commands_own(self):
def test_an_items_args_equal_to_its_commands_own(self):
A = atlas()
entry(A, "paint")["args"] = {"shade": "blue"}
entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}}
self.assertFault(A, "tint", "the args paint's own row takes")
self.assertFault(A, "tint", "the args paint's own item takes")
def test_no_args_for_a_row_of_a_command_with_a_row_of_its_own(self):
# A call with none opens the command's own row.
def test_no_args_for_an_item_of_a_command_with_a_menu_item_of_its_own(self):
# A call with none opens the command's own item.
A = atlas()
entry(A, "tint")["fold"] = {"into": "paint", "args": {}}
self.assertFault(A, "tint", "the args paint's own row takes")
self.assertFault(A, "tint", "the args paint's own item takes")
def test_own_args_on_an_entry_with_no_action(self):
A = atlas()
@@ -205,18 +205,18 @@ class Faults(unittest.TestCase):
# --- modes -----------------------------------------------------------------------------------
def test_rows_of_one_command_in_different_modes(self):
def test_items_of_one_command_in_different_modes(self):
A = atlas()
A["verbs"].append({"id": "rinse", "name": "Rinse", "slot": None, "tool": block()})
entry(A, "tint")["fold"] = {"into": "rinse", "args": {"shade": "blue"}}
A["verbs"].append(row("wash", "btn:wash", mode="sketch", fold={"into": "rinse", "args": {"shade": "red"}}))
A["verbs"].append(item("wash", "btn:wash", mode="sketch", fold={"into": "rinse", "args": {"shade": "red"}}))
self.assertFault(A, "wash", "in another mode than tint")
def test_a_row_in_another_mode_than_its_commands_own_row(self):
def test_an_item_in_another_mode_than_its_commands_own_item(self):
A = atlas()
entry(A, "tint")["mode"] = "sketch"
entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}}
self.assertFault(A, "tint", "in another mode than paint's own row")
self.assertFault(A, "tint", "in another mode than paint's own item")
# --- headings --------------------------------------------------------------------------------
@@ -230,19 +230,19 @@ class Faults(unittest.TestCase):
entry(A, "paint")["section"] = "Painting"
self.assertFault(A, "paint", "section 'Painting' is not one of")
def test_a_section_on_a_folded_row(self):
def test_a_section_on_a_folded_item(self):
A = atlas()
entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}}
self.assertFault(A, "tint", "is no command and has no section")
def test_a_section_on_a_greyed_row(self):
def test_a_section_on_a_greyed_item(self):
A = atlas()
del entry(A, "tint")["action"]
self.assertFault(A, "tint", "is no command and has no section")
# --- the rows that act on the Feature list's row ---------------------------------------------
# --- the items that act on the Feature list's row --------------------------------------------
def test_feature_row_on_a_command_with_a_row_of_its_own_passes(self):
def test_feature_row_on_a_command_with_a_menu_item_of_its_own_passes(self):
A = atlas()
entry(A, "tint")["feature_row"] = True
entry(A, "paint")["feature_row"] = True
@@ -252,21 +252,21 @@ class Faults(unittest.TestCase):
A = atlas()
A["verbs"].append({"id": "rinse", "name": "Rinse", "section": "Solid", "slot": None, "tool": block(),
"feature_row": True})
self.assertFault(A, "rinse", "feature_row needs a row of its own")
self.assertFault(A, "rinse", "feature_row needs a menu item of its own")
def test_feature_row_on_a_folded_row(self):
def test_feature_row_on_a_folded_item(self):
A = atlas()
entry(A, "tint")["fold"] = {"into": "paint", "args": {"shade": "blue"}}
del entry(A, "tint")["section"]
entry(A, "tint")["feature_row"] = True
self.assertFault(A, "tint", "feature_row needs a row of its own")
self.assertFault(A, "tint", "feature_row needs a menu item of its own")
# --- entries and blocks ----------------------------------------------------------------------
def test_an_entry_with_no_slot_no_action_and_no_block(self):
A = atlas()
A["verbs"].append({"id": "nothing", "name": "Nothing", "slot": None})
self.assertFault(A, "nothing", "neither a row, an action nor a tool block")
self.assertFault(A, "nothing", "neither a menu item, an action nor a tool block")
def test_a_closed_that_is_no_boolean(self):
A = atlas()
+8 -8
View File
@@ -2148,7 +2148,7 @@
{
"id": "rename_selected",
"name": "Rename…",
"section": "Menu rows",
"section": "Menu items",
"slot": "top",
"key": "F2",
"feature": "Tree",
@@ -2238,7 +2238,7 @@
{
"id": "zoom_to_selection",
"name": "Zoom to selection",
"section": "Menu rows",
"section": "Menu items",
"slot": "top",
"key": null,
"feature": null,
@@ -2894,7 +2894,7 @@
{
"id": "sketch_polygon_inscribed",
"name": "Inscribed",
"section": "Menu rows",
"section": "Menu items",
"slot": "create",
"key": null,
"feature": "Sketch",
@@ -2917,7 +2917,7 @@
{
"id": "sketch_polygon_circumscribed",
"name": "Circumscribed",
"section": "Menu rows",
"section": "Menu items",
"slot": "create",
"key": null,
"feature": "Sketch",
@@ -3525,7 +3525,7 @@
{
"id": "sketch_constrain_selected",
"name": "Constrain sketch",
"section": "Menu rows",
"section": "Menu items",
"slot": "reference",
"key": null,
"feature": "Sketch",
@@ -3544,7 +3544,7 @@
"feature_row": true,
"note": [
"Same verb, model-mode vocabulary: offered when a SKETCH is selected (bit 14, SkLoop), the",
"state a user is in right after finishing one. Without this row the only way in was the",
"state a user is in right after finishing one. Without this item the only way in was the",
"toolbar icon, and constraints read as absent — see the Onshape-comparison report.",
"It sits in the Reference row, the address the sketch-mode Constrain has: one verb, one row."
]
@@ -3700,7 +3700,7 @@
"icon": "design_dimension",
"hint": "Type the length of this line",
"note": [
"Typing the defining number of the element you pointed at. Three rows rather than one so",
"Typing the defining number of the element you pointed at. Three items rather than one so",
"each names the quantity in the drawing-office word for THAT element; all three land on",
"the same handler, because dimension_kind() already resolves the quantity from the",
"selection. Without these, an element's own numbers were reachable only by arming the",
@@ -4872,7 +4872,7 @@
"ok_false": false,
"closed": true,
"summary": "Select a body, a face, edges, a vertex, a reference plane, a sketch's loop or a feature by id, as a click selects it.",
"details": "One form: body; body with face, edges (the last the current edge, as in a Shift+click set) or vertex; plane; sketch with loop; feature; or nothing, which clears the selection. A body is selected as a click on its row of the Bodies list selects it, a face, edges or a vertex as a click in the view picks them, a loop as a click on it, which also selects its Sketch's row, and a feature as a click on its row of the Feature list. A plane is picked only where a click can pick one: while the Origin row shows the planes, or while Sketch waits for its plane (sketch_create {}), where picking it opens the sketch. A loop is numbered as sketch_describe {sketch} numbers closed_loops and extrude {sketch, loop} takes it, and is selected only while the view shows it: an extrude that takes the whole sketch hides the sketch, and one that takes a loop hides that loop. Whatever was selected goes first, of every kind. The menu-row forms then act on the selection: feature_edit, rename_selected, feature_delete and sketch_constrain_selected called with no arguments act on the selected row of the Feature list while nothing is picked in the view, and zoom_to_selection acts on what is picked in the view, so a sketch is zoomed to through sketch with loop, not through feature. Refused, changing nothing, for an id the model does not have, and while a card, a sketch, Constrain mode, a body Move or the Text dialog is open, where a click means something else. Reply: selection {kind, id}, plane and feature, as describe_design reports selection, picked_plane and feature_row; for a vertex also point, as body_describe gives it, and placed_point, where the view draws it (the same unless the body was moved).",
"details": "One form: body; body with face, edges (the last the current edge, as in a Shift+click set) or vertex; plane; sketch with loop; feature; or nothing, which clears the selection. A body is selected as a click on its row of the Bodies list selects it, a face, edges or a vertex as a click in the view picks them, a loop as a click on it, which also selects its Sketch's row, and a feature as a click on its row of the Feature list. A plane is picked only where a click can pick one: while the Origin row shows the planes, or while Sketch waits for its plane (sketch_create {}), where picking it opens the sketch. A loop is numbered as sketch_describe {sketch} numbers closed_loops and extrude {sketch, loop} takes it, and is selected only while the view shows it: an extrude that takes the whole sketch hides the sketch, and one that takes a loop hides that loop. Whatever was selected goes first, of every kind. The menu-item forms then act on the selection: feature_edit, rename_selected, feature_delete and sketch_constrain_selected called with no arguments act on the selected row of the Feature list while nothing is picked in the view, and zoom_to_selection acts on what is picked in the view, so a sketch is zoomed to through sketch with loop, not through feature. Refused, changing nothing, for an id the model does not have, and while a card, a sketch, Constrain mode, a body Move or the Text dialog is open, where a click means something else. Reply: selection {kind, id}, plane and feature, as describe_design reports selection, picked_plane and feature_row; for a vertex also point, as body_describe gives it, and placed_point, where the view draws it (the same unless the body was moved).",
"params": [
{"name": "body", "type": "integer", "default": null, "min": 0, "description": "body index (describe_design); alone, the whole body"},
{"name": "face", "type": "integer", "default": null, "min": 0, "description": "a face id of body (body_describe)"},
+3 -3
View File
@@ -6,9 +6,9 @@
# Generate candidates with: python3 scripts/check_operation_calls.py --print
[src/slic3r/GUI/NativeCommands.cpp]
# The asking path of a command, its menu row's tile (Rows): the row's function calls the owner's method, which asks
# the person what an operation would be told (project_open {}, project_save {save_as: true}, project_import {archive:
# true}, project_export with a tile's arguments, filament_sync_ams {}).
# The asking path of a command, its menu item's tile (MenuItems): the item's function calls the owner's method, which
# asks the person what an operation would be told (project_open {}, project_save {save_as: true}, project_import
# {archive: true}, project_export with a tile's arguments, filament_sync_ams {}).
plater->load_project();
return NativeCommands::project_save_result(plater->save_project(true));
plater->import_zip_archive();
+1 -1
View File
@@ -145,7 +145,7 @@ set(SLIC3R_GUI_SOURCES
GUI/ActionRegistry.hpp
GUI/ActionReplayDialog.cpp
GUI/ActionReplayDialog.hpp
GUI/NativeCommandRows.hpp
GUI/NativeCommandMenuItems.hpp
GUI/NativeCommands.cpp
GUI/NativeCommands.hpp
GUI/Operations/ExportOps.cpp
+1 -1
View File
@@ -1017,7 +1017,7 @@ void ActionRegistry::materialize_design_actions()
// The tiles act on the Design tab a person is looking at, so they are there only while it is shown, and
// only those of the mode it is in, the tools its right-click menu offers there; none while the CAD feature
// is off, though the tab stays until a restart (Mcp::design_tiles()). The catalog holds the Design commands
// only when the CAD feature was on at startup. A folded row's tile runs its command with the row's arguments.
// only when the CAD feature was on at startup. A folded item's tile runs its command with the item's arguments.
const MainFrame* frame = wxTheApp ? wxGetApp().mainframe : nullptr;
const DesignPanel* panel = frame != nullptr ? frame->shown_design_panel() : nullptr;
std::unordered_set<std::string> seen;
+2 -2
View File
@@ -171,7 +171,7 @@ inline bool requires_mode_switch(ConfigOptionMode setting_mode, ConfigOptionMode
std::vector<std::string> cap_favourites(const std::vector<std::string>& ids, size_t limit);
// Whether `id` is the id of a Design tab tile, that of an entry of the Design table with an action: a Design
// command's own tile, or a folded row's, which runs the command it is folded into. Such a tile is live only while
// command's own tile, or a folded item's, which runs the command it is folded into. Such a tile is live only while
// that tab is shown, in its entry's mode. The Design table tells it apart, so it does even when the catalog holds
// no Design command (the CAD feature off at startup). A build without CAD has no table, and there it is never one.
bool is_design_tile_id(const std::string& id);
@@ -330,7 +330,7 @@ private:
// (Re)materialise the Design tab's tiles: while the tab is shown with the CAD feature on, one per entry of the
// Design table with an action offered in the tab's mode (Mcp::design_tiles()), a Design command's own or a
// folded row's, titled as the right-click menu names the entry (the "Design" context) with the entry's icon;
// folded item's, titled as the right-click menu names the entry (the "Design" context) with the entry's icon;
// otherwise none. A build without CAD has none.
void materialize_design_actions();
+52 -52
View File
@@ -7,11 +7,11 @@
// ratified 2026-07-31; changing an index is a breaking change to every user's muscle memory.
// An entry with an action or a tool block, and no fold_into, is a command of the catalog's group Design
// (Mcp::register_cad_commands(), Mcp::is_design_command()), under its section in tool_search's index. A
// call whose arguments are exactly those that choose one of its rows opens that row's tool for a person
// (Mcp::opened_row()): none choose the entry's own row where it has an action, else the rows folded into it
// with {}; a folded row's args, or the entry's own, choose that row. Any other call runs its tool block's
// silent form. A folded row (fold_into) is no command: it is a way of calling the command it names. A row
// with neither an action nor a tool block is greyed, and no command. An entry with no row is a command only.
// call whose arguments are exactly those that choose one of its items opens that item's tool for a person
// (Mcp::opened_item()): none choose the entry's own item where it has an action, else the items folded into it
// with {}; a folded item's args, or the entry's own, choose that item. Any other call runs its tool block's
// silent form. A folded item (fold_into) is no command: it is a way of calling the command it names. An item
// with neither an action nor a tool block is greyed, and no command. An entry with no menu item is a command only.
#ifndef slic3r_GUI_DesignOffer_hpp_
#define slic3r_GUI_DesignOffer_hpp_
@@ -93,15 +93,15 @@ enum class CadAccess { None, Read, Change, Sketch, Ui };
// "key:L" -> m_keys_sketch['L']
// "fly:material#4" -> row 4 of the "material" feature flyout
// "btn:delete" -> a standalone toolbar button
// nullptr -> no GUI path (the row, if it has one, shows disabled)
// nullptr -> no GUI path (the item, if it has one, shows disabled)
struct DesignTool {
const char* id; // also the key of its Design command
const char* name; // drawing-office word (L10); msgctxt "Design", translated at use
int row; // index into kOfferRowNames, the ratified address — NEVER reorder;
// -1: no menu row, a command only
const char* key; // shortcut shown in the row, or nullptr
// -1: no menu item, a command only
const char* key; // shortcut shown in the item, or nullptr
const char* action;
const char* refusal; // why this row is greyed, in the product's own words
const char* refusal; // why this item is greyed, in the product's own words
uint32_t accepts; // bitmask over OfferSel
int need_bodies;
int need_sketches;
@@ -112,7 +112,7 @@ struct DesignTool {
// address fixed (L4.1) while the variants hang one level below it, mirroring the toolbar's
// grouping instead of flattening 19 create tools into one wall.
const char* family;
const char* icon; // resources/images name, or nullptr — the offer draws it beside the row
const char* icon; // resources/images name, or nullptr — the offer draws it beside the item
const char* hint; // what the verb does / what to click; shown on hover
bool modal; // its action opens a dialog that waits for an answer: a modal one, which holds
// the call until it is answered, or Text's, which is modeless and does not
@@ -120,22 +120,22 @@ struct DesignTool {
bool ok_false; // its silent form reports a rejected rebuild in its reply (ok false)
// Its silent form's summary, details, params, examples and ids as JSON text, the parameter
// schema of record, and closed when its schema refuses an argument it does not name; nullptr for an
// entry whose command only does what its row does.
// entry whose command only does what its menu item does.
const char* doc;
const char* fold_into; // the id of the command this row is a variant of, or nullptr
// The arguments that choose this row, as JSON text: a folded row's, or those that choose the own row of
const char* fold_into; // the id of the command this item is a variant of, or nullptr
// The arguments that choose this item, as JSON text: a folded item's, or those that choose the own item of
// an entry with an action and a tool block as a call with none does; nullptr for none.
const char* args;
// The heading its command is listed under in tool_search's index (kDesignSections,
// Mcp::design_command_index()); nullptr for an entry that is no command.
const char* section;
// Its action acts on the selected row of the Feature list, which a call of its command, not a person's
// pick, takes as what the row is for while nothing is picked in the view (Mcp::open_refusal()).
// pick, takes as what the item is for while nothing is picked in the view (Mcp::open_refusal()).
bool feature_row;
};
// The headings of tool_search's index of the Design commands, in its order. Menu rows holds the commands
// that take no arguments and only do what their row does.
// The headings of tool_search's index of the Design commands, in its order. Menu items holds the commands
// that take no arguments and only do what their menu item does.
static const char* const kDesignSections[] = {
"Document",
"Sketch",
@@ -145,7 +145,7 @@ static const char* const kDesignSections[] = {
"Inspect",
"Bodies",
"History",
"Menu rows",
"Menu items",
};
// Row labels, in ratified order.
@@ -832,7 +832,7 @@ static const DesignTool kDesignTools[] = {
",\"args\":{\"diameter\":5,\"through\":true}},{\"tool\":\"feature_edit\",\"args\":{\"feature\":2,\"fields\":{\"hol"
"e_diameter\":8}}}]}],\"ids\":false}", nullptr, nullptr, "History", true},
{"rename_selected", L_CONTEXT("Rename…", "Design"), 8, "F2", "btn:rename", L("Select a feature, or a body, to rename it"), 0x00004080u, 0, 0, false, false, nullptr, "rename_edit", L("Give this feature a name you will recognise in the tree (a body takes its name from the feature that makes it)"), false, CadAccess::None, false,
nullptr, nullptr, nullptr, "Menu rows", true},
nullptr, nullptr, nullptr, "Menu items", true},
{"delete_face", L_CONTEXT("Delete Face", "Design"), 7, nullptr, "fly:dressup#3", L("Delete Face needs a body — add or import one first"), 0x0000000eu, 1, 0, false, false, nullptr, "design_delete", L("Remove faces from a body and heal the solid"), false, CadAccess::Change, true,
"{\"summary\":\"Remove faces from a solid, healing the gap via OCCT defeaturing.\",\"details\":\"\",\"para"
"ms\":[{\"name\":\"body\",\"type\":\"integer\",\"default\":-1,\"description\":\"target body; omit for the last "
@@ -844,7 +844,7 @@ static const DesignTool kDesignTools[] = {
{"colour", L_CONTEXT("Color", "Design"), 8, nullptr, "btn:colour", nullptr, 0x000001feu, 1, 0, false, false, nullptr, "color_palette", L("Set the selected body's display color"), true, CadAccess::None, false,
nullptr, "body_set", "{}", nullptr, false},
{"zoom_to_selection", L_CONTEXT("Zoom to selection", "Design"), 8, nullptr, "btn:zoom_to", nullptr, 0x000041feu, 0, 0, false, false, nullptr, "design_zoom", L("Frame the selection in the view, keeping the view direction"), false, CadAccess::None, false,
nullptr, nullptr, nullptr, "Menu rows", false},
nullptr, nullptr, nullptr, "Menu items", false},
{"feature_delete", L_CONTEXT("Delete", "Design"), 7, "Del", "btn:delete", nullptr, 0x000f7c00u, 0, 0, false, false, nullptr, "design_delete", L("Delete what is selected"), false, CadAccess::Change, false,
"{\"summary\":\"Delete a feature as its tree row's Delete does; deleting a sketch also deletes the f"
"eatures built on it.\",\"details\":\"One undo step. Later indices shift. Reply: removed (how many fe"
@@ -911,9 +911,9 @@ static const DesignTool kDesignTools[] = {
{"sk_poly_12", L_CONTEXT("Dodecagon", "Design"), 0, nullptr, "btn:poly#12", nullptr, 0x000f8000u, 0, 0, false, true, L_CONTEXT("Polygon", "Design"), "design_polygon", L("Dodecagon — click center, then a vertex"), false, CadAccess::None, false,
nullptr, "sketch_draw", "{\"type\":\"polygon\",\"sides\":12}", nullptr, false},
{"sketch_polygon_inscribed", L_CONTEXT("Inscribed", "Design"), 0, nullptr, "btn:polyfit#0", nullptr, 0x000f8000u, 0, 0, false, true, L_CONTEXT("Polygon", "Design"), "design_polygon", L("Measure the polygon to its corners (inscribed)"), false, CadAccess::None, false,
nullptr, nullptr, nullptr, "Menu rows", false},
nullptr, nullptr, nullptr, "Menu items", false},
{"sketch_polygon_circumscribed", L_CONTEXT("Circumscribed", "Design"), 0, nullptr, "btn:polyfit#1", nullptr, 0x000f8000u, 0, 0, false, true, L_CONTEXT("Polygon", "Design"), "design_polygon", L("Measure the polygon to its flats (circumscribed)"), false, CadAccess::None, false,
nullptr, nullptr, nullptr, "Menu rows", false},
nullptr, nullptr, nullptr, "Menu items", false},
{"sk_point_t", L_CONTEXT("Point", "Design"), 0, "P", "key:P", nullptr, 0x000f8000u, 0, 0, false, true, nullptr, "design_point", L("Point — click to place"), false, CadAccess::None, false,
nullptr, "sketch_draw", "{\"type\":\"point\"}", nullptr, false},
{"sketch_text", L_CONTEXT("Text", "Design"), 0, nullptr, "btn:text", nullptr, 0x000f8000u, 0, 0, false, true, nullptr, "design_text", L("Type text; it becomes a Text feature on this sketch's plane, editable later"), true, CadAccess::Change, false,
@@ -1079,11 +1079,11 @@ static const DesignTool kDesignTools[] = {
"strain\",\"args\":{\"refs\":[{\"entity\":0,\"role\":\"p0\"}],\"type\":\"lock_x\",\"value\":5}}]}],\"ids\":false,\"cl"
"osed\":true}", nullptr, nullptr, "Sketch", false},
// Same verb, model-mode vocabulary: offered when a SKETCH is selected (bit 14, SkLoop), the
// state a user is in right after finishing one. Without this row the only way in was the
// state a user is in right after finishing one. Without this item the only way in was the
// toolbar icon, and constraints read as absent — see the Onshape-comparison report.
// It sits in the Reference row, the address the sketch-mode Constrain has: one verb, one row.
{"sketch_constrain_selected", L_CONTEXT("Constrain sketch", "Design"), 6, nullptr, "btn:constrain", L("Select a sketch to constrain it"), 0x00004000u, 0, 1, false, false, nullptr, "design_constrain", L("Add dimensions and relations (coincident, tangent, parallel...) to the selected sketch"), false, CadAccess::None, false,
nullptr, nullptr, nullptr, "Menu rows", true},
nullptr, nullptr, nullptr, "Menu items", true},
{"sketch_toggle_construction", L_CONTEXT("Construction", "Design"), 6, "Q", "key:Q", nullptr, 0x000b8000u, 0, 0, false, true, nullptr, "design_construction", L("Toggle construction: geometry that guides but is never built"), 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\":\""
@@ -1112,7 +1112,7 @@ static const DesignTool kDesignTools[] = {
":[{\"tool\":\"sketch_create\",\"args\":{\"plane\":\"XY\"}},{\"tool\":\"sketch_draw\",\"args\":{\"p0\":[-15,-10],\"p"
"1\":[15,10],\"type\":\"rectangle_2_point\"}},{\"tool\":\"sketch_select\",\"args\":{\"entities\":[1,3]}},{\"too"
"l\":\"sketch_delete\",\"args\":{\"silent\":true}}]}],\"ids\":false}", nullptr, nullptr, "Sketch", false},
// Typing the defining number of the element you pointed at. Three rows rather than one so
// Typing the defining number of the element you pointed at. Three items rather than one so
// each names the quantity in the drawing-office word for THAT element; all three land on
// the same handler, because dimension_kind() already resolves the quantity from the
// selection. Without these, an element's own numbers were reachable only by arming the
@@ -1594,34 +1594,34 @@ static const DesignTool kDesignTools[] = {
"d as sketch_describe {sketch} numbers closed_loops and extrude {sketch, loop} takes it, and is s"
"elected only while the view shows it: an extrude that takes the whole sketch hides the sketch, a"
"nd one that takes a loop hides that loop. Whatever was selected goes first, of every kind. The m"
"enu-row forms then act on the selection: feature_edit, rename_selected, feature_delete and sketc"
"h_constrain_selected called with no arguments act on the selected row of the Feature list while "
"nothing is picked in the view, and zoom_to_selection acts on what is picked in the view, so a sk"
"etch is zoomed to through sketch with loop, not through feature. Refused, changing nothing, for "
"an id the model does not have, and while a card, a sketch, Constrain mode, a body Move or the Te"
"xt dialog is open, where a click means something else. Reply: selection {kind, id}, plane and fe"
"ature, as describe_design reports selection, picked_plane and feature_row; for a vertex also poi"
"nt, as body_describe gives it, and placed_point, where the view draws it (the same unless the bo"
"dy was moved).\",\"params\":[{\"name\":\"body\",\"type\":\"integer\",\"default\":null,\"min\":0,\"description\":\""
"body index (describe_design); alone, the whole body\"},{\"name\":\"face\",\"type\":\"integer\",\"default\":"
"null,\"min\":0,\"description\":\"a face id of body (body_describe)\"},{\"name\":\"edges\",\"type\":\"array\",\""
"default\":null,\"description\":\"edge ids of body (body_describe), one or more\"},{\"name\":\"vertex\",\"t"
"ype\":\"integer\",\"default\":null,\"min\":0,\"description\":\"a vertex id of body (body_describe {vertice"
"s: true})\"},{\"name\":\"plane\",\"type\":\"string\",\"default\":null,\"enum\":[\"XY\",\"XZ\",\"YZ\"],\"description\""
":\"a reference plane\"},{\"name\":\"sketch\",\"type\":\"integer\",\"default\":null,\"min\":0,\"description\":\"fe"
"ature index of a committed sketch\"},{\"name\":\"loop\",\"type\":\"integer\",\"default\":null,\"min\":0,\"desc"
"ription\":\"a closed loop of sketch: its index in sketch_describe's closed_loops\"},{\"name\":\"featur"
"e\",\"type\":\"integer\",\"default\":null,\"min\":0,\"description\":\"feature index (describe_design): its r"
"ow of the Feature list\"}],\"examples\":[{\"title\":\"A plate selected whole, as a click on its row of"
" the Bodies list selects it\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width\""
":20}},{\"tool\":\"select_geometry\",\"args\":{\"body\":0}}]},{\"title\":\"A plate's top face selected, as a"
" click on it selects it\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width\":20}"
"},{\"tool\":\"body_describe\",\"args\":{\"at_extreme\":\"+z\",\"body\":0}},{\"tool\":\"select_geometry\",\"args\":"
"{\"body\":0,\"face\":5,\"generation\":{\"from_call\":1,\"key\":\"generation\"}}}]},{\"title\":\"A sketched squa"
"re's loop selected, which selects its Sketch's row too\",\"calls\":[{\"tool\":\"sketch_create\",\"args\":"
"{\"plane\":\"XY\"}},{\"tool\":\"sketch_draw\",\"args\":{\"p0\":[-10,-10],\"p1\":[10,10],\"type\":\"rectangle_2_po"
"int\"}},{\"tool\":\"sketch_finish\",\"args\":{}},{\"tool\":\"select_geometry\",\"args\":{\"loop\":0,\"sketch\":0}"
"}]}],\"ids\":true,\"closed\":true}", nullptr, nullptr, "Document", false},
"enu-item forms then act on the selection: feature_edit, rename_selected, feature_delete and sket"
"ch_constrain_selected called with no arguments act on the selected row of the Feature list while"
" nothing is picked in the view, and zoom_to_selection acts on what is picked in the view, so a s"
"ketch is zoomed to through sketch with loop, not through feature. Refused, changing nothing, for"
" an id the model does not have, and while a card, a sketch, Constrain mode, a body Move or the T"
"ext dialog is open, where a click means something else. Reply: selection {kind, id}, plane and f"
"eature, as describe_design reports selection, picked_plane and feature_row; for a vertex also po"
"int, as body_describe gives it, and placed_point, where the view draws it (the same unless the b"
"ody was moved).\",\"params\":[{\"name\":\"body\",\"type\":\"integer\",\"default\":null,\"min\":0,\"description\":"
"\"body index (describe_design); alone, the whole body\"},{\"name\":\"face\",\"type\":\"integer\",\"default\""
":null,\"min\":0,\"description\":\"a face id of body (body_describe)\"},{\"name\":\"edges\",\"type\":\"array\","
"\"default\":null,\"description\":\"edge ids of body (body_describe), one or more\"},{\"name\":\"vertex\",\""
"type\":\"integer\",\"default\":null,\"min\":0,\"description\":\"a vertex id of body (body_describe {vertic"
"es: true})\"},{\"name\":\"plane\",\"type\":\"string\",\"default\":null,\"enum\":[\"XY\",\"XZ\",\"YZ\"],\"description"
"\":\"a reference plane\"},{\"name\":\"sketch\",\"type\":\"integer\",\"default\":null,\"min\":0,\"description\":\"f"
"eature index of a committed sketch\"},{\"name\":\"loop\",\"type\":\"integer\",\"default\":null,\"min\":0,\"des"
"cription\":\"a closed loop of sketch: its index in sketch_describe's closed_loops\"},{\"name\":\"featu"
"re\",\"type\":\"integer\",\"default\":null,\"min\":0,\"description\":\"feature index (describe_design): its "
"row of the Feature list\"}],\"examples\":[{\"title\":\"A plate selected whole, as a click on its row o"
"f the Bodies list selects it\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width"
"\":20}},{\"tool\":\"select_geometry\",\"args\":{\"body\":0}}]},{\"title\":\"A plate's top face selected, as "
"a click on it selects it\",\"calls\":[{\"tool\":\"extrude\",\"args\":{\"distance\":5,\"height\":20,\"width\":20"
"}},{\"tool\":\"body_describe\",\"args\":{\"at_extreme\":\"+z\",\"body\":0}},{\"tool\":\"select_geometry\",\"args\""
":{\"body\":0,\"face\":5,\"generation\":{\"from_call\":1,\"key\":\"generation\"}}}]},{\"title\":\"A sketched squ"
"are's loop selected, which selects its Sketch's row too\",\"calls\":[{\"tool\":\"sketch_create\",\"args\""
":{\"plane\":\"XY\"}},{\"tool\":\"sketch_draw\",\"args\":{\"p0\":[-10,-10],\"p1\":[10,10],\"type\":\"rectangle_2_p"
"oint\"}},{\"tool\":\"sketch_finish\",\"args\":{}},{\"tool\":\"select_geometry\",\"args\":{\"loop\":0,\"sketch\":0"
"}}]}],\"ids\":true,\"closed\":true}", nullptr, nullptr, "Document", false},
{"confirm_tool", L_CONTEXT("Confirm tool", "Design"), -1, nullptr, nullptr, nullptr, 0x00000000u, 0, 0, false, false, nullptr, nullptr, nullptr, false, CadAccess::Ui, false,
"{\"summary\":\"Confirm what is open in the Design tab, as its Confirm button and Enter do.\",\"detail"
"s\":\"What is open, in the order Confirm takes it: the Text dialog (text), a value field (value), "
+31 -31
View File
@@ -29,7 +29,7 @@
#include <wx/stopwatch.h>
#include <cassert>
#include <cstdarg> // offer_trace: the offer menu's rows on stderr under ORCA_CAD_KEYTRACE
#include <cstdarg> // offer_trace: the offer menu's items on stderr under ORCA_CAD_KEYTRACE
#include <cstddef>
#include <cstdint>
#include <cstdio>
@@ -521,9 +521,9 @@ DesignPanel::DesignPanel(wxWindow* parent)
// Constrain (finish the live sketch + enter constrain), and Construction toggle.
// V for Value: type the defining number of whatever is selected — a line's length, an arc's
// radius, a circle's diameter, the angle between two lines. One handler behind three offer
// rows, because the quantity comes from the selection, not from which row was clicked.
// items, because the quantity comes from the selection, not from which item was clicked.
//
// It needs a KEY, not just a menu row. The deck profile in VSD_n1_streamcontroller is
// It needs a KEY, not just a menu item. The deck profile in VSD_n1_streamcontroller is
// generated from these two key tables, so a verb with no shortcut cannot be put on a
// physical button at all — which is the whole point of that profile for a user who drives
// the app from buttons rather than a menu.
@@ -625,7 +625,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
// the addresses are created inside the widget-building loops, so not building would silently
// delete 42 verbs from the offer while they still rendered. 7ih records the cleanup
// that lets the construction go away too.
// What stays: the view controls, which are chrome_only in the atlas and so have no offer row
// What stays: the view controls, which are chrome_only in the atlas and so have no offer item
// to fall back on, and Sketch, the group's lead. All four are built with the doc buttons.
static const std::set<std::string> kBarKeep = { "place", "section", "flip" };
auto fadd = [&tb_slot](const char* id, wxWindow* w) {
@@ -651,7 +651,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
// owner. Doing this before any wxWindow exists is what lets the build below be skipped
// outright for a family the bar no longer carries. Registered INSIDE the build loop,
// a retired family would still have to be constructed and then Hide()n, since skipping
// it would delete its verbs from the offer while their rows still rendered and do
// it would delete its verbs from the offer while their items still rendered and do
// nothing when picked.
// Keyed on "fly:<family>#<row>" so the generated table can name a variant without the
// item struct growing a field at 26 call sites.
@@ -855,7 +855,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
// Surface: sheet-body tools (extrude / revolve / loft / fill / offset / thicken)
// The drawer BUTTON is design_surface, not design_extrude: sharing a face with the
// Add-material drawer made the two buttons indistinguishable in the bar. The entries
// inside may reuse the solid glyphs — a menu row carries its own text label.
// inside may reuse the solid glyphs — a menu item carries its own text label.
feat_dropdown("surface", "design_surface", _L("Surface (extrude / revolve / loft / fill / offset / thicken)"), {
{"design_extrude", _L("Surface Extrude"), _L("Extrude a sketch into a sheet body (no end caps)"),
[this] {
@@ -1089,7 +1089,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
// Reachable from the offer menu on a SELECTED SKETCH, not only from the toolbar icon.
// A user evaluating against Onshape reported that "adding constraints seems to be
// missing" — with nineteen constraint types and a solver shipped. The only paths in
// were an icon-only button and a sketch-mode-only offer row filed under "Reference",
// were an icon-only button and a sketch-mode-only offer item filed under "Reference",
// so after finishing a sketch there was no affordance where users actually look.
m_verb_actions["btn:constrain"] = [this] {
on_begin_constrain();
@@ -1493,7 +1493,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
// STAYS on the bar. Construction is not a tool, it is a persistent MODE — the same kind
// of thing as the Feature tree's Bed row — and the sketch bar is already shown only in
// Sketch mode, so it appears exactly while it can apply. Hiding it left Q and the offer's
// Construction row still toggling a checkbox nobody could see: you could not tell whether
// Construction item still toggling a checkbox nobody could see: you could not tell whether
// the next line would be construction geometry. A stateful toggle has to show its state.
sadd_bar(m_construction);
add_sep(m_tb_sketch);
@@ -2157,7 +2157,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
auto* bform = two_col_form();
m_bool_op = make_combo(m_cards);
m_bool_op->Append(_L_CONTEXT("Join", "Boolean Mode")); // the Extrude result word; the offer row says the same
m_bool_op->Append(_L_CONTEXT("Join", "Boolean Mode")); // the Extrude result word; the offer item says the same
m_bool_op->Append(_L("Subtract"));
m_bool_op->Append(_L("Intersect"));
m_bool_op->SetSelection(0);
@@ -4417,7 +4417,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
SetSizer(outer);
// The atlas says a verb is wired; the registrations above say what it runs. Nothing else checks
// that the two agree, and a broken join is INVISIBLE — the row renders, is enabled, and does
// that the two agree, and a broken join is INVISIBLE — the item renders, is enabled, and does
// nothing when picked — and cannot be seen by reading either side alone. Verify the join once,
// here, where every registration is complete. Cheap: 89 map lookups, once per panel.
{
@@ -4425,7 +4425,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
for (int i = 0; i < kDesignToolCount; ++i) {
const DesignTool& v = kDesignTools[i];
if (v.action == nullptr || *v.action == '\0')
continue; // kernel support, no GUI path — the row shows disabled
continue; // kernel support, no GUI path — the item shows disabled
const std::string a(v.action);
bool ok = false;
if (a.rfind("key:", 0) == 0) { // resolved exactly as run_offer_action() resolves it
@@ -6255,7 +6255,7 @@ void DesignPanel::on_check_interference()
void DesignPanel::on_mass_properties()
{
// This bounds check is not defensive padding — it is what makes the verb safe to fire from
// its Design command or Speed Dial tile, which have no offer menu to grey the row out.
// its Design command or Speed Dial tile, which have no offer menu to grey the item out.
if (m_sel_solid_body < 0 || m_sel_solid_body >= int(m_doc.bodies.size())) {
set_status(StatusKind::Info, _L("Select a body to measure it"));
return;
@@ -6525,7 +6525,7 @@ bool DesignPanel::sketch_plane_target(wxString& what) const
// ---------------------------------------------------------------------------------------------
// The object-driven offer (charter §4.1). Right-click the geometry and get a vertical list in the
// ratified row order, with the verbs that do not apply DISABLED IN PLACE carrying their reason.
// The rows come from DesignOffer.hpp, generated from scripts/CAD/tool_atlas.json — the same file the
// The items come from DesignOffer.hpp, generated from scripts/CAD/tool_atlas.json — the same file the
// mockups are drawn from, so a drawing and the product cannot drift apart.
// ---------------------------------------------------------------------------------------------
@@ -6594,7 +6594,7 @@ int DesignPanel::offer_selection_kind() const
return int(OfferSel::None);
}
// Route a row to the code that already implements the verb. Nothing here re-implements a tool:
// Route an item to the code that already implements the verb. Nothing here re-implements a tool:
// the offer is a second door onto the same room, which is what keeps the toolbar, the shortcuts
// and the menu from drifting into three behaviours.
void DesignPanel::run_offer_action(const char* action)
@@ -6646,9 +6646,9 @@ wxPoint DesignPanel::offer_anchor() const
return wxPoint(r.x + r.width / 2, r.y + r.height / 2);
}
// Append a verb row carrying the same glyph its toolbar button shows. The icon name comes from
// Append a verb item carrying the same glyph its toolbar button shows. The icon name comes from
// the atlas, so a verb and its icon are declared in one place; a null or unknown name leaves
// the row text-only rather than drawing a blank square.
// the item text-only rather than drawing a blank square.
//
// THE BITMAP MUST BE SET BEFORE Append(). wxGTK builds the GtkMenuItem inside Append and reads
// GetBitmap() right there (gtk/menu.cpp) — it makes a gtk_image_menu_item only if a bitmap is
@@ -6920,8 +6920,8 @@ wxMenuItem* DesignPanel::append_offer_item(wxMenu* menu, int id, const wxString&
return item;
}
// Diagnostic only: when ORCA_CAD_KEYTRACE is set, what the offer is about to show, a line per row,
// on stderr. It is printed from the loop that builds the rows, so it lists the rows the menu shows.
// Diagnostic only: when ORCA_CAD_KEYTRACE is set, what the offer is about to show, a line per item,
// on stderr. It is printed from the loop that builds the items, so it lists the items the menu shows.
// The variable is read once, so the trace costs nothing when off.
static void offer_trace(const char* fmt, ...)
{
@@ -6979,7 +6979,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
const uint32_t bit = offer_bit(OfferSel(kind));
// Which verb MAP applies is a question about the MODE, not about whether a session is
// running — the same distinction the keyboard map makes. Gated on is_sketching(), the offer
// would open on entering a sketch showing the FEATURE rows, every one of them refusing the
// would open on entering a sketch showing the FEATURE items, every one of them refusing the
// sketch selection: a menu of dead entries.
const bool sketching = sketch_map_applies();
// The trace is printed from the same loop that builds the menu, so it cannot drift from what
@@ -7027,7 +7027,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
std::vector<const DesignTool*> bound; // menu id offset -> verb
const int base = wxID_HIGHEST + 4200;
// Header: WHAT the rows below act on, named the way the tree and the cards name it. The rows
// Header: WHAT the items below act on, named the way the tree and the cards name it. The items
// only make sense against the selection, and the selection is not always visible under the
// cursor that opened the menu. Greyed, so it reads as a title and cannot be run.
{
@@ -7168,8 +7168,8 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
// Fed by CadDocument::mate_options() so the offer can never disagree with the kernel about
// which assembly mates a connector pair admits. Shown only when the document holds at least
// two ENABLED CoordSys features: below that the whole section would be one permanently dead
// row, which is noise rather than information.
// Set while a hovered mate row is showing its ghost, so the cleanup after PopupMenu can tell
// item, which is noise rather than information.
// Set while a hovered mate item is showing its ghost, so the cleanup after PopupMenu can tell
// "I put that there" from "some other tool's preview was already on screen".
bool mate_ghost = false;
std::vector<int> cs_features;
@@ -7179,7 +7179,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
if (cs_features.size() >= 2) {
// Which two connectors the types would apply to. The Mate card's combos when it is open —
// so the offer and the card can never disagree about the pair — otherwise the first two
// enabled CoordSys features, which is a defensible default precisely because the header row
// enabled CoordSys features, which is a defensible default precisely because the header item
// below NAMES it. An offer that acts on an unnamed pair would be worse than no offer.
int cs_a = -1, cs_b = -1;
if (m_active == Tool::Mate && m_mate_cs_a && m_mate_cs_b
@@ -7190,8 +7190,8 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
}
if (cs_a < 0 || cs_b < 0) { cs_a = cs_features[0]; cs_b = cs_features[1]; }
// The generated verb rows own [base, base + bound.size()); the table has 92 entries with a
// row (kDesignToolCount, 127, counts the commands with none too), so a gap of 500 keeps this
// The generated verb items own [base, base + bound.size()); the table has 92 entries with a
// menu item (kDesignToolCount, 127, counts the commands with none too), so a gap of 500 keeps this
// section's ids clear of that range and lets its own handler index by a distinct offset.
const int mate_base = base + 500;
@@ -7216,7 +7216,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
default: return _L("Cylindrical");
}
};
// Five rows, always, in kind order. Never reordered, never filtered — a menu that changes
// Five items, always, in kind order. Never reordered, never filtered — a menu that changes
// shape between invocations destroys the motor memory experts rely on.
const std::vector<CadDocument::MateOption> opts = m_doc.mate_options(cs_a, cs_b);
for (int i = 0; i < int(opts.size()); ++i) {
@@ -7227,7 +7227,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
menu.Append(mate_base + 1 + i, label)->Enable(o.viable);
}
// Hovering a row shows the RESULT, not a description of it (epic gap G3). preview() moves
// Hovering an item shows the RESULT, not a description of it (epic gap G3). preview() moves
// the body on a throwaway copy of the document, so nothing is written until the click —
// the "commit nothing until you choose" behaviour the palette was asked for.
auto drop_ghost = [this, &mate_ghost]() {
@@ -7240,7 +7240,7 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
menu.Bind(wxEVT_MENU_HIGHLIGHT,
[this, cs_a, cs_b, opts, &mate_ghost, drop_ghost](wxMenuEvent& e) {
const int i = e.GetMenuId() - (mate_base + 1);
// Off the palette (a verb row, the header, or nothing) — a stale ghost from the row
// Off the palette (a verb item, the header, or nothing) — a stale ghost from the item
// you just left is worse than none, so it goes as soon as the cursor does.
if (i < 0 || i >= int(opts.size()) || !opts[i].viable) { drop_ghost(); return; }
std::string err;
@@ -7267,11 +7267,11 @@ void DesignPanel::show_offer_menu(const wxPoint& screen_pos)
});
}
// Hovering a row explains it. The offer is the only door to these tools now, so a bare
// Hovering an item explains it. The offer is the only door to these tools now, so a bare
// name is not enough — and the hint arrives while you are still choosing.
// BOUND TO THE VERB ID RANGE, NOT THE WHOLE MENU. wxWidgets pushes dynamic entries to the
// FRONT of the handler list, so these two, bound LAST, run FIRST; unfiltered, they would run
// for every id, the mate rows at mate_base+1 (base+501) above included. Both fall out of
// for every id, the mate items at mate_base+1 (base+501) above included. Both fall out of
// `bound`'s range there and return WITHOUT e.Skip(), which wx reads as "handled", so the mate
// handlers would never run: hovering a mate kind would show no ghost and leave the previous
// status message on screen, and clicking one would create nothing at all. Restricting the
@@ -11916,7 +11916,7 @@ void DesignPanel::begin_sketch_session(const SketchPlane& plane, const wxString&
// Hand over the tools rather than naming them in a status line: the sketch bar carries none.
// CallAfter so the mode change has settled, and the pick that got here has returned, before a
// modal menu takes the loop; the menu carries each tool's shortcut, so pressing the key
// instead of picking a row costs nothing.
// instead of picking an item costs nothing.
if (offer_tools)
CallAfter([this] { show_offer_menu(offer_anchor()); });
}
+5 -5
View File
@@ -185,7 +185,7 @@ public:
// line), which is what a profile is drawn around, or -1 for the plane axis.
static int default_revolve_axis_entity(const std::vector<SketchEntity>& ents);
// The offer table's verbs without a right-click: a Design command with no arguments, a Speed Dial
// tile or an agent's call, fires one by id, so every verb is reachable — including the rows with
// tile or an agent's call, fires one by id, so every verb is reachable — including the items with
// no keyboard shortcut, which are otherwise invisible to anything that parses key tables.
int mcp_offer_selection_kind() const { return offer_selection_kind(); } // OfferSel as int
// Whether the right-click menu offers the sketch's verbs now, not the model's (sketch_map_applies()).
@@ -564,7 +564,7 @@ private:
// body has been moved.
TriangleMesh ghost_from_bodies(const std::vector<TriangleMesh>& per_body) const;
// A mate makes no new geometry but it MOVES a body, and the moved assembly is the ghost worth
// showing. Used both by the Mate card and by hovering a row of the offer's mate palette.
// showing. Used both by the Mate card and by hovering an item of the offer's mate palette.
bool show_mate_ghost(int kind, int cs_a, int cs_b,
double offset, double angle_deg, bool flip, std::string& err);
int resolve_extrude_sketch() const;
@@ -1086,11 +1086,11 @@ private:
wxString m_sketch_on;
// --- the object-driven offer (charter 4.1) ---------------------------------------------
// Right-click the geometry -> a vertical list in ratified row order, verbs that do not
// apply disabled IN PLACE with their reason. The rows come from the generated table in
// DesignOffer.hpp; this map is how a row reaches the code that already implements it, for
// apply disabled IN PLACE with their reason. The items come from the generated table in
// DesignOffer.hpp; this map is how an item reaches the code that already implements it, for
// the verbs that have no keyboard shortcut to route through.
std::map<std::string, std::function<void()>> m_verb_actions;
// Append an offer row with its toolbar glyph. The bitmap must be set BEFORE Append —
// Append an offer item with its toolbar glyph. The bitmap must be set BEFORE Append —
// wxGTK builds the GtkMenuItem there and only makes an image item if one is present.
// Every status write goes through here so long hints wrap instead of clipping. The kind
// sets the colour AND a leading glyph, so a message's meaning never rests on colour alone
+3 -3
View File
@@ -10688,7 +10688,7 @@ static void translate_entity(SketchEntity& e, const Vec2d& d)
// Select whatever the cursor is over, for a RIGHT-click. In every CAD application the context
// menu belongs to the thing you pointed at; here the menu was built from whatever happened to be
// selected already, so right-clicking a line you had not left-clicked first offered the empty-
// selection vocabulary and its own Delete/Length/Trim rows were nowhere. The offer table already
// selection vocabulary and its own Delete/Length/Trim items were nowhere. The offer table already
// described all of those for SkLine/SkArc/SkPoint — the pick was the missing half.
//
// Nothing is stolen from an existing selection: if the entity under the cursor is already part
@@ -11265,7 +11265,7 @@ bool DesignSketchTool::select_at_screen(GLCanvas3D& canvas, int sx, int sy)
// A Point ENTITY is its own handle: there is nothing else to select there. Taking the
// handle branch for it filled m_point_sel and left m_selection empty — and the offer
// counts only m_selection, so right-clicking a sketch point produced the EMPTY
// vocabulary and every SkPoint row in the atlas was unreachable from the menu. Other
// vocabulary and every SkPoint item in the atlas was unreachable from the menu. Other
// entities keep the handle pick: a line's endpoint is a drag target, not a thing with a
// vocabulary of its own. lnri.
if (ei >= 0 && ei < int(m_entities.size())
@@ -11341,7 +11341,7 @@ std::vector<int> DesignSketchTool::connected_loop(int seed) const
}
// Right-click has two jobs in a sketch: end a polyline chain, abandon an anchor or exit a tool,
// and open the offer. Excluding the offer in sketch mode wholesale would make every sketch row in
// and open the offer. Excluding the offer in sketch mode wholesale would make every sketch item in
// the atlas unreachable. The honest test is not "which mode are we in" but "did the tool actually
// USE this right-click", and only the tool knows: take_right_click returns it for every
// terminator, from the twenty-odd sites that consume a RightDown.
+1 -1
View File
@@ -103,7 +103,7 @@ public:
Constrain };
// Which tool is armed, and how many anchors it has down. Read-only, for the offer ladder:
// "the menu armed the verb I chose" is otherwise unassertable, and a menu walk that lands one
// row off arms a NEIGHBOURING tool and then grades whatever that drew. ekt9.
// item off arms a NEIGHBOURING tool and then grades whatever that drew. ekt9.
Mode mode() const { return m_mode; }
int pending_points() const { return int(m_points.size()); }
// Picks the armed tool is holding that are not yet an entity or a constraint: the Dimension
+1 -1
View File
@@ -129,7 +129,7 @@ const nlohmann::json* tile_with_args(const NativeCommand& command, const nlohman
{
if (!command.tiles.is_array())
return nullptr;
// A call with no arguments gives none, null as {}, as Mcp::opened_row() reads it.
// A call with no arguments gives none, null as {}, as Mcp::opened_item() reads it.
const nlohmann::json given = Mcp::person_form(args) ? nlohmann::json::object() : args;
// A tile that collects a value is called with that value besides its own arguments, never with these alone.
for (const nlohmann::json& tile : command.tiles)
+5 -5
View File
@@ -58,14 +58,14 @@ struct NativeCommand
nlohmann::json input_schema = {{"type", "object"}, {"properties", nlohmann::json::object()}};
// Calls that document the command: [{title, calls: [{tool, args}], needs?}], or null.
nlohmann::json examples;
// The tiles of the menu rows folded into the command, [{key, title, group?, icon, description, args, input?,
// The tiles of the menu items folded into the command, [{key, title, group?, icon, description, args, input?,
// input_arg?}] (NativeCommands::tile()), or null: each, under the id of its key, runs the command with `args`
// (NativeCommands::make_action()). Its title is an untranslated msgid in title_context(), as the command's is.
// group is its Speed Dial section, an untranslated msgid; a Design tile has none and is in the command's group.
// input is the Speed Dial's token for the value its second phase collects ("percent", "tab"), which the tile
// passes on under input_arg, the command's argument, or under the token where it has no input_arg.
nlohmann::json tiles;
// shown in tools/list: every command outside the Design tab that runs from its arguments, all but three menu rows
// shown in tools/list: every command outside the Design tab that runs from its arguments, all but three menu items
bool listed = false;
bool in_palette = false; // a person can pick it: it has a tile of its own, under its key
// The access labels sent as MCP's annotations. Clients act on them: Codex asks a person before every call
@@ -78,9 +78,9 @@ struct NativeCommand
// arguments name (widget_click and the other input tools, action_run, tool_call, replay_run, script_run), though
// what it runs may be. The client sees both in the arguments, and the label would ask on every call. Nor is
// recording_encode, which deletes only a recording this session made, once its MP4 has replaced it, nor a command
// whose deletion has undo (object_delete, plate_delete). A command made from menu rows is neither read_only nor
// whose deletion has undo (object_delete, plate_delete). A command made from menu items is neither read_only nor
// destructive. open_world: it can reach outside OrcaSlicer (a printer, the cloud account, the network, or anything
// the computer allows), including through what it runs: of the commands made from rows, printer_send, preset_sync,
// the computer allows), including through what it runs: of the commands made from menu items, printer_send, preset_sync,
// filament_sync_ams, app_check_for_updates, app_open_web_page and plugin_refresh; and plugin_enable and plugin_reload,
// which run a plugin's code and download a cloud plugin, and plugin_uninstall, whose Unsubscribe reaches the account.
bool read_only = false, destructive = false, idempotent = false, open_world = false;
@@ -105,7 +105,7 @@ struct NativeCommand
// The context a command's title is translated in, or nullptr for none: "Design" for a Design command, whose
// title is its entry's name, which the Design table marks in that context for every entry (DesignOffer.hpp), with
// a menu row or without, the context the Design tab's right-click menu translates a row's name in. Every place
// a menu item or without, the context the Design tab's right-click menu translates an item's name in. Every place
// that shows a command's title translates it with this (NativeCommands::tile_title(), a recording's caption).
inline const char* title_context(const NativeCommand& command)
{
+1 -1
View File
@@ -25,7 +25,7 @@ std::string resolve_call(const CommandCatalog& catalog, std::shared_ptr<const Na
std::string validate_arguments(const nlohmann::json& schema, const nlohmann::json& args);
// Whether `args` is a call with no arguments: an object with no members, or null. A Design command and a menu
// row's function do their person's form then (they ask, as a person's pick does).
// item's function do their person's form then (they ask, as a person's pick does).
bool person_form(const nlohmann::json& args);
// The arguments of each of `command`'s person's forms: {} for its own tile (in_palette), and the args of each item
// of its tiles that collects no value (no input), in their order.
+1 -1
View File
@@ -32,7 +32,7 @@ std::size_t serialized_size(const json& args) { return args.dump(-1, ' ', false,
// The name a journaled call of `tool` with `args` runs under, and the arguments it runs with: the call's own, or, for
// action_run of a command's tile, by its full id or the key inside it, that key and the arguments inside the tile's
// {id, args}. A command's own tile is under its command's key, so a Design command's tile is rewritten as its command
// is; a tile of a row folded into a command is under a key of its own, and its call's arguments, none, the tile's own
// is; a tile of a menu item folded into a command is under a key of its own, and its call's arguments, none, the tile's own
// or the value it collects, hold no path to rewrite.
std::pair<std::string, json*> called_command(const std::string& tool, json& args)
{
+1 -1
View File
@@ -44,7 +44,7 @@ public:
// What action_run runs a command's tile with: the context of action_run's own call, except that a command
// that rewrites its journal entry does so inside action_run's, as {"id": <the tile's action id>, "args": ...},
// so that a replay runs the tile again through action_run. A tile of fixed arguments (an item of a command's tiles, a
// Design command's folded rows among them, or a command's own tile outside the Design tab) records `tile_args` there in
// Design command's folded items among them, or a command's own tile outside the Design tab) records `tile_args` there in
// place of the command's rewrite: what action_run takes for it (tile_journal_args()). action_run refuses any other
// arguments for such a tile, and so would refuse the replay of a rewrite (object_arrange's adds the settings in
// force). A Design command's own tile, which takes its command's arguments, has none, and the command's rewrite stands.
+3 -3
View File
@@ -183,8 +183,8 @@ void describe_action(Builder& b, const CommandCatalog& catalog, const json& args
{
const std::string id = args.contains("id") && args["id"].is_string() ? args["id"].get<std::string>() : std::string();
const json given = args.contains("args") ? args["args"] : json();
// A command's tile, by its full id or by the key inside it, as action_run takes either: a folded row's tile runs its
// command with the row's arguments, and the value it collects when it has one, as a person's pick of it does.
// A command's tile, by its full id or by the key inside it, as action_run takes either: a folded item's tile runs its
// command with the item's arguments, and the value it collects when it has one, as a person's pick of it does.
if (const auto [command, tile] = find_tile(catalog, command_tile_key(id)); command != nullptr) {
describe_command(b, catalog, command->key, tile_call_args(tile, given), tile);
return;
@@ -208,7 +208,7 @@ void describe_action(Builder& b, const CommandCatalog& catalog, const json& args
}
}
// A command of `catalog` called as one of its tiles: with the arguments of a tile that runs it with them (a menu row
// A command of `catalog` called as one of its tiles: with the arguments of a tile that runs it with them (a menu item
// folded into it), or with none, as its tile of its own (plate_delete). A command with a tile of its own that the tool
// list does not show (a Design command) is its tile's call whatever its arguments. Called so, it does what action_run
// of that tile does.
+1 -1
View File
@@ -26,7 +26,7 @@ const char* kInstructions =
"- script_run runs Python against orca.host, the plugin API (script_search_api searches it), to compute over "
"meshes and settings and call tools (orca.host.tools); its file, program, thread and network use is restricted "
"unless app_state.python.scripts_unrestricted.\n"
"- tool_search {query} searches every catalog: the commands, those the tool list does not show too (menu rows "
"- tool_search {query} searches every catalog: the commands, those the tool list does not show too (menu items "
"with no arguments, the Design tab's, plugin operations as plugin.<plugin>.<name>; tool_call runs them), the "
"Speed Dial's other actions, settings and the Python API.\n"
"Acting on project data by index and name, JSON in and out; prefer these:\n"
+1 -1
View File
@@ -31,7 +31,7 @@ enum TargetKind : unsigned {
kParts = 4,
// An instance or a part selected stands for its object, for a command that takes objects and not them. Asked for by
// object_set_instances, whose items read the selected object so (Plater::get_selected_object_idx()), and by the
// commands of one object that have no row: part_add, object_set_variable_layer_height and object_set_height_ranges.
// commands of one object that have no menu item: part_add, object_set_variable_layer_height and object_set_height_ranges.
kObjectOfSelection = 8,
// A part selected stands for its instance, for a command that takes instances and not parts. Asked for by
// object_separate_instances, as Set as Individual Objects reads it (ObjectList::split_instances()).
+9 -9
View File
@@ -138,15 +138,15 @@ NativeCommand reaching(std::vector<std::string> operations, NativeCommand comman
// Anything that changes the app: a job under the mutate guard, journaled.
NativeCommand mutate_tool(std::string name, std::string title, std::string description, nlohmann::json schema, CommandFn handler,
bool destructive = false);
// A command made from menu rows (NativeCommandRows.hpp): NativeCommands::ui_command(), listed, with `description` and
// the rows as its `tiles`. `fn` does what the row a call's variant argument names does, as a person's pick of that row
// does: on the targets the call names (McpTargets.hpp) where the command takes them, else on what is selected. A row
// A command made from menu items (NativeCommandMenuItems.hpp): NativeCommands::ui_command(), listed, with `description` and
// the items as its `tiles`. `fn` does what the menu item a call's variant argument names does, as a person's pick of that item
// does: on the targets the call names (McpTargets.hpp) where the command takes them, else on what is selected. A menu item
// with no argument form is no command of the tool list: its declaration sets listed false.
NativeCommand row_command(std::string name, std::string title, std::string description, nlohmann::json schema, nlohmann::json tiles,
NativeCommand menu_command(std::string name, std::string title, std::string description, nlohmann::json schema, nlohmann::json tiles,
std::function<AppActionRunResult(const nlohmann::json& args)> fn);
// What a command made from rows replies to a call, which a pick does not show: `reply`.
AppActionRunResult row_reply(const nlohmann::json& reply);
// What a command made from rows answers for a refusal after a dialog the person answered or read, which told them why:
// What a command made from menu items replies to a call, which a pick does not show: `reply`.
AppActionRunResult menu_reply(const nlohmann::json& reply);
// What a command made from menu items answers for a refusal after a dialog the person answered or read, which told them why:
// a pick shows nothing more, and a call learns the refusal.
AppActionRunResult quiet_refusal(const Ops::Refusal& refusal);
@@ -211,7 +211,7 @@ nlohmann::json rank_actions(const nlohmann::json& listed, const std::vector<std:
// Why action_run refuses `args` for `action`, or empty when it does not: a tile that collects a value (input) takes
// exactly that value, a command's own tile takes its command's arguments, which the command checks, an item of a
// command's tiles (a folded row's, with a preset) takes none or exactly its preset, and every other action (a
// command's tiles (a folded item's, with a preset) takes none or exactly its preset, and every other action (a
// plugin's script or page, a plate's, a setting's or a recent project's) takes none.
std::string action_args_error(const AppAction& action, const nlohmann::json& args);
// The arguments action_run's journal step keeps for a command's tile of fixed arguments (AppAction::preset), run with
@@ -222,7 +222,7 @@ nlohmann::json tile_journal_args(const AppAction& action, const nlohmann::json&
// What action_run answers for `id`, an action id or the name inside one, that no action of the app's state has:
// for a Design tab tile's, when that tile is there and the tool_call that runs it from any tab (its command, with
// the row's arguments for a folded row's tile), or, when `catalog` leaves the tile's command out
// the item's arguments for a folded item's tile), or, when `catalog` leaves the tile's command out
// (CommandCatalog::leave_out()), why; for any other, where an action or a command is found.
std::string unknown_action(const std::string& id, const CommandCatalog& catalog);
+1 -1
View File
@@ -119,7 +119,7 @@ std::string unknown_action(const std::string& id, const CommandCatalog& catalog)
if (is_design_tile_id(tile)) {
if (const std::string* why = catalog.left_out(short_id(tile)))
return id + " is a Design tab tile, and " + *why;
// A folded row's tile is a call of the command it is folded into with the row's arguments, written as the
// A folded item's tile is a call of the command it is folded into with the item's arguments, written as the
// rest of the call is, a space after each colon and comma.
const auto [command, folded] = find_tile(catalog, short_id(tile));
std::string call = "{\"tool\": \"" + (command != nullptr ? command->key : short_id(tile)) + "\"";
+3 -3
View File
@@ -1,5 +1,5 @@
// tool_search and tool_call: a generic way to every command of the catalog, those tools/list does not show among
// them: the menu rows that take no arguments, the Design tab's commands and the operations plugins offer
// them: the menu items that take no arguments, the Design tab's commands and the operations plugins offer
// (plugin.<key>.<name>). tool_search's search also reaches the other catalogs an agent calls into: the Speed Dial's
// other actions, settings and the Python API.
@@ -281,7 +281,7 @@ void register_api_tools(CommandCatalog& catalog, const std::string& design_index
"tool_search", L("Find tools, actions, settings and APIs"),
"Find what does something, in one search, or look up one command. With query: the commands that match, best "
"first, each with its group, the first sentence of its description and listed, whether the tool list shows it; "
"one that is not listed (a menu row that takes no arguments, a Design tab command, or an operation a plugin "
"one that is not listed (a menu item that takes no arguments, a Design tab command, or an operation a plugin "
"offers, plugin.<plugin>.<name>) comes with its input schema, and its description when that says more, which "
"nothing else shows. Beside them, the best few matches of each other catalog, with its total and how to use it: "
"actions (the Speed Dial's plates, recent projects and plugin scripts and pages), settings, and python (the orca "
@@ -323,7 +323,7 @@ void register_api_tools(CommandCatalog& catalog, const std::string& design_index
// mode, budget and journal flag, and is journaled as the target's call. This handler is never reached.
NativeCommand call = mutate_tool(
"tool_call", L("Call a tool or plugin operation"),
"Call any command by name with its arguments: a tool, or one the tool list does not show, a menu row that takes no "
"Call any command by name with its arguments: a tool, or one the tool list does not show, a menu item that takes no "
"arguments, a Design tab command or an operation a plugin offers (see tool_search). It runs and is recorded as "
"that command's own call, with its guards and reply budget.",
object_schema({{"tool", prop("string", "The command to call.")},
+16 -16
View File
@@ -1,5 +1,5 @@
// app_state, app_wait and app_log: what an agent reads before and after acting; undo and redo; and the app's
// commands made from the Help menu's rows.
// commands made from the Help menu's items.
#include "JobRegistry.hpp"
#include "slic3r/GUI/I18N.hpp"
@@ -24,7 +24,7 @@
#include "slic3r/GUI/Gizmos/GLGizmosManager.hpp"
#include "slic3r/GUI/Jobs/Worker.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "slic3r/GUI/NativeCommandRows.hpp"
#include "slic3r/GUI/NativeCommandMenuItems.hpp"
#include "slic3r/GUI/NativeCommands.hpp"
#include "slic3r/GUI/Notebook.hpp"
#include "slic3r/GUI/NotificationManager.hpp"
@@ -415,13 +415,13 @@ void register_app_tools(CommandCatalog& catalog, [[maybe_unused]] bool cad)
{{"history", enum_prop({"design", "project"}, "The history: design, the Design tab's (with the CAD feature on), or project. "
"Default: the Design tab's while it is shown, else the project's.")}});
// A person's pick does what the Edit menu's item does, and shows nothing where it would be greyed. An automated
// call, action_run of the tile included, acts on the history Rows::undo_redo() picks: the Design tab's through its
// call, action_run of the tile included, acts on the history MenuItems::undo_redo() picks: the Design tab's through its
// gate, whose refusals say why, and the project's as the Edit menu's item does.
const auto history_command = [&history](std::string key, std::string title, std::string icon, std::string description, bool redo) {
NativeCommand command = row_command(std::move(key), std::move(title), std::move(description), history, json(),
[redo](const json& args) { return Rows::undo_redo(args, redo); });
NativeCommand command = menu_command(std::move(key), std::move(title), std::move(description), history, json(),
[redo](const json& args) { return MenuItems::undo_redo(args, redo); });
const CommandFn picked = NativeCommands::ui_command(command.key, command.title, command.group, history,
[redo](const json& args) { return Rows::picked_undo_redo(args, redo); })
[redo](const json& args) { return MenuItems::picked_undo_redo(args, redo); })
.run;
command.run = [picked, automated = std::move(command.run)](const json& args, ToolContext& ctx) {
return ctx.person() ? picked(args, ctx) : automated(args, ctx);
@@ -471,11 +471,11 @@ void register_app_tools(CommandCatalog& catalog, [[maybe_unused]] bool cad)
catalog.add(std::move(undo));
catalog.add(std::move(redo));
// ---- The app's commands made from the Help and Plugins menus' rows ----
// ---- The app's commands made from the Help and Plugins menus' items ----
using NativeCommands::tile;
NativeCommand web_page = row_command(
NativeCommand web_page = menu_command(
"app_open_web_page", L("Open a web page"),
"Open one of OrcaSlicer's web pages in the default web browser, as its menu row does: wiki, the OrcaSlicer wiki; "
"Open one of OrcaSlicer's web pages in the default web browser, as its menu item does: wiki, the OrcaSlicer wiki; "
"youtube, the OrcaSlicer YouTube channel; plugin_hub, the plugin hub's page, where a person picks a plugin to install. "
"Nothing opens in OrcaSlicer.",
object_schema({{"page", enum_prop({"wiki", "youtube", "plugin_hub"}, "The page.")}}, {"page"}),
@@ -485,29 +485,29 @@ void register_app_tools(CommandCatalog& catalog, [[maybe_unused]] bool cad)
tile("install_plugin", L("Install Plugin"), L("Plugins"), "", {{"page", "plugin_hub"}},
"Open the plugin hub's page in the default web browser, where a person picks a plugin to install; "
"nothing opens in OrcaSlicer.")}),
[](const json& args) { return Rows::open_web_page(arg_string(args, "page")); });
[](const json& args) { return MenuItems::open_web_page(arg_string(args, "page")); });
// The browser it opens reaches the network.
web_page.open_world = true;
catalog.add(std::move(web_page));
const std::string updates = "Check for a newer OrcaSlicer.";
NativeCommand check_updates = row_command("app_check_for_updates", L("Check for Updates"), updates, object_schema({}),
NativeCommand check_updates = menu_command("app_check_for_updates", L("Check for Updates"), updates, object_schema({}),
json::array({tile("help_check_updates", L("Check for Updates"), L("Help"), "refresh",
json::object(), updates)}),
[](const json&) { return Rows::check_for_updates(); });
[](const json&) { return MenuItems::check_for_updates(); });
// It asks the update server.
check_updates.open_world = true;
catalog.add(std::move(check_updates));
const std::string folder = "Open the configuration folder in the file manager.";
catalog.add(row_command("app_show_config_folder", L("Show Configuration Folder"), folder, object_schema({}),
catalog.add(menu_command("app_show_config_folder", L("Show Configuration Folder"), folder, object_schema({}),
json::array({tile("help_open_config_folder", L("Show Configuration Folder"), L("Help"), "open_project",
json::object(), folder)}),
[](const json&) { return Rows::show_config_folder(); }));
[](const json&) { return MenuItems::show_config_folder(); }));
const std::string benchmark = "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.";
catalog.add(row_command("app_benchmark_3d_scene", L("Benchmark 3D Scene"), benchmark, object_schema({}),
catalog.add(menu_command("app_benchmark_3d_scene", L("Benchmark 3D Scene"), benchmark, object_schema({}),
json::array({tile("help_benchmark_3d_scene", L("Benchmark 3D Scene"), L("Help"), "", json::object(), benchmark)}),
[](const json&) { return Rows::benchmark_3d_scene(); }));
[](const json&) { return MenuItems::benchmark_3d_scene(); }));
}
}}} // namespace Slic3r::GUI::Mcp
+67 -67
View File
@@ -1,8 +1,8 @@
// The Design tab's commands. The Design table (kDesignTools, generated from scripts/CAD/tool_atlas.json)
// declares every one, its menu row, action, access, tool block and the rows folded into it; kSilentForms binds a
// declares every one, its menu item, action, access, tool block and the items folded into it; kSilentForms binds a
// block to the function that runs it. register_cad_commands() makes a command of each entry that is one
// (is_design_command()): a call with the arguments that choose one of its rows does what that menu row does
// (opened_row(), open_tool()), and any other has run_cad_tool() run its silent form on the UI thread, through the
// (is_design_command()): a call with the arguments that choose one of its items does what that menu item does
// (opened_item(), open_tool()), and any other has run_cad_tool() run its silent form on the UI thread, through the
// GUI's own CadDocument and DesignPanel's mcp_* hooks, behind the Design tab's busy and stale-id checks
// (cad_gate()).
@@ -55,7 +55,7 @@
#include "slic3r/GUI/CAD/DesignPanel.hpp"
#include "slic3r/GUI/CAD/DesignCanvas.hpp"
#include "slic3r/GUI/CAD/DesignSketchTool.hpp"
#include "slic3r/GUI/CAD/DesignOffer.hpp" // the Design table: every command's row, action and tool block
#include "slic3r/GUI/CAD/DesignOffer.hpp" // the Design table: every command's menu item, action and tool block
#include "libslic3r/CAD/CadDocument.hpp"
#include "libslic3r/CAD/SketchEngine.hpp"
@@ -166,15 +166,15 @@ const char* const kFailureNote = "A rejected rebuild is reported in the reply: o
// The rest of the description of a command whose entry has an action and no silent form, after its hint and
// before mode_note().
const char* const kOpensToolNote =
"It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open "
"It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open "
"a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the "
"tab's status line shows then.";
// The `silent` property of a command whose call with no arguments opens a tool, before mode_note() of that tool's
// row.
// item.
const char* const kSilentNote =
"true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design "
"tab's menu row does, as a person's pick does.";
"tab's menu item does, as a person's pick does.";
// The mode an entry with an action runs in, as the Design tab's right-click menu offers it (offered_in_mode()).
// A sketch being constrained counts as open, and refuses sketch_finish and sketch_cancel: the tab's own Confirm
@@ -218,7 +218,7 @@ json picked_plane_json(const DesignPanel& panel)
return plane >= 0 ? json(names[plane]) : json();
}
// The selected row of the Feature list, a feature index, which the rows that act on it take while nothing is picked
// The selected row of the Feature list, a feature index, which the menu items that act on it take while nothing is picked
// in the view; or null.
json feature_row_json(const DesignPanel& panel)
{
@@ -1863,8 +1863,8 @@ json action_sketch_describe(DesignPanel* panel, const json& params)
for (int i = 0; i < int(t.entities().size()); ++i)
ents.push_back(sketch_entity_to(t.entities()[i], i));
// The armed TOOL and its pending anchors. Without these the only way to tell which tool a
// menu row actually armed is to draw with it and infer from what came out — which is how a
// menu walk that lands one row off gets diagnosed as "the tool is broken".
// menu item actually armed is to draw with it and infer from what came out — which is how a
// menu walk that lands one item off gets diagnosed as "the tool is broken".
static const char* const kModeNames[] = {
"select", "dimension", "polyline", "line", "rect_corner", "rect_center", "rect_oblique",
"rect_rounded", "circle_center", "circle_2pt", "point",
@@ -3989,7 +3989,7 @@ json run_guarded(const std::function<json()>& run)
}
// Why a menu-only entry (a btn: or fly: action) is refused for a selection it does not accept.
// TRN Refusal of a Design tab tool picked for a selection its right-click menu row is greyed for (Constrain
// TRN Refusal of a Design tab tool picked for a selection its right-click menu item is greyed for (Constrain
// sketch with a face selected).
const char* const kDoesNotApply = L("This tool does not apply to what is selected");
// Why an entry of the sketch's vocabulary is refused outside a sketch, and one of the model's inside one.
@@ -4000,7 +4000,7 @@ const char* const kModelTool = L("This tool works on the model: finish or cancel
// The selection kinds the Design tab reports as what is selected (DesignPanel::offer_selection_kind()), as OfferSel
// bits: in a sketch, what is picked there; on the model, nothing, a face, an edge, a vertex, a body or a committed
// sketch's loop. Rows accept other kinds too (two bodies, a datum, art, a sketch line on the model), which the tab
// sketch's loop. Menu items accept other kinds too (two bodies, a datum, art, a sketch line on the model), which the tab
// never reports, so no selection can be one of them.
uint32_t reported_kinds(bool sketching)
{
@@ -4016,31 +4016,31 @@ uint32_t reported_kinds(bool sketching)
return bits;
}
// Row `row`'s action, for a call of `command` that opens it (opened_row()), as a person's pick of the row or its
// Item `item`'s action, for a call of `command` that opens it (opened_item()), as a person's pick of the item or its
// tile runs it: past cad_gate() with no access of its own, so that only a rebuild refuses it, as the Design tab's
// keys and menu are refused by nothing; each tool decides for itself what an open card means to it. The action
// runs in place, so a modal dialog it opens holds the call, which the core reports as blocked by that dialog. It
// is refused, as open_refusal() says, in the mode the row does not belong to, where the right-click menu does not
// offer it, and for a btn: or fly: action a selection the menu greys the row for. The reply claims nothing about
// is refused, as open_refusal() says, in the mode the item does not belong to, where the right-click menu does not
// offer it, and for a btn: or fly: action a selection the menu greys the item for. The reply claims nothing about
// what the action did, which may be to open a card, start a sketch tool, act at once or tell the person why it
// cannot: it says what the tab shows after it, its busy reason (a card, a dialog or a sketch now open) and its
// status line. Its `tool` is the command called. A call that is not a person's pick, made while a row of the Feature
// list is selected and nothing is picked in the view, targets that row: a row whose action acts on it (feature_row)
// is not refused for the selection then, and applies. A person's pick keeps the menu's rule, which greys the row.
json open_tool(const DesignTool& row, const char* command, const json& args, bool person)
// list is selected and nothing is picked in the view, targets that row: an item whose action acts on it (feature_row)
// is not refused for the selection then, and applies. A person's pick keeps the menu's rule, which greys the item.
json open_tool(const DesignTool& item, const char* command, const json& args, bool person)
{
DesignPanel* panel = cad_gate(CadAccess::None, args);
const int kind = panel->mcp_offer_selection_kind();
const bool row_target = !person && panel->mcp_feature_row() >= 0 && kind == int(OfferSel::None) &&
panel->mcp_picked_plane() < 0;
const bool applies = (row_target && row.feature_row) || (row.accepts & offer_bit(OfferSel(kind))) != 0;
if (std::optional<ToolFailure> refused = open_refusal(row, panel->mcp_sketch_map_applies(), kind, row_target))
const bool applies = (row_target && item.feature_row) || (item.accepts & offer_bit(OfferSel(kind))) != 0;
if (std::optional<ToolFailure> refused = open_refusal(item, panel->mcp_sketch_map_applies(), kind, row_target))
throw *refused;
const bool text_was_open = panel->mcp_text_dialog_open();
panel->mcp_run_verb(row.id);
panel->mcp_run_verb(item.id);
// A dialog the action opened held the call until it was answered, unless the action opened the Text dialog,
// which is modeless: the call returns with it open. A Text dialog open before the action is not its dialog.
const bool modal = row.modal && !(panel->mcp_text_dialog_open() && !text_was_open);
const bool modal = item.modal && !(panel->mcp_text_dialog_open() && !text_was_open);
std::string why;
const bool busy = panel->mcp_busy(false, false, why);
return json{{"interactive", true},
@@ -4052,37 +4052,37 @@ json open_tool(const DesignTool& row, const char* command, const json& args, boo
{"status", into_u8(panel->mcp_status())}};
}
// The end of the description of entry `t`'s command: the argument sets that name a row, its own args and those of
// the rows folded into it, each once with the names of the rows it opens (rows folded in with one set are one tool
// under several labels, as the value rows are with {}), so that a search for a row's name finds the command; empty
// The end of the description of entry `t`'s command: the argument sets that name a menu item, its own args and those of
// the items folded into it, each once with the names of the items it opens (items folded in with one set are one tool
// under several labels, as the value items are with {}), so that a search for an item's name finds the command; empty
// when there are none.
std::string opening_calls(const DesignTool& t)
{
std::vector<std::pair<std::string, std::string>> sets; // an argument set as JSON text, and its rows' names
const auto add = [&sets](const DesignTool& row) {
const std::string args = json::parse(row.args).dump();
std::vector<std::pair<std::string, std::string>> sets; // an argument set as JSON text, and its items' names
const auto add = [&sets](const DesignTool& item) {
const std::string args = json::parse(item.args).dump();
const auto same = std::find_if(sets.begin(), sets.end(), [&args](const auto& set) { return set.first == args; });
if (same == sets.end())
sets.emplace_back(args, row.name);
sets.emplace_back(args, item.name);
else
same->second += std::string(", ") + row.name;
same->second += std::string(", ") + item.name;
};
if (t.action != nullptr && t.args != nullptr)
add(t);
for (const DesignTool& row : kDesignTools)
if (row.fold_into != nullptr && std::strcmp(row.fold_into, t.id) == 0)
add(row);
for (const DesignTool& item : kDesignTools)
if (item.fold_into != nullptr && std::strcmp(item.fold_into, t.id) == 0)
add(item);
if (sets.empty())
return {};
std::string calls;
for (const auto& [args, names] : sets)
calls += (calls.empty() ? "" : ", ") + args + " (" + names + ")";
return " Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design "
"tab for a person, as the menu row does: " +
return " Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design "
"tab for a person, as the menu item does: " +
calls + ".";
}
// The command of the Design table's entry `t`, which has an action, a tool block or both, and is no folded row.
// The command of the Design table's entry `t`, which has an action, a tool block or both, and is no folded item.
NativeCommand design_command(const DesignTool& t)
{
const json doc = t.doc != nullptr ? json::parse(t.doc) : json();
@@ -4091,34 +4091,34 @@ NativeCommand design_command(const DesignTool& t)
schema = {{"type", "object"}, {"properties", json::object()}, {"additionalProperties", false}};
else
schema = cad_input_schema(doc);
// The person's form is the call with no arguments where that opens a row's tool, the entry's own or one folded
// into it: it requires nothing (with_silent()), and runs in that row's mode only.
const DesignTool* person_row = opened_row(t, json::object());
if (person_row != nullptr && !doc.is_null()) {
// The person's form is the call with no arguments where that opens an item's tool, the entry's own or one folded
// into it: it requires nothing (with_silent()), and runs in that item's mode only.
const DesignTool* person_item = opened_item(t, json::object());
if (person_item != nullptr && !doc.is_null()) {
schema = with_silent(std::move(schema));
schema["properties"]["silent"]["description"] = std::string(kSilentNote) + " " + mode_note(*person_row, true);
schema["properties"]["silent"]["description"] = std::string(kSilentNote) + " " + mode_note(*person_item, true);
}
const DesignTool* entry = &t;
NativeCommand c = cad_command(
t.id, t.name, std::move(schema),
[entry](const json& args, bool person) {
if (const DesignTool* row = opened_row(*entry, args))
return open_tool(*row, entry->id, args, person);
if (const DesignTool* item = opened_item(*entry, args))
return open_tool(*item, entry->id, args, person);
return run_cad_tool(entry->id, silent_args(args));
},
[entry](const json& args) { return opened_row(*entry, args) != nullptr; });
[entry](const json& args) { return opened_item(*entry, args) != nullptr; });
c.in_palette = t.action != nullptr;
c.icon = t.icon != nullptr ? t.icon : "";
// The rows folded into the command keep their tiles, each a call of the command with the row's arguments, and
// The items folded into the command keep their tiles, each a call of the command with the item's arguments, and
// say what a pick does as a command with an action only does.
for (const DesignTool& row : kDesignTools)
if (row.fold_into != nullptr && std::strcmp(row.fold_into, t.id) == 0)
c.tiles.push_back({{"key", row.id},
{"title", row.name},
{"icon", row.icon != nullptr ? row.icon : ""},
{"description", std::string(row.hint) + ". " + kOpensToolNote + " " + mode_note(row)},
{"args", json::parse(row.args)}});
for (const DesignTool& item : kDesignTools)
if (item.fold_into != nullptr && std::strcmp(item.fold_into, t.id) == 0)
c.tiles.push_back({{"key", item.id},
{"title", item.name},
{"icon", item.icon != nullptr ? item.icon : ""},
{"description", std::string(item.hint) + ". " + kOpensToolNote + " " + mode_note(item)},
{"args", json::parse(item.args)}});
if (doc.is_null()) {
c.description = std::string(t.hint) + ". " + kOpensToolNote + " " + mode_note(t);
return c;
@@ -4149,16 +4149,16 @@ const DesignTool* find_design_tool(const std::string& id)
bool is_design_command(const DesignTool& t) { return (t.action != nullptr || t.doc != nullptr) && t.fold_into == nullptr; }
const DesignTool* opened_row(const DesignTool& entry, const json& args)
const DesignTool* opened_item(const DesignTool& entry, const json& args)
{
// A call with no arguments gives none, null as {}.
const json given = person_form(args) ? json::object() : args;
if (entry.action != nullptr && (given.empty() || (entry.args != nullptr && json::parse(entry.args) == given)))
return &entry;
for (const DesignTool& row : kDesignTools)
if (row.fold_into != nullptr && std::strcmp(row.fold_into, entry.id) == 0 && row.args != nullptr &&
json::parse(row.args) == given)
return &row;
for (const DesignTool& item : kDesignTools)
if (item.fold_into != nullptr && std::strcmp(item.fold_into, entry.id) == 0 && item.args != nullptr &&
json::parse(item.args) == given)
return &item;
return nullptr;
}
@@ -4181,19 +4181,19 @@ std::optional<ToolFailure> open_refusal(const DesignTool& t, bool sketching, int
if (!offered_in_mode(t, sketching))
return ToolFailure(t.sketch_mode ? kSketchTool : kModelTool,
{{"code", -32000}, {"mode", t.sketch_mode ? "sketch" : "model"}});
// The row's action acts on the Feature list's selected row, and says itself what it cannot do with it.
// The item's action acts on the Feature list's selected row, and says itself what it cannot do with it.
if (row_target && t.feature_row)
return std::nullopt;
const std::string action(t.action);
const bool applies = (t.accepts & offer_bit(OfferSel(kind))) != 0;
// Only a row that accepts a kind the tab can report in its mode is greyed for the others; one that accepts none
// (Boolean's rows take two bodies, Rib a sketch line) opens as its toolbar button does, whatever is selected.
// Only an item that accepts a kind the tab can report in its mode is greyed for the others; one that accepts none
// (Boolean's items take two bodies, Rib a sketch line) opens as its toolbar button does, whatever is selected.
const bool greyable = (action.rfind("btn:", 0) == 0 || action.rfind("fly:", 0) == 0) &&
(t.accepts & reported_kinds(t.sketch_mode)) != 0;
if (applies || !greyable)
return std::nullopt;
// The row's own refusal is about the document (no body, no second sketch), which the menu shows only for
// a row that takes the selection; here the selection is the obstacle, so the reply names what to pick.
// The item's own refusal is about the document (no body, no second sketch), which the menu shows only for
// an item that takes the selection; here the selection is the obstacle, so the reply names what to pick.
json accepts = json::array();
for (int sel = 0; sel < int(OfferSel::Count); ++sel)
if ((t.accepts & offer_bit(OfferSel(sel))) != 0)
@@ -4342,7 +4342,7 @@ NativeCommand cad_command(std::string key, std::string title, json schema,
return ToolResult::ok({{"result", fn(args, true)}});
} catch (const ToolFailure& refused) {
// What the person reads, in the UI's language where the text is a msgid (an entry's refusal). Looked
// up in the application's catalogue only, as the right-click menu's rows are (show_offer_menu()), so
// up in the application's catalogue only, as the right-click menu's items are (show_offer_menu()), so
// that a wxWidgets entry cannot answer for it.
throw ToolFailure(into_u8(wxGetTranslation(wxString::FromUTF8(refused.what()), SLIC3R_APP_KEY)), refused.details);
}
@@ -4373,7 +4373,7 @@ void register_cad_commands(CommandCatalog& catalog)
void leave_out_cad_commands(CommandCatalog& catalog)
{
// A folded row's id too, which is no command but names a tile.
// A folded item's id too, which is no command but names a tile.
for (const DesignTool& t : kDesignTools)
if (t.action != nullptr || t.doc != nullptr)
catalog.leave_out(t.id, kCadOffAtStartup);
@@ -4398,15 +4398,15 @@ std::string design_command_index()
{
std::string index = " The Design tab's CAD commands follow by heading (sketches, solid and surface features, bodies, "
"measurements); look one up with tool before calling it. A command whose schema has silent does what "
"its menu row does when called with no arguments, unless silent is true.";
"its menu item does when called with no arguments, unless silent is true.";
for (const char* section : kDesignSections) {
std::string names;
for (const DesignTool& t : kDesignTools)
if (t.section != nullptr && std::strcmp(t.section, section) == 0)
names += (names.empty() ? "" : ", ") + std::string(t.id);
index += std::string(" ") + section;
if (std::strcmp(section, "Menu rows") == 0)
index += ", which take no arguments and do what their row of the right-click menu does";
if (std::strcmp(section, "Menu items") == 0)
index += ", which take no arguments and do what their item of the right-click menu does";
index += ": " + names + ".";
}
return index;
+18 -18
View File
@@ -1,11 +1,11 @@
#pragma once
// The Design tab's commands, one per entry of its table (kDesignTools, DesignOffer.hpp, generated from
// scripts/CAD/tool_atlas.json) that has an action or a tool block and is no folded row (is_design_command()): its
// scripts/CAD/tool_atlas.json) that has an action or a tool block and is no folded item (is_design_command()): its
// tools, sketches, features, measurements and edits, which an agent finds with tool_search (group Design) and
// runs with tool_call, and a person picks as Speed Dial tiles while the Design tab is shown, those of the mode it
// is in. A call with exactly the arguments that choose one of the command's rows (opened_row()) does what that
// right-click menu row does, in the mode the row belongs to (open_refusal()); any other call, or one with
// is in. A call with exactly the arguments that choose one of the command's items (opened_item()) does what that
// right-click menu item does, in the mode the item belongs to (open_refusal()); any other call, or one with
// silent: true, runs the entry's tool block's silent form. They run on the UI thread through the GUI's own
// CadDocument (no engine of their own), behind one gate (cad_gate()): every command is refused (-32002) during a
// rebuild, whose worker owns the document, and a silent form that changes the document also while the Design tab
@@ -64,27 +64,27 @@ NativeCommand cad_command(std::string key, std::string title, nlohmann::json sch
std::function<bool(const nlohmann::json& args)> opens = {});
// Adds the Design commands to `catalog`, one per entry of kDesignTools that is a command (is_design_command()):
// its id as the key, its name as the title, and its icon. An entry with an action is in the palette, and a row
// folded into a command is one of the command's `tiles`, with the row's id as its key, its name, icon and args, and
// its id as the key, its name as the title, and its icon. An entry with an action is in the palette, and an item
// folded into a command is one of the command's `tiles`, with the item's id as its key, its name, icon and args, and
// as its description its hint and what a pick does (a tile is materialised only while the Design tab is shown in
// its entry's mode, ActionRegistry::materialize_design_actions()). One with a block is read_only for Read access,
// and its description is the block's summary, details and, for a silent form that reports a rejected rebuild in
// its reply, how that shows, then the other calls that open a tool, each with its row's name; its examples are the
// its reply, how that shows, then the other calls that open a tool, each with its item's name; its examples are the
// block's and its schema cad_input_schema() of it, through with_silent() when a call with no arguments opens a
// tool. One with an action only takes no arguments, and its description is its hint and what the call does.
// undo and redo are the shared commands of NativeCommands.cpp and not among them.
void register_cad_commands(CommandCatalog& catalog);
// Records in `catalog`, built with the CAD feature off, that it leaves out the keys register_cad_commands()
// adds, and the ids of the rows folded into them, which name tiles, because the feature was off when OrcaSlicer
// adds, and the ids of the items folded into them, which name tiles, because the feature was off when OrcaSlicer
// started and how a person turns it on (CommandCatalog::leave_out()).
void leave_out_cad_commands(CommandCatalog& catalog);
// What tool_search's 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: a lead saying what they cover, that one is looked up with
// tool before it is called, and that a command whose schema has silent does what its menu row does when called
// tool before it is called, and that a command whose schema has silent does what its menu item does when called
// with no arguments unless silent is true; then each heading of kDesignSections with the keys of its commands
// (DesignTool::section) in the table's order, Menu rows saying that its commands take no arguments. It starts with
// (DesignTool::section) in the table's order, Menu items saying that its commands take no arguments. It starts with
// a space, to follow the description's last sentence.
std::string design_command_index();
@@ -115,16 +115,16 @@ DesignPanel* cad_gate(CadAccess access, const nlohmann::json& args);
// The Design table's entry `id`, or nullptr.
const DesignTool* find_design_tool(const std::string& id);
// Whether entry `t` is a command of the catalog: it has an action or a tool block, and is no folded row
// Whether entry `t` is a command of the catalog: it has an action or a tool block, and is no folded item
// (DesignTool::fold_into), which is a way of calling the command it is folded into.
bool is_design_command(const DesignTool& t);
// The row whose tool a call of `entry`'s command with `args` opens, or nullptr when the call runs. A call with no
// arguments (null or {}) opens `entry`'s own row where it has an action, else the first row folded into it with
// {}; any other opens `entry`'s row where it has an action and its own args equal `args`, else the first row
// The item whose tool a call of `entry`'s command with `args` opens, or nullptr when the call runs. A call with no
// arguments (null or {}) opens `entry`'s own item where it has an action, else the first item folded into it with
// {}; any other opens `entry`'s item where it has an action and its own args equal `args`, else the first item
// folded into it whose args equal `args`. Arguments are compared as JSON values, as they reach the command's
// function: `generation`, `silent` or any other argument beside the choosing ones makes the call run.
const DesignTool* opened_row(const DesignTool& entry, const nlohmann::json& args);
const DesignTool* opened_item(const DesignTool& entry, const nlohmann::json& args);
// Whether the Design tab offers entry `t` in the mode it is in, `sketching` being the right-click menu's
// DesignPanel::sketch_map_applies(): an entry of the sketch's vocabulary in a sketch, one of the model's
@@ -132,7 +132,7 @@ const DesignTool* opened_row(const DesignTool& entry, const nlohmann::json& args
// there are the model's. Only then is its tile shown and its person's form run.
bool offered_in_mode(const DesignTool& t, bool sketching);
// A Speed Dial tile of the Design tab: `command`'s own (`tile` null), or the item of command->tiles that a menu row
// A Speed Dial tile of the Design tab: `command`'s own (`tile` null), or the item of command->tiles that a menu item
// folded into it has.
struct DesignTile
{
@@ -142,7 +142,7 @@ struct DesignTile
// The Speed Dial tiles the Design tab has while it is shown in the mode `sketching` names (as offered_in_mode()
// takes it): one per entry of the Design table with an action offered in that mode, in the table's order, whose
// command `catalog` holds: a folded row's runs the command it is folded into with the row's args. None while the
// command `catalog` holds: a folded item's runs the command it is folded into with the item's args. None while the
// CAD feature is off (`cad_on` false): the tab stays until a restart, but cad_gate() would refuse every pick of
// its tiles.
std::vector<DesignTile> design_tiles(const CommandCatalog& catalog, bool sketching, bool cad_on);
@@ -151,9 +151,9 @@ std::vector<DesignTile> design_tiles(const CommandCatalog& catalog, bool sketchi
// tab's mode (offered_in_mode()), and the message says which mode it belongs to and what to do; or `t`'s
// action is a btn: or fly: one, which the menu greys for a selection it does not accept, `t` accepts a kind the
// tab reports as the selection in its mode, and selection `kind` (OfferSel as int) is not one it accepts, and the
// details name the selection and those it accepts. A row that accepts no kind the tab reports there opens as its
// details name the selection and those it accepts. An item that accepts no kind the tab reports there opens as its
// toolbar button does, and a key: action runs whatever is selected, as its key does. With `row_target`, a call that
// targets the Feature list's selected row (nothing picked in the view), a row whose action acts on that row
// targets the Feature list's selected row (nothing picked in the view), an item whose action acts on that row
// (DesignTool::feature_row) is not refused for the selection: its action says itself what it cannot do. The message
// is a msgid, the code -32000.
std::optional<ToolFailure> open_refusal(const DesignTool& t, bool sketching, int kind, bool row_target = false);
+2 -2
View File
@@ -88,7 +88,7 @@ NativeCommand mutate_tool(std::string name, std::string title, std::string descr
return d;
}
NativeCommand row_command(std::string name, std::string title, std::string description, json schema, json tiles,
NativeCommand menu_command(std::string name, std::string title, std::string description, json schema, json tiles,
std::function<AppActionRunResult(const json& args)> fn)
{
NativeCommand d = NativeCommands::ui_command(std::move(name), std::move(title), {}, std::move(schema), std::move(fn));
@@ -98,7 +98,7 @@ NativeCommand row_command(std::string name, std::string title, std::string descr
return d;
}
AppActionRunResult row_reply(const json& reply)
AppActionRunResult menu_reply(const json& reply)
{
AppActionRunResult result{AppActionRunResult::Level::Succeeded};
result.reply = reply.dump();
+54 -54
View File
@@ -4,9 +4,9 @@
// settings change through the Tab's own transaction (strict parsing, on_change callbacks, rollback on failure), or
// for the project's and the plates' own settings through the code of their sidebar controls and dialogs, so the UI
// and the project stay consistent. The preferences have commands of their own (McpToolsPreferences.cpp). The plate
// commands made from menu rows act on the plate a call names, else on the
// current plate, through the plate operations (Operations/PlateOps.hpp); plate_add runs its row's function
// (NativeCommandRows.hpp).
// commands made from menu items act on the plate a call names, else on the
// current plate, through the plate operations (Operations/PlateOps.hpp); plate_add runs its menu item's function
// (NativeCommandMenuItems.hpp).
#include "slic3r/GUI/I18N.hpp"
#include "McpArguments.hpp"
@@ -24,7 +24,7 @@
#include "slic3r/GUI/GUI_ObjectList.hpp"
#include "slic3r/GUI/IMSlider.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "slic3r/GUI/NativeCommandRows.hpp"
#include "slic3r/GUI/NativeCommandMenuItems.hpp"
#include "slic3r/GUI/NativeCommands.hpp"
#include "slic3r/GUI/ObjectDataViewModel.hpp"
#include "slic3r/GUI/Operations/Outcome.hpp"
@@ -861,9 +861,9 @@ json list_plates(const json& args)
return page(items, args, 100);
}
// ---- The plate commands made from menu rows ----
// ---- The plate commands made from menu items ----
// What a plate command made from rows answers for a refusal: as information where its row told it so (no plates to
// What a plate command made from menu items answers for a refusal: as information where its item told it so (no plates to
// edit, the only plate, no room for another, a slice running), else as an error.
AppActionRunResult plate_refused(const Ops::Refusal& refusal)
{
@@ -899,7 +899,7 @@ AppActionRunResult plate_delete_command(const json& args)
return plate_refused(deleted.refusal());
json reply = plates_reply();
reply["plate"] = deleted.value();
return row_reply(reply);
return menu_reply(reply);
}
AppActionRunResult plate_duplicate_command(const json& args)
@@ -910,10 +910,10 @@ AppActionRunResult plate_duplicate_command(const json& args)
json reply = plates_reply();
reply["plate"] = made.value().plate;
reply["new_plate"] = made.value().copy;
return row_reply(reply);
return menu_reply(reply);
}
// plate_rename: a call with no arguments asks for the current plate's name in its name dialog, as the row does; any
// plate_rename: a call with no arguments asks for the current plate's name in its name dialog, as the menu item does; any
// other gives it.
AppActionRunResult plate_rename_command(const json& args)
{
@@ -935,7 +935,7 @@ AppActionRunResult plate_rename_command(const json& args)
if (!renamed)
return plate_refused(renamed.refusal());
const PartPlate& plate = *ui_plater().get_partplate_list().get_plate(renamed.value());
return row_reply({{"plate", renamed.value()}, {"name", plate.get_plate_name()}});
return menu_reply({{"plate", renamed.value()}, {"name", plate.get_plate_name()}});
}
AppActionRunResult plate_lock_command(const json& args)
@@ -947,10 +947,10 @@ AppActionRunResult plate_lock_command(const json& args)
const Ops::Outcome<Ops::PlateLocked> locked = Ops::set_plate_locked(op);
if (!locked)
return plate_refused(locked.refusal());
return row_reply({{"plate", locked.value().plate}, {"locked", locked.value().locked}, {"changed", locked.value().changed}});
return menu_reply({{"plate", locked.value().plate}, {"locked", locked.value().locked}, {"changed", locked.value().changed}});
}
// plate_select: Ops::select_plate() also serves the commands that select a plate on the way, so the check of the rows,
// plate_select: Ops::select_plate() also serves the commands that select a plate on the way, so the check of the menu items,
// that the project has plates to select, is made here.
AppActionRunResult plate_select_command(const json& args)
{
@@ -960,12 +960,12 @@ AppActionRunResult plate_select_command(const json& args)
op.plate = arg_int(args, "plate", ui_plater().get_partplate_list().get_curr_plate_index());
if (const Ops::Outcome<Ops::Done> selected = Ops::select_plate(op); !selected)
return plate_refused(selected.refusal());
return row_reply({{"plate", op.plate}});
return menu_reply({{"plate", op.plate}});
}
// ---- The filament slot commands made from menu rows, and Sync Presets ----
// ---- The filament slot commands made from menu items, and Sync Presets ----
// What a filament slot command answers for a refusal: as information where its row told it so (no slots to change, no
// What a filament slot command answers for a refusal: as information where its menu item told it so (no slots to change, no
// + and - buttons for the printer, no room for another slot, the only slot), else as an error.
AppActionRunResult filament_refused(const Ops::Refusal& refusal)
{
@@ -1016,7 +1016,7 @@ AppActionRunResult filament_delete_command(const json& args)
AppActionRunResult sync_ams_command(const json& args)
{
if (!args.contains("mode"))
return Rows::sync_ams();
return MenuItems::sync_ams();
const Ops::AmsSyncMode mode = arg_string(args, "mode") == "map" ? Ops::AmsSyncMode::Map : Ops::AmsSyncMode::Overwrite;
const Ops::Outcome<Ops::AmsSynced> synced = Ops::sync_filaments_from_ams(mode);
if (!synced)
@@ -1031,10 +1031,10 @@ AppActionRunResult sync_ams_command(const json& args)
json reply{{"mode", arg_string(args, "mode")}, {"filaments", std::move(slots)}};
if (!synced.value().unknowns.empty())
reply["mapped_to_generic"] = synced.value().unknowns;
return row_reply(reply);
return menu_reply(reply);
}
// preset_sync: signed out, a pick says to sign in, as its row did, and a call is refused.
// preset_sync: signed out, a pick says to sign in, as its menu item did, and a call is refused.
AppActionRunResult preset_sync_command(const json&)
{
if (const Ops::Outcome<Ops::Done> synced = Ops::sync_presets(); !synced)
@@ -3311,8 +3311,8 @@ void register_config_tools(CommandCatalog& catalog)
{"offset", {{"type", "integer"}, {"minimum", 0}}}}),
[](const json& args, ToolContext& ctx) { return ToolResult::ok(ctx.run_ui([&] { return list_plates(args); })); }));
// The plate commands made from menu rows: each acts on the plate the call names, else on the current plate, as its row
// does, and its reply names the plate. A command named as its row is that row's tile, in the Speed Dial's section
// The plate commands made from menu items: each acts on the plate the call names, else on the current plate, as its item
// does, and its reply names the plate. A command named as its item is that item's tile, in the Speed Dial's section
// `section`.
const auto own_tile = [](NativeCommand command, std::string section, std::string icon) {
command.in_palette = true;
@@ -3322,11 +3322,11 @@ void register_config_tools(CommandCatalog& catalog)
};
const std::string plates_after = "plates (each plate afterwards: index, name and objects, how many stand on it) and current "
"(the current plate)";
catalog.add(own_tile(row_command("plate_add", L("Add Plate"), "Add a plate.", object_schema({}), json(),
[](const json&) { return Rows::plate_add(); }),
catalog.add(own_tile(menu_command("plate_add", L("Add Plate"), "Add a plate.", object_schema({}), json(),
[](const json&) { return MenuItems::plate_add(); }),
L("Plate"), "toolbar_add_plate"));
catalog.add(reaching({"delete_plate"},
own_tile(row_command("plate_delete", L("Delete Plate"),
own_tile(menu_command("plate_delete", L("Delete Plate"),
"Delete a plate (plate, else the current one), as Delete Plate does. The objects on it "
"stay in the project, outside the plates, and the plates after it move down one. The "
"only plate is refused. One undo step. Reply: plate (the index it had), " +
@@ -3334,7 +3334,7 @@ void register_config_tools(CommandCatalog& catalog)
object_schema({{"plate", plate_prop}}), json(), plate_delete_command),
L("Plate"), "delete")));
catalog.add(reaching({"duplicate_plate"},
own_tile(row_command("plate_duplicate", L("Duplicate Plate"),
own_tile(menu_command("plate_duplicate", L("Duplicate Plate"),
"Add a plate with a copy of each object on the plate (plate, else the current one), "
"placed on it as on that plate, as Duplicate Current Plate does. The new "
"plate comes last, and the current plate stays current. Refused when the project "
@@ -3344,7 +3344,7 @@ void register_config_tools(CommandCatalog& catalog)
object_schema({{"plate", plate_prop}}), json(), plate_duplicate_command),
L("Plate"), "menu_copy")));
// The name dialog's name, which every call but the tile's gives.
NativeCommand rename = own_tile(row_command("plate_rename", L("Rename Plate"),
NativeCommand rename = own_tile(menu_command("plate_rename", L("Rename Plate"),
"Name a plate (plate, else the current one), as its name icon does: a plate other "
"than the current one is made current first. name \"\" leaves it unnamed. With no "
"arguments, as its tile, the name dialog asks for the current plate's name "
@@ -3360,7 +3360,7 @@ void register_config_tools(CommandCatalog& catalog)
catalog.add(reaching({"rename_plate", "select_plate"}, std::move(rename)));
catalog.add(reaching(
{"set_plate_locked"},
row_command("plate_lock", L("Toggle Plate Lock"),
menu_command("plate_lock", L("Toggle Plate Lock"),
"Lock or unlock a plate (plate, else the current one), as its lock icon does: locked true locks it and false "
"unlocks it; without locked it toggles, as its tile does. An arrange of every plate leaves a locked one as "
"it is. One undo step, none when the plate is in that state already. Reply: plate, locked, and changed "
@@ -3372,7 +3372,7 @@ void register_config_tools(CommandCatalog& catalog)
plate_lock_command)));
catalog.add(reaching(
{"select_plate"},
row_command("plate_select", L("Go to Plate"),
menu_command("plate_select", L("Go to Plate"),
"Make a plate the current one, as a click on it does: plate; without it, the current plate stays current. "
"An index the project lacks is an error. Reply: plate.",
object_schema({{"plate", plate_prop}}),
@@ -3380,23 +3380,23 @@ void register_config_tools(CommandCatalog& catalog)
"Make the first plate the current one.")}),
plate_select_command)));
// ---- The presets and settings commands made from menu rows ----
// ---- The presets and settings commands made from menu items ----
using NativeCommands::tile;
const std::string preset_file = "a preset .json, a .zip of them, an .orca_printer, .orca_filament or .orca_bundle, or a .gcode";
const std::string imported = "and the message names the presets imported, replaced and kept; a .gcode loads the settings it was "
"sliced with.";
NativeCommand import_configs = reaching(
{"import_presets"},
row_command("preset_import", L("Import Configs"),
menu_command("preset_import", L("Import Configs"),
"Import presets from " + preset_file + " by absolute path, without a dialog, " + imported +
" Called with no arguments it is Import Configs: the file dialog asks for the file (blocked_by_dialog).",
object_schema({{"path", Rows::input_file(preset_file.c_str())},
object_schema({{"path", MenuItems::input_file(preset_file.c_str())},
{"on_conflict", enum_prop({"skip", "overwrite"}, "What happens to a preset that exists already. Default skip.")}},
{"path"}),
json::array({tile("import_configs", L("Import Configs"), L("Import"), "menu_open", json::object(),
"Import presets from the file a dialog asks for. preset_import with a path imports " + preset_file +
" without a dialog, " + imported)}),
[](const json& args) { return Rows::import_configs(args); }));
[](const json& args) { return MenuItems::import_configs(args); }));
import_configs.input_schema = with_silent(std::move(import_configs.input_schema), person_forms(import_configs));
catalog.add(std::move(import_configs));
@@ -3404,18 +3404,18 @@ void register_config_tools(CommandCatalog& catalog)
const std::string export_dialog = "Export presets as a bundle or ZIP archives through the Export Preset Bundle dialog: click the "
"label of the kind to export, check its rows (each named after a printer preset or a "
"filament), press OK, then answer the result message.";
catalog.add(row_command(
catalog.add(menu_command(
"preset_export", L("Export Preset Bundle"),
export_dialog + " Every call opens the dialog (blocked_by_dialog). With path, OK writes into that folder instead of "
"asking for one, and a cancelled dialog is an error: nothing was exported.",
object_schema({{"path", prop("string", "Absolute path of an existing folder, which the dialog's OK writes into.")}}),
json::array({tile("export_config", L("Export Preset Bundle"), L("Export"), "save", json::object(),
export_dialog + " preset_export with a folder as path has OK write there instead of asking for one.")}),
[](const json& args) { return Rows::export_config(args); }));
[](const json& args) { return MenuItems::export_config(args); }));
const std::string sync = "Synchronize user presets with the cloud account.";
NativeCommand preset_sync = reaching({"sync_presets"},
row_command("preset_sync", L("Sync Presets"), sync + " Refused while no account is signed in.",
menu_command("preset_sync", L("Sync Presets"), sync + " Refused while no account is signed in.",
object_schema({}),
json::array({tile("sync_presets", L("Sync Presets"), L("Presets"), "printer_sync_ok",
json::object(), sync)}),
@@ -3425,47 +3425,47 @@ void register_config_tools(CommandCatalog& catalog)
catalog.add(std::move(preset_sync));
const std::string migrate = "Migrate legacy user filament presets.";
catalog.add(row_command("preset_migrate_filaments", L("Migrate Filament Presets"), migrate, object_schema({}),
catalog.add(menu_command("preset_migrate_filaments", L("Migrate Filament Presets"), migrate, object_schema({}),
json::array({tile("help_migrate_filament_presets", L("Migrate Filament Presets"), L("Help"), "",
json::object(), migrate)}),
[](const json&) { return Rows::migrate_filament_presets(); }));
[](const json&) { return MenuItems::migrate_filament_presets(); }));
// The Mode rows; titles are L("...")-marked here so xgettext extracts them.
struct ModeRow
// The Mode menu items; titles are L("...")-marked here so xgettext extracts them.
struct ModeMenuItem
{
const char* key;
const char* title;
const char* mode;
const char* name;
};
static const ModeRow mode_rows[] = {{"mode_simple", L("Mode: Simple"), "simple", "Simple"},
static const ModeMenuItem mode_menu_items[] = {{"mode_simple", L("Mode: Simple"), "simple", "Simple"},
{"mode_advanced", L("Mode: Advanced"), "advanced", "Advanced"},
{"mode_expert", L("Mode: Expert"), "expert", "Expert"}};
json mode_tiles = json::array();
for (const ModeRow& row : mode_rows)
mode_tiles.push_back(tile(row.key, row.title, L("Mode"), "advanced", {{"mode", row.mode}},
std::string("Switch the settings view to ") + row.name + " mode."));
catalog.add(row_command("settings_set_mode", L("Set the settings mode"),
for (const ModeMenuItem& item : mode_menu_items)
mode_tiles.push_back(tile(item.key, item.title, L("Mode"), "advanced", {{"mode", item.mode}},
std::string("Switch the settings view to ") + item.name + " mode."));
catalog.add(menu_command("settings_set_mode", L("Set the settings mode"),
"Switch the settings view to Simple, Advanced or Expert mode, which decides which settings the settings "
"pages show.",
object_schema({{"mode", enum_prop({"simple", "advanced", "expert"}, "The mode.")}}, {"mode"}),
std::move(mode_tiles), [](const json& args) { return Rows::set_mode(arg_string(args, "mode")); }));
std::move(mode_tiles), [](const json& args) { return MenuItems::set_mode(arg_string(args, "mode")); }));
const std::string developer = "Turn Developer mode on or off.";
NativeCommand developer_mode = row_command("settings_toggle_developer_mode", L("Toggle Developer Mode"), developer, object_schema({}),
NativeCommand developer_mode = menu_command("settings_toggle_developer_mode", L("Toggle Developer Mode"), developer, object_schema({}),
json::array({tile("toggle_developer_mode", L("Toggle Developer Mode"), L("Mode"),
"advanced", json::object(), developer)}),
[](const json&) { return Rows::toggle_developer_mode(); });
// A menu row with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it.
[](const json&) { return MenuItems::toggle_developer_mode(); });
// A menu item with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it.
developer_mode.listed = false;
catalog.add(std::move(developer_mode));
// ---- The filament slot and printer commands made from menu rows ----
// The + and - buttons above the filament list and a slot's Delete menu item, each named as its row, in the Speed
// ---- The filament slot and printer commands made from menu items ----
// The + and - buttons above the filament list and a slot's Delete menu item, each named as the button or menu item is, in the Speed
// Dial's section Filament.
const std::string slot_buttons = "Refused for a printer that has one filament per extruder, which shows no + and - buttons.";
catalog.add(reaching({"add_filament_slot"},
own_tile(row_command("filament_add", L("Add Filament Slot"),
own_tile(menu_command("filament_add", L("Add Filament Slot"),
"Add a filament slot, as the + button above the filament list does. It takes the next "
"colour and the last slot's preset (change them with preset_select filament_slot and "
"project_set_settings filament_colour). It goes after the physical slots: mixed "
@@ -3476,7 +3476,7 @@ void register_config_tools(CommandCatalog& catalog)
L("Filament"), "add_filament")));
catalog.add(reaching(
{"delete_filament_slot"},
own_tile(row_command("filament_delete", L("Delete Filament Slot"),
own_tile(menu_command("filament_delete", L("Delete Filament Slot"),
"Delete a filament slot, as its Delete menu item does, the objects on it taking the first filament; "
"with merge_into, as its Merge with item does, the objects on it taking that slot. The slots after "
"it move down by one. The only physical slot and a mixed filament (project_get_settings "
@@ -3537,7 +3537,7 @@ void register_config_tools(CommandCatalog& catalog)
const std::string ams = "Synchronize the filament list from the connected printer's AMS.";
NativeCommand sync_ams = reaching(
{"sync_filaments_from_ams"},
row_command("filament_sync_ams", L("Synchronize Filament List from AMS"),
menu_command("filament_sync_ams", L("Synchronize Filament List from AMS"),
ams + " With mode, as the sync dialog's Synchronize now does with that choice, without the dialog: map maps "
"each of the project's filaments to a slot, as the dialog's Mapping first does, which takes a project "
"with objects; overwrite replaces the filament list with the slots' filaments. Called with no arguments, "
@@ -3560,10 +3560,10 @@ void register_config_tools(CommandCatalog& catalog)
"row's state, and a failed upload also opens an error dialog. A replay uploads again. Fails for a printer without a "
"print host, or one that prints through the Bambu network or printer agents.";
NativeCommand printer_send = reaching({"send_gcode_to_host"},
row_command("printer_send", L("Send G-code to printer host"), send, object_schema({}),
menu_command("printer_send", L("Send G-code to printer host"), send, object_schema({}),
json::array({tile("send_gcode", L("Send G-code to printer host"),
L("Slice & Export"), "printer", json::object(), send)}),
[](const json&) { return Rows::send_gcode(); }));
[](const json&) { return MenuItems::send_gcode(); }));
// It uploads to the printer's print host.
printer_send.open_world = true;
catalog.add(std::move(printer_send));
+7 -7
View File
@@ -1,5 +1,5 @@
// The plugin commands: what the Plugins window lists and does (plugin_list, plugin_enable, plugin_uninstall,
// plugin_reload) on the operations of GUI/Operations/PluginOps.hpp, and the Plugins menu's rows (plugin_install_local,
// plugin_reload) on the operations of GUI/Operations/PluginOps.hpp, and the Plugins menu's items (plugin_install_local,
// plugin_refresh).
#include "McpArguments.hpp"
@@ -9,7 +9,7 @@
#include "slic3r/GUI/CommandTypes.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/NativeCommandRows.hpp"
#include "slic3r/GUI/NativeCommandMenuItems.hpp"
#include "slic3r/GUI/NativeCommands.hpp"
#include "slic3r/GUI/Operations/Outcome.hpp"
#include "slic3r/GUI/Operations/PluginOps.hpp"
@@ -290,19 +290,19 @@ void register_plugin_tools(CommandCatalog& catalog)
// The file its dialog asks for, which every call but the tile's gives.
const std::string replacing = "A plugin of that name installed already is replaced only with overwrite true; without it the "
"call is refused with the question the dialog asks.";
NativeCommand local = row_command(
NativeCommand local = menu_command(
"plugin_install_local", L("Install Local Plugin"),
"Install a plugin from a .py or .whl file by absolute path, as the Plugins dialog's Install local plugin does, without its "
"file dialog. " + replacing + " Called with no arguments, the file dialog asks for the file (blocked_by_dialog), and "
"replacing an installed plugin asks first (dialog_answer).",
object_schema({{"path", Rows::input_file("a .py or .whl plugin package")},
object_schema({{"path", MenuItems::input_file("a .py or .whl plugin package")},
{"overwrite", prop("boolean", "Replace a plugin of that name installed already. Default false.")}},
{"path"}),
json::array({tile("install_local_plugin", L("Install Local Plugin"), L("Plugins"), "", json::object(),
"Install a plugin from the .py or .whl file a dialog asks for, as the Plugins dialog's Install local "
"plugin does, asking before it replaces one installed; plugin_install_local with a path installs that "
"file without a dialog. " + replacing)}),
[](const json& args) { return Rows::install_local_plugin(args); });
[](const json& args) { return MenuItems::install_local_plugin(args); });
local.input_schema = with_silent(std::move(local.input_schema), person_forms(local));
catalog.add(std::move(local));
@@ -388,8 +388,8 @@ void register_plugin_tools(CommandCatalog& catalog)
refresh_command.tiles =
json::array({tile("refresh_plugins", L("Refresh Plugins"), L("Plugins"), "", json::object(), "Reload plugins.")});
// A person's pick starts the refresh and returns, its notification saying how it went; a call waits for it.
catalog.add(NativeCommands::with_row_forms(
std::move(refresh_command), [](const json&) { return Rows::refresh_plugins(); }, /*person_form_behind_dialogs=*/false,
catalog.add(NativeCommands::with_menu_item_forms(
std::move(refresh_command), [](const json&) { return MenuItems::refresh_plugins(); }, /*person_form_behind_dialogs=*/false,
std::vector<json>{json::object()}));
}
+27 -27
View File
@@ -1,5 +1,5 @@
// project_new, project_open, project_import, project_save and project_export: the project's files in and out without
// file dialogs, and called as their menu rows' tiles, with them. calibration_generate_test: the Calibration menu's
// file dialogs, and called as their menu items' tiles, with them. calibration_generate_test: the Calibration menu's
// tests, which start a new project.
#include "slic3r/GUI/I18N.hpp"
@@ -14,7 +14,7 @@
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "slic3r/GUI/NativeCommandRows.hpp"
#include "slic3r/GUI/NativeCommandMenuItems.hpp"
#include "slic3r/GUI/NativeCommands.hpp"
#include "slic3r/GUI/Operations/ExportOps.hpp"
#include "slic3r/GUI/Operations/ObjectOps.hpp"
@@ -445,7 +445,7 @@ void register_project_tools(CommandCatalog& catalog)
"Open a project through the Open dialog (it asks first if the current project "
"has unsaved changes); project_open with a path opens that file without a "
"dialog.")});
catalog.add(NativeCommands::with_person_form(std::move(open), [](const json&) { return Rows::load_project(); }));
catalog.add(NativeCommands::with_person_form(std::move(open), [](const json&) { return MenuItems::load_project(); }));
NativeCommand import_ = reaching({"import_models"}, mutate_tool(
"project_import", L("Import models"),
@@ -525,10 +525,10 @@ void register_project_tools(CommandCatalog& catalog)
NativeCommands::tile("import_zip_archive", L("Import ZIP Archive"), L("Import"), "menu_open", {{"archive", true}},
"Import models from a ZIP archive (opens a file dialog).")});
catalog.add(NativeCommands::with_person_form(std::move(import_), [](const json& tile_args) {
return tile_args.value("archive", false) ? Rows::import_zip_archive() : Rows::import_file();
return tile_args.value("archive", false) ? MenuItems::import_zip_archive() : MenuItems::import_file();
}));
// New Project's row is its tile: with no arguments it asks as the row does.
// New Project's menu item is its tile: with no arguments it asks as the item does.
NativeCommand project_new = reaching({"new_project"}, mutate_tool(
"project_new", L("New Project"),
"Start a new, empty project. Called with no arguments, it asks as New Project does, about the unsaved changes "
@@ -722,9 +722,9 @@ void register_project_tools(CommandCatalog& catalog)
settle(ctx);
return ToolResult::ok(out);
});
// The Calibration menu's rows, each the dialog of its test. The tab strip's calib_sf glyph is drawn white for the dark
// tab bar and vanishes on the palette's light tile, so each row borrows the matching settings-group icon instead.
struct CalibrationRow
// The Calibration menu's items, each the dialog of its test. The tab strip's calib_sf glyph is drawn white for the dark
// tab bar and vanishes on the palette's light tile, so each item borrows the matching settings-group icon instead.
struct CalibrationMenuItem
{
const char* key;
const char* title;
@@ -733,7 +733,7 @@ void register_project_tools(CommandCatalog& catalog)
CalibKind kind;
};
// Titles are L("...")-marked here so xgettext extracts them.
static const CalibrationRow calibration_rows[] = {
static const CalibrationMenuItem calibration_menu_items[] = {
{"calib_temperature", L("Temperature Calibration"), "param_temperature", "temperature", CalibKind::Temperature},
{"calib_max_volumetric", L("Max Volumetric Speed Calibration"), "param_volumetric_speed", "max_volumetric",
CalibKind::MaxVolumetric},
@@ -749,21 +749,21 @@ void register_project_tools(CommandCatalog& catalog)
{"calib_vfa", L("VFA Calibration"), "param_speed", "vfa", CalibKind::VFA},
};
calibration.tiles = json::array();
for (const CalibrationRow& row : calibration_rows)
calibration.tiles.push_back(NativeCommands::tile(row.key, row.title, L("Calibration"), row.icon, {{"test", row.test}},
std::string("Open the ") + row.title +
for (const CalibrationMenuItem& item : calibration_menu_items)
calibration.tiles.push_back(NativeCommands::tile(item.key, item.title, L("Calibration"), item.icon, {{"test", item.test}},
std::string("Open the ") + item.title +
" dialog; calibration_generate_test with the test's parameters, or "
"silent, runs it with no dialog."));
catalog.add(NativeCommands::with_person_form(std::move(calibration), [](const json& tile_args) {
const std::string test = tile_args.at("test");
for (const CalibrationRow& row : calibration_rows)
if (test == row.test)
return Rows::calib(row.kind);
for (const CalibrationMenuItem& item : calibration_menu_items)
if (test == item.test)
return MenuItems::calib(item.kind);
return AppActionRunResult{AppActionRunResult::Level::Error, from_u8("Unknown test \"" + test + "\""), false};
}));
// Save Project's and Save Project As's rows are its tiles: with no arguments, or with save_as alone, it saves as the
// row does.
// Save Project's and Save Project As's menu items are its tiles: with no arguments, or with save_as alone, it saves as the
// item does.
NativeCommand save = reaching({"save_project_as"}, mutate_tool(
"project_save", L("Save Project"),
"Save the project. Called with no arguments, it saves as Save Project does: to the project's file (reply: ran, "
@@ -807,7 +807,7 @@ void register_project_tools(CommandCatalog& catalog)
"writes that).")});
save = NativeCommands::with_person_form(std::move(save), [](const json& tile_args) {
if (tile_args.value("save_as", false))
return Rows::save_project_as();
return MenuItems::save_project_as();
if (Plater* plater = wxGetApp().plater())
return NativeCommands::project_save_result(plater->save_project(false));
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
@@ -829,8 +829,8 @@ void register_project_tools(CommandCatalog& catalog)
"path names; every object of every plate, or those objects names. toolpaths_obj: the toolpaths the Preview shows, "
"as an OBJ, refused while it shows none (slice the plate and show the Preview first). Without format, the path's "
"extension (.gcode, .gcode.3mf, .3mf, .stl, .drc, .obj) says which. Called with exactly the arguments of one of the "
"File > Export rows (format alone, sliced_3mf with plates \"all\", stl or drc with per_object), it asks for the file "
"or folder in the dialog that row opens (blocked_by_dialog). A file per object of a project with no objects, and the "
"File > Export menu items (format alone, sliced_3mf with plates \"all\", stl or drc with per_object), it asks for the file "
"or folder in the dialog that item opens (blocked_by_dialog). A file per object of a project with no objects, and the "
"toolpaths while the Preview shows none, are refused in either form. Reply: path and bytes; for gcode, path and "
"export (ok, or superseded with a note when the project changed while it was written); for per_object, path and "
"files (each file written); for stl and drc, objects (those written).",
@@ -946,7 +946,7 @@ void register_project_tools(CommandCatalog& catalog)
reply.update(written);
return ToolResult::ok(reply);
})));
// The File > Export rows, each with the dialog it asks for the file or folder in.
// The File > Export menu items, each with the dialog it asks for the file or folder in.
export_.tiles = json::array({
NativeCommands::tile("export_gcode", L("Export G-code"), L("Slice & Export"), "custom-gcode_gcode", {{"format", "gcode"}},
"Export the current plate's G-code through the export dialog, in the background. project_export "
@@ -979,16 +979,16 @@ void register_project_tools(CommandCatalog& catalog)
const std::string format = tile_args.at("format");
const bool per_object = tile_args.value("per_object", false);
if (format == "gcode")
return Rows::export_gcode();
return MenuItems::export_gcode();
if (format == "sliced_3mf")
return Rows::export_sliced_file(tile_args.value("plates", std::string()) == "all");
return MenuItems::export_sliced_file(tile_args.value("plates", std::string()) == "all");
if (format == "3mf")
return Rows::export_3mf();
return MenuItems::export_3mf();
if (format == "stl")
return per_object ? Rows::export_stl_multi() : Rows::export_stl();
return per_object ? MenuItems::export_stl_multi() : MenuItems::export_stl();
if (format == "drc")
return per_object ? Rows::export_drc_multi() : Rows::export_drc_single();
return Rows::export_toolpaths_obj();
return per_object ? MenuItems::export_drc_multi() : MenuItems::export_drc_single();
return MenuItems::export_toolpaths_obj();
}));
}
+5 -5
View File
@@ -11,7 +11,7 @@
#include "slic3r/GUI/ActionRegistry.hpp"
#include "slic3r/GUI/CommandCatalog.hpp"
#include "slic3r/GUI/NativeCommandRows.hpp"
#include "slic3r/GUI/NativeCommandMenuItems.hpp"
#include "slic3r/GUI/NativeCommands.hpp"
#include "slic3r/GUI/CommandTypes.hpp"
#include "slic3r/GUI/GUI_App.hpp"
@@ -448,14 +448,14 @@ void register_python_tools(CommandCatalog& catalog)
return ToolResult::ok(std::move(out));
}));
// The Run Script panel's menu row, which has no argument form.
// The Run Script panel's menu item, which has no argument form.
const std::string panel = "Show or hide the Run Script panel, where a person writes and runs Python scripts cell by cell. Agents "
"run Python with the script_run tool instead.";
NativeCommand toggle_panel = row_command("script_toggle_panel", L("Run Script"), panel, object_schema({}),
NativeCommand toggle_panel = menu_command("script_toggle_panel", L("Run Script"), panel, object_schema({}),
json::array({NativeCommands::tile("toggle_run_script_panel", L("Run Script"),
L("Commands"), "media_play", json::object(), panel)}),
[](const json&) { return Rows::toggle_run_script_panel(); });
// A menu row with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it.
[](const json&) { return MenuItems::toggle_run_script_panel(); });
// A menu item with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it.
toggle_panel.listed = false;
catalog.add(std::move(toggle_panel));
}
+113 -110
View File
@@ -1,9 +1,9 @@
// object_list, object_select, object_transform, part_add, object_arrange, plate_slice and job_cancel: the model on the plates, the
// arrange and Fill bed jobs, and the slice operation, which reports its own outcome per plate (see
// Operations/RunStatus). The object and part commands made from menu rows: those that add a primitive, delete, rename,
// Operations/RunStatus). The object and part commands made from menu items: those that add a primitive, delete, rename,
// set the number of instances, make instances separate objects, split, assemble, order, mirror, centre, scale to fit,
// drop and orient objects and change a part's type take their targets (McpTargets.hpp) and run their operations
// (Operations/ObjectOps, ProjectOps); the others run their rows' functions (NativeCommandRows.hpp) on the selection.
// (Operations/ObjectOps, ProjectOps); the others run their menu items' functions (NativeCommandMenuItems.hpp) on the selection.
// The object and part commands of menu items with no Speed Dial tile, which mark objects printable, turn their Auto Drop
// on or off, repair their meshes, clone them, reload them from their files and replace a part's mesh, take their targets
// and run their operations too.
@@ -34,7 +34,7 @@
#include "slic3r/GUI/Gizmos/GLGizmosManager.hpp"
#include "slic3r/GUI/Jobs/Worker.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "slic3r/GUI/NativeCommandRows.hpp"
#include "slic3r/GUI/NativeCommandMenuItems.hpp"
#include "slic3r/GUI/NativeCommands.hpp"
#include "slic3r/GUI/NotificationManager.hpp"
#include "slic3r/GUI/ObjectDataViewModel.hpp"
@@ -1011,16 +1011,16 @@ json plate_summary(const json& statistics, const GCodeProcessorResult& result)
namespace {
// The Prepare view's selection, the view shown first when another is, as the object rows read it: what a command made
// from rows acts on when it is given no target. Null for a call that names its targets, which leaves the view shown.
// The Prepare view's selection, the view shown first when another is, as the object menu items read it: what a command made
// from menu items acts on when it is given no target. Null for a call that names its targets, which leaves the view shown.
const Selection* prepare_selection(const json& args)
{
return names_targets(args) ? nullptr : &Ops::shown_prepare_canvas().get_selection();
}
// What a command made from rows answers for a refusal: as information where the person can select something else or
// wait and pick it again, as the rows told those, else as an error.
AppActionRunResult row_refused(const Ops::Refusal& refusal)
// What a command made from menu items answers for a refusal: as information where the person can select something else or
// wait and pick it again, as the items told those, else as an error.
AppActionRunResult menu_refused(const Ops::Refusal& refusal)
{
const std::string code = refusal.code;
const bool again = refusal.kind == Ops::RefusalKind::Busy || code == "nothing_selected" || code == "wrong_selection" ||
@@ -1028,14 +1028,14 @@ AppActionRunResult row_refused(const Ops::Refusal& refusal)
return NativeCommands::refused(refusal, again ? AppActionRunResult::Level::Info : AppActionRunResult::Level::Error);
}
// A refusal a command made from rows answers as information, where its row told that refusal, or the check it stands
// A refusal a command made from menu items answers as information, where its item told that refusal, or the check it stands
// for, as information.
AppActionRunResult row_info(const Ops::Refusal& refusal) { return NativeCommands::refused(refusal, AppActionRunResult::Level::Info); }
AppActionRunResult menu_info(const Ops::Refusal& refusal) { return NativeCommands::refused(refusal, AppActionRunResult::Level::Info); }
constexpr unsigned kEveryTarget = kObjects | kInstances | kParts;
// The object list's selected rows as targets, for a command whose row acted on them (Assemble, Change Type), read in
// the Prepare view, shown first, as the row read them: an object row as its object, an instance row as [object,
// The object list's selected rows as targets, for a command whose menu item acted on them (Assemble, Change Type), read in
// the Prepare view, shown first, as the menu item read them: an object row as its object, an instance row as [object,
// instance] and a part row as [object, part], by the part's index in the model. Refuses nothing_selected for no row and
// wrong_selection for a row of none of `types` (ItemType bits). UI thread.
Ops::Outcome<Targets> listed_rows(int types)
@@ -1165,7 +1165,7 @@ AppActionRunResult delete_command(const json& args)
} else if (!all) {
const Ops::Outcome<Targets> found = resolve_targets(model, prepare_selection(args), args, kEveryTarget, false);
if (!found)
return row_refused(found.refusal());
return menu_refused(found.refusal());
op.targets = found.value();
}
// Named before the delete renumbers what follows.
@@ -1177,7 +1177,7 @@ AppActionRunResult delete_command(const json& args)
const Ops::Outcome<Ops::DeletedTargets> deleted = Ops::delete_objects(op);
if (!deleted) {
if (std::string(deleted.refusal().code) != "nothing_deleted")
return row_refused(deleted.refusal());
return menu_refused(deleted.refusal());
// The object list told the person why, or they answered its question themself: the pick shows nothing more,
// and a call learns that nothing was deleted.
AppActionRunResult kept{AppActionRunResult::Level::Info, {}, false};
@@ -1188,11 +1188,11 @@ AppActionRunResult delete_command(const json& args)
if (const json kept = targets_reply(model, deleted.value().kept); !kept.empty())
reply["kept"] = kept;
reply["object_count"] = model.objects.size();
return row_reply(reply);
return menu_reply(reply);
}
// object_rename: the object or part the call names, else the one selected. A call with no arguments asks for the name
// in the Rename dialog, as the row does; any other gives it.
// in the Rename dialog, as the menu item does; any other gives it.
AppActionRunResult rename_command(const json& args)
{
const bool asks = person_form(args);
@@ -1200,17 +1200,17 @@ AppActionRunResult rename_command(const json& args)
// Before anything is read, so a name that cannot be given leaves the view as it is.
if (!asks)
if (const std::optional<Ops::Refusal> refusal = Ops::rename_refusal(name))
return row_refused(*refusal);
return menu_refused(*refusal);
Plater& plater = ui_plater();
const Ops::Outcome<Targets> found = resolve_targets(plater.model(), prepare_selection(args), args, kObjects | kParts, true);
if (!found)
return row_refused(std::string(found.refusal().code) == "wrong_selection" ? Ops::rename_wrong_selection() : found.refusal());
return menu_refused(std::string(found.refusal().code) == "wrong_selection" ? Ops::rename_wrong_selection() : found.refusal());
const Targets& target = found.value();
const int object = target.parts.empty() ? target.objects.front() : target.parts.front().first;
const int part = target.parts.empty() ? -1 : target.parts.front().second;
if (asks) {
if (const std::optional<Ops::Refusal> refusal = Ops::unlisted_part_refusal(plater.model(), object, part))
return row_refused(*refusal);
return menu_refused(*refusal);
// The dialog renames the object list's selected row, which is the target's once every instance of an object
// selected stands for it. A part's row is by its place among the rows, which leave a cut's connectors out.
ObjectList* list = wxGetApp().obj_list();
@@ -1222,9 +1222,9 @@ AppActionRunResult rename_command(const json& args)
select_rows(owner, part < 0 ? nullptr : owner->volumes[std::size_t(part)]);
list->rename_item();
} else if (const Ops::Outcome<std::string> renamed = Ops::rename_object({object, part, name}); !renamed) {
return row_refused(renamed.refusal());
return menu_refused(renamed.refusal());
}
return row_reply(targets_reply(plater.model(), target));
return menu_reply(targets_reply(plater.model(), target));
}
// object_set_instances: the object the call names, else the one selected, or the object of the selected instance or
@@ -1241,25 +1241,25 @@ AppActionRunResult instances_command(const json& args)
const Ops::Outcome<Targets> found =
resolve_targets(plater.model(), prepare_selection(args), args, kObjects | kObjectOfSelection, true);
if (!found)
return row_refused(found.refusal());
return menu_refused(found.refusal());
const int object = found.value().objects.front();
const std::size_t had = plater.model().objects[std::size_t(object)]->instances.size();
if (asks) {
// The asking path: the item's dialog, on the selected object, enabled as the menu enables it.
if (const std::optional<Ops::Refusal> refusal = Ops::add_instances_refusal(plater.model(), object))
return row_refused(*refusal);
return menu_refused(*refusal);
if (const std::optional<Ops::Refusal> refusal = Ops::instance_change_blocked())
return row_refused(*refusal);
return menu_refused(*refusal);
plater.set_number_of_copies();
} else {
const int count = args.contains("count") ? args.at("count").get<int>() : int(had) + args.at("delta").get<int>();
if (const Ops::Outcome<Ops::InstanceCount> set = Ops::set_instance_count({object, count}); !set)
return row_refused(set.refusal());
return menu_refused(set.refusal());
}
json reply = targets_reply(plater.model(), found.value());
reply["object"] = object;
reply["instances"] = plater.model().objects[std::size_t(object)]->instances.size();
return row_reply(reply);
return menu_reply(reply);
}
// object_separate_instances: the object the call names or the instances of one object, else the selection, where a part
@@ -1270,16 +1270,16 @@ AppActionRunResult separate_command(const json& args)
const Ops::Outcome<Targets> found = resolve_targets(plater.model(), prepare_selection(args), args,
kObjects | kInstances | kInstanceOfSelectedPart, false);
if (!found)
return row_refused(found.refusal());
return menu_refused(found.refusal());
const Ops::Outcome<Targets> holders = Ops::separate_instances(found.value());
if (!holders)
return row_refused(holders.refusal());
return row_reply(targets_reply(plater.model(), holders.value()));
return menu_refused(holders.refusal());
return menu_reply(targets_reply(plater.model(), holders.value()));
}
// object_split: the object the call names, else the object list's one selected row (split_row()), as the Split rows
// object_split: the object the call names, else the object list's one selected row (split_row()), as the Split menu items
// read it. A call with a tile's arguments asks what Split asks (the Auto-Drop question, a message for an object of one
// piece); any other answers the question with keep_z, and is refused without it. The rows told every refusal of theirs
// piece); any other answers the question with keep_z, and is refused without it. The menu items told every refusal of theirs
// as information.
AppActionRunResult split_command(const json& args)
{
@@ -1291,12 +1291,12 @@ AppActionRunResult split_command(const json& args)
if (names_targets(args)) {
const Ops::Outcome<Targets> found = resolve_targets(plater.model(), nullptr, args, kObjects, true);
if (!found)
return row_info(found.refusal());
return menu_info(found.refusal());
op.target = found.value();
} else {
const Ops::Outcome<SplitRow> found = split_row(to_objects);
if (!found)
return row_info(found.refusal());
return menu_info(found.refusal());
op.target = found.value().target;
op.expand = found.value().object_row;
}
@@ -1306,14 +1306,14 @@ AppActionRunResult split_command(const json& args)
op.keep_z = args.at("keep_z").get<bool>();
const Ops::Outcome<Targets> made = Ops::split_object(op);
if (!made)
return asks && std::string(made.refusal().code) == "one_piece" ? quiet_refusal(made.refusal()) : row_info(made.refusal());
return asks && std::string(made.refusal().code) == "one_piece" ? quiet_refusal(made.refusal()) : menu_info(made.refusal());
json reply = targets_reply(plater.model(), made.value());
reply["object_count"] = plater.model().objects.size();
return row_reply(reply);
return menu_reply(reply);
}
// object_assemble: the objects the call names, else the object and instance rows selected in the object list, which
// the Assemble row merged. The row told a selection of fewer than two, or of parts, as information, and a cut object as
// the Assemble menu item merged. The menu item told a selection of fewer than two, or of parts, as information, and a cut object as
// an error.
AppActionRunResult assemble_command(const json& args)
{
@@ -1322,22 +1322,24 @@ AppActionRunResult assemble_command(const json& args)
const Ops::Outcome<Targets> found = names_targets(args) ? resolve_targets(model, nullptr, args, kObjects | kInstances, false) :
listed_rows(itObject | itInstance);
if (!found)
return row_info(std::string(found.refusal().code) == "wrong_selection" ? *Ops::assemble_refusal(model, Targets{}) : found.refusal());
return menu_info(std::string(found.refusal().code) == "wrong_selection" ? *Ops::assemble_refusal(model, Targets{}) :
found.refusal());
const Ops::Outcome<int> assembled = Ops::assemble_objects(found.value());
if (!assembled)
return std::string(assembled.refusal().code) == "too_few_objects" ? row_info(assembled.refusal()) : row_refused(assembled.refusal());
return std::string(assembled.refusal().code) == "too_few_objects" ? menu_info(assembled.refusal()) :
menu_refused(assembled.refusal());
const int index = assembled.value();
Targets made;
made.objects = {index};
json reply = targets_reply(model, made);
reply["object"] = index;
reply["name"] = model.objects[std::size_t(index)]->name;
return row_reply(reply);
return menu_reply(reply);
}
// part_change_type: the parts the call names, else the part rows selected in the object list, which the Change Type
// rows changed. The row told a selection of anything but parts as information, in its own words, and why a part keeps
// its type as an error.
// menu items changed. The menu item told a selection of anything but parts as information, in its own words, and why a
// part keeps its type as an error.
AppActionRunResult part_type_command(const json& args)
{
std::optional<ModelVolumeType> subtype;
@@ -1347,16 +1349,16 @@ AppActionRunResult part_type_command(const json& args)
const Ops::Outcome<Targets> found = names_targets(args) ? resolve_targets(plater.model(), nullptr, args, kParts, false) :
listed_rows(itVolume);
if (!found)
return row_info(std::string(found.refusal().code) == "wrong_selection" ? Ops::part_wrong_selection() : found.refusal());
return menu_info(std::string(found.refusal().code) == "wrong_selection" ? Ops::part_wrong_selection() : found.refusal());
const Ops::Outcome<Targets> changed = Ops::change_part_type({found.value(), volume_type_from_name(arg_string(args, "type")), subtype});
if (!changed)
return row_refused(changed.refusal());
return menu_refused(changed.refusal());
json reply = targets_reply(plater.model(), changed.value());
for (json& part : reply["parts"]) {
const ModelVolume& volume = *plater.model().objects[part["object"].get<std::size_t>()]->volumes[part["part"].get<std::size_t>()];
part["type"] = volume_type_name(volume.type());
}
return row_reply(reply);
return menu_reply(reply);
}
// object_order's arguments, checked before the call reads the app: by, or the objects in order, which names one plate's.
@@ -1394,7 +1396,7 @@ json plate_objects(int sorted, bool all)
// object_order: the current plate, the plate the call names, or every plate with all. Its tile's call ({by}) shows
// the Prepare view and reverses an order the objects already have, as the plate menu's Order By does; any other call
// with by is ascending unless descending says otherwise. With order, the plate's objects go in that order, as drags in
// the object list put them. The row told a plate with no objects as information.
// the object list put them. The menu item told a plate with no objects as information.
AppActionRunResult order_command(const json& args)
{
if (const auto order = args.find("order"); order != args.end()) {
@@ -1404,9 +1406,9 @@ AppActionRunResult order_command(const json& args)
op.plate = arg_int(args, "plate", 0);
const Ops::Outcome<std::vector<int>> ordered = Ops::reorder_objects(op);
if (!ordered)
return row_refused(ordered.refusal());
return menu_refused(ordered.refusal());
const int plate = op.plate.value_or(ui_plater().get_partplate_list().get_curr_plate_index());
return row_reply({{"order", plate_objects(plate, false)}});
return menu_reply({{"order", plate_objects(plate, false)}});
}
const std::string by = arg_string(args, "by");
const bool all = arg_bool(args, "all", false);
@@ -1426,30 +1428,31 @@ AppActionRunResult order_command(const json& args)
op.descending = arg_bool(args, "descending", false);
const Ops::Outcome<bool> ordered = Ops::order_objects(op);
if (!ordered)
return std::string(ordered.refusal().code) == "no_objects_to_order" ? row_info(ordered.refusal()) : row_refused(ordered.refusal());
return std::string(ordered.refusal().code) == "no_objects_to_order" ? menu_info(ordered.refusal()) :
menu_refused(ordered.refusal());
// The sorted plates' objects in their new order.
const int sorted = op.plate.value_or(ui_plater().get_partplate_list().get_curr_plate_index());
return row_reply({{"order", plate_objects(sorted, all)}, {"descending", ordered.value()}});
return menu_reply({{"order", plate_objects(sorted, all)}, {"descending", ordered.value()}});
}
// object_mirror: the objects and parts the call names, else the selection, which Mirror takes of one instance or parts
// of one. The row told every refusal as information.
// of one. The menu item told every refusal as information.
AppActionRunResult mirror_command(const json& args)
{
const std::string axis = arg_string(args, "axis");
Plater& plater = ui_plater();
const Ops::Outcome<Targets> found = resolve_targets(plater.model(), prepare_selection(args), args, kEveryTarget, false);
if (!found)
return row_info(found.refusal());
return menu_info(found.refusal());
const Ops::Outcome<Ops::Done> mirrored = Ops::mirror_objects({found.value(), axis == "x" ? Axis::X : axis == "y" ? Axis::Y : Axis::Z});
if (!mirrored)
return row_info(mirrored.refusal());
return row_reply(targets_reply(plater.model(), found.value()));
return menu_info(mirrored.refusal());
return menu_reply(targets_reply(plater.model(), found.value()));
}
// object_center: the objects the call names, else the selection; on the plate each stands on, or on plate. Its tile's
// call ({}) is Center on the selection. The row told a selection to make as information.
// call ({}) is Center on the selection. The menu item told a selection to make as information.
AppActionRunResult center_command(const json& args)
{
Plater& plater = ui_plater();
@@ -1458,32 +1461,32 @@ AppActionRunResult center_command(const json& args)
plate = arg_int(args, "plate", 0);
// Before the selection is read, so a plate the project lacks is named whatever is selected.
if (const int count = plater.get_partplate_list().get_plate_count(); *plate >= count)
return row_refused(Ops::no_such_plate(*plate, count));
return menu_refused(Ops::no_such_plate(*plate, count));
}
const Ops::Outcome<Targets> found = resolve_targets(plater.model(), prepare_selection(args), args, kEveryTarget, false);
if (!found)
return row_info(found.refusal());
return menu_info(found.refusal());
const Ops::Outcome<std::map<int, std::vector<int>>> centred = Ops::center_objects({found.value(), plate});
if (!centred)
return row_refused(centred.refusal());
return menu_refused(centred.refusal());
json reply = targets_reply(plater.model(), found.value());
json plates = json::array();
for (const auto& [on, objects] : centred.value())
plates.push_back({{"plate", on}, {"objects", objects}});
reply["plates"] = std::move(plates);
return row_reply(reply);
return menu_reply(reply);
}
// object_scale_to_fit: the objects the call names, else the objects and instances selected, as Scale to Fit Print Volume
// takes them. The row told every refusal as information.
// takes them. The menu item told every refusal as information.
AppActionRunResult scale_to_fit_command(const json& args)
{
Plater& plater = ui_plater();
const Ops::Outcome<Targets> found = resolve_targets(plater.model(), prepare_selection(args), args, kObjects | kInstances, false);
if (!found)
return row_info(found.refusal());
return menu_info(found.refusal());
if (const Ops::Outcome<Ops::Done> fitted = Ops::scale_to_fit(found.value()); !fitted)
return row_info(fitted.refusal());
return menu_info(fitted.refusal());
const Model& model = plater.model();
std::vector<std::pair<int, int>> instances = found.value().instances;
for (int object : found.value().objects)
@@ -1496,7 +1499,7 @@ AppActionRunResult scale_to_fit_command(const json& args)
{"scale", vec3(model.objects[std::size_t(object)]->instances[std::size_t(instance)]->get_scaling_factor())}});
json reply = targets_reply(model, found.value());
reply["scales"] = std::move(scales);
return row_reply(reply);
return menu_reply(reply);
}
// object_drop: the objects and parts the call names, else the selection. What already rests on the bed is no error: the
@@ -1506,15 +1509,15 @@ AppActionRunResult drop_command(const json& args)
Plater& plater = ui_plater();
const Ops::Outcome<Targets> found = resolve_targets(plater.model(), prepare_selection(args), args, kEveryTarget, false);
if (!found)
return row_info(found.refusal());
return menu_info(found.refusal());
const Ops::Outcome<bool> dropped = Ops::drop_objects(found.value());
if (!dropped)
return row_info(dropped.refusal());
return menu_info(dropped.refusal());
json reply = targets_reply(plater.model(), found.value());
reply["moved"] = dropped.value();
if (dropped.value())
return row_reply(reply);
AppActionRunResult resting = row_info(Ops::already_on_bed());
return menu_reply(reply);
AppActionRunResult resting = menu_info(Ops::already_on_bed());
resting.done = true;
resting.reply = reply.dump();
return resting;
@@ -1603,7 +1606,7 @@ AppActionRunResult add_primitive_command(const json& args)
const Ops::Outcome<int> added = Ops::add_primitive(op);
if (!added)
// The size dialog cancelled told the person nothing more is to come.
return op.ask && std::string(added.refusal().code) == "not_added" ? quiet_refusal(added.refusal()) : row_refused(added.refusal());
return op.ask && std::string(added.refusal().code) == "not_added" ? quiet_refusal(added.refusal()) : menu_refused(added.refusal());
const int index = added.value();
Targets made;
made.objects = {index};
@@ -1611,14 +1614,14 @@ AppActionRunResult add_primitive_command(const json& args)
reply["object"] = index;
reply["plate"] = instance_plate(plater.get_partplate_list(), index, 0);
reply["offset"] = vec3(plater.model().objects[std::size_t(index)]->instances.front()->get_offset());
return row_reply(reply);
return menu_reply(reply);
}
// The object and part commands made from menu rows: each acts on the targets it is given or, given none, on what is
// selected in the Prepare view, as a person's pick of the row does. Those of the object's and part's menus read their
// targets through resolve_targets() and run their operations; the handy models, Text and SVG run the row their
// variant argument names. Their tiles are the rows, under the rows' ids, titles, sections and icons.
void register_object_rows(CommandCatalog& catalog)
// The object and part commands made from menu items: each acts on the targets it is given or, given none, on what is
// selected in the Prepare view, as a person's pick of the item does. Those of the object's and part's menus read their
// targets through resolve_targets() and run their operations; the handy models, Text and SVG run the menu item their
// variant argument names. Their tiles are the menu items, under the items' ids, titles, sections and icons.
void register_object_menu_commands(CommandCatalog& catalog)
{
using NativeCommands::tile;
const char* const object_section = L("Object");
@@ -1637,7 +1640,7 @@ void register_object_rows(CommandCatalog& catalog)
(turns ? turned : std::string()));
};
// With shape alone the size dialog asks, as the tiles do; a size or silent skips it.
NativeCommand add_primitive = row_command(
NativeCommand add_primitive = menu_command(
"object_add_primitive", L("Add a primitive"),
"Add a primitive shape (cube, cylinder, sphere, cone, disc or torus) as a new object, as Add Primitive does: on the "
"current plate, or on plate, which becomes the current one; at position, in the bed coordinates object_list and "
@@ -1681,7 +1684,7 @@ void register_object_rows(CommandCatalog& catalog)
handy_tiles.push_back(tile("add_handy_" + models.back(), model.label, L("Add Handy models"), "", {{"model", model.key}},
description));
}
catalog.add(row_command(
catalog.add(menu_command(
"object_add_handy_model", L("Add a handy model"),
"Add one of the test models OrcaSlicer ships to the current plate, as Add Handy models does; orca_cube and "
"orcasliced_combo, of several files, then arrange the objects as the toolbar's Arrange does, which moves the others too.",
@@ -1689,28 +1692,28 @@ void register_object_rows(CommandCatalog& catalog)
const std::string model = arg_string(args, "model");
const std::vector<MenuFactory::HandyModel>& all = MenuFactory::handy_models();
const auto it = std::find_if(all.begin(), all.end(), [&model](const MenuFactory::HandyModel& m) { return model == m.key; });
return Rows::add_handy(std::size_t(it - all.begin()));
return MenuItems::add_handy(std::size_t(it - all.begin()));
}));
const std::string text = "Add a text: a part on the selected object, or a new object when nothing is selected. It is created "
"in the background (app_wait {for: \"idle\"} waits for it), and the Text gizmo opens on it.";
catalog.add(row_command("object_add_text", L("Text"), text, object_schema({}),
catalog.add(menu_command("object_add_text", L("Text"), text, object_schema({}),
json::array({tile("add_primitive_text", L("Text"), L("Add Primitive"), "menu_obj_text", json::object(), text)}),
[](const json&) { return Rows::add_primitive_text(); }));
[](const json&) { return MenuItems::add_primitive_text(); }));
catalog.add(row_command(
catalog.add(menu_command(
"object_add_svg", L("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 (app_wait {for: \"idle\"} waits for it), and the SVG gizmo opens on it.",
object_schema({{"path", Rows::input_file("an .svg file")}}),
object_schema({{"path", MenuItems::input_file("an .svg file")}}),
json::array({tile("add_primitive_svg", L("SVG"), L("Add Primitive"), "menu_obj_svg", json::object(),
"Add an SVG as a new object, or as a part of the selected object, from the file a dialog asks for; "
"object_add_svg with a path uses that file without one. The part is created in the background "
"(app_wait {for: \"idle\"} waits for it), and the SVG gizmo opens on it.")}),
[](const json& args) { return Rows::add_primitive_svg(args); }));
[](const json& args) { return MenuItems::add_primitive_svg(args); }));
// ---- Object ---- (the object's context menu and the Edit menu)
NativeCommand del = row_command(
NativeCommand del = menu_command(
"object_delete", L("Delete objects"),
"Delete objects, instances or parts, as Delete does: those named (objects, instances, parts), what stands on a plate "
"(plate: its objects, or the instances on it of an object on two plates), every object (all, as Delete All does), or "
@@ -1731,7 +1734,7 @@ void register_object_rows(CommandCatalog& catalog)
catalog.add(reaching({"delete_objects"}, with_expected_ids(std::move(del))));
// The Rename dialog's name, which every call but the tile's gives.
NativeCommand rename = row_command(
NativeCommand rename = menu_command(
"object_rename", L("Rename"),
"Rename an object, or a part of it (object and part), or with neither the object or part selected in the Prepare "
"view. With a name, skips the Rename dialog; an empty name, or one with characters a file name cannot hold, is "
@@ -1744,7 +1747,7 @@ void register_object_rows(CommandCatalog& catalog)
catalog.add(reaching({"rename_object"}, with_expected_ids(std::move(rename))));
// The count the dialog asks for, which every call but the tiles' gives; delta is the toolbar's + and -.
NativeCommand instances = row_command(
NativeCommand instances = menu_command(
"object_set_instances", L("Set the number of instances"),
"Give an object this many instances (count), as Set Number of Instances does, or one more or one fewer (delta 1 "
"or -1), as the toolbar's + and - do: the object named, else the one selected in the Prepare view, or the object "
@@ -1774,7 +1777,7 @@ void register_object_rows(CommandCatalog& catalog)
"tile's arguments, does what a person's pick of that tile does.";
catalog.add(reaching({"set_instance_count"}, with_expected_ids(std::move(instances))));
NativeCommand separate = row_command(
NativeCommand separate = menu_command(
"object_separate_instances", L("Set as Individual Objects"),
"Make each instance of an object a separate object (object), or some instances of one object one new object "
"(instances), as Set as Individual Objects does; with neither, what is selected in the Prepare view: an object, or "
@@ -1789,7 +1792,7 @@ void register_object_rows(CommandCatalog& catalog)
catalog.add(reaching({"separate_instances"}, with_expected_ids(std::move(separate))));
// The answer to Split's Auto-Drop question, which every call but the tiles' gives where the split asks it.
NativeCommand split = row_command(
NativeCommand split = menu_command(
"object_split", L("Split an object"),
"Split an object into separate objects, or into parts of it, as Split > To Objects and To Parts do: the object named, "
"else the one row selected in the object list, as Split reads it: an object's row, into objects also a row of the "
@@ -1816,7 +1819,7 @@ void register_object_rows(CommandCatalog& catalog)
catalog.add(reaching(
{"assemble_objects"},
with_expected_ids(row_command(
with_expected_ids(menu_command(
"object_assemble", L("Assemble"),
"Assemble two or more objects into one object of parts named Assembly, as Assemble does: those named, else the "
"object and instance rows selected in the object list, an instance becoming an object of its own first. Cut objects "
@@ -1829,7 +1832,7 @@ void register_object_rows(CommandCatalog& catalog)
assemble_command))));
// The plate menu's Order By.
struct OrderRow
struct OrderMenuItem
{
const char* key;
const char* title;
@@ -1837,22 +1840,22 @@ void register_object_rows(CommandCatalog& catalog)
const char* what;
};
// Titles are L("...")-marked here so xgettext extracts them.
static const OrderRow order_rows[] = {
static const OrderMenuItem order_menu_items[] = {
{"obj_order_by_name", L("Order by Name"), "name", "name"},
{"obj_order_by_filament", L("Order by Filament"), "filament", "filament"},
{"obj_order_by_height", L("Order by Height"), "height", "height"},
{"obj_order_by_size", L("Order by Size"), "size", "size (bounding box volume)"},
};
json order_tiles = json::array();
for (const OrderRow& row : order_rows)
order_tiles.push_back(tile(row.key, row.title, object_section, "", {{"by", row.by}},
std::string("Order the current plate's objects by ") + row.what +
for (const OrderMenuItem& item : order_menu_items)
order_tiles.push_back(tile(item.key, item.title, object_section, "", {{"by", item.by}},
std::string("Order the current plate's objects by ") + item.what +
", 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."));
NativeCommand order = reaching(
{"order_objects", "reorder_objects"},
row_command("object_order", L("Order objects"),
menu_command("object_order", L("Order objects"),
"Order the objects of a plate (the current one, or plate), or with all of every plate, by name, filament, "
"height or size (bounding box volume), which sets the object list and print order, as the plate menu's "
"Order By does: ascending, or with descending true descending. Called with by alone, as its tiles, it shows "
@@ -1880,7 +1883,7 @@ void register_object_rows(CommandCatalog& catalog)
catalog.add(reaching(
{"drop_objects"},
with_expected_ids(row_command(
with_expected_ids(menu_command(
"object_drop", L("Drop to Bed"),
"Drop objects or parts onto the bed, as Drop does: those named, each instance and each part that does not rest on "
"the bed dropped on its own, else what is selected in the Prepare view, dropped as one by its lowest point. What "
@@ -1892,7 +1895,7 @@ void register_object_rows(CommandCatalog& catalog)
catalog.add(reaching(
{"mirror_objects"},
with_expected_ids(row_command(
with_expected_ids(menu_command(
"object_mirror", L("Mirror objects"),
"Mirror objects or parts along an axis, as Mirror > Along X Axis, Y Axis and Z Axis do: those named, each instance "
"of an object and the parts of each object in turn, else what is selected in the Prepare view, which Mirror takes "
@@ -1906,7 +1909,7 @@ void register_object_rows(CommandCatalog& catalog)
catalog.add(reaching(
{"center_objects"},
with_expected_ids(row_command(
with_expected_ids(menu_command(
"object_center", L("Center Selected on Plate"),
"Centre objects on their plate, as Center does: those named, each plate's as one group on the plate it stands on (an "
"object on no plate goes with the current plate's), or all on plate; with none named, what is selected in the "
@@ -1921,7 +1924,7 @@ void register_object_rows(CommandCatalog& catalog)
catalog.add(reaching(
{"scale_to_fit"},
with_expected_ids(row_command(
with_expected_ids(menu_command(
"object_scale_to_fit", L("Scale to Fit Print Volume"),
"Scale objects as one to fit the current plate's print volume and move them into it, as Scale to build volume does: "
"those named, else the objects and instances selected in the Prepare view. Cut objects and a bed of another shape "
@@ -1983,7 +1986,7 @@ void register_object_rows(CommandCatalog& catalog)
// A person's pick of the tile starts the orientation in place and returns while it runs; an automated call of the
// tile's arguments is the command's own function, which waits and replies. Both are orient_objects() on the same
// targets.
catalog.add(NativeCommands::with_row_forms(
catalog.add(NativeCommands::with_menu_item_forms(
std::move(orient),
[](const json&) {
Plater* plater = wxGetApp().plater();
@@ -1991,15 +1994,15 @@ void register_object_rows(CommandCatalog& catalog)
return AppActionRunResult{};
const Ops::Outcome<Ops::OrientObjectsArgs> found = orient_args(*plater, json::object());
if (!found)
return row_info(found.refusal());
return menu_info(found.refusal());
if (const Ops::Outcome<Ops::Done> started = Ops::orient_objects(found.value()); !started)
return row_info(started.refusal());
return menu_info(started.refusal());
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
},
/*person_form_behind_dialogs=*/false, std::vector<json>{json::object()}));
// ---- Parts ---- (Change Type, in the part menus only)
struct TypeRow
struct TypeMenuItem
{
const char* key;
const char* title;
@@ -2007,7 +2010,7 @@ void register_object_rows(CommandCatalog& catalog)
const char* description;
};
// Titles are L("...")-marked here so xgettext extracts them.
const TypeRow type_rows[] = {
const TypeMenuItem type_menu_items[] = {
{"obj_type_part", L("Change Type to Part"), "part",
"Make the selected parts (object_select {parts} first) solid parts, as Change Type does. Parts are listed by type, so "
"part indices change."},
@@ -2028,11 +2031,11 @@ void register_object_rows(CommandCatalog& catalog)
"solid part, nor a text or SVG part. Parts are listed by type, so part indices change."},
};
json type_tiles = json::array();
for (const TypeRow& row : type_rows)
type_tiles.push_back(tile(row.key, row.title, object_section, "", {{"type", row.type}}, row.description));
for (const TypeMenuItem& item : type_menu_items)
type_tiles.push_back(tile(item.key, item.title, object_section, "", {{"type", item.type}}, item.description));
catalog.add(reaching(
{"change_part_type"},
with_expected_ids(row_command(
with_expected_ids(menu_command(
"part_change_type", L("Change a part's type"),
"Change what parts are, as Change Type does: those named, else the part rows selected in the object list. type is "
"part, negative, modifier, support_blocker, support_enforcer, or precise_seam, a Center precise seam where a seam "
@@ -2502,11 +2505,11 @@ void register_scene_tools(CommandCatalog& catalog)
"Clear the selection in the 3D view (the assemble view while it is shown, "
"else Prepare, switching to it), close the open gizmo, and reply with the "
"selection. A person's pick clears it where it is, switching no tab.")});
// A person's pick runs in place, as its row did: Select All shows Prepare and select_everything() selects there,
// A person's pick runs in place, as its menu item did: Select All shows Prepare and select_everything() selects there,
// Deselect All is clear_selection() on the view shown, switching no tab. An automated call of either tile's
// arguments is object_select's own function, which the two functions serve too, on the view shown, and replies
// with the selection.
catalog.add(NativeCommands::with_row_forms(
catalog.add(NativeCommands::with_menu_item_forms(
std::move(select),
[](const json& tile_args) {
Plater* plater = wxGetApp().plater();
@@ -2622,7 +2625,7 @@ void register_scene_tools(CommandCatalog& catalog)
return ToolResult::ok(out);
})));
register_object_rows(catalog);
register_object_menu_commands(catalog);
register_object_tools(catalog);
NativeCommand arrange = reaching({"start_arrange"}, mutate_tool(
@@ -2682,8 +2685,8 @@ void register_scene_tools(CommandCatalog& catalog)
// A person's pick starts the arrangement in place as the toolbar does, and returns while it runs; an automated call
// of the tile's arguments is object_arrange's own function, which waits and replies. Both are Ops::start_arrange()
// on every unlocked plate with the panel's settings.
catalog.add(NativeCommands::with_row_forms(
std::move(arrange), [](const json&) { return Rows::obj_arrange(); }, /*person_form_behind_dialogs=*/false,
catalog.add(NativeCommands::with_menu_item_forms(
std::move(arrange), [](const json&) { return MenuItems::obj_arrange(); }, /*person_form_behind_dialogs=*/false,
std::vector<json>{json::object()}));
NativeCommand slice = reaching({"start_slice"}, mutate_tool(
+35 -30
View File
@@ -1,5 +1,5 @@
// window_screenshot, plate_slice_stats and view_set: what the agent looks at and reads off the Preview, and
// pointing the view before looking; and the window commands made from menu rows, window_open and
// pointing the view before looking; and the window commands made from menu items, window_open and
// window_save_screenshot.
#include "libvgcode/include/ColorRange.hpp"
@@ -23,7 +23,7 @@
#include "slic3r/GUI/IMSlider.hpp"
#include "slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "slic3r/GUI/NativeCommandRows.hpp"
#include "slic3r/GUI/NativeCommandMenuItems.hpp"
#include "slic3r/GUI/NativeCommands.hpp"
#include "slic3r/GUI/Notebook.hpp"
#include "slic3r/GUI/Operations/Outcome.hpp"
@@ -425,7 +425,7 @@ Ops::Outcome<Ops::ShownLayers> show_layer_percent(double percent)
return Ops::show_layer_range(range);
}
// A person's pick of one of view_set's tiles, in place on the UI thread as its row ran: for each argument the function
// A person's pick of one of view_set's tiles, in place on the UI thread as its menu item ran: for each argument the function
// a call's UI closure runs, and a refusal in the UI's language, Go to tab's as an error and the others, which say that
// the view has nothing to show it, as information.
AppActionRunResult picked_view(const json& tile_args)
@@ -435,9 +435,9 @@ AppActionRunResult picked_view(const json& tile_args)
if (plater == nullptr || frame == nullptr)
return AppActionRunResult{};
if (tile_args.contains("layout"))
return Rows::reset_window_layout();
return MenuItems::reset_window_layout();
if (tile_args.contains("projection"))
return Rows::toggle_perspective();
return MenuItems::toggle_perspective();
if (tile_args.contains("tab")) {
if (const std::optional<Ops::Refusal> refusal = show_tab(*frame, arg_string(tile_args, "tab")))
return NativeCommands::refused(*refusal);
@@ -1264,29 +1264,33 @@ void register_view_tools(CommandCatalog& catalog)
}));
return ToolResult::ok(out);
}));
// The View menu's rows and the Speed Dial's Go to tab and Go to layer, whose value its second phase collects. Titles
// The View menu's items and the Speed Dial's Go to tab and Go to layer, whose value its second phase collects. Titles
// are L("...")-marked here so xgettext extracts them.
struct CameraRow
struct CameraMenuItem
{
const char* key;
const char* title;
const char* camera;
};
static const CameraRow camera_rows[] = {{"view_top", L("View: Top"), "top"}, {"view_bottom", L("View: Bottom"), "bottom"},
{"view_front", L("View: Front"), "front"}, {"view_rear", L("View: Rear"), "rear"},
{"view_left", L("View: Left"), "left"}, {"view_right", L("View: Right"), "right"},
{"view_iso", L("View: Isometric"), "iso"}, {"view_default", L("View: Default"), "default"},
{"view_fit_bed", L("Fit Bed to View"), "fit_bed"}};
static const CameraMenuItem camera_menu_items[] = {{"view_top", L("View: Top"), "top"},
{"view_bottom", L("View: Bottom"), "bottom"},
{"view_front", L("View: Front"), "front"},
{"view_rear", L("View: Rear"), "rear"},
{"view_left", L("View: Left"), "left"},
{"view_right", L("View: Right"), "right"},
{"view_iso", L("View: Isometric"), "iso"},
{"view_default", L("View: Default"), "default"},
{"view_fit_bed", L("Fit Bed to View"), "fit_bed"}};
view.tiles = json::array();
std::vector<json> camera_forms;
for (const CameraRow& row : camera_rows) {
const std::string camera = row.camera;
for (const CameraMenuItem& item : camera_menu_items) {
const std::string camera = item.camera;
std::string does = "Turn the camera of the view shown, the Design tab's too, to the " + camera + " view.";
if (camera == "default")
does = "Turn the camera of the view shown to the default view and fit the plate; on the Design tab, its Home view.";
else if (camera == "fit_bed")
does = "Fit the build plate in the 3D view shown; refused on the Design tab, which has no bed to fit.";
view.tiles.push_back(NativeCommands::tile(row.key, row.title, L("View"), "", {{"camera", camera}}, does));
view.tiles.push_back(NativeCommands::tile(item.key, item.title, L("View"), "", {{"camera", camera}}, does));
camera_forms.push_back({{"camera", camera}});
}
view.tiles.push_back(NativeCommands::tile("view_toggle_perspective", L("Toggle Perspective"), L("View"), "", {{"projection", "toggle"}},
@@ -1301,14 +1305,14 @@ void register_view_tools(CommandCatalog& catalog)
"while the Preview has no layers (slice first).",
"percent", "layer_percent"));
// A person's pick of any of these tiles runs in place (picked_view()): Toggle Perspective and Reset Window Layout
// their rows, the camera tiles, Go to tab and Go to layer the camera, tab and layer functions view_set's UI closure
// their menu items, the camera tiles, Go to tab and Go to layer the camera, tab and layer functions view_set's UI closure
// runs for a call, so a camera tile turns the Design tab's camera too. An automated call of a camera tile, Go to tab
// or Go to layer is view_set's own function.
catalog.add(NativeCommands::with_row_forms(std::move(view), picked_view, /*person_form_behind_dialogs=*/false,
catalog.add(NativeCommands::with_menu_item_forms(std::move(view), picked_view, /*person_form_behind_dialogs=*/false,
std::move(camera_forms)));
// ---- The window commands made from menu rows ----
struct WindowRow
// ---- The window commands made from menu items ----
struct WindowMenuItem
{
const char* key;
const char* title;
@@ -1318,7 +1322,7 @@ void register_view_tools(CommandCatalog& catalog)
const char* description;
};
// Titles are L("...")-marked here so xgettext extracts them.
static const WindowRow window_rows[] = {
static const WindowMenuItem window_menu_items[] = {
{"open_preferences", L("Preferences"), L("Commands"), "cog", "preferences",
"Open the Preferences dialog. window_open with a tab, and a key on it, opens it on that tab with that preference's "
"control scrolled into view and focused (shown on its own tab)."},
@@ -1336,13 +1340,14 @@ void register_view_tools(CommandCatalog& catalog)
};
std::vector<std::string> windows;
json window_tiles = json::array();
for (const WindowRow& row : window_rows) {
windows.emplace_back(row.window);
window_tiles.push_back(NativeCommands::tile(row.key, row.title, row.group, row.icon, {{"window", row.window}}, row.description));
for (const WindowMenuItem& item : window_menu_items) {
windows.emplace_back(item.window);
window_tiles.push_back(
NativeCommands::tile(item.key, item.title, item.group, item.icon, {{"window", item.window}}, item.description));
}
catalog.add(row_command(
catalog.add(menu_command(
"window_open", L("Open a window"),
"Open one of OrcaSlicer's windows or dialogs for a person, as its menu row does: preferences, the Preferences dialog, "
"Open one of OrcaSlicer's windows or dialogs for a person, as its menu item does: preferences, the Preferences dialog, "
"with tab, and key on it, on that tab with that preference's control scrolled into view and focused (its controls are "
"named after their preference keys: preferences_get reads them and preferences_set writes those it does not refuse, "
"and widget_set_value {\"target\": {\"name\": key, \"within\": \"Preferences\"}} changes one through the "
@@ -1351,7 +1356,7 @@ void register_view_tools(CommandCatalog& catalog)
"bundle manager; keyboard_shortcuts; setup_wizard; network_test; troubleshoot, the troubleshooting center; "
"tip_of_the_day; about. A modal one replies blocked_by_dialog.",
object_schema({{"window", enum_prop(windows, "The window.")},
{"tab", enum_prop(Rows::preferences_tabs(), "preferences: the tab to show.")},
{"tab", enum_prop(MenuItems::preferences_tabs(), "preferences: the tab to show.")},
{"key", prop("string", "preferences, with tab: a preference on that tab, e.g. auto_arrange on behaviour: "
"its control is scrolled into view and focused.")}},
{"window"}),
@@ -1361,17 +1366,17 @@ void register_view_tools(CommandCatalog& catalog)
return AppActionRunResult{AppActionRunResult::Level::Error, from_u8("tab and key go with window preferences"), false};
json preferences = args;
preferences.erase("window");
return Rows::open_window(window, preferences);
return MenuItems::open_window(window, preferences);
}));
const std::string saved = "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 window_screenshot tool, which returns the image.";
NativeCommand save_screenshot = row_command("window_save_screenshot", L("Take Screenshot"), saved, object_schema({}),
NativeCommand save_screenshot = menu_command("window_save_screenshot", L("Take Screenshot"), saved, object_schema({}),
json::array({NativeCommands::tile("take_screenshot", L("Take Screenshot"),
L("Commands"), "screenshot", json::object(), saved)}),
[](const json&) { return Rows::take_screenshot(); });
// A menu row with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it.
[](const json&) { return MenuItems::take_screenshot(); });
// A menu item with no argument form: tool_search finds it and tool_call runs it, the tool list does not show it.
save_screenshot.listed = false;
catalog.add(std::move(save_screenshot));
}
@@ -13,13 +13,13 @@ namespace GUI {
enum class CalibKind : int;
// The functions of the Speed Dial's menu rows that are tiles of a command: each does what its row does, as a
// person's pick of the row does it: on what is selected in the Prepare view, on the current plate, or on the app and
// its windows. A command made from rows calls the function of the row its variant argument names, and a typed tool
// calls one when a call's arguments are that row's tile's (Mcp::person_form()), or, where the row does what the tool
// does (Auto-Arrange), for a person's pick of the tile alone (NativeCommands::with_row_forms()). They are defined in
// NativeCommands.cpp, beside the helpers the rows share. UI thread.
namespace Rows {
// The functions of the Speed Dial's menu items that are tiles of a command: each does what its item does, as a
// person's pick of the item does it: on what is selected in the Prepare view, on the current plate, or on the app and
// its windows. A command made from menu items calls the function of the menu item its variant argument names, and a typed tool
// calls one when a call's arguments are that item's tile's (Mcp::person_form()), or, where the item does what the tool
// does (Auto-Arrange), for a person's pick of the tile alone (NativeCommands::with_menu_item_forms()). They are defined in
// NativeCommands.cpp, beside the helpers the menu items share. UI thread.
namespace MenuItems {
// ---- The project ----
AppActionRunResult load_project();
@@ -101,7 +101,7 @@ AppActionRunResult toggle_run_script_panel();
// of `what`.
nlohmann::json input_file(const char* what);
} // namespace Rows
} // namespace MenuItems
} // namespace GUI
} // namespace Slic3r
+48 -48
View File
@@ -1,5 +1,5 @@
#include "NativeCommands.hpp"
#include "NativeCommandRows.hpp"
#include "NativeCommandMenuItems.hpp"
#include "ActionIds.hpp"
#include "calib_dlg.hpp"
@@ -460,11 +460,11 @@ constexpr std::pair<const char*, PreferencesTab> kPreferencesTabs[] = {{"general
} // namespace
// ---- The rows that are tiles of a command (NativeCommandRows.hpp) ----
// ---- The menu items that are tiles of a command (NativeCommandMenuItems.hpp) ----
json Rows::input_file(const char* what) { return Mcp::prop("string", std::string("Absolute path of ") + what + "."); }
json MenuItems::input_file(const char* what) { return Mcp::prop("string", std::string("Absolute path of ") + what + "."); }
AppActionRunResult Rows::load_project()
AppActionRunResult MenuItems::load_project()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -473,7 +473,7 @@ AppActionRunResult Rows::load_project()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::save_project_as()
AppActionRunResult MenuItems::save_project_as()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -481,7 +481,7 @@ AppActionRunResult Rows::save_project_as()
return NativeCommands::project_save_result(plater->save_project(true));
}
AppActionRunResult Rows::export_gcode()
AppActionRunResult MenuItems::export_gcode()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -490,7 +490,7 @@ AppActionRunResult Rows::export_gcode()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::export_stl()
AppActionRunResult MenuItems::export_stl()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -499,7 +499,7 @@ AppActionRunResult Rows::export_stl()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::export_3mf()
AppActionRunResult MenuItems::export_3mf()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -508,7 +508,7 @@ AppActionRunResult Rows::export_3mf()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::export_sliced_file(bool all_plates)
AppActionRunResult MenuItems::export_sliced_file(bool all_plates)
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -517,13 +517,13 @@ AppActionRunResult Rows::export_sliced_file(bool all_plates)
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::calib(CalibKind kind) { return calib_command(kind); }
AppActionRunResult MenuItems::calib(CalibKind kind) { return calib_command(kind); }
// ---- Object ----
AppActionRunResult Rows::obj_arrange() { return arrange_all(wxGetApp().plater()); }
AppActionRunResult MenuItems::obj_arrange() { return arrange_all(wxGetApp().plater()); }
// ---- Add Primitive ---- (the Add > Add Primitive submenu's Text and SVG)
AppActionRunResult Rows::add_primitive_text()
AppActionRunResult MenuItems::add_primitive_text()
{
Plater* plater = wxGetApp().plater();
if (plater) {
@@ -535,7 +535,7 @@ AppActionRunResult Rows::add_primitive_text()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::add_primitive_svg(const json& args)
AppActionRunResult MenuItems::add_primitive_svg(const json& args)
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -561,7 +561,7 @@ AppActionRunResult Rows::add_primitive_svg(const json& args)
}
// ---- Add Handy models ---- (the Add > Add Handy models submenu)
AppActionRunResult Rows::add_handy(std::size_t index)
AppActionRunResult MenuItems::add_handy(std::size_t index)
{
if (Plater* plater = wxGetApp().plater())
ensure_3d_view(plater);
@@ -570,7 +570,7 @@ AppActionRunResult Rows::add_handy(std::size_t index)
}
// ---- Plate ----
AppActionRunResult Rows::plate_add()
AppActionRunResult MenuItems::plate_add()
{
Plater* plater = wxGetApp().plater();
if (!is_fff_plater(plater))
@@ -582,7 +582,7 @@ AppActionRunResult Rows::plate_add()
}
// ---- Import ----
AppActionRunResult Rows::import_file()
AppActionRunResult MenuItems::import_file()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -595,7 +595,7 @@ AppActionRunResult Rows::import_file()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::import_zip_archive()
AppActionRunResult MenuItems::import_zip_archive()
{
if (Plater* plater = wxGetApp().plater())
plater->import_zip_archive();
@@ -603,7 +603,7 @@ AppActionRunResult Rows::import_zip_archive()
}
// ---- Export extras ----
AppActionRunResult Rows::export_stl_multi()
AppActionRunResult MenuItems::export_stl_multi()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -614,14 +614,14 @@ AppActionRunResult Rows::export_stl_multi()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::export_drc_single()
AppActionRunResult MenuItems::export_drc_single()
{
if (Plater* plater = wxGetApp().plater())
plater->export_stl(false, false, false, FT_DRC);
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::export_drc_multi()
AppActionRunResult MenuItems::export_drc_multi()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -632,7 +632,7 @@ AppActionRunResult Rows::export_drc_multi()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::export_toolpaths_obj()
AppActionRunResult MenuItems::export_toolpaths_obj()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -644,7 +644,7 @@ AppActionRunResult Rows::export_toolpaths_obj()
}
// ---- Presets and settings ----
AppActionRunResult Rows::import_configs(const json& args)
AppActionRunResult MenuItems::import_configs(const json& args)
{
MainFrame* mf = wxGetApp().mainframe;
if (mf == nullptr)
@@ -671,7 +671,7 @@ AppActionRunResult Rows::import_configs(const json& args)
"Not a preset file: give a .json, .zip, .orca_printer, .orca_filament, .orca_bundle or .gcode"};
}
AppActionRunResult Rows::export_config(const json& args)
AppActionRunResult MenuItems::export_config(const json& args)
{
if (Mcp::person_form(args)) {
if (MainFrame* mf = wxGetApp().mainframe)
@@ -689,13 +689,13 @@ AppActionRunResult Rows::export_config(const json& args)
return AppActionRunResult{AppActionRunResult::Level::Succeeded, from_path(*dir)};
}
AppActionRunResult Rows::migrate_filament_presets()
AppActionRunResult MenuItems::migrate_filament_presets()
{
wxGetApp().check_legacy_user_filament_presets(true);
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::set_mode(const std::string& mode)
AppActionRunResult MenuItems::set_mode(const std::string& mode)
{
static const std::pair<const char*, ConfigOptionMode> modes[] = {{"simple", comSimple}, {"advanced", comAdvanced}, {"expert", comExpert}};
for (const auto& [name, value] : modes)
@@ -707,7 +707,7 @@ AppActionRunResult Rows::set_mode(const std::string& mode)
}
// What Preferences > Developer > Developer mode does: flip the flag, keep it, refresh the UI.
AppActionRunResult Rows::toggle_developer_mode()
AppActionRunResult MenuItems::toggle_developer_mode()
{
GUI_App& app = wxGetApp();
const bool on = !app.app_config->get_bool("developer_mode");
@@ -721,7 +721,7 @@ AppActionRunResult Rows::toggle_developer_mode()
// The Design tab's history is "design", else "project". Without args.history it is the shown tab's, as the Edit menu's
// Undo and Redo choose it. The reply says which history it was and, for the Design tab's, what Mcp::cad_undo_redo()
// replies.
AppActionRunResult Rows::undo_redo(const json& args, bool redo)
AppActionRunResult MenuItems::undo_redo(const json& args, bool redo)
{
std::string history = args.value("history", std::string());
if (history.empty()) {
@@ -744,7 +744,7 @@ AppActionRunResult Rows::undo_redo(const json& args, bool redo)
// Through the function the menu calls. It shows nothing: where the menu's item would be greyed it does nothing, and
// otherwise the Design tab's status line or the canvas shows what changed, as after the menu's.
AppActionRunResult Rows::picked_undo_redo(const json& args, bool redo)
AppActionRunResult MenuItems::picked_undo_redo(const json& args, bool redo)
{
const std::string history = args.value("history", std::string());
// What a pick that does nothing shows: nothing.
@@ -775,7 +775,7 @@ AppActionRunResult Rows::picked_undo_redo(const json& args, bool redo)
return project_undo_redo(redo, /*agent=*/false);
}
AppActionRunResult Rows::open_web_page(const std::string& page)
AppActionRunResult MenuItems::open_web_page(const std::string& page)
{
if (page == "wiki")
wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/", wxBROWSER_NEW_WINDOW);
@@ -788,40 +788,40 @@ AppActionRunResult Rows::open_web_page(const std::string& page)
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::check_for_updates()
AppActionRunResult MenuItems::check_for_updates()
{
wxGetApp().check_new_version_sf(true, 1);
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::show_config_folder()
AppActionRunResult MenuItems::show_config_folder()
{
Slic3r::GUI::desktop_open_datadir_folder();
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::benchmark_3d_scene()
AppActionRunResult MenuItems::benchmark_3d_scene()
{
run_scene_benchmark();
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
// ---- View and windows ----
AppActionRunResult Rows::toggle_perspective()
AppActionRunResult MenuItems::toggle_perspective()
{
if (Plater* plater = wxGetApp().plater())
plater->get_camera().select_next_type();
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::reset_window_layout()
AppActionRunResult MenuItems::reset_window_layout()
{
if (Plater* plater = wxGetApp().plater())
plater->reset_window_layout();
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
std::vector<std::string> Rows::preferences_tabs()
std::vector<std::string> MenuItems::preferences_tabs()
{
std::vector<std::string> names;
for (const auto& [name, tab] : kPreferencesTabs)
@@ -829,7 +829,7 @@ std::vector<std::string> Rows::preferences_tabs()
return names;
}
AppActionRunResult Rows::open_window(const std::string& window, const json& args)
AppActionRunResult MenuItems::open_window(const std::string& window, const json& args)
{
GUI_App& app = wxGetApp();
if (window == "preferences") {
@@ -875,7 +875,7 @@ AppActionRunResult Rows::open_window(const std::string& window, const json& args
}
// A PNG of the main window, saved where the person's recordings go, as the MCP screenshot tool's default.
AppActionRunResult Rows::take_screenshot()
AppActionRunResult MenuItems::take_screenshot()
{
MainFrame* mf = wxGetApp().mainframe;
if (mf == nullptr)
@@ -894,7 +894,7 @@ AppActionRunResult Rows::take_screenshot()
}
// ---- Filaments, printers and plugins ----
AppActionRunResult Rows::sync_ams()
AppActionRunResult MenuItems::sync_ams()
{
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
@@ -902,7 +902,7 @@ AppActionRunResult Rows::sync_ams()
const std::optional<Ops::Refusal> refusal = plater->sidebar().sync_ams_list();
if (!refusal)
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
// With no printer the row says so; otherwise the warning it showed said why.
// With no printer the menu item says so; otherwise the warning it showed said why.
if (std::string(refusal->code) == "no_printer")
return refused(*refusal, AppActionRunResult::Level::Info);
return Mcp::quiet_refusal(*refusal);
@@ -910,7 +910,7 @@ AppActionRunResult Rows::sync_ams()
// The Print button's send for a printer with a print host: the Send G-code dialog, then the upload queue. Where the
// button would not send to a print host, it says why instead of doing nothing.
AppActionRunResult Rows::send_gcode()
AppActionRunResult MenuItems::send_gcode()
{
if (wxGetApp().plater() == nullptr)
return AppActionRunResult{};
@@ -919,7 +919,7 @@ AppActionRunResult Rows::send_gcode()
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
AppActionRunResult Rows::install_local_plugin(const json& args)
AppActionRunResult MenuItems::install_local_plugin(const json& args)
{
MainFrame* mf = wxGetApp().mainframe;
if (mf == nullptr)
@@ -952,14 +952,14 @@ AppActionRunResult Rows::install_local_plugin(const json& args)
return AppActionRunResult{installed ? AppActionRunResult::Level::Succeeded : AppActionRunResult::Level::Error, message};
}
AppActionRunResult Rows::refresh_plugins()
AppActionRunResult MenuItems::refresh_plugins()
{
wxGetApp().refresh_plugins();
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
}
// ---- Scripts ----
AppActionRunResult Rows::toggle_run_script_panel()
AppActionRunResult MenuItems::toggle_run_script_panel()
{
if (wxGetApp().mainframe != nullptr)
wxGetApp().run_script_panel().toggle();
@@ -1001,7 +1001,7 @@ constexpr std::pair<const char*, const char*> kPlaceWords[] = {
{"replay", kRecordings}, {"script", kRecordings}};
// The commands grouped apart from their first word, looked up before it: a screenshot is a recording's still, so the
// agent's capture and the person's row are with the recordings, not with the windows.
// agent's capture and the person's menu item are with the recordings, not with the windows.
constexpr std::pair<const char*, const char*> kPlaceExceptions[] = {{"window_screenshot", kRecordings},
{"window_save_screenshot", kRecordings}};
@@ -1257,10 +1257,10 @@ NativeCommand NativeCommands::with_person_form(NativeCommand tool, std::function
bool person_form_behind_dialogs)
{
tool.input_schema = Mcp::with_silent(std::move(tool.input_schema), Mcp::person_forms(tool));
return with_row_forms(std::move(tool), std::move(person), person_form_behind_dialogs);
return with_menu_item_forms(std::move(tool), std::move(person), person_form_behind_dialogs);
}
NativeCommand NativeCommands::with_row_forms(NativeCommand tool, std::function<AppActionRunResult(const json& tile_args)> person,
NativeCommand NativeCommands::with_menu_item_forms(NativeCommand tool, std::function<AppActionRunResult(const json& tile_args)> person,
bool person_form_behind_dialogs, std::vector<json> own_forms)
{
// The tiles a call's arguments are matched against, kept apart from the tool this returns.
@@ -1278,8 +1278,8 @@ NativeCommand NativeCommands::with_row_forms(NativeCommand tool, std::function<A
tool.run = [key = tool.key, forms = std::move(forms), own_forms = std::move(own_forms), person = std::move(person), given, asks,
checked, silent = std::move(tool.run)](const json& args, ToolContext& ctx) {
const bool own = std::find(own_forms.begin(), own_forms.end(), given(args)) != own_forms.end();
// A person's pick of a tile whose row is the tool's own function, or of a tile that collects a value, runs that
// function in place, as a row does: no job.
// A person's pick of a tile whose menu item is the tool's own function, or of a tile that collects a value, runs that
// function in place, as a menu item does: no job.
if (ctx.person() && (own || tile_with_input(forms, args) != nullptr))
return asks(args, ctx);
if (own || !Mcp::person_form(forms, args))
+8 -8
View File
@@ -27,9 +27,9 @@ struct CatalogOptions
};
// Adds the built-in commands to `catalog`, family by family (Mcp::register_app_tools() and the others): the typed
// tools and the commands made from menu rows (Rows, NativeCommandRows.hpp), whose rows are their tiles, eight of them
// tools and the commands made from menu items (MenuItems, NativeCommandMenuItems.hpp), whose items are their tiles, eight of them
// with a tile of their own (in_palette). Each is in the group of its place (place_heading()) and is listed, as it runs
// from its arguments, but for the three rows that take none (window_save_screenshot, script_toggle_panel,
// from its arguments, but for the three menu items that take none (window_save_screenshot, script_toggle_panel,
// settings_toggle_developer_mode). They come in the order tools/list gives them: tool_search, tool_call and app_state,
// then place by place (Tools and actions, The app, The project, Objects, Parts, Plates and on), each place's commands
// in the order their families declare them, and Driving the GUI last. Before Driving the GUI, with options.cad, the Design tab's commands
@@ -56,9 +56,9 @@ void build(const CatalogOptions& options);
// switch. Any thread.
const CommandCatalog& instance();
// An item of a command's `tiles`: a menu row folded into the command, which runs it with `args`. `title` and `group`
// An item of a command's `tiles`: a menu item folded into the command, which runs it with `args`. `title` and `group`
// (its Speed Dial section) are untranslated msgids, L()-marked by the caller. `input` is the Speed Dial's token for
// the value the row's second phase collects ("percent", "tab"), and `input_arg` the command's argument that value
// the value the item's second phase collects ("percent", "tab"), and `input_arg` the command's argument that value
// goes to where it is not named as the token. The item has `group`, `input` and `input_arg` only when they are
// given: without a group it is in its command's section.
nlohmann::json tile(std::string key, std::string title, std::string group, std::string icon, nlohmann::json args,
@@ -97,7 +97,7 @@ NativeCommand long_command(std::string key, std::string title, std::string group
// tiles), with its person's forms (Mcp::person_forms()): {} for its own tile, and the args of each item that collects
// no value. A call that is one of them (Mcp::person_form(tool, args)) is the person's form: `person` given those
// arguments, on the UI thread, as ui_command() runs a function. Any other call is the tool's own function, given the
// arguments as they are. `own_forms` are the tiles whose row does what the tool does (view_set's camera tiles): an
// arguments as they are. `own_forms` are the tiles whose menu item does what the tool does (view_set's camera tiles): an
// automated call whose arguments, null as {}, are one of them is the tool's own function, and a person's pick of one
// is `person`, which runs the same function in place; they stay person's forms (Mcp::person_form()) for what reads a
// call as a tile's. A person's pick of a tile that collects a value is `person` too, given the tile's call (its args
@@ -106,9 +106,9 @@ NativeCommand long_command(std::string key, std::string title, std::string group
// guard lets it run behind dialogs, unless `person_form_behind_dialogs` says the form opens nothing and may run where
// the tool does. The tool's schema stays as it is: it takes its tiles' arguments, and its own function needs nothing a
// tile leaves out.
NativeCommand with_row_forms(NativeCommand tool, std::function<AppActionRunResult(const nlohmann::json& tile_args)> person,
NativeCommand with_menu_item_forms(NativeCommand tool, std::function<AppActionRunResult(const nlohmann::json& tile_args)> person,
bool person_form_behind_dialogs = false, std::vector<nlohmann::json> own_forms = {});
// with_row_forms() for a tool whose own function requires what its person's forms leave out (a path a dialog asks
// with_menu_item_forms() for a tool whose own function requires what its person's forms leave out (a path a dialog asks
// for): its schema goes through Mcp::with_silent() with them, so it also takes silent: true, and a call with silent is
// the tool's own function, given silent with the other arguments, so that what the function journals keeps it.
NativeCommand with_person_form(NativeCommand tool, std::function<AppActionRunResult(const nlohmann::json& tile_args)> person,
@@ -156,7 +156,7 @@ bool recording_active();
const NativeCommand* find(const std::string& key);
// A command's title as its tile shows it, in the UI's language, translated in its title_context(): a Design
// command's, its entry's name, in the Design context, as the right-click menu names a row; any other command's
// command's, its entry's name, in the Design context, as the right-click menu names an item; any other command's
// title with no context. The Speed Dial's tiles, the replay and script editors and the notice of a job a person
// started show a command's title with it; a recording's caption translates the title in the same context on its
// own (title_context()). UI thread only.
+4 -4
View File
@@ -111,7 +111,7 @@ Refusal nothing_deleted();
// dialog leaves unchanged, and a character a file name cannot hold (invalid_name), which the object list refuses.
std::optional<Refusal> rename_refusal(const std::string& name);
// The refusal of Rename with a selection it does not rename, such as an instance, in the object menu row's words
// The refusal of Rename with a selection it does not rename, such as an instance, in the object menu item's words
// (wrong_selection).
Refusal rename_wrong_selection();
@@ -191,7 +191,7 @@ Outcome<int> assemble_objects(const Targets& targets);
std::optional<Refusal> part_type_refusal(const Model& model, const Targets& targets, ModelVolumeType type,
std::optional<ModelVolumeType> subtype);
// The refusal of Change Type with a selection of anything but parts, in the row's words (wrong_selection).
// The refusal of Change Type with a selection of anything but parts, in the menu item's words (wrong_selection).
Refusal part_wrong_selection();
struct ChangePartTypeArgs
@@ -231,8 +231,8 @@ struct ReorderObjectsArgs
Outcome<std::vector<int>> reorder_objects(const ReorderObjectsArgs& args);
// ---- Mirror, centre, scale to fit, drop, orient ----
// Each runs the function of its row on the targets selected in the Prepare view, the view shown first, and leaves them
// selected. Targets read from the selection are the selection, which it acts on as it is, as the row does.
// Each runs the function of its menu item on the targets selected in the Prepare view, the view shown first, and leaves them
// selected. Targets read from the selection are the selection, which it acts on as it is, as the menu item does.
// What keeps `targets` from being mirrored, or none: a cut object (cut_object).
std::optional<Refusal> mirror_refusal(const Model& model, const Targets& targets);
+2 -2
View File
@@ -25,7 +25,7 @@ using Flags = std::vector<std::string>;
const Flags kEveryFlag{"writes_file", "changes_presets", "replaces_project", "sends_to_printer"};
// The commands the cases call by their key, with tiles and places in the tool list as the app's catalog has them:
// commands whose menu rows are items of their tiles, view_set's two among them collecting a value, and object_mirror's
// commands whose menu items are their tiles, view_set's two among them collecting a value, and object_mirror's
// two, one of which has a Speed Dial section of its own; plate_delete, with a tile of its own; all of them listed, as
// they run from their arguments. And export_drawing, made up, with a tile of its own and one that runs it with
// {"format": "pdf"}, which the tool list does not show, as a Design command. Every other tool the cases name is a
@@ -220,7 +220,7 @@ TEST_CASE("a call with other arguments than a tile's is described by its argumen
// The command's own tile with the other tile's arguments is that tile.
CHECK(describe(action("orca_command:export_drawing:orca", {{"format", "pdf"}})).what ==
json{{"kind", "command"}, {"key", "export_drawing"}, {"tile", "export_drawing_pdf"}});
// A command made from rows called with arguments no tile has is described as a typed tool's call, with what it
// A command made from menu items called with arguments no tile has is described as a typed tool's call, with what it
// does whichever way it is called.
const StepDescription exported = describe(json{{"tool", "preset_export"}, {"args", {{"path", abs_path("presets")}}}}.dump());
CHECK(exported.what == json{{"kind", "files"}, {"names", {"presets"}}});
+105 -105
View File
@@ -2,7 +2,7 @@
"commands": [
{
"completion": "immediate",
"description": "Find what does something, in one search, or look up one command. With query: the commands that match, best first, each with its group, the first sentence of its description and listed, whether the tool list shows it; one that is not listed (a menu row that takes no arguments, a Design tab command, or an operation a plugin offers, plugin.<plugin>.<name>) comes with its input schema, and its description when that says more, which nothing else shows. Beside them, the best few matches of each other catalog, with its total and how to use it: actions (the Speed Dial's plates, recent projects and plugin scripts and pages), settings, and python (the orca API a script calls). The reply says how to call each kind of match. With tool: that command's description and input schema, and its examples when it has some (the Design commands do). With neither: every command's name. group keeps the names and the command matches to one group; the other catalogs' matches stay as they are. The Design tab's CAD commands follow by heading (sketches, solid and surface features, bodies, measurements); look one up with tool before calling it. A command whose schema has silent does what its menu row does when called with no arguments, unless silent is true. Document: describe_design, import_step, import_mesh, set_variable, commit_to_plate, new_design, export_step, select_geometry, confirm_tool, cancel_tool. Sketch: sketch_create, sketch_project, sketch_text, sketch_insert_svg, sketch_offset, sketch_trim, sketch_fillet, sketch_chamfer, sketch_mirror, sketch_dimension, sketch_constrain, sketch_toggle_construction, sketch_extend, sketch_delete, sketch_describe, sketch_validate, sketch_list_constraints, sketch_blend_curve, sketch_finish, sketch_cancel, sketch_edit, sketch_draw, sketch_select, sketch_repair, sketch_set_value, sketch_transform, sketch_pattern, sketch_delete_constraint. Solid: extrude, revolve, sweep, loft, thicken, rib, boolean, hole, thread, shell, split, fillet, chamfer, draft, pattern, mirror, align, delete_face, list_align_types. Surface: surface_extrude, surface_revolve, surface_loft, surface_patch, surface_offset. Construct: construct_plane, construct_axis, construct_coordinate_system, helix. Inspect: measure, body_mass_properties, interference, body_describe, body_section, body_compare. Bodies: body_transform, body_delete, body_set, body_place. History: feature_edit, feature_delete, feature_describe, feature_set_expression, feature_move, feature_suppress, feature_rename. Menu rows, which take no arguments and do what their row of the right-click menu does: rename_selected, zoom_to_selection, sketch_polygon_inscribed, sketch_polygon_circumscribed, sketch_constrain_selected.",
"description": "Find what does something, in one search, or look up one command. With query: the commands that match, best first, each with its group, the first sentence of its description and listed, whether the tool list shows it; one that is not listed (a menu item that takes no arguments, a Design tab command, or an operation a plugin offers, plugin.<plugin>.<name>) comes with its input schema, and its description when that says more, which nothing else shows. Beside them, the best few matches of each other catalog, with its total and how to use it: actions (the Speed Dial's plates, recent projects and plugin scripts and pages), settings, and python (the orca API a script calls). The reply says how to call each kind of match. With tool: that command's description and input schema, and its examples when it has some (the Design commands do). With neither: every command's name. group keeps the names and the command matches to one group; the other catalogs' matches stay as they are. The Design tab's CAD commands follow by heading (sketches, solid and surface features, bodies, measurements); look one up with tool before calling it. A command whose schema has silent does what its menu item does when called with no arguments, unless silent is true. Document: describe_design, import_step, import_mesh, set_variable, commit_to_plate, new_design, export_step, select_geometry, confirm_tool, cancel_tool. Sketch: sketch_create, sketch_project, sketch_text, sketch_insert_svg, sketch_offset, sketch_trim, sketch_fillet, sketch_chamfer, sketch_mirror, sketch_dimension, sketch_constrain, sketch_toggle_construction, sketch_extend, sketch_delete, sketch_describe, sketch_validate, sketch_list_constraints, sketch_blend_curve, sketch_finish, sketch_cancel, sketch_edit, sketch_draw, sketch_select, sketch_repair, sketch_set_value, sketch_transform, sketch_pattern, sketch_delete_constraint. Solid: extrude, revolve, sweep, loft, thicken, rib, boolean, hole, thread, shell, split, fillet, chamfer, draft, pattern, mirror, align, delete_face, list_align_types. Surface: surface_extrude, surface_revolve, surface_loft, surface_patch, surface_offset. Construct: construct_plane, construct_axis, construct_coordinate_system, helix. Inspect: measure, body_mass_properties, interference, body_describe, body_section, body_compare. Bodies: body_transform, body_delete, body_set, body_place. History: feature_edit, feature_delete, feature_describe, feature_set_expression, feature_move, feature_suppress, feature_rename. Menu items, which take no arguments and do what their item of the right-click menu does: rename_selected, zoom_to_selection, sketch_polygon_inscribed, sketch_polygon_circumscribed, sketch_constrain_selected.",
"destructive": false,
"group": "Tools and actions",
"guard": "inspect",
@@ -41,7 +41,7 @@
},
{
"completion": "immediate",
"description": "Call any command by name with its arguments: a tool, or one the tool list does not show, a menu row that takes no arguments, a Design tab command or an operation a plugin offers (see tool_search). It runs and is recorded as that command's own call, with its guards and reply budget.",
"description": "Call any command by name with its arguments: a tool, or one the tool list does not show, a menu item that takes no arguments, a Design tab command or an operation a plugin offers (see tool_search). It runs and is recorded as that command's own call, with its guards and reply budget.",
"destructive": false,
"group": "Tools and actions",
"guard": "mutate",
@@ -457,7 +457,7 @@
},
{
"completion": "immediate",
"description": "Open one of OrcaSlicer's web pages in the default web browser, as its menu row does: wiki, the OrcaSlicer wiki; youtube, the OrcaSlicer YouTube channel; plugin_hub, the plugin hub's page, where a person picks a plugin to install. Nothing opens in OrcaSlicer.",
"description": "Open one of OrcaSlicer's web pages in the default web browser, as its menu item does: wiki, the OrcaSlicer wiki; youtube, the OrcaSlicer YouTube channel; plugin_hub, the plugin hub's page, where a person picks a plugin to install. Nothing opens in OrcaSlicer.",
"destructive": false,
"group": "The app",
"guard": "mutate",
@@ -1016,7 +1016,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 (slice first: a plate that is not sliced is written without G-code). 3mf: the model without slicing data. stl and drc (Draco): the objects as one file, or with per_object each in a file of its own, named after it, into the folder path names; every object of every plate, or those objects names. toolpaths_obj: the toolpaths the Preview shows, as an OBJ, refused while it shows none (slice the plate and show the Preview first). Without format, the path's extension (.gcode, .gcode.3mf, .3mf, .stl, .drc, .obj) says which. Called with exactly the arguments of one of the File > Export rows (format alone, sliced_3mf with plates \"all\", stl or drc with per_object), it asks for the file or folder in the dialog that row opens (blocked_by_dialog). A file per object of a project with no objects, and the toolpaths while the Preview shows none, are refused in either form. Reply: path and bytes; for gcode, path and export (ok, or superseded with a note when the project changed while it was written); for per_object, path and files (each file written); for stl and drc, objects (those written).",
"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 and drc (Draco): the objects as one file, or with per_object each in a file of its own, named after it, into the folder path names; every object of every plate, or those objects names. toolpaths_obj: the toolpaths the Preview shows, as an OBJ, refused while it shows none (slice the plate and show the Preview first). Without format, the path's extension (.gcode, .gcode.3mf, .3mf, .stl, .drc, .obj) says which. Called with exactly the arguments of one of the File > Export menu items (format alone, sliced_3mf with plates \"all\", stl or drc with per_object), it asks for the file or folder in the dialog that item opens (blocked_by_dialog). A file per object of a project with no objects, and the toolpaths while the Preview shows none, are refused in either form. Reply: path and bytes; for gcode, path and export (ok, or superseded with a note when the project changed while it was written); for per_object, path and files (each file written); for stl and drc, objects (those written).",
"destructive": false,
"group": "The project",
"guard": "mutate",
@@ -6423,7 +6423,7 @@
},
{
"completion": "immediate",
"description": "Open one of OrcaSlicer's windows or dialogs for a person, as its menu row does: preferences, the Preferences dialog, with tab, and key on it, on that tab with that preference's control scrolled into view and focused (its controls are named after their preference keys: preferences_get reads them and preferences_set writes those it does not refuse, and widget_set_value {\"target\": {\"name\": key, \"within\": \"Preferences\"}} changes one through the dialog); plugins, the Plugins window; action_replay, the Action Replay window, where a person replays a replay file (agents run one with replay_run); preset_bundle, the preset bundle manager; keyboard_shortcuts; setup_wizard; network_test; troubleshoot, the troubleshooting center; tip_of_the_day; about. A modal one replies blocked_by_dialog.",
"description": "Open one of OrcaSlicer's windows or dialogs for a person, as its menu item does: preferences, the Preferences dialog, with tab, and key on it, on that tab with that preference's control scrolled into view and focused (its controls are named after their preference keys: preferences_get reads them and preferences_set writes those it does not refuse, and widget_set_value {\"target\": {\"name\": key, \"within\": \"Preferences\"}} changes one through the dialog); plugins, the Plugins window; action_replay, the Action Replay window, where a person replays a replay file (agents run one with replay_run); preset_bundle, the preset bundle manager; keyboard_shortcuts; setup_wizard; network_test; troubleshoot, the troubleshooting center; tip_of_the_day; about. A modal one replies blocked_by_dialog.",
"destructive": false,
"group": "View and windows",
"guard": "mutate",
@@ -7275,7 +7275,7 @@
]
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -7488,7 +7488,7 @@
"type": "array"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -7691,7 +7691,7 @@
"type": "array"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -7873,7 +7873,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -8020,7 +8020,7 @@
"type": "boolean"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -8043,7 +8043,7 @@
},
{
"completion": "immediate",
"description": "Thicken a face of a body, or a whole sheet body, into a new solid body by a wall thickness. type face offsets one face of a body into a thin plate. type surface thickens a sheet body: a sheet of several faces whose free rims close into planar loops (the walls of a box with no lids) is capped at them and grows inward, into the closed shape that makes, whatever flip says; one whose rim can't be capped is refused. A single face or a closed shell is offset face by face along each face's normal, the one body_describe gives, or against it with flip; a closed shell can fail to thicken this way. Reply: thicken_index, bodies. Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design tab for a person, as the menu row does: {\"type\":\"face\"} (Thicken), {\"type\":\"surface\"} (Thicken Surface).",
"description": "Thicken a face of a body, or a whole sheet body, into a new solid body by a wall thickness. type face offsets one face of a body into a thin plate. type surface thickens a sheet body: a sheet of several faces whose free rims close into planar loops (the walls of a box with no lids) is capped at them and grows inward, into the closed shape that makes, whatever flip says; one whose rim can't be capped is refused. A single face or a closed shell is offset face by face along each face's normal, the one body_describe gives, or against it with flip; a closed shell can fail to thicken this way. Reply: thicken_index, bodies. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"face\"} (Thicken), {\"type\":\"surface\"} (Thicken Surface).",
"destructive": false,
"examples": [
{
@@ -8198,7 +8198,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -8235,7 +8235,7 @@
"args": {
"type": "surface"
},
"description": "Thicken a sheet body into a solid. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "Thicken a sheet body into a solid. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"icon": "design_thicken",
"key": "thicken_surf",
"title": "Thicken Surface"
@@ -8343,7 +8343,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -8376,7 +8376,7 @@
},
{
"completion": "immediate",
"description": "Combine two bodies: join them, cut the tool from the target, or keep where they intersect. A rejected rebuild is reported in the reply: ok is false or error is not empty. Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design tab for a person, as the menu row does: {\"operation\":\"join\"} (Join), {\"operation\":\"cut\"} (Subtract), {\"operation\":\"intersect\"} (Intersect).",
"description": "Combine two bodies: join them, cut the tool from the target, or keep where they intersect. A rejected rebuild is reported in the reply: ok is false or error is not empty. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"operation\":\"join\"} (Join), {\"operation\":\"cut\"} (Subtract), {\"operation\":\"intersect\"} (Intersect).",
"destructive": false,
"examples": [
{
@@ -8486,7 +8486,7 @@
"type": "string"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -8523,7 +8523,7 @@
"args": {
"operation": "cut"
},
"description": "Cut the tool body out of the target. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "Cut the tool body out of the target. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"icon": "design_boolean",
"key": "bool_subtract",
"title": "Subtract"
@@ -8532,7 +8532,7 @@
"args": {
"operation": "intersect"
},
"description": "Keep only where the two bodies overlap. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "Keep only where the two bodies overlap. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"icon": "design_boolean",
"key": "bool_intersect",
"title": "Intersect"
@@ -8644,7 +8644,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -8799,7 +8799,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -8928,7 +8928,7 @@
"type": "boolean"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -9042,7 +9042,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -9242,7 +9242,7 @@
]
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -9504,7 +9504,7 @@
]
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -9610,7 +9610,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -9778,7 +9778,7 @@
]
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -9914,7 +9914,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -10015,7 +10015,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -10108,7 +10108,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -10243,7 +10243,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -10261,7 +10261,7 @@
},
{
"completion": "immediate",
"description": "Replicate a body in a row, around the plane's normal, or along a sketch curve. linear places count copies along a plane axis at spacing; circular spreads them over angle about the plane's normal through its origin; curve places them at equal-parameter points on a sketch entity, each translated by (P_i - P_0). An argument of one type is refused with another. Reply: pattern_index, bodies, and for linear and circular the frame. Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design tab for a person, as the menu row does: {\"type\":\"linear\"} (Linear pattern), {\"type\":\"circular\"} (Circular pattern).",
"description": "Replicate a body in a row, around the plane's normal, or along a sketch curve. linear places count copies along a plane axis at spacing; circular spreads them over angle about the plane's normal through its origin; curve places them at equal-parameter points on a sketch entity, each translated by (P_i - P_0). An argument of one type is refused with another. Reply: pattern_index, bodies, and for linear and circular the frame. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"linear\"} (Linear pattern), {\"type\":\"circular\"} (Circular pattern).",
"destructive": false,
"examples": [
{
@@ -10440,7 +10440,7 @@
]
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -10482,7 +10482,7 @@
"args": {
"type": "circular"
},
"description": "Repeat the body around an axis — set the count and sweep. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "Repeat the body around an axis — set the count and sweep. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"icon": "design_polararray",
"key": "pattern_circular",
"title": "Circular pattern"
@@ -10608,7 +10608,7 @@
]
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -10738,7 +10738,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -10884,7 +10884,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -11089,7 +11089,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -11289,7 +11289,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -11393,7 +11393,7 @@
"type": "array"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -11503,7 +11503,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -11667,7 +11667,7 @@
]
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -11889,7 +11889,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -11957,7 +11957,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -12060,7 +12060,7 @@
"type": "object"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -12083,7 +12083,7 @@
},
{
"completion": "immediate",
"description": "Give this feature a name you will recognise in the tree (a body takes its name from the feature that makes it). It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "Give this feature a name you will recognise in the tree (a body takes its name from the feature that makes it). It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"destructive": false,
"group": "Design",
"guard": "mutate",
@@ -12175,7 +12175,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -12198,7 +12198,7 @@
},
{
"completion": "immediate",
"description": "Frame the selection in the view, keeping the view direction. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "Frame the selection in the view, keeping the view direction. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"destructive": false,
"group": "Design",
"guard": "mutate",
@@ -12311,7 +12311,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -12402,7 +12402,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -12425,7 +12425,7 @@
},
{
"completion": "immediate",
"description": "Measure the polygon to its corners (inscribed). It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Measure the polygon to its corners (inscribed). It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"destructive": false,
"group": "Design",
"guard": "mutate",
@@ -12446,7 +12446,7 @@
},
{
"completion": "immediate",
"description": "Measure the polygon to its flats (circumscribed). It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Measure the polygon to its flats (circumscribed). It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"destructive": false,
"group": "Design",
"guard": "mutate",
@@ -12576,7 +12576,7 @@
"type": "array"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -12686,7 +12686,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -12804,7 +12804,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -12901,7 +12901,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -12993,7 +12993,7 @@
"type": "number"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -13080,7 +13080,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -13271,7 +13271,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -13402,7 +13402,7 @@
"type": "array"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -13599,7 +13599,7 @@
"type": "array"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -13656,7 +13656,7 @@
},
{
"completion": "immediate",
"description": "Add dimensions and relations (coincident, tangent, parallel...) to the selected sketch. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "Add dimensions and relations (coincident, tangent, parallel...) to the selected sketch. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"destructive": false,
"group": "Design",
"guard": "mutate",
@@ -13750,7 +13750,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -13842,7 +13842,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -13965,7 +13965,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -15462,7 +15462,7 @@
},
{
"completion": "immediate",
"description": "Rename, colour or show/hide a body, as its Bodies row and the Color button do; give one or more. Not in the undo history. The name and colour are saved with the project and the name names its committed object; visibility is view state, and commit_to_plate leaves hidden bodies out. Reply: name, color, visible. Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design tab for a person, as the menu row does: {} (Color).",
"description": "Rename, colour or show/hide a body, as its Bodies row and the Color button do; give one or more. Not in the undo history. The name and colour are saved with the project and the name names its committed object; visibility is view state, and commit_to_plate leaves hidden bodies out. Reply: name, color, visible. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {} (Color).",
"destructive": false,
"examples": [
{
@@ -15567,7 +15567,7 @@
]
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"enum": [
true
],
@@ -15596,7 +15596,7 @@
"tiles": [
{
"args": {},
"description": "Set the selected body's display color. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"description": "Set the selected body's display color. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only outside a sketch (sketch_finish or sketch_cancel ends one; while the tab constrains a sketch, its Confirm or Cancel button ends that).",
"icon": "color_palette",
"key": "colour",
"title": "Color"
@@ -16065,7 +16065,7 @@
},
{
"completion": "immediate",
"description": "Draw a shape in the open sketch from its fields beside `type`, or a list of shapes as `entities`. Each type, and the fields it takes: line {p0, p1}; polyline {points: 2 or more, a loop when the last is the first}; rectangle_2_point {p0, p1: opposite corners}; rectangle_center {center, corner}; rectangle_3_point {p0, p1: one side; width: signed, to the left of p0 to p1}; rectangle_rounded {p0, p1: opposite corners; radius: of the corners}; circle_center {center, radius}; circle_2_point {p0, p1: the ends of a diameter}; circle_3_point {p0, p1, p2: on the circle}; arc_3_point {p0: start; p1: end; on_arc}; arc_center {center, radius, start_angle, end_angle}; arc_tangent {end; entity: the line or arc it leaves, the sketch's or one an item before it adds, at that one's end, along its direction there, left out the one added last}; slot {c0, c1, width}; slot_arc {center, start, end: its direction from the centre, width}; ellipse {center, radius (semi-major), rminor, rotation}; ellipse_arc {the ellipse's fields, start_angle, end_angle: parametric, counter-clockwise}; spline {ctrl: 2 or more poles}; polygon {center, sides, radius (to a vertex) or across_flats, angle (of that vertex, or of the first edge's midpoint)}; point {p}. A type refuses a field it does not take. Each is built as its drawing tool builds it: a rectangle, a slot or a polygon is one shape, which one undo of the sketch takes off whole, and a polyline is its lines, as its tool leaves them; the constraints are inferred exactly, so that none moves what is given. Each shape carries the constraints its tool gives it, at any slant; a constraint between a shape and the sketch's axes or what is already in the sketch, or between plain lines, is inferred only where it holds exactly, so a square on the axes is level only on a side lying exactly on one, with right angles holding the others. Each item of entities may carry its own construction; the top-level construction is the single-type form's, and beside entities each item's that gives none. Beside entities a shape's field, type among them, is refused: it belongs in its item. Points are [x, y] in the sketch plane (mm); angles are radians, or degrees as start_angle_deg and the like. A polygon is lines; its side count is not kept once committed. Reply: first_index, added, shapes [{first, count}] per item, entities, dof. Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design tab for a person, as the menu row does: {\"type\":\"line\"} (Line), {\"type\":\"polyline\"} (Polyline), {\"type\":\"rectangle_2_point\"} (Corner rectangle), {\"type\":\"rectangle_center\"} (Center rectangle), {\"type\":\"rectangle_3_point\"} (Oblique rectangle), {\"type\":\"rectangle_rounded\"} (Rounded rectangle), {\"type\":\"circle_center\"} (Center circle), {\"type\":\"circle_2_point\"} (2-point circle), {\"type\":\"circle_3_point\"} (3-point circle), {\"type\":\"arc_3_point\"} (3-point arc), {\"type\":\"arc_tangent\"} (Tangent arc), {\"type\":\"arc_center\"} (Center-point arc), {\"type\":\"slot\"} (Slot), {\"type\":\"slot_arc\"} (Arc slot), {\"type\":\"ellipse\"} (Ellipse), {\"type\":\"ellipse_arc\"} (Elliptical arc), {\"type\":\"spline\"} (Spline), {\"sides\":3,\"type\":\"polygon\"} (Triangle), {\"sides\":4,\"type\":\"polygon\"} (Square), {\"sides\":5,\"type\":\"polygon\"} (Pentagon), {\"sides\":6,\"type\":\"polygon\"} (Hexagon), {\"sides\":8,\"type\":\"polygon\"} (Octagon), {\"sides\":12,\"type\":\"polygon\"} (Dodecagon), {\"type\":\"point\"} (Point).",
"description": "Draw a shape in the open sketch from its fields beside `type`, or a list of shapes as `entities`. Each type, and the fields it takes: line {p0, p1}; polyline {points: 2 or more, a loop when the last is the first}; rectangle_2_point {p0, p1: opposite corners}; rectangle_center {center, corner}; rectangle_3_point {p0, p1: one side; width: signed, to the left of p0 to p1}; rectangle_rounded {p0, p1: opposite corners; radius: of the corners}; circle_center {center, radius}; circle_2_point {p0, p1: the ends of a diameter}; circle_3_point {p0, p1, p2: on the circle}; arc_3_point {p0: start; p1: end; on_arc}; arc_center {center, radius, start_angle, end_angle}; arc_tangent {end; entity: the line or arc it leaves, the sketch's or one an item before it adds, at that one's end, along its direction there, left out the one added last}; slot {c0, c1, width}; slot_arc {center, start, end: its direction from the centre, width}; ellipse {center, radius (semi-major), rminor, rotation}; ellipse_arc {the ellipse's fields, start_angle, end_angle: parametric, counter-clockwise}; spline {ctrl: 2 or more poles}; polygon {center, sides, radius (to a vertex) or across_flats, angle (of that vertex, or of the first edge's midpoint)}; point {p}. A type refuses a field it does not take. Each is built as its drawing tool builds it: a rectangle, a slot or a polygon is one shape, which one undo of the sketch takes off whole, and a polyline is its lines, as its tool leaves them; the constraints are inferred exactly, so that none moves what is given. Each shape carries the constraints its tool gives it, at any slant; a constraint between a shape and the sketch's axes or what is already in the sketch, or between plain lines, is inferred only where it holds exactly, so a square on the axes is level only on a side lying exactly on one, with right angles holding the others. Each item of entities may carry its own construction; the top-level construction is the single-type form's, and beside entities each item's that gives none. Beside entities a shape's field, type among them, is refused: it belongs in its item. Points are [x, y] in the sketch plane (mm); angles are radians, or degrees as start_angle_deg and the like. A polygon is lines; its side count is not kept once committed. Reply: first_index, added, shapes [{first, count}] per item, entities, dof. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"line\"} (Line), {\"type\":\"polyline\"} (Polyline), {\"type\":\"rectangle_2_point\"} (Corner rectangle), {\"type\":\"rectangle_center\"} (Center rectangle), {\"type\":\"rectangle_3_point\"} (Oblique rectangle), {\"type\":\"rectangle_rounded\"} (Rounded rectangle), {\"type\":\"circle_center\"} (Center circle), {\"type\":\"circle_2_point\"} (2-point circle), {\"type\":\"circle_3_point\"} (3-point circle), {\"type\":\"arc_3_point\"} (3-point arc), {\"type\":\"arc_tangent\"} (Tangent arc), {\"type\":\"arc_center\"} (Center-point arc), {\"type\":\"slot\"} (Slot), {\"type\":\"slot_arc\"} (Arc slot), {\"type\":\"ellipse\"} (Ellipse), {\"type\":\"ellipse_arc\"} (Elliptical arc), {\"type\":\"spline\"} (Spline), {\"sides\":3,\"type\":\"polygon\"} (Triangle), {\"sides\":4,\"type\":\"polygon\"} (Square), {\"sides\":5,\"type\":\"polygon\"} (Pentagon), {\"sides\":6,\"type\":\"polygon\"} (Hexagon), {\"sides\":8,\"type\":\"polygon\"} (Octagon), {\"sides\":12,\"type\":\"polygon\"} (Dodecagon), {\"type\":\"point\"} (Point).",
"destructive": false,
"examples": [
{
@@ -16449,7 +16449,7 @@
"args": {
"type": "line"
},
"description": "Line — click start, then end. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Line — click start, then end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_line",
"key": "sk_line_t",
"title": "Line"
@@ -16458,7 +16458,7 @@
"args": {
"type": "polyline"
},
"description": "Click points; click the first point to close the loop, right-click to end it open. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click points; click the first point to close the loop, right-click to end it open. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_polyline",
"key": "sk_polyline",
"title": "Polyline"
@@ -16467,7 +16467,7 @@
"args": {
"type": "rectangle_2_point"
},
"description": "Rectangle — click two opposite corners. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Rectangle — click two opposite corners. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_rect",
"key": "sk_rect",
"title": "Corner rectangle"
@@ -16476,7 +16476,7 @@
"args": {
"type": "rectangle_center"
},
"description": "Click center, then a corner. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click center, then a corner. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_crect",
"key": "sk_rect_center",
"title": "Center rectangle"
@@ -16485,7 +16485,7 @@
"args": {
"type": "rectangle_3_point"
},
"description": "Click two corners of one edge, then a point for the width. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click two corners of one edge, then a point for the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_rect_oblique",
"key": "sk_rect_oblique",
"title": "Oblique rectangle"
@@ -16494,7 +16494,7 @@
"args": {
"type": "rectangle_rounded"
},
"description": "Click two opposite corners, then a point for the corner radius. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click two opposite corners, then a point for the corner radius. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_rect_rounded",
"key": "sk_rect_rounded",
"title": "Rounded rectangle"
@@ -16503,7 +16503,7 @@
"args": {
"type": "circle_center"
},
"description": "Circle — click center, then radius. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Circle — click center, then radius. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_circle",
"key": "sk_circle",
"title": "Center circle"
@@ -16512,7 +16512,7 @@
"args": {
"type": "circle_2_point"
},
"description": "Click two ends of the diameter. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click two ends of the diameter. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_circle2pt",
"key": "sk_circle_2pt",
"title": "2-point circle"
@@ -16521,7 +16521,7 @@
"args": {
"type": "circle_3_point"
},
"description": "Click three points on the circle. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click three points on the circle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_circle3pt",
"key": "sk_circle_3pt",
"title": "3-point circle"
@@ -16530,7 +16530,7 @@
"args": {
"type": "arc_3_point"
},
"description": "Arc — click start, end, then a point. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Arc — click start, end, then a point. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_arc3pt",
"key": "sk_arc_t",
"title": "3-point arc"
@@ -16539,7 +16539,7 @@
"args": {
"type": "arc_tangent"
},
"description": "Click start (on the last entity) then end. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click start (on the last entity) then end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_tangentarc",
"key": "sk_arc_tangent",
"title": "Tangent arc"
@@ -16548,7 +16548,7 @@
"args": {
"type": "arc_center"
},
"description": "Click center, then start, then a point for the end angle. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click center, then start, then a point for the end angle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_arc_center",
"key": "sk_arc_center",
"title": "Center-point arc"
@@ -16557,7 +16557,7 @@
"args": {
"type": "slot"
},
"description": "Slot — two centerline ends, then the width. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Slot — two centerline ends, then the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_slot",
"key": "sk_slot",
"title": "Slot"
@@ -16566,7 +16566,7 @@
"args": {
"type": "slot_arc"
},
"description": "Click center, start, end, then a point for the width. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click center, start, end, then a point for the width. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_slot_arc",
"key": "sk_slot_arc",
"title": "Arc slot"
@@ -16575,7 +16575,7 @@
"args": {
"type": "ellipse"
},
"description": "Ellipse — center, major end, minor point. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Ellipse — center, major end, minor point. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_ellipse",
"key": "sk_ellipse",
"title": "Ellipse"
@@ -16584,7 +16584,7 @@
"args": {
"type": "ellipse_arc"
},
"description": "Click center, major-axis end, minor point, then arc start and end. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Click center, major-axis end, minor point, then arc start and end. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_ellipse_arc",
"key": "sk_ellipse_arc",
"title": "Elliptical arc"
@@ -16593,7 +16593,7 @@
"args": {
"type": "spline"
},
"description": "Spline — click control points. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Spline — click control points. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_bspline",
"key": "sk_spline",
"title": "Spline"
@@ -16603,7 +16603,7 @@
"sides": 3,
"type": "polygon"
},
"description": "Triangle — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Triangle — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_polygon",
"key": "sk_poly_3",
"title": "Triangle"
@@ -16613,7 +16613,7 @@
"sides": 4,
"type": "polygon"
},
"description": "Square — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Square — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_polygon",
"key": "sk_poly_4",
"title": "Square"
@@ -16623,7 +16623,7 @@
"sides": 5,
"type": "polygon"
},
"description": "Pentagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Pentagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_polygon",
"key": "sk_poly_5",
"title": "Pentagon"
@@ -16633,7 +16633,7 @@
"sides": 6,
"type": "polygon"
},
"description": "Hexagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Hexagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_polygon",
"key": "sk_polygon",
"title": "Hexagon"
@@ -16643,7 +16643,7 @@
"sides": 8,
"type": "polygon"
},
"description": "Octagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Octagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_polygon",
"key": "sk_poly_8",
"title": "Octagon"
@@ -16653,7 +16653,7 @@
"sides": 12,
"type": "polygon"
},
"description": "Dodecagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Dodecagon — click center, then a vertex. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_polygon",
"key": "sk_poly_12",
"title": "Dodecagon"
@@ -16662,7 +16662,7 @@
"args": {
"type": "point"
},
"description": "Point — click to place. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Point — click to place. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_point",
"key": "sk_point_t",
"title": "Point"
@@ -16870,7 +16870,7 @@
},
{
"completion": "immediate",
"description": "Set the dimension of the selected sketch entities, as the value field does. A line's length, a circle's diameter, an arc's radius, or the angle or distance between two. Select them with sketch_select first. Reply: kind, before, value, dof and the loops. Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design tab for a person, as the menu row does: {} (Length…, Radius / diameter…, Angle / distance…).",
"description": "Set the dimension of the selected sketch entities, as the value field does. A line's length, a circle's diameter, an arc's radius, or the angle or distance between two. Select them with sketch_select first. Reply: kind, before, value, dof and the loops. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {} (Length…, Radius / diameter…, Angle / distance…).",
"destructive": false,
"examples": [
{
@@ -16968,7 +16968,7 @@
"type": "integer"
},
"silent": {
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu row does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"description": "true runs the tool with the other arguments and opens nothing. A call with no arguments does what the Design tab's menu item does, as a person's pick does. Called with no arguments, it runs only in an open sketch (sketch_create opens one).",
"enum": [
true
],
@@ -16994,21 +16994,21 @@
"tiles": [
{
"args": {},
"description": "Type the length of this line. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Type the length of this line. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_dimension",
"key": "sk_length",
"title": "Length…"
},
{
"args": {},
"description": "Type the radius of this arc, or the diameter of this circle. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Type the radius of this arc, or the diameter of this circle. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_dimension",
"key": "sk_radius",
"title": "Radius / diameter…"
},
{
"args": {},
"description": "Type the angle between two lines, or the distance between the two picks. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Type the angle between two lines, or the distance between the two picks. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_dimension",
"key": "sk_angdist",
"title": "Angle / distance…"
@@ -17018,7 +17018,7 @@
},
{
"completion": "immediate",
"description": "Move, rotate or scale entities of the open sketch, as the transform tools' Confirm does. move {dx, dy}, rotate {angle, pivot} and scale {scale, pivot} change the entities and release the constraints that no longer hold. pivot defaults to the entities' centroid. Angles are radians, or degrees as angle_deg. Reply: type, moved, released_constraints, pivot, entities, dof. Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design tab for a person, as the menu row does: {\"type\":\"move\"} (Move), {\"type\":\"rotate\"} (Rotate), {\"type\":\"scale\"} (Scale).",
"description": "Move, rotate or scale entities of the open sketch, as the transform tools' Confirm does. move {dx, dy}, rotate {angle, pivot} and scale {scale, pivot} change the entities and release the constraints that no longer hold. pivot defaults to the entities' centroid. Angles are radians, or degrees as angle_deg. Reply: type, moved, released_constraints, pivot, entities, dof. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"move\"} (Move), {\"type\":\"rotate\"} (Rotate), {\"type\":\"scale\"} (Scale).",
"destructive": false,
"examples": [
{
@@ -17171,7 +17171,7 @@
"args": {
"type": "move"
},
"description": "Pick entities, then drag the handle or click the distance; click empty to apply. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Pick entities, then drag the handle or click the distance; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_move",
"key": "sk_move",
"title": "Move"
@@ -17180,7 +17180,7 @@
"args": {
"type": "rotate"
},
"description": "Pick entities, then drag around the pivot or click the angle; click empty to apply. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Pick entities, then drag around the pivot or click the angle; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_rotate",
"key": "sk_rotate",
"title": "Rotate"
@@ -17189,7 +17189,7 @@
"args": {
"type": "scale"
},
"description": "Pick entities, then drag the handle or click the factor; click empty to apply. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Pick entities, then drag the handle or click the factor; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_scale",
"key": "sk_scale",
"title": "Scale"
@@ -17199,7 +17199,7 @@
},
{
"completion": "immediate",
"description": "Repeat entities of the open sketch in a row or around a point, as the Linear and Polar array tools do. linear adds copies stepped by dx, dy; circular adds copies every angle/count about pivot (angle is the whole sweep, default 360 degrees). count includes the original, and each copy is bound to its source (equal length and parallel, or its radius). Angles are radians, or degrees as angle_deg. Reply: type, first_index, added, bound, pivot (circular), entities, dof. Called with exactly one of these argument sets and nothing else, it opens that row's tool of the Design tab for a person, as the menu row does: {\"type\":\"linear\"} (Linear array), {\"type\":\"circular\"} (Polar array).",
"description": "Repeat entities of the open sketch in a row or around a point, as the Linear and Polar array tools do. linear adds copies stepped by dx, dy; circular adds copies every angle/count about pivot (angle is the whole sweep, default 360 degrees). count includes the original, and each copy is bound to its source (equal length and parallel, or its radius). Angles are radians, or degrees as angle_deg. Reply: type, first_index, added, bound, pivot (circular), entities, dof. Called with exactly one of these argument sets and nothing else, it opens that item's tool of the Design tab for a person, as the menu item does: {\"type\":\"linear\"} (Linear array), {\"type\":\"circular\"} (Polar array).",
"destructive": false,
"examples": [
{
@@ -17353,7 +17353,7 @@
"args": {
"type": "linear"
},
"description": "Pick entities, drag the spacing handle, click the count; click empty to apply. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Pick entities, drag the spacing handle, click the count; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_array",
"key": "sk_array",
"title": "Linear array"
@@ -17362,7 +17362,7 @@
"args": {
"type": "circular"
},
"description": "Pick entities, drag the sweep handle, click the count; click empty to apply. It takes no arguments and does what the Design tab's right-click menu row does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"description": "Pick entities, drag the sweep handle, click the count; click empty to apply. It takes no arguments and does what the Design tab's right-click menu item does, as a person's pick does: open a tool, start a sketch tool, act at once, or tell the person why it cannot. The reply's status is what the tab's status line shows then. It runs only in an open sketch (sketch_create opens one).",
"icon": "design_polararray",
"key": "sk_array_polar",
"title": "Polar array"
@@ -17563,7 +17563,7 @@
},
{
"completion": "immediate",
"description": "Select a body, a face, edges, a vertex, a reference plane, a sketch's loop or a feature by id, as a click selects it. One form: body; body with face, edges (the last the current edge, as in a Shift+click set) or vertex; plane; sketch with loop; feature; or nothing, which clears the selection. A body is selected as a click on its row of the Bodies list selects it, a face, edges or a vertex as a click in the view picks them, a loop as a click on it, which also selects its Sketch's row, and a feature as a click on its row of the Feature list. A plane is picked only where a click can pick one: while the Origin row shows the planes, or while Sketch waits for its plane (sketch_create {}), where picking it opens the sketch. A loop is numbered as sketch_describe {sketch} numbers closed_loops and extrude {sketch, loop} takes it, and is selected only while the view shows it: an extrude that takes the whole sketch hides the sketch, and one that takes a loop hides that loop. Whatever was selected goes first, of every kind. The menu-row forms then act on the selection: feature_edit, rename_selected, feature_delete and sketch_constrain_selected called with no arguments act on the selected row of the Feature list while nothing is picked in the view, and zoom_to_selection acts on what is picked in the view, so a sketch is zoomed to through sketch with loop, not through feature. Refused, changing nothing, for an id the model does not have, and while a card, a sketch, Constrain mode, a body Move or the Text dialog is open, where a click means something else. Reply: selection {kind, id}, plane and feature, as describe_design reports selection, picked_plane and feature_row; for a vertex also point, as body_describe gives it, and placed_point, where the view draws it (the same unless the body was moved).",
"description": "Select a body, a face, edges, a vertex, a reference plane, a sketch's loop or a feature by id, as a click selects it. One form: body; body with face, edges (the last the current edge, as in a Shift+click set) or vertex; plane; sketch with loop; feature; or nothing, which clears the selection. A body is selected as a click on its row of the Bodies list selects it, a face, edges or a vertex as a click in the view picks them, a loop as a click on it, which also selects its Sketch's row, and a feature as a click on its row of the Feature list. A plane is picked only where a click can pick one: while the Origin row shows the planes, or while Sketch waits for its plane (sketch_create {}), where picking it opens the sketch. A loop is numbered as sketch_describe {sketch} numbers closed_loops and extrude {sketch, loop} takes it, and is selected only while the view shows it: an extrude that takes the whole sketch hides the sketch, and one that takes a loop hides that loop. Whatever was selected goes first, of every kind. The menu-item forms then act on the selection: feature_edit, rename_selected, feature_delete and sketch_constrain_selected called with no arguments act on the selected row of the Feature list while nothing is picked in the view, and zoom_to_selection acts on what is picked in the view, so a sketch is zoomed to through sketch with loop, not through feature. Refused, changing nothing, for an id the model does not have, and while a card, a sketch, Constrain mode, a body Move or the Text dialog is open, where a click means something else. Reply: selection {kind, id}, plane and feature, as describe_design reports selection, picked_plane and feature_row; for a vertex also point, as body_describe gives it, and placed_point, where the view draws it (the same unless the body was moved).",
"destructive": false,
"examples": [
{
+4 -4
View File
@@ -26,10 +26,10 @@ inline const std::vector<std::string> kRetiredTools{
"pick_gizmo_file", "run_javascript", "open_files", "get_settings",
"set_settings"};
// The ids of the menu rows that are a tile of a command of another name (the design's Mapping), each the key of
// The ids of the menu items that are a tile of a command of another name (the design's Mapping), each the key of
// its tile: those of the project, the objects, the parts and the plates, then those of the presets, the app, the view
// and the rest.
inline const std::vector<std::string> kRetiredRows{
inline const std::vector<std::string> kRetiredMenuItems{
"new_project", "load_project", "import_file", "import_zip_archive",
"save_project", "save_project_as", "export_gcode", "export_sliced_file",
"export_all_sliced_file", "export_3mf", "export_stl", "export_stl_multi",
@@ -62,7 +62,7 @@ inline const std::vector<std::string> kRetiredRows{
"install_local_plugin", "refresh_plugins", "start_recording", "stop_recording",
"toggle_run_script_panel"};
// The names of kRetiredTools and kRetiredRows that are words of `text`, as a text an agent reads would name a command:
// The names of kRetiredTools and kRetiredMenuItems that are words of `text`, as a text an agent reads would name a command:
// a word is a run of letters, digits, underscores and hyphens, compared in its case, so project_export holds no export
// and a right-click menu no click.
inline std::set<std::string> retired_names_in(const std::string& text)
@@ -73,7 +73,7 @@ inline std::set<std::string> retired_names_in(const std::string& text)
const auto named = [&word](const std::vector<std::string>& names) {
return std::find(names.begin(), names.end(), word) != names.end();
};
if (named(kRetiredTools) || named(kRetiredRows))
if (named(kRetiredTools) || named(kRetiredMenuItems))
found.insert(word);
word.clear();
};
+5 -5
View File
@@ -200,7 +200,7 @@ TEST_CASE("A pin with no live action is dropped, the others keep their order", "
#endif
}
TEST_CASE("A pin under a row's id is kept, as its tile's", "[ActionSource][SpeedDial]")
TEST_CASE("A pin under a menu item's id is kept, as its tile's", "[ActionSource][SpeedDial]")
{
// The ids the registry holds of the palette's tiles, which it makes as the Speed Dial starts.
std::set<std::string> held;
@@ -209,7 +209,7 @@ TEST_CASE("A pin under a row's id is kept, as its tile's", "[ActionSource][Speed
Slic3r::GUI::NativeCommands::make_action(*t.command))
->id());
const auto live = [&held](const std::string& id) { return held.count(id) != 0; };
// Delete Selected and New Project, whose rows are tiles of object_delete and project_new.
// Delete Selected and New Project, whose menu items are tiles of object_delete and project_new.
const std::vector<std::string> pinned{"orca_command:obj_delete:orca", "orca_command:new_project:orca"};
std::vector<std::string> stored, shown;
Slic3r::GUI::prune_favourites(pinned, live, stored, shown);
@@ -357,8 +357,8 @@ TEST_CASE("the palette's own tiles leave the Design group out", "[ActionSource][
c.group = group;
c.listed = c.group != Slic3r::GUI::kDesignGroup;
c.in_palette = true;
c.tiles = nlohmann::json::array({nlohmann::json{{"key", std::string(group) + "_row"}, {"title", group}, {"icon", ""},
{"description", ""}, {"args", {{"row", true}}}}});
c.tiles = nlohmann::json::array({nlohmann::json{{"key", std::string(group) + "_item"}, {"title", group}, {"icon", ""},
{"description", ""}, {"args", {{"item", true}}}}});
catalog.add(std::move(c));
}
catalog.seal();
@@ -367,7 +367,7 @@ TEST_CASE("the palette's own tiles leave the Design group out", "[ActionSource][
CHECK(palette[0].command->key == "Objects_tile");
CHECK(palette[0].tile == nullptr);
REQUIRE(palette[1].tile != nullptr);
CHECK(palette[1].tile->at("key") == "Objects_row");
CHECK(palette[1].tile->at("key") == "Objects_item");
}
// The Help-menu tiles, wiki/YouTube links and the developer-mode toggle are part of the palette.
+39 -39
View File
@@ -144,7 +144,7 @@ std::string first_difference(const std::string& actual, const std::string& expec
// The design's command set outside the Design tab, heading by heading in the order tools/list gives them, Driving the
// GUI last, after the Design tab's commands: the 118 commands of the catalog, its typed tools, the commands made from
// menu rows, the seven Parts 4a to 4c add (Printable, Fix Model, Auto Drop, Clone, Reload from disk, Replace 3D file,
// menu items, the seven Parts 4a to 4c add (Printable, Fix Model, Auto Drop, Clone, Reload from disk, Replace 3D file,
// Add Mixed Filament), the three of Part 5a (the Printer Selection dialog's list, install and uninstall), the two of
// Part 5b (the System Filaments dialog's install and uninstall), Part 5c's write of the Preferences dialog's preferences
// and the four of Part 5d (the Plugins window's list, a switch, Delete or Unsubscribe, and Reload).
@@ -248,14 +248,14 @@ TEST_CASE("every Speed Dial tile of today is still a tile", "[CommandCatalog][Sp
CHECK(tiles == expected);
}
TEST_CASE("a row's id is a tile's key, not a command", "[CommandCatalog][SpeedDial]")
TEST_CASE("a menu item's id is a tile's key, not a command", "[CommandCatalog][SpeedDial]")
{
const CommandCatalog& catalog = NativeCommands::instance();
REQUIRE(kRetiredRows.size() == 121);
for (const std::string& row : kRetiredRows) {
INFO(row);
CHECK(catalog.find(row) == nullptr);
const auto [command, tile] = Slic3r::GUI::find_tile(catalog, row);
REQUIRE(kRetiredMenuItems.size() == 121);
for (const std::string& item : kRetiredMenuItems) {
INFO(item);
CHECK(catalog.find(item) == nullptr);
const auto [command, tile] = Slic3r::GUI::find_tile(catalog, item);
CHECK(command != nullptr);
CHECK(tile != nullptr);
}
@@ -263,7 +263,7 @@ TEST_CASE("a row's id is a tile's key, not a command", "[CommandCatalog][SpeedDi
TEST_CASE("every tile is its command's, with the design's arguments, and they fit its schema", "[CommandCatalog][SpeedDial]")
{
// Each of the 129 tiles with the command the design folds its row into and the arguments it runs it with.
// Each of the 129 tiles with the command the design folds its menu item into and the arguments it runs it with.
std::ifstream in(std::string(TEST_DATA_DIR) + "/speed_dial_tile_calls.json", std::ios::binary);
REQUIRE(in.is_open());
const json fixture = json::parse(in);
@@ -304,7 +304,7 @@ TEST_CASE("every tile is its command's, with the design's arguments, and they fi
json call = Slic3r::GUI::tile_call_args(tile, value);
CHECK(Mcp::argument_error(*command, call).empty());
}
// Every tile of today, under the command the design folds its row into.
// Every tile of today, under the command the design folds its menu item into.
CHECK(folded == 129);
// The tiles that ask need none of what the silent form requires; one more argument is the silent form.
@@ -326,7 +326,7 @@ TEST_CASE("every tile is its command's, with the design's arguments, and they fi
CHECK_THAT(Mcp::argument_error(*export_, gcode_overwrite), ContainsSubstring("path"));
}
TEST_CASE("a row's tile runs its command with the row's arguments", "[SpeedDial]")
TEST_CASE("a menu item's tile runs its command with the item's arguments", "[SpeedDial]")
{
// One tile of each command that has tiles, and each of view_set's kinds of tile: a tile's key, its command, the
// arguments it runs it with, and the Speed Dial's token for the value it collects with the argument that takes it.
@@ -444,10 +444,10 @@ TEST_CASE("outside the Design tab the catalog has its commands and 129 tiles", "
// An own tile is in the section the Speed Dial shows its key in.
CHECK(c.tile_group == section.at(c.key));
}
// The commands outside the Design tab: the typed tools, the commands made from menu rows, the seven Parts 4a to 4c
// The commands outside the Design tab: the typed tools, the commands made from menu items, the seven Parts 4a to 4c
// add, Part 5a's three, Part 5b's two, Part 5c's one and Part 5d's four.
CHECK(commands == 118);
// The eight commands named as their rows keep a tile of their own; the other 121 tiles are items.
// The eight commands named as their menu items keep a tile of their own; the other 121 tiles are items.
CHECK(own == std::set<std::string>{"plate_add", "plate_delete", "plate_duplicate", "plate_rename", "filament_add", "filament_delete",
"undo", "redo"});
CHECK(items == 121);
@@ -491,7 +491,7 @@ TEST_CASE("the commands outside the Design tab are the design's, under its headi
CHECK(heading_of("window_screenshot") == "Recordings, replays and scripts");
CHECK(heading_of("window_save_screenshot") == "Recordings, replays and scripts");
CHECK(heading_of("window_list") == "View and windows");
// undo and redo are a place's word of their own; a row's id and a word that is no place have none.
// undo and redo are a place's word of their own; a menu item's id and a word that is no place have none.
CHECK(heading_of("undo") == "The app");
CHECK(heading_of("obj_mirror_x") == "(none)");
CHECK(heading_of("objects_list") == "(none)");
@@ -511,7 +511,7 @@ TEST_CASE("every command that runs from arguments is in the tool list, by place"
else
unlisted.insert(c.key);
}
// The three menu rows with no argument form, which tool_search finds and tool_call runs.
// The three menu items with no argument form, which tool_search finds and tool_call runs.
CHECK(unlisted == std::set<std::string>{"window_save_screenshot", "script_toggle_panel", "settings_toggle_developer_mode"});
// Task 3's 98, the seven Parts 4a to 4c add, Part 5a's three, Part 5b's two, Part 5c's one and Part 5d's four.
CHECK(listed.size() == 115);
@@ -544,9 +544,9 @@ TEST_CASE("only deleting a preset and uninstalling a plugin are labelled destruc
"plate_get_settings", "project_get_settings", "plate_list", "object_list",
"window_screenshot", "plate_slice_stats", "script_search_api", "action_search",
"window_list", "widget_list", "printer_list_models", "plugin_list"};
// The commands made from menu rows whose row reaches a printer, the cloud account or the network.
const std::set<std::string> rows_reaching_out{"printer_send", "preset_sync", "filament_sync_ams",
"app_check_for_updates", "app_open_web_page", "plugin_refresh"};
// The commands made from menu items whose item reaches a printer, the cloud account or the network.
const std::set<std::string> menu_items_reaching_out{"printer_send", "preset_sync", "filament_sync_ams",
"app_check_for_updates", "app_open_web_page", "plugin_refresh"};
// The plugin commands that run a plugin's code or reach the cloud account: a plugin switched on or loaded again
// runs its code, a cloud plugin is downloaded, and Unsubscribe ends a subscription.
const std::set<std::string> plugins_reaching_out{"plugin_enable", "plugin_reload", "plugin_uninstall"};
@@ -566,7 +566,7 @@ TEST_CASE("only deleting a preset and uninstalling a plugin are labelled destruc
}
CHECK(destructive == std::set<std::string>{"preset_delete", "plugin_uninstall"});
CHECK(read_only == reads);
std::set<std::string> reaching_out = rows_reaching_out;
std::set<std::string> reaching_out = menu_items_reaching_out;
reaching_out.insert(plugins_reaching_out.begin(), plugins_reaching_out.end());
for (const std::string& key : reaching_out) {
INFO(key);
@@ -646,14 +646,14 @@ TEST_CASE("every key of the process catalog is unique, tools and commands togeth
INFO(c.key);
CHECK(keys.insert(c.key).second);
}
// The commands made from menu rows and the typed tools are both there.
// The commands made from menu items and the typed tools are both there.
CHECK(keys.count("object_mirror") == 1);
CHECK(keys.count("app_state") == 1);
}
TEST_CASE("the typed tools are listed and the merged commands are both", "[CommandCatalog]")
{
// A tool whose row is an item of its tiles, with the row's title, section and icon.
// A tool whose menu item is one of its tiles, with the item's title, section and icon.
for (const auto& [key, tile_key, title] : {std::make_tuple("project_new", "new_project", "New Project"),
std::make_tuple("project_save", "save_project", "Save Project"),
std::make_tuple("recording_start", "start_recording", "Start Recording"),
@@ -676,17 +676,17 @@ TEST_CASE("the typed tools are listed and the merged commands are both", "[Comma
CHECK(tool->listed);
CHECK_FALSE(tool->in_palette);
// A command made from menu rows is listed too, as it runs from its arguments: its rows are its tiles.
const NativeCommand* rows = NativeCommands::find("object_mirror");
REQUIRE(rows != nullptr);
CHECK(rows->listed);
CHECK_FALSE(rows->in_palette);
CHECK(rows->tiles.size() == 3);
// A command made from menu items is listed too, as it runs from its arguments: its menu items are its tiles.
const NativeCommand* menu_items = NativeCommands::find("object_mirror");
REQUIRE(menu_items != nullptr);
CHECK(menu_items->listed);
CHECK_FALSE(menu_items->in_palette);
CHECK(menu_items->tiles.size() == 3);
}
TEST_CASE("the palette's tiles are under the rows' keys, not the tools' names", "[CommandCatalog]")
TEST_CASE("the palette's tiles are under the menu items' keys, not the tools' names", "[CommandCatalog]")
{
// Every tile of the Speed Dial by its key: a typed tool is there only through its rows' tiles.
// Every tile of the Speed Dial by its key: a typed tool is there only through its menu items' tiles.
const std::set<std::string> tiles{
"add_handy_3dbenchy", "add_handy_autodesk_fdm_test", "add_handy_cali_cat", "add_handy_orca_badge",
"add_handy_orca_cube", "add_handy_orca_string_hell", "add_handy_orca_tolerance_test", "add_handy_orcasliced_combo",
@@ -779,7 +779,7 @@ TEST_CASE("a merged command's call with a tile's arguments is the person's form"
CHECK(given.data["tool"] == true);
}
TEST_CASE("a pick of a tile whose row and tool are one function runs it in place, and a call runs the tool", "[CommandCatalog]")
TEST_CASE("a pick of a tile whose menu item and tool are one function runs it in place, and a call runs the tool", "[CommandCatalog]")
{
int tool_calls = 0;
json person_args = json::array(); // what each run of the shared function for a pick was given
@@ -787,26 +787,26 @@ TEST_CASE("a pick of a tile whose row and tool are one function runs it in place
++tool_calls;
return ToolResult::ok({{"tool", true}});
});
tool.tiles = json::array({NativeCommands::tile("k_row", "Row", "View", "", {{"row", true}}, "The row's function."),
tool.tiles = json::array({NativeCommands::tile("k_item", "Item", "View", "", {{"item", true}}, "The menu item's function."),
NativeCommands::tile("k_tool", "Tool", "View", "", {{"camera", "top"}}, "The tool's function."),
NativeCommands::tile("k_input", "Input", "View", "", json::object(), "A value it collects.", "percent",
"level")});
const NativeCommand merged = NativeCommands::with_row_forms(
const NativeCommand merged = NativeCommands::with_menu_item_forms(
tool,
[&person_args](const json& tile_args) {
person_args.push_back(tile_args);
return AppActionRunResult{AppActionRunResult::Level::Succeeded};
},
/*person_form_behind_dialogs=*/false, std::vector<json>{json{{"camera", "top"}}});
// The row's tile and the tool's are person's forms of the command; the tile that collects a value is not.
CHECK(Mcp::person_form(merged, {{"row", true}}));
// The menu item's tile and the tool's are person's forms of the command; the tile that collects a value is not.
CHECK(Mcp::person_form(merged, {{"item", true}}));
CHECK(Mcp::person_form(merged, {{"camera", "top"}}));
CHECK_FALSE(Mcp::person_form(merged, {{"level", 50}}));
// An automated call: the row's tile runs the row, the tool's own form and the input tile's call run the tool.
// An automated call: the menu item's tile runs the item, the tool's own form and the input tile's call run the tool.
TestContext agent;
merged.run({{"row", true}}, agent);
CHECK(person_args == json::array({{{"row", true}}}));
merged.run({{"item", true}}, agent);
CHECK(person_args == json::array({{{"item", true}}}));
CHECK(merged.run({{"camera", "top"}}, agent).data["tool"] == true);
CHECK(merged.run({{"level", 50}}, agent).data["tool"] == true);
CHECK(tool_calls == 2);
@@ -820,7 +820,7 @@ TEST_CASE("a pick of a tile whose row and tool are one function runs it in place
REQUIRE(picked.notice != nullptr);
CHECK(picked.notice->level == AppActionRunResult::Level::Succeeded);
merged.run({{"level", 50}}, person);
CHECK(person_args == json::array({{{"row", true}}, {{"camera", "top"}}, {{"level", 50}}}));
CHECK(person_args == json::array({{{"item", true}}, {{"camera", "top"}}, {{"level", 50}}}));
CHECK(person.submitted.empty());
CHECK(tool_calls == 2);
// Any other call of a person is the tool's, which a long command starts as a job.
@@ -898,11 +898,11 @@ TEST_CASE("the catalog needs no runtime", "[CommandCatalog]")
CHECK(names.count("app_state") == 1);
CHECK(names.count("tool_call") == 1);
CHECK(names.count("object_mirror") == 1);
// A menu row with no argument form is not.
// A menu item with no argument form is not.
CHECK(names.count("settings_toggle_developer_mode") == 0);
}
TEST_CASE("a command made from menu rows is found by the one lookup", "[CommandCatalog]")
TEST_CASE("a command made from menu items is found by the one lookup", "[CommandCatalog]")
{
const CommandCatalog& catalog = NativeCommands::instance();
CHECK(catalog.lookup("object_mirror") != nullptr);
+116 -116
View File
@@ -240,11 +240,11 @@ std::vector<GUI::OfferSel> reported_kinds(bool sketching)
return {S::None, S::FacePlanar, S::FaceCyl, S::FaceOther, S::EdgeStr, S::EdgeCirc, S::Vertex, S::BodySolid, S::BodySheet, S::SkLoop};
}
// The id of the row a call of `entry`'s command with `args` opens, or "" when the call runs.
// The id of the item a call of `entry`'s command with `args` opens, or "" when the call runs.
std::string opened_id(const GUI::DesignTool& entry, const json& args)
{
const GUI::DesignTool* row = GUI::Mcp::opened_row(entry, args);
return row != nullptr ? row->id : "";
const GUI::DesignTool* item = GUI::Mcp::opened_item(entry, args);
return item != nullptr ? item->id : "";
}
// Whether a param by this name takes face or edge ids.
@@ -276,15 +276,15 @@ struct JournalContext final : GUI::ToolContext
};
// An id of the Design commands' old vocabulary, which names no command, and whether its entry stays in the
// Design table as a menu row.
// Design table as a menu item.
struct Retired
{
const char* id;
bool row;
bool menu_item;
};
// Ids of the old vocabulary: entries renamed, rows merged with the argument command for their job, the entry that
// did two jobs, and rows folded into their command.
// Ids of the old vocabulary: entries renamed, menu items merged with the argument command for their job, the entry that
// did two jobs, and items folded into their command.
const Retired kRetired[] = {
// Renamed.
{"describe_scene", false}, {"describe_feature", false}, {"query_topology", false}, {"slice_body", false},
@@ -295,7 +295,7 @@ const Retired kRetired[] = {
{"coordsys_v", false}, {"rename", false}, {"zoom_to", false}, {"constrain", false}, {"sk_poly_inscribed", false},
{"sk_poly_circumscribed", false}, {"sk_text", false}, {"sk_svg", false}, {"sk_dimension", false},
{"sk_extend", false}, {"mate", false},
// A row and its argument command, merged.
// A menu item and its argument command, merged.
{"sketch", false}, {"sketch_begin", false}, {"cut", false}, {"delete", false}, {"delete_body", false},
{"sk_offset", false}, {"sk_trim", false}, {"sk_fillet", false}, {"sk_chamfer", false}, {"sk_mirror", false},
{"sk_construct", false}, {"sketch_construction", false}, {"sk_delete", false}, {"sk_constrain", false},
@@ -313,13 +313,13 @@ const Retired kRetired[] = {
{"sk_poly_5", true}, {"sk_polygon", true}, {"sk_poly_8", true}, {"sk_poly_12", true}, {"sk_polyline", true},
{"sk_rect_center", true}, {"sk_rect_oblique", true}, {"sk_rect_rounded", true}, {"sk_circle_2pt", true},
{"sk_circle_3pt", true}, {"sk_arc_t", true}, {"sk_arc_tangent", true}, {"sk_slot_arc", true},
// pattern's type curve: the row stays, greyed.
// pattern's type curve: the item stays, greyed.
{"pat_curve", true},
};
} // namespace
TEST_CASE("the CAD commands are the Design table's entries but its greyed and folded rows", "[Mcp][CAD]")
TEST_CASE("the CAD commands are the Design table's entries but its greyed and folded items", "[Mcp][CAD]")
{
const GUI::CommandCatalog catalog = cad_catalog();
std::set<std::string> keys;
@@ -328,7 +328,7 @@ TEST_CASE("the CAD commands are the Design table's entries but its greyed and fo
CHECK(keys.insert(c.key).second);
CHECK(c.group == "Design");
CHECK_FALSE(c.listed);
// Its title is the row's name, the one the right-click menu and its tile show.
// Its title is the item's name, the one the right-click menu and its tile show.
CHECK(c.title == design_row(c.key).name);
}
CHECK(keys.size() == 88);
@@ -353,11 +353,11 @@ TEST_CASE("a name of the old vocabulary is no command", "[Mcp][CAD]")
CHECK(listed.insert(retired.id).second);
CHECK(catalog.find(retired.id) == nullptr);
const GUI::DesignTool* entry = GUI::Mcp::find_design_tool(retired.id);
if (!retired.row) {
if (!retired.menu_item) {
CHECK(entry == nullptr);
continue;
}
// A row that stays keeps its entry and its place in the menu, and is no command.
// An item that stays keeps its entry and its place in the menu, and is no command.
REQUIRE(entry != nullptr);
CHECK(entry->row != -1);
}
@@ -365,7 +365,7 @@ TEST_CASE("a name of the old vocabulary is no command", "[Mcp][CAD]")
CHECK(std::size(kRetired) == 89);
}
TEST_CASE("a menu row and the command that runs its job are one command", "[Mcp][CAD]")
TEST_CASE("a menu item and the command that runs its job are one command", "[Mcp][CAD]")
{
const GUI::CommandCatalog catalog = cad_catalog();
for (const char* key : {"sketch_create", "split", "feature_delete", "body_delete", "sketch_offset", "sketch_trim",
@@ -382,14 +382,14 @@ TEST_CASE("a menu row and the command that runs its job are one command", "[Mcp]
}
}
TEST_CASE("a renamed entry keeps its row", "[Mcp][CAD]")
TEST_CASE("a renamed entry keeps its menu item", "[Mcp][CAD]")
{
const GUI::CommandCatalog catalog = cad_catalog();
const GUI::DesignTool& plane = design_row("construct_plane");
REQUIRE(plane.key != nullptr);
CHECK(std::string(plane.key) == "Shift+P");
CHECK(std::string(plane.action) == "key:S+P");
// The mate command takes the id align; the unbuilt Align to row stays, greyed, as align_to.
// The mate command takes the id align; the unbuilt Align to item stays, greyed, as align_to.
const GUI::DesignTool& align = design_row("align");
REQUIRE(align.action != nullptr);
CHECK(std::string(align.action) == "fly:placement#2");
@@ -399,7 +399,7 @@ TEST_CASE("a renamed entry keeps its row", "[Mcp][CAD]")
CHECK(align_to.action == nullptr);
CHECK(align_to.doc == nullptr);
CHECK(catalog.find("align_to") == nullptr);
// split takes the Cut card as its row, and the greyed Split row goes.
// split takes the Cut card as its menu item, and the greyed Split item goes.
const GUI::DesignTool& split = design_row("split");
REQUIRE(split.action != nullptr);
CHECK(std::string(split.action) == "key:S+X");
@@ -455,7 +455,7 @@ TEST_CASE("every block has a silent function and every silent function a block",
CHECK(blocks == functions);
}
TEST_CASE("a row with no slot is in no menu row", "[Mcp][CAD]")
TEST_CASE("a row with no slot has no menu item", "[Mcp][CAD]")
{
std::size_t commands_only = 0;
for (int i = 0; i < GUI::kDesignToolCount; ++i) {
@@ -502,15 +502,15 @@ TEST_CASE("a command has silent when a call with no arguments opens a tool", "[M
INFO(c.key);
const GUI::DesignTool& entry = design_row(c.key);
if (entry.doc != nullptr)
CHECK(two_forms(c) == (GUI::Mcp::opened_row(entry, json::object()) != nullptr));
// A command that has a tile is the one whose entry has an action, and it carries the row's icon.
CHECK(two_forms(c) == (GUI::Mcp::opened_item(entry, json::object()) != nullptr));
// A command that has a tile is the one whose entry has an action, and it carries the item's icon.
CHECK(c.in_palette == (entry.action != nullptr));
CHECK(c.icon == (entry.icon != nullptr ? entry.icon : ""));
// A tile with no icon would be a blank square in the Speed Dial.
if (c.in_palette)
CHECK_FALSE(c.icon.empty());
}
// Their rows are folded into them, and their tiles are the rows'.
// Their items are folded into them, and their tiles are the items'.
for (const char* key : {"body_set", "sketch_set_value"}) {
INFO(key);
CHECK(two_forms(command_of(catalog, key)));
@@ -525,62 +525,62 @@ TEST_CASE("a command has silent when a call with no arguments opens a tool", "[M
CHECK(GUI::Mcp::argument_error(command_of(catalog, "sketch_polygon_inscribed"), none).empty());
}
TEST_CASE("a folded row is no command, and its command opens it", "[Mcp][CAD]")
TEST_CASE("a folded item is no command, and its command opens it", "[Mcp][CAD]")
{
const GUI::CommandCatalog catalog = cad_catalog();
std::size_t folded = 0;
std::set<std::string> commands;
for (int i = 0; i < GUI::kDesignToolCount; ++i) {
const GUI::DesignTool& row = GUI::kDesignTools[i];
if (row.fold_into == nullptr)
const GUI::DesignTool& item = GUI::kDesignTools[i];
if (item.fold_into == nullptr)
continue;
INFO(row.id);
INFO(item.id);
++folded;
commands.insert(row.fold_into);
CHECK(catalog.find(row.id) == nullptr);
CHECK_FALSE(GUI::Mcp::is_design_command(row));
const GUI::NativeCommand& command = command_of(catalog, row.fold_into);
CHECK_THAT(command.description, ContainsSubstring(row.name));
// The call with the row's arguments is one its command takes, and it opens the row's tool.
REQUIRE(row.args != nullptr);
json args = json::parse(row.args);
commands.insert(item.fold_into);
CHECK(catalog.find(item.id) == nullptr);
CHECK_FALSE(GUI::Mcp::is_design_command(item));
const GUI::NativeCommand& command = command_of(catalog, item.fold_into);
CHECK_THAT(command.description, ContainsSubstring(item.name));
// The call with the item's arguments is one its command takes, and it opens the item's tool.
REQUIRE(item.args != nullptr);
json args = json::parse(item.args);
CHECK(GUI::Mcp::argument_error(command, args).empty());
const GUI::DesignTool* entry = GUI::Mcp::find_design_tool(row.fold_into);
const GUI::DesignTool* entry = GUI::Mcp::find_design_tool(item.fold_into);
REQUIRE(entry != nullptr);
const GUI::DesignTool* opened = GUI::Mcp::opened_row(*entry, args);
const GUI::DesignTool* opened = GUI::Mcp::opened_item(*entry, args);
REQUIRE(opened != nullptr);
REQUIRE(opened->action != nullptr);
CHECK(std::string(opened->action) == row.action);
CHECK(std::string(opened->action) == item.action);
}
// The Color row, into body_set; the three value rows, into sketch_set_value; Subtract and Intersect, into
// The Color item, into body_set; the three value items, into sketch_set_value; Subtract and Intersect, into
// boolean; Thicken Surface, into thicken; Circular pattern, into pattern; the two arrays, into sketch_pattern;
// Move, Rotate and Scale, into sketch_transform; the twenty-four drawing rows, into sketch_draw.
// Move, Rotate and Scale, into sketch_transform; the twenty-four drawing items, into sketch_draw.
CHECK(folded == 37);
CHECK(commands.size() == 8);
}
TEST_CASE("a call opens a tool only with the arguments that choose it", "[Mcp][CAD]")
{
// body_set's Color row opens with no arguments, and any argument runs the command.
// body_set's Color item opens with no arguments, and any argument runs the command.
const GUI::DesignTool& body_set = design_row("body_set");
const GUI::DesignTool* colour = GUI::Mcp::opened_row(body_set, json::object());
const GUI::DesignTool* colour = GUI::Mcp::opened_item(body_set, json::object());
REQUIRE(colour != nullptr);
CHECK(std::string(colour->id) == "colour");
CHECK(GUI::Mcp::opened_row(body_set, json()) == colour);
CHECK(GUI::Mcp::opened_item(body_set, json()) == colour);
for (const json& runs : {json{{"body", 0}}, json{{"silent", true}}, json{{"generation", 1}}}) {
INFO(runs.dump());
CHECK(GUI::Mcp::opened_row(body_set, runs) == nullptr);
CHECK(GUI::Mcp::opened_item(body_set, runs) == nullptr);
}
// sketch_set_value's three value rows are one action.
const GUI::DesignTool* value = GUI::Mcp::opened_row(design_row("sketch_set_value"), json::object());
// sketch_set_value's three value items are one action.
const GUI::DesignTool* value = GUI::Mcp::opened_item(design_row("sketch_set_value"), json::object());
REQUIRE(value != nullptr);
REQUIRE(value->action != nullptr);
CHECK(std::string(value->action) == "key:V");
// A command with a row of its own opens it; one with no row and none folded into it opens nothing.
// A command with a menu item of its own opens it; one with no menu item and none folded into it opens nothing.
const GUI::DesignTool& trim = design_row("sketch_trim");
CHECK(GUI::Mcp::opened_row(trim, json::object()) == &trim);
CHECK(GUI::Mcp::opened_row(design_row("sketch_draw"), json::object()) == nullptr);
// boolean's own row, Join, opens with no arguments and with its own; each operation opens the row that does it,
CHECK(GUI::Mcp::opened_item(trim, json::object()) == &trim);
CHECK(GUI::Mcp::opened_item(design_row("sketch_draw"), json::object()) == nullptr);
// boolean's own item, Join, opens with no arguments and with its own; each operation opens the item that does it,
// and anything beside the operation runs the command.
const GUI::DesignTool& boolean = design_row("boolean");
CHECK(opened_id(boolean, json::object()) == "boolean");
@@ -589,14 +589,14 @@ TEST_CASE("a call opens a tool only with the arguments that choose it", "[Mcp][C
CHECK(opened_id(boolean, {{"operation", "intersect"}}) == "bool_intersect");
CHECK(opened_id(boolean, {{"operation", "cut"}, {"target", 0}}).empty());
CHECK(opened_id(boolean, {{"operation", "cut"}, {"silent", true}}).empty());
// pattern's own row is the linear one and Circular pattern is folded into it; a curve pattern has no row.
// pattern's own item is the linear one and Circular pattern is folded into it; a curve pattern has no item.
const GUI::DesignTool& pattern = design_row("pattern");
CHECK(opened_id(pattern, json::object()) == "pattern");
CHECK(opened_id(pattern, {{"type", "linear"}}) == "pattern");
CHECK(opened_id(pattern, {{"type", "circular"}}) == "pattern_circular");
CHECK(opened_id(pattern, {{"type", "curve"}}).empty());
CHECK(opened_id(design_row("thicken"), {{"type", "surface"}}) == "thicken_surf");
// A sketch command with no row of its own opens a folded row only with its type, and nothing with no arguments.
// A sketch command with no menu item of its own opens a folded item only with its type, and nothing with no arguments.
const GUI::DesignTool& sketch_pattern = design_row("sketch_pattern");
CHECK(opened_id(sketch_pattern, {{"type", "linear"}}) == "sk_array");
CHECK(opened_id(sketch_pattern, {{"type", "circular"}}) == "sk_array_polar");
@@ -605,7 +605,7 @@ TEST_CASE("a call opens a tool only with the arguments that choose it", "[Mcp][C
const GUI::DesignTool& sketch_transform = design_row("sketch_transform");
CHECK(opened_id(sketch_transform, {{"type", "scale"}}) == "sk_scale");
CHECK(opened_id(sketch_transform, json::object()).empty());
// sketch_draw opens a drawing row with the row's type alone, a polygon row with its sides too; a type with its
// sketch_draw opens a drawing item with the item's type alone, a polygon item with its sides too; a type with its
// shape's fields draws it.
const GUI::DesignTool& sketch_draw = design_row("sketch_draw");
CHECK(opened_id(sketch_draw, {{"type", "circle_center"}}) == "sk_circle");
@@ -614,12 +614,12 @@ TEST_CASE("a call opens a tool only with the arguments that choose it", "[Mcp][C
CHECK(opened_id(sketch_draw, {{"type", "circle_center"}, {"center", {0, 0}}, {"radius", 1}}).empty());
CHECK(opened_id(sketch_draw, {{"type", "rectangle_rounded"}}) == "sk_rect_rounded");
CHECK(opened_id(sketch_draw, {{"type", "arc_3_point"}}) == "sk_arc_t");
// The Extend and Dimension rows are their commands' own.
// The Extend and Dimension items are their commands' own.
CHECK(opened_id(design_row("sketch_extend"), json::object()) == "sketch_extend");
CHECK(opened_id(design_row("sketch_dimension"), json::object()) == "sketch_dimension");
}
TEST_CASE("a folded row opens only in its own mode", "[Mcp][CAD]")
TEST_CASE("a folded item opens only in its own mode", "[Mcp][CAD]")
{
const GUI::DesignTool& colour = design_row("colour");
const std::optional<GUI::ToolFailure> in_sketch = GUI::Mcp::open_refusal(colour, true, int(GUI::OfferSel::SkNone));
@@ -630,7 +630,7 @@ TEST_CASE("a folded row opens only in its own mode", "[Mcp][CAD]")
const std::optional<GUI::ToolFailure> nothing = GUI::Mcp::open_refusal(colour, false, int(GUI::OfferSel::None));
REQUIRE(nothing.has_value());
CHECK(std::string(nothing->what()) == "This tool does not apply to what is selected");
// The command's silent says the mode of the row a call with no arguments opens.
// The command's silent says the mode of the item a call with no arguments opens.
const GUI::CommandCatalog catalog = cad_catalog();
CHECK_THAT(property_of(command_of(catalog, "sketch_set_value"), "silent").value("description", std::string()),
ContainsSubstring("Called with no arguments, it runs only in an open sketch"));
@@ -700,7 +700,7 @@ TEST_CASE("a Design command is named by its verb's id", "[Mcp][CAD]")
}
}
TEST_CASE("a Design command carries its row's icon", "[Mcp][CAD]")
TEST_CASE("a Design command carries its menu item's icon", "[Mcp][CAD]")
{
const GUI::CommandCatalog catalog = cad_catalog();
CHECK(command_of(catalog, "sketch_create").icon == "design_sketch");
@@ -719,7 +719,7 @@ TEST_CASE("a Design command carries its row's icon", "[Mcp][CAD]")
TEST_CASE("the Design tiles' icons resolve to shipped SVGs", "[Mcp][CAD][SpeedDial]")
{
// An icon comes from a hand-edited atlas row, so a typo would be a blank tile and a blank menu row.
// An icon comes from a hand-edited atlas row, so a typo would be a blank tile and a blank menu item.
const boost::filesystem::path images = boost::filesystem::path(PROFILES_DIR).parent_path() / "images";
const GUI::CommandCatalog catalog = catalog_with_cad();
std::size_t tiles = 0;
@@ -741,14 +741,14 @@ TEST_CASE("the Design tiles' icons resolve to shipped SVGs", "[Mcp][CAD][SpeedDi
++tiles;
}
}
// One per entry with an action: the 52 commands' own and the 37 folded rows'.
// One per entry with an action: the 52 commands' own and the 37 folded items'.
CHECK(tiles == 89);
}
TEST_CASE("a tool refused for the selection says it does not apply and what it takes", "[Mcp][CAD]")
{
// Delete Face takes a picked face. With nothing picked, the obstacle is the selection, not the document its
// row's refusal speaks of.
// item's refusal speaks of.
const GUI::DesignTool& delete_face = design_row("delete_face");
const int none = int(GUI::OfferSel::None);
const std::optional<GUI::ToolFailure> refused = GUI::Mcp::open_refusal(delete_face, false, none);
@@ -759,8 +759,8 @@ TEST_CASE("a tool refused for the selection says it does not apply and what it t
CHECK(refused->details.at("selection") == "none");
CHECK(refused->details.at("accepts") == json::array({"face_planar", "face_cyl", "face_other"}));
CHECK_FALSE(GUI::Mcp::open_refusal(delete_face, false, int(GUI::OfferSel::FacePlanar)).has_value());
// Every row only the menu reaches says the same for a selection the tab reports in the row's mode and the row
// does not take. A row that takes none of those is never greyed for the selection there, and opens whatever is
// Every item only the menu reaches says the same for a selection the tab reports in the item's mode and the item
// does not take. An item that takes none of those is never greyed for the selection there, and opens whatever is
// selected.
std::size_t greyed = 0, never_greyed = 0;
for (int i = 0; i < GUI::kDesignToolCount; ++i) {
@@ -790,10 +790,10 @@ TEST_CASE("a tool refused for the selection says it does not apply and what it t
CHECK_FALSE(GUI::Mcp::open_refusal(design_row("shell"), false, int(GUI::OfferSel::None)).has_value());
}
TEST_CASE("a row for a selection the tab never reports opens as its button does", "[Mcp][CAD]")
TEST_CASE("a menu item for a selection the tab never reports opens as its button does", "[Mcp][CAD]")
{
// Boolean's three rows take two bodies and Rib a sketch line, which the model never reports as the selection:
// their toolbar buttons open the card with nothing selected, and so do the rows.
// Boolean's three items take two bodies and Rib a sketch line, which the model never reports as the selection:
// their toolbar buttons open the card with nothing selected, and so do the items.
for (const char* id : {"boolean", "bool_subtract", "bool_intersect", "rib"}) {
INFO(id);
CHECK_FALSE(GUI::Mcp::open_refusal(design_row(id), false, int(GUI::OfferSel::None)).has_value());
@@ -805,7 +805,7 @@ TEST_CASE("a row for a selection the tab never reports opens as its button does"
CHECK(std::string(refused->what()) == "This tool does not apply to what is selected");
}
TEST_CASE("the rows that act on the Feature list's row are not refused for the selection when a call targets that row", "[Mcp][CAD]")
TEST_CASE("the menu items that act on the Feature list's row are not refused for the selection when a call targets that row", "[Mcp][CAD]")
{
const std::set<std::string> feature_rows = {"feature_edit", "rename_selected", "feature_delete", "sketch_constrain_selected"};
for (int i = 0; i < GUI::kDesignToolCount; ++i) {
@@ -821,21 +821,21 @@ TEST_CASE("the rows that act on the Feature list's row are not refused for the s
REQUIRE(refused.has_value());
CHECK(std::string(refused->what()) == "This tool does not apply to what is selected");
CHECK_FALSE(GUI::Mcp::open_refusal(design_row(id), false, none, true).has_value());
// Still only in the mode its row belongs to.
// Still only in the mode its item belongs to.
CHECK(GUI::Mcp::open_refusal(design_row(id), true, int(GUI::OfferSel::SkNone), true).has_value());
}
// Zoom to selection frames what is picked in the view, so a Feature list row is nothing to it.
CHECK(GUI::Mcp::open_refusal(design_row("zoom_to_selection"), false, none).has_value());
CHECK(GUI::Mcp::open_refusal(design_row("zoom_to_selection"), false, none, true).has_value());
// A pick in the view, a card's included, is checked against the row's accepts.
// A pick in the view, a card's included, is checked against the item's accepts.
CHECK(GUI::Mcp::open_refusal(design_row("rename_selected"), false, int(GUI::OfferSel::FacePlanar)).has_value());
}
TEST_CASE("a Design tool opens only in the mode its row belongs to", "[Mcp][CAD]")
TEST_CASE("a Design tool opens only in the mode its menu item belongs to", "[Mcp][CAD]")
{
const std::string in_sketch = "This tool works in a sketch: open a sketch first";
const std::string on_model = "This tool works on the model: finish or cancel the sketch first";
std::size_t sketch_rows = 0, model_rows = 0;
std::size_t sketch_items = 0, model_items = 0;
for (int i = 0; i < GUI::kDesignToolCount; ++i) {
const GUI::DesignTool& t = GUI::kDesignTools[i];
if (t.action == nullptr)
@@ -852,10 +852,10 @@ TEST_CASE("a Design tool opens only in the mode its row belongs to", "[Mcp][CAD]
CHECK(refused->details.at("code") == -32000);
CHECK(refused->details.at("mode") == (t.sketch_mode ? "sketch" : "model"));
}
++(t.sketch_mode ? sketch_rows : model_rows);
++(t.sketch_mode ? sketch_items : model_items);
}
CHECK(sketch_rows == 46);
CHECK(model_rows == 43);
CHECK(sketch_items == 46);
CHECK(model_items == 43);
// Shell opens on the model whatever is picked, and never over an open sketch.
CHECK_FALSE(GUI::Mcp::open_refusal(design_row("shell"), false, int(GUI::OfferSel::None)).has_value());
CHECK(GUI::Mcp::open_refusal(design_row("shell"), true, int(GUI::OfferSel::SkNone)).has_value());
@@ -866,15 +866,15 @@ TEST_CASE("a pinned Design tile stays pinned while its tile is not shown", "[Mcp
{
CHECK(GUI::is_design_tile_id("orca_command:shell:orca"));
CHECK(GUI::is_design_tile_id("orca_command:sk_rect:orca"));
CHECK(GUI::is_design_tile_id("orca_command:sk_array:orca")); // a folded row's, which runs sketch_pattern
CHECK(GUI::is_design_tile_id("orca_command:sk_array:orca")); // a folded item's, which runs sketch_pattern
CHECK_FALSE(GUI::is_design_tile_id("orca_command:describe_design:orca")); // a Design command with no tile
CHECK_FALSE(GUI::is_design_tile_id("orca_command:align_to:orca")); // an entry with no command
CHECK_FALSE(GUI::is_design_tile_id("orca_command:sk_trim:orca")); // no entry's: the Trim row is sketch_trim's
CHECK_FALSE(GUI::is_design_tile_id("orca_command:sk_trim:orca")); // no entry's: the Trim item is sketch_trim's
CHECK_FALSE(GUI::is_design_tile_id("orca_command:save_project:orca"));
CHECK_FALSE(GUI::is_design_tile_id("orca_plate_goto:shell:orca"));
CHECK_FALSE(GUI::is_design_tile_id("shell"));
// On the Prepare tab no Design tile is live, and the third plate is gone. A pin under an id no entry has, as
// the Trim row's tile had before it took sketch_trim's key, has no live action either: it is dropped, and the
// the Trim item's tile had before it took sketch_trim's key, has no live action either: it is dropped, and the
// pins on either side of it stay.
const std::string shell = "orca_command:shell:orca", rect = "orca_command:sk_rect:orca";
const std::string array = "orca_command:sk_array:orca", trim = "orca_command:sk_trim:orca";
@@ -922,7 +922,7 @@ TEST_CASE("the Design tab's tiles are its mode's tools, and none with the CAD fe
INFO(id);
const GUI::DesignTool& entry = design_row(id);
if (entry.fold_into != nullptr) {
// A folded row's tile runs the command it is folded into with the row's arguments.
// A folded item's tile runs the command it is folded into with the item's arguments.
REQUIRE(tile.tile != nullptr);
CHECK(tile.command->key == entry.fold_into);
CHECK(tile.tile->at("args") == json::parse(entry.args));
@@ -947,14 +947,14 @@ TEST_CASE("the Design tab's tiles are its mode's tools, and none with the CAD fe
}
}
TEST_CASE("a folded row's tile runs its command with the row's arguments", "[Mcp][CAD][SpeedDial]")
TEST_CASE("a folded item's tile runs its command with the item's arguments", "[Mcp][CAD][SpeedDial]")
{
const GUI::CommandCatalog catalog = cad_catalog();
const GUI::NativeCommand& sketch_pattern = command_of(catalog, "sketch_pattern");
const auto [pattern_owner, array] = GUI::find_tile(catalog, "sk_array");
REQUIRE(pattern_owner == &sketch_pattern);
REQUIRE(array != nullptr);
// The Linear array row's tile, under the id it has had, titled and pictured as the row, in the tests' English UI.
// The Linear array item's tile, under the id it has had, titled and pictured as the item, in the tests' English UI.
const std::unique_ptr<GUI::AppAction> action = GUI::NativeCommands::make_action(sketch_pattern, *array);
REQUIRE(action != nullptr);
CHECK(action->id() == "orca_command:sk_array:orca");
@@ -967,16 +967,16 @@ TEST_CASE("a folded row's tile runs its command with the row's arguments", "[Mcp
CHECK(action->input_schema.at("properties").empty());
CHECK_THAT(action->automation_description, ContainsSubstring("Pick entities, drag the spacing handle"));
CHECK_THAT(action->automation_description, ContainsSubstring("It runs only in an open sketch"));
// An agent runs it with no arguments, or with exactly the row's.
// An agent runs it with no arguments, or with exactly the item's.
CHECK(GUI::Mcp::action_args_error(*action, json::object()).empty());
CHECK(GUI::Mcp::action_args_error(*action, {{"type", "linear"}}).empty());
CHECK_FALSE(GUI::Mcp::action_args_error(*action, {{"count", 3}}).empty());
CHECK_FALSE(GUI::Mcp::action_args_error(*action, {{"type", "circular"}}).empty());
// A call of the command with the row's arguments is titled as the row's tile; with any other, as the command.
// A call of the command with the item's arguments is titled as the item's tile; with any other, as the command.
CHECK(GUI::call_title(sketch_pattern, {{"type", "linear"}}) == "Linear array");
CHECK(GUI::call_title(sketch_pattern, {{"type", "linear"}, {"count", 3}}) == sketch_pattern.title);
// The Color row runs body_set with no arguments: its preset is an empty object, not null.
// The Color item runs body_set with no arguments: its preset is an empty object, not null.
const GUI::NativeCommand& body_set = command_of(catalog, "body_set");
const auto [colour_owner, colour_tile] = GUI::find_tile(catalog, "colour");
REQUIRE(colour_owner == &body_set);
@@ -986,7 +986,7 @@ TEST_CASE("a folded row's tile runs its command with the row's arguments", "[Mcp
CHECK(colour->preset.is_object());
CHECK(colour->preset.empty());
CHECK(GUI::call_title(body_set, json::object()) == "Color");
// The three value rows are one action under three labels, all with no arguments: a call with none is titled as
// The three value items are one action under three labels, all with no arguments: a call with none is titled as
// the first of them.
CHECK(GUI::call_title(command_of(catalog, "sketch_set_value"), json::object()) == "Length\xE2\x80\xA6");
@@ -998,7 +998,7 @@ TEST_CASE("a folded row's tile runs its command with the row's arguments", "[Mcp
CHECK(none == nullptr);
CHECK(none_tile == nullptr);
// Every tile's arguments are a call its command takes, and that call opens the tile's row.
// Every tile's arguments are a call its command takes, and that call opens the tile's item.
std::size_t tiles = 0;
for (const GUI::NativeCommand& c : catalog.commands()) {
if (c.tiles.is_null())
@@ -1009,21 +1009,21 @@ TEST_CASE("a folded row's tile runs its command with the row's arguments", "[Mcp
INFO(c.key << " / " << tile.at("key"));
json args = tile.at("args");
CHECK(GUI::Mcp::argument_error(c, args).empty());
const GUI::DesignTool* row = GUI::Mcp::opened_row(*entry, tile.at("args"));
REQUIRE(row != nullptr);
CHECK(std::string(row->action) == design_row(tile.at("key").get<std::string>()).action);
const GUI::DesignTool* item = GUI::Mcp::opened_item(*entry, tile.at("args"));
REQUIRE(item != nullptr);
CHECK(std::string(item->action) == design_row(tile.at("key").get<std::string>()).action);
++tiles;
}
}
CHECK(tiles == 37); // one per folded row
CHECK(tiles == 37); // one per folded item
}
TEST_CASE("the Action Replay window titles a step that calls a folded row's tile as that row", "[Mcp][CAD][SpeedDial]")
TEST_CASE("the Action Replay window titles a step that calls a folded item's tile as that item", "[Mcp][CAD][SpeedDial]")
{
const GUI::CommandCatalog catalog = cad_catalog();
const std::string pattern = command_of(catalog, "sketch_pattern").title;
const json step{{"kind", "command"}, {"key", "sketch_pattern"}};
// describe_step()'s `what` for a call of sketch_pattern with the Linear array row's arguments names the row's tile:
// describe_step()'s `what` for a call of sketch_pattern with the Linear array item's arguments names the item's tile:
// the window shows that tile's title, in the tests' English UI.
json tiled = step;
tiled["tile"] = "sk_array";
@@ -1049,7 +1049,7 @@ TEST_CASE("a Design command with a read block is read-only", "[Mcp][CAD]")
TEST_CASE("select_geometry selects in the model at rest, as a command that changes it", "[Mcp][CAD]")
{
// A command with no row of its own, under Document, with the access of one that edits, so that it is refused
// A command with no menu item of its own, under Document, with the access of one that edits, so that it is refused
// where a click means something else: under a card, a sketch, Constrain mode, a body Move or the Text dialog.
const GUI::DesignTool& entry = design_row("select_geometry");
CHECK(entry.access == GUI::CadAccess::Change);
@@ -1082,7 +1082,7 @@ TEST_CASE("select_geometry selects in the model at rest, as a command that chang
TEST_CASE("confirm_tool and cancel_tool act on what the tab has open, which only a rebuild refuses", "[Mcp][CAD]")
{
// Commands with no row of their own, under Document, with the access ui: what is open in the tab (a card, a
// Commands with no menu item of their own, under Document, with the access ui: what is open in the tab (a card, a
// sketch, a Move) refuses a command that changes the document, but these act on it. They commit or discard it, so
// neither is read-only.
const GUI::CommandCatalog catalog = cad_catalog();
@@ -1120,7 +1120,7 @@ TEST_CASE("confirm_tool and cancel_tool act on what the tab has open, which only
TEST_CASE("body_place places a body outside the history, under Bodies", "[Mcp][CAD]")
{
// A command with no row of its own, with the access of one that edits: where a body stands is refused under what a
// A command with no menu item of its own, with the access of one that edits: where a body stands is refused under what a
// click would feed, as the Move it does from arguments is.
const GUI::DesignTool& entry = design_row("body_place");
CHECK(entry.access == GUI::CadAccess::Change);
@@ -1522,15 +1522,15 @@ TEST_CASE("hole and pattern refuse an argument the type they are given does not
CHECK(doc.features[p].pattern_dir == 1);
}
TEST_CASE("a command's description gives each argument set that opens a tool once, with its rows' names", "[Mcp][CAD]")
TEST_CASE("a command's description gives each argument set that opens a tool once, with its items' names", "[Mcp][CAD]")
{
const GUI::CommandCatalog catalog = cad_catalog();
// The three value rows are one tool under three names, opened with no arguments.
// The three value items are one tool under three names, opened with no arguments.
const std::string& value = command_of(catalog, "sketch_set_value").description;
CHECK_THAT(value, ContainsSubstring(std::string(": {} (") + design_row("sk_length").name + ", " + design_row("sk_radius").name +
", " + design_row("sk_angdist").name + ")."));
CHECK(value.find("{}") == value.rfind("{}"));
// boolean's own row and the two folded into it, one argument set each.
// boolean's own item and the two folded into it, one argument set each.
CHECK_THAT(command_of(catalog, "boolean").description,
ContainsSubstring(": {\"operation\":\"join\"} (Join), {\"operation\":\"cut\"} (Subtract), "
"{\"operation\":\"intersect\"} (Intersect)."));
@@ -1550,7 +1550,7 @@ TEST_CASE("a CAD command's summary is one sentence of at most 120 characters", "
CHECK_THAT(command_of(catalog, "sketch_transform").description, ContainsSubstring("pivot"));
CHECK_THAT(command_of(catalog, "shell").description, ContainsSubstring("ok is false"));
CHECK_THAT(command_of(catalog, "extrude").description, !ContainsSubstring("ok is false"));
// One with an action only does what its row does, which for Zoom to selection is to act at once.
// One with an action only does what its menu item does, which for Zoom to selection is to act at once.
CHECK_THAT(command_of(catalog, "zoom_to_selection").description, ContainsSubstring("act at once"));
CHECK_THAT(command_of(catalog, "zoom_to_selection").description, !ContainsSubstring("opens the tool"));
}
@@ -1561,17 +1561,17 @@ TEST_CASE("a Design command with a person's form says which mode it runs in", "[
const GUI::CommandCatalog catalog = cad_catalog();
std::size_t told = 0;
for (const GUI::NativeCommand& c : catalog.commands()) {
const GUI::DesignTool& row = design_row(c.key);
if (row.action == nullptr)
const GUI::DesignTool& item = design_row(c.key);
if (item.action == nullptr)
continue;
INFO(c.key);
// An action only: its description says it of the command, which takes no arguments. Both forms: the `silent`
// property says it of the call with no arguments, whose row's mode the argument form need not share.
const bool both = row.doc != nullptr;
// property says it of the call with no arguments, whose item's mode the argument form need not share.
const bool both = item.doc != nullptr;
const std::string text = both ? property_of(c, "silent").value("description", std::string()) : c.description;
const std::string lead = both ? "Called with no arguments, it " : "It ";
CHECK_THAT(text, ContainsSubstring(lead + (row.sketch_mode ? in_sketch : outside)));
CHECK_THAT(text, !ContainsSubstring(row.sketch_mode ? outside : in_sketch));
CHECK_THAT(text, ContainsSubstring(lead + (item.sketch_mode ? in_sketch : outside)));
CHECK_THAT(text, !ContainsSubstring(item.sketch_mode ? outside : in_sketch));
if (both)
CHECK_THAT(text, !ContainsSubstring("It runs only"));
++told;
@@ -1581,7 +1581,7 @@ TEST_CASE("a Design command with a person's form says which mode it runs in", "[
CHECK_THAT(command_of(catalog, "zoom_to_selection").description, ContainsSubstring("It " + outside));
CHECK_THAT(property_of(command_of(catalog, "shell"), "silent").value("description", std::string()),
ContainsSubstring("opens nothing"));
// The argument forms of these run where their row does not: the note says which call it is about.
// The argument forms of these run where their menu item does not: the note says which call it is about.
for (const char* key : {"sketch_text", "sketch_insert_svg", "sketch_project", "body_mass_properties", "interference"}) {
INFO(key);
CHECK_THAT(property_of(command_of(catalog, key), "silent").value("description", std::string()),
@@ -1672,7 +1672,7 @@ TEST_CASE("the Design commands are the design's 88, under its headings", "[Mcp][
{"History",
{"feature_describe", "feature_edit", "feature_set_expression", "feature_suppress", "feature_move", "feature_rename",
"feature_delete"}},
{"Menu rows",
{"Menu items",
{"rename_selected", "zoom_to_selection", "sketch_polygon_inscribed", "sketch_polygon_circumscribed",
"sketch_constrain_selected"}},
};
@@ -1689,16 +1689,16 @@ TEST_CASE("the Design commands are the design's 88, under its headings", "[Mcp][
REQUIRE(t.section != nullptr);
table[t.section].insert(id);
++commands;
// A command that only does what its menu row does is one of the menu rows.
const bool row_only = t.action != nullptr && t.doc == nullptr;
CHECK(row_only == (std::string(t.section) == "Menu rows"));
// A command that only does what its menu item does is one of the menu items.
const bool item_only = t.action != nullptr && t.doc == nullptr;
CHECK(item_only == (std::string(t.section) == "Menu items"));
}
CHECK(table == design);
CHECK(commands == 88);
// The headings, in the order the index gives them.
CHECK(std::vector<std::string>(std::begin(GUI::kDesignSections), std::end(GUI::kDesignSections)) ==
std::vector<std::string>{"Document", "Sketch", "Solid", "Surface", "Construct", "Inspect", "Bodies", "History",
"Menu rows"});
"Menu items"});
}
TEST_CASE("the tool_search description names every Design command under its heading", "[Mcp][CAD]")
@@ -1733,8 +1733,8 @@ TEST_CASE("the tool_search description names every Design command under its head
const std::string index = told.substr(plain.size());
CHECK_THAT(index, ContainsSubstring("CAD"));
CHECK_THAT(index, ContainsSubstring("look one up with tool"));
// A command with silent does what its menu row does when it is given no arguments.
CHECK_THAT(index, ContainsSubstring("silent does what its menu row does when called with no arguments, unless silent is true"));
// A command with silent does what its menu item does when it is given no arguments.
CHECK_THAT(index, ContainsSubstring("silent does what its menu item does when called with no arguments, unless silent is true"));
// Each heading starts a sentence once, in the design's order, and its names follow its colon to the full stop,
// apart by ", ", in the table's order.
@@ -1770,8 +1770,8 @@ TEST_CASE("the tool_search description names every Design command under its head
at = stop;
}
CHECK(named == 88);
// The menu rows' heading says they take no arguments.
CHECK_THAT(index, ContainsSubstring(". Menu rows, which take no arguments"));
// The menu items' heading says they take no arguments.
CHECK_THAT(index, ContainsSubstring(". Menu items, which take no arguments"));
}
TEST_CASE("a CAD call is journaled without its generation and with its silent", "[Mcp][CAD]")
@@ -1810,13 +1810,13 @@ TEST_CASE("a CAD call is journaled without its generation and with its silent",
JournalContext read;
fillet.run({{"generation", 4}}, read);
CHECK(read.journaled == json::object());
// body_set's Color row opens with no arguments. The call is journaled before it runs, and it fails here, where
// body_set's Color item opens with no arguments. The call is journaled before it runs, and it fails here, where
// there is no Design tab.
const GUI::CommandCatalog catalog = cad_catalog();
JournalContext body;
CHECK_THROWS_AS(command_of(catalog, "body_set").run({{"generation", 1}}, body), GUI::ToolFailure);
CHECK(body.journaled == json{{"silent", true}});
// boolean's operation alone opens the row that does it, so a cut given its generation is replayed as a cut.
// boolean's operation alone opens the item that does it, so a cut given its generation is replayed as a cut.
JournalContext cut;
CHECK_THROWS_AS(command_of(catalog, "boolean").run({{"operation", "cut"}, {"generation", 1}}, cut), GUI::ToolFailure);
CHECK(cut.journaled == json{{"operation", "cut"}, {"silent", true}});
@@ -1831,7 +1831,7 @@ TEST_CASE("a CAD call is journaled without its generation and with its silent",
TEST_CASE("a CAD command tells its function a person's pick from a call", "[Mcp][CAD]")
{
// The four rows that act on the Feature list's row are not refused for the selection on a call, and a person's
// The four menu items that act on the Feature list's row are not refused for the selection on a call, and a person's
// pick keeps the menu's rule: the function is told which it runs for.
std::vector<bool> told;
const GUI::NativeCommand rename = GUI::Mcp::cad_command("rename_selected", "Rename", json{{"type", "object"}, {"properties", json::object()}},
@@ -2973,7 +2973,7 @@ TEST_CASE("sketch_edit re-opens a committed sketch by its index, as a sketch com
const GUI::CommandCatalog catalog = cad_catalog();
const GUI::NativeCommand& command = command_of(catalog, "sketch_edit");
const GUI::DesignTool& entry = design_row("sketch_edit");
// A command with no row of its own: no menu row, no tile and no person's form.
// A command with no menu item of its own: no menu item, no tile and no person's form.
CHECK(entry.row == -1);
CHECK(entry.action == nullptr);
CHECK_FALSE(command.in_palette);
@@ -6098,7 +6098,7 @@ TEST_CASE("a sketch command's type names its variant", "[Mcp][CAD]")
CHECK(GUI::Mcp::argument_error(command_of(catalog, "sketch_dimension"), dimension).empty());
json lock{{"type", "lock_x"}, {"entities", {0}}, {"value", 5}};
CHECK(GUI::Mcp::argument_error(command_of(catalog, "sketch_constrain"), lock).empty());
// sketch_extend is the Extend row and Extend's argument form.
// sketch_extend is the Extend item and Extend's argument form.
const GUI::NativeCommand& extend = command_of(catalog, "sketch_extend");
CHECK(property_of(extend, "at").is_object());
CHECK(property_of(extend, "tolerance").at("default") == 0.05);
+1 -1
View File
@@ -86,7 +86,7 @@ TEST_CASE("a tile's journal update stays inside action_run's envelope", "[Mcp]")
TEST_CASE("a tile of fixed arguments is journaled with the arguments action_run takes for it", "[Mcp]")
{
// What action_run takes for the tile: a folded row's own arguments, none for a command's own tile outside the
// What action_run takes for the tile: a folded item's own arguments, none for a command's own tile outside the
// Design tab, or the value a tile with an input collects.
const json tile_args = GENERATE(json{{"type", "circular"}}, json::object(), json{{"percent", 50}});
Harness h;
+2 -2
View File
@@ -1012,7 +1012,7 @@ TEST_CASE("a caption keeps the context its title is translated in", "[Mcp][Recor
TEST_CASE("a call with a tile's arguments is captioned with the tile's title", "[Mcp][Recording]")
{
// A Design command whose Linear array row is folded into it: the call that row's tile makes is titled as the
// A Design command whose Linear array item is folded into it: the call that item's tile makes is titled as the
// tile, untranslated and in the command's context, as McpRecorder::call_started() hands it to the board.
NativeCommand pattern;
pattern.key = "sketch_pattern";
@@ -1190,7 +1190,7 @@ TEST_CASE("captions name what a call acts on and never show secrets", "[Mcp][Rec
CHECK(settings.find("s3cret") == std::string::npos);
CHECK(settings.find("nozzle_diameter = 0.4") != std::string::npos);
CHECK(caption_detail("project_import", {{"paths", {"C:/models/part.stl", "/tmp/b.3mf"}}}) == "part.stl, b.3mf");
// A row's tile is its command's call; a command's own tile given arguments shows them.
// A menu item's tile is its command's call; a command's own tile given arguments shows them.
CHECK(caption_detail("action_run", {{"id", "orca_command:obj_arrange:orca"}}) == "object_arrange");
CHECK(caption_detail("action_run", {{"id", "orca_command:undo:orca"}, {"args", {{"history", "design"}}}}) == "undo history: design");
CHECK(caption_detail("webview_run_javascript", {{"code", "login('s3cret')"}}).empty());
+3 -3
View File
@@ -163,7 +163,7 @@ TEST_CASE("the commands that replace a dialog take the arguments the table gives
REQUIRE(names("preset_import") == Names{"path", "on_conflict", "silent"});
REQUIRE(names("plugin_install_local") == Names{"path", "overwrite", "silent"});
REQUIRE(names("window_open") == Names{"window", "tab", "key"});
// The object commands made from rows take their targets, by index or by the ids object_list reports.
// The object commands made from menu items take their targets, by index or by the ids object_list reports.
REQUIRE(names("object_rename") == Names{"object", "object_id", "part", "part_id", "name", "silent"});
REQUIRE(names("object_set_instances") == Names{"object", "object_id", "count", "delta", "silent"});
REQUIRE(names("object_delete") ==
@@ -185,7 +185,7 @@ TEST_CASE("the commands that replace a dialog take the arguments the table gives
REQUIRE(names("object_clone") == Names{"objects", "object_ids", "count", "arrange"});
REQUIRE(names("object_reload_from_disk") == Names{"objects", "object_ids", "parts", "part_ids", "all"});
REQUIRE(names("part_replace") == Names{"object", "object_id", "part", "part_id", "path"});
// The plate commands made from rows take the plate, and what their dialog or icon gives.
// The plate commands made from menu items take the plate, and what their dialog or icon gives.
REQUIRE(names("plate_select") == Names{"plate"});
REQUIRE(names("plate_delete") == Names{"plate"});
REQUIRE(names("plate_duplicate") == Names{"plate"});
@@ -1118,7 +1118,7 @@ TEST_CASE("a shape's size needs one positive number per field of the size dialog
}
}
// The object list's context-menu rows are tiles of commands beside the other object and part commands.
// The object list's context-menu items are tiles of commands beside the other object and part commands.
TEST_CASE("the object structure commands sit beside the other object commands", "[Mcp][Scene]")
{
const NativeCommand* objects = NativeCommands::find("object_delete");
+6 -6
View File
@@ -186,7 +186,7 @@ TEST_CASE("action_run refuses arguments for an action that takes none", "[Mcp][S
CHECK(action_args_error(*own, json::object()).empty());
const std::string refused = action_args_error(*own, {{"filament_slot", 2}});
CHECK_THAT(refused, Catch::Matchers::ContainsSubstring("filament_delete"));
// A row's tile takes no arguments, or exactly its own; a row's former arguments are refused, naming the command.
// A menu item's tile takes no arguments, or exactly its own; an item's former arguments are refused, naming the command.
const auto [export_command, export_gcode] = find_tile(NativeCommands::instance(), "export_gcode");
REQUIRE(export_gcode != nullptr);
const std::unique_ptr<Slic3r::GUI::AppAction> gcode = NativeCommands::make_action(*export_command, *export_gcode);
@@ -259,7 +259,7 @@ TEST_CASE("what action_run journals for a tile of fixed arguments is a call it t
TEST_CASE("a call with a tile's arguments asks, and one more argument runs", "[Mcp]")
{
// The commands whose tiles ask, as the design's table "When a call does what a row does" lists them: called with
// The commands whose tiles ask, as the design's table "When a call does what a menu item does" lists them: called with
// exactly a tile's arguments a command is its person's form, and with silent beside them its silent form.
const CommandCatalog& catalog = NativeCommands::instance();
for (const char* key : {"project_open", "project_import", "project_save", "project_export", "object_add_primitive", "object_rename",
@@ -484,7 +484,7 @@ TEST_CASE("action_run says where an action it cannot find is", "[Mcp][SpeedDial]
"--cad");
}
}
// A folded row's tile names the call of its command that runs it; with the feature off at startup, there is
// A folded item's tile names the call of its command that runs it; with the feature off at startup, there is
// neither, as for any other tile.
const std::string folded = "orca_command:sk_array:orca";
INFO(folded << (cad ? ", the CAD feature on" : ", the CAD feature off"));
@@ -534,7 +534,7 @@ TEST_CASE("a tool of the old vocabulary is no command", "[Mcp]")
};
static const Renamed renamed[] = {
{"search_tools", "tool_search", "Find what does something, in one search, or look up one command."},
{"call_tool", "tool_call", "Call any command by name with its arguments: a tool, or one the tool list does not show, a menu row "
{"call_tool", "tool_call", "Call any command by name with its arguments: a tool, or one the tool list does not show, a menu item "
"that takes no arguments, a Design tab command or an operation a plugin offers (see tool_search)."},
{"generate_calibration_test", "calibration_generate_test",
"Generate a Calibration menu test as its dialog's OK does: a new project named after the test with the test model, and the "
@@ -650,7 +650,7 @@ TEST_CASE("a tool of the old vocabulary is no command", "[Mcp]")
}
// Outside the Design group 115 commands are listed: every one that runs from its arguments, all but the three menu
// rows that take none (Task 3's 98, the seven Parts 4a to 4c add, Part 5a's three, Part 5b's two, Part 5c's one and
// items that take none (Task 3's 98, the seven Parts 4a to 4c add, Part 5a's three, Part 5b's two, Part 5c's one and
// Part 5d's four).
std::size_t listed = 0;
for (const NativeCommand& c : catalog.commands())
@@ -882,7 +882,7 @@ TEST_CASE("a guessed type is read as a command's one variant argument", "[Mcp]")
CHECK(either == json{{"type", "stl"}});
}
TEST_CASE("tool_search finds a Design command by the name of a row folded into it", "[Mcp][CAD]")
TEST_CASE("tool_search finds a Design command by the name of a menu item folded into it", "[Mcp][CAD]")
{
CommandCatalog catalog;
NativeCommands::register_all_commands(catalog, {true});
+23 -23
View File
@@ -2051,14 +2051,14 @@ const std::set<std::string> kOperations = {
};
// What an exception is, so that the reason reads the same for every entry of a kind.
constexpr const char* kRunsWhatItIsGiven = "runs what its arguments name, which is classified where it is defined";
constexpr const char* kDrivesTheGui = "drives the GUI as a person does: the widget it acts on decides what happens";
constexpr const char* kSessionState = "changes the automation session (jobs, the journal, recordings), not the project";
constexpr const char* kOneEntryPoint = "its function has one automation entry point, so no second caller can drift from it";
constexpr const char* kHistory = "it calls the undo and redo of the history it names, which no operation stands for";
constexpr const char* kRowAdds = "it runs its menu row's function, which adds an object, a part, a plate or a filament slot";
constexpr const char* kRowOpens = "it runs its menu row's function, which opens a window, a panel or a web page for a person";
constexpr const char* kRowAppSetting = "it runs its menu row's function, which changes a setting of the app, not the project";
constexpr const char* kRunsWhatItIsGiven = "runs what its arguments name, which is classified where it is defined";
constexpr const char* kDrivesTheGui = "drives the GUI as a person does: the widget it acts on decides what happens";
constexpr const char* kSessionState = "changes the automation session (jobs, the journal, recordings), not the project";
constexpr const char* kOneEntryPoint = "its function has one automation entry point, so no second caller can drift from it";
constexpr const char* kHistory = "it calls the undo and redo of the history it names, which no operation stands for";
constexpr const char* kMenuItemAdds = "it runs its menu item's function, which adds an object, a part, a plate or a filament slot";
constexpr const char* kMenuItemOpens = "it runs its menu item's function, which opens a window, a panel or a web page for a person";
constexpr const char* kMenuItemAppSetting = "it runs its menu item's function, which changes a setting of the app, not the project";
const std::map<std::string, const char*> kExceptions = {
// The typed tools.
@@ -2092,25 +2092,25 @@ const std::map<std::string, const char*> kExceptions = {
{"settings_set", kOneEntryPoint},
{"plate_set_settings", kOneEntryPoint},
{"project_set_settings", kOneEntryPoint},
// The commands made from menu rows, which run their rows' functions.
{"object_add_handy_model", kRowAdds},
{"object_add_text", kRowAdds},
{"object_add_svg", kRowAdds},
{"plate_add", kRowAdds},
{"window_open", kRowOpens},
{"app_open_web_page", kRowOpens},
{"app_show_config_folder", kRowOpens},
{"script_toggle_panel", "it runs its menu row's function, which shows or hides the Run Script panel for a person"},
{"settings_set_mode", kRowAppSetting},
{"settings_toggle_developer_mode", kRowAppSetting},
// The commands made from menu items, which run their items' functions.
{"object_add_handy_model", kMenuItemAdds},
{"object_add_text", kMenuItemAdds},
{"object_add_svg", kMenuItemAdds},
{"plate_add", kMenuItemAdds},
{"window_open", kMenuItemOpens},
{"app_open_web_page", kMenuItemOpens},
{"app_show_config_folder", kMenuItemOpens},
{"script_toggle_panel", "it runs its menu item's function, which shows or hides the Run Script panel for a person"},
{"settings_set_mode", kMenuItemAppSetting},
{"settings_toggle_developer_mode", kMenuItemAppSetting},
{"undo", kHistory},
{"redo", kHistory},
{"preset_export", kOneEntryPoint},
{"plugin_install_local", kOneEntryPoint},
{"preset_migrate_filaments", "it runs its menu row's function, which asks before it migrates the legacy user filament presets"},
{"app_check_for_updates", "it runs its menu row's function, which asks the update server and shows its answer"},
{"app_benchmark_3d_scene", "it runs its menu row's function, which times the 3D views on a test model in place of the project"},
{"window_save_screenshot", "it runs its menu row's function, which saves a picture of the main window where recordings go"},
{"preset_migrate_filaments", "it runs its menu item's function, which asks before it migrates the legacy user filament presets"},
{"app_check_for_updates", "it runs its menu item's function, which asks the update server and shows its answer"},
{"app_benchmark_3d_scene", "it runs its menu item's function, which times the 3D views on a test model in place of the project"},
{"window_save_screenshot", "it runs its menu item's function, which saves a picture of the main window where recordings go"},
};
} // namespace
+12 -10
View File
@@ -129,7 +129,7 @@ the tool list does not show. Outside the Design tab a section is a Speed Dial se
the `tile_group` of a command's own tile), and each tile has a row with its key, its title, the command and
arguments it runs (`project_export {"format": "gcode"}` for Export G-code) and its description. In the
Design section a command has a row of its own when it has a tile of its own (`in_palette`), and each Design
menu row folded into a command follows it as a row with the command's key, the row's title and the
menu item folded into a command follows it as a row with the command's key, the item's title and the
arguments that open its tool (`sketch_pattern` with `{"type": "linear"}` for Linear array). It needs no
running app. With `--check` it writes
nothing, prints the difference and exits 1 when the file is not what it would write. When a command
@@ -180,7 +180,7 @@ the run that outlives its reply budget runs with the budget capped at 4 s (`ORCA
`test_plugin_tools.py` checks a plugin's calls into the tools in the running app: it side-loads
`tests/plugins/mcp_tools_fixture` into a fresh data folder and launches twice: over MCP, with the Design tab
on (its operation is in the group Plugins, reached through `tool_search` and `tool_call` and out of
`tools/list`; a menu row's command is found among `tool_search`'s commands with its schema and its tile not
`tools/list`; a menu item's command is found among `tool_search`'s commands with its schema and its tile not
among its actions, and `tool_call` runs it; a group is a place's heading, in any case; a Design command is
found there too, in no section of its own; calls from its Script worker
and a thread it starts reach the tools, an auto-answer rule it sets is the plugin's, `replay_export` is
@@ -437,7 +437,7 @@ constraints, loops and degrees of freedom; `sketch_edit` and its replace, cancel
`sketch_project` with and without an open sketch, `sketch_text`, `sketch_insert_svg` and Scale artwork;
`feature_edit`'s `refs` and a card's picks while it edits a feature; `view_set`'s Design options;
`select_geometry`, `confirm_tool`, `cancel_tool` and `body_place`; the Boolean card a call opens; and a
pick of a folded row's tile from the Speed Dial, and its replay. Its docstring lists the rungs.
pick of a folded item's tile from the Speed Dial, and its replay. Its docstring lists the rungs.
Three more harness tests on a `--cad` instance drive the Design tab the way a person does. Every action goes
through the UI tools (`view_set`, `widget_click`, `mouse_gesture`, `keyboard_press`, `widget_set_value`,
@@ -617,10 +617,11 @@ Select All Objects run in place (the script). `test_project_open_settings.py`
launches its own app, whose Preferences load a project's geometry only, and checks that `project_open` loads
the settings a project was saved with all the same.
The commands that do a menu row's job take their targets by index, and the replays call them so and read each
back: `tests/rows_objects.json` (rename, instances, separate, delete, height ranges), `rows_structure.json`
(split, assemble, change type, order), `rows_placement.json` (add a primitive by numbers, mirror, drop, centre,
scale to fit, auto-orient) and `rows_plates.json` (duplicate, rename, lock, select and delete a plate);
The commands that do a menu item's job take their targets by index, and the replays call them so and read each
back: `tests/menu_items_objects.json` (rename, instances, separate, delete, height ranges),
`menu_items_structure.json` (split, assemble, change type, order), `menu_items_placement.json` (add a
primitive by numbers, mirror, drop, centre, scale to fit, auto-orient) and `menu_items_plates.json`
(duplicate, rename, lock, select and delete a plate);
`objects_state.json` (`object_set_printable`, `object_fix`, `object_set_auto_drop`), `objects_files.json`
(`object_clone`, `object_reload_from_disk`, `part_replace`, with the files `tests/fixtures/objects_files.py`
writes), `objects_order.json` (`object_order {order}`), `filaments_and_files.json` (a slot merged into
@@ -629,8 +630,9 @@ another, a mixed filament, exports of some objects and of each object, a ZIP's e
`presets_and_plate_map.json` (`preset_list`'s filters, a plate's filament map, a nozzle variant) and
`view_switches.json` (`view_set`'s display switches, sidebar and legend, and an object placed by a plate's
`origin` and `size`). A replay cannot expect an error, so the refusals are Python tests:
`test_rows_refusals.py` checks that each object command made from rows refuses with its own reason, and
`test_additions_refusals.py` the filament, preset, export and import commands'. `test_preferences.py` checks
`test_menu_items_refusals.py` checks that each object command made from menu items refuses with its own
reason, and `test_additions_refusals.py` the filament, preset, export and import commands'.
`test_preferences.py` checks
`preferences_get` and `preferences_set` against the Preferences dialog, tab by tab. Some launch their own app,
on a fresh data folder and printers the sweep does not seed: `test_install_printers.py` and
`test_install_filaments.py` (installs and uninstalls, read back after a restart), `test_plugin_commands.py`
@@ -640,7 +642,7 @@ on a fresh data folder and printers the sweep does not seed: `test_install_print
`test_every_tile.py` runs each of the 129 Speed Dial tiles of `tests/data/speed_dial_tiles.json` through
`action_run`, each from a state its table sets up afresh, answers the dialog or file picker it opens, and reads what
its row's job leaves: a change only that tile makes, the window it opens, the file it writes, or the refusal of a
its menu item's job leaves: a change only that tile makes, the window it opens, the file it writes, or the refusal of a
tile that needs a printer or an account. It also checks the reply's `ran` and the step `replay_export` keeps against
`tests/data/speed_dial_tile_calls.json`. Its web-page and configuration-folder tiles hand over to the system's
browser and file manager, so the sweep runs it on its own.
+1 -1
View File
@@ -930,7 +930,7 @@ class CadGui:
for now (describe_design's selection): those of the sketch vocabulary, or with sketch_mode False of the
model one, or with None both. Each has id, name, row, row_name, family (its submenu within the row,
or None), key, action, sketch_mode, applies (it accepts the selection), modal and hint, as the table
has them; entries with no menu row (commands only) are left out."""
has them; entries with no menu item (commands only) are left out."""
with open(ATLAS, encoding="utf-8") as f:
atlas = json.load(f)
slots = atlas["slots"]
+10 -10
View File
@@ -11,7 +11,7 @@ repository: every tile a person can pick, section by section in the order the ca
Outside the Design tab a section is a Speed Dial section (a tile's group, or the tile_group of a
command's own tile), and each tile has a row with its key, its title, the command and arguments it
runs and its description. In the Design section a command with a tile of its own (in_palette) has a
row with its key, title, arguments and description, and each Design menu row folded into a command
row with its key, title, arguments and description, and each Design menu item folded into a command
(its tiles) a row after it, with the command's key, the tile's title, the arguments that open it and
its description. The file is generated: edit the commands in OrcaSlicer and regenerate it. A header
that names a command the reference does not have is an error, so that a renamed or removed command
@@ -48,12 +48,12 @@ YouTube links, About, the plugin hub and the configuration folder (`app_open_web
A call with exactly a tile's arguments is the tile's own call: where the tile asks in a dialog, the call opens
it, which it reports as `blocked_by_dialog`, and where the tile acts on the selection, so does the call. A
tile whose row does what its command does (a camera view, Select All, Deselect All, Auto-Arrange, Auto-Orient,
Refresh Plugins) runs the command's own function and replies as the command does. Any other arguments, or
`silent: true` where the schema has `silent`, run the command without asking, with the arguments its schema
marks required. Go to tab and Go to layer collect their value in the Speed Dial: `action_run` gives such a
tile its one value (`{"tab": "preview"}`, `{"percent": 50}`), and the command takes it as the argument its
row names. A command whose dialog is what it does opens it with arguments too
tile whose menu item does what its command does (a camera view, Select All, Deselect All, Auto-Arrange,
Auto-Orient, Refresh Plugins) runs the command's own function and replies as the command does. Any other
arguments, or `silent: true` where the schema has `silent`, run the command without asking, with the arguments
its schema marks required. Go to tab and Go to layer collect their value in the Speed Dial: `action_run` gives
such a tile its one value (`{"tab": "preview"}`, `{"percent": 50}`), and the command takes it as the argument
its row names. A command whose dialog is what it does opens it with arguments too
(`preset_export {"path": "/abs/dir"}` only spares it the folder question).
The Design section lists the Design tab's commands that have a tile; `tool_search {"group": "Design"}` lists
@@ -62,8 +62,8 @@ in Preferences > Features before restarting OrcaSlicer: `app_state.design_tab` s
is on, and `cad_note`, while its commands cannot run, how to turn it on (a test instance gets it with
`tools/mcp/orca_mcp.py launch --cad`). A Design tile is in the Speed Dial, and `action_run` runs it, only while
the Design tab is shown in the tile's mode (in a sketch or outside one); `tool_call` runs its command from any
tab. Called with no arguments, a tile's command does what its right-click menu row does, which may be to act
at once (a Delete row deletes what is selected) or to decline.
tab. Called with no arguments, a tile's command does what its right-click menu item does, which may be to act
at once (a Delete item deletes what is selected) or to decline.
A Design row whose arguments are written as a call's own (`{"type": "linear"}`, or `{}`) is one tool of its
command: `tool_call` given exactly those arguments opens that tool, as a person's pick of its tile does, and any
@@ -126,7 +126,7 @@ def header(design, unlisted):
if needs:
facts.append("%s %s." % (names(needs), "needs its value" if len(needs) == 1 else "need their value"))
if unlisted:
facts.append("The tool list does not show %s, menu rows that take no arguments: call %s with `tool_call`." %
facts.append("The tool list does not show %s, menu items that take no arguments: call %s with `tool_call`." %
(names(unlisted), "it" if len(unlisted) == 1 else "them"))
if not facts:
return HEADER
+5 -5
View File
@@ -45,10 +45,10 @@
"preview": {"path": "tests/preview.json"},
"recording": {"path": "tests/recording.json"},
"rows": {"path": "tests/rows.json"},
"rows_objects": {"path": "tests/rows_objects.json"},
"rows_placement": {"path": "tests/rows_placement.json"},
"rows_plates": {"path": "tests/rows_plates.json"},
"rows_structure": {"path": "tests/rows_structure.json"},
"menu_items_objects": {"path": "tests/menu_items_objects.json"},
"menu_items_placement": {"path": "tests/menu_items_placement.json"},
"menu_items_plates": {"path": "tests/menu_items_plates.json"},
"menu_items_structure": {"path": "tests/menu_items_structure.json"},
"scene": {"path": "tests/scene.json"},
"settings_targets": {"path": "tests/settings_targets.json"},
"slice_stats": {"path": "tests/slice_stats.json"},
@@ -82,7 +82,7 @@
"test_project_open_settings": {"path": "test_project_open_settings.py", "launch": "own", "args": ["--bin", "{bin}"]},
"test_recovery_under_load": {"path": "test_recovery_under_load.py"},
"test_ref_locator_export": {"path": "test_ref_locator_export.py"},
"test_rows_refusals": {"path": "test_rows_refusals.py"},
"test_menu_items_refusals": {"path": "test_menu_items_refusals.py"},
"test_run_sweep": {"path": "test_run_sweep.py", "launch": "none"},
"test_runtime_lifecycle": {"path": "test_runtime_lifecycle.py", "launch": "own", "args": ["--bin", "{bin}"], "locks": ["port-13694"], "why": "both serve on the fixed port 13694"},
"test_send_gcode": {"path": "test_send_gcode.py"},
+1 -1
View File
@@ -23,7 +23,7 @@ sidebar is off, and view_set of it is refused.
filament_delete of the only filament slot is refused. With a mixed filament of slots 1 and 2, a merge of slot 1 into it
is refused with the question Merge with asks, and filament_delete of the mixed slot is refused. filament_add once the
project holds as many filament slots as it can is refused, and a pick of Add Filament Slot then says so, as its row did.
project holds as many filament slots as it can is refused, and a pick of Add Filament Slot then says so, as its menu item did.
object_order with an order that leaves out an object of the plate is refused, naming it, and leaves the order as it was.
+16 -16
View File
@@ -16,7 +16,7 @@ suppresses a feature, which describe_design and feature_describe say as suppress
cannot both hold, which describe_design lists in align_conflicts; and it calls the open sketch's commands by
their type, sketch_extend, sketch_pattern, sketch_transform and sketch_dimension, through their silent forms.
shapes_match_tools draws twelve shapes twice, each in a sketch of its own: once with its drawing tool, its
right-click menu row chosen and its points clicked on the canvas, and once with sketch_draw, from the geometry
right-click menu item chosen and its points clicked on the canvas, and once with sketch_draw, from the geometry
the tool's shape reads back with; the 3-point rectangle, the tangent arc, the slot and the square are drawn at a
slant. The two sketches agree in their entities' types and geometry, their constraints' count and kinds (as
sketch_list_constraints reads them), their loops and their degrees of freedom, and again after one undo of each,
@@ -65,7 +65,7 @@ editor; a face, an edge and a vertex, at the point body_describe gives it; the s
rename_selected renames and zoom_to_selection frames; and each feature, which rename_selected, feature_delete,
feature_edit and sketch_constrain_selected then act on, as zoom_to_selection does not. {} clears it all. Under an open
card or sketch, and for an id the model lacks or a plane no click could pick, it is refused and the selection stays
as it was. With an edge, a face, a body and a vertex selected, the menu rows that take them apply; the canvas draws a
as it was. With an edge, a face, a body and a vertex selected, the menu items that take them apply; the canvas draws a
face, an edge and a vertex selected, each differently. A plane is selected while the Origin row shows the planes, and
starts the sketch Sketch waits for, on XY as its sketch_normal camera reads it.
select_loops extrudes loop 0 of a sketch of three squares alone: select_geometry's loop 1 is then the loop
@@ -92,9 +92,9 @@ where it stands. place_follows deletes the feature that made the first of two pl
placement as it becomes body 0, a box added afterwards has none, and undo brings the first back where it stood.
boolean_opens calls boolean {} and boolean {operation: "cut"} with two bodies and nothing selected: each replies that
a tool is open, and the card it opened, confirmed with confirm_tool, adds a join and a cut; with target and tool the
cut runs. tile_pick opens the Speed Dial in a sketch with a line selected and picks the Polar array tile, a row folded
cut runs. tile_pick opens the Speed Dial in a sketch with a line selected and picks the Polar array tile, an item folded
into sketch_pattern, which arms the polar array tool, and the Trim tile, sketch_trim's own, which arms the trim tool.
tile_replay runs the Polar array tile with action_run, exports the session, whose step carries the row's arguments
tile_replay runs the Polar array tile with action_run, exports the session, whose step carries the item's arguments
{"type": "circular"}, and replays it in a new project to the same armed tool.
"""
@@ -249,7 +249,7 @@ def rung_words():
# ---------------------------------------------------------------- the shapes
# The tool each drawing row arms, as sketch_describe names it, so that a row chosen one off is caught where it is.
# The tool each drawing item arms, as sketch_describe names it, so that an item chosen one off is caught where it is.
ARMS = {"sk_rect": "rect_corner", "sk_polyline": "polyline", "sk_rect_center": "rect_center",
"sk_rect_oblique": "rect_oblique", "sk_rect_rounded": "rect_rounded", "sk_circle_2pt": "circle_2pt",
"sk_circle_3pt": "circle_3pt", "sk_arc_t": "arc_3pt", "sk_arc_tangent": "arc_tangent", "sk_slot_arc": "slot_arc",
@@ -257,7 +257,7 @@ ARMS = {"sk_rect": "rect_corner", "sk_polyline": "polyline", "sk_rect_center": "
def menu_path(verb):
"""The label path of the drawing row `verb` in the offer a right-click on empty space in a sketch opens: its
"""The label path of the drawing item `verb` in the offer a right-click on empty space in a sketch opens: its
row, its family when it has one, and its name, as DesignPanel::show_offer_menu lays out a row of many verbs."""
v = next(v for v in gui.verbs() if v["id"] == verb)
return ">".join([v["row_name"]] + ([v["family"]] if v["family"] else []) + [v["name"]])
@@ -307,7 +307,7 @@ def disagreement(by_tool, by_command):
def shapes(box):
"""The shapes shapes_match_tools draws: for each, its row, what both sketches get first by sketch_draw, the tool's
"""The shapes shapes_match_tools draws: for each, its menu item, what both sketches get first by sketch_draw, the tool's
clicks (mm), how many entities it adds and how many an undo leaves of them, and the sketch_draw arguments that
draw it again, from what the tool drew (the entities after the first ones). Positions are shares of the
calibrated region `box` (x0, x1, y0, y1), so that every click lands in it whatever the window, and none falls
@@ -585,7 +585,7 @@ def failing_edit():
def rung_sketch_edit_failed_leave():
# sketch_text {}, the Text row, and K, Constrain, finish the open sketch before they open the Text dialog or
# sketch_text {}, the Text item, and K, Constrain, finish the open sketch before they open the Text dialog or
# Constrain mode on it. A re-opened sketch whose replace fails stops each there: nothing opens on the sketch as it
# was, and the status line says why.
for route, leave in (("sketch_text {}", lambda: gui.cad("sketch_text")),
@@ -810,7 +810,7 @@ def rung_surface_revolve_flip():
gui.cad("sketch_create", plane="XZ")
gui.cad("sketch_draw", type="rectangle_2_point", p0=[10, 0], p1=[14, 20])
sketch = gui.cad("sketch_finish")["sketch_index"]
# Its menu row takes a picked loop, and the card revolves the sketch the loop is of.
# Its menu item takes a picked loop, and the card revolves the sketch the loop is of.
gui.cad("select_geometry", sketch=sketch, loop=0)
opened = gui.cad("surface_revolve")
shown = until(lambda: any(w.kind == "toggle" and w.label == "Flip direction" for w in gui.widgets()))
@@ -1002,7 +1002,7 @@ def rung_select():
r = gui.cad("zoom_to_selection")
gui.check("select: zoom_to_selection applies to the loop", r.get("applies") is True, r)
# Features of the Feature list, straight after the loop, which the four rows that act on its row act on.
# Features of the Feature list, straight after the loop, which the four menu items that act on its row act on.
r = select(feature=f["box"])
gui.check("select: {feature} reads back the feature's row, and nothing picked in the view",
r["feature"] == f["box"] and r["selection"]["id"] == "none" and selected() == ("none", None, f["box"]), r)
@@ -1073,7 +1073,7 @@ def rung_select():
why = refused("select_geometry", body=0, face=top, generation=gen + 1)
gui.check("select: a stale generation is refused", "-32010" in why, why)
# The menu rows that take what is selected apply to it.
# The menu items that take what is selected apply to it.
select(body=0, edges=[edge], generation=gen)
r = gui.cad("fillet")
gui.check("select: with an edge selected fillet {} applies and opens its card",
@@ -1778,7 +1778,7 @@ def rung_shapes_match_tools():
for shape in shapes(gui.safe):
name, setup = shape["type"], shape["setup"]
# With the tool: its row chosen from the offer on empty space, its points clicked.
# With the tool: its item chosen from the offer on empty space, its points clicked.
gui.enter_sketch()
if setup:
gui.cad("sketch_draw", entities=setup)
@@ -1844,7 +1844,7 @@ def boolean_card(rung, args, operation):
def rung_boolean_opens():
# The Boolean rows take two bodies, which the tab never reports as what is selected, so a call opens the card as
# The Boolean items take two bodies, which the tab never reports as what is selected, so a call opens the card as
# the toolbar button does, whatever is selected.
two_bodies()
boolean_card("boolean_opens", {}, "join")
@@ -1872,7 +1872,7 @@ def line_selected():
def rung_tile_pick():
# A pick from the Speed Dial runs its tile's action: a folded row's with the row's arguments, a merged row's as its
# A pick from the Speed Dial runs its tile's action: a folded item's with the item's arguments, a merged item's as its
# command's own tile.
line_selected()
dial_pick("Polar array")
@@ -1885,7 +1885,7 @@ def rung_tile_pick():
def rung_tile_replay():
# action_run of a folded row's tile is journaled with the row's arguments, so the exported session replays the pick.
# action_run of a folded item's tile is journaled with the item's arguments, so the exported session replays the pick.
gui.new_design()
gui.client.call("replay_export", clear=True)
gui.cad("sketch_create", plane="XY")
@@ -1898,7 +1898,7 @@ def rung_tile_replay():
path = os.path.join(out_dir, "session.json")
gui.client.call("replay_export", path=path, overwrite=True)
picks = [s for s in steps_of(path) if s["tool"] == "action_run"]
gui.check("tile_replay: the export keeps the pick with the row's arguments",
gui.check("tile_replay: the export keeps the pick with the item's arguments",
len(picks) == 1 and picks[0]["args"].get("id") == "orca_command:sk_array_polar:orca"
and picks[0]["args"].get("args") == {"type": "circular"}, picks)
gui.cad("sketch_cancel")
+2 -2
View File
@@ -44,7 +44,7 @@ from cad_gui import CANVAS, CadGui, until # noqa: E402
gui = None # the CadGui main() starts
# The offer's header for each sketch selection: its first item, greyed, naming what the rows act
# The offer's header for each sketch selection: its first item, greyed, naming what the items act
# on (DesignPanel::offer_header). Keyed by the selection kinds of the offer table (OfferSel).
HEADER = {"SkNone": "Sketch — nothing selected", "SkLine": "Sketch line", "SkArc": "Sketch curve",
"SkPoint": "Sketch point", "Sk2Ent": "2 sketch entities"}
@@ -326,7 +326,7 @@ def rung_vocabulary():
f"table only {sorted(want - got)}; greyed {sorted(o.disabled)} vs {sorted(want_grey)}")
seen[name] = offered(o, verbs)
# The sets differ: an offer that adapts does not show the same rows everywhere.
# The sets differ: an offer that adapts does not show the same items everywhere.
gui.check("vocabulary: every selection offers a different set",
len(set(map(frozenset, seen.values()))) == len(seen),
", ".join(f"{k}={len(v)}" for k, v in seen.items()))
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
"""Checks what the object commands made from menu rows refuse, and that each refusal says its reason.
"""Checks what the object commands made from menu items refuse, and that each refusal says its reason.
tools/mcp/orca_mcp.py launch
tools/mcp/test_rows_refusals.py
tools/mcp/test_menu_items_refusals.py
Set as Individual Objects on an object of one instance is refused, saying it has one instance. Select All (object_select
{all: true}) selects every object while the Move gizmo is open, which lets it, and is refused while the Place on face
@@ -13,9 +13,9 @@ and object_delete by index leaves the view shown (the assemble view).
A selection of a kind a command does not take: object_rename with an instance selected is refused as wrong_selection,
and a pick of Rename from the Speed Dial (Space on the 3D view, the search field, a click on the tile) says to select
one object or part, as its row did, and opens no dialog. A pick of Set as Individual Objects with a part selected
one object or part, as its menu item did, and opens no dialog. A pick of Set as Individual Objects with a part selected
separates that part's instance alone. A pick of Delete with an object's last solid part selected shows the object
list's message, as the row did, where object_delete of that part by index is refused as last_solid_part; object_delete
list's message, as the menu item did, where object_delete of that part by index is refused as last_solid_part; object_delete
with no arguments on both solid parts of an object with a modifier deletes the second, shows that message for the first,
and replies with the part deleted and, under kept, the part that stayed. A cube cut
with the Cut gizmo: object_delete of a half by index is refused as cut_object; with no arguments it asks the object
@@ -25,7 +25,7 @@ and cancelled shows no notice.
Split: object_split of a mesh of one shell is refused as one_shell, and a pick of Split to Objects on it says it is one
piece; a split into objects that would leave a piece floating above the bed is refused with the Auto-Drop question
(auto_drop_question) unless keep_z answers it, while a pick of Split to Objects asks it. A pick of Change Type with an
object selected, and of Assemble with one object selected, say what to select, in their rows' words.
object selected, and of Assemble with one object selected, say what to select, in their menu items' words.
Placement: object_mirror with no axis is refused by its schema, and object_center and object_add_primitive on a plate the
project lacks as no_such_plate. A pick of Mirror X with two objects selected says Mirror takes one instance, a pick of Drop to Bed on an
@@ -39,12 +39,12 @@ and Change Type to Negative Part on every solid part row says the last solid par
instance rows, and Split to Parts on every part row, say they take one row. object_auto_orient of a plate with no
objects is refused as no_objects_to_orient and turns nothing, and its reply leaves out an object on a locked plate.
Named objects, or a plate, of which nothing is printable (an Assembly of a cube made not printable) are refused as
not_printable and turn no other object, while a pick of Auto-Orient on that object turns the other object, as its row's
not_printable and turn no other object, while a pick of Auto-Orient on that object turns the other object, as its menu item's
job did, and names it.
The plates: a pick of Duplicate Plate is one undo step, which Undo takes back alone. The Rename Plate tile run with its
name dialog cancelled is told the plate was not renamed (not_renamed), while a pick of it, cancelled, shows nothing, as
its row did. plate_delete, plate_duplicate, plate_rename, plate_lock and plate_select of a plate the project lacks are
its menu item did. plate_delete, plate_duplicate, plate_rename, plate_lock and plate_select of a plate the project lacks are
refused as no_such_plate, each leaving the plates as they were; a rename of a plate to the name it has changes neither
the current plate nor the undo history.
@@ -174,7 +174,7 @@ def main():
check("object_delete by index leaves the assemble view shown", shown == "assemble", shown)
client.call("view_set", canvas="3d")
# ---- A selection of a kind Rename does not take: an instance, which a pick of Rename refuses as its row did ----
# ---- A selection of a kind Rename does not take: an instance, which a pick of Rename refuses as its menu item did ----
client.call("object_set_instances", object=0, count=2)
client.call("object_select", instances=[[0, 1]])
refused("object_rename with an instance selected is refused", "object_rename", {"name": "x"}, "Select one object or part first",
@@ -205,7 +205,7 @@ def main():
check("and the new object is the part's instance, instance 0",
len(objects) == 2 and objects[1]["instances"][0]["offset"] == offsets[0], (offsets, objects[-1]["instances"]))
# ---- A pick of Delete with an object's last solid part selected: the object list says why, as for the row ----
# ---- A pick of Delete with an object's last solid part selected: the object list says why, as for the menu item ----
client.call("project_new", discard_changes=True)
client.call("object_add_primitive", shape="cube", size=[20, 20, 20])
client.call("part_add", object=0, type="modifier", shape="cube", size=[5, 5, 5])
@@ -331,7 +331,7 @@ def main():
check("and, answered No, the pieces drop", len(lowest) == 2 and lowest[1] < 1, lowest)
client.call("dialog_auto_answer", rules=[])
# ---- Change Type and Assemble picked with a selection their rows refused, in the rows' words ----
# ---- Change Type and Assemble picked with a selection their menu items refused, in the items' words ----
client.call("object_select", objects=[0])
dial_pick("Change Type to Modifier")
state = settled()
@@ -344,7 +344,7 @@ def main():
any("Select two or more objects first" in text for text in notices(state)), notices(state))
check("and assembles nothing", total() == 2, total())
# ---- Mirror needs its axis, a plate the project lacks is named, and picks refused as their rows were ----
# ---- Mirror needs its axis, a plate the project lacks is named, and picks refused as their menu items were ----
refused("object_mirror with no axis is refused by its schema", "object_mirror", {"objects": [0]}, "axis")
refused("object_center on a plate the project lacks is refused", "object_center", {"plate": 9}, "plate", "no_such_plate")
refused("object_add_primitive on a plate the project lacks is refused", "object_add_primitive",
@@ -421,7 +421,7 @@ def main():
list_rows("left>left", "left>Generic-Cube")
dial_pick("Assemble")
state = settled()
check("a pick of Assemble on every part row of an object says to select two or more objects, as its row did",
check("a pick of Assemble on every part row of an object says to select two or more objects, as its menu item did",
any("Select two or more objects first" in text for text in notices(state)), notices(state))
check("and assembles nothing", objects_named() == [("left", 2), ("right", 2)], objects_named())
@@ -504,7 +504,7 @@ def main():
refused("object_auto_orient of a plate whose only object is not printable is refused, saying why", "object_auto_orient",
{"plates": [1]}, "not printable", "not_printable")
check("and turns no other object", edge_rotation() == before, (before, edge_rotation()))
# With the object that is not printable selected, the job turns every other object, as the row's did, and the
# With the object that is not printable selected, the job turns every other object, as the menu item's did, and the
# reply names what it turned.
client.call("object_select", objects=[0])
reply = client.call("action_run", id="orca_command:obj_orient:orca")
+5 -5
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""Checks that a call with exactly a tile's arguments asks as a person's pick does, that one with a path does not, and
that a person's pick of a view tile or Deselect All runs in place, as its row did.
that a person's pick of a view tile or Deselect All runs in place, as its menu item did.
tools/mcp/orca_mcp.py launch
tools/mcp/test_person_forms.py
@@ -233,12 +233,12 @@ def main():
check("and the journal keeps it with the settings in force", step.get("tool") == "object_arrange"
and "spacing" in step.get("args", {}), step)
# action_run names the tile it ran in ran, whatever the command replies; the row replied level besides.
# action_run names the tile it ran in ran, whatever the command replies; the menu item replied level besides.
cube_off_plate("action_run of Auto-Arrange")
arranged = client.await_job(client.call("action_run", id="orca_command:obj_arrange:orca"))
check("action_run of Auto-Arrange replies with the settings in force and what it left off the plates",
"settings" in arranged and arranged.get("off_plate") == [], arranged)
check("and not with the row's level", "level" not in arranged, arranged)
check("and not with the menu item's level", "level" not in arranged, arranged)
check("and with ran, the tile's id", arranged.get("ran") == "orca_command:obj_arrange:orca", arranged)
check("and puts the cube back on the plate", outside() == [], outside())
# action_run takes the tile with its own arguments alone, none here, so the journal keeps those in place of the
@@ -280,7 +280,7 @@ def main():
chosen = client.call("action_run", id="orca_command:select_all:orca")
check("action_run of Select All Objects replies with the selection, the three cubes", chosen.get("objects") == [0, 1, 2],
chosen)
check("and not with the row's level", "level" not in chosen, chosen)
check("and not with the menu item's level", "level" not in chosen, chosen)
check("and with ran, the tile's id", chosen.get("ran") == "orca_command:select_all:orca", chosen)
client.call("view_set", canvas="assemble")
@@ -323,7 +323,7 @@ def main():
state.get("selection"))
# Where the pick and the call differ: picked while the assemble view is shown, Select All Objects shows Prepare and
# selects there, as its row did, where the call selects in the assemble view.
# selects there, as its menu item did, where the call selects in the assemble view.
client.call("object_select", none=True)
client.call("view_set", canvas="assemble")
client.call("object_select", none=True)
+5 -5
View File
@@ -147,7 +147,7 @@ def main():
exported = run_plugin_script(orca, plugin_dir, "export", CAPABILITIES[3])
check("a plugin is refused replay_export", exported.get("ok") is False and "agent's session" in exported.get("error", ""),
exported)
# tool_search's one search: a command the tool list does not show (an operation, a menu row) with
# tool_search's one search: a command the tool list does not show (an operation, a menu item) with
# its schema, a listed tool with its summary (its schema is in tools/list), and beside them the other
# catalogs' best matches.
found = orca.call("tool_search", query="fixture measure")
@@ -163,7 +163,7 @@ def main():
found)
found = orca.call("tool_search", query="developer mode")
command = next((i for i in found["items"] if i["name"] == "settings_toggle_developer_mode"), {})
check("tool_search's search finds a menu row's command among the commands, with its schema",
check("tool_search's search finds a menu item's command among the commands, with its schema",
command.get("listed") is False and "input_schema" in command, found)
check("and not its tile among the actions",
not any("toggle_developer_mode" in a["id"] for a in found.get("actions", {}).get("items", [])), found)
@@ -171,8 +171,8 @@ def main():
check("tool_search's search finds the Speed Dial's other actions",
any("fixture" in a.get("title", "").lower() for a in found.get("actions", {}).get("items", [])), found)
described = orca.call_raw("tool_search", {"tool": "script_toggle_panel"})
row = {} if described.get("isError") else json.loads(described["content"][0]["text"])
check("tool_search describes a menu row's command", row.get("listed") is False and "input_schema" in row, described)
item = {} if described.get("isError") else json.loads(described["content"][0]["text"])
check("tool_search describes a menu item's command", item.get("listed") is False and "input_schema" in item, described)
names = orca.call("tool_search", group="objects").get("names", [])
check("tool_search's group is any case, a place's heading", "object_arrange" in names, names)
unknown = orca.call_raw("tool_search", {"group": "commandz"})
@@ -180,7 +180,7 @@ def main():
unknown.get("isError") and "Objects" in unknown["content"][0]["text"], unknown)
# It shows the Run Script panel; the second call hides it again.
ran = orca.call_raw("tool_call", {"tool": "script_toggle_panel"})
check("tool_call runs a menu row's command", not ran.get("isError"), ran)
check("tool_call runs a menu item's command", not ran.get("isError"), ran)
orca.call_raw("tool_call", {"tool": "script_toggle_panel"})
found = orca.call("tool_search", query="mesh normals")
check("tool_search's search finds the Python API", found.get("python", {}).get("items", [{}])[0].get("name") ==
+2 -2
View File
@@ -53,7 +53,7 @@ def import_cube(args):
def repair_notices():
"""The notifications Fix Model's menu row ends in (the object list's fix_through_cgal()), and the open dialogs.
"""The notifications Fix Model's menu item ends in (the object list's fix_through_cgal()), and the open dialogs.
The object info notification of a selected object, which offers Fix Model, is not one."""
state = call("app_state", {})
ends = ("has been repaired", "have been repaired", "needed no repair", "Failed to repair", "Repairing was canceled")
@@ -70,7 +70,7 @@ def mesh_errors(index):
def wait_repaired(args):
"""Waits up to 30 s for object args["object"] to have no open edge and for Fix Model's notification, since the
command of a menu row that a mouse_gesture picks runs after the gesture's reply, and its progress dialog lets
command of a menu item that a mouse_gesture picks runs after the gesture's reply, and its progress dialog lets
calls in while it repairs, before the notification is pushed; returns its mesh errors and repair_notices()."""
deadline = time.monotonic() + 30
errors = mesh_errors(args["object"])
@@ -1,11 +1,11 @@
// The object commands made from rows, called by index, and with no target on the selection: object_rename,
// The object commands made from menu items, called by index, and with no target on the selection: object_rename,
// object_set_instances, object_separate_instances and object_delete name what they act on in their replies, which
// object_list reads back; the Delete Selected tile deletes the selection; object_set_height_ranges and
// object_set_variable_layer_height without object act on the selected object and name it. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/rows_objects.json --out <dir>
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/menu_items_objects.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "object rows by index",
"name": "object menu items by index",
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
@@ -1,14 +1,14 @@
// The placement commands made from rows, called by index: object_add_primitive on a plate, at a position and with a
// The placement commands made from menu items, called by index: object_add_primitive on a plate, at a position and with a
// name while another object is selected, in one undo step (the snapshots read from the log, fixtures/ops_undo.py);
// object_mirror, object_drop, object_center (each plate's objects on their own plate, then all on one),
// object_scale_to_fit and object_auto_orient (a cube on its edge laid on a face), each read back through object_list;
// and the Center, Drop, Scale to Fit and Auto-Orient tiles on the selection. Plate positions are those of the sweep's printer, a
// Bambu Lab X1 Carbon (a 256 mm bed): with three plates, plate 1's centre is at x 435.2, y 128 and plate 2's at x 128,
// y -179.2. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/rows_placement.json --out <dir>
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/menu_items_placement.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "placement rows by index",
"name": "placement menu items by index",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
@@ -1,13 +1,13 @@
// Runs the plate commands made from menu rows by index, as a call gives them, and reads each back from plate_list:
// Runs the plate commands made from menu items by index, as a call gives them, and reads each back from plate_list:
// plate_duplicate copies plate 1 while plate 0 is current, plate_rename names plate 2 (which its name icon makes
// current), plate_lock locks plate 3 and toggles it back, plate_select makes plate 2 current, and plate_delete
// deletes plate 1 while plate 2 is current, whose index drops to 1, leaving the objects of the deleted plate outside
// the plates. Each is called once with no plate too, and its reply names the current plate. Last, undo gives back the
// plate the last delete took. The project starts with a cube on each of two plates. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/rows_plates.json --out <dir>
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/menu_items_plates.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "rows plates",
"name": "menu items plates",
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
@@ -1,10 +1,10 @@
// The object structure commands made from rows, called by index: object_split into objects and into parts,
// The object structure commands made from menu items, called by index: object_split into objects and into parts,
// object_assemble, part_change_type and object_order name what they made or renumbered in their replies, which
// object_list reads back; the Split to Objects tile splits the selected object. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/rows_structure.json --out <dir>
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/menu_items_structure.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "object structure rows by index",
"name": "object structure menu items by index",
"vars": {"two_shells": "${replay_dir}/../../../tests/data/two_hollow_squares.obj"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
+1 -1
View File
@@ -1,4 +1,4 @@
// A call with exactly a tile's arguments does what a person's pick of the tile does, and a tile whose row and tool do
// A call with exactly a tile's arguments does what a person's pick of the tile does, and a tile whose menu item and tool do
// the same thing runs the tool's function: calibration_generate_test with test alone asks in the test's dialog, and
// with silent runs with its defaults; View: Top turns the Design tab's camera; Go to tab and Go to layer take their
// value through action_run; plate_slice {preview: true} and Slice and Preview slice and show the Preview tab; Deselect