diff --git a/docs/HLSD/mcp-server.md b/docs/HLSD/mcp-server.md index c28dcc9c05..0a3b0ac8db 100644 --- a/docs/HLSD/mcp-server.md +++ b/docs/HLSD/mcp-server.md @@ -75,12 +75,12 @@ arguments included, are `isError` results the model can act on; an unknown tool replay steps alike, so the journal records the schema's form. An argument under a name the tool does not take is read as one it does, when the call leaves that one out and the value fits it: `ref` as `target`, `key` as `keys`, `text` as `value`, `action` as `id` or `button`, `object` as `objects`, `plate` as `plates`, `filter` as -`query`, `settings` as `values`, `part` as `volume` (and `parts`, `part_id`, `part_ids` likewise), `path` +`query`, `settings` as `values`, `path` as `save_path` where the tool has no `path` of its own, and `view` as `set_view`'s `canvas` or `camera`, whichever takes the value. A value in another JSON form is converted: a number, boolean, array or object written as a string, an index as a string where a name may also go (`"0"` for a plate), a single item for an array. A value an enum lacks is read as the one it stands -for, when the enum lists that one: `print` as `process`, `part` as `volume`, `window` as `main`. A +for, when the enum lists that one: `print` as `process`, `window` as `main`. A value outside its argument's enum moves to the one other argument whose enum takes it, when the call leaves that out: `set_view`'s `canvas: "front"` is its `camera`. Each enum lists only its own values, since listing a camera direction under both had agents give it to the wrong one. Anything that still @@ -392,10 +392,10 @@ Script panel, which runs Python. | | `set_settings` | set values the way the settings tab does, all or none; one entry of a per-variant value; object and part overrides and filaments; the project's and a plate's own settings through their controls' and dialogs' code; `null` takes a preset's key back to its saved or parent value, `reset_all` drops a preset's unsaved changes first; replies with every setting that `changed` | | | `save_preset` | save the preset being edited under a name, as a user preset or inside the project | | | `delete_preset` | delete a user or project preset, selected or not, as the tab's Delete does (destructive) | -| Objects | `list_objects` | objects (filament, auto drop, overrides, brim ears, height range modifiers, variable layer height profile), instances (placement, mirrored, bounding box, canvas rectangle on request) and parts (type, filament, placement and bounding box on the bed, scaled and mesh volume, painted facets, text and SVG sources), paged | -| | `list_plates` | plates with the settings they print with and those they set themselves, objects, name, lock, slice state, prime tower position and layer G-codes, paged | +| Objects | `list_objects` | each plate with the objects on it, then the objects on no plate: objects (filament, auto drop, overrides, brim ears, height range modifiers, variable layer height profile), their instances there (placement, mirrored, bounding box, canvas rectangle on request) and parts (type, filament, placement and bounding box on the bed, scaled and mesh volume, painted facets, text and SVG sources), paged | +| | `list_plates` | plates with the settings they print with and those they set themselves, how many objects are on each, name, lock, slice state, prime tower position and layer G-codes, paged | | | `select_objects` | select objects, instances or parts (indices checked against what the object has), all, or none | -| | `transform` | translate, rotate, scale or size one instance, relative or absolute, move it to a `position` or to another plate; or the same for one part (`volume`) | +| | `transform` | translate, rotate, scale or size one instance, relative or absolute, move it to a `position` or to another plate; or the same for one part (`part`) | | | `add_part` | add a part, negative part, modifier, support blocker or enforcer, or precise seam to an object: a shape at a size or a model file, optionally at a position | | | `arrange` | arrange every unlocked plate or one plate, or fill an object's plate with instances or copies, with the Arrange options panel's settings; waits for the job | | | `set_height_ranges` | replace an object's height range modifiers: Z ranges with their own layer height, filament and process settings | @@ -458,10 +458,10 @@ copy), `run_javascript` (the page's own reach), and through what they run `run_a `sync_presets`), `call_tool`, `run_replay` and `run_script`, which has the app's access to the computer. No client is known to ask on it. `idempotent`: the same call again changes nothing more. -The tools that take an object index (`set_settings` object and volume scopes, `transform`, `add_part`, +The tools that take an object index (`set_settings` object and part scopes, `transform`, `add_part`, `set_height_ranges`, `set_variable_layer_height`) also take an optional `object_id`, and where they take a -part index a `volume_id`; `select_objects` takes `object_ids`, `instance_object_ids` and `volume_ids`, one per -entry of `objects`, `instances` and `volumes`: the `ObjectID` values `list_objects` reports as `id`, which `orca.host` shows +part index a `part_id`; `select_objects` takes `object_ids`, `instance_object_ids` and `part_ids`, one per +entry of `objects`, `instances` and `parts`: the `ObjectID` values `list_objects` reports as `id`, which `orca.host` shows too. `check_expected_ids()` refuses the call before anything changes when the index names another object or part now, so a replay or script addresses what it read. `list_objects`' description says what the ids are for and names the tools that take them, so each property only points back at it. Ids are allocated per @@ -473,8 +473,8 @@ Descriptions keep one order: what the tool does, the arguments that change it, ` fields it has, then edge cases; a long one puts each case on a line of its own (the scopes of `get_settings` and `set_settings`, `click`'s web pages). What several tools share is written once, since every session loads the whole tool list: the locator grammar in `list_widgets`'s description, -which hands out the refs, each `target` giving two examples and pointing there; the paging shape, and -that a part is a `volume` in argument names, in the server instructions. +which hands out the refs, each `target` giving two examples and pointing there; the paging shape in +the server instructions. An argument name means one thing across the tools, so what an agent learns from one tool holds for the next. `target` is the window or element a UI tool acts on (a ref, a locator, or `main`, `dialog` @@ -482,8 +482,12 @@ and the like), `canvas` a 3D view, `path` the file a tool is about, and `save_pa writes its file beside its reply. So the point `set_view`'s camera looks at is `look_at`, which `camera_state` reads back under the same name, and a drag's intermediate points are `waypoints`. The main window is `main` wherever a tool names it, as `list_windows` calls its kind; `window` is -another kind there. A tool that takes one plate calls it `plate`, an index; one that also takes -`"current"` or `"all"` calls it `plates`. Where a tool takes two unlike things of one word, each says +another kind there. A part of an object is `part` in arguments and replies, the Objects panel's word +for what the model calls a volume, which leaves `mesh_volume` and `scaled_volume` to mean cubic +millimetres. A tool that takes one plate calls it `plate`, an index; one that also takes +`"current"` or `"all"` calls it `plates`. Each refuses an index the project lacks in the same words +(`no_such_plate()`), which give the index and the plates there are, so an agent learns the range from +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'. @@ -501,7 +505,8 @@ protocol layer free of the GUI: `tools/call`, `call_tool`, `search_tools {tool}` plugin's or script's call. `run_action`, `call_cad_tool` and `describe_cad_tool` ask it themselves. Each tool family registers itself from its own `McpTools*.cpp` through `register_*_tools()`. -List tools take `limit` and `offset` and reply `{items, offset, total}` (`page()`), with `next_offset` while +List tools take `limit` and `offset` and reply `{items, offset, total}` (`page()`; `list_objects`, a tree, +has `plates` and `outside` in place of `items`), with `next_offset` while more remain: `search_actions` and `list_cad_tools` too, whose one page holds every CAD tool by default. The server instructions give that shape once, rather than every description, and each `limit` states its default. `McpPaths.hpp` requires @@ -513,9 +518,29 @@ narrow conversion would use the ANSI code page. ### list_objects -`list_objects` describes the model through `object_info()` and `volume_info()` (McpToolsScene.cpp, -libslic3r only, so unit tests build them from a `Model`); the handler adds what the GUI knows: each -instance's plate from the plate registry and, on request, its canvas rectangle. Bounding boxes are +`list_objects` lays the model out as the Objects panel does: `plates`, each `{index, name, objects}` +with the objects that have an instance on it, then `outside`, the objects with an instance on no +plate. `objects_by_plate()` builds it from `object_info()` and `volume_info()` (McpToolsScene.cpp, +libslic3r only, so unit tests build them from a `Model`) and a callback that says which plate an +instance is on. The handler's is `instance_plate()`: the plate registry's answer or, for an instance +the registry does not hold, as Fill bed leaves its new ones, the first plate the instance stands on, +so the copies that fill a plate are listed on it. `list_plates` counts a plate's objects the same +way. On request the handler adds each instance's canvas rectangle. + +The reply differs from the panel in two places, both so that a row says all an agent needs to act +on it. A plate holds instances, not objects, so an object row lists the instances of its plate only, +and an object with instances on two plates has a row under each; the panel shows it once, under its +first instance's plate. And an object always lists its `parts`, even a single one, which the panel +folds into the object's row: painting, a part's filament and its settings address the part. An +object with several parts is what Assemble makes, and the reply has no other kind for it. + +An object's `index` numbers it in the project and a part's in its object, whatever the plate, since +those are what the other tools take. `plate` lists one plate alone, without `outside`. `limit` and +`offset` page the objects listed, in the model's order, and `total` counts them, each once however +many plates it is on. A page lists its objects under every plate they are on, so the rows of one +object come together. + +Bounding boxes are `ModelObject::instance_bounding_box()`, on the bed and of model parts only, which is what prints; the Object manipulation panel's Size also counts modifiers and negative parts. A part's `position`, `bbox` and `scaled_volume` (the mesh's volume times the determinant of its placement) are measured on @@ -527,7 +552,7 @@ column: an object's `extruder`, 1 when unset; a part's own, else its object's; a it sets one, since a modifier without one leaves the filament of what it covers alone; none for negative parts, support blockers and enforcers, and precise seams. A precise seam has `type: "precise_seam"` and its `subtype` (`center`, `left`, `right`, `enforced`, `blocked`, `neutral`, the 3MF -names without their prefix). The `transform` reply on a part carries the same `volume_info`. An +names without their prefix). The `transform` reply on a part carries the same entry as `part_info`. An object with height range modifiers lists them as `layer_config_ranges` (`layer_config_ranges_json()`), each with its whole config serialized as `get_settings` serializes values, so a range always shows its `layer_height` and `extruder`, and the list can be handed back to `set_height_ranges` unchanged. An @@ -554,7 +579,7 @@ leaving it sunk, and the instance is registered with the plate it is on now `GLCanvas3D::do_move()` does for a person's moves. Slicing and `list_objects` read plates from that registry. -On a part (`volume`), it takes the Object manipulation panel's path. It refuses the assemble view, an +On a part (`part`), it takes the Object manipulation panel's path. It refuses the assemble view, an open gizmo and an object with one part (which has no row of its own), selects the part's row in the object list with nothing else selected, so the 3D view selects it on instance 0, takes one undo snapshot, and runs `Selection::translate()` / `rotate()` along the bed's axes and `scale()` along the @@ -716,7 +741,7 @@ object or across a spiral vase change. The journal records the plate the call re ### Object and part settings -The object and volume scopes of `get_settings` and `set_settings` take the keys the object list +The object and part scopes of `get_settings` and `set_settings` take the keys the object list offers to add to an object, or to a part or modifier: `SettingsFactory::get_options()` less what `SettingsFactory::is_improper_category()` hides with the current filament count, the rule of the list's Add Settings menu. Keys a person cannot add there, such as the internal `print_extruder_id`, @@ -727,7 +752,7 @@ than stored and ignored by slicing. Parts and modifiers take region keys only. it through `ObjectList::set_extruder_for_items()`, the Change Filament code without the selection, so a call leaves the user's selection alone. An object's filament clears its parts' own; 0 or null is Default, which is filament 1 on an object, the object's filament on a part and no filament -override on a modifier. A single-part object has no part row, so its volume 0 sets the object's +override on a modifier. A single-part object has no part row, so its part 0 sets the object's filament, and the reply notes it. Filament numbers (`extruder`, the per-feature and the support filaments) past the project's slots are refused before anything changes, and the support filaments refuse a mixed slot, as their combos do. A call is one undo step (`Plater::SingleSnapshot`). @@ -760,7 +785,7 @@ There is no subset of edits to save. `set_settings {"reset_all": true, "values": scope first discards every unsaved change with `Tab::on_roll_back_value()`, the tab's undo button, then applies the values in the same call, so `save_preset` keeps exactly those. The reply lists the discarded keys in `reverted`. The values are parsed before the reset, so a bad one leaves the edits in -place. The object and volume scopes refuse `reset_all`; a null value removes an override there. +place. The object and part scopes refuse `reset_all`; a null value removes an override there. ### Reading, comparing and changing preset values @@ -845,7 +870,7 @@ On a preset scope, a `null` value takes the key back to the saved preset's value arrow does, and with `reset_to: "parent"` to the value of the preset it inherits from (the `:parent` of `compare`), as its lock icon does. The value joins the call's other values in the tab's transaction, so its handling runs as for a typed value. `reset_to` without a null value, and in the -object and volume scopes, is refused. +object and part scopes, is refused. `select_preset` finds the name in the selector the GUI picks from: the sidebar's filament combo of the slot, or the tab's combo, by the label shown or the internal name. A selector lists the visible, @@ -993,7 +1018,7 @@ and `changed`. The plate tab's `skirt_start_angle` and the per-plate filament gr scope. `list_plates` reports every plate with these values as it prints them, `overrides` (the keys it sets -itself), `current`, `objects` (`[object, instance]`, as `list_objects` places instances), `sliced` (an +itself), `current`, `objects` (how many objects have an instance on it; `list_objects` lists them), `sliced` (an up-to-date slice), `wipe_tower` (the project's tower position for the plate) and `layer_gcode`, the plate's entry of `Model::plates_custom_gcodes`: the Preview slider's ticks, pauses, custom G-code, templates and filament changes, each `{z, layer, type, filament, color, gcode}` by height. `z` is rounded @@ -1558,7 +1583,7 @@ gives it (`selection_state()`): in `select_objects`'s own indices, the objects, in and, when the selection holds parts rather than whole instances, those parts. An agent reads it before an operation that acts on the selection: `run_action` runs the object operations the catalog has (delete, split, mirror, center, drop, instances, arrange, orient, change type, rename, assemble, -set as individual objects, order by), and `set_settings` with the object or volume scope edits their +set as individual objects, order by), and `set_settings` with the object or part scope edits their settings and filament. `add_part` adds parts, modifiers and support shapes, `set_height_ranges` sets height range modifiers, and `set_variable_layer_height` runs the Variable layer height panel's buttons. `set_custom_gcode_at_layer` does what the Preview layer slider's right-click menu does. @@ -1934,8 +1959,8 @@ panel fields or `transform` set those values. Pickers inside a gizmo go through actions are the bodies of those pickers (`GLGizmoSVG::change_file()`, `save_svg_as()`, `GLGizmoTextureDisplacement::import_texture()`). -`mouse_gesture` takes points of the model (`CanvasTarget`): `{object, instance, volume}` with `point` in -the part's mesh coordinates (`frame: "volume"`, mapped by `GLVolume::world_matrix()`, which follows +`mouse_gesture` takes points of the model (`CanvasTarget`): `{object, instance, part}` with `point` in +the part's mesh coordinates (`frame: "part"`, mapped by `GLVolume::world_matrix()`, which follows the assemble view's offset and explosion) or in the scene's (`"world"`), or `spot`, where a ray along an axis through the part's displayed bounding box first meets it. A point is projected through the camera the canvas was drawn with and converted to logical pixels. With `check: "surface"` (the @@ -3448,7 +3473,7 @@ dialog's description, a web dialog rule's wx buttons and web view handles; budget, non-blocking push, finish, abort and failed frames, the video transform, overlays and frame repeats, captions and what they hide, the ffmpeg command and listings, the files recordings and encodes reserve, and the journal's recording paths; `test_mcp_tools` setting serialization, how a query ranks -the Speed Dial's actions, and which catalog a name its own lacks is pointed to; `test_mcp_config` the object and volume scopes' keys and +the Speed Dial's actions, and which catalog a name its own lacks is pointed to; `test_mcp_config` the object and part scopes' keys and effective values, the names and places `save_preset` accepts, enum labels and descriptions, the settings search, per-variant entries and their writes, preset comparison, `changed`, which unsaved changes a call discarded, which presets `delete_preset` refuses or deletes with a custom printer, the project scope's slot colours, @@ -3502,8 +3527,9 @@ connection. See `tools/mcp/README.md`. commands' size param, notifications updated before the first ImGui frame, `arrange`'s option rules, worker-job admission on a stand-in worker (a job past the reply budget, a slow cancel and a timeout, three ways to start one, recover input and a person's job), `list_objects`' descriptions of a `Model` -built in the test (placement and boxes on the bed, mirrors, filament fallback, precise seam subtypes, -height ranges, the summary of a variable layer height profile), `add_part`'s type names and shape +built in the test (its rows by plate, the plate filter and paging, placement and boxes on the bed, +mirrors, filament fallback, precise seam subtypes, height ranges, the summary of a variable layer +height profile), `add_part`'s type names and shape sizes, the object structure commands' params, the height ranges `set_height_ranges` accepts (order, overlaps, bounds, keys), and `set_custom_gcode_at_layer`'s edits of a layer slider built in the test (by layer and height, in-place edits, refusals that leave the slider as it was, the type names). On the app, diff --git a/src/slic3r/GUI/Mcp/McpJournal.cpp b/src/slic3r/GUI/Mcp/McpJournal.cpp index 8184986528..388a321dbd 100644 --- a/src/slic3r/GUI/Mcp/McpJournal.cpp +++ b/src/slic3r/GUI/Mcp/McpJournal.cpp @@ -55,7 +55,7 @@ json without_expected_ids(const std::string& tool, json args) return args; } if (takes_ids.count(tool) != 0) - for (const char* key : {"object_id", "volume_id", "object_ids", "volume_ids", "instance_object_ids"}) + for (const char* key : {"object_id", "part_id", "object_ids", "part_ids", "instance_object_ids"}) args.erase(key); return args; } diff --git a/src/slic3r/GUI/Mcp/McpJournal.hpp b/src/slic3r/GUI/Mcp/McpJournal.hpp index e07b2dcf08..2fc449850c 100644 --- a/src/slic3r/GUI/Mcp/McpJournal.hpp +++ b/src/slic3r/GUI/Mcp/McpJournal.hpp @@ -26,7 +26,7 @@ namespace Slic3r { namespace GUI { namespace Mcp { // its reply or before it, and the answer depends on it. Such a job replays with `await:false`, and a // call that answered a dialog replays after a `wait {for:"dialog"}`, since the dialog may open later // than the job's replayed reply. Thread-safe. -// `args` of a `tool` call as the journal records them: expected object_id and volume_id are left out, +// `args` of a `tool` call as the journal records them: expected object_id and part_id are left out, // as ids are allocated per process and a replay addresses by index. Inside a run_replay's inline steps // too; a run_script call's code and args stay as written, since a script reads the ids it uses. nlohmann::json without_expected_ids(const std::string& tool, nlohmann::json args); diff --git a/src/slic3r/GUI/Mcp/McpProtocol.cpp b/src/slic3r/GUI/Mcp/McpProtocol.cpp index 757f2a8618..2d24824ea5 100644 --- a/src/slic3r/GUI/Mcp/McpProtocol.cpp +++ b/src/slic3r/GUI/Mcp/McpProtocol.cpp @@ -161,8 +161,6 @@ const std::vector>>& argument_al static const std::vector>> aliases{ {"ref", {"target"}}, {"key", {"keys"}}, {"text", {"value"}}, {"action", {"id", "button"}}, {"object", {"objects"}}, {"plate", {"plates"}}, {"filter", {"query"}}, {"settings", {"values"}}, - // A part is a volume in argument names. - {"part", {"volume"}}, {"parts", {"volumes"}}, {"part_id", {"volume_id"}}, {"part_ids", {"volume_ids"}}, // A capture's output file, where the tool has no path of its own. {"path", {"save_path"}}, // set_view's 3D view, or the camera's direction, whichever takes the value. @@ -172,11 +170,11 @@ const std::vector>>& argument_al } // Values agents reach for in place of the ones an enum lists, each with the value it stands for: the -// process preset is the print preset in OrcaSlicer's files, a part is a volume in argument names, and -// the main window is "the window" where no other window can be meant. +// process preset is the print preset in OrcaSlicer's files, and the main window is "the window" where no +// other window can be meant. const std::vector>& value_aliases() { - static const std::vector> aliases{{"print", "process"}, {"part", "volume"}, {"window", "main"}}; + static const std::vector> aliases{{"print", "process"}, {"window", "main"}}; return aliases; } diff --git a/src/slic3r/GUI/Mcp/McpService.cpp b/src/slic3r/GUI/Mcp/McpService.cpp index 1682b5656f..e6e5ff2efe 100644 --- a/src/slic3r/GUI/Mcp/McpService.cpp +++ b/src/slic3r/GUI/Mcp/McpService.cpp @@ -178,10 +178,10 @@ const char* kInstructions = "scope, which looks through the process, filament and printer settings; each item names its scope, the one " "set_settings needs (its default is the process), and its meta has its description and where (its settings page and " "group).\n" - "- Objects, parts (volume in argument names) and plates are 0-based indices, as list_objects and list_plates give " + "- Objects, parts and plates are 0-based indices, as list_objects and list_plates give " "them; filament slots and Preview layers are 1-based.\n" "- Lists come in pages: {items, offset, total}, with next_offset while more remain; call again with that offset to " - "read on.\n" + "read on. list_objects has plates and outside in place of items.\n" "- Paths are absolute. Outputs never overwrite a file unless overwrite is true.\n" "UI lane:\n" "- run_action runs every Speed Dial command (search_actions finds them): prefer it to GUI clicks.\n" diff --git a/src/slic3r/GUI/Mcp/McpTools.hpp b/src/slic3r/GUI/Mcp/McpTools.hpp index 93b0f2a380..7cc1e403b5 100644 --- a/src/slic3r/GUI/Mcp/McpTools.hpp +++ b/src/slic3r/GUI/Mcp/McpTools.hpp @@ -27,6 +27,7 @@ class PythonSession; struct Calib_Params; class ConfigOptionDef; class DynamicPrintConfig; +class Model; class ModelObject; class ModelVolume; enum class ModelVolumeType : int; @@ -38,6 +39,7 @@ namespace CustomGCode { struct Info; } namespace GUI { class IMSlider; +class PartPlateList; class Plater; namespace Mcp { @@ -100,7 +102,7 @@ ToolDef mutate_tool(std::string name, std::string title, std::string description // The schema of an expected ID argument: the id list_objects reports for an object or part (`of`), which // orca.host shows too, so a script addresses what it read. nlohmann::json expected_id_prop(const char* of); -// Refuses the call when `args` names an expected object_id, or volume_id, that is not the id of `object`, +// Refuses the call when `args` names an expected object_id, or part_id, that is not the id of `object`, // or `volume`, which its index names now: the model changed since the caller read the index. Call it // before the tool changes anything. void check_expected_ids(const ModelObject& object, const ModelVolume* volume, const nlohmann::json& args); @@ -115,6 +117,9 @@ void settle(ToolContext& ctx); // UI thread only. Plater& ui_plater(); +// What a tool says of a plate index the project does not have: the index, and the plates there are. +std::string no_such_plate(int plate, int count); + // Typed argument access with defaults; schema validation has already checked the types. std::string arg_string(const nlohmann::json& args, const char* key, const std::string& fallback = {}); int arg_int(const nlohmann::json& args, const char* key, int fallback); @@ -438,6 +443,20 @@ nlohmann::json object_info(const ModelObject& object, std::size_t index); // A part as list_objects describes it: its type, filament, placement on the bed measured on instance 0, // rotation and scale in the object's frame, mesh, paint, and what a text or SVG part was made from. nlohmann::json volume_info(const ModelVolume& volume, std::size_t index); +// What list_objects replies with, laid out as the Objects panel is: `plates`, each {index, name, objects} +// with the objects that have an instance on it, and `outside`, the objects with an instance on no plate. +// An object row lists the instances of its plate only, so an object on two plates has a row under each. +// `plate_of(object, instance)` is the plate an instance is on, or -1, and `plate_names` has a name per +// plate. Of `args`, plate lists that plate alone, without `outside`, and limit (default 200) and offset +// page the objects listed, in the model's order: total counts them, each once, and next_offset is there +// while more follow. A page lists its objects under every plate they are on. +nlohmann::json objects_by_plate(const Model& model, const std::vector& plate_names, + const std::function& plate_of, + const nlohmann::json& args); + +// The plate an instance is on, or -1 on none: the plate registry's answer or, for an instance the +// registry does not hold, as Fill bed leaves its new ones, the first plate it stands on. UI thread. +int instance_plate(PartPlateList& plates, int object, int instance); // What `canvas` has selected, in the indices select_objects takes: its objects, the instances [[object, instance]] // they are selected in and, when the selection holds parts rather than whole instances, those parts diff --git a/src/slic3r/GUI/Mcp/McpToolsApp.cpp b/src/slic3r/GUI/Mcp/McpToolsApp.cpp index f2fb40f525..36f82a6bb3 100644 --- a/src/slic3r/GUI/Mcp/McpToolsApp.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsApp.cpp @@ -254,7 +254,7 @@ void register_app_tools(McpService& service) "Preferences and restarts). The project: current tab and mode, printer technology, name, path and unsaved changes, " "selected printer/process/filament presets, plates (count, current), object count, the selection (objects, the " "instances [[object, instance]] they are selected in and, when parts rather than whole instances are selected, " - "volumes [[object, part]], in the indices select_objects takes; wipe_tower when a prime tower is selected; canvas is the 3D " + "parts [[object, part]], in the indices select_objects takes; wipe_tower when a prime tower is selected; canvas is the 3D " "view it belongs to), slicing state, " "the Preview's view type, time mode and layer range (1-based, with their Z), and the camera of the 3D view shown " "(camera: type, look_at, position, zoom, click_px_per_mm, elevation and azimuth, as set_view replies with it). What " diff --git a/src/slic3r/GUI/Mcp/McpToolsCad.cpp b/src/slic3r/GUI/Mcp/McpToolsCad.cpp index e9b166d9f8..5d338038d9 100644 --- a/src/slic3r/GUI/Mcp/McpToolsCad.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsCad.cpp @@ -904,7 +904,7 @@ json tool_rows() {"title": "An STL mesh turned into an editable body", "needs": "an STL or OBJ mesh file", "calls": [ {"tool": "import_mesh", "args": {"path": "/path/to/part.stl"}}]}])json")}}, json{{"name", "commit"}, {"summary", "Commit to Plate: send the visible bodies to Prepare at their Move-gizmo positions and show Prepare."}, - {"details", "It is one Prepare undo step. A lone body is sent even when hidden. A body named in the Bodies list or with body_set names its object or part. Reply: objects (list_objects index after replace, name, volumes), bodies_sent, bodies_hidden, replaced."}, + {"details", "It is one Prepare undo step. A lone body is sent even when hidden. A body named in the Bodies list or with body_set names its object or part. Reply: objects (list_objects index after replace, name, parts: how many), bodies_sent, bodies_hidden, replaced."}, {"params", json::array({ json{{"name", "mode"}, {"type", "string"}, {"enum", json::array({"assembly", "bodies"})}, {"default", ""}, {"description", "assembly: one object with a part per body; bodies: an object per body. Default: the Commit button's mode, which this leaves as it is."}}, json{{"name", "replace"}, {"type", "array"}, {"default", json::array()}, {"description", "list_objects indices to delete in the same undo step, such as an earlier commit. Their settings, modifiers and paint go with them."}}, @@ -4145,7 +4145,7 @@ json action_commit(DesignPanel* panel, const json& params) json objects = json::array(); for (const ModelObject* o : made) { const auto it = std::find(model.objects.begin(), model.objects.end(), o); - objects.push_back(json{{"index", int(it - model.objects.begin())}, {"name", o->name}, {"volumes", o->volumes.size()}}); + objects.push_back(json{{"index", int(it - model.objects.begin())}, {"name", o->name}, {"parts", o->volumes.size()}}); } json hidden = json::array(); for (int b = 0; b < int(doc.bodies.size()); ++b) diff --git a/src/slic3r/GUI/Mcp/McpToolsCommon.cpp b/src/slic3r/GUI/Mcp/McpToolsCommon.cpp index fe2b7580f9..4fbd4eda1b 100644 --- a/src/slic3r/GUI/Mcp/McpToolsCommon.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsCommon.cpp @@ -227,6 +227,12 @@ std::string arg_string(const json& args, const char* key, const std::string& fal return it != args.end() && it->is_string() ? it->get() : fallback; } +std::string no_such_plate(int plate, int count) +{ + return "Plate " + std::to_string(plate) + " does not exist (the project has " + + (count == 1 ? "plate 0 only" : "plates 0.." + std::to_string(count - 1)) + ")"; +} + int arg_int(const json& args, const char* key, int fallback) { auto it = args.find(key); @@ -319,9 +325,9 @@ void check_expected_ids(const ModelObject& object, const ModelVolume* volume, co "), not the expected id " + std::to_string(args["object_id"].get()) + ": list_objects again", {{"id", object.id().id}}); - if (volume != nullptr && args.contains("volume_id") && args["volume_id"].get() != volume->id().id) + if (volume != nullptr && args.contains("part_id") && args["part_id"].get() != volume->id().id) throw ToolFailure("The part at this index is now \"" + volume->name + "\" (id " + std::to_string(volume->id().id) + - "), not the expected id " + std::to_string(args["volume_id"].get()) + + "), not the expected id " + std::to_string(args["part_id"].get()) + ": list_objects again", {{"id", volume->id().id}}); } diff --git a/src/slic3r/GUI/Mcp/McpToolsConfig.cpp b/src/slic3r/GUI/Mcp/McpToolsConfig.cpp index 26e34c2100..ad25896eef 100644 --- a/src/slic3r/GUI/Mcp/McpToolsConfig.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsConfig.cpp @@ -560,7 +560,7 @@ int scope_plate(const json& args) PartPlateList& plates = ui_plater().get_partplate_list(); const int index = arg_int(args, "plate", plates.get_curr_plate_index()); if (index < 0 || index >= plates.get_plate_count()) - throw ToolFailure("plate must be 0.." + std::to_string(plates.get_plate_count() - 1)); + throw ToolFailure(no_such_plate(index, plates.get_plate_count())); return index; } @@ -774,12 +774,16 @@ json list_plates(const json& args) if (is_plate_setting(key) && !plate_value(plate, key, false).is_null()) overrides.push_back(key); entry["overrides"] = std::move(overrides); - json objects = json::array(); - for (std::size_t o = 0; o < model.objects.size(); ++o) - for (std::size_t j = 0; j < model.objects[o]->instances.size(); ++j) - if (plates.find_instance(int(o), int(j)) == i) - objects.push_back({int(o), int(j)}); - entry["objects"] = std::move(objects); + // How many objects have an instance on the plate; list_objects lists them. + int objects = 0; + for (std::size_t o = 0; o < model.objects.size(); ++o) { + const std::size_t instances = model.objects[o]->instances.size(); + std::size_t j = 0; + while (j < instances && instance_plate(plates, int(o), int(j)) != i) + ++j; + objects += j < instances; + } + entry["objects"] = objects; entry["sliced"] = plate.is_slice_result_valid(); if (tower_x != nullptr && tower_y != nullptr && !tower_x->empty() && !tower_y->empty()) entry["wipe_tower"] = {tower_x->get_at(std::size_t(i)), tower_y->get_at(std::size_t(i))}; @@ -801,7 +805,7 @@ ConfigTarget resolve_target(const json& args, bool for_write) const std::string scope = arg_string(args, "scope", "process"); PresetBundle& bundle = *wxGetApp().preset_bundle; ConfigTarget t; - if (scope == "object" || scope == "volume") { + if (scope == "object" || scope == "part") { Plater& plater = ui_plater(); const int idx = arg_int(args, "object", -1); ModelObjectPtrs& objects = plater.model().objects; @@ -809,10 +813,10 @@ ConfigTarget resolve_target(const json& args, bool for_write) throw ToolFailure("object must be an index from list_objects (0.." + std::to_string(int(objects.size()) - 1) + ")"); t.object = objects[size_t(idx)]; t.object_index = idx; - if (scope == "volume") { - const int v = arg_int(args, "volume", -1); + if (scope == "part") { + const int v = arg_int(args, "part", -1); if (v < 0 || v >= int(t.object->volumes.size())) - throw ToolFailure("volume must be a part index from list_objects"); + throw ToolFailure("part must be a part index from list_objects"); t.volume = t.object->volumes[size_t(v)]; t.config = &t.volume->config.get(); } else { @@ -946,7 +950,7 @@ wxDataViewItem filament_row(const ConfigTarget& t) { ObjectDataViewModel& rows = *wxGetApp().obj_list()->GetModel(); if (t.volume != nullptr && !t.volume->is_model_part() && !t.volume->is_modifier()) - throw ToolFailure("Only parts and modifiers take a filament; this volume is a negative part, a support blocker or enforcer, " + throw ToolFailure("Only parts and modifiers take a filament; this one is a negative part, a support blocker or enforcer, " "or a seam modifier"); if (t.volume == nullptr || t.object->volumes.size() == 1) return rows.GetItemById(t.object_index); @@ -1079,7 +1083,7 @@ json effective_setting(const std::string& key, const DynamicPrintConfig& process const ModelVolume& v = *object.volumes[i]; if (v.is_model_part() || v.is_modifier()) if (const ConfigOption* opt = own(v.config)) - parts.push_back({{"volume", int(i)}, {"value", opt->serialize()}}); + parts.push_back({{"part", int(i)}, {"value", opt->serialize()}}); } if (!parts.empty()) out["parts"] = std::move(parts); @@ -1884,7 +1888,7 @@ void register_config_tools(McpService& service) ToolRegistry& reg = service.registry(); const json plate_prop = {{"type", "integer"}, {"minimum", 0}, {"description", "Plate index (plate scope; default: the current plate)."}}; // get_settings and set_settings take the same scopes and differ in what they do without one. - const std::vector scopes{"process", "filament", "printer", "object", "volume", "project", "plate", "preferences"}; + const std::vector scopes{"process", "filament", "printer", "object", "part", "project", "plate", "preferences"}; const std::string scope_text = "Which settings: the process, filament or printer preset being edited, an " "object's / part's own overrides, the project's own settings, a plate's, or the " "app's preferences (read only)."; @@ -2153,7 +2157,7 @@ void register_config_tools(McpService& service) "- process, filament, printer: the preset being edited, or with preset a saved one; compare lists only " "the keys that differ from another preset (value and other). A per-variant value lists in meta its variants (what " "each entry is for) and active (the entry each extruder prints with).\n" - "- object, volume: the overrides that object or part carries, each with effective (the value it prints with) and " + "- object, part: the overrides that object or part carries, each with effective (the value it prints with) and " "source (part, object, process or default); an object's item lists in parts the parts and modifiers that override " "the key inside their own volume.\n" "- project: the plate type, slot colours, flushing volumes, purge mode, prime tower position per plate, mixed slots " @@ -2169,8 +2173,8 @@ void register_config_tools(McpService& service) "matches unless limit says otherwise.")}, {"where", prop("string", "A settings page, or \"Page > Group\" as meta.where gives it, e.g. " "\"Strength > Walls\".")}, - {"object", {{"type", "integer"}, {"minimum", 0}, {"description", "Object index (object/volume scope)."}}}, - {"volume", {{"type", "integer"}, {"minimum", 0}, {"description", "Part index (volume scope)."}}}, + {"object", {{"type", "integer"}, {"minimum", 0}, {"description", "Object index (object/part scope)."}}}, + {"part", {{"type", "integer"}, {"minimum", 0}, {"description", "Part index (part scope)."}}}, {"plate", plate_prop}, {"filament_slot", {{"type", "integer"}, {"minimum", 1}, {"description", "Filament slot, 1-based."}}}, {"preset", prop("string", "Preset scopes: read this saved preset (a name from list_presets) instead of the " @@ -2200,7 +2204,7 @@ void register_config_tools(McpService& service) "parent's; reset_all first discards every unsaved change, as the tab's undo button does (reply: reverted). A " "per-variant value (get_settings meta.variants) takes one value for the entries in use (meta.active), {index, " "value} for one entry, or an array of all.\n" - "- object, volume: overrides of the keys the object list offers there; null removes one. extruder is the object's " + "- object, part: overrides of the keys the object list offers there; null removes one. extruder is the object's " "or part's filament (1-based; 0 or null for Default), set as the Change Filament menu does.\n" "- project, as the sidebar's controls write them: curr_bed_type, filament_colour (#RRGGBB per slot), " "flush_multiplier, flush_volumes_matrix, prime_volume_mode, and wipe_tower_x/y (mm from the plate's origin, one per " @@ -2216,10 +2220,10 @@ void register_config_tools(McpService& service) {"reset_all", prop("boolean", "Preset scopes: discard the unsaved changes before applying values.")}, {"reset_to", enum_prop({"saved", "parent"}, "Preset scopes: what a null value takes a key back to: the " "saved preset (default) or the preset it inherits from.")}, - {"object", {{"type", "integer"}, {"minimum", 0}, {"description", "Object index (object/volume scope)."}}}, - {"volume", {{"type", "integer"}, {"minimum", 0}, {"description", "Part index (volume scope)."}}}, + {"object", {{"type", "integer"}, {"minimum", 0}, {"description", "Object index (object/part scope)."}}}, + {"part", {{"type", "integer"}, {"minimum", 0}, {"description", "Part index (part scope)."}}}, {"object_id", expected_id_prop("object")}, - {"volume_id", expected_id_prop("part")}, + {"part_id", expected_id_prop("part")}, {"plate", plate_prop}, {"filament_slot", {{"type", "integer"}, {"minimum", 1}, {"description", "Filament slot, 1-based."}}}}), [](const json& args, ToolContext& ctx) { @@ -2360,7 +2364,7 @@ void register_config_tools(McpService& service) reg.add(inspect_tool( "list_plates", L("List plates"), - "Plates with name, locked, current, objects ([object, instance]), and the settings they print with: curr_bed_type, " + "Plates with name, locked, current, objects (how many are on it; list_objects lists them), and the settings they print with: curr_bed_type, " "print_sequence, spiral_mode, first_layer_print_sequence and other_layers_print_sequence (null: Auto); overrides " "lists those the plate sets itself (set_settings scope plate). Also sliced (an up-to-date slice), wipe_tower [x, y] " "and layer_gcode: the plate's pauses, custom G-code, templates and filament changes, each {z, layer, type, " diff --git a/src/slic3r/GUI/Mcp/McpToolsLayers.cpp b/src/slic3r/GUI/Mcp/McpToolsLayers.cpp index e903157d01..677d626b4f 100644 --- a/src/slic3r/GUI/Mcp/McpToolsLayers.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsLayers.cpp @@ -206,7 +206,7 @@ int gcode_plate(Plater& plater, const json& args) PartPlateList& plates = plater.get_partplate_list(); const int index = arg_int(args, "plate", plates.get_curr_plate_index()); if (index < 0 || index >= plates.get_plate_count()) - throw ToolFailure("plate must be 0.." + std::to_string(plates.get_plate_count() - 1)); + throw ToolFailure(no_such_plate(index, plates.get_plate_count())); PartPlate& plate = *plates.get_plate(index); const std::string name = "plate " + std::to_string(index); // The slider's menus offer no codes on a plate printed by object, and it erases them all when it diff --git a/src/slic3r/GUI/Mcp/McpToolsProject.cpp b/src/slic3r/GUI/Mcp/McpToolsProject.cpp index 1991843e10..85f19478b8 100644 --- a/src/slic3r/GUI/Mcp/McpToolsProject.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsProject.cpp @@ -671,7 +671,7 @@ void register_project_tools(McpService& service) if (plate.is_number_integer()) { const int index = plate.get(); if (index < 0 || index >= plater.get_partplate_list().get_plate_count()) - throw ToolFailure("plate index out of range"); + throw ToolFailure(no_such_plate(index, plater.get_partplate_list().get_plate_count())); plater.select_plate(index); } if (format == "gcode") { diff --git a/src/slic3r/GUI/Mcp/McpToolsScene.cpp b/src/slic3r/GUI/Mcp/McpToolsScene.cpp index 5921ef5e20..6f97f01924 100644 --- a/src/slic3r/GUI/Mcp/McpToolsScene.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsScene.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -223,10 +224,8 @@ json screen_rect(GLCanvas3D& canvas, int object, int instance) json list_objects(const json& args) { - Plater& plater = ui_plater(); - PartPlateList& plates = plater.get_partplate_list(); - const ModelObjectPtrs& objects = plater.model().objects; - const int only_plate = arg_int(args, "plate", -1); + Plater& plater = ui_plater(); + PartPlateList& plates = plater.get_partplate_list(); // Screen rectangles are of the 3D view shown, Prepare's or the assemble view's. GLCanvas3D* canvas = nullptr; if (arg_bool(args, "screen", false)) { @@ -234,28 +233,23 @@ json list_objects(const json& args) if (canvas == nullptr || canvas == plater.get_preview_canvas3D()) throw ToolFailure("screen needs the Prepare view or the assemble view shown (set_view)"); } - json items = json::array(); - for (size_t i = 0; i < objects.size(); ++i) { - const ModelObject* o = objects[i]; - std::vector on(o->instances.size()); - bool on_plate = only_plate < 0; - for (size_t j = 0; j < o->instances.size(); ++j) { - on[j] = plates.find_instance(int(i), int(j)); - on_plate = on_plate || on[j] == only_plate; - } - if (!on_plate) - continue; - json item = object_info(*o, i); - for (size_t j = 0; j < o->instances.size(); ++j) { - json& inst = item["instances"][j]; - inst["plate"] = on[j]; - if (canvas != nullptr) - inst["screen"] = screen_rect(*canvas, int(i), int(j)); - } - items.push_back(std::move(item)); + std::vector names; + for (int i = 0; i < plates.get_plate_count(); ++i) + names.push_back(plates.get_plate(i)->get_plate_name()); + json out = objects_by_plate(plater.model(), names, + [&](std::size_t object, std::size_t instance) { return instance_plate(plates, int(object), int(instance)); }, + args); + if (canvas != nullptr) { + const auto add_screen = [&](json& objects) { + for (json& object : objects) + for (json& instance : object["instances"]) + instance["screen"] = screen_rect(*canvas, object["index"].get(), instance["index"].get()); + }; + for (json& plate : out["plates"]) + add_screen(plate["objects"]); + if (out.contains("outside")) + add_screen(out["outside"]); } - json out = page(items, args, 200); - out["plates"] = plates.get_plate_count(); return out; } @@ -294,7 +288,7 @@ json transform_instance(Plater& plater, int oi, const json& args) if (args.contains("plate")) { const int to = arg_int(args, "plate", 0); if (to >= plates.get_plate_count()) - throw ToolFailure("plate " + std::to_string(to) + " does not exist; run_action plate_add makes one"); + throw ToolFailure(no_such_plate(to, plates.get_plate_count()) + "; run_action plate_add makes one"); const int from = plates.find_instance(oi, ii); if (from < 0) throw ToolFailure("instance " + std::to_string(ii) + " is off every plate; place it with translate (absolute) first"); @@ -339,9 +333,9 @@ json transform_instance(Plater& plater, int oi, const json& args) json transform_part(Plater& plater, int oi, const json& args) { ModelObject* object = plater.model().objects[size_t(oi)]; - const int vi = arg_int(args, "volume", 0); + const int vi = arg_int(args, "part", 0); if (vi >= int(object->volumes.size())) - throw ToolFailure("volume index out of range"); + throw ToolFailure("part index out of range"); check_expected_ids(*object, object->volumes[size_t(vi)], args); // A single part has no row of its own in the object list, so the panel can't select it. if (object->volumes.size() == 1) @@ -349,7 +343,7 @@ json transform_part(Plater& plater, int oi, const json& args) if (arg_int(args, "instance", 0) != 0) throw ToolFailure("a part belongs to its object and moves on every instance; leave instance out"); if (args.contains("plate")) - throw ToolFailure("plate moves an instance; leave volume out"); + throw ToolFailure("plate moves an instance; leave part out"); const bool absolute = arg_string(args, "mode", "relative") == "absolute"; if (absolute && args.contains("rotate")) throw ToolFailure("rotate a part relative to its current rotation (mode \"relative\")"); @@ -392,7 +386,7 @@ json transform_part(Plater& plater, int oi, const json& args) sel.scale(*scale, TransformationType::Local_Relative_Joint); canvas.do_scale(""); } - return {{"object", oi}, {"volume", vi}, {"size", vec3(part_size(*volume))}, {"volume_info", volume_info(*volume, size_t(vi))}}; + return {{"object", oi}, {"part", vi}, {"size", vec3(part_size(*volume))}, {"part_info", volume_info(*volume, size_t(vi))}}; } // An arrange or Fill bed the call started, and what its reply compares with once the job is done. @@ -447,7 +441,7 @@ ArrangeStart start_arrange(Plater& plater, const json& args) } else { plate = p.get(); if (plate < 0 || plate >= plates.get_plate_count()) - throw ToolFailure("plate " + std::to_string(plate) + " does not exist; there are " + std::to_string(plates.get_plate_count())); + throw ToolFailure(no_such_plate(plate, plates.get_plate_count())); } const std::string plate_name = "Plate " + std::to_string(plate); if (plate >= 0 && plates.get_plate(plate)->is_locked()) @@ -629,11 +623,20 @@ json add_part(Plater& plater, const json& args) canvas.do_move(""); } const auto vi = std::size_t(std::find(object->volumes.begin(), object->volumes.end(), volume) - object->volumes.begin()); - return {{"object", oi}, {"volume", vi}, {"volume_count", object->volumes.size()}, {"volume_info", volume_info(*volume, vi)}}; + return {{"object", oi}, {"part", vi}, {"part_count", object->volumes.size()}, {"part_info", volume_info(*volume, vi)}}; } } // namespace +int instance_plate(PartPlateList& plates, int object, int instance) +{ + int plate = plates.find_instance(object, instance); + for (int p = 0; plate < 0 && p < plates.get_plate_count(); ++p) + if (plates.get_plate(p)->intersect_instance(object, instance)) + plate = p; + return plate; +} + json selection_state(GLCanvas3D& canvas) { const Selection& sel = canvas.get_selection(); @@ -656,7 +659,7 @@ json selection_state(GLCanvas3D& canvas) json out{{"canvas", canvas_name(&canvas)}, {"empty", sel.is_empty()}, {"objects", objects}, {"instances", instances}}; // A whole instance brings all its parts along; only a selection of parts lists them. if (sel.get_mode() == Selection::Volume && !volumes.empty()) - out["volumes"] = volumes; + out["parts"] = volumes; if (wipe_tower) out["wipe_tower"] = true; return out; @@ -724,7 +727,7 @@ json object_info(const ModelObject& object, std::size_t index) {"filament", object_filament(object)}, {"auto_drop", object.auto_drop}, {"instances", std::move(instances)}, - {"volumes", std::move(volumes)}, + {"parts", std::move(volumes)}, {"bbox", object.instances.empty() ? json(nullptr) : box_json(object.instance_bounding_box(0))}, {"brim_ears", object.brim_points.size()}, {"overrides", std::move(overrides)}}; @@ -796,6 +799,61 @@ json volume_info(const ModelVolume& v, std::size_t index) return out; } +json objects_by_plate(const Model& model, const std::vector& plate_names, + const std::function& plate_of, const json& args) +{ + const int plate_count = int(plate_names.size()); + const int only = arg_int(args, "plate", -1); + if (args.contains("plate") && (only < 0 || only >= plate_count)) + throw ToolFailure(no_such_plate(only, plate_count)); + + // The plate of every instance (-1: none), and the objects to list: all, or those on the plate asked for. + std::vector> on(model.objects.size()); + std::vector listed; + for (std::size_t i = 0; i < model.objects.size(); ++i) { + for (std::size_t j = 0; j < model.objects[i]->instances.size(); ++j) + on[i].push_back(std::max(-1, plate_of(i, j))); + if (only < 0 || std::find(on[i].begin(), on[i].end(), only) != on[i].end()) + listed.push_back(i); + } + + json plates = json::array(); + for (int plate = 0; plate < plate_count; ++plate) + if (only < 0 || plate == only) + plates.push_back({{"index", plate}, {"name", plate_names[std::size_t(plate)]}, {"objects", json::array()}}); + json outside = json::array(); + const std::size_t total = listed.size(); + const std::size_t offset = std::min(std::size_t(std::max(0, arg_int(args, "offset", 0))), total); + const std::size_t limit = std::size_t(std::max(1, arg_int(args, "limit", 200))); + for (std::size_t n = offset; n < total && n - offset < limit; ++n) { + const std::size_t i = listed[n]; + json item = object_info(*model.objects[i], i); + const json every = std::move(item["instances"]); + // The object's row where it has an instance; one without any instance is on no plate either. + const auto add_row = [&](int plate, json& into) { + json instances = json::array(); + for (std::size_t j = 0; j < on[i].size(); ++j) + if (on[i][j] == plate) + instances.push_back(every[j]); + if (instances.empty() && (plate >= 0 || !on[i].empty())) + return; + json row = item; + row["instances"] = std::move(instances); + into.push_back(std::move(row)); + }; + for (json& plate : plates) + add_row(plate["index"].get(), plate["objects"]); + if (only < 0) + add_row(-1, outside); + } + json out{{"plates", std::move(plates)}, {"total", total}, {"offset", offset}}; + if (only < 0) + out["outside"] = std::move(outside); + if (offset + limit < total) + out["next_offset"] = offset + limit; + return out; +} + std::string apply_arrange_args(GLCanvas3D::ArrangeSettings& settings, const json& args) { if (args.contains("spacing")) @@ -901,37 +959,41 @@ void register_scene_tools(McpService& service) reg.add(inspect_tool( "list_objects", L("List objects"), - "Objects in the project: filament, auto_drop, bounding box (instance 0), brim ear count and the settings they " - "override; their instances (plate, offset, rotation in degrees, scale, mirrored, bbox); their parts and modifiers " - "(type, with subtype for a precise seam; filament: a part's own or its object's, a modifier's only when it sets " + "The project as the Objects panel lists it. plates: each {index, name, objects}, with the objects that have an " + "instance on it; outside: the objects with an instance on no plate. An object with instances on two plates is " + "listed under both, each time with that plate's instances. An object has its filament, auto_drop, bounding box " + "(instance 0), brim ear count and the settings it overrides; its instances (offset, rotation in degrees, scale, " + "mirrored, bbox); its parts, one or more: parts, negative parts, modifiers, support blockers and enforcers and " + "precise seams (type, with subtype for a precise seam; filament: a part's own or its object's, a modifier's only when it sets " "one; position, bbox and scaled_volume in mm3 on the bed, measured on instance 0; rotation_deg and scale in the " "object's frame; mirrored; triangle count; mesh_volume, the unscaled mesh's mm3; painted facets: supports and " "seam enforcers/blockers, fuzzy_skin, mmu per filament, texture per layer; a text part's text and font, an SVG " "part's file); its height range modifiers when it has any (layer_config_ranges: [{min_z, max_z, values}], as " "set_height_ranges takes them) and its variable layer height profile when it has one (layer_height_profile: " "{points, min_height, max_height}). A bbox is {min, max, size} in mm of model parts only, so unlike the panel's Size it " - "leaves out modifiers. Indices are what select_objects, transform, mouse_gesture targets and the object/volume settings scopes take. " + "leaves out modifiers. An object's index numbers it in the project and a part's in its object, whatever the plate: " + "they are what select_objects, transform, mouse_gesture targets and the object/part settings scopes take. " "Each object and part also has an id, which stays with it when a delete, split or assemble shifts the indices: pass " - "it as object_id / volume_id to transform, add_part, set_settings, set_height_ranges and set_variable_layer_height " - "(object_ids, volume_ids and instance_object_ids to select_objects), and a call whose index names another one now is " - "refused instead of acting on it.", - object_schema({{"plate", {{"type", "integer"}, {"minimum", 0}, {"description", "Only objects on this plate."}}}, + "it as object_id / part_id to transform, add_part, set_settings, set_height_ranges and set_variable_layer_height " + "(object_ids, part_ids and instance_object_ids to select_objects), and a call whose index names another one now is " + "refused instead of acting on it. limit and offset page the objects and total counts them, each once.", + object_schema({{"plate", {{"type", "integer"}, {"minimum", 0}, {"description", "List this plate alone, without outside."}}}, {"screen", prop("boolean", "Add each instance's rectangle in the shown 3D view, logical pixels [x, y, w, h].")}, - {"limit", {{"type", "integer"}, {"minimum", 1}, {"maximum", 500}, {"description", "Default 200."}}}, + {"limit", {{"type", "integer"}, {"minimum", 1}, {"maximum", 500}, {"description", "Objects, default 200."}}}, {"offset", {{"type", "integer"}, {"minimum", 0}}}}), [](const json& args, ToolContext& ctx) { return ToolResult::ok(ctx.run_ui([&] { return list_objects(args); })); })); reg.add(mutate_tool( "select_objects", L("Select objects"), "Select objects, instances or parts in the 3D view (the assemble view while it is shown, else Prepare, switching to it), as clicking them would. Give objects, " - "instances ([[object, instance], ...]) or volumes ([[object, part], ...]); add keeps the current selection; all / " + "instances ([[object, instance], ...]) or parts ([[object, part], ...]); add keeps the current selection; all / " "none select everything or nothing. The reply is the selection as get_app_state.selection gives it.", object_schema({{"objects", array_prop({{"type", "integer"}}, "Object indices.")}, {"instances", array_prop({{"type", "array"}}, "[[object, instance], ...]")}, - {"volumes", array_prop({{"type", "array"}}, "[[object, part], ...]")}, + {"parts", array_prop({{"type", "array"}}, "[[object, part], ...]")}, {"object_ids", array_prop({{"type", "integer"}}, "The ids list_objects reports for objects, one per " "entry: refused when an index names another object now.")}, - {"volume_ids", array_prop({{"type", "integer"}}, "The ids list_objects reports for the parts of volumes, " + {"part_ids", array_prop({{"type", "integer"}}, "The ids list_objects reports for the entries of parts, " "one per entry: refused when a pair names another part now.")}, {"instance_object_ids", array_prop({{"type", "integer"}}, "The ids list_objects reports for the objects of " "instances, one per entry: refused when a pair names " @@ -978,7 +1040,7 @@ void register_scene_tools(McpService& service) std::to_string(i) + " (list_objects lists them)"); }; // Expected ids are checked for every entry before the selection changes. - const json objects = args.value("objects", json::array()), volumes = args.value("volumes", json::array()); + const json objects = args.value("objects", json::array()), volumes = args.value("parts", json::array()); if (args.contains("object_ids")) { if (args["object_ids"].size() != objects.size()) throw ToolFailure("object_ids takes one id per entry of objects"); @@ -998,14 +1060,14 @@ void register_scene_tools(McpService& service) json{{"object_id", args["instance_object_ids"][k]}}); } } - if (args.contains("volume_ids")) { - if (args["volume_ids"].size() != volumes.size()) - throw ToolFailure("volume_ids takes one id per entry of volumes"); + if (args.contains("part_ids")) { + if (args["part_ids"].size() != volumes.size()) + throw ToolFailure("part_ids takes one id per entry of parts"); for (std::size_t k = 0; k < volumes.size(); ++k) { check_in(volumes[k], false); const ModelObject& object = *plater.model().objects[size_t(volumes[k].at(0).get())]; check_expected_ids(object, object.volumes[size_t(volumes[k].at(1).get())], - json{{"volume_id", args["volume_ids"][k]}}); + json{{"part_id", args["part_ids"][k]}}); } } for (const json& o : objects) { @@ -1018,7 +1080,7 @@ void register_scene_tools(McpService& service) sel.add_instance(unsigned(p.at(0).get()), unsigned(p.at(1).get()), first); first = false; } - for (const json& p : args.value("volumes", json::array())) { + for (const json& p : args.value("parts", json::array())) { check_in(p, false); sel.add_volume(unsigned(p.at(0).get()), unsigned(p.at(1).get()), 0, first); first = false; @@ -1033,7 +1095,7 @@ void register_scene_tools(McpService& service) reg.add(mutate_tool( "transform", L("Move, rotate or scale an instance or a part"), - "Change one instance's placement, or one part's with volume. translate is in mm, position where it goes (mm, as " + "Change one instance's placement, or one part's with part. translate is in mm, position where it goes (mm, as " "the Move panel shows it, whatever mode says), rotate in degrees about X/Y/Z, " "scale a factor (one number or [x, y, z]), size [x, y, z] mm along the object's or part's own axes, plate moves " "the instance onto that plate at the same place. mode \"relative\" (default) adds to the current placement, " @@ -1041,12 +1103,12 @@ void register_scene_tools(McpService& service) "Object manipulation panel moves it: translate and rotate along the bed's axes, measured on instance 0, scale and " "size along its own axes; every instance shows the change, and Auto Drop may lower the object afterwards. One " "undo step. Reply: the instance's offset, scale and plate, or the part's size along its own axes and its " - "list_objects entry (volume_info).", + "list_objects entry (part_info).", object_schema({{"object", {{"type", "integer"}, {"minimum", 0}, {"description", "Object index (list_objects)."}}}, {"instance", {{"type", "integer"}, {"minimum", 0}, {"description", "Default 0."}}}, - {"volume", {{"type", "integer"}, {"minimum", 0}, {"description", "Transform this part instead of the instance."}}}, + {"part", {{"type", "integer"}, {"minimum", 0}, {"description", "Transform this part instead of the instance."}}}, {"object_id", expected_id_prop("object")}, - {"volume_id", expected_id_prop("part")}, + {"part_id", expected_id_prop("part")}, {"translate", array_prop({{"type", "number"}}, "[x, y, z] mm")}, {"position", array_prop({{"type", "number"}}, "[x, y, z] mm: the position to move to. Not with translate.")}, {"rotate", array_prop({{"type", "number"}}, "[x, y, z] degrees; relative only for a part")}, @@ -1068,7 +1130,7 @@ void register_scene_tools(McpService& service) if (args.contains("translate") && args.contains("position")) throw ToolFailure("give translate or position, not both"); check_expected_ids(*plater.model().objects[size_t(oi)], nullptr, args); - return args.contains("volume") ? transform_part(plater, oi, args) : transform_instance(plater, oi, args); + return args.contains("part") ? transform_part(plater, oi, args) : transform_instance(plater, oi, args); }); settle(ctx); return ToolResult::ok(out); @@ -1083,7 +1145,7 @@ void register_scene_tools(McpService& service) "(the instance's scale then reads 1). Refused for an object with several instances: add parts first. A STEP file " "may ask for mesh options (blocked_by_dialog). The new part is selected; one undo step. Reply: its index, which is " "not always the last (parts are ordered by type), the object's part count and the part's list_objects entry " - "(volume_info).", + "(part_info).", object_schema({{"object", {{"type", "integer"}, {"minimum", 0}, {"description", "Object index (list_objects)."}}}, {"object_id", expected_id_prop("object")}, {"type", enum_prop({"part", "negative", "modifier", "support_blocker", "support_enforcer", "precise_seam"}, @@ -1191,7 +1253,7 @@ void register_scene_tools(McpService& service) } else if (plates_arg.is_number_integer()) { const int index = plates_arg.get(); if (index < 0 || index >= list.get_plate_count()) - throw ToolFailure("plate index out of range"); + throw ToolFailure(no_such_plate(index, list.get_plate_count())); ticket->plates.push_back(index); } else { ticket->plates.push_back(list.get_curr_plate_index()); diff --git a/src/slic3r/GUI/Mcp/McpToolsUi.cpp b/src/slic3r/GUI/Mcp/McpToolsUi.cpp index 707e174600..619d16032d 100644 --- a/src/slic3r/GUI/Mcp/McpToolsUi.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsUi.cpp @@ -1661,15 +1661,15 @@ void register_ui_tools(McpService& service) const json target_schema = { {"type", "object"}, - {"description", "A point of the model: {object, instance (default 0), volume (part, default 0), and point [x, y, z] in " - "the part's own mesh coordinates (frame \"volume\", the default) or the scene's (frame \"world\"), or " + {"description", "A point of the model: {object, instance (default 0), part (default 0), and point [x, y, z] in " + "the part's own mesh coordinates (frame \"part\", the default) or the scene's (frame \"world\"), or " "spot: top | bottom | front | back | left | right, where a ray along that axis first meets the part}."}, {"properties", {{"object", {{"type", "integer"}, {"minimum", 0}}}, {"instance", {{"type", "integer"}, {"minimum", 0}}}, - {"volume", {{"type", "integer"}, {"minimum", 0}}}, + {"part", {{"type", "integer"}, {"minimum", 0}}}, {"point", array_prop({{"type", "number"}}, "[x, y, z] mm")}, - {"frame", enum_prop({"volume", "world"}, "Default volume.")}, + {"frame", enum_prop({"part", "world"}, "Default part.")}, {"spot", enum_prop({"top", "bottom", "front", "back", "left", "right"}, "A side of the part.")}}}, {"required", {"object"}}, {"additionalProperties", false}}; diff --git a/src/slic3r/GUI/Mcp/McpToolsView.cpp b/src/slic3r/GUI/Mcp/McpToolsView.cpp index b8bba4ade2..db552a1f89 100644 --- a/src/slic3r/GUI/Mcp/McpToolsView.cpp +++ b/src/slic3r/GUI/Mcp/McpToolsView.cpp @@ -608,7 +608,7 @@ void register_view_tools(McpService& service) const int current = plates.get_curr_plate_index(); const int index = arg_int(args, "plate", current); if (index >= plates.get_plate_count()) - throw ToolFailure("plate index out of range (0.." + std::to_string(plates.get_plate_count() - 1) + ")"); + throw ToolFailure(no_such_plate(index, plates.get_plate_count())); GLCanvas3D* canvas = plater.get_preview_canvas3D(); if (canvas == nullptr) throw ToolFailure("The preview is not available"); diff --git a/src/slic3r/GUI/Mcp/UiInspector.cpp b/src/slic3r/GUI/Mcp/UiInspector.cpp index c1ca8f5f77..2894a5b4ad 100644 --- a/src/slic3r/GUI/Mcp/UiInspector.cpp +++ b/src/slic3r/GUI/Mcp/UiInspector.cpp @@ -3,6 +3,7 @@ #include "CanvasTarget.hpp" #include "McpService.hpp" +#include "McpTools.hpp" #include "McpTypes.hpp" #include "ModalTracker.hpp" #include "ScreenCapture.hpp" @@ -1006,13 +1007,13 @@ CanvasView canvas_view(GLCanvas3D& canvas) } // The logical pixel of `canvas` showing a point of the model: {object, instance, volume} and either -// `point` (with `frame` "volume", the part's mesh coordinates, or "world", the scene's) or `spot`. +// `point` (with `frame` "part", the part's mesh coordinates, or "world", the scene's) or `spot`. // With `check` "surface" a click there must land on that part at that point (see check_surface()). wxPoint target_pixel(GLCanvas3D& canvas, const json& target, const std::string& check, double tolerance) { if (!target.is_object()) - throw ToolFailure("A model target is {object, instance, volume, point | spot}"); - const int oi = target.value("object", -1), ii = target.value("instance", 0), vi = target.value("volume", 0); + throw ToolFailure("A model target is {object, instance, part, point | spot}"); + const int oi = target.value("object", -1), ii = target.value("instance", 0), vi = target.value("part", 0); const std::string what = "object " + std::to_string(oi) + " instance " + std::to_string(ii) + " part " + std::to_string(vi); // The instance the open gizmo works on draws its parts itself, even while their scene entries are // inactive (the painters deactivate them). @@ -1047,11 +1048,11 @@ wxPoint target_pixel(GLCanvas3D& canvas, const json& target, const std::string& if (!p.is_array() || p.size() != 3) throw ToolFailure("point is [x, y, z]"); point = Vec3d(p[0].get(), p[1].get(), p[2].get()); - const std::string frame = target.value("frame", "volume"); - if (frame == "volume") + const std::string frame = target.value("frame", "part"); + if (frame == "part") point = world * point; else if (frame != "world") - throw ToolFailure("frame is volume or world"); + throw ToolFailure("frame is part or world"); } else { throw ToolFailure("A model target needs point or spot"); } @@ -1202,11 +1203,6 @@ std::string plate_label(PartPlate& plate) return label; } -std::string no_such_plate(int plate, int count) -{ - return "Plate " + std::to_string(plate) + " does not exist (plates 0.." + std::to_string(count - 1) + ")"; -} - } // namespace std::vector live_canvases() diff --git a/src/slic3r/GUI/NativeCommands.cpp b/src/slic3r/GUI/NativeCommands.cpp index e1a3d63fac..d7dfc9f2b4 100644 --- a/src/slic3r/GUI/NativeCommands.cpp +++ b/src/slic3r/GUI/NativeCommands.cpp @@ -577,7 +577,7 @@ void describe_commands(std::vector& commands) {"obj_orient", "Auto-orient the selection, or every object when nothing is selected; the call returns when it is done."}, // Object structure: the object list's Change Type, Rename, instance and Assemble items, and the plate // menu's Order By. A param stands in for the item's dialog. - {"obj_type_part", "Make the selected parts (select_objects {volumes} first) solid parts, as Change Type does. Parts are listed by type, so part indices change."}, + {"obj_type_part", "Make the selected parts (select_objects {parts} first) solid parts, as Change Type does. Parts are listed by type, so part indices change."}, {"obj_type_negative", "Make the selected parts negative parts, as Change Type does; not the object's last solid part. Parts are listed by type, so part indices change."}, {"obj_type_modifier", "Make the selected parts modifiers, as Change Type does; not the object's last solid part. Parts are listed by type, so part indices change."}, {"obj_type_support_blocker", "Make the selected parts support blockers, as Change Type does; not the object's last solid part, nor a text or SVG part. Parts are listed by type, so part indices change."}, diff --git a/tests/slic3rutils/test_mcp_config.cpp b/tests/slic3rutils/test_mcp_config.cpp index 9bbd88387c..bccace2f22 100644 --- a/tests/slic3rutils/test_mcp_config.cpp +++ b/tests/slic3rutils/test_mcp_config.cpp @@ -172,7 +172,7 @@ TEST_CASE("a modifier's override applies only inside its own volume", "[Mcp]") CHECK(e["effective"] == "15%"); CHECK(e["source"] == "process"); REQUIRE(e["parts"].size() == 1); - CHECK(e["parts"][0]["volume"] == 1); + CHECK(e["parts"][0]["part"] == 1); CHECK(e["parts"][0]["value"] == "40%"); // Inside the modifier: its own value, and the object's or process's for the rest. @@ -207,7 +207,7 @@ TEST_CASE("a filament of 0 is no filament of its own", "[Mcp]") CHECK(e["effective"] == "2"); CHECK(e["source"] == "object"); REQUIRE(e["parts"].size() == 1); - CHECK(e["parts"][0]["volume"] == 1); + CHECK(e["parts"][0]["part"] == 1); CHECK(e["parts"][0]["value"] == "3"); e = effective_setting("extruder", s.process, *s.object, part); diff --git a/tests/slic3rutils/test_mcp_protocol.cpp b/tests/slic3rutils/test_mcp_protocol.cpp index 2fe60842f1..a0bca7dbc2 100644 --- a/tests/slic3rutils/test_mcp_protocol.cpp +++ b/tests/slic3rutils/test_mcp_protocol.cpp @@ -391,18 +391,12 @@ TEST_CASE("argument normalization reads the names agents reach for as the ones a CHECK(click == json{{"action", "click"}}); } -TEST_CASE("argument normalization reads a part, an output path and a view by the names agents give them", "[Mcp]") +TEST_CASE("argument normalization reads an output path and a view by the names agents give them", "[Mcp]") { const auto normalized = [](const json& properties, json args) { normalize_arguments({{"type", "object"}, {"properties", properties}, {"additionalProperties", false}}, args); return args; }; - // A part is a volume in argument names. - const json part = {{"volume", {{"type", "integer"}}}, {"volume_id", {{"type", "integer"}}}}; - CHECK(normalized(part, {{"part", 1}, {"part_id", 7}}) == json{{"volume", 1}, {"volume_id", 7}}); - const json parts = {{"volumes", {{"type", "array"}}}, {"volume_ids", {{"type", "array"}, {"items", {{"type", "integer"}}}}}}; - CHECK(normalized(parts, {{"parts", {{0, 1}}}, {"part_ids", {7}}}) == json{{"volumes", {{0, 1}}}, {"volume_ids", {7}}}); - // A capture's output file is its save_path; a tool with a path of its own keeps that. const json capture = {{"save_path", {{"type", "string"}}}}; CHECK(normalized(capture, {{"path", "/a.png"}}) == json{{"save_path", "/a.png"}}); @@ -420,7 +414,7 @@ TEST_CASE("argument normalization reads the values agents reach for as the ones { const json schema = {{"type", "object"}, {"properties", - {{"scope", {{"type", "string"}, {"enum", {"process", "filament", "volume"}}}}, + {{"scope", {{"type", "string"}, {"enum", {"process", "filament", "part"}}}}, {"target", {{"type", "string"}, {"enum", {"main", "canvas"}}}}, {"kind", {{"type", "string"}, {"enum", {"main", "window"}}}}}}, {"additionalProperties", false}}; @@ -429,7 +423,6 @@ TEST_CASE("argument normalization reads the values agents reach for as the ones return args; }; CHECK(normalized({{"scope", "print"}}) == json{{"scope", "process"}}); - CHECK(normalized({{"scope", "part"}}) == json{{"scope", "volume"}}); CHECK(normalized({{"target", "window"}}) == json{{"target", "main"}}); // A value the enum lists itself stays, and so does one with no stand-in, for the validator to name. CHECK(normalized({{"kind", "window"}}) == json{{"kind", "window"}}); diff --git a/tests/slic3rutils/test_mcp_scene.cpp b/tests/slic3rutils/test_mcp_scene.cpp index 1af4dcba81..226064b6ca 100644 --- a/tests/slic3rutils/test_mcp_scene.cpp +++ b/tests/slic3rutils/test_mcp_scene.cpp @@ -505,7 +505,7 @@ TEST_CASE("a part's position and bounding box are on the bed", "[Mcp][Scene]") const json object_json = Mcp::object_info(*object, 0); CHECK(object_json["instances"][0]["bbox"] == object_json["bbox"]); CHECK(object_json["bbox"]["max"][1].get() < 141.); - CHECK(object_json["volumes"][2]["bbox"]["max"][1].get() > 200.); + CHECK(object_json["parts"][2]["bbox"]["max"][1].get() > 200.); } TEST_CASE("a mirrored copy reports mirrored", "[Mcp][Scene]") @@ -525,9 +525,9 @@ TEST_CASE("a mirrored copy reports mirrored", "[Mcp][Scene]") CHECK(info["instances"][1]["mirrored"] == true); check_vec3(info["instances"][1]["scale"], Vec3d::Ones()); CHECK(info["instances"][2]["mirrored"] == false); - CHECK(info["volumes"][0]["mirrored"] == true); - check_vec3(info["volumes"][0]["scale"], Vec3d::Ones()); - CHECK(info["volumes"][1]["mirrored"] == false); + CHECK(info["parts"][0]["mirrored"] == true); + check_vec3(info["parts"][0]["scale"], Vec3d::Ones()); + CHECK(info["parts"][1]["mirrored"] == false); } TEST_CASE("a part's filament falls back to its object's", "[Mcp][Scene]") @@ -545,18 +545,18 @@ TEST_CASE("a part's filament falls back to its object's", "[Mcp][Scene]") // Unset ("Default") is filament 1 on an object. json info = Mcp::object_info(*object, 0); CHECK(info["filament"] == 1); - CHECK(info["volumes"][0]["filament"] == 1); + CHECK(info["parts"][0]["filament"] == 1); object->config.set("extruder", 2); info = Mcp::object_info(*object, 0); CHECK(info["filament"] == 2); - CHECK(info["volumes"][0]["filament"] == 2); - CHECK(info["volumes"][1]["filament"] == 2); - CHECK(info["volumes"][2]["filament"] == 3); + CHECK(info["parts"][0]["filament"] == 2); + CHECK(info["parts"][1]["filament"] == 2); + CHECK(info["parts"][2]["filament"] == 3); // A modifier without its own filament leaves the filament of what it covers alone. - CHECK_FALSE(info["volumes"][3].contains("filament")); - CHECK(info["volumes"][4]["filament"] == 4); - CHECK_FALSE(info["volumes"][5].contains("filament")); + CHECK_FALSE(info["parts"][3].contains("filament")); + CHECK(info["parts"][4]["filament"] == 4); + CHECK_FALSE(info["parts"][5].contains("filament")); } TEST_CASE("a precise seam reports its subtype, and an object its auto drop", "[Mcp][Scene]") @@ -571,11 +571,126 @@ TEST_CASE("a precise seam reports its subtype, and an object its auto drop", "[M const json info = Mcp::object_info(*object, 0); CHECK(info["auto_drop"] == false); - CHECK_FALSE(info["volumes"][0].contains("subtype")); - CHECK(info["volumes"][1]["type"] == "precise_seam"); - CHECK(info["volumes"][1]["subtype"] == "left"); - CHECK(info["volumes"][2]["subtype"] == "neutral"); - CHECK_FALSE(info["volumes"][1].contains("filament")); + CHECK_FALSE(info["parts"][0].contains("subtype")); + CHECK(info["parts"][1]["type"] == "precise_seam"); + CHECK(info["parts"][1]["subtype"] == "left"); + CHECK(info["parts"][2]["subtype"] == "neutral"); + CHECK_FALSE(info["parts"][1].contains("filament")); +} + +namespace { + +// Three objects of one cube each: "alone" on plate 0, "twice" with an instance on plate 0 and one on +// plate 1, and "off" on no plate. +struct PlatedModel +{ + Model model; + std::vector> on{{0}, {0, 1}, {-1}}; + std::vector plate_names{"", "second", "spare"}; + + PlatedModel() + { + for (const char* name : {"alone", "twice", "off"}) { + ModelObject* object = model.add_object(); + object->name = name; + object->add_volume(make_cube(10., 10., 10.), ModelVolumeType::MODEL_PART, false); + for (std::size_t i = 0; i < on[model.objects.size() - 1].size(); ++i) + object->add_instance(); + } + } + + json list(const json& args = json::object()) const + { + return Mcp::objects_by_plate(model, plate_names, [this](std::size_t object, std::size_t instance) { return on[object][instance]; }, + args); + } +}; + +} // namespace + +TEST_CASE("list_objects lists each plate's objects, then those on no plate", "[Mcp][Scene]") +{ + const PlatedModel scene; + const json out = scene.list(); + REQUIRE(out["plates"].size() == 3); + const json& first = out["plates"][0]; + CHECK(first["index"] == 0); + CHECK(first["name"] == ""); + REQUIRE(first["objects"].size() == 2); + CHECK(first["objects"][0]["name"] == "alone"); + CHECK(first["objects"][0]["parts"].size() == 1); + // An object keeps its index and id in the project, and lists the instances on this plate only. + const json& twice = first["objects"][1]; + CHECK(twice["index"] == 1); + CHECK(twice["id"] == scene.model.objects[1]->id().id); + REQUIRE(twice["instances"].size() == 1); + CHECK(twice["instances"][0]["index"] == 0); + CHECK_FALSE(twice["instances"][0].contains("plate")); + + const json& second = out["plates"][1]; + CHECK(second["name"] == "second"); + REQUIRE(second["objects"].size() == 1); + CHECK(second["objects"][0]["index"] == 1); + REQUIRE(second["objects"][0]["instances"].size() == 1); + CHECK(second["objects"][0]["instances"][0]["index"] == 1); + + // A plate with nothing on it is listed. + CHECK(out["plates"][2]["objects"].empty()); + REQUIRE(out["outside"].size() == 1); + CHECK(out["outside"][0]["name"] == "off"); + // The object on two plates is listed under both and counted once. + CHECK(out["total"] == 3); + CHECK_FALSE(out.contains("next_offset")); +} + +TEST_CASE("list_objects with a plate lists that plate alone", "[Mcp][Scene]") +{ + const PlatedModel scene; + const json out = scene.list({{"plate", 1}}); + REQUIRE(out["plates"].size() == 1); + CHECK(out["plates"][0]["index"] == 1); + REQUIRE(out["plates"][0]["objects"].size() == 1); + CHECK(out["plates"][0]["objects"][0]["name"] == "twice"); + CHECK_FALSE(out.contains("outside")); + CHECK(out["total"] == 1); + + CHECK_THROWS_WITH(scene.list({{"plate", 3}}), ContainsSubstring("Plate 3 does not exist (the project has plates 0..2)")); +} + +TEST_CASE("list_objects pages the objects, listing each under every plate it is on", "[Mcp][Scene]") +{ + const PlatedModel scene; + // The second of the three objects is the one on two plates. + json out = scene.list({{"offset", 1}, {"limit", 1}}); + CHECK(out["total"] == 3); + CHECK(out["offset"] == 1); + CHECK(out["next_offset"] == 2); + REQUIRE(out["plates"].size() == 3); + REQUIRE(out["plates"][0]["objects"].size() == 1); + CHECK(out["plates"][0]["objects"][0]["name"] == "twice"); + REQUIRE(out["plates"][1]["objects"].size() == 1); + CHECK(out["plates"][1]["objects"][0]["name"] == "twice"); + CHECK(out["outside"].empty()); + + out = scene.list({{"offset", 2}, {"limit", 1}}); + CHECK(out["plates"][0]["objects"].empty()); + CHECK(out["plates"][1]["objects"].empty()); + REQUIRE(out["outside"].size() == 1); + CHECK(out["outside"][0]["name"] == "off"); + CHECK_FALSE(out.contains("next_offset")); +} + +TEST_CASE("list_objects with a plate pages and counts that plate's objects", "[Mcp][Scene]") +{ + const PlatedModel scene; + const json out = scene.list({{"plate", 0}, {"offset", 1}, {"limit", 1}}); + CHECK(out["total"] == 2); + CHECK(out["offset"] == 1); + CHECK_FALSE(out.contains("next_offset")); + REQUIRE(out["plates"][0]["objects"].size() == 1); + CHECK(out["plates"][0]["objects"][0]["name"] == "twice"); + REQUIRE(out["plates"][0]["objects"][0]["instances"].size() == 1); + CHECK(out["plates"][0]["objects"][0]["instances"][0]["index"] == 0); } TEST_CASE("part types round-trip between names and ModelVolumeType", "[Mcp][Scene]") diff --git a/tests/slic3rutils/test_mcp_tools.cpp b/tests/slic3rutils/test_mcp_tools.cpp index ee207d1e27..60a9ca0869 100644 --- a/tests/slic3rutils/test_mcp_tools.cpp +++ b/tests/slic3rutils/test_mcp_tools.cpp @@ -144,6 +144,12 @@ TEST_CASE("a name its catalog lacks is pointed to the catalog that has it", "[Mc #endif } +TEST_CASE("a plate the project lacks is refused by its number, with the plates the project has", "[Mcp]") +{ + CHECK(no_such_plate(5, 3) == "Plate 5 does not exist (the project has plates 0..2)"); + CHECK(no_such_plate(1, 1) == "Plate 1 does not exist (the project has plate 0 only)"); +} + TEST_CASE("a listing summary is a documentation's first sentence on one line", "[Mcp]") { CHECK(first_sentence("Return the mesh.\nIt is a copy.") == "Return the mesh."); @@ -386,7 +392,7 @@ TEST_CASE("a call naming an object's id is refused once its index names another Slic3r::ModelVolume* part = first->add_volume(Slic3r::TriangleMesh()); CHECK_NOTHROW(check_expected_ids(*first, nullptr, json{{"object", 0}, {"object_id", first->id().id}})); - CHECK_NOTHROW(check_expected_ids(*first, part, json{{"object", 0}, {"volume_id", part->id().id}})); + CHECK_NOTHROW(check_expected_ids(*first, part, json{{"object", 0}, {"part_id", part->id().id}})); // Without expected ids the index alone decides, as before. CHECK_NOTHROW(check_expected_ids(*second, nullptr, json{{"object", 0}})); try { @@ -396,12 +402,12 @@ TEST_CASE("a call naming an object's id is refused once its index names another CHECK(std::string(f.what()).find("lid") != std::string::npos); CHECK(f.details["id"] == second->id().id); } - CHECK_THROWS_AS(check_expected_ids(*first, part, json{{"volume_id", part->id().id + 1000}}), ToolFailure); + CHECK_THROWS_AS(check_expected_ids(*first, part, json{{"part_id", part->id().id + 1000}}), ToolFailure); } TEST_CASE("the journal records indices without expected ids, except a Python step's arguments", "[Mcp]") { - CHECK(without_expected_ids("set_settings", json{{"object", 0}, {"object_id", 7}, {"volume_id", 8}}) == json{{"object", 0}}); + CHECK(without_expected_ids("set_settings", json{{"object", 0}, {"object_id", 7}, {"part_id", 8}}) == json{{"object", 0}}); CHECK(without_expected_ids("set_height_ranges", json{{"object", 0}, {"object_id", 7}}) == json{{"object", 0}}); CHECK(without_expected_ids("set_variable_layer_height", json{{"object", 0}, {"object_id", 7}}) == json{{"object", 0}}); const json replay{{"replay", {{"orca_replay", 1}, diff --git a/tools/mcp/README.md b/tools/mcp/README.md index bdd9f88ce7..8af6fe6c70 100644 --- a/tools/mcp/README.md +++ b/tools/mcp/README.md @@ -233,7 +233,7 @@ unless `captions` or `pointer` turns one on, and that one started with `encode` `ffmpeg -i session.mkv -vf fps=1 frame%02d.png` extracts, for the caption, the pointer and the dialog. `tests/multicolor.json` assigns filaments to objects and parts through `set_settings`' object and -volume scopes, with undo and redo, and reads them back with `get_settings`' effective values. It then +part scopes, with undo and redo, and reads them back with `get_settings`' effective values. It then sets the project's slot colours, flushing multiplier, one flushing volume and plate type through the project scope (in one call, the colour first), checks the refusals that leave everything as it was (the read-only `filament_is_mixed`, a bad colour, a purge mode the printer has no button for, a non-zero diff --git a/tools/mcp/test_ref_locator_export.py b/tools/mcp/test_ref_locator_export.py index 892f90a585..251377ac6d 100755 --- a/tools/mcp/test_ref_locator_export.py +++ b/tools/mcp/test_ref_locator_export.py @@ -68,7 +68,7 @@ def main(): if row: client.call("click", target={"imgui_name": "Remove", "index": 0}) clicked = client.call("click", target=row[0]) - layers = client.call("list_objects")["items"][0]["volumes"][0]["painted"]["texture"] + layers = client.call("list_objects")["plates"][0]["objects"][0]["parts"][0]["painted"]["texture"] checks.append(("the old ref clicks the renamed row", len(layers) == 2, (clicked, len(layers)))) # Its icon closes it: in a small window the object's info notification covers the panel's Close. client.call("click", target={"gizmo": "Texture Displacement"}) diff --git a/tools/mcp/tests/agent_forms.json b/tools/mcp/tests/agent_forms.json index eecf68afb8..fbbc0fb22b 100644 --- a/tools/mcp/tests/agent_forms.json +++ b/tools/mcp/tests/agent_forms.json @@ -19,14 +19,14 @@ {"tool": "open_files", "args": {"paths": ["${vars.cube}"]}, "expect": {"/added": {"eq": 1}}}, {"tool": "select_objects", "args": {"object": "1"}}, {"tool": "run_action", "args": {"id": "obj_rename", "param": "renamed"}, "expect": {"/ran": {"eq": "orca_command:obj_rename:orca"}}}, - {"tool": "list_objects", "expect": {"/items/1/name": {"eq": "renamed"}, "/items/0/name": {"ne": "renamed"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/1/name": {"eq": "renamed"}, "/plates/0/objects/0/name": {"ne": "renamed"}}}, {"tool": "run_action", "args": {"action": "view_top"}, "expect": {"/ran": {"eq": "orca_command:view_top:orca"}}}, // ---- A camera direction as view; position for an absolute move; key for keys; wait for idle ---- {"tool": "set_view", "args": {"view": "front"}, "expect": {"/camera": {"eq": "front"}}}, {"tool": "transform", "args": {"object": 0, "position": [100, 110, 0]}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/offset/0": {"ge": 99.99, "le": 100.01}, - "/items/0/instances/0/offset/1": {"ge": 109.99, "le": 110.01}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/offset/0": {"ge": 99.99, "le": 100.01}, + "/plates/0/objects/0/instances/0/offset/1": {"ge": 109.99, "le": 110.01}}}, {"tool": "press_keys", "args": {"key": "Escape"}}, {"tool": "wait", "args": {}, "expect": {"/satisfied": {"eq": true}}}, diff --git a/tools/mcp/tests/cad_doc.json b/tools/mcp/tests/cad_doc.json index 0b05c89762..e4dd37c536 100644 --- a/tools/mcp/tests/cad_doc.json +++ b/tools/mcp/tests/cad_doc.json @@ -64,15 +64,15 @@ "/result/editable": {"empty": true}}}, {"tool": "call_cad_tool", "args": {"tool": "commit"}, "expect": {"/result/objects/0/index": {"eq": 0}, "/result/objects/0/name": {"eq": "Design Body"}, - "/result/objects/0/volumes": {"eq": 1}, "/result/bodies_sent/0": {"eq": 0}, "/result/tab": {"eq": "prepare"}}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/items/0/name": {"eq": "Design Body"}, - "/items/0/bbox/size/2": {"ge": 14.99, "le": 15.01}}}, + "/result/objects/0/parts": {"eq": 1}, "/result/bodies_sent/0": {"eq": 0}, "/result/tab": {"eq": "prepare"}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/name": {"eq": "Design Body"}, + "/plates/0/objects/0/bbox/size/2": {"ge": 14.99, "le": 15.01}}}, {"tool": "call_cad_tool", "args": {"tool": "set_feature", "args": {"feature": 1, "fields": {"distance": 20}}}}, {"tool": "call_cad_tool", "args": {"tool": "commit", "args": {"replace": [0]}}, "expect": {"/result/objects/0/index": {"eq": 0}, "/result/replaced/0/index": {"eq": 0}, "/result/replaced/0/name": {"eq": "Design Body"}}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/items/0/bbox/size/2": {"ge": 19.99, "le": 20.01}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/bbox/size/2": {"ge": 19.99, "le": 20.01}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/items/0/bbox/size/2": {"ge": 14.99, "le": 15.01}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/bbox/size/2": {"ge": 14.99, "le": 15.01}}}, {"tool": "call_cad_tool", "args": {"tool": "export_step", "args": {"path": "${out_dir}/design.step", "overwrite": true}}, "expect": {"/result/bytes": {"gt": 0}, "/result/bodies": {"eq": 1}, "/result/moved_bodies": {"empty": true}}}, {"tool": "call_cad_tool", "args": {"tool": "new_design", "args": {"discard_changes": true}}, @@ -87,7 +87,7 @@ "expect": {"/result/mode": {"eq": "bodies"}, "/result/objects/0/index": {"eq": 1}, "/result/objects/1/index": {"eq": 2}, "/result/objects/1/name": {"eq": "Design Body 2"}, "/result/bodies_sent/1": {"eq": 1}, "/result/bodies_hidden": {"empty": true}}}, {"tool": "call_cad_tool", "args": {"tool": "commit", "args": {"mode": "assembly"}}, - "expect": {"/result/objects/0/index": {"eq": 3}, "/result/objects/0/name": {"eq": "Design Assembly"}, "/result/objects/0/volumes": {"eq": 2}}}, + "expect": {"/result/objects/0/index": {"eq": 3}, "/result/objects/0/name": {"eq": "Design Assembly"}, "/result/objects/0/parts": {"eq": 2}}}, {"tool": "list_objects", "expect": {"/total": {"eq": 4}}}, {"tool": "call_cad_tool", "args": {"tool": "new_design", "args": {"discard_changes": true}}}, diff --git a/tools/mcp/tests/calibration.json b/tools/mcp/tests/calibration.json index 4ac5362884..8794f52e30 100644 --- a/tools/mcp/tests/calibration.json +++ b/tools/mcp/tests/calibration.json @@ -39,7 +39,7 @@ {"tool": "generate_calibration_test", "args": {"test": "temperature", "step": 5, "discard_changes": true, "preset_changes": "discard"}, "optional": true}, {"tool": "generate_calibration_test", "args": {"test": "pressure_advance", "start": 0.01, "end": 0.05, "step": 0.051, "discard_changes": true, "preset_changes": "discard"}, "optional": true}, - {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/items/0/name": {"eq": "temperature_tower.drc"}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/name": {"eq": "temperature_tower.drc"}}}, {"tool": "list_presets", "args": {"type": "filament"}, "expect": {"/items/0/name": {"eq": "Bambu PLA Basic @BBL X1C"}, "/items/0/modified": {"eq": true}}}, diff --git a/tools/mcp/tests/context_menus.json b/tools/mcp/tests/context_menus.json index 19ccb4bb73..c658a37704 100644 --- a/tools/mcp/tests/context_menus.json +++ b/tools/mcp/tests/context_menus.json @@ -28,11 +28,11 @@ {"tool": "mouse_gesture", "args": {"action": "click", "button": "right", "at": {"object": 0, "spot": "top"}, "popup_item": "add modifier>cylinder"}, "expect": {"/ran": {"eq": "Add Modifier>Cylinder"}}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "modifier"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "modifier"}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1": {"exists": false}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "modifier"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "modifier"}}}, // ---- Empty space with nothing selected: the default menu ---- {"tool": "select_objects", "args": {"none": true}}, diff --git a/tools/mcp/tests/dialogs_canvas_input.json b/tools/mcp/tests/dialogs_canvas_input.json index 6319dd13c1..58d2f60f71 100644 --- a/tools/mcp/tests/dialogs_canvas_input.json +++ b/tools/mcp/tests/dialogs_canvas_input.json @@ -45,10 +45,10 @@ {"tool": "wait", "args": {"for": "idle"}}, {"tool": "click", "args": {"target": {"imgui": "Cut"}}}, {"tool": "click", "args": {"target": {"imgui": "Done"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "negative"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "negative"}}}, // The text's size, and so which of its ends the cube hides, differs between platforms; the step is // about the part resolving as a target, so it skips the visibility check. - {"tool": "mouse_gesture", "args": {"action": "move", "at": {"object": 0, "volume": 1, "spot": "right"}, "check": "point"}}, + {"tool": "mouse_gesture", "args": {"action": "move", "at": {"object": 0, "part": 1, "spot": "right"}, "check": "point"}}, // ---- From below, the bed hides nothing ---- {"tool": "set_view", "args": {"camera": "bottom"}}, diff --git a/tools/mcp/tests/gizmos.json b/tools/mcp/tests/gizmos.json index 2167fecd8a..760ca5fcce 100644 --- a/tools/mcp/tests/gizmos.json +++ b/tools/mcp/tests/gizmos.json @@ -50,11 +50,11 @@ {"tool": "click", "args": {"target": {"gizmo": "Move"}}, "expect": {"/active": {"eq": true}}}, {"tool": "get_app_state", "expect": {"/gizmo/name": {"eq": "Move"}}}, {"tool": "set_widget_value", "args": {"target": {"imgui": "Position", "window": "Object operations"}, "value": 90}, "expect": {"/value": {"eq": "90.00"}}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/offset/0": {"eq": 90}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/offset/0": {"eq": 90}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/offset/0": {"eq": 100}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/offset/0": {"eq": 100}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/offset/0": {"eq": 90}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/offset/0": {"eq": 90}}}, {"tool": "set_widget_value", "args": {"target": {"imgui_name": "coordinates"}, "value": "Object"}, "expect": {"/selected": {"eq": "Object"}}}, {"tool": "set_widget_value", "args": {"target": {"imgui_name": "coordinates"}, "value": 0}, "expect": {"/selected": {"eq": "World"}}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/move.png", "overwrite": true, "include_image": false}}, @@ -65,17 +65,17 @@ {"tool": "select_objects", "args": {"all": true}}, {"tool": "click", "args": {"target": {"gizmo": "Move"}}, "expect": {"/active": {"eq": true}}}, {"tool": "click", "args": {"target": {"imgui_name": "Align front"}}}, - {"tool": "list_objects", "expect": {"/items/1/instances/0/offset/1": {"eq": 100}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/1/instances/0/offset/1": {"eq": 100}}}, {"tool": "click", "args": {"target": {"gizmo": "Move"}}}, // ---- Rotate: the absolute Z angle ---- {"tool": "select_objects", "args": {"objects": [0]}}, {"tool": "click", "args": {"target": {"gizmo": "Rotate"}}, "expect": {"/active": {"eq": true}}}, {"tool": "set_widget_value", "args": {"target": {"imgui_name": "absolute_rotation_z"}, "value": 30}, "expect": {"/value": {"eq": "30.00"}}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/rotation_deg/2": {"gt": 29.9}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/rotation_deg/2": {"gt": 29.9}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/rotation_deg/2": {"gt": 29.9}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/rotation_deg/2": {"gt": 29.9}}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/rotate.png", "overwrite": true, "include_image": false}}, {"tool": "set_widget_value", "args": {"target": {"imgui_name": "absolute_rotation_z"}, "value": 0}}, {"tool": "click", "args": {"target": {"gizmo": "Rotate"}}, "expect": {"/active": {"eq": false}}}, @@ -83,9 +83,9 @@ // ---- Scale: uniform scale by the X field ---- {"tool": "click", "args": {"target": {"gizmo": "Scale"}}, "expect": {"/active": {"eq": true}}}, {"tool": "set_widget_value", "args": {"target": {"imgui": "Scale"}, "value": 120}, "expect": {"/value": {"eq": "120.00"}}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/scale/2": {"gt": 1.19}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/scale/2": {"gt": 1.19}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/scale/2": {"eq": 1}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/scale/2": {"eq": 1}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/scale.png", "overwrite": true, "include_image": false}}, {"tool": "set_widget_value", "args": {"target": {"imgui": "Scale"}, "value": 100}}, @@ -95,9 +95,9 @@ {"tool": "select_objects", "args": {"objects": [1]}}, {"tool": "click", "args": {"target": {"gizmo": "Flatten"}}, "expect": {"/active": {"eq": true}}}, {"tool": "mouse_gesture", "args": {"at": {"object": 1, "spot": "front"}}}, - {"tool": "list_objects", "expect": {"/items/1/instances/0/rotation_deg/0": {"gt": 89}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/1/instances/0/rotation_deg/0": {"gt": 89}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/1/instances/0/rotation_deg/0": {"lt": 1}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/1/instances/0/rotation_deg/0": {"lt": 1}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/flatten.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"gizmo": "Flatten"}}}, @@ -111,16 +111,16 @@ {"tool": "click", "args": {"target": {"imgui_name": "Fill"}}}, // Object 1 stands in front of object 0's front face; the gizmo hides it, so the point is clickable. {"tool": "mouse_gesture", "args": {"at": {"object": 0, "spot": "front"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/supports/enforcers": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/supports/enforcers": {"gt": 0}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted": {"exists": false}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, {"tool": "set_view", "args": {"camera": "iso"}}, {"tool": "set_view", "args": {"camera": "fit_objects"}}, {"tool": "click", "args": {"target": {"imgui_name": "Circle"}}}, {"tool": "set_widget_value", "args": {"target": {"imgui": "Brush size"}, "value": 3}, "expect": {"/value": {"eq": "3.00"}}}, {"tool": "mouse_gesture", "args": {"action": "drag", "button": "right", "at": {"object": 0, "spot": "top"}, "to": {"object": 0, "point": [6, 6, 12.8]}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/supports/blockers": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/supports/blockers": {"gt": 0}}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/supports.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"imgui": "Done"}}}, // Painted enforcers with support off raise a lasting warning, whose notification can cover a later @@ -131,9 +131,9 @@ // ---- Seam ---- {"tool": "click", "args": {"target": {"gizmo": "Seam"}}, "expect": {"/active": {"eq": true}}}, {"tool": "mouse_gesture", "args": {"at": {"object": 0, "spot": "front"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/seam/enforcers": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/seam/enforcers": {"gt": 0}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/seam": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/seam": {"exists": false}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/seam.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"imgui": "Done"}}}, @@ -145,10 +145,10 @@ {"tool": "get_settings", "args": {"scope": "object", "object": 0, "keys": ["fuzzy_skin"]}, "expect": {"/items/0/value": {"eq": "none"}}}, {"tool": "click", "args": {"target": {"imgui_name": "Fill"}}}, {"tool": "mouse_gesture", "args": {"at": {"object": 0, "spot": "left"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/fuzzy_skin": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/fuzzy_skin": {"gt": 0}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/fuzzy_skin": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/fuzzy_skin": {"gt": 0}}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/fuzzy_skin.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"imgui": "Done"}}}, @@ -157,10 +157,10 @@ {"tool": "click", "args": {"target": {"imgui_name": "extruder_color_2"}}}, {"tool": "click", "args": {"target": {"imgui_name": "Fill"}}}, {"tool": "mouse_gesture", "args": {"at": {"object": 0, "spot": "front"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/mmu/2": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/mmu/2": {"gt": 0}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/mmu/2": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/mmu/2": {"gt": 0}}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/color.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"imgui": "Done"}}}, @@ -169,11 +169,11 @@ {"tool": "pick_gizmo_file", "args": {"action": "texture_import", "path": "${vars.heightmap}"}}, {"tool": "mouse_gesture", "args": {"action": "drag", "at": {"object": 0, "spot": "top"}, "waypoints": [{"object": 0, "point": [8, 0, 12.8]}], "to": {"object": 0, "point": [8, 8, 12.8]}}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/texture/0/name": {"contains": "heightmap"}, "/items/0/volumes/0/painted/texture/0/painted": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/texture/0/name": {"contains": "heightmap"}, "/plates/0/objects/0/parts/0/painted/texture/0/painted": {"gt": 0}}}, {"tool": "click", "args": {"target": {"imgui_name": "add_layer"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/texture/1": {"exists": true}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/texture/1": {"exists": true}}}, {"tool": "click", "args": {"target": {"imgui_name": "Remove", "index": 1}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/painted/texture/1": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/painted/texture/1": {"exists": false}}}, // The remaining layer's card, collapsed when the second one was added, opens on its row; its // "more settings" link is scrolled into view when the panel is too short to show it. {"tool": "click", "args": {"target": {"imgui_name": "Layer 1"}}}, @@ -200,7 +200,7 @@ {"tool": "click", "args": {"target": {"imgui_name": "Revert Depth"}}}, {"tool": "list_widgets", "args": {"query": "2.50 mm"}, "expect": {"/nodes": {"eq": 0}}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/text/text": {"eq": "Orca\nMCP"}, "/items/0/volumes/1/text/style": {"eq": "ITALIC"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/text/text": {"eq": "Orca\nMCP"}, "/plates/0/objects/0/parts/1/text/style": {"eq": "ITALIC"}}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/text.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"imgui": "Done"}}}, @@ -208,20 +208,20 @@ {"tool": "select_objects", "args": {"none": true}}, {"tool": "run_action", "args": {"id": "orca_command:add_primitive_svg:orca", "param": "${vars.svg}"}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 3}, "/items/2/volumes/0/svg/path": {"contains": "star.svg"}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 3}, "/plates/0/objects/2/parts/0/svg/path": {"contains": "star.svg"}}}, {"tool": "get_app_state", "expect": {"/gizmo/name": {"eq": "SVG"}}}, {"tool": "pick_gizmo_file", "args": {"action": "svg_save_as", "path": "${out_dir}/star-copy.svg", "overwrite": true}}, - {"tool": "list_objects", "expect": {"/items/2/volumes/0/svg/path": {"contains": "star-copy.svg"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/2/parts/0/svg/path": {"contains": "star-copy.svg"}}}, {"tool": "pick_gizmo_file", "args": {"action": "svg_change", "path": "${vars.svg}"}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/items/2/volumes/0/svg/path": {"contains": "star.svg"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/2/parts/0/svg/path": {"contains": "star.svg"}}}, // The panel shows the new file's name. {"tool": "list_widgets", "args": {"query": "star-copy"}, "expect": {"/nodes": {"eq": 0}}}, {"tool": "click", "args": {"target": {"gizmo": "SVG"}}}, {"tool": "select_objects", "args": {"objects": [0]}}, {"tool": "run_action", "args": {"id": "orca_command:add_primitive_svg:orca", "param": "${vars.svg}"}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/2/svg/path": {"contains": "star.svg"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/2/svg/path": {"contains": "star.svg"}}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/svg.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"gizmo": "SVG"}}}, @@ -239,7 +239,7 @@ {"tool": "click", "args": {"target": {"gizmo": "Measure"}}}, // ---- Simplify: the text part cut by 90 %; its count depends on the system font, so the bound is loose ---- - {"tool": "select_objects", "args": {"volumes": [[0, 1]]}}, + {"tool": "select_objects", "args": {"parts": [[0, 1]]}}, // Closed while it calculates, it leaves nothing to wait for. {"tool": "click", "args": {"target": {"gizmo": "Simplify"}}, "expect": {"/active": {"eq": true}}}, {"tool": "set_widget_value", "args": {"target": {"imgui_name": "use_count"}, "value": true}}, @@ -252,7 +252,7 @@ {"tool": "wait", "args": {"for": "idle"}}, {"tool": "click", "args": {"target": {"imgui": "Apply"}}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/triangles": {"lt": 1000}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/triangles": {"lt": 1000}}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/simplify.png", "overwrite": true, "include_image": false}}, // ---- Brim ears: the "set to painted" link, auto-generated ears and one more by a click ---- @@ -261,9 +261,9 @@ {"tool": "set_view", "args": {"camera": "fit_selection"}}, {"tool": "click", "args": {"target": {"gizmo": "Brim Ears"}}, "expect": {"/active": {"eq": true}}}, {"tool": "click", "args": {"target": {"imgui_name": "Set brim type to painted"}}}, - {"tool": "list_objects", "expect": {"/items/1/overrides": {"contains": "brim_type"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/1/overrides": {"contains": "brim_type"}}}, {"tool": "click", "args": {"target": {"imgui": "Auto-generate"}}}, - {"tool": "list_objects", "expect": {"/items/1/brim_ears": {"gt": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/1/brim_ears": {"gt": 0}}}, {"tool": "mouse_gesture", "args": {"at": {"object": 1, "point": [172.8, 100, 0.5], "frame": "world"}, "check": "point"}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/brim_ears.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"imgui": "Done"}}}, @@ -274,14 +274,14 @@ {"tool": "click", "args": {"target": {"gizmo": "MeshBoolean"}}, "expect": {"/active": {"eq": true}}}, {"tool": "click", "args": {"target": {"imgui": "Union", "index": 0}}}, {"tool": "click", "args": {"target": {"imgui_name": "select_source_volume"}}}, - {"tool": "mouse_gesture", "args": {"at": {"object": 0, "volume": 0, "spot": "front"}}}, + {"tool": "mouse_gesture", "args": {"at": {"object": 0, "part": 0, "spot": "front"}}}, {"tool": "click", "args": {"target": {"imgui_name": "select_tool_volume"}}}, - {"tool": "mouse_gesture", "args": {"at": {"object": 0, "volume": 2, "spot": "top"}}}, + {"tool": "mouse_gesture", "args": {"at": {"object": 0, "part": 2, "spot": "top"}}}, {"tool": "click", "args": {"target": {"imgui_name": "btn"}}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/2": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/2": {"exists": false}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/2": {"exists": true}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/2": {"exists": true}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, {"tool": "screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/mesh_boolean.png", "overwrite": true, "include_image": false}}, {"tool": "click", "args": {"target": {"gizmo": "MeshBoolean"}}}, diff --git a/tools/mcp/tests/layers.json b/tools/mcp/tests/layers.json index f584bdce18..d71cac6ec2 100644 --- a/tools/mcp/tests/layers.json +++ b/tools/mcp/tests/layers.json @@ -18,7 +18,7 @@ {"tool": "open_files", "args": {"paths": ["${vars.cube}"]}, "expect": {"/added": {"eq": 1}}}, {"tool": "transform", "args": {"object": 0, "size": [20, 20, 20]}}, {"tool": "set_settings", "args": {"scope": "process", "values": {"layer_height": 0.2, "initial_layer_print_height": 0.2}}}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges": {"exists": false}}}, // ---- Two ranges, given in any order: the lower half at 40 % infill, the upper half at 0.1 mm ---- {"tool": "set_height_ranges", @@ -32,24 +32,24 @@ "/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}, "/layer_config_ranges/1/values/extruder": {"eq": "0"}, "/warnings": {"exists": false}}}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges/0/values/sparse_infill_density": {"eq": "40%"}, - "/items/0/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}, - "/items/0/layer_config_ranges/2": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges/0/values/sparse_infill_density": {"eq": "40%"}, + "/plates/0/objects/0/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}, + "/plates/0/objects/0/layer_config_ranges/2": {"exists": false}}}, // Ranges are not the object's own overrides. {"tool": "get_settings", "args": {"scope": "object", "object": 0, "keys": ["sparse_infill_density"], "include_meta": false}, "expect": {"/items/0/value": {"eq": null}}}, // ---- One undo step; the same ranges again add none ---- {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges": {"exists": false}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, {"tool": "set_height_ranges", "args": {"object": 0, "ranges": [{"min_z": 0, "max_z": 10, "values": {"sparse_infill_density": "40%"}}, {"min_z": 10, "max_z": 20, "values": {"layer_height": 0.1}}]}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges": {"exists": false}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}}}, // ---- The slicer prints them: 50 layers of 0.2 mm, then 100 of 0.1 mm ---- {"tool": "slice", "expect": {"/status": {"eq": "done"}, "/plates/0/outcome": {"eq": "ok"}}}, @@ -66,9 +66,9 @@ {"tool": "set_height_ranges", "args": {"object": 0, "ranges": [{"min_z": 0, "max_z": 5, "values": {"enable_support": true}}]}, "optional": true}, {"tool": "set_height_ranges", "args": {"object": 0, "ranges": [{"min_z": 5, "max_z": 5}]}, "optional": true}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges/0/max_z": {"eq": 10}, - "/items/0/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}, - "/items/0/layer_config_ranges/2": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges/0/max_z": {"eq": 10}, + "/plates/0/objects/0/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}, + "/plates/0/objects/0/layer_config_ranges/2": {"exists": false}}}, // ---- A range printed with the second filament, above the object's top ---- {"tool": "set_view", "args": {"tab": "prepare"}}, @@ -85,13 +85,13 @@ // Loading a project asks about preset edits an earlier replay left; the project brings its own. {"tool": "auto_answer_dialogs", "args": {"rules": [{"match": "unsaved changes", "button": "Discard"}]}}, {"tool": "open_files", "args": {"paths": ["${out_dir}/layers.3mf"], "discard_changes": true}}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges/0/values/sparse_infill_density": {"eq": "40%"}, - "/items/0/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}, - "/items/0/layer_config_ranges/2/values/extruder": {"eq": "2"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges/0/values/sparse_infill_density": {"eq": "40%"}, + "/plates/0/objects/0/layer_config_ranges/1/values/layer_height": {"eq": "0.1"}, + "/plates/0/objects/0/layer_config_ranges/2/values/extruder": {"eq": "2"}}}, // ---- [] removes them all ---- {"tool": "set_height_ranges", "args": {"object": 0, "ranges": []}, "expect": {"/layer_config_ranges": {"eq": []}}}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges": {"exists": false}}}, {"tool": "slice", "expect": {"/status": {"eq": "done"}, "/plates/0/outcome": {"eq": "ok"}}}, {"tool": "set_view", "args": {"tab": "preview", "layer": 1}, "expect": {"/layers/2": {"eq": 100}}}, @@ -99,7 +99,7 @@ {"tool": "new_project", "args": {"discard_changes": true}}, {"tool": "open_files", "args": {"paths": ["${vars.benchy}"]}, "expect": {"/added": {"eq": 1}}}, {"tool": "set_settings", "args": {"scope": "process", "values": {"layer_height": 0.2, "initial_layer_print_height": 0.2}}}, - {"tool": "list_objects", "expect": {"/items/0/layer_height_profile": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_height_profile": {"exists": false}}}, {"tool": "slice", "expect": {"/status": {"eq": "done"}, "/plates/0/outcome": {"eq": "ok"}}}, {"tool": "set_variable_layer_height", "args": {"object": 0, "action": "adaptive"}, "expect": {"/height": {"ge": 47.99, "le": 48.01}, @@ -108,7 +108,7 @@ "/layer_height_profile/max_height": {"gt": 0.2}, "/warnings": {"exists": false}}}, {"tool": "get_app_state", "expect": {"/tab": {"eq": "prepare"}}}, - {"tool": "list_objects", "expect": {"/items/0/layer_height_profile/points": {"gt": 250}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_height_profile/points": {"gt": 250}}}, // Toward quality more layers, toward speed fewer. {"tool": "set_variable_layer_height", "args": {"object": 0, "action": "adaptive", "quality": 0}, "expect": {"/layer_height_profile/points": {"gt": 380}}}, @@ -122,14 +122,14 @@ {"tool": "set_variable_layer_height", "args": {"object": 0, "action": "smooth", "radius": 10, "keep_min": true}, "expect": {"/layer_height_profile/max_height": {"lt": 0.28}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/layer_height_profile/max_height": {"eq": 0.28}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_height_profile/max_height": {"eq": 0.28}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/layer_height_profile/max_height": {"lt": 0.28}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_height_profile/max_height": {"lt": 0.28}}}, {"tool": "set_variable_layer_height", "args": {"object": 0, "action": "reset"}, "expect": {"/layer_height_profile": {"exists": false}}}, - {"tool": "list_objects", "expect": {"/items/0/layer_height_profile": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_height_profile": {"exists": false}}}, {"tool": "set_variable_layer_height", "args": {"object": 0, "action": "reset"}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/layer_height_profile/max_height": {"lt": 0.28}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_height_profile/max_height": {"lt": 0.28}}}, {"tool": "set_variable_layer_height", "args": {"object": 0, "action": "reset"}}, // ---- Refusals change nothing: an argument of another action, the assemble view ---- @@ -137,7 +137,7 @@ {"tool": "set_view", "args": {"canvas": "assemble"}}, {"tool": "set_variable_layer_height", "args": {"object": 0, "action": "adaptive"}, "optional": true}, {"tool": "set_view", "args": {"canvas": "3d"}}, - {"tool": "list_objects", "expect": {"/items/0/layer_height_profile": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_height_profile": {"exists": false}}}, // ---- With height ranges: Smooth starts from the ranges' heights, Adaptive keeps them inside each // range, and the profile then decides ---- @@ -150,15 +150,15 @@ "/warnings/0": {"contains": "decides its layer heights"}}}, {"tool": "set_variable_layer_height", "args": {"object": 0, "action": "adaptive", "quality": 0}, "expect": {"/layer_height_profile/min_height": {"eq": 0.12}}}, - {"tool": "list_objects", "expect": {"/items/0/layer_config_ranges/1/values/layer_height": {"eq": "0.28"}, - "/items/0/layer_height_profile/min_height": {"eq": 0.12}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_config_ranges/1/values/layer_height": {"eq": "0.28"}, + "/plates/0/objects/0/layer_height_profile/min_height": {"eq": 0.12}}}, // ---- A 3MF keeps the profile ---- {"tool": "save_project", "args": {"path": "${out_dir}/profile.3mf", "overwrite": true}}, {"tool": "new_project", "args": {"discard_changes": true}}, {"tool": "open_files", "args": {"paths": ["${out_dir}/profile.3mf"], "discard_changes": true}}, - {"tool": "list_objects", "expect": {"/items/0/layer_height_profile/min_height": {"eq": 0.12}, - "/items/0/layer_height_profile/points": {"gt": 100}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/layer_height_profile/min_height": {"eq": 0.12}, + "/plates/0/objects/0/layer_height_profile/points": {"gt": 100}}}, {"tool": "slice", "expect": {"/status": {"eq": "done"}, "/plates/0/outcome": {"eq": "ok"}}}, // ---- Layer G-codes on a 20 mm cube of 100 layers of 0.2 mm: none before a slice ---- diff --git a/tools/mcp/tests/multicolor.json b/tools/mcp/tests/multicolor.json index 974db2c3c9..476d665670 100644 --- a/tools/mcp/tests/multicolor.json +++ b/tools/mcp/tests/multicolor.json @@ -36,8 +36,8 @@ {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, {"tool": "get_settings", "args": {"scope": "object", "object": 1, "keys": ["extruder"]}, "expect": {"/items/0/effective": {"eq": "2"}}}, - // ---- A single-part object's volume 0 is the object: its filament is set there ---- - {"tool": "set_settings", "args": {"scope": "volume", "object": 1, "volume": 0, "values": {"extruder": 1}}, + // ---- A single-part object's part 0 is the object: its filament is set there ---- + {"tool": "set_settings", "args": {"scope": "part", "object": 1, "part": 0, "values": {"extruder": 1}}, "expect": {"/applied/extruder": {"eq": "1"}, "/note": {"exists": true}}}, {"tool": "get_settings", "args": {"scope": "object", "object": 1, "keys": ["extruder"]}, "expect": {"/items/0/effective": {"eq": "1"}}}, {"tool": "set_settings", "args": {"scope": "object", "object": 1, "values": {"extruder": 2}}}, @@ -47,15 +47,15 @@ {"tool": "click", "args": {"target": {"gizmo": "Text"}}, "expect": {"/created": {"eq": true}, "/active": {"eq": true}}}, {"tool": "wait", "args": {"for": "idle"}}, {"tool": "click", "args": {"target": {"imgui": "Done"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/text": {"exists": true}}}, - {"tool": "set_settings", "args": {"scope": "volume", "object": 0, "volume": 1, "values": {"extruder": 2}}, "expect": {"/applied/extruder": {"eq": "2"}}}, - {"tool": "get_settings", "args": {"scope": "volume", "object": 0, "volume": 1, "keys": ["extruder"]}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/text": {"exists": true}}}, + {"tool": "set_settings", "args": {"scope": "part", "object": 0, "part": 1, "values": {"extruder": 2}}, "expect": {"/applied/extruder": {"eq": "2"}}}, + {"tool": "get_settings", "args": {"scope": "part", "object": 0, "part": 1, "keys": ["extruder"]}, "expect": {"/items/0/effective": {"eq": "2"}, "/items/0/source": {"eq": "part"}, "/note": {"exists": true}}}, {"tool": "get_settings", "args": {"scope": "object", "object": 0, "keys": ["extruder"]}, - "expect": {"/items/0/effective": {"eq": "1"}, "/items/0/parts/0/volume": {"eq": 1}, "/items/0/parts/0/value": {"eq": "2"}, "/note": {"exists": true}}}, + "expect": {"/items/0/effective": {"eq": "1"}, "/items/0/parts/0/part": {"eq": 1}, "/items/0/parts/0/value": {"eq": "2"}, "/note": {"exists": true}}}, // Default on a part is its object's filament. - {"tool": "set_settings", "args": {"scope": "volume", "object": 0, "volume": 1, "values": {"extruder": null}}, "expect": {"/applied/extruder": {"eq": "1"}}}, - {"tool": "set_settings", "args": {"scope": "volume", "object": 0, "volume": 1, "values": {"extruder": 2}}}, + {"tool": "set_settings", "args": {"scope": "part", "object": 0, "part": 1, "values": {"extruder": null}}, "expect": {"/applied/extruder": {"eq": "1"}}}, + {"tool": "set_settings", "args": {"scope": "part", "object": 0, "part": 1, "values": {"extruder": 2}}}, // ---- A filament and another setting in one call are one undo step; the object's filament clears the part's ---- {"tool": "set_settings", "args": {"scope": "object", "object": 0, "values": {"extruder": 2, "wall_loops": 5}}, diff --git a/tools/mcp/tests/plate_icons.json b/tools/mcp/tests/plate_icons.json index 0da433e503..f23ba1de69 100644 --- a/tools/mcp/tests/plate_icons.json +++ b/tools/mcp/tests/plate_icons.json @@ -34,13 +34,13 @@ {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca"}}, {"tool": "wait", "args": {"for": "idle"}}, {"tool": "list_objects", "expect": {"/total": {"eq": 2}, - "/items/0/instances/0/plate": {"eq": 1}, "/items/1/instances/0/plate": {"eq": 1}, - "/items/0/instances/0/offset/1": {"eq": 128.0}, "/items/1/instances/0/offset/1": {"eq": 128.0}}}, + "/plates/1/objects/0/instances/0/index": {"eq": 0}, "/plates/1/objects/1/instances/0/index": {"eq": 0}, + "/plates/1/objects/0/instances/0/offset/1": {"eq": 128.0}, "/plates/1/objects/1/instances/0/offset/1": {"eq": 128.0}}}, {"tool": "click", "args": {"target": {"plate_icon": "arrange", "plate": 1}}, "expect": {"/started": {"eq": true}, "/done": {"eq": true}}}, {"tool": "wait", "args": {"for": "idle", "timeout_s": 2}, "expect": {"/satisfied": {"eq": true}}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/plate": {"eq": 1}, "/items/1/instances/0/plate": {"eq": 1}, - "/items/0/instances/0/offset/1": {"ne": 128.0}, "/items/1/instances/0/offset/1": {"ne": 128.0}}}, + {"tool": "list_objects", "expect": {"/plates/1/objects/0/instances/0/index": {"eq": 0}, "/plates/1/objects/1/instances/0/index": {"eq": 0}, + "/plates/1/objects/0/instances/0/offset/1": {"ne": 128.0}, "/plates/1/objects/1/instances/0/offset/1": {"ne": 128.0}}}, // ---- A right click opens the plate menu: listed, or one of its items run ---- {"tool": "click", "args": {"target": {"plate_icon": "plate", "plate": 1}, "button": "right"}, @@ -52,7 +52,7 @@ // ---- Move to front: the second plate becomes the first, with its cubes ---- {"tool": "click", "args": {"target": {"plate_icon": "move_to_front", "plate": 1}}, "expect": {"/current": {"eq": 0}}}, {"tool": "get_app_state", "expect": {"/plates/current": {"eq": 0}, "/plates/count": {"eq": 2}}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/plate": {"eq": 0}, "/items/1/instances/0/plate": {"eq": 0}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/index": {"eq": 0}, "/plates/0/objects/1/instances/0/index": {"eq": 0}}}, {"tool": "get_app_state", "expect": {"/dialogs": {"empty": true}, "/closed_menus": {"empty": true}}} ] } diff --git a/tools/mcp/tests/plates.json b/tools/mcp/tests/plates.json index e1763fbe83..0d39893e35 100644 --- a/tools/mcp/tests/plates.json +++ b/tools/mcp/tests/plates.json @@ -44,7 +44,7 @@ {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca"}}, {"tool": "wait", "args": {"for": "idle"}}, {"tool": "list_plates", "save_as": "start", - "expect": {"/total": {"eq": 2}, "/items/0/objects/0": {"eq": [0, 0]}, "/items/1/objects/0": {"eq": [1, 0]}, + "expect": {"/total": {"eq": 2}, "/items/0/objects": {"eq": 1}, "/items/1/objects": {"eq": 1}, "/items/0/overrides": {"empty": true}, "/items/1/overrides": {"empty": true}, "/items/1/current": {"eq": true}, "/items/0/locked": {"eq": false}, "/items/0/print_sequence": {"eq": "by layer"}, "/items/0/spiral_mode": {"eq": false}, "/items/0/first_layer_print_sequence": {"eq": null}, "/items/0/layer_gcode": {"empty": true}, diff --git a/tools/mcp/tests/preview.json b/tools/mcp/tests/preview.json index b0be921f3e..d6239782a5 100644 --- a/tools/mcp/tests/preview.json +++ b/tools/mcp/tests/preview.json @@ -110,7 +110,7 @@ {"tool": "select_objects", "args": {"none": true}}, {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca"}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_plates", "expect": {"/items/1/objects/0": {"exists": true}}}, + {"tool": "list_plates", "expect": {"/items/1/objects": {"gt": 0}}}, {"tool": "slice", "args": {"plates": "all"}, "expect": {"/plates/0/outcome": {"eq": "ok"}, "/plates/1/outcome": {"eq": "ok"}}}, // Slicing every plate leaves the Preview on its all-plates statistics; plate 0 is shown from Prepare. {"tool": "set_view", "args": {"tab": "prepare"}}, diff --git a/tools/mcp/tests/rows.json b/tools/mcp/tests/rows.json index dd95bd36d1..d9b2a60f7b 100644 --- a/tools/mcp/tests/rows.json +++ b/tools/mcp/tests/rows.json @@ -39,7 +39,7 @@ {"tool": "click", "args": {"target": {"row": "Cube"}, "button": "right", "popup_item": "Add Modifier>Cylinder"}, "expect": {"/ran": {"eq": "Add Modifier>Cylinder"}}}, {"tool": "wait", "args": {"for": "idle"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "modifier"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "modifier"}}}, // ---- Part rows: a click, Ctrl adds another; a right click keeps a selection it is in, so the part // is clicked alone before its menu changes its type ---- @@ -49,15 +49,15 @@ {"tool": "click", "args": {"target": {"row": "Cube>Generic-Cylinder"}}}, {"tool": "click", "args": {"target": {"row": "Cube>Generic-Cylinder"}, "button": "right", "popup_item": "Change Type>Negative Part"}, "expect": {"/ran": {"eq": "Change Type>Negative Part"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "negative"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "negative"}}}, // ---- The Printable column acts as a click on its icon; a double click frames the object ---- {"tool": "click", "args": {"target": {"row": "Plate 1>Cube", "column": "Printable"}}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/printable": {"eq": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/printable": {"eq": false}}}, {"tool": "click", "args": {"target": {"row": "Plate 1>Cube", "column": "Printable"}}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/printable": {"eq": true}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/printable": {"eq": true}}}, {"tool": "click", "args": {"target": {"row": "Plate 1>Cube"}, "double": true}, "expect": {"/selected": {"eq": ["Plate 1>Cube"]}}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/items/0/instances/0/printable": {"eq": true}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/instances/0/printable": {"eq": true}}}, // ---- Compare presets: a data view's rows, with both presets' values ---- {"tool": "click", "args": {"target": {"label": "Compare presets"}}}, diff --git a/tools/mcp/tests/scene.json b/tools/mcp/tests/scene.json index 5bd5162097..c998305a8a 100644 --- a/tools/mcp/tests/scene.json +++ b/tools/mcp/tests/scene.json @@ -19,19 +19,19 @@ // ---- An instance: a scale that grows it drops it onto the bed; size keeps the proportions ---- {"tool": "open_files", "args": {"paths": ["${vars.cube}"]}, "expect": {"/added": {"eq": 1}}}, {"tool": "transform", "args": {"object": 0, "scale": 1.5}}, - {"tool": "list_objects", "expect": {"/items/0/bbox/min/2": {"ge": -0.001, "le": 0.001}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/bbox/min/2": {"ge": -0.001, "le": 0.001}}}, {"tool": "transform", "args": {"object": 0, "size": [30, null, null]}}, - {"tool": "list_objects", "expect": {"/items/0/bbox/size/0": {"ge": 29.99, "le": 30.01}, - "/items/0/bbox/min/2": {"ge": -0.001, "le": 0.001}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/bbox/size/0": {"ge": 29.99, "le": 30.01}, + "/plates/0/objects/0/bbox/min/2": {"ge": -0.001, "le": 0.001}}}, {"tool": "transform", "args": {"object": 0, "size": [30, 20, 10]}}, - {"tool": "list_objects", "expect": {"/items/0/bbox/size/1": {"ge": 19.99, "le": 20.01}, - "/items/0/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/bbox/size/1": {"ge": 19.99, "le": 20.01}, + "/plates/0/objects/0/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, {"tool": "transform", "args": {"object": 0, "size": [30, 30, 30]}}, // ---- A move to another plate registers the instance there, for list_objects and slicing ---- {"tool": "run_action", "args": {"id": "orca_command:plate_add:orca"}}, {"tool": "transform", "args": {"object": 0, "plate": 1}, "expect": {"/plate": {"eq": 1}}}, - {"tool": "list_objects", "args": {"plate": 1}, "expect": {"/total": {"eq": 1}, "/items/0/instances/0/plate": {"eq": 1}}}, + {"tool": "list_objects", "args": {"plate": 1}, "expect": {"/total": {"eq": 1}, "/plates/0/index": {"eq": 1}, "/plates/0/objects/0/instances/0/index": {"eq": 0}}}, {"tool": "transform", "args": {"object": 0, "plate": 0}, "expect": {"/plate": {"eq": 0}}}, {"tool": "transform", "args": {"object": 0, "translate": [100, 100, 0], "mode": "absolute"}, "expect": {"/offset/0": {"ge": 99.99, "le": 100.01}, "/plate": {"eq": 0}}}, @@ -41,60 +41,60 @@ {"tool": "run_action", "args": {"id": "orca_command:add_primitive_svg:orca", "param": "${vars.svg}"}}, {"tool": "wait", "args": {"for": "idle"}}, {"tool": "click", "args": {"target": {"gizmo": "SVG"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/svg/path": {"contains": "star.svg"}}}, - {"tool": "transform", "args": {"object": 0, "volume": 1, "translate": [100, 100, 15], "mode": "absolute"}, - "expect": {"/volume_info/position/0": {"ge": 99.99, "le": 100.01}, "/volume_info/position/1": {"ge": 99.99, "le": 100.01}, - "/volume_info/position/2": {"ge": 14.99, "le": 15.01}, "/volume_info/type": {"eq": "part"}}}, - {"tool": "transform", "args": {"object": 0, "volume": 1, "translate": [5, 0, 0]}, - "expect": {"/volume_info/position/0": {"ge": 104.99, "le": 105.01}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/svg/path": {"contains": "star.svg"}}}, + {"tool": "transform", "args": {"object": 0, "part": 1, "translate": [100, 100, 15], "mode": "absolute"}, + "expect": {"/part_info/position/0": {"ge": 99.99, "le": 100.01}, "/part_info/position/1": {"ge": 99.99, "le": 100.01}, + "/part_info/position/2": {"ge": 14.99, "le": 15.01}, "/part_info/type": {"eq": "part"}}}, + {"tool": "transform", "args": {"object": 0, "part": 1, "translate": [5, 0, 0]}, + "expect": {"/part_info/position/0": {"ge": 104.99, "le": 105.01}}}, // one undo step per call {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "transform", "args": {"object": 0, "volume": 1, "translate": [0, 0, 0]}, - "expect": {"/volume_info/position/0": {"ge": 99.99, "le": 100.01}}}, - {"tool": "transform", "args": {"object": 0, "volume": 1, "scale": 2, "mode": "absolute"}, - "expect": {"/volume_info/scale/0": {"ge": 1.999, "le": 2.001}, "/volume_info/scale/2": {"ge": 1.999, "le": 2.001}}}, - {"tool": "transform", "args": {"object": 0, "volume": 1, "size": [null, null, 3]}, + {"tool": "transform", "args": {"object": 0, "part": 1, "translate": [0, 0, 0]}, + "expect": {"/part_info/position/0": {"ge": 99.99, "le": 100.01}}}, + {"tool": "transform", "args": {"object": 0, "part": 1, "scale": 2, "mode": "absolute"}, + "expect": {"/part_info/scale/0": {"ge": 1.999, "le": 2.001}, "/part_info/scale/2": {"ge": 1.999, "le": 2.001}}}, + {"tool": "transform", "args": {"object": 0, "part": 1, "size": [null, null, 3]}, "expect": {"/size/2": {"ge": 2.999, "le": 3.001}}}, - {"tool": "transform", "args": {"object": 0, "volume": 1, "rotate": [0, 0, 45]}}, + {"tool": "transform", "args": {"object": 0, "part": 1, "rotate": [0, 0, 45]}}, // refused: an absolute rotation of a part, a part with plate, a single part - {"tool": "transform", "args": {"object": 0, "volume": 1, "rotate": [0, 0, 0], "mode": "absolute"}, "optional": true}, - {"tool": "transform", "args": {"object": 0, "volume": 1, "plate": 1}, "optional": true}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/plate": {"eq": 0}}}, + {"tool": "transform", "args": {"object": 0, "part": 1, "rotate": [0, 0, 0], "mode": "absolute"}, "optional": true}, + {"tool": "transform", "args": {"object": 0, "part": 1, "plate": 1}, "optional": true}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/index": {"eq": 0}}}, // ---- What list_objects says of the part and the instance: placement on the bed, filament, mirror ---- // The star stands on the face the camera saw, so only orientation-free values are checked; a turn // about Z keeps its height, and at 0.3 of its size it holds 0.027 of its mesh's volume. - {"tool": "list_objects", "expect": {"/items/0/filament": {"eq": 1}, "/items/0/auto_drop": {"eq": true}, - "/items/0/instances/0/mirrored": {"eq": false}, - "/items/0/instances/0/bbox/min/2": {"ge": -0.001, "le": 0.001}, - "/items/0/instances/0/bbox/size/0": {"ge": 29.99, "le": 30.01}, - "/items/0/volumes/1/filament": {"eq": 1}, "/items/0/volumes/1/mirrored": {"eq": false}, - "/items/0/volumes/1/position/2": {"ge": 14.99, "le": 15.01}, - "/items/0/volumes/1/bbox/min/2": {"gt": 0, "le": 15}, - "/items/0/volumes/1/bbox/max/2": {"ge": 15, "lt": 30}, - "/items/0/volumes/1/mesh_volume": {"gt": 1000}, - "/items/0/volumes/1/scaled_volume": {"gt": 0, "lt": 100}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/filament": {"eq": 1}, "/plates/0/objects/0/auto_drop": {"eq": true}, + "/plates/0/objects/0/instances/0/mirrored": {"eq": false}, + "/plates/0/objects/0/instances/0/bbox/min/2": {"ge": -0.001, "le": 0.001}, + "/plates/0/objects/0/instances/0/bbox/size/0": {"ge": 29.99, "le": 30.01}, + "/plates/0/objects/0/parts/1/filament": {"eq": 1}, "/plates/0/objects/0/parts/1/mirrored": {"eq": false}, + "/plates/0/objects/0/parts/1/position/2": {"ge": 14.99, "le": 15.01}, + "/plates/0/objects/0/parts/1/bbox/min/2": {"gt": 0, "le": 15}, + "/plates/0/objects/0/parts/1/bbox/max/2": {"ge": 15, "lt": 30}, + "/plates/0/objects/0/parts/1/mesh_volume": {"gt": 1000}, + "/plates/0/objects/0/parts/1/scaled_volume": {"gt": 0, "lt": 100}}}, // a mirrored part is mirrored in the object's frame; an instance mirrored twice is a half turn - {"tool": "select_objects", "args": {"volumes": [[0, 1]]}, - "expect": {"/canvas": {"eq": "3d"}, "/objects": {"eq": [0]}, "/instances": {"eq": [[0, 0]]}, "/volumes": {"eq": [[0, 1]]}}}, - {"tool": "get_app_state", "expect": {"/selection/volumes": {"eq": [[0, 1]]}, "/python/available": {"eq": true}, + {"tool": "select_objects", "args": {"parts": [[0, 1]]}, + "expect": {"/canvas": {"eq": "3d"}, "/objects": {"eq": [0]}, "/instances": {"eq": [[0, 0]]}, "/parts": {"eq": [[0, 1]]}}}, + {"tool": "get_app_state", "expect": {"/selection/parts": {"eq": [[0, 1]]}, "/python/available": {"eq": true}, "/python/scripts_allowed": {"ne": null}, "/design_tab": {"ne": null}}}, {"tool": "run_action", "args": {"id": "orca_command:obj_mirror_x:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/mirrored": {"eq": true}, "/items/0/instances/0/mirrored": {"eq": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/mirrored": {"eq": true}, "/plates/0/objects/0/instances/0/mirrored": {"eq": false}}}, // a whole instance lists no parts - {"tool": "select_objects", "args": {"objects": [0]}, "expect": {"/instances": {"eq": [[0, 0]]}, "/volumes": {"exists": false}}}, + {"tool": "select_objects", "args": {"objects": [0]}, "expect": {"/instances": {"eq": [[0, 0]]}, "/parts": {"exists": false}}}, {"tool": "run_action", "args": {"id": "orca_command:obj_mirror_y:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/mirrored": {"eq": true}, "/items/0/instances/0/scale/0": {"gt": 0}, - "/items/0/volumes/1/mirrored": {"eq": true}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/mirrored": {"eq": true}, "/plates/0/objects/0/instances/0/scale/0": {"gt": 0}, + "/plates/0/objects/0/parts/1/mirrored": {"eq": true}}}, {"tool": "run_action", "args": {"id": "orca_command:obj_mirror_x:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/instances/0/mirrored": {"eq": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/instances/0/mirrored": {"eq": false}}}, // ---- Shapes at a size, without the dialog ---- {"tool": "select_objects", "args": {"none": true}, "expect": {"/empty": {"eq": true}, "/objects": {"empty": true}}}, {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "param": "40 40 10"}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 2}, "/items/1/bbox/size/0": {"ge": 39.99, "le": 40.01}, - "/items/1/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, - {"tool": "transform", "args": {"object": 1, "volume": 0, "translate": [1, 0, 0]}, "optional": true}, + {"tool": "list_objects", "expect": {"/total": {"eq": 2}, "/plates/1/objects/0/bbox/size/0": {"ge": 39.99, "le": 40.01}, + "/plates/1/objects/0/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, + {"tool": "transform", "args": {"object": 1, "part": 0, "translate": [1, 0, 0]}, "optional": true}, // a wrong count adds nothing {"tool": "select_objects", "args": {"none": true}}, {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cylinder:orca", "param": "1 2 3"}, "optional": true}, @@ -111,9 +111,10 @@ // The shapes were added on the current plate, plate 1; the cube goes back to plate 0. {"tool": "transform", "args": {"object": 1, "plate": 0}, "expect": {"/plate": {"eq": 0}}}, {"tool": "arrange", "args": {"fill": 2}, "expect": {"/added": {"gt": 0}, "/plate": {"eq": 1}, "/off_plate": {"empty": true}}}, - {"tool": "list_objects", "expect": {"/items/2/instances/1": {"exists": true}}}, + // The new instances are listed on the plate they fill. + {"tool": "list_objects", "expect": {"/plates/1/objects/0/instances/1": {"exists": true}, "/outside": {"empty": true}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/2/instances/1": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/1/objects/0/instances/1": {"exists": false}, "/outside": {"empty": true}}}, // refused: a locked plate, a plate that does not exist, fill with plates {"tool": "run_action", "args": {"id": "orca_command:plate_goto:orca", "param": "1"}}, {"tool": "run_action", "args": {"id": "orca_command:plate_toggle_lock:orca"}}, @@ -121,14 +122,14 @@ {"tool": "run_action", "args": {"id": "orca_command:plate_toggle_lock:orca"}}, {"tool": "arrange", "args": {"plates": 7}, "optional": true}, {"tool": "arrange", "args": {"fill": 0, "plates": 0}, "optional": true}, - {"tool": "list_objects", "expect": {"/plates": {"eq": 2}, "/items/2/instances/0/plate": {"eq": 1}, - "/items/2/instances/1": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/1": {"exists": true}, "/plates/2": {"exists": false}, "/plates/1/objects/0/instances/0/index": {"eq": 0}, + "/plates/1/objects/0/instances/1": {"exists": false}}}, // ---- Arrange one plate with options; the other plate keeps its object (arrange may reorder objects) ---- {"tool": "arrange", "args": {"plates": 0, "spacing": 10, "rotate": false, "align_y": false}, "expect": {"/off_plate": {"empty": true}, "/plates": {"eq": 2}, "/settings/spacing": {"eq": 10}, "/settings/rotate": {"eq": false}}}, - {"tool": "list_objects", "args": {"plate": 1}, "expect": {"/total": {"eq": 1}, "/items/0/name": {"eq": "Cylinder"}}}, + {"tool": "list_objects", "args": {"plate": 1}, "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/name": {"eq": "Cylinder"}}}, {"tool": "list_objects", "args": {"plate": 0}, "expect": {"/total": {"eq": 2}}}, // every plate with the saved options; obj_arrange runs the same job and returns once it is done {"tool": "arrange", "expect": {"/settings/spacing": {"eq": 10}, "/off_plate": {"empty": true}}}, @@ -144,31 +145,31 @@ // a magnet pocket at the bottom centre {"tool": "add_part", "args": {"object": 0, "type": "negative", "shape": "cylinder", "size": [6.2, 3.2], "position": [100, 100, 1.6]}, - "expect": {"/volume": {"eq": 1}, "/volume_count": {"eq": 2}, "/volume_info/type": {"eq": "negative"}, - "/volume_info/position/0": {"ge": 99.99, "le": 100.01}, "/volume_info/position/1": {"ge": 99.99, "le": 100.01}, - "/volume_info/bbox/min/2": {"ge": -0.01, "le": 0.01}, "/volume_info/bbox/size/2": {"ge": 3.19, "le": 3.21}, - "/volume_info/bbox/size/0": {"ge": 6.1, "le": 6.21}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/mesh_volume": {"gt": 90}, - "/items/0/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, + "expect": {"/part": {"eq": 1}, "/part_count": {"eq": 2}, "/part_info/type": {"eq": "negative"}, + "/part_info/position/0": {"ge": 99.99, "le": 100.01}, "/part_info/position/1": {"ge": 99.99, "le": 100.01}, + "/part_info/bbox/min/2": {"ge": -0.01, "le": 0.01}, "/part_info/bbox/size/2": {"ge": 3.19, "le": 3.21}, + "/part_info/bbox/size/0": {"ge": 6.1, "le": 6.21}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/mesh_volume": {"gt": 90}, + "/plates/0/objects/0/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1": {"exists": false}}}, {"tool": "run_action", "args": {"id": "orca_command:redo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "negative"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "negative"}}}, // a modifier from a file, where Load... puts it; parts are ordered by type (part, negative, modifier) {"tool": "add_part", "args": {"object": 0, "type": "modifier", "path": "${vars.cube}"}, - "expect": {"/volume": {"eq": 2}, "/volume_count": {"eq": 3}, "/volume_info/type": {"eq": "modifier"}, - "/volume_info/name": {"eq": "OrcaCube_v2.drc"}}}, + "expect": {"/part": {"eq": 2}, "/part_count": {"eq": 3}, "/part_info/type": {"eq": "modifier"}, + "/part_info/name": {"eq": "OrcaCube_v2.drc"}}}, // a solid part at a size takes the object's filament and grows the object; the built-in size for the rest {"tool": "add_part", "args": {"object": 0, "type": "part", "shape": "cube", "size": [10, 10, 20], "position": [125, 100, 10]}, - "expect": {"/volume": {"eq": 1}, "/volume_info/type": {"eq": "part"}, "/volume_info/filament": {"eq": 1}, - "/volume_info/bbox/size/2": {"ge": 19.99, "le": 20.01}}}, + "expect": {"/part": {"eq": 1}, "/part_info/type": {"eq": "part"}, "/part_info/filament": {"eq": 1}, + "/part_info/bbox/size/2": {"ge": 19.99, "le": 20.01}}}, {"tool": "add_part", "args": {"object": 0, "type": "support_blocker", "shape": "sphere", "position": [110, 110, 10]}, - "expect": {"/volume_info/type": {"eq": "support_blocker"}, "/volume_info/position/2": {"ge": 9.99, "le": 10.01}}}, + "expect": {"/part_info/type": {"eq": "support_blocker"}, "/part_info/position/2": {"ge": 9.99, "le": 10.01}}}, {"tool": "add_part", "args": {"object": 0, "type": "precise_seam", "shape": "cube", "size": [2, 2, 2]}, - "expect": {"/volume_info/type": {"eq": "precise_seam"}, "/volume_info/subtype": {"eq": "center"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/2/type": {"eq": "negative"}, "/items/0/volumes/3/type": {"eq": "modifier"}, - "/items/0/volumes/5": {"exists": true}, "/items/0/volumes/6": {"exists": false}, - "/items/0/bbox/size/2": {"ge": 19.99, "le": 20.01}}}, + "expect": {"/part_info/type": {"eq": "precise_seam"}, "/part_info/subtype": {"eq": "center"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/2/type": {"eq": "negative"}, "/plates/0/objects/0/parts/3/type": {"eq": "modifier"}, + "/plates/0/objects/0/parts/5": {"exists": true}, "/plates/0/objects/0/parts/6": {"exists": false}, + "/plates/0/objects/0/bbox/size/2": {"ge": 19.99, "le": 20.01}}}, // refused, adding nothing: shape and path, a size with the wrong count, an SVG file, a file that is // not a model, an object with two instances {"tool": "add_part", "args": {"object": 0, "type": "modifier", "shape": "cube", "path": "${vars.cube}"}, "optional": true}, @@ -178,7 +179,7 @@ {"tool": "select_objects", "args": {"objects": [0]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_instances_up:orca"}}, {"tool": "add_part", "args": {"object": 0, "type": "modifier", "shape": "cube"}, "optional": true}, - {"tool": "list_objects", "expect": {"/items/0/volumes/6": {"exists": false}, "/items/0/instances/1": {"exists": true}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/6": {"exists": false}, "/plates/0/objects/0/instances/1": {"exists": true}}}, // the selection names the instances it is in {"tool": "select_objects", "args": {"instances": [[0, 1]]}, "expect": {"/objects": {"eq": [0]}, "/instances": {"eq": [[0, 1]]}}}, {"tool": "select_objects", "args": {"objects": [0]}, "expect": {"/instances": {"eq": [[0, 0], [0, 1]]}}}, @@ -188,53 +189,53 @@ {"tool": "select_objects", "args": {"none": true}}, {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "param": "20 20 20"}}, {"tool": "transform", "args": {"object": 1, "scale": 1.5}}, - {"tool": "add_part", "args": {"object": 1, "type": "modifier", "shape": "cube"}, "expect": {"/volume": {"eq": 1}}}, - {"tool": "list_objects", "expect": {"/items/1/instances/0/scale/0": {"ge": 0.999, "le": 1.001}, - "/items/1/bbox/size/0": {"ge": 29.99, "le": 30.01}, - "/items/1/volumes/0/scale/0": {"ge": 1.499, "le": 1.501}}}, + {"tool": "add_part", "args": {"object": 1, "type": "modifier", "shape": "cube"}, "expect": {"/part": {"eq": 1}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/1/instances/0/scale/0": {"ge": 0.999, "le": 1.001}, + "/plates/0/objects/1/bbox/size/0": {"ge": 29.99, "le": 30.01}, + "/plates/0/objects/1/parts/0/scale/0": {"ge": 1.499, "le": 1.501}}}, // ---- Object structure commands: the context menus' Change Type, Rename, number of instances, // Set as Individual Objects and Assemble, each a run_action on what select_objects picked ---- {"tool": "new_project", "args": {"discard_changes": true}}, {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "param": "30 30 10"}}, - {"tool": "add_part", "args": {"object": 0, "type": "modifier", "shape": "cube", "size": [10, 10, 10]}, "expect": {"/volume": {"eq": 1}}}, + {"tool": "add_part", "args": {"object": 0, "type": "modifier", "shape": "cube", "size": [10, 10, 10]}, "expect": {"/part": {"eq": 1}}}, // Change Type, one undo step each; a seam made a part again is listed after the first part - {"tool": "select_objects", "args": {"volumes": [[0, 1]]}}, + {"tool": "select_objects", "args": {"parts": [[0, 1]]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_type_negative:orca"}, "expect": {"/level": {"eq": "success"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "negative"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "negative"}}}, {"tool": "run_action", "args": {"id": "orca_command:obj_type_support_blocker:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "support_blocker"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "support_blocker"}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "negative"}}}, - {"tool": "select_objects", "args": {"volumes": [[0, 1]]}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "negative"}}}, + {"tool": "select_objects", "args": {"parts": [[0, 1]]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_type_precise_seam:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "precise_seam"}, "/items/0/volumes/1/subtype": {"eq": "center"}}}, - {"tool": "select_objects", "args": {"volumes": [[0, 1]]}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "precise_seam"}, "/plates/0/objects/0/parts/1/subtype": {"eq": "center"}}}, + {"tool": "select_objects", "args": {"parts": [[0, 1]]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_type_part:orca"}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/type": {"eq": "part"}, "/items/0/volumes/1/type": {"eq": "part"}}}, - {"tool": "select_objects", "args": {"volumes": [[0, 1]]}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/type": {"eq": "part"}, "/plates/0/objects/0/parts/1/type": {"eq": "part"}}}, + {"tool": "select_objects", "args": {"parts": [[0, 1]]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_type_modifier:orca"}}, // refused, changing nothing: the object's last solid part, and an object's row, which is not a part - {"tool": "select_objects", "args": {"volumes": [[0, 0]]}}, + {"tool": "select_objects", "args": {"parts": [[0, 0]]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_type_modifier:orca"}, "optional": true}, {"tool": "select_objects", "args": {"objects": [0]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_type_part:orca"}, "optional": true}, - {"tool": "list_objects", "expect": {"/items/0/volumes/0/type": {"eq": "part"}, "/items/0/volumes/1/type": {"eq": "modifier"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/0/type": {"eq": "part"}, "/plates/0/objects/0/parts/1/type": {"eq": "modifier"}}}, // refused: an SVG part stays a part, a modifier or a negative part {"tool": "run_action", "args": {"id": "orca_command:add_primitive_svg:orca", "param": "${vars.svg}"}}, {"tool": "wait", "args": {"for": "idle"}}, {"tool": "click", "args": {"target": {"gizmo": "SVG"}}}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/svg/path": {"contains": "star.svg"}, "/items/0/volumes/2/type": {"eq": "modifier"}}}, - {"tool": "select_objects", "args": {"volumes": [[0, 1]]}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/svg/path": {"contains": "star.svg"}, "/plates/0/objects/0/parts/2/type": {"eq": "modifier"}}}, + {"tool": "select_objects", "args": {"parts": [[0, 1]]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_type_support_enforcer:orca"}, "optional": true}, - {"tool": "list_objects", "expect": {"/items/0/volumes/1/type": {"eq": "part"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "part"}}}, // Rename an object and a part; refused: a name a file name cannot hold {"tool": "select_objects", "args": {"objects": [0]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_rename:orca", "param": "base"}}, - {"tool": "select_objects", "args": {"volumes": [[0, 2]]}}, + {"tool": "select_objects", "args": {"parts": [[0, 2]]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_rename:orca", "param": "infill zone"}}, {"tool": "run_action", "args": {"id": "orca_command:obj_rename:orca", "param": "a/b"}, "optional": true}, - {"tool": "list_objects", "expect": {"/items/0/name": {"eq": "base"}, "/items/0/volumes/2/name": {"eq": "infill zone"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/name": {"eq": "base"}, "/plates/0/objects/0/parts/2/name": {"eq": "infill zone"}}}, // a number of instances in one undo step; refused: 0 and a word {"tool": "select_objects", "args": {"none": true}}, {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "param": "20 20 20"}}, @@ -242,22 +243,22 @@ {"tool": "run_action", "args": {"id": "orca_command:obj_set_instances:orca", "param": "6"}, "expect": {"/object": {"eq": 1}, "/instances": {"eq": 6}}}, {"tool": "run_action", "args": {"id": "orca_command:undo:orca"}}, - {"tool": "list_objects", "expect": {"/items/1/instances/1": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/1/instances/1": {"exists": false}}}, {"tool": "select_objects", "args": {"objects": [1]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_set_instances:orca", "param": "3"}}, {"tool": "run_action", "args": {"id": "orca_command:obj_set_instances:orca", "param": "0"}, "optional": true}, {"tool": "run_action", "args": {"id": "orca_command:obj_set_instances:orca", "param": "three"}, "optional": true}, - {"tool": "list_objects", "expect": {"/total": {"eq": 2}, "/items/1/instances/2": {"exists": true}, "/items/1/instances/3": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 2}, "/plates/0/objects/1/instances/2": {"exists": true}, "/plates/0/objects/1/instances/3": {"exists": false}}}, // every instance its own object (the whole object selected), then two of them assembled {"tool": "select_objects", "args": {"objects": [1]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_instances_to_objects:orca"}, "expect": {"/objects/0": {"eq": 1}, "/objects/2": {"eq": 3}}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 4}, "/items/3/instances/1": {"exists": false}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 4}, "/plates/0/objects/3/instances/1": {"exists": false}}}, {"tool": "select_objects", "args": {"objects": [1]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_instances_to_objects:orca"}, "optional": true}, {"tool": "select_objects", "args": {"objects": [2, 3]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_assemble:orca"}, "expect": {"/object": {"eq": 2}, "/name": {"eq": "Assembly"}}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 3}, "/items/2/name": {"eq": "Assembly"}, "/items/2/volumes/1": {"exists": true}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 3}, "/plates/0/objects/2/name": {"eq": "Assembly"}, "/plates/0/objects/2/parts/1": {"exists": true}}}, {"tool": "select_objects", "args": {"objects": [0]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_assemble:orca"}, "optional": true}, {"tool": "list_objects", "expect": {"/total": {"eq": 3}}}, @@ -271,18 +272,18 @@ {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "param": "20 20 20"}}, {"tool": "run_action", "args": {"id": "orca_command:obj_order_by_height:orca"}, "expect": {"/descending": {"eq": false}, "/order/2/object": {"eq": 2}, "/order/2/plate": {"eq": 0}}}, - {"tool": "list_objects", "expect": {"/items/0/bbox/size/2": {"ge": 9.99, "le": 10.01}, "/items/2/bbox/size/2": {"ge": 29.99, "le": 30.01}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/bbox/size/2": {"ge": 9.99, "le": 10.01}, "/plates/0/objects/2/bbox/size/2": {"ge": 29.99, "le": 30.01}}}, {"tool": "run_action", "args": {"id": "orca_command:obj_order_by_height:orca"}, "expect": {"/descending": {"eq": true}}}, - {"tool": "list_objects", "expect": {"/items/0/bbox/size/2": {"ge": 29.99, "le": 30.01}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/bbox/size/2": {"ge": 29.99, "le": 30.01}}}, // refused: an empty current plate, a param other than all; all orders every plate {"tool": "run_action", "args": {"id": "orca_command:plate_add:orca"}}, {"tool": "run_action", "args": {"id": "orca_command:plate_goto:orca", "param": "1"}}, {"tool": "run_action", "args": {"id": "orca_command:obj_order_by_size:orca"}, "optional": true}, {"tool": "run_action", "args": {"id": "orca_command:obj_order_by_size:orca", "param": "every"}, "optional": true}, - {"tool": "list_objects", "expect": {"/items/0/bbox/size/2": {"ge": 29.99, "le": 30.01}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/bbox/size/2": {"ge": 29.99, "le": 30.01}}}, {"tool": "run_action", "args": {"id": "orca_command:obj_order_by_size:orca", "param": "all"}, "expect": {"/descending": {"eq": false}, "/order/0/plate": {"eq": 0}, "/order/3": {"exists": false}}}, - {"tool": "list_objects", "expect": {"/items/0/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/bbox/size/2": {"ge": 9.99, "le": 10.01}}}, // ---- End to end: a block with a magnet pocket and a boss, sized on the bed, moved to a second // plate, six copies arranged apart there, each made its own object, one mirrored, two assembled, @@ -291,20 +292,20 @@ {"tool": "run_action", "args": {"id": "orca_command:add_primitive_cube:orca", "param": "40 40 10"}}, {"tool": "transform", "args": {"object": 0, "translate": [100, 100, 5], "mode": "absolute"}}, {"tool": "add_part", "args": {"object": 0, "type": "negative", "shape": "cylinder", "size": [6.2, 3.2], - "position": [100, 100, 1.6]}, "expect": {"/volume": {"eq": 1}}}, + "position": [100, 100, 1.6]}, "expect": {"/part": {"eq": 1}}}, // a boss on top; solid parts are listed before negative ones {"tool": "add_part", "args": {"object": 0, "type": "part", "shape": "cylinder", "size": [10, 5], "position": [100, 100, 12.5]}, - "expect": {"/volume": {"eq": 1}, "/volume_count": {"eq": 3}, "/volume_info/bbox/min/2": {"ge": 9.99, "le": 10.01}}}, - {"tool": "select_objects", "args": {"volumes": [[0, 1]]}}, + "expect": {"/part": {"eq": 1}, "/part_count": {"eq": 3}, "/part_info/bbox/min/2": {"ge": 9.99, "le": 10.01}}}, + {"tool": "select_objects", "args": {"parts": [[0, 1]]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_rename:orca", "param": "boss"}}, - {"tool": "transform", "args": {"object": 0, "volume": 1, "translate": [5, 0, 0]}, - "expect": {"/volume_info/name": {"eq": "boss"}, "/volume_info/position/0": {"ge": 104.99, "le": 105.01}}}, + {"tool": "transform", "args": {"object": 0, "part": 1, "translate": [5, 0, 0]}, + "expect": {"/part_info/name": {"eq": "boss"}, "/part_info/position/0": {"ge": 104.99, "le": 105.01}}}, // 50 mm wide in proportion, so 1.25 x (10 + 5) mm tall, and still on the bed {"tool": "transform", "args": {"object": 0, "size": [50, null, null]}}, - {"tool": "list_objects", "expect": {"/items/0/bbox/size/0": {"ge": 49.99, "le": 50.01}, - "/items/0/bbox/size/2": {"ge": 18.74, "le": 18.76}, - "/items/0/bbox/min/2": {"ge": -0.001, "le": 0.001}, - "/items/0/volumes/2/type": {"eq": "negative"}}}, + {"tool": "list_objects", "expect": {"/plates/0/objects/0/bbox/size/0": {"ge": 49.99, "le": 50.01}, + "/plates/0/objects/0/bbox/size/2": {"ge": 18.74, "le": 18.76}, + "/plates/0/objects/0/bbox/min/2": {"ge": -0.001, "le": 0.001}, + "/plates/0/objects/0/parts/2/type": {"eq": "negative"}}}, {"tool": "run_action", "args": {"id": "orca_command:plate_add:orca"}}, {"tool": "transform", "args": {"object": 0, "plate": 1}, "expect": {"/plate": {"eq": 1}}}, // six copies, overlapping where Set Number of Instances puts them, spread out on plate 1 alone @@ -313,21 +314,21 @@ {"tool": "arrange", "args": {"plates": 1, "spacing": 10, "rotate": false}, "expect": {"/off_plate": {"empty": true}, "/settings/spacing": {"eq": 10}, "/plates": {"eq": 2}}}, {"tool": "list_objects", "args": {"plate": 0}, "expect": {"/total": {"eq": 0}}}, - {"tool": "list_objects", "args": {"plate": 1}, "expect": {"/items/0/instances/5/plate": {"eq": 1}}}, + {"tool": "list_objects", "args": {"plate": 1}, "expect": {"/plates/0/objects/0/instances/5/index": {"eq": 5}}}, // every instance its own object (the whole object selected), each with the three parts {"tool": "select_objects", "args": {"objects": [0]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_instances_to_objects:orca"}, "expect": {"/objects/5": {"eq": 5}}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 6}, "/items/5/volumes/1/name": {"eq": "boss"}, - "/items/5/volumes/2/type": {"eq": "negative"}, "/items/5/instances/0/plate": {"eq": 1}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 6}, "/plates/1/objects/5/parts/1/name": {"eq": "boss"}, + "/plates/1/objects/5/parts/2/type": {"eq": "negative"}, "/plates/1/objects/5/instances/0/index": {"eq": 0}}}, {"tool": "select_objects", "args": {"objects": [5]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_mirror_x:orca"}}, - {"tool": "list_objects", "expect": {"/items/5/instances/0/mirrored": {"eq": true}, "/items/4/instances/0/mirrored": {"eq": false}}}, + {"tool": "list_objects", "expect": {"/plates/1/objects/5/instances/0/mirrored": {"eq": true}, "/plates/1/objects/4/instances/0/mirrored": {"eq": false}}}, // two assembled into one object, which goes last; the mirrored one moves up to index 3 {"tool": "select_objects", "args": {"objects": [0, 1]}}, {"tool": "run_action", "args": {"id": "orca_command:obj_assemble:orca"}, "expect": {"/object": {"eq": 4}, "/name": {"eq": "Assembly"}}}, - {"tool": "list_objects", "expect": {"/total": {"eq": 5}, "/items/4/volumes/5": {"exists": true}, - "/items/4/bbox/min/2": {"ge": -0.001, "le": 0.001}, - "/items/3/instances/0/mirrored": {"eq": true}}}, + {"tool": "list_objects", "expect": {"/total": {"eq": 5}, "/plates/1/objects/4/parts/5": {"exists": true}, + "/plates/1/objects/4/bbox/min/2": {"ge": -0.001, "le": 0.001}, + "/plates/1/objects/3/instances/0/mirrored": {"eq": true}}}, {"tool": "run_action", "args": {"id": "orca_command:obj_order_by_name:orca", "param": "all"}, "expect": {"/descending": {"eq": false}, "/order/0/name": {"eq": "Assembly"}, "/order/4/plate": {"eq": 1}}}, {"tool": "arrange", "args": {"fill": 1}, "expect": {"/added": {"gt": 0}, "/plate": {"eq": 1}, "/off_plate": {"empty": true}}},