Commit Graph
697 Commits
Author SHA1 Message Date
Ian Chua bd9f5261ab feat: allow filament slots independent of toolhead count (#17847)
* feat: make filament slots independent from extruders

* test: fix filament slot fixtures

* fix: warn when filament slots exceed tool count

* test: fix filament slot warning fixture

* fix: update preset sweep for independent filament slots

* fix: Warn about filament slots that may address the wrong tool

* fix: align MCP filament slot operations with the sidebar

* test: fix filament slot schema and preset sweep

* fix: limit object filament settings by slot count
2026-11-27 19:38:12 +08:00
SoftFever 04603d6ccd Official OrcaSlicer MCP support (#17819)
* Give the MCP server its own AI features group in Preferences

The group shows whether agents can connect and at which address, and copies a
ready-made setup for Claude Code, Codex, opencode, DeepSeek Harness or other
apps. A second OrcaSlicer window on the same configuration folder says another
window is serving agents and takes the server over when that window closes.

* Let users choose HTTP or stdio when adding OrcaSlicer to an agent

* Refuse Design tab reads while a rebuild owns the document

* Let MCP clients drive every gizmo

Also fixes a crash when a script answers the primitive size dialog, the Simplify ratio box being
ignored, a Measure crash after a reload, and Mesh Boolean showing a bare "tool" label.

* Let MCP clients do the OrcaSlicer tasks the agent benchmark found missing

* Point agents at the MCP harness instead of an in-repo skill

* Add explain_settings so agents can look up what settings do

It returns each setting's full tooltip, its page and group, and its wiki link, maps every setting
by page and group, and finds settings by the words of their help text. get_settings no longer
includes tooltips in its metadata.

* set window size to 1920x1200 for MCP scripts

* Add a Run Script dialog for running MCP scripts in the app

* update git ignore

* Add app recording and screenshots for MCP agents and the Help menu

Agents can record OrcaSlicer to video, captioned with the current tool call, and encode it to MP4.
People get Take Screenshot and Start/Stop Recording in the Speed Dial and the Help menu, with a
dialog for the recording and encoding settings.

* Stop the app flickering while a recording runs on Windows

* Make recording overlays opt-in, with pointer and caption switches in Start Recording

* Let agents ask for an MP4 when starting a recording

* Show a REC pill in the tab bar while a recording runs

* Make the MCP tools easier for agents to use

get_settings now gives each setting's description and settings page and finds settings by what
they do, replacing explain_settings. set_view orbits the camera by degrees, the same on every
install, and a painting stroke that would miss the object is refused with the pixel to start it
at instead of turning the camera. Tools accept the argument names and forms agents commonly use,
save_project refuses a .gcode.3mf path, and select range-checks part and instance indices.

* Keep the Run Script dialog in front after its file picker closes on macOS

* Add a script editor with suggestions and saving to the Run Script dialog

* Show the recording and screenshot icons in the Speed Dial at full size

* Keep the Run Script dialog in sight while a script runs on macOS

* Let MCP agents read and drive web dialogs and plugin pages

Agents can also answer a native message box that is already open (Windows and Linux), and URLs in
replies hide credential values.

* Fix MCP canvas captures failing right after a tab switch on Wayland

* Add missing includes in the MCP sources and the recording dialog

* Make the MCP harness and its test scripts executable

* Stop the MCP stdio bridge leaving a quit OrcaSlicer as a zombie process

* Report frames that failed to encode in stop_recording's result

* Tell MCP agents when a call fails because the display is off

* Name the open dialog when a script step times out waiting for its job

* Make canvas screenshots taken right after a layer or view type change show the change

* Add Python scripts and plugin tools to the MCP server

The MCP tools are listed in core, API and UI lanes. With Python scripts turned on in Preferences, agents
and people can run Python against the open app; plugins holding the tools permission can call the tools,
and plugins can offer operations of their own to agents. Calls can pin object and volume ids so a stale
index is refused, and run_script takes a script as JSON text as well as an object.

* Run Python scripts like python file.py, with the whole plugin API

* Document the whole orca Python API and search every catalog from api_describe

* Tell agents which scope a setting belongs to when they name the wrong one or none

* Ask for approval only on MCP calls that delete without undo, and mark the tools that reach outside the app

* Let agents select hidden filaments and printers by name

* Show agents the selection, the Python setting and the Design tab in get_state

* Tell agents what list_objects ids are for and how paged replies continue

* Make the MCP tool descriptions shorter and consistent, with the UI locators described once

* Explain in the MCP design doc why tools have no output schema

* Let the MCP harness call api_call, whose argument is named tool

* Read a modal dialog's controls and values into its MCP message

* Let install_local_plugin take a plugin file's path

* Report why a local plugin install failed

* Show Speed Dial plugin refreshes and installs in an open Plugins dialog

* Show a reloaded local plugin's new version in the Plugins dialog

* Give python_api's static methods their own documentation

* Give register_operation a signature Python can declare

* Correct the MCP web fixture's comments on its thread command

* Start OrcaSlicer from the stdio bridge only when a tool is called

* Show dialogs in Wayland recordings and stop blank Wayland window captures

* Show popups, context menus and tooltips in Wayland recordings and screenshots

* Show popups in Windows and macOS recordings and screenshots

* Keep MCP canvas clicks working when OrcaSlicer is in the background

* Show context menus, dialogs and web views in macOS screenshots and recordings

Recording frames are also spaced as documented when capture is slow, and a drop-down that has left the screen is no longer drawn into macOS frames.

* Fix Windows popup capture and MCP stalls in native menus and dialogs

* Move the MCP server only when its port is edited in Preferences

* Vendor Ace 1.45.2 for the script editors

* Split Run Script into Action Replay and a docked Python Run Script panel

* Add an MCP tool that lists open windows with refs for screenshots and input

* Give MCP tools plain names and call recorded tool lists replays

* Keep the call_cad_tool registration with the Design tab's MCP code

* Move the Design tab's MCP code next to the MCP server

* Reach the Design tab only through the MCP server

* Give every CAD tool a one-line summary and details

* Add list_cad_tools and describe_cad_tool and call CAD tools by tool and args

* Attach orca_mcp.py to a running app and call CAD tools from Python

* Give the CAD read and sketch tools runnable examples

* Give the CAD solid, dress-up and datum tools runnable examples

* Give every CAD tool runnable examples

* Bound the MCP journal by the size of its calls' arguments

* Run the CAD sketch checks against the app's MCP server

* Remove the Design tab's Docker test setup and check its offer table in CI

* Correct CAD docs and comments that disagree with the code

* Pin the journal's byte accounting and the CAD table's id notes in tests

* Find a portable OrcaSlicer through a symlinked binary in orca_mcp.py

* Correct when the Design tab is created and why sketch_set_value exists

* Describe orca_mcp.py's macOS datadir lookup as the stdio bridge's

* Keep the MCP journal's trim linear and its lock short

* End the journal entry of a job that never runs

* Clarify the CAD tool descriptions and examples

* Tidy orca_mcp.py's CAD helper and its tests

* Describe CAD checks and sketch code as they are, not as they were

* Finish describing the CAD sources and checks as they are

* Describe thicken_surface's capped and simple paths as they are

* Say which sheets thicken_surface refuses

* Report sketch loop areas as positive whichever way the loop runs

* Report degrees of freedom instead of -1 for sketches with no constraints

* Keep constraints among entities a sketch transform moves together

* Build revolve's default rectangle beside the axis instead of across it

* Report every bad example reference and describe the sketch code as it is

* Move the Design-tab GUI checks into the MCP tests

* Fix four Design-tab sketch bugs the GUI tests found

A sketch with thousands of constraints no longer freezes the app, the first value field after launch
takes typed digits, an array's spacing and copy count can both be typed, and cancelling a new Text
removes it.

* Let auto-answer rules answer file and folder pickers with a path

* Run the Design-tab GUI tests through MCP on every platform

* Refuse MCP clicks on main menu items the app would show greyed

* Report the selected sketch constraint over MCP and test badge selection in the Design GUI tests

* Add set_window and set_view camera target and zoom over MCP

* Mention set_window in the MCP server instructions and keep them under 4096 characters

* Load the flow ratio calibration models without the 3MF import dialog

* Make set_window work on Wayland and on an X server without a window manager

Also keeps a polygon drawn near an axis regular in the Design tab, and lets the Design GUI tests run on Linux.

* Launch MCP harness instances on a private headless desktop on Linux, falling back to Xvfb

* Point MCP name misses at the right catalog and give each argument one name

A tool, Speed Dial action or CAD tool called through the wrong tool is told
where it runs, search_actions ranks a query's words as search_tools does, and
every list replies with items.

Renamed arguments: set_view's target and view are look_at and canvas,
list_widgets' root is target, mouse_gesture's path is waypoints, the presets'
changes is preset_changes, set_height_ranges' layer_config_ranges is ranges,
and the main window is "main" for screenshot and start_recording.

The harness's launch takes --python-scripts to allow Python scripts in the
instance it starts.

* List objects by plate over MCP and call a part "part" in every tool

list_objects replies as the Objects panel is laid out: each plate with the
objects on it, then the objects on no plate. list_plates gives how many
objects a plate has, and every tool refuses a plate the project lacks in the
same words.

* Drop the old MCP names the server still read and the text that still used them

set_view's view, the print scope and window for the main window are refused
like any unknown name.

* Reduce script permissions to a single "run unrestricted" switch

Python scripts always run and follow the plugin permission checks; the switch in Preferences lets
them bypass the checks. Plugins call the tools and offer operations without a separate permission.

* Fix macOS issues found driving the app over MCP

set_window brings a window minimized while zoomed back to normal, and its documentation covers
raising windows and native dialogs. A right-click in the Design tab picks what it points at on
Retina displays, where the Design tab GUI tests now run too, and the Text dialog opens in a plain
font. The app no longer hangs when dialogs open and close with the display asleep, and no longer
crashes when a new project or a delete removes an object that has parts.

* Run commands, tools and the plugin API through one operations layer

A Speed Dial command, the MCP tool that does the same thing and the plugin
API's preset calls now run one shared operation, so every route accepts and
refuses the same states, with one wording and a code for each refusal. An
import by a command or a tool is one undo step, and import_file adds geometry
only.

The cases where two routes behaved differently now behave the same: a project
is not saved under a .gcode.3mf name, an empty project exports as .3mf but not
as STL, arrange runs from any view and with a gizmo open, a mixed-colour
filament slot is refused as one, a hidden preset is shown before it is
selected, and a layer is refused while the Preview has none.

* Hold Speed Dial commands, MCP tools and Design tools in one command catalog

Every command takes JSON arguments and has one function for a person and for
automation: with no arguments it does what a person's pick does, and with
arguments it runs silently. The Design tab's CAD tools are commands that
call_tool runs, and they show as Speed Dial tiles on the Design tab.

* Correct what command descriptions and the skill reference tell agents

A Design tile's command says it follows its right-click menu row and may
decline, export_config says how its rows are named, and the generated skill
reference says which commands are the person's own and how the Design tab is
turned on.

* Fix the sketching test's undo check and a missing include found on Linux

* Open the Speed Dial with Space right after a tab switch, without a KWin title bar on Wayland

* Fix MCP menu paths, CAD-off replies, test-instance sign-in, Preview focus and clang-tidy on macOS

* Make the MCP harness and page tests pass reliably on a loaded machine and on macOS

* Make the automation runtime its own subsystem, with MCP as one front end

Everything that drives OrcaSlicer by command (the dispatch of the command
catalog, jobs, the journal, replays, Python scripts, recordings) lived
inside the MCP server's service class. So Action Replay, the Run Script
panel, a plugin's tool call, a person's recording and a run from the
command line each had to start "the MCP service", with all of its GUI
hooks, although none of them needs a server or an agent.

The automation runtime is now a subsystem of its own. It starts the first
time a front end asks for it and knows none of them. The MCP endpoint
(HTTP, the protocol, the token, the discovery file, the takeover of a port
another window holds) is one front end beside the others, opened and
closed without stopping what the others run. The widget inspector, menu
capture and ImGui item recording are turned on only by a front end that
drives the GUI, so a person's recording or long command does not carry
them.

The part of the runtime that needs no GUI is the library
libslic3r_automation, built without wxWidgets and tested by its own suite,
automation_tests. A wx dependency in it fails to build, and its tests no
longer link the GUI library or the embedded Python.

The command line has one option set for this: --run FILE runs a replay or
a Python script once the GUI is ready, with --outputdir for its files, and
--unrestricted-scripts and --cad turn their settings on for one run
without saving them. --mcp-run, --mcp-run-out and --mcp-token are gone;
the scripts setting is python_scripts_unrestricted and a session's output
folder is <datadir>/automation/out. get_app_state reports ready and
version at the top level, and its mcp block describes the endpoint only.

No change to slicing output.

* Keep only the MP4 of an encoded recording unless asked to keep the raw video file

* Expect keep_raw_video_file among the start_recording command's arguments

* revert localization/i18n/OrcaSlicer.pot

* Let a plugin file be named script.py or mcp.py

* Leave a Speed Dial command's unexpected exception to the app's handler

* Keep the Speed Dial's Undo and Redo to where the Edit menu allows them

* Keep menu update handlers away from a freed context menu's items

* Turn the automation's GUI instruments off when nothing drives the GUI

* Cut the MCP test sweep's run time without losing coverage

* Keep the Design toolbar at its own height when the Design tab first opens

* Open every MCP test instance at 1600x900 in the top left of the screen

* Rename the completion and result enums clear of Xlib's macros

* Run the MCP sweep on the desktop, and answer the certificate prompt

* Click a partly shown list row, and let a refusal keep its result.json

* Make the MCP test sweep pass on Windows

Windows now keeps one window per data folder, as macOS and Linux do.

* Name the Design tab's commands in the search_tools description

* Keep layer G-code when New Project's prompt is cancelled or saves the project

* Report a project save that wrote nothing as not saved

* Make the MCP tool descriptions say what the tools do, and rename four misleading names

* Rename and regroup the Design tab's MCP commands, and add the missing ones

The Design commands follow Fusion 360's names and grouping: one command per
job, with a `type` argument for its variants, so 133 commands become 88. An
old name or argument is refused. What the tab could do and no command
reached now has one: re-opening a committed sketch, selecting geometry,
confirming or cancelling an open tool, placing a body, sketch patterns and
dimensions, and text, SVG art and projected edges from arguments.

Ten defects in the Design tab's cards and sketch tools found on the way are
fixed. For a person: the Mirror tool binds a mirrored line or arc to its
source, Commit to Plate and Export STEP stop when the open card's Confirm
fails, and the Speed Dial keeps a query typed before its list arrives.

* Give replay files a semver format version

* Document the Design tab's command set

* Regroup the slicer's MCP commands and let each run from its arguments

Outside the Design tab an agent had 175 commands, 50 of them in the tool
list. There are now 118, named by what they act on (`object_`, `plate_`,
`preset_`, `filament_`, `plugin_` and so on), and 115 are listed. Each takes
its target and values in the call, acts on the selection when it names no
target and says what it acted on; an old name is refused. Printers and
system filaments install and uninstall, preferences read and write, plugins
enable, reload, uninstall and refresh, and objects reorder, with no dialog
to drive.

The Speed Dial keeps its 129 tiles under the same ids. Eight defects in the
rows these commands share with the menus are fixed. For a person: an object
row that cannot run says why instead of "Select an object first.", rows
that failed no longer claim success, Duplicate Plate can be undone, and
Refresh Plugins picked while a refresh runs now runs after it instead of
beside it.

* Document every MCP command in one reference, the Design tab's in a section of its own

The commands outside the Design tab now have a reference like the Design tab's: what each does and
takes, which menu rows call it, which calls ask in a dialog and the call that does not. Both live in
docs/HLSD/mcp-tools.md, OrcaSlicer's commands first and the Design tab's at the end.

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

The MCP command descriptions, docs and code called an entry of the app's
menus a "row", the word they also use for the rows of the object list and
the app's other lists. They now say "menu item", so a row is only ever a row
of a list or table. Command names, arguments and Speed Dial tile ids are
unchanged.

* Say action and Speed Dial, not tile and palette, in the MCP commands and docs

The MCP commands, their catalog and the docs called a command's Speed Dial entry a "tile" and the Speed
Dial itself "the palette", words the app already uses for an entry's icon and for sets of colours. They now
say "action" and "Speed Dial", as action_search and action_run do, and the catalog's tiles, tile_group and
in_palette fields are now actions, action_group and has_own_action. Speed Dial ids, and the pins people
stored under them, are unchanged.

* Catalog the MCP sweep tests and design their Python replacements

Every sweep test now has an entry, by area under tools/mcp/test-entries/, saying what it checks, how it decides pass
or fail and what it leaves unchecked, and TESTS.md holds the rules a new test is designed by before it is written.
The entries also design the Python tests that take the place of the replays, which leave the sweep as those land;
the fifteen operation replays that could not fail are removed now.

* Check the plates in the MCP sweep with a Python test that reads every step back

test_plates.py takes the place of the plate replays: after each add, duplicate, rename, lock, select or delete it
reads the plate list back and compares it with the state its entry writes out, and it checks what a lock keeps
Arrange and Auto-Orient from doing, a plate's own settings, the filament slots and the plate icons. Arranging a
locked plate is refused with advice that names plate_lock with the plate, instead of a needless plate_select.

* Check every area of the MCP sweep with Python tests that read each step back

The sweep's objects, presets, filaments, settings, project files, slicing, gizmos and GUI tools are tested by Python
tests that compare the app's state after every step with the values their entries write out, in place of the
replays, and the existing tests' checks that could not fail now can. The calls these tests found wrong now behave
as described: moving one instance no longer sinks the others, a toolpath export writes the layers shown, an
auto-answered dialog no longer reports its call blocked, and a web dialog that has just opened takes requests.

* Design the sweep tests for the gizmo and printing commands

The sweep's entries now describe the tests for the commands that open a gizmo or a print dialog on a target and,
where they can, do its job from arguments: what each step must leave behind and how every refusal is told apart.
They also take every sweep call that would open a Bambu printer's Print or storage dialog off the scratch datadir,
so no test run messages a real printer.

* Check that a refused gizmo opening leaves the selection as it was

The gizmo commands' test design now also checks a refused opening made while another gizmo is open, and says which
refusals put back the selection the call had changed and which come before it changes anything.

* Let MCP clients open the painting, Measure, Simplify and Mesh Boolean gizmos on a named object

object_paint, object_measure, object_simplify and part_boolean open their gizmo on the object, instance or part a
client names, where before a client had to know the gizmo existed and click its icon after selecting. A refused
opening says why in the gizmo's own terms, such as Mesh Boolean needing two parts, and leaves the selection and the
undo history as they were.

* Let MCP clients cut an object along a plane with object_cut

object_cut cuts an object at a height or along any plane, keeping either piece or both, laid where the Cut gizmo would
lay them or kept as two parts of one object, in one undo step, as the gizmo's Perform cut does. Named with only its
object it opens the Cut gizmo on it, for connectors, the dovetail and cuts along a contour. A plane that misses the
object, or an object with connectors, is refused with the model left as it was.

* Let MCP clients lay an object on a face, set its brim ears, and add text or an SVG to a named object

object_lay_on_face turns an instance so that the face a direction names lies on the bed, as a click in the Lay on Face
gizmo does, and object_set_brim_ears places brim ears at bed positions, or clears them, as the Brim Ears gizmo stores
them; called with only their object, both open their gizmo. object_add_text and object_add_svg can name the object the
part joins and make it a negative part or a modifier. The Brim Ears gizmo shows ears set this way when it next opens,
rather than writing back the ones it held.

* Let MCP clients start a print, send to a Bambu printer, and test the print host

print_start opens the dialog the Print button opens for the selected printer, for one plate or all of them, and is
refused where the button would be disabled, such as for a plate not sliced. printer_send, and the Send G-code Speed
Dial action with it, open the dialog that sends to a Bambu printer's storage where they used to refuse such a printer,
and take the plate to send. printer_test_host checks that the printer's print host answers, as the Test button of its
connection dialog does.

* Let MCP clients read the connected printer's status and pause, resume or stop its print

printer_status reads what the Device tab shows of the printer it is connected to: its state, progress, layer, the
file printing and the temperatures, with no serial number and nothing sent to the printer. print_pause, print_resume
and print_stop do what the tab's buttons do, and are refused, saying why, where the printer's state does not allow
them or a job can be resumed only at the printer.

* Let MCP clients see and close the Action Replay window

The Action Replay window was hidden from every GUI tool, so an agent or a test that opened it could not close it,
and it stayed on screen for the rest of the run. It is now listed with a ref, its page can be read, and Escape sent
to it closes it. Its file pickers and confirmation prompts stay the person's alone.

* Document the gizmo and printing commands for MCP clients and developers

The command reference now describes the 13 gizmo and printing commands: which gizmo or dialog each opens, the
arguments that do the job without it, the Print button's routes for each kind of printer, and what is left to the
dialog. The server design says how the commands reach the gizmos, the print dialogs and the printer, and the test
notes name what no test reaches: the Bambu print dialogs and a physical printer.

* Fix object_cut on planes just off straight down, and text added with several objects selected

An object_cut plane tilted less than a degree from straight down was cut level, and object_add_text or
object_add_svg given only a part type, with several objects selected, made a new ordinary object. The cut now keeps
the plane's tilt, the add is refused one_object_only, and the sweep also checks lay on face's refusals, clearing
brim ears with the gizmo open, and print calls that name a plate.

* Add a typed text or SVG to an object when only its negative part or modifier is selected

object_add_text or object_add_svg given only a part type, with nothing but a negative part or modifier of an object
selected, made a new ordinary object. It now selects that object whole and adds the part to it, as a right click on
the object's row does before its Add Part, Add Negative Part and Add Modifier menus.

* Keep the flush multiplier when viewing a G-code file

Viewing a G-code file set the project's flush multiplier to 1 whatever the file was sliced with, and
the 1 stayed through a new project, a preset switch and a restart, so every later multi-colour slice
purged several times as much. The project now keeps the file's own multiplier, and the preview still
shows the purge volumes the file was sliced with.

* Delete mixed filament slots and export sliced files of unsliced plates over MCP

An agent could not remove a mixed filament slot, so a project that had one never got back to a single slot, and
deleting a physical slot a mix used left the mix broken. filament_delete now removes a mixed slot as the sidebar's
list does and refuses to delete a slot a mix needs. Exporting a sliced file to a given path no longer fails on the
file name template when the plate is not sliced, as it did on the Generic Klipper Printer.

* Keep MCP calls reliable on a busy machine

When the computer was busy, agents saw calls fail that work on a quiet one. A right click's context menu could open
on screen instead of reaching the call, a click could find a button still disabled, a call could report it was
blocked by a dialog an auto-answer rule had already answered, the first call through the stdio bridge could be
refused while the app it started was still loading, and a replay could fail waiting on a step that had finished.
Each of these now waits for the app to catch up instead.

* Run the MCP sweep on shared data folders with the Generic Klipper Printer

The sweep made a fresh data folder for every test, copying all of Bambu Lab's profiles each time, left tens of
gigabytes of run folders behind, and failed outright on a test that only failed while other tests loaded the
machine. Each job now keeps one data folder for all its tests, seeded with the Generic Klipper Printer as a person's
folder carries over from day to day; a test that fails beside others runs again alone and is remembered as one to run
alone; and a passing test's folder is deleted as soon as it passes.

* Thread bores reliably wherever the part sits on the bed

In the Design tab, threading a bore could fail with "thread removed no material" depending only on
where the part sat: an M5 standoff at the centre of a 250 x 250 mm bed could not be tapped, while the
same part a few millimetres away could, and some blind holes could not be tapped anywhere. Threads now
cut into through and blind holes alike, at any position.

* Fix the MCP sweep's files and preferences tests failing on the DRC depth

Both tests still set the DRC depth to 0, a value the Preferences dialog does not take, so they failed. The files test
now checks that the depth is the app's lossless default and fails by name on a data folder set to a lossy one, and the
preferences test no longer checks a value outside the dialog's range.

* Say what the slice preview test leaves now that viewing G-code keeps the flush multiplier

The test's entry still said a viewed G-code file leaves the flush multiplier at 1. It now says the test leaves the 0.3
its start sets, and why that start still sets it: the filaments test leaves the same printer at 1.4.

* Say which slot colours and flush multiplier the filaments test leaves

A developer reading the filaments test's entry could not tell that it leaves white and black slots and a flush
multiplier of 1.4 on the shared data folder, which the next test meets and a two-colour slice purges more for.

* Edit mixed filaments and their gradients over MCP as the sidebar does

Agents can now read the whole filament list with filament_list, change a mixed filament with filament_edit_mixed,
and set a gradient by driving the Add or Edit Mixed Filament dialog. The slot colours and the flushing settings move
from the project tools to filament_set_colour and filament_set_flushing, beside the rest of the filament list.
Deleting or merging a filament that a mix uses now behaves as it does in the sidebar, and the settings tools no
longer edit a physical filament's preset through a mixed slot.

* Keep sf-plan design and planning files out of the repository

* Make the full MCP sweep finish in about 11 minutes

A full sweep on six jobs took 17 to 19 minutes, too long to run often. Its 66 tests are
now 40 that cover the same areas with each scenario run once, and the sweep finishes in
about 11 minutes. The Speed Dial test checks a handful of commands no other test reaches,
and the sweep runs only test_*.py files; smoke_test.json and the Design replays are
played by the tests that use them.

* Let agents answer the mixed-filament merge warning on macOS

Merging a filament into a mixed filament that uses it asks for confirmation first. On
macOS that question was a native alert, which held the app so an agent driving it over
MCP could neither see nor answer it. It now opens in Orca's own dialog, as the app's
other warnings do, with the same text and buttons.

* Fix crash when a web window is closed as soon as it opens

On macOS, opening the Action Replay window and closing it straight away with Escape
crashed OrcaSlicer a moment later. Web windows can now be closed the moment they open.

* Make the MCP sweep's tests pass on macOS

Several sweep tests failed on every macOS run while passing on Windows: the Run Script
panel and plugin command checks, the auto-orient placement check, and the Design tab's
edge re-pick checks. They now pass on both.

* Fix renaming in the Design tab ending as soon as it starts on Linux

* Make test_cad_commands pass when another app takes the focus on Linux

* Stop testing that the early MCP command-line options are refused

The command-line test checked that four MCP options from before their rename are refused. They never shipped in a release, so the check guarded nothing a user could rely on, and on Windows it printed the app's full usage text into the sweep's console four times.

* Make MCP sweep tests pass in any order, one app per job

A test's verdict depended on which test had run before it on the shared data folder, and fixed pauses failed tests
on a busy machine. Each job now runs its tests in one app, every test starts from the same baseline whatever ran
before, and tests wait for the state they expect rather than for a set time; --shuffle runs the sweep in a random
order to show any test that still leans on another. The command-line test is gone, as it checked options outside
the MCP server.

* Clear every sweep test's serial mark at once with --forget all

* Let MCP path rules answer folder pickers on Linux

A dialog_auto_answer rule with a path cancelled every folder picker on Linux, such as the Preferences
download folder's Browse and the recording dialog's Change..., so a script couldn't pick a folder there and
the sweep's Preferences and Speed Dial tests failed. Folder pickers now take the path as on Windows and
macOS; file pickers still cancel on Linux.

* Let MCP path rules answer file pickers on Linux

A dialog_auto_answer rule with a path still cancelled every open and save file picker on Linux, so a script
couldn't save or open a project through the File menu or insert an SVG in the Design tab there, and the sweep
skipped those steps. File pickers now take the path as on Windows and macOS. This needs the updated
wxWidgets, so rebuild the deps.

* Bring the checked-in command reference up to date with the Linux picker rules

The reference still said a path rule cancels a file picker on Linux and that a save picker needs a new
file, so the reference test failed.

* Let MCP calibration tests print with any physical filament

calibration_generate_test always printed with filament slot 1, so an agent could not calibrate another filament of
the project or, on a multi-extruder printer, the nozzle that prints it. It now takes filament_slot, as the
Calibration dialogs' filament list offers, prints on the extruder the filament map gives that filament, and says in
its reply which extruder that is.

* Start Action Replay with a replay that slices the Orca Cube on a new plate

The Action Replay window now opens with a replay that adds a plate, puts the Orca Cube on it, slices that
plate and saves a screenshot of the preview. It checks that the new plate really sliced, so it fails
instead of passing on an empty plate.

* Write replay results to the temp folder unless an output folder is given

Replays that name no output folder, whether run from Action Replay, by an agent or with --run, left a
<name>.out folder beside the replay file or filled the data folder. They now write to a new
orca_action_replay/replay-<time> folder in the temp folder, or inside --outputdir when a --run launch names one.

* Fix --run crashing at exit when a dialog is still open

A --run launch that ended with a dialog open, such as the prompt to restore an unsaved project left by an
earlier session, crashed while closing and returned a crash code instead of the replay's result. It now
closes the dialog first and exits with the replay's code, and it no longer asks about or discards a
person's unsaved project, which their next normal launch still offers to restore.

* Refuse misspelt Design arguments and tell agents how to fix refused calls

A misspelt argument to most Design commands was ignored, so the command ran with
its default, such as a helix built with the default pitch. Every Design command now
refuses it and names the arguments it takes. Refusals of a missing object or part,
an unknown setting key, an invalid setting value or a preset that is not installed
now say the valid range, the similar keys, what the setting takes or the command
to use, and plate_add and object_add_handy_model say what they added.

* Say in a word why an MCP call was refused, and how to get past it

Design commands were refused with numbers such as -32002 or with no code at all; they now say design_busy,
precondition, invalid_argument, rebuild_failed and the like, so an agent can tell a wrong argument from a design
that is not ready, on every route that takes arguments. Refusals worded for a person, such as an open gizmo or a
selected object, carry a hint naming the call that gets past them, and an index too large for the app or written
as 2.0 is no longer misread as another object, plate or instance.

* Show what each command does when tool_search lists a group

Agents listing the Design tab's commands, or any other group, got bare names and had to look each one up to
choose. tool_search {group} now gives each command's first sentence and, in Design, its heading, in the order
the description's index uses. action_search names the Speed Dial's sections section rather than group, so they
are no longer mistaken for tool_search's groups, and a wrong section is refused with the sections there are
instead of returning nothing.

* Give agents a manual for any MCP command with tool_describe

An agent could read a command's arguments only as raw JSON Schema, with its conditional rules left to decode and
no word on where an object index or a face id comes from. tool_describe now gives any command's manual, listed or
not: every parameter at every depth with its allowed values, ranges and defaults, the schema's rules as sentences,
the Speed Dial items that run it with their arguments, its examples, and which tool lists a value the schema can't.

* List the commands tools/list leaves out with tool_list, in place of tool_search

tool_search matched words, so an agent that asked for a goal such as "add a brim" or "round the edges"
got unrelated commands. Agents now read tool_list, which lists the Design tab's commands, the menu items
that take no arguments and the plugins' operations with what each does, and a call refused for its
arguments names the tool_describe call that gives that command's parameters.

* Document how agents find and read commands with tool_list and tool_describe

* List the Speed Dial's actions with action_list, in place of action_search

action_search ranked actions by matching an agent's words, so an action named differently from the request
was missed. action_list lists them by section and title for the agent to choose from, as tool_list does
for commands.

* Browse the Python API a module at a time with script_list_api and script_describe_api

script_search_api ranked the API by an agent's words, so a goal phrased in other words found the wrong entries.
Agents now list what a module or class holds with script_list_api and read one entry's whole documentation
with script_describe_api.

* Browse settings by page with settings_list_pages, and read them by key

settings_get and preferences_get matched an agent's words, so a goal such as "add a brim" found the wrong
settings. Agents now list a settings tab's pages and groups with settings_list_pages, read a page's settings
and what each does with settings_list, and read named settings with settings_get and preferences by tab
with preferences_get.

* Pass clang-tidy on the MCP list tools and drop the docs' last search wording

* Point tool_describe's manuals to more values' sources, and keep plugin rules

An agent reading a manual now learns where a filament's purge mode, a calibration's shaper type, a
hole's point, printer_install's models and dialog_answer's dialog come from, and sees that a plugin
operation can reach outside the app. What a plugin's schema says that the manual can't show, such as a
required argument with no property, now comes with the raw schema, and a schema that takes any argument
says so instead of looking like one that takes none.

* Say in tool_describe's manuals which objects take keys they don't list

Every object in a manual now says whether it takes keys besides its properties, at any depth, as the top
level already did. A plugin schema whose properties can't be read now comes with the raw schema instead of
looking like one that takes no arguments.

* Keep tool_describe from calling an object open when a plugin schema may close it

A plugin schema can close an object through a keyword the manual keeps raw, such as allOf. The manual
then no longer says the object, or the call, takes other keys, and leaves the attached schema to say
what it accepts.

* Say in the MCP design doc exactly what a manual leaves out for a raw schema

* Say where tool_describe keeps a schema part it cannot show

* Tell agents in the server instructions how to find what to call

An agent connecting to the MCP server now reads, right after the workflow, how each catalog is found
by listing: commands place by place and the rest through tool_list, a command's manual before calling
it through tool_call, settings by page, Speed Dial actions by section and the Python API by module.

* Tell agents which catalog filters are optional and that values_from may name several tools

* Say in the server instructions that values_from belongs to a parameter

* Keep MCP replies short and free of float noise

Agents now read an object's position as 60.001 rather than 60.001007080078125, and a Design
command's zero as 0 rather than 4.4e-16, without the wrapper and ok flag that said nothing; a
client that computes with the numbers can still ask for them whole. object_list gives a short row
per object unless asked for detail, so a plate of a hundred objects fits a client's reply limit,
and app_log returns 50 lines by default.

* Shrink the MCP tool list

Agents load less text before their first call: the object and part id guards are explained once
in the server instructions instead of in every schema that takes one, and each tool's title is
sent once.

* Mark names as code in the MCP tool descriptions

Agents can tell an argument or a reply field from an English word in every tool description. The
server instructions say what the Speed Dial is, a call held by a dialog says how to run it without
asking next time, and object_add_text and object_add_svg say what they reply.

* Shorten the longest MCP tool descriptions

The ten largest definitions in the tool list repeated much of what their parameters already say. They now
say it once, taking about 4.9 KB off the tool list an agent reads at the start of every session, with
nothing they described left out.

* Let MCP commands name objects, parts and instances by id

An agent that read an object's id in object_list could only pass it as a guard beside the index, and the index moves
whenever objects are deleted, split or reordered; an id passed as an index was refused without saying what it was.
Every command that names an object, a part or an instance now takes its index or its id, both together still a
guard, and object_list gives each instance's id too. An id given as an index is refused with what that id names, and
recorded replays keep naming targets by index, so they still run in a new session.

* Fix the CI failures from the first build and test run of the MCP branch

The Flatpak build failed to compile the MCP bridge, clang-tidy flagged four missing
includes, and several new tests failed only on CI: plugin and script tests on Windows
runners with a non-UTF-8 code page, and two tests that raced on slower machines.

* Give a polygon drawn on the axes the same constraints on every platform

A square drawn on the axes through sketch_draw was locked level on x64 but could be
left free to rotate on arm64, so its constraints and degrees of freedom depended on
the CPU, and the test of them failed on macOS arm64 and Windows arm64. A polygon's
side that lies on an axis is now pinned Horizontal or Vertical on every platform, as
the Polygon tool pins it, so such a square has all four sides pinned.

* Fix two unit tests that failed at random on CI

The plugin-unload test of the automation suite and the in-flight tool call
test of the Python script runner each failed now and then on a busy runner,
macOS arm64 and Linux aarch64 in the last run, with nothing wrong in the app.
Both pass however the runner schedules their threads.

* Fix the Flatpak unit-test jobs failing on the page agent test

Both Flatpak unit-test jobs failed one test, which reads the MCP server's
page agent script, because the script was missing from the test bundle those
jobs run from. The bundle carries it, so the jobs run that test as the other
platforms' jobs do.

* Warn in Action Replay when a step can run a program

A replay someone sends you can hold a Python script or set a post-processing
script, and either runs a program on your computer when the replay plays. The
window listed those steps with no warning. They carry a "Can run a program"
tag, as a step that writes a file or sends to a printer carries its own, and a
step that makes its call through tool_call shows the tags of that call.

* Stop a calibration when its save prompt is cancelled

Choosing Cancel when a calibration asked to save the open project still
created the calibration on top of that project, so the project's pauses and
color changes ended up in the calibration's G-code. Only the flow rate tests
stopped. Cancel leaves the project as it was for every calibration.

* Warn in Action Replay when a step replaces a post-processing script

A replay could swap one of your post-processing scripts for its own by
setting a single entry of the list, and the step showed no warning. It now
carries the "Can run a program" tag, as setting the whole list does.

* Add the Agent Activity pane

A new pane, opened from View > Agent Activity or the Speed Dial, lists live what an AI agent and other
automation (Action Replay, Run Script, the command line, plugins) do in OrcaSlicer while it is open: each
call with its source, what it changed, failures with their reason, the steps of a run and the dialogs a
rule answered. Opening a call shows its request and response with passwords, keys and typed text masked,
so a person can watch and check what an agent is doing to their project.

* Fix the clang-tidy check failing on the Agent Activity test

* Fix sweep tests failing with a current_path error in a shared app

When the test that launched a job's app passed, the sweep deleted that test's folder while the app was still
running in it. Later tests in that app then failed on the first preset reload with "boost::filesystem::current_path:
No such file or directory", as test_printers, test_settings and test_speed_dial_open did. The job's app now runs in
a folder of the job's own.

The settings reads now place a printer's extruder settings on its Extruder page on every printer. After a printer
with several extruders, they could put a setting on a page such as "Extruder 3" that the selected printer does not
have, and leave it out of the page it is on, which made test_presets fail when it ran after test_printers.

The sweep can also run every app on a private Xvfb display with --xvfb, for a machine without a desktop, and with
--headless or --xvfb the tests that start their own apps stay off the desktop too. Where Openbox is installed, Xvfb
runs it as the window manager, so drop-down lists and popups stay open as on a desktop and the whole sweep passes
there. Apps launched side by side each get a display of their own, and test_slice_preview no longer fails where the
3D view draws slowly, as on Xvfb.

A test that fails beside the others and then passes alone no longer runs alone in every later sweep: each sweep
runs it among the others again, so a failure that returns is seen, and --forget, which undid that, is gone. Only
the tests sweep.json marks exclusive run alone from the start.

* Stop the Speed Dial offering settings of extruders the printer lacks

After a printer with several extruders, selecting one with fewer left the extra extruders' settings in the Speed
Dial and the settings search, such as Retraction Length under Extruder 3 on a single-extruder printer. They now
list only the extruders the selected printer has.

* Report a dialog closed when an answer ends it on a busy machine

On a busy machine, dialog_answer could reply without closed: true for a dialog its answer ended, such as a web
dialog cancelled while its page was still busy, although the dialog closed a moment later. An agent was then told
the dialog was still open. The reply now says closed for every dialog an answer ends, message boxes included,
however busy the app is.

* Organize the MCP tool code by place and the Design commands by heading

Each place an agent finds commands under (Objects, Plates, View and windows and so on) now has one source file
under Mcp/Tools/, and the Design tab's commands have one file per Design heading, so a developer finds a command
where tool_list lists it and adds a new one beside its neighbours. A unit test fails when a command is added in
another place's file. No change to what agents or people see: the command catalog is byte-identical.

* Run the MCP sweep in CI on the Linux AppImage

Every Build all run now drives the x86_64 Linux AppImage it built through
all the MCP sweep tests on Xvfb with Openbox. When a test fails, its logs are
uploaded with the run.

* Fix the MCP sweep tests that fail on a CI runner

test_run_sweep failed on a machine with no X display, and test_gizmos failed
where the desktop's UI font is as wide as Ubuntu's default, DejaVu Sans. The CI
job summary also lists every failed run of a test, its run alone included.

* Name the Design commands by their place, like the other MCP tools

Thirty-four Design commands were bare verbs (extrude, fillet, measure), so an
agent could not tell from a name where a command acts or find a place's
commands together. Every Design command now starts with its place: design_,
sketch_, solid_, surface_, construct_, body_ or feature_. Replacing objects when
committing a design to the plate deletes them as Prepare's Delete does, and the
guide to making a feature reachable covers Design commands.

* Fix the Speed Dial and other web pages sometimes freezing on Windows

Opening the Speed Dial occasionally left it, the Home page and every other
web page in OrcaSlicer unresponsive, with one CPU core kept busy, until the
app was restarted. The Flushing volumes dialog and the printer camera view
no longer risk the same freeze. The Speed Dial's search field still takes
the keyboard focus on every open, and the Flushing volumes dialog still
falls back to English text when a translation cannot be shown.

* Show the app's message when a Speed Dial pick in the MCP sweep gets no answer

A sweep test whose Speed Dial pick got no answer from the dial's page failed with only
"last seen None". It now fails with the app's own message, such as "The page did not
answer within 30 s".

* List long widget labels whole and keep each MCP fact in one place

widget_list cut a widget's label at 120 bytes, so a long path or tooltip came back truncated, and a test that
read it back failed on a machine with a longer folder; labels now come back whole. Adding or renaming a command
or a sweep test no longer means updating hand-kept lists, copied test helpers or the same text in several docs,
and the runner's own test now fails when a sweep test has no entry in the index.

* Make the MCP server doc an architecture overview

The server doc walked through every command, repeating what the tool reference and each command's own description already say. It now covers the components, how they fit together and the design rules every command follows, and points to the tool reference for what each command does. Caller-facing facts that only the server doc held are now in the tool reference.

* Make calls say whether they ask, and show Prepare after an agent's new project

Calls into the plater, object list and tabs now say in words whether they ask a
person or run without prompts, instead of passing bare true/false flags. An
agent's project_new now does what New Project does: it shows the Prepare tab and
tells plugins about the new project.

* Ask before a plugin calls OrcaSlicer's tools

Any plugin could call OrcaSlicer's tools through orca.host.tools without a permission, so it could change your project, run post-processing scripts and answer permission prompts. It now needs the OrcaSlicer tools permission or full access, which it can declare as it loads or is asked for the first time it calls, like its other permissions. The Plugins dialog's Permissions tab has a switch for it, and turning it off ends what the plugin's calls left in force.

* fix test_cad_commands

* Fix the camera view teardown test crashing

The Web media controller teardown test crashed because running a page script read the app's
settings before checking for a page. Running a script on a web view with no page now does
nothing on every platform.
2026-11-26 11:31:45 +08:00
TheLegendTubaGuy 755459931e Number IDEX/IQEX tools from 1 like the sidebar (#16959) 2026-11-25 19:28:37 -06:00
SoftFever 4723f694ca Merge branch 'main' into feature/mcp 2026-11-26 03:39:47 +08:00
Martin Stachon 808dd7dff8 Fix OBJ import on macOS 13.3 to 14.0 when the UI language uses a decimal comma (#17851)
On macOS 13.3 to 14.0, Apple's `strtod` reads the process locale and ignores the thread locale that `CNumericLocalesSetter` sets. With a UI language that uses a decimal comma, every OBJ vertex with a decimal point was rejected and the import failed. `objparser.cpp` now reads numbers with the new `strtod_decimal_point()` in `LocalesUtils`, which parses with fast_float and doesn't depend on the locale.
2026-11-25 10:14:39 -06:00
Kris Austin 71a1f4f6f2 Load startup plugins after the presets are loaded (#17873)
* Load startup plugins after the presets are loaded

The startup plugin loads ran on the load thread while the main thread
was still starting the network and had not loaded the presets yet. A
plugin that reads the presets while it registers, such as through
full_config_value(), reached PresetBundle::full_fff_config() while
filament_presets was still empty and crashed reading filament_presets[0].
A plugin that got there a little later read the presets while
load_presets() was rebuilding them.

Start the startup loads after load_current_presets(). A printer agent
that a plugin registers after that point is already installed by the
late registration path.

Fixes #17792

* Build the full config of a bundle whose presets are not loaded yet

A new PresetBundle has no filament_presets until load_presets() runs,
and full_fff_config() read filament_presets[0] anyway, which crashed any
caller that asked for the full config before the presets loaded. Treat
such a bundle as having one filament, the edited filament preset.
2026-11-25 14:18:45 +08:00
Kris Austin 38f12b1357 Keep a filament's compatible printers when a project loads its edits (#17770)
A project doesn't save a filament's compatible_printers or compatible_prints. When a project with an edited filament preset was opened again, both lists came in empty and the preset's compatible printers reset to All.

load_external_preset now leaves the two keys alone when it applies a project filament over an existing preset. When a later filament slot becomes a new "Name(file.3mf)" preset, that preset copies the lists from the preset the project names.

The test covers the first slot over the named preset and over the inherited parent, and a later slot over an embedded preset and as a new copy.
2026-11-24 12:27:08 -06:00
SoftFever 18eb4f8459 Organize the MCP tool code by place and the Design commands by heading
Each place an agent finds commands under (Objects, Plates, View and windows and so on) now has one source file
under Mcp/Tools/, and the Design tab's commands have one file per Design heading, so a developer finds a command
where tool_list lists it and adds a new one beside its neighbours. A unit test fails when a command is added in
another place's file. No change to what agents or people see: the command catalog is byte-identical.
2026-11-24 23:50:10 +08:00
Noisyfox 821b602c4d Keep height ranges and per-feature filament assignments on their mixed slots (#17729)
Adding a physical filament inserts it ahead of the mixed filaments. Height ranges and the per-feature filament settings (outer and inner walls, sparse and internal solid infill, top and bottom surfaces) kept their old slot numbers, so an assignment to a mix printed with the new physical filament instead.

Shift those assignments with the mixes when a filament is added, and move them with the deleted or merged slot when a filament is removed. This covers the process preset, objects, parts, modifiers and height ranges. Inherited (Default) assignments are unchanged.

When a published 3MF import moves mixed filaments, imported parts and published process settings follow the author's slot moves, and process settings kept from the receiver follow the receiver's own mixes. A receiver mix that moved no longer redirects the author's references to the physical filament in that slot.

Fixes #17727
2026-11-23 15:56:49 -06:00
yw4zandNoisyfox 074be951e5 Fix: Instances move when a part is added, and assembly view poses break for copies and part changes (#17617)
* init

* fix assembly

* fix text instances and storing rotated items on assembly

* unposed source as new object

* simplify comments

* update text object

* fix object looses positioning after deleting volumes

* fix scale properties not used for instances on assembly view

* fix undo history for scale not reflected to assembly view

* apply exact scaling to assembly view for fixing skewed scalings

* fix cant create proper instances from skewed objects

* Preserve assembly poses when splitting an object into parts

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
2026-11-23 23:03:36 +03:00
Damir Galeev aefb6b3d66 Precise Seam: intersect modifiers with the model surface, not the perimeter centerline (#17557)
* Precise Seam: intersect modifiers with the model surface, not the perimeter centerline

A modifier acted where it crossed the centerline of the printed perimeter, which
lies about half a line width inside the model surface and deeper at corners. It
now acts where it crosses the model surface.

- The surface is reconstructed from the centerline by a shift of half the
  external perimeter width less the XY compensation and a 5 um margin, clipped
  against the modifier and carried back onto the centerline.
- On elephant foot layers and with Arachne the shift is measured against the
  layer's islands.
- With fuzzy skin the perimeter generator keeps the centerline before texturing
  (ExtrusionLoop::untextured); modifiers are evaluated on it and the points are
  carried onto the noisy loop.
- Open extrusions are left out of Precise Seam.
- The "had no effect" warning no longer names the centerline.

See docs/HLSD/precise-seam.md.

* Precise Seam: fuzzy skin window per loop kind; no negative search reach

The transfer window of a fuzzy skin loop counted every region with fuzzy
skin on the layer, including those that do not texture its kind (a Hole
region for contours, an External one for holes). FuzzySkin.cpp skips such
regions, so mixed settings widened the transfer search and the weak zone
order check. The window is now computed for contours and holes separately
from the regions should_fuzzify() selects, as a function in
PreciseSeamInternal.hpp with a unit test.

The modifier prefilter of the measured shift no longer takes a negative
reach: a compensation beyond the whole wall depth leaves no shift.

* Precise Seam: shift narrow classic loops by their own line; keep the warning translations

Without thin wall detection the classic generator prints an island too narrow for
two lines with a thinner line and insets the loop by half of that width, while the
surface shift used the region's external perimeter width. The reconstructed
surface lay 0.055 x spacing - 5 um outside the model, more than the margin, so a
modifier flush against the face acted on such loops. The shift of a classic loop
now comes from the width of its own external perimeter path; Arachne loops are
measured as before.

The two "had no effect on the seam" messages lost their bracketed part, and the
catalogs dropped the old entries without getting the new ones. The entries are
back under the new msgids with the existing translations, trimmed of the
bracketed part.

* Precise Seam: keep the aligned seam inside an Enforced modifier zone

A loop with an Enforced zone in effect now has exact ends: alignment no longer
moves the seam up to 0.2 mm past a zone boundary, and Random does not sample
the edge leaving the zone.

* Precise Seam: test both ends of an Enforced zone in alignment

The regression test for the aligned seam leaving an Enforced modifier zone
ran on the right face only, where the stepping end of the zone is the last
candidate of the Enforced run. It now also runs on the left face, where the
same end is the first candidate, so both directions of the allowed arc are
checked.

The HLSD notes that a zone reduced to a single candidate holds the aligned
seam on it, so alignment cannot smooth its shift between layers.
2026-11-23 18:32:08 +08:00
SoftFever df459143cc Merge branch 'main' into feature/mcp 2026-11-23 13:29:29 +08:00
Arthur Porto 6d563f72c2 Keep arranged objects clear of a compacted prime tower (#17304)
With "No sparse layers" on, Arrange and Fill bed keep objects as far from the compacted prime tower as the slicer's clearance check needs. Objects stay the toolhead radius away, or 4 mm when none of the objects being placed is taller than nozzle_height. Objects taller than the rod clearance are also kept out of the tower's Y span, and the final alignment of the pile is skipped in that case. Placing a newly added object keeps the full toolhead radius.

With the option off, arranging is unchanged.

Fixes #17566
2026-11-22 16:43:49 -06:00
HanifKoh 65a350a0ce Stop Print Plate Aborting When a Multi-Nozzle Printer Has No Physical Extruder Map (#17664)
A multi-nozzle printer whose profile never sets physical_extruder_map, such as the Snapmaker U1, carries the single-entry default {0}. PartPlate::get_physical_extruder_by_filament_id indexed it by logical extruder, so Print plate read past its end for any plate that used filament 2 or later, and the Flatpak aborted there.

PartPlate's lookup, the printer sync in Plater and the three calibration setups in CalibUtils now read the map through effective_physical_extruder_map. It returns the profile's map when its length matches the nozzle count and the identity otherwise, so printers that ship a full map get the same values as before. The helper moves unchanged from IMEXHelpers to PrintConfig and PresetBundle, and its tests move to test_config.cpp. The G-code paths are unchanged.
2026-11-21 09:21:15 -06:00
Warren GreenandClaude Opus 5.5 1174b39004 Speed up slicing without changing the G-code of a fresh slice (#17335)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 10:59:12 -03:00
SoftFever 867ba9b005 Merge branch 'main' into feature/mcp 2026-11-21 18:57:39 +08:00
TheLegendTubaGuy 49b84637ee Fix Stack Overflow When Nesting Clipper2 Results With Cyclic Splits (#17592)
Backport PolyClipping/Clipper2 f97d65d. CheckSplitOwner descended into an
emptied OutRec's splits without the recursive_split guard, so emptied
OutRecs that referred to each other recursed until the stack overflowed.

Fixes #17584
2026-11-20 22:07:36 -06:00
Rodrigo Faselli cdd695117f Fix cone seam pcurve selection in OCCT (#17720)
Since the OCCT 8.0.1 update, some STEP files imported with cone faces missing. OCCT told the two seam pcurves of a cone apart with a 1e-7 threshold, which fails when the neighboring pcurves end slightly past the seam. The OCCT patch now picks the closer pcurve. The #16290 fix is kept.

Also stops admesh from merging unrelated edges of open meshes from STEP and SVG import on ARM64. A mesh built in memory reaches the nearby check with a tolerance of 0, and dividing by it was undefined. The check now returns early, which is what x86-64 already did.
2026-11-20 16:05:58 -06:00
SoftFever f12b73014f Thread bores reliably wherever the part sits on the bed
In the Design tab, threading a bore could fail with "thread removed no material" depending only on
where the part sat: an M5 standoff at the centre of a 250 x 250 mm bed could not be tapped, while the
same part a few millimetres away could, and some blind holes could not be tapped anywhere. Threads now
cut into through and blind holes alike, at any position.
2026-11-20 15:14:11 +08:00
Lam Wei Lun 1de01873ae Fix mouse ear brim missing at a rounded corner depending on object orientation (#17163)
Mouse ear placement no longer depends on where the outline starts. The old code simplified the outline with Douglas-Peucker, which is anchored on its first vertex, so rotating a part changed which rounded corners got an ear.

make_brim_ear_points() now measures the turn at each vertex over a window of arc length on both sides, and doubles the window while the outline keeps turning. Corners with large fillets now get an ear at the default settings. A candidate whose window already reached a placed ear is dropped, so a sharp corner next to a curve gets one ear. The Brim Ears tool's Auto-generate uses the same function.

Behavior change: a smooth closed outline such as a disc gets no ears at the default 125 degree max angle. Raising the max angle to 135 or more still gives it ears.

Fixes #17119
2026-11-19 08:01:51 -06:00
yw4z c51687243f Fix plate skirt start point not saved to 3mf (#17457)
Save and load the plate's skirt start angle in the project file. Before this, a skirt start point set in Plate Settings was lost on save. Adds a round-trip check to the plate test in test_3mf.cpp.
2026-11-19 07:52:31 -06:00
HanifKoh 4aaef535e6 Skip Arachne Toolpaths When the Voronoi Diagram Cannot Be Repaired (#17600)
* Skip Arachne Toolpaths When the Voronoi Diagram Cannot Be Repaired

When the Voronoi repair fails, the skeletal graph built from the
diagram has edges without twins, and the later stages dereference
them. Leave the graph empty and log an error instead, so that outline
gets no toolpaths rather than crashing the slice.

* Cast the Far Sliver Coordinates to `coord_t` in the Unrepairable Voronoi Test

On macOS int64_t is long long, so a literal of type long matched no Point constructor exactly and the call was ambiguous.
2026-11-18 14:04:54 +08:00
HanifKoh 8ebb0a9a2b Stop Arachne's Outline Simplification From Placing Vertices Metres Away (#17599)
simplify() may move a vertex to the intersection of its neighbouring
lines, guarded by a check that the point stays near them. The check
squared the distance in int64, which overflows when nearly parallel
lines meet more than about 3 m away, so the far point was accepted.
The broken outline gave a Voronoi diagram the repair could not fix,
and SkeletalTrapezoidation then dereferenced an edge without a twin.

Compute the squared distances in double.
2026-11-18 12:58:45 +08:00
Kris Austin 428a8fcc91 Arrange items almost as wide as the bed again (#17416)
* Arrange items almost as wide as the bed again

An arrange spacing lets a rectangular bed grow by the part of the spacing
past every item's brim or tree support, the way printing by object
already grows it. The spacing is kept in full and a part that fits the
bed is not refused for it. The bed does not grow when an item that can
be placed would keep less inflation than the growth, beyond the EPSILON
slack, so a part that fills the bed may sit up to EPSILON past its edge,
within BuildVolume::BedEpsilon. A round bed never grows for a spacing,
since moving its points along each axis would grow it unevenly.

The cap on an item's inflation measures the item as the nester packs it,
inflated with square joins and turned, so it holds for an item turned to
the Y axis or by hand, and it leaves room for the skirt. An item too big
for the bed keeps its full inflation, so it is still refused on a grown
bed, and it no longer sets the bed margin given back to the other items.
Printing by object, this keeps the 5 mm margin for the placed objects
when another one is refused.

The arrange bed keeps EPSILON on each side of the largest item for every
print sequence, since the nester cannot place an item beside one that
fills the bed exactly.

The skirt room reads a percent first layer line width against the
nozzle diameter instead of as millimeters, and accepts a width stored as
a plain number.

update_arrange_items() runs the arrange setup in the order it depends on
for the arrange job and the CLI.

* Arrange items the nester has to turn

With rotations allowed the nester turns an item that does not fit as it
lies, even onto the bed's diagonal, so no item counts as too big. An item
that has to turn is measured at an angle where it fits along the bed's
axes, if there is one, so it keeps its spacing.
2026-11-17 22:07:31 -06:00
Ian Bassi e76b4d676c Split smoothed infill corners no finer than 5 microns (#17630) 2026-11-17 09:54:18 -03:00
Ian Bassi 745207d3e3 Choose the filament each calibration prints with (#17621) 2026-11-17 08:36:13 -03:00
Kiss Lorand 32f6db87e8 Fix validation of legacy bed exclusion areas (#17618) 2026-11-17 10:20:41 +08:00
Kiss Lorand 9cdaaedad7 Fix Measure geometry after nonuniform scaling (#17549) 2026-11-16 18:35:55 -03:00
SoftFever 81b93dd687 Rename and regroup the Design tab's MCP commands, and add the missing ones
The Design commands follow Fusion 360's names and grouping: one command per
job, with a `type` argument for its variants, so 133 commands become 88. An
old name or argument is refused. What the tab could do and no command
reached now has one: re-opening a committed sketch, selecting geometry,
confirming or cancelling an open tool, placing a body, sketch patterns and
dimensions, and text, SVG art and projected edges from arguments.

Ten defects in the Design tab's cards and sketch tools found on the way are
fixed. For a person: the Mirror tool binds a mirrored line or arc to its
source, Commit to Plate and Export STEP stop when the open card's Confirm
fails, and the Speed Dial keeps a query typed before its list arrives.
2026-11-16 19:50:08 +08:00
HanifKoh 59acdedd06 Keep Heavy Boost and Plugin Headers Out of Widely Included Headers (#17494)
* Keep Heavy Boost and Plugin Headers Out of Widely Included Headers

Several headers that most of the code includes pulled in large libraries they barely use, so hundreds of files compiled them for nothing:

- Point.hpp, Line.hpp, Polygon.hpp and ExPolygon.hpp included all of Boost.Polygon to declare traits. Point and Line now include only the concept headers they need, and the polygon traits move to BoostPolygonTraits.hpp, included by BridgeDetector.cpp, the one file that runs Boost.Polygon algorithms on polygons.
- ProjectTask.hpp included Boost.Thread and the filesystem streams but only uses boost::filesystem::path.
- Utils.hpp included Boost.DateTime for one inline function, which moves to utils.cpp.
- Semver.hpp used boost::format for two version strings; std::to_string prints the same.
- MainFrame.hpp held PluginPages by value, which brought in the web view and plugin headers; it now holds it by unique_ptr.
- Model.hpp included STEP.hpp, and with it OpenCASCADE, for a forward-declarable type and two typedefs.

Files that relied on these headers arriving indirectly now include what they use.

* Include What the Polygon Traits and the End-Time Helper Use

* Drop Two Unneeded Includes and Include the Filesystem Directory Header
2026-11-16 19:30:35 +08:00
SoftFever e40a8a7ed5 Merge branch 'main' into feature/mcp 2026-11-15 01:01:57 +08:00
Kris Austin 9921437c27 Fail tests whose sections assert nothing (#17420)
tests/CATCH2.md says to run the suites with `--order rand --warn
NoAssertions`. On main that fails in fff_print (8 test cases), libslic3r
(15), sla_print (1) and slic3rutils (4), even when each case runs alone.
ctest never passed the flag, so nothing stopped new ones. Most of these
tests have SECTIONs that only set up state, with the assertions after
them, or generated cases that return early for combinations that don't
apply. Catch2 counts assertions per section, so each of those reads as
an empty test.

Where only a value or a short setup changes, use GENERATE or a table and
generate only the combinations that apply. Elsewhere, end each section
with a call to a local check. ctest now passes `--warn NoAssertions`, so
CI fails a case or section that asserts nothing, and tests/AGENTS.md
says so. ctest also passes the CATCH_EXTRA_ARGS cache variable, which
nothing read before, split like a command line, so setting it now takes
effect.

Three tests only wrote a debug mesh or diagram and asserted nothing.
They now check that the Voronoi diagram of the six points is complete,
that hollowing with hfRemoveInsideTriangles removes at least half of the
roughly 400 mm² of the two spheres that lies deeper than the wall, and
that the half cone is closed. The legacy 3MF scenario checked for a
volume map on every plate of a file that has none, so it now also saves
and loads a project with a plate, and its name says so.
2026-11-14 10:47:42 -06:00
Kris Austin bf1fb93b78 Use WebKit's Shared-Memory Transport on Wayland Outside the Flatpak (#17399)
* Use WebKit's shared-memory transport on Wayland outside the Flatpak

In a Wayland session, the hardware DMABUF path of Ubuntu's WebKitGTK 2.52
on Intel GPUs froze the Preview, Device and Project tabs and left the 3D
view drawn over other pages. On the default path of a build with EGL,
outside the Flatpak, set WEBKIT_DMABUF_RENDERER_FORCE_SHM=1, as Orca
already does for NVIDIA and virtual machines, so compositing stays on.
WebKitGTK 2.42 and 2.43 have the DMABUF renderer but ignore that switch,
so they get WEBKIT_DISABLE_COMPOSITING_MODE=1 instead. The Flatpak's
runtime WebKitGTK works, so it keeps the hardware path.

A Wayland session is detected by wayland_socket_available(), which looks
for the socket the way wl_display_connect(NULL) does. The no-EGL fallback
and the GUI start-up check use it too, so all three agree with GTK.
is_running_in_flatpak() checks only /.flatpak-info, because a host process
started from a Flatpak can inherit FLATPAK_ID; the data-dir migration and
the Troubleshoot dialog now use it. Both helpers live in libslic3r/Utils
and have unit tests.

Fixes #17381

* Note that Debian's WebKitGTK 2.54 on AMD freezes too
2026-11-14 10:46:49 -06:00
SoftFever fece418ae0 Make the automation runtime its own subsystem, with MCP as one front end
Everything that drives OrcaSlicer by command (the dispatch of the command
catalog, jobs, the journal, replays, Python scripts, recordings) lived
inside the MCP server's service class. So Action Replay, the Run Script
panel, a plugin's tool call, a person's recording and a run from the
command line each had to start "the MCP service", with all of its GUI
hooks, although none of them needs a server or an agent.

The automation runtime is now a subsystem of its own. It starts the first
time a front end asks for it and knows none of them. The MCP endpoint
(HTTP, the protocol, the token, the discovery file, the takeover of a port
another window holds) is one front end beside the others, opened and
closed without stopping what the others run. The widget inspector, menu
capture and ImGui item recording are turned on only by a front end that
drives the GUI, so a person's recording or long command does not carry
them.

The part of the runtime that needs no GUI is the library
libslic3r_automation, built without wxWidgets and tested by its own suite,
automation_tests. A wx dependency in it fails to build, and its tests no
longer link the GUI library or the embedded Python.

The command line has one option set for this: --run FILE runs a replay or
a Python script once the GUI is ready, with --outputdir for its files, and
--unrestricted-scripts and --cad turn their settings on for one run
without saving them. --mcp-run, --mcp-run-out and --mcp-token are gone;
the scripts setting is python_scripts_unrestricted and a session's output
folder is <datadir>/automation/out. get_app_state reports ready and
version at the top level, and its mcp block describes the endpoint only.

No change to slicing output.
2026-11-14 23:41:01 +08:00
SoftFever 822775179b Merge branch 'main' into feature/mcp 2026-11-14 01:05:25 +08:00
HanifKoh 71c9f556f0 Fix the Crash When Editing an Object's Speed on a Printer Without a Matching Variant (#17529)
A process whose print_extruder_variant has no entry for the printer's extruder type and nozzle volume (a Bowden
printer with a "Direct Drive Standard" process, or a bare "Bowden" variant) made Tab::switch_excluder return
before it mapped the page's variant fields. Editing a per-variant option on the Objects tab then read the end of
that empty map in TabPrintModel::on_value_change and crashed with std::bad_alloc.

switch_excluder now falls back to the extruder's first variant through find_variant_index, as slicing does,
and logs it; get_index_for_extruder keeps returning -1 for its other callers. on_value_change checks the map
lookup and otherwise takes the index from the field id.
2026-11-13 16:00:08 +08:00
SoftFever 0616068e26 Run commands, tools and the plugin API through one operations layer
A Speed Dial command, the MCP tool that does the same thing and the plugin
API's preset calls now run one shared operation, so every route accepts and
refuses the same states, with one wording and a code for each refusal. An
import by a command or a tool is one undo step, and import_file adds geometry
only.

The cases where two routes behaved differently now behave the same: a project
is not saved under a .gcode.3mf name, an empty project exports as .3mf but not
as STL, arrange runs from any view and with a gizmo open, a mixed-colour
filament slot is refused as one, a hidden preset is shown before it is
selected, and a layer is refused while the Preview has none.
2026-11-12 22:06:10 +08:00
Ian Bassi db9968b9ee Painted modifiers (#16213) 2026-11-12 10:38:03 -03:00
Rodrigo Faselli 0291395132 Place Separate Objects Side by Side in the Assembly View (#17386) 2026-11-11 19:32:58 -03:00
Ian Bassiandraistlin7447 34de2b49df Copy per-nozzle settings to every tool of a toolchanger, and choose which unsaved changes to keep (#17461)
Co-authored-by: raistlin7447 <kris.austin@gmail.com>
2026-11-11 19:18:28 -03:00
Arthur Porto 32dbacb423 Variable layer height on several objects, and with the prime tower on objects of different heights (#16462)
* Variable layer height on several objects, and with the prime tower on objects of different heights

The variable layer height tool now opens with several objects selected.
Adaptive, Smooth, Reset and manual edits apply to all of them: they share one
profile, the finest layer height any of them asks for at each Z, unless
"Each object separately" is ticked. Every selected object is painted with
its layer heights. With a profile each, up to three objects get a bar of
their own, drawn to one scale, and the bar under the mouse is the one edited.

The prime tower check compares the layers objects are sliced at over the
height they share, rather than the raw profiles, which never matched once the
profile of a lower object ended at its own top. Precise Z height, which fits
the last layers of each object to its own height, is left out of such a
print, with a warning.

* Check the prime tower layers on the sliced objects, and note the new strings for translators

* Include what the new tests use

* Compare the layers as sliced, before the prime tower is generated from them

* Check that precise Z height stays on without a prime tower

* Keep each object's layer height texture on the GPU, and mark only lower tops

The variable layer height tool sent a 1024x1024 texture to the GPU for every
selected object on every frame, and set_config(), run after every edit,
dropped the other objects' textures so that each was generated again.

Each other object now has a texture of its own on the GPU. It is generated
and sent only when its profile, its height or the slicing parameters it shows
change, which set_config() now only asks to check. The object shown sends its
texture only when it is generated, and while the objects share one profile,
those on its layers are drawn with its texture and need none of their own.
The textures of objects no longer selected are freed.

The bars and the layer height curves are built again only when what they
show changes, and each bar is scaled with its own object's layer heights.

A lower object's top is marked only when it is lower than the object shown,
objects ending at the same height share one label, and a label stays on the
canvas and below the one above it.

The comment on precise_z_height_overridden() now says what the override
trades: the tower can join the off-grid layers to the tower layer below, but
a joined layer holds two purges, which makes the tower deeper.

* Fix the precise Z warning, shared profiles across first layers and the bar clicked

- The precise Z override, and its warning, now need an object with precise
  Z height on. Every plate with a prime tower and variable layer height on
  objects of different heights warned about a setting that is off by
  default.
- The objects the override slices again get their slicing parameters back
  at once, since validate() reads them before slicing.
- When the objects share one profile, an object that starts its layers
  elsewhere than the object shown, with a raft of its own say, keeps its
  own. The shared profile starts with the first layer of the object shown,
  and PrintObject::update_layer_height_profile() dropped it on such an
  object, which then printed at the preset layer height.
- Clicking a bar edits its object, even when no frame was drawn since the
  mouse got there.
- Select all is ignored while a profile is painted, and select all plates
  while the tool is open.
- The bars' models are made again, not copied, when their number changes:
  a copy shares the GPU buffers that the original deletes.
- Objects with no height above the bed are left out of the tool, and a
  profile fitted within EPSILON above one of its entries no longer runs
  past it.

* Keep the object top labels below the toolbar row

When the toolbar row ends next to the bar, the label of an object that
ends near the top of the tallest one covered the toolbar's last buttons.
Such a label now starts below the row, with its arrow pointing up to the
line on the bar.

* Fill the layer height texture up to the top of the object

The last layer can end under the top of the object, by up to half a
layer, and no layer wrote the cells there. The top face is drawn with
them, so it showed what the buffer held before: black on the texture of
an object made for the first time, or the colours of another object.
The last layer now fills them, with the shade of its top.

* Draw horizontal faces without the layer stripes

A horizontal face lies at one height, so the stripes cannot show on it,
only the shade they have there. That shade changed whenever a layer
under it moved, and the tops flickered at every stroke. Such a face now
gets the plain colour of its layer height, from the 2nd level of the
texture.

That level is now read at its own level of detail instead of with a
bias. On a horizontal face the texture coordinates do not change, so the
GPU picks the 1st level however large the bias, and read it at the
coordinates of the 2nd: the tops showed black, or the colour of another
height. The 110 shader does so where GL_ARB_shader_texture_lod is
available, and keeps the stripes elsewhere.

* Include ObjectID.hpp where ObjectWithTimestamp is used

clang-tidy (misc-include-cleaner) asks for the header to be included directly.

* Find the horizontal faces with the inverse transpose of the world matrix

The variable layer height shader took the normals to world space with the world matrix itself, which is only right under a uniform scale. With a non-uniform scale it drew sloped faces as flat, and once the object was also rotated it missed real flat ones. The normals now go through the inverse transpose of the world matrix, which render_object_volumes() already built for the view normal matrix.

* Note why the precise Z override keys on has_wipe_tower()

Since #16999 the tower is printed only when slicing finds it is needed, so
the override also applies on plates where no tower is printed in the end.
2026-11-12 02:34:10 +08:00
HanifKoh d7534d7fb9 Fix the Crash When the Per-Extruder Printable Areas Do Not Overlap (#17439)
When the per-extruder printable areas only touched or did not overlap, get_shared_poly read the first polygon of an empty intersection. That crashed the CLI on the bed shape, and the GUI in scale to fit, fill bed and prime tower placement.

The shared area is now empty in that case. An area with fewer than three points leaves its extruder the whole bed. Placement (get_bed_shape with use_share, PartPlate::get_build_volume(true)) falls back to the whole bed. The prime tower's default position and drag fall back to the plate's shape. Validation now says the extruder printable areas share no common area, instead of reporting the tower as partially outside the printable area.

Profiles whose areas overlap, and profiles without areas, get the same shapes as before.
2026-11-11 08:53:37 -06:00
SoftFever f5368b0483 Merge remote-tracking branch 'origin/main' into feature/mcp 2026-11-11 19:46:07 +08:00
Lam Wei Lun 97ee8d9197 Cut: keep per-part filament colors after dovetail cut (#17322)
* Cut: keep per-part filament colors after dovetail cut

The dovetail path merged every model part of each half into one volume
built from a raw mesh, dropping per-part extruder and material overrides,
so the cut result fell back to the object-level extruder (T1).

Merge by effective slicing identity (extruder, material, per-part config)
instead, one merged volume per group, copying the representative's config
and material. Connectors and modifiers are never merged or deleted, and
single-group results keep today's single volume named after the object.

Fixes #17187

* Fix missing includes

* Cut: number extra parts and fix null material lookups

Name the extra merged parts Object_2, Object_3, ... as splitting a mesh
into parts does, instead of Object_T<extruder>, which misleads when the
parts differ by material or by a per-part setting, and whose fallback
suffix was not re-checked for uniqueness.

Move the merged mesh into the new volume instead of copying it.

add_cut_volume() dereferenced the source volume's material, but the cut
model has no material table, so cutting a part that has a material id
crashed before the merge could carry that id. Fall back to the material
id alone, and let PrintObject skip a material's region settings when the
material is missing rather than dereferencing null.

* Cut: don't replace the source material while copying it

add_cut_volume() carried the source volume's material with set_material(),
and Model::add_material(id, other) deletes the existing material before
copying from other. The source volume and the target object share the cut
model, so the second copy of the same volume (the "_A" and "_B" halves of
a groove cut) resolved that same material and replaced it with a copy of
itself after deleting it, reading freed memory. A part with a material id
segfaulted the cut before the merge could carry that id.

Copy the material's settings only when the target model has no material
of that id yet; otherwise just set the id and keep the existing one.

* Cut: carry a part's material id and merge by effective settings

The cut model holds no material settings, so add_cut_volume() only needs
the id: copying the material there could only replace the source object's
own entry, which Model::add_material() deletes before copying from it.
Drop the unused duplicate of add_cut_volume() in Model.cpp as well.

Group parts by the settings they slice with rather than by the keys they
set explicitly: a part that restates a value the object already sets now
stays with a part that leaves it implicit, instead of coming back as
Object_2.

* Model: keep a part's material when converting units

ModelObject::convert_units() rebuilt a clone detached from its model and
then called set_material() on it: the source volume's material was read
without a check, and set_material() reached add_material() through the
clone's null model. Any part with a material id crashed the conversion.

Copy the id, pointing the clone at the source model for the call so the
entry is recorded and its settings resolve after the conversion.
set_material() has no callers left, so remove it.

* Model tests: free the converted objects through a model

ModelObject's destructor is private, so the tests cannot delete the
objects convert_units() hands back. Give them to a Model, which owns
model objects and frees them.
2026-11-11 18:36:58 +08:00
TheLegendTubaGuy 9696797638 Keep Bambu LAN printers saved before printer agents in the Device tab (#17468)
Builds before 2.5.0 saved local machines without a printer_agent_id, and
DeviceManager hides and drops entries with no agent, so Bambu printers bound
over LAN in 2.4.x vanished after the upgrade. Assign them to the Bambu agent
when the config is loaded. Entries of the other agents stay unassigned: those
were keyed by their address, which equals the stored IP or contains a '.' or
':' that a Bambu serial number never has.
2026-11-10 20:30:37 -06:00
Niklas 96d7742974 Trust the per-printer CA file for Bambu LAN connections (#17062)
The HTTPS CA file in the IP and access code dialog had no effect for Bambu Lab printers. For Bambu printers, the CA path is now saved with the printer's local machine entry instead of being read from the selected preset. On connect, Orca builds `<data_dir>/cert` with the bundled `printer.cer` plus the CA of each printer connected in this session, and points the network plug-in there. The file must contain only CA certificates. If it doesn't, Orca logs a warning and keeps the bundled certs. Other printer agents still use `printhost_cafile` from the preset.

A CA chosen before this change is not migrated. Choose it again in the dialog.

Fixes #17061
2026-11-10 18:48:28 -06:00
Eric Lin fabad6114a Fix filament sync showing a slot as another material (#17089)
When no visible filament preset matched the material a printer reported, first_visible_idx_by_type() returned an arbitrary visible preset, so the slot showed a different material. It now returns no match, and the Moonraker, Creality CFS, Qidi and Snapmaker agents fall back to the OrcaFilamentLibrary generic for that material.

The generic name table now maps PLA+, PLA PRO, ABS+ and PETG+ to their family, and adds PLA Matte, PETG HF, PETG-CF, PE-CF, PP-CF and PP-GF. The redundant visible-base check in the Creality CFS fallback is gone.
2026-11-10 18:34:50 -06:00
SoftFever 58ff1f5244 Merge remote-tracking branch 'origin/main' into feature/mcp 2026-11-11 03:35:56 +08:00
HanifKohandRodrigo Faselli 46f7b0e719 Offer the Sliced Objects as a Solid Model While Dragging the Preview (#15818)
* Offer the Sliced Objects as a Solid Model While Dragging

The G-code preview draws every toolpath segment as an instanced box, and its frame cost is
linear in the number of segments drawn. On a plate of large objects that is enough that
dragging the camera or a preview slider cannot keep up, and no amount of per-segment work
changes that; only drawing fewer segments does.

The objects themselves are cheaper: a mesh costs its triangles once, however many layers it
has, and the preview already loads the objects as shells for its translucent ghost. A new
preference, "Only render solid model when dragging" (off by default), draws those shells
opaque in their filament colours instead of the toolpaths while the user drags.

The visible layer range still holds. The shells are cut at the range's top and bottom through
the gouraud shader's z range, and libvgcode keeps a second index buffer holding just the
range's bottom and top layers, filled in the same walk as the full one, which is drawn
afterwards so that it caps the cut with what was really printed there. Switching between the
two sets is a buffer binding, never a rebuild. The prime tower is added to the shells from its
sliced mesh while the preference is on, positioned as the print placed it; it keeps its opaque
colour and so stays out of the translucent ghost. Supports have no mesh and are not shown.

Dragging is the camera, the navigator or either slider being held; a slider reports it from
ImGui's active id, since its dirty flag is raised and consumed inside one frame. A wheel step
holds the solid model for a 150 ms settle time, with the frame that restores the toolpaths
scheduled for when it runs out. The switch is decided at the top of the frame, before the
cached scene is consulted, and a frame that switches redraws the scene. A drag cut short by
focus or capture loss is ended explicitly, and a button release wakes the idle loop, since on
some platforms no idle event follows it until the next input.

With the preference off, nothing is built and the preview is unchanged.

* Release the Reduced Set When Unused and Share the Drag Check With the Scene Cache

The reduced index buffers were only re-uploaded while the preference was on, so
the last set stayed allocated until the next load once it was switched off, and
their size was missing from get_used_gpu_memory(). They are now uploaded on every
rebuild, empty when nothing was built, and counted.

The scene cache and the solid model both asked whether the user was dragging,
with different lists: the cache knew about gizmos and the rectangle selection,
the solid model about the navigator and the sliders. One is_user_interacting()
now answers both.

The tooltip says that negative volumes are not cut out of the solid model, since
load_shells() drops every non-model-part volume, and the preferences handler
keeps the dimming comment with the branch it documents.

* Let the User Choose What the Preview Draws While Dragging

The solid model is one answer to a preview that cannot keep up with a drag; a
reviewer asked for the two that keep the drag view made of toolpaths. The
checkbox is now a combobox, "Simplify preview while dragging", with Off, Solid
model, Skip layers and Outer walls, and a spin, "Draw one layer in every N",
for the toolpath modes. Off is the default, and with it nothing is built.

Skip layers keeps one layer in every N. Outer walls keeps the outer and overhang
perimeters of those layers, so the prime tower and supports, whose segments have
other roles, drop out of it. Both keep the bottom and top layers of the visible
range whole, as the solid model does, so the faces the range cuts open stay what
was printed there.

libvgcode takes the choice as EReducedDetailMode and a stride; the sets are
rebuilt when either changes, and drawing from the reduced one is still a buffer
binding. A mode change reaches the loaded preview at once, as the checkbox did.

* Add a Shell-Only Drag Mode That Keeps What Can Be Seen From Outside

A third mode of the drag preference: the reduced set keeps every role but the sparse
infill, internal solid infill, internal bridge infill and gap fill, which lie under the
skins or between the walls, on every layer. Walls, top and bottom surfaces, bridges,
supports and the prime tower are drawn whole, so from outside the print looks as it does
at rest, and the two end layers of the visible range stay whole as in every mode.

The roles come from the slicer, so the classification is exact wherever the slicer's is.
What a role cannot tell apart is the inside of the prime tower or of a support from its
outside; both are kept whole. A profile with no top or bottom shell layers exposes infill,
which this mode hides.

* Keep Only the Solid Model and Shell Modes While Dragging

The skip-layers and outer-walls modes drew one layer in every N, and every visual
complaint on the review came from the gaps that leaves at close range. The shell mode
draws every layer and looks the same from outside, and the solid model is the one mode
whose cost does not depend on the toolpaths, so the two of them cover what the stride
modes were for. The layer stride goes with them; a saved preference naming a removed
mode falls back to off.

* Hide Infill in the Shell Drag Mode Only Where the Profile Covers It

A profile with no top or bottom shell layers, or no walls, leaves the infill on the surface,
so hiding it changed the picture. The viewer now reads the print's default region settings
when it loads a print and leaves the infill in place for such a print; per-object overrides
are not consulted.

* Keep the Ghost and Cap the Cut of the Solid Model While Dragging

In the solid model mode the translucent ghost disappeared for the length of every drag, since the scene drew either it or the solid; it is now drawn in every mode, so the part above the cut stays in view.

The cut itself was open: a sparse layer on the cut showed, between its lines, whatever lay below inside the hollow shell, the first layer or the bed, which moved with the camera and read as a flickering shadow; and a face of the model in the cut layer's own plane fought that layer's toolpaths pixel by pixel. The solid now runs from the top of the range's bottom layer to the bottom of its top layer, and a stencil pass caps each cut plane, body by body, with a quad in the body's colour darkened where the cut has opened it: back faces less front faces, counted with the depth test off, which leaves a closed body at zero.

* Leave the Preview Untouched While Dragging With the Mode Off

The reduced flag was raised on every drag whatever the mode. libvgcode still drew the full set with the mode off, but the canvas reads the flag: it redrew the scene on the first and last frame of each drag, scheduled an extra frame after every wheel burst, and ended a drag that lost focus or capture. The flag is now raised only when a mode is set.

The realistic view's shadow-caster pass draws whichever set is bound, and the static shadow map's key did not say which, so a map built during a drag stayed thinned after release; the key now includes it.

* Tidy the Drag Mode: Cheaper Caps and No Leftovers

The solid model's cap quads are built once per frame and recoloured per body instead of being rebuilt for each, and the stencil count draws each body directly: going through the collection's render built the full preset config and sorted every volume once per body, per frame. A one-line settings wrapper is inlined, the function that added or removed the tower with the mode is folded into its one caller, the two libvgcode getters nobody calls are removed, and the wheel's settle time is set where the wheel is handled. The Shell only tooltip names internal bridges, which the mode hides.

* Cut the Solid Model at the Toolpaths' Heights on a Printer With a Z Offset

The cut heights took the printer's z offset out of the layer heights, which the G-code processor has already taken it out of, so on a printer with a z offset the solid was cut one offset away from the layers drawn as toolpaths: a gap under the top one and an overlap with the bottom one, and the caps sat off the solid's cut plane. The layer heights are in the shells' frame as they are.

* Test That AppConfig Keeps Only the Preview Drag Modes It Knows

A missing mode becomes off, the three modes survive, and a value from an earlier revision or an empty one falls back to off.

* Hold the Navigator's Drag for as Long as the Button Is Held

The navigator reports a drag only on a frame the mouse moved in, and the flag is written by the overlay, after the frame has chosen which toolpath set to draw. A still frame in the middle of a drag dropped the flag, so the next one drew the full set, and a release with no motion left the reduced set on screen until the next mouse event. The flag now holds while the button does, and the drag check reads the button itself.

* Keep the Toolpaths While Dragging a Print Whose Layers Do Not Rise

The solid model is cut at the heights of the layer range's two ends, one range for the whole plate. Printed object by object, the layer heights start over with each object, so those two heights do not bound the range: an earlier object was cut at a later one's height, and a range across two objects could come out empty. Such a print keeps its toolpaths while dragging, as a plate with no shells does.

* Cut the Solid Model Past a Layer With No Extrusion

A layer with no extrusion has a height of zero, and the solid model read its cut heights from the layers at the ends of the range as they were: with such a layer under the top of the range the whole solid was cut away. The nearest layer below with a height stands in for it.

* Keep the Toolpaths While Dragging a Preview Cut by the Section View

The section view cuts the toolpaths open to show their inside. The solid model was drawn with no clipping plane, so while dragging it covered the section whole and the section came back on release. A preview with a section active now keeps its toolpaths while dragging, as a print made object by object does; the shell mode draws through the same plane as the full set and is unaffected.

* Keep the Supports While Dragging in the Solid Model Mode

The solid model stands in for the sliced objects, which are the only shells the preview loads: a support has no mesh, so the moment a drag started everything under an overhang vanished and the object sat on nothing until release. The reduced set now keeps the support roles whole on every layer, as the shell mode does, and the supports draw as toolpaths beside the solid.

* Draw the Layers Down to the Nearest Infill Whole at Each End of the Range

The reduced set kept the two end layers of the visible range whole, and the solid model was cut right under the top one, as though every layer carried every role. Infill combination prints the sparse infill of a few layers in one and leaves the others walls alone, and a support layer with no object layer at its height gets a layer of its own, so a cut under such a layer capped the print where at rest the infill of the layer below shows through: a flat disc inside the walls while dragging, the infill grid on release. Each end of the range now runs to the nearest layer with sparse infill, at most eight layers deep, in both modes, and the solid is cut at the edges of those bands. The layer table is the whole plate's, so another object's solid infill on a layer does not end the band while sparse infill is within reach; a print with none in reach falls back to the nearest layer with any infill, else keeps the end layer alone. The layer table records which layers have infill when the toolpaths are loaded, and the bands are covered by tests.

* Colour the Solid Model as the View Colours the Toolpaths

The solid model and its caps wore the filament colours whatever the view, so a drag in the Line type view turned an orange-walled, red-filled print into a block of its filament colour. The solid stands in for the toolpaths, so it now takes their colours: in a view that colours by something other than the filament, the body the outer wall's, each cap the infill's of the layer it is cut under, sparse before solid, and the prime tower its own role's, each sampled from the first vertex of the role through the viewer. The filament views keep every body its own colour. The colours are resolved when a drag starts and when the view type or the end bands change.

* Close the End Bands Object by Object

The end bands of the reduced set stopped at the nearest layer with sparse infill anywhere on the plate. Two objects rarely combine their infill on the same layers, so where one object still had sparse infill on a layer the other's walls-only layer closed the band, and that object was capped right under it: a flat disc inside the cone's walls while the funnel beside it printed its last infill. The G-code labels its moves with their object, so the wrapper that feeds libvgcode now tallies walls and infill per object and layer and hands the viewer the layers whose infill closes every object printed on them; the bands stop at those. Sparse infill closes an object on a layer. Solid infill closes it only where the object has no sparse infill left in the direction the band looks from, its top shells as seen from above and its bottom shells as seen from below, since a layer whose sparse infill was combined into another still carries the solid infill under its skins and is open; an object with no sparse infill anywhere is closed by any infill. A range from the print's first layer has no bottom band, as nothing is cut under that layer. A preview built from the print, or one whose G-code labels no object, carries no such list and keeps the judgement by the roles of the whole layer.

The G-code processor read the object only from the "start printing object" line that Bambu printers add; every printer writes "printing object <name> id:<n> copy <m>", so it reads that too, and takes the id after the last "id:" so that a colon in the name does not mislead it. The printable-area check that groups extrusions by that id now sees the objects of such a print one by one, as it does for a Bambu print, instead of as one.

* Colour the Solid Model From the Grade Most of the Role Was Printed At

The solid model took each colour from the first vertex of the role in the
sampled layer. The first vertex of an outer wall is the start of its
extrusion, still on the acceleration ramp, so under Actual speed and Actual
flow the whole solid showed the slowest grade of the legend, and under Fan
speed the body colour jumped between drags with whichever layer happened to
be the top cut.

Viewer::find_extrusion_vertex() now takes a layer interval and, in a view
that grades the toolpaths by a value, returns the extrusion of the role at
the length-weighted median of that value over up to eight layers spread
across the interval; in any other view the first extrusion found, as
before. The body and the prime tower are sampled over the layers the solid
stands for, each cap in its own cut layer.

* Count Each Cap of the Solid Model Against Its Own Cut

With the bottom slider above the first layer the solid model is cut at both
ends, and the one stencil count that both caps were drawn through counted
the body with both cuts applied. An open tube counts a view ray through
both openings as closed, so the top cap had a hole through which the
infill toolpaths showed, and a ray in through a wall and out through the
bottom opening as open, so from a low angle the top cap's quad, which
spans the bounding box, was drawn in the air beside the body.

Each cap now gets its own count, with the body cut at that cap alone and
whole at its other end, which is odd exactly where the cap plane lies
inside the body from any viewpoint. The second body pass per volume only
runs when the bottom is cut.

* Let the Solid Model Cast and Take the Realistic View's Shadows

The realistic view's shadow map was built from the toolpath segments
alone, and while dragging in the solid model mode those are only the end
bands and the supports, so the solid threw no shadow at all. Its own pass
also forced the shadow intensity to zero, so it took none either.

In that mode the shells, cut at the solid's heights, are now drawn
depth-only into the same map through the flat clip shader, and the solid
samples the map back with the light the canvas passed on, so a body
shades the plate, its neighbours and the end-band toolpaths as the
toolpaths it stands in for would, and takes their shadows in turn. The
map's key also carries the drag mode, so a map built with the solid is not
kept for the shell mode.

* Keep the Reduced Set Up While a Navigator Click Turns the Camera

A click on a face or a corner of the 3D navigator makes it turn the camera
over the forty frames that follow, with no button held. Each of those
frames was drawn with the full toolpaths, since nothing counted as a drag,
and on a weak GPU the turn took seconds.

The overlay reports each of those frames as a change that is not a drag,
so the canvas holds a flag for as long as that lasts and counts it as
interacting; the frame after the last one is requested so that the full
toolpaths come back on their own.

* Let the Cut Faces of the Solid Model Cast Their Shadow

The solid model was drawn into the shadow map as the shells cut at the
same heights, open where it is cut, on the ground that from the light an
open body's far wall closes its outline. It does, but not its depth: a
ray through the opening passes the end band's sparse infill lines and
reaches the far wall, so on a flank below the light's side the solid
carried the lattice of those lines, where the toolpaths it stands in for
are in one uniform shadow under the opaque layers above.

The shells now cast through a shader of their own: a back face that a
ray reached through a cut is drawn at the depth of that cut, the nearest
of the cut planes on the way back toward the light, and a front face
keeps its own depth. A ray reaches a back face through a lit wall as
well, and the cut's depth would then shadow that wall, so the front
faces are drawn on their own first, into a depth texture of the
viewer's, for the shader to tell the two apart. The shadow map has no
stencil, so the camera pass's cap count could not be reused here.

* Hold the Solid Model's Body Colour While a Slider Drag Moves the Span

A slider drag shows the solid model like a camera drag does, and the
body took a fresh sample at every step, from eight layers spread over
the span of the moment. Where the walls' speed or fan differs from layer
to layer, each step fell on another mix of layers and the length-weighted
median flipped with it, so the body jumped between the grades of the
legend for as long as the slider moved.

The body and the tower are now sampled once, as the drag begins, and
held until it ends; the next drag samples them afresh over the span it
finds. Each cap still follows its own layer, as the toolpaths of that
layer would.

* Colour Each Body of the Solid Model From Its Own Toolpaths

The solid model took one body colour for every object on the plate,
sampled from all the walls of the layers it stands for, so an object
printed at its own speeds wore the grade of the others while its
toolpaths showed another.

The viewer's sampler now takes a rectangle of the XY plane and counts
only the extrusions that end inside it, and each shell volume samples
its body and caps within its own footprint; the tower likewise, from its
own role. Objects that overlap in XY share their samples, which is as
close as the toolpaths come to naming their object.

* Dim and Grey the Solid Model With the Layers It Stands For

With "Dim lower layers" on, the toolpaths around the inspected layers
are drawn at the preference's brightness, and with it off they go dark
grey while the moves slider is short of the top layer's end. The solid
model, which stands in for exactly those layers, was drawn at full
brightness either way.

The layers the solid stands for are never the ones a slider thumb
lights, so its bodies, caps and tower now take the same brightness or
grey the toolpath shader gives the rest of the print, decided by the
rule that shader is given.

* Cut the Solid Model by the Section View

While the section view was on, a drag kept the full toolpaths, since the
solid model would have covered what the view cuts them open to show.
That held even where the plane cut nothing, so with the view on the drag
mode gave nothing at all.

The solid now takes the section plane as the toolpaths do: the bodies
are clipped by it, the two height caps are drawn on its kept side, and
the section face gets a cap of its own, counted on the body cut by that
plane alone and drawn between the two heights, in the body's colour
darkened like the others. What the plane cuts away casts no shadow.

* Keep the Travels Between the End Layers of the Solid Model

With Travel shown in the legend, the solid model kept the travels only on the
layers at the ends of the range, so they vanished on every drag. They are kept
on every layer now, as the supports are. The rule moves into Utils so the
cases can be tested.

* Drag Belt Printer Previews With the Toolpaths Instead of the Solid Model

The solid model is cut by horizontal planes at the end layers' heights, but a
belt printer's layers are planes tilted at the belt angle, with heights in the
G-code's frame, so the cuts missed the body. On belt printers a drag keeps the
toolpaths, as it does for a print whose layer heights start over per object.

* Cast the Solid Model's Cut Faces Into the Shadow Map

A band cut at both ends let the light in through the top cut and out through
the bottom one past every wall, so only the top band's infill lines cast and
the bed showed their grid. The cut faces are now counted and drawn into the
shadow map as the visible pass draws them: in a depth and stencil target of
the viewer's, since the map has no stencil, then copied into the map. This
replaces the back-face depth rewrite of the cut caster shader, and both
passes build the caps through one helper.

* Describe the Solid Model's Cut-Face Shadows, Travels, Belt Fallback and Section Cut

* Keep Parts Above the Visible Range Out of the Solid Model's Cut-Face Shadow

The light's frustum ends at the highest visible layer, so its near plane
cut through parts above the range (a bunny's ears) during the cut-face
stencil count: only their far faces were counted, the count read them as
open and the bottom cap cast an ear-shaped shadow on the bed. Clamp depth
during the count so every face is counted.

* Say in the Drag Option That Belt Printers Keep Their Toolpaths

The solid model handles the section view, and belt printers fall back to
the toolpaths; the description said the opposite of both.

---------

Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
2026-11-10 08:23:08 +08:00
SoftFever 4dd989a9e3 Merge remote-tracking branch 'origin/main' into feature/mcp 2026-11-10 03:03:41 +08:00