* WipeTower2: on Klipper, sync motion only before temperature commands
Follow-up to #15133. On Klipper, flush_planner_queue() emitted M400 at
every toolchange boundary, stalling the toolhead over the tower. Keep the
sync only before M104/M109/M591, and drop the sync line left behind when
GCode.cpp strips the interface-temperature M109.
End the deretraction placeholder with a newline: without the M400 that
used to follow it, the next tower move was glued to the placeholder line,
skipped post_process_wipe_tower_moves and kept tower-local Y.
Creator 5 Pro, 247 toolchanges: 1235 M400 -> 247 (~30 min saved).
* Update src/libslic3r/GCode.cpp
Good point, done. The strip now uses flush_planner_queue_command() and follows whatever the tower writes.
Co-authored-by: Kris Austin <kris.austin@gmail.com>
* tests: move the wipe tower slice and shared checks into one helper
* WipeTower2: keep the sync at the end of the unload on Klipper
[change_filament_gcode] and Tn are macros on Klipper; their non-motion
parts run when parsed, so without the sync a filament-change macro could
run while the unload and ramming moves are still queued.
Creator 5 Pro, 247 toolchanges: 494 M400 instead of 1235 (247 in this PR
before). The other boundary flushes, which stalled the toolhead over the
tower, stay removed.
* tests: check the unload sync before each change_filament_gcode
* WipeTower2: don't sync the cooldown after the interface wipe
The reset to the base temperature after the interface wipe isn't
timing-critical, but its M400 stopped the head over the tower before the
tower perimeter. Test print, Creator 5 Pro, 247 toolchanges: 3:22 with
the sync, 3:17 without it.
* tests: check only the interface cooldown for a missing sync
* WipeTower2: skip the cooldown sync on Klipper only
---------
Co-authored-by: Kris Austin <kris.austin@gmail.com>
Co-authored-by: GhZserG <ghzserg@zmod.link>
* Join Precise-Z Sliver Layers to the Prime Tower Layer Below
Precise Z height ends each object at its exact top, so another object's
layers can print a few microns above these. Each sliver became its own
wipe tower layer, and a tool change on it was sized for that height: a
0.0009 mm layer asked for a 230 mm ramming band, which grew the tower
past the bed ("Prime tower is partially outside the printable area").
Once sized correctly, G-code export lost step with the tower and threw
"append_tcr was asked to do a toolchange it didn't expect".
A tower layer thinner than half the printer's minimum layer height now
joins the tower layer below: ToolOrdering records the tower layer each
layer prints on and whether it finishes it, the tower plans the joined
tool changes on that layer's z and height, and the G-code neither
advances the tower on a joined layer nor finishes the layer before it.
* Finish a Joined Prime Tower Layer on Its Last Tool Change
The joined layer always finished the tower layer, so a joined layer that
changed no tools asked for a result after the layer below had taken them
all and threw "Wipe tower generation failed". The layer that finishes is
now the last of the group that changes tools, or the last one when none
does, matching how a single layer merges its finish into a tool change.
A joined layer also reset the Type 1 tower's first print, so smooth
timelapse replayed the tower layer's wall and threw the same error.
Layers are now joined below the printer's minimum layer height instead of
half of it: precise Z height can move a layer off by up to a layer height,
and the 0.04-0.08 mm layers left on their own still grew the tower off the
bed.
* Print Joined Prime Tower Purges at the Tower Layer's Z
A joined layer printed its purges at its own nozzle height, up to just
under the minimum layer height above the tower layer, so the beads were
not pressed onto it. The emitter now descends to the tower layer's z for
a joined layer, travelling over the tower first and climbing back after,
the way it already does for a tower compacted below the objects.
Layers sliced at exactly the minimum layer height sum to gaps a hair
under it and were joined to the layer below; an EPSILON margin keeps
them apart.
* Travel Over the Prime Tower Before a Joined Layer Descends
With no change_filament_gcode and no nozzle change, the Type 1 emitter
descended to the joined tower layer's z while the head was still over the
part, then travelled to the tower at that z. It now travels over the tower
first. The tests check that every descent below the object layer happens
over the tower.
The post-slice check stored the extruders that can't print each filament as bits in an int. From the 32nd extruder on, the shift overflowed, and on x86 extruder 33's bit landed on extruder 1. limit_filament_maps and the printable area mask are now 64-bit, which covers MAXIMUM_EXTRUDER_NUMBER. Printers with up to 31 extruders get the same values as before.
The tests check the area, height and filament type limits on nozzles 2, 32, 33 and 64, and slice a cube on nozzle 64 of a 64-nozzle printer.
* Validate Only the Edited Variant's Adaptive PA Model and Accept Spaces in It
Since pressure advance became a per-variant filament setting, the Filament
tab validated every variant column of the adaptive pressure advance model
whenever one was edited. The columns the user never touched still hold the
default placeholder, which the validator rejects, so every edit of a
multi-variant filament ended in a "Line 1: flow value must be greater than PA
value" dialog about a column the user could not see. The check now covers the
variant being edited only, as the nozzle temperature checks on the same tab do.
The validator also rejected whitespace between the values, which the model
parser accepts, so a model typed as "0.027, 8.1416, 2000.0" sliced correctly
but warned on every slice. Whitespace is now ignored before the values are
checked.
Enabling adaptive pressure advance before entering a model warned that the
model "may contain invalid values", which only meant that the placeholder is
all zeros. That case now gets its own warning saying that no measurements
have been entered.
* Keep the Empty Adaptive PA Model a Single Filament Column in Its Test
Deserializing an empty string into the model option leaves it with no
entries, and get_at on an empty vector aborts on a libstdc++ built with
assertions, as the Flatpak unit-test lanes are. Presets always hold one
column per filament, so set the value directly.
* Fix center of mass details, belt preview and section view bugs
Fixes the center of mass bugs from #16781 (center of mass a-d and
rendering b).
- The details box follows its marker, so zooming toward the cursor
could slide it under the mouse, where ImGui took the wheel and
zooming stopped. The wheel now zooms over the box.
- Esc closes the details box. A click on a marker now focuses the 3D
view first, so Esc reaches it after typing in a sidebar field.
- On belt printers the Preview markers stayed in the raw G-code frame
while the upright view draws the toolpaths back-transformed. The
masses now get the toolpaths' transform. It shears, so the second
moments are kept as a full 3x3 matrix to keep the moments of
inertia right, and the bounding box rows are left out for a map
that mixes the axes, where the box of the mapped corners would be
far too large.
- At the top layer of the slider the solid marker of what is printed
so far covered the faded finished-print one, which could not be
clicked. At the top layer only the finished print's markers show,
drawn solid.
- The section view cuts a marker away when its center is on the cut
side, as it does the toolpaths' option markers.
* Keep the belt bounding box and store six second moments
- Belt prints keep the bounding box rows in the details. The G-code
back-transform moves from GCodeViewer into
BeltTransformPipeline::build_gcode_back_transform(), and on a belt
print the processor keeps a second box per mass, of each segment's
ends and bead height mapped by its linear part. ObjectMass::transform()
moves that box by the translation, instead of dropping the box that
the shear would blow up.
- A mass stores its second moments as the diagonal and the three cross
terms instead of a full matrix, which is built only to transform it.
The post-slice check compared each path with the bounding box of the region its nozzle can't reach. When the nozzle's printable area is inset on two or more sides, that region is L-, U- or frame-shaped and its box covers the whole bed, so every slice failed. The check now tests the path's box against the region itself, and the same result sets limit_filament_maps.
Fixes#15746
The cooling buffer drops a G1 F that repeats the feedrate the preceding
travel, wipe or retraction already set, so an extrusion printed at the
travel speed reaches the adaptive pressure advance processor without a
feedrate line of its own. The processor only read standalone G1 F lines
and fell back to the last one it had seen, often the first layer's, so
the predicted pressure advance stayed at the first-layer value for the
rest of the print.
Track the feedrate every move with an F word sets, as the firmware does,
and use it for an extrusion that no G1 F precedes.
Several per-filament and per-extruder options default to a single value. When a config lists fewer values than there are filaments or nozzles, the Type1 prime tower and the pre-heat injector read past the end of the vector, and the same scene could slice to different G-code from one run to the next.
- Read `filament_change_length`, `filament_change_length_nc` and `hotend_cooling_rate` with the same fallback to the first value that `get_at()` uses.
- `is_nil(idx)` falls back to the first value like `get_at()` instead of reading past the end.
- Skip the pre-cooling and last-layer reads when `get_extruder_id()` returns -1, and when no wall filament matches the selected category.
- Bounds-check the pre-heat injector's per-filament and per-extruder reads, and use the extruder index when `physical_extruder_map` is too short.
Configs that list a value for every filament and nozzle produce the same G-code as before.
Adds a test that nozzle-change ramming extrudes the same length in both directions when `filament_change_length` has one value for two filaments.
# Description
<!--
> Please provide a summary of the changes made in this PR. Include
details such as:
> * What issue does this PR address or fix?
> * What new features or enhancements does this PR introduce?
> * Are there any breaking changes or dependencies that need to be
considered?
-->
Fixes#16771. Opening a project saved by 2.5.0-alpha in a nightly shows
"The 3MF file version 2.5.0-alpha is newer than OrcaSlicer's version
2.5.0-dev, found the following unrecognized keys:", followed by an empty
list.
Three things cause this:
- `semver.c` ranks `dev` below every other prerelease. Nightlies stay on
`x.y.z-dev` after the alpha and beta are tagged on the release branch,
so every alpha or beta project looked newer than the nightly opening it.
- `silent_mode` was retired: `handle_legacy` drops it on load, and
nothing can set it. It was still defined, though, so it was written into
every project. Every project then reported it as an unrecognized key on
load, and every project from a newer version took the "unrecognized
keys" branch of the warning. For the project in the issue it is the only
key reported.
- The warning never printed the keys it found, so the list was blank.
## Changes
- Rank `dev` above the other prereleases of the same version and below
the release: alpha < beta < rc < dev < release. This also changes two
other places that compare against the app's version:
- A project saved by a `x.y.z-dev` nightly now counts as newer when
opened in that version's alpha or beta.
- The update check, with prereleases enabled, no longer offers that
version's alpha or beta to nightly users. It still offers the release.
- Remove the `silent_mode` option, so projects no longer save it, along
with the code that only read it: the Normal/Silent columns on the
printer's Motion ability page, the Normal/Silent label in the
unsaved-changes dialog, and the switch that enabled the stealth time
estimator. Since the value was always false, none of these ran. The key
stays in the obsolete set, so older projects that contain it still load.
- List the unrecognized keys in the newer-version warning. The UI
strings are unchanged, so existing translations stay valid.
Projects saved before this change still carry `silent_mode`, so the
warning lists it when one of them is newer than the running version.
# Screenshots/Recordings/Graphs
<!--
> Please attach relevant screenshots to showcase the UI changes.
> Please attach images that can help explain the changes.
-->
Before:
<img width="860" height="200" alt="before"
src="https://github.com/user-attachments/assets/5d067ae1-5cfb-40b4-8973-3ac10cf2aeb9"
/>
After:
<img width="860" height="200" alt="after"
src="https://github.com/user-attachments/assets/2ef2401e-e869-4ae8-84f6-8730494c13c0"
/>
## Tests
<!--
> Please describe the tests that you have conducted to verify the
changes made in this PR.
-->
- New `[Semver]` cases: dev ranks above alpha, beta and rc and below the
release of its version; two dev builds compare equal. They fail without
the `semver.c` change.
- New `[Config]` case: a full config has no `silent_mode`, and loading
one that has it drops it and reports it as unrecognized.
- On Linux, loaded the project from the issue in a `2.5.0-dev` build.
Before: the warning with an empty list. After: no warning. The same
project relabelled as 2.5.0 and given an unknown key shows the warning
listing that key and `silent_mode`.
- Re-saved the project from the CLI: `silent_mode` is no longer in
`project_settings.config`.
- Sliced the project before and after: identical moves and time
estimates; only the settings comments differ.
- `tests/libslic3r` and `tests/fff_print` pass on Linux. The STEP case
"A cone with a slightly tilted seam imports as a closed mesh" fails
locally on main too. The profile tool tests pass.
<!--
> A guide for users on how to download the artifacts from this PR.
-->
[How to Download Pull Requests Artifacts for
Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
silent_mode has been dropped on load since it was retired, and nothing
can set it, yet it was still defined and written into every project.
Remove the option and the code that only read it. The key stays in the
obsolete set so older projects still load.
The ;HEIGHT: and ;WIDTH: tags that WipeTowerWriter writes for GCodeProcessor
were formatted with std::to_string, which follows the C numeric locale. On a
thread that keeps the user's locale, a comma-decimal locale wrote tags such as
";HEIGHT:0,300000". GCodeProcessor parses these values with the C locale, so it
logs an error and ignores the tag, and the width and height it assumes for the
tower fall back to its own.
Format them with float_to_string_decimal_point like the move coordinates beside
them, keeping six decimals so the output in the C locale is unchanged. The same
tags in WipeTower2 go through a stream, which formats in the global C++ locale
and was never affected.
Adds a test that slices with a comma numeric locale and checks every ;HEIGHT:
and ;WIDTH: line, including the two the writer's constructor emits before the
tower's start tag.
Related to #16777.
# Description
This PR adds opt-in, height-aware exclusion volumes to OrcaSlicer,
including multi-nozzle handling, object and generated-geometry
validation, final G-code collision checking, and travel rerouting.
It grew from the original object-placement prototype into a
collision-aware slicing pipeline with documented limitations. The
central compatibility decision is that Orca's existing
`bed_exclude_area` keeps its historical meaning, while the new
`bed_exclude_volumes` setting explicitly enables the stronger
collision-aware behavior.
<img width="935" height="707" alt="Travel paths routed around exclusion
volumes"
src="https://github.com/user-attachments/assets/22925e5c-a3b1-4c26-be1a-8a89d9970cb5"
/>
Related issues: #5922, #10579, #10638 and #12774.
## Why this is useful
The existing 2D exclusion area prevents object placement in areas such
as the filament-cutter corner on Bambu printers. It cannot describe low
bed clips, raised tool docks, camera arms, flying-gantry hardware, or
other obstacles that occupy only part of the printer's Z range.
Treating every existing area as a physical motion obstacle would also be
unsafe for compatibility: some printers deliberately move into their
excluded material area. This PR therefore separates the two concepts
rather than changing the meaning of existing profiles.
| Setting | Purpose | Existing motion affected? |
| --- | --- | --- |
| `bed_exclude_area` | Existing bed-fixed material/placement keep-out |
No G-code checking or travel rerouting |
| `bed_exclude_volumes` | Shared 3D collision volumes |
Object/generated-material checks, G-code validation and travel rerouting
|
| `extruder_bed_exclude_volumes` | Per-extruder 3D collision volumes |
Same collision behavior, resolved for the active physical nozzle |
Bed areas and collision volumes are additive. A printer can retain an
existing cutter/material keep-out while adding separate physical
collision volumes. Belt printers retain the existing projection of bed
areas onto the tilted belt surface; collision volumes remain in model
coordinates.
## Configuration and syntax
`bed_exclude_volumes` accepts one or more polygonal prisms:
```text
XxY,XxY,...
```
defines a full-height collision volume.
```text
REGION|REGION|REGION
```
defines multiple independent volumes.
```text
ZMIN..ZMAX;XxY,XxY,...
```
defines a volume active only across that Z range. Either Z bound may be
omitted:
```text
..10;20x20,40x20,40x40,20x40
30..;20x20,40x20,40x40,20x40
```
For example:
```text
20x0,45x0,45x18,20x18|8..22;115x20,145x20,145x48,115x48
```
defines one full-height volume and one volume active from Z=8 mm to Z=22
mm. Z ranges are validated and clamped against the configured printable
height, and decimal parsing is locale-independent.
The CLI exposes the same distinction:
```text
--bed-exclude-area
--bed-exclude-volumes
```
Existing scripts using `--bed-exclude-area` retain the original polygon
format and behavior.
## Backward compatibility and migration
- Existing profiles and projects using only `bed_exclude_area` keep its
material/placement keep-out meaning; they do not implicitly enable
collision-volume checking or travel rerouting.
- Stock printer motion is not checked or rerouted against bed areas.
This is important for machines that deliberately enter an excluded
material area during cutting or loading.
- The new syntax is stored under separate config keys, so an older Orca
build does not try to deserialize a volumetric string as the existing
point-list option.
- In **Printer settings → Basic information → Printable space**,
**Excluded bed area** remains a normal editable field with Orca's
standard reset controls. **Toolhead collision volumes** is a separate
field directly below it. There is no Convert/Copy button and neither
setting clears the other.
- A bed-area polygon can be manually copied into the collision-volume
field to describe a full-height physical obstacle. Pasting volume syntax
into the bed-area field instead prompts for confirmation before adding
it to the appropriate volume definitions. The saved bed area, existing
volumes and selected nozzle mode are preserved; cancelling leaves them
unchanged.
- If a user does not configure the new volume keys, the new G-code
checker, rerouter, support trimming and nozzle-specific brim behavior
remain inactive.
This gives existing profiles a stable compatibility boundary while
allowing users and maintainers to migrate deliberately to full collision
checking over time.
## Multi-nozzle behavior
For multi-nozzle printers, the collision-volume mode selects one of
three behaviours. In individual mode, each extruder's definition is
edited on its own Extruder settings page. These modes apply only to
collision volumes; the excluded bed area stays shared and bed-fixed.
Collision volumes support three modes:
<img width="549" height="441" alt="Exclusion volume behavior selector"
src="https://github.com/user-attachments/assets/6ca8c2e2-d00e-4b32-9b12-bfbff0928966"
/>
### Shared
Every physical nozzle uses the same collision-volume definition.
<img width="2353" height="1633" alt="Shared exclusion volumes"
src="https://github.com/user-attachments/assets/96fe938b-07b4-4cd9-b587-e31f2ebba5f8"
/>
### Toolhead-relative (nozzle offsets)
The shared definition is treated as relative to the toolhead. Orca
derives the other nozzles' collision regions using their configured XY
offset from the reference nozzle. This is useful where the same physical
carriage must avoid an obstacle but its position changes when a
different offset nozzle prints at the same model coordinate.
<img width="1084" height="803" alt="Toolhead-relative exclusion volumes"
src="https://github.com/user-attachments/assets/e0790ee4-68b5-444f-90ac-22a5eba05eec"
/>
### Individual per extruder
Each physical extruder/nozzle has its own independent volume definition.
This supports machines whose valid region differs by tool and cannot be
derived from a simple nozzle offset.
<img width="1123" height="761" alt="Independent exclusion volumes for
three extruders"
src="https://github.com/user-attachments/assets/c6404ceb-9958-4df8-93ed-5ff2ac7dc658"
/>
Object validation resolves logical filament assignments to the physical
nozzle or nozzles that may print the object, including automatic Bambu
mapping. If an object may use several nozzles through painting,
feature-level assignments, modifiers, support or interface material, the
complete object is conservatively checked against every relevant
nozzle's volumes.
## Object validation and 3D preview
Object collision detection uses a cheap XY/Z broad phase followed by an
exact mesh-versus-prism test. The exact test:
- Avoids rejecting an object whose XY shadow overlaps a raised volume
while its real mesh remains clear.
- Detects normal surface crossings.
- Detects a volume completely enclosed inside a solid model.
- Respects object-instance and model-volume transforms.
- Separates the collision decision from optional preview-mesh
generation.
When a collision is found, Orca reports the relevant extruder where
possible and renders the intersecting model surface in red. The bed
preview shows a neutral grey footprint, a thin nozzle-colored ownership
border where appropriate, and a translucent 3D prism when a nearby
object makes the volume relevant. Raised volumes keep their ownership
outline on the bed rather than floating at their starting Z.
<img width="578" height="534" alt="Red model and exclusion-volume
intersection preview"
src="https://github.com/user-attachments/assets/d409f574-1790-48e5-b4a3-703273439954"
/>
Single-nozzle/shared geometry remains visually neutral; nozzle colors
are used when they convey distinct tool ownership.
The default automatic preview limits the translucent 3D geometry to
nearby object height to avoid obscuring the workspace. **View → Show all
collision volumes** displays the complete configured Z ranges, including
on an empty bed. Its default shortcut is **Ctrl+Shift+V**
(**Command+Shift+V** on macOS), and it can be changed in the shortcut
settings. Orca remembers this application-level display preference
independently of printer presets; it does not change collision checks or
slicing.
## Arrange and Fill Bed
Arrange and Fill Bed receive Z-aware, nozzle-aware obstacles, so an
object may occupy a footprint belonging only to another nozzle or pass
below a raised volume when its height permits it.
- Existing objects remain obstacles when Fill Bed creates new copies.
- Convex volume footprints are passed through accurately.
- Orca's current libnest2d path supports convex NFP obstacles only, so
non-convex volumes use a documented conservative bounding box until
convex decomposition is implemented.
- Orca's existing final alignment and normal unplaced-item behavior are
retained.
<img width="1097" height="846" alt="Fill Bed with multiple tools and
exclusion volumes"
src="https://github.com/user-attachments/assets/8c0ee5cf-624b-42a6-b57a-13c73400ac5c"
/>
## Brim and support generation
When collision volumes are enabled, object and support brims are clipped
against the relevant first-layer volume footprints before their final
extrusion paths are generated. Brim ownership is retained so touching
object and support brims cannot be merged and silently reassigned to a
nozzle whose volume they intersect. Established bed-edge and bed-area
brim clipping remains unchanged when collision volumes are not
configured.
<img width="1139" height="770" alt="Object and support brims clipped
around nozzle-specific volumes"
src="https://github.com/user-attachments/assets/2913ff31-53e4-4e43-8b27-1afba7e3bafb"
/>
Normal support and raft polygon categories are trimmed against the
relevant volumes over each support layer's actual vertical slab.
Support-material resolution accounts for explicit support/interface
tools, “current filament” behavior, alternating material layers,
automatic physical-nozzle mapping, support brims, and shared support
geometry.
TreeSupport3D receives active exclusion geometry during branch planning
so its existing avoidance machinery can steer branches around obstacles
rather than merely cutting finished paths.
## Final G-code collision validation
The final emitted G-code is checked as a safety backstop after slicing.
The checker tracks:
- The active physical nozzle and its XY offset.
- Absolute and relative XY/Z motion.
- Travel, extrusion and other parsed motion types.
- Tool selection and physical/nozzle mapping.
- Explicit motion in start, filament-change and tool-change G-code.
- Coordinate resets and common `G28` forms, including bare, spaced,
compact and parameterized axis selections.
Material keep-outs from `bed_exclude_area` are deliberately ignored by
the motion checker. Only explicit collision volumes constrain motion.
If Z is genuinely unknown, the check is conservative across all relevant
heights and the warning identifies that fact and includes the relevant
G-code line. The artificial first segment that the preview draws from
`(0,0)` is not treated as a real machine move.
## Travel rerouting
Generated travel moves are rerouted around active collision volumes when
a valid route exists.
Routing is:
- Aware of the travel's actual Z slab and planned lift/Z-hop.
- Resolved for the active physical nozzle.
- Constrained so any detour vertices added by Orca remain inside the
printable bed.
- Able to accept firmware-established start/end points on or beyond the
nominal bed edge.
- Revalidated before the replacement path is emitted.
The implementation covers ordinary generated travels, the first
generated move after start G-code, and moves following physical or
same-nozzle filament changes. Explicit movement commands in custom
start/tool-change G-code update the tracked position so the next
generated travel begins from the correct point without defeating Orca's
post-toolchange Z restoration.
Obstacle geometry is cached by extruder and active Z-region set, with
bounding-box rejection before expensive polygon work. Clear travels
therefore avoid repeatedly unioning and offsetting the same obstacles.
If no safe route can be found, Orca leaves the original move for the
final checker to report rather than emitting an assumed-safe detour.
Extrusion paths are validated but never rerouted.
<img width="1286" height="706" alt="Travel rerouting from start G-code
across multiple Z-aware volumes"
src="https://github.com/user-attachments/assets/a68cd98f-5576-4f78-af43-697e9f687a9b"
/>
And here is an example of independent nozzle travel rerouting:
<img width="2532" height="876" alt="image"
src="https://github.com/user-attachments/assets/28b0c26e-59d6-42b9-a64f-4c2205c4ea3f"
/>
## Testing and review status
Targeted Catch2 coverage now includes:
- Bed-area/volume parsing, validation, confirmed paste handling,
additive behavior and CLI options.
- Belt-surface projection of bed areas through both static and dynamic
region resolution, including the reported cube positions, with collision
volumes left unprojected.
- Shared, toolhead-relative and individual per-extruder resolution.
- Physical-nozzle and filament mapping.
- Exact object intersection, including fully enclosed prisms and
transformed instances.
- 3MF persistence.
- Arrange behavior for convex and non-convex obstacles.
- Brim bed-boundary and volume clipping regressions.
- Support and interface-material masks across support polygon
categories.
- G-code motion classification, coordinate tracking, homing forms and
tool selection.
- Safe travel rerouting, Z-aware activation, nozzle selection, off-bed
firmware endpoints and failure cases.
The reviewed `929beaee15` revision passed the CI checks, and review
testing confirmed that the unit tests and earlier arrange, tool-change Z
restoration, support, brim and brim-ownership regressions still pass.
Stock-output comparisons covered 12 printers × 3 jobs plus 17 project
files and produced G-code identical to `main` when the new feature was
not configured.
The belt projection correction and its regression coverage are included
in the latest update. Please use the checks below for the current head's
build and test status; earlier successful runs do not substitute for
validation of a new revision.
Review also compared CLI output against `main` across stock printers and
multi-filament projects. The compatibility regressions found during that
review—including stock Bambu cutter motion, preset dirty state,
unintended bed-area brim/support changes, tool-change Z restoration,
stale post-change origins, arrange rejection, router cost, locale
parsing and bed-edge brim clipping—have been addressed.
## Known limitations and follow-up work
The implementation deliberately favors conservative safety. A false
positive or some unused build volume is preferable to emitting a
movement that may collide with the machine. Collision warnings are not
an automatic repair or a guarantee of safe output.
- Skirts and draft shields are not regenerated or detoured around
collision volumes. The final checker can report an intersection, but
producing a valid closed loop around internal obstacles while remaining
inside the bed needs a dedicated solution.
- Extrusion paths are checked but not rerouted.
- Spiral Z-hop's circular XY sweep is generated after the primary travel
route has been planned. That sweep is not currently rerouted; the final
G-code checker can report a collision, but does not repair it.
- Orca cannot infer movement hidden inside an opaque firmware macro. A
deterministic macro endpoint should be exposed with explicit `G90`/`G91`
and `G0`/`G1` motion in Orca's custom G-code so the following travel can
be routed from a known position. Movements inside custom G-code are
checked, but only the generated travel after them is rerouted.
- Negative model parts are not applied to the raw object-intersection
mesh, so geometry removed only by a negative part can produce a
conservative false positive.
- Multi-nozzle object validation applies every relevant nozzle's volume
to the complete object rather than only its visibly painted surface.
- Support shared by several instances uses a conservative union of
relevant plate-space exclusions.
- Support avoidance trims or steers generated geometry but does not
perform structural support re-planning. Support above a raised volume
may resume over a void; native tree-support paths not using
TreeSupport3D are not yet volume-aware.
- Raised-only collision volumes are not yet fully represented in
prime/wipe-tower placement validation; the final G-code checker remains
the safety backstop.
- Existing cross-object support-to-support overlap behavior is outside
this PR.
- “No tool selected” carriage-only exclusions are not represented by
Orca's current backend and remain a possible future extension.
## Origin
This work began with the [Muon3D
M1](https://www.youtube.com/watch?v=jBatFQpTM6g), whose notched glass
bed leaves usable print volume above a low obstruction. Upstreaming the
capability lets other printers describe low clips, raised docks,
toolchanger hardware and per-tool clearance limits without requiring a
permanent fork.
Thank you to everyone who tested the implementation, reviewed the
architecture, identified regressions and helped improve the test
coverage—especially the multi-tool and macOS testers. Further
real-hardware feedback remains welcome, but the current implementation
and compatibility behavior are ready to merge.
Harry Loud
Muon3D
# Description
<!--
> Please provide a summary of the changes made in this PR. Include
details such as:
> * What issue does this PR address or fix?
> * What new features or enhancements does this PR introduce?
> * Are there any breaking changes or dependencies that need to be
considered?
-->
Fixes#16693. After slicing, the Preview listed layer pauses one or more
layers too high, and with two adjacent pauses one of them showed as
layer 0. The G-code was always right: every pause is written at the
correct height, before the correct layer. Only the Preview's layer
numbering was wrong.
## Cause
When the G-code processor reads a pause, color change or custom G-code
tag, `OptionsZCorrector::set()` stores the index of that vertex in the
move list. At the first extrusion after it, `update()` moves the vertex
to that point so it renders at the new layer's height.
A pause (and a color change) first flushes the time planner. The flush
inserts actual speed moves ahead of the flushed blocks' moves, which all
come before the vertex, so the stored index goes stale and points at an
earlier move: the previous layer's last extrusion. `update()` then moves
that extrusion past the travel to the next layer, with its old layer id,
and erases a real move. The erase also shifts every later move down one,
so the time blocks still queued for the travel and unretract after the
pause point one move off; a Debug build trips
`assert(curr_move.actual_feedrate == 0.0f)` in
`TimeMachine::calculate_time` on a Marlin profile.
This has been possible since actual speed moves were added. It became
visible with the belt printer change that renumbers the Preview's layers
on every change of a move's layer id (`f64b49ab52`): the out-of-order
move now turns into two extra layers, the layer heights stop being
sorted, and the legend's lookup misses. 2.4.2 is not affected.
## Changes
- `OptionsZCorrector::on_moves_inserted()`, called at the end of
`GCodeProcessor::calculate_time`, shifts the stored index by the moves
the flush inserted before it, read from the block id map the same
function already builds for the queued blocks.
- `OptionsZCorrector::update()` returns the index it erased, and
`process_G1` moves the queued blocks after it down by one.
No change to the G-code, the time estimates of prints without pauses, or
project files.
# Screenshots/Recordings/Graphs
<!--
> Please attach relevant screenshots to showcase the UI changes.
> Please attach images that can help explain the changes.
-->
The reporter's cube with pauses at layers 55 and 56 (Z 11 and 11.2):
main lists them at layers 56 and 60 and shows 132 layers for a 128-layer
print; with this change they are at 55 and 56, and the slider shows 128
layers.
Before:
<img width="480" height="560" alt="legend-before-main"
src="https://github.com/user-attachments/assets/d9604038-91c0-4574-8496-a7d9f49268cf"
/>
After:
<img width="480" height="560" alt="legend-after-fix"
src="https://github.com/user-attachments/assets/0ad4be7e-a258-4eaa-ae94-8eb66ef01fae"
/>
## Tests
<!--
> Please describe the tests that you have conducted to verify the
changes made in this PR.
-->
- New test in `tests/fff_print/test_gcodeprocessor.cpp`, "A pause keeps
the moves around it in order and on their own layers": three layers with
a pause before the second; checks the pause's height and that layer ids
and G-code lines never go backwards. It fails on main (the pause stays
at Z 0.2 and a layer-0 extrusion lands after layer-1 moves) and passes
with the change.
- `fff_print` suite passes (484 tests, Release, Linux), including the
`[GCodeTiming]` cases.
- On Linux, sliced the issue's project with one and two pauses on the
Anycubic Kobra 3 (Klipper) profile and checked the Preview legend and
layer slider. Marlin is covered by the new test, which runs the
processor with Marlin.
- clang-tidy check passes.
<!--
> A guide for users on how to download the artifacts from this PR.
-->
[How to Download Pull Requests Artifacts for
Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
merge_tcr formatted the feedrate of the travel that joins two wipe tower
blocks with std::to_string, which follows the numeric locale. The GUI slices
on a thread that keeps the user's locale, so a comma-decimal locale wrote
moves such as 'G1 Y249.463 F5400,000000', which Klipper rejects. Format it
with float_to_string_decimal_point like the X and Y beside it; the output in
the C locale is unchanged.
The comma-locale test helper moves to the shared test header so the wipe
tower test can use it.
When a saved prime tower position no longer fits the estimated tower, the
load-time clamp moved it to the comfort-margin bound with no regard for the
objects on the plate, and stored it without telling the user. A tower saved
in a corner could land on the model and produce a G-code conflict the user
never caused.
The GUI reload clamp and the CLI pre-slice clamp now keep the re-placed spot
only when it is clear of every printable object and its brim. Otherwise they
take the clear spot nearest the saved position, keeping the comfort margin
where the plate allows, and only fall back to the old spot when no space is
left. The GUI shows a notification whenever a saved tower is moved, and the
CLI logs a warning.
The G-code processor remembers where a pause, color change or custom
G-code vertex sits in the move list, so it can move that vertex to the
first extrusion after it. A pause flushes the time planner first, which
inserts actual speed moves ahead of the vertex, so the remembered index
pointed at an earlier move: the previous layer's last extrusion was
moved instead, a real move was erased, and the time blocks queued after
the vertex were left one move off.
Shift the remembered index by the moves each flush inserts before it,
and shift the queued blocks after the erase. The Preview numbers layers
from the move order, so the stray move showed up as extra layers and
listed pauses on the wrong layer.
* Shorten the travel between extrusion paths
chain_and_reorder_extrusion_entities() builds the print order of the infill,
ironing and support paths of a region from the nozzle position. It took the
greedy chain, which leaves its longest joins for last; it now shortens it:
- Up to eight paths, chain_segments_exact() finds the shortest chain over
every order and allowed reversal, by dynamic programming over the subsets
of paths, with a fixed start and a free end.
- Longer chains are refined by local search: 2-opt, or-opt of up to three
paths, and moving a run of any length next to the nozzle to the front, each
tried only toward the 32 end points nearest a link, which come from a
uniform grid. A move is applied only if it shortens the chain, so the result
is never longer than the greedy one.
- A nearest-next chain is built too, and refined and used instead when it is
already shorter than the refined greedy chain, which happens when the greedy
chain sweeps away from the nozzle and has to come back with a long jump.
The shared greedy chaining also chains two to four segments exactly, which
covers the islands of a layer and the loops of a perimeter collection. Paths
that cannot reverse, such as Grid's, are only reordered, and collections that
keep their order are left alone. The overload without a start point keeps the
greedy chain.
Co-authored-by: Tobias Gloth <tobias.gloth@3dsystems.com>
* Order objects and islands along shorter tours
Objects under print_order Default, and the tour of islands across objects, are
visited in the same order on every layer, so chain_points_with_postprocessing()
orders them as a closed tour. Up to ten points, tsp_exact_cycle() finds the
shortest tour by dynamic programming over subsets, starting at the point
nearest the start point when one is given. Larger sets add or-opt to the
existing 2-opt and crossing removal: runs of up to three points move next to
one of the eight points nearest an end of the run, reversed or not, and
crossing removal runs last so no crossing is left. Snake ordering is
unchanged; Best of strategies gets the shorter Default tour as a candidate.
* Join infill lines into fewer paths
Every separate infill path costs a travel to it, so the fill generators now
leave fewer of them:
- connect_infill() pairs the line ends along each wall in the order that
joins the most lines: besides shortest arc first, it replays arcs of about
the same length taken along each contour, forwards and backwards, including
the last pass that joins neighboring open ends, and keeps the order that
joins the most. Regular patterns no longer leave loose ends where the
pairs along a wall fall out of step, and multiline copies print out and back.
- Ends whose anchors would meet are joined along the wall instead, up to two
anchors and a line width apart.
- An unpaired end anchors toward the nearest open end of another path, where
the next path usually starts, instead of the side with more free wall. With
multiline infill, an anchor toward a copy of the same line stops short of
the copy instead of printing over it.
- Last, sparse infill lines whose ends are at most two line spacings apart are
joined with a straight piece, shortest first, without closing a loop or
crossing a line; with anchors off this is the only joining. Copies of
neighboring multiline groups are joined at the same side, and lines that
cannot reverse only join end to start.
* Describe the travel optimization design
How the extrusion chains, the object and island tours and the infill line joining shorten the travel, and why each part is built the way it is.
---------
Co-authored-by: Tobias Gloth <tobias.gloth@3dsystems.com>
The G-code editor lists the Print Statistics placeholders for every
custom G-code field, but total_weight, used_filament, total_cost,
print_time, normal_print_time, silent_print_time,
total_wipe_tower_cost and total_wipe_tower_filament were only defined
for filename_format. Using one in custom G-code, including the File
header G-code, stopped slicing with "Not a variable name".
They are known only once the whole G-code is generated, so they use the
reserved-tag mechanism of print_time_sec and used_filament_length: the
placeholder parser gets a tag such as @TOTAL_WEIGHT@ and
GCodeProcessor::run_post_process() replaces it with the same value
filename_format gets, with numbers written to two decimals. The
per-tag replacement loops are folded into one helper. The running
extruded_* totals are unchanged.
Fixes#15320Fixes#7870
With ooze prevention on, an extruder that has no layers left is set to 0 °C when it is parked, instead of its standby temperature. On IMEX printers where several filaments share one heater, the heater is only turned off once every filament on it is done.
* Export G-code statistics as JSON
Add an export of a plate's G-code statistics for scripts and
spreadsheets that compare prints or settings: print time, travel,
filament and feature totals, the same per layer, and the filament of
each object instance and its supports. The times are the preview's
estimates, summed the way the preview sums them.
The GUI writes <name>.statistics.json next to an exported G-code when
"Export statistics with G-code" is enabled in Preferences (Control >
Slicing). The CLI writes plate_N.statistics.json to the output directory
with --export-statistics, and exits with -25 when it cannot.
The per-instance masses now carry the object's name and the instance's
index, so the export can name them. The vertices the processor adds
inside a move for the actual speed view repeat the move's extrusion, so
the filament sums skip them.
* Move the statistics export preference to the Developer tab
"Export statistics with G-code" now sits in Developer > Settings
instead of Control > Slicing.
* Store the G-code statistics inside exported 3MF files
With the preference on, an exported sliced 3MF file holds each plate's
statistics as Metadata/plate_N.statistics.json, next to its G-code. The
print job sent to a printer and the autosave backup leave them out.
The CLI does the same with --export-3mf, and writes the separate file
only next to the G-code in --outputdir, as without it the G-code is a
temporary file. The file is written in binary mode, so it reads the
same on every platform and matches the copy in the 3MF.
* Address review of the statistics export
- Number each object instance by its position among its model object's
copies. A copy of another rotation or scale, and every copy on a belt
printer, slices as a print object of its own, where it was always
instance 0; a copy after a non-printable one shifted too.
- Take the filament totals from the processor's statistics, which count
the flush as the preview's filament table does, and list each
filament's model, support, prime tower and flush use. The summary's
cost is now filament_cost, as the preview's cost adds the time cost.
- State when the version goes up.
- Drop the preference's default, which get_bool already gives.
* Precise Seam: new full-coverage policy for Seam Blocked
A Seam Blocked modifier that covers a whole perimeter now blocks it, like a
perimeter painted red all round, instead of being skipped. It overrides
painting and lower-priority modifiers, like Enforced and Neutral. A new
warning names the modifier: "Seam Blocked modifier "<name>" of "<object>"
covers an entire perimeter". It is shown only when a perimeter stays
entirely Blocked after all weak modifiers. The full-containment warning now
covers only Center, Left and Right.
* Precise Seam: fix seams on perimeters blocked all round
- SeamComparator::is_first_not_much_worse() compares the types first, so two
Blocked candidates fall through like Neutral ones. On a perimeter blocked
all round, by a whole Seam Blocked modifier or by red painting, Random put
the seam on the closing vertex of every layer and Aligned stopped aligning.
- The whole-perimeter Blocked warning flags only the highest whole zone, the
one in effect. A lower whole zone it overwrites is no longer reported, and
the candidate scan runs only when that zone is Blocked.
- The warning msgids take the type name from the menu's "Seam Blocked" msgid.
- PreciseSeamWarnings::set() shares the load-before-store idiom, and every
weak segment records its modifier.
- Tests: a whole Blocked perimeter gets the seams of an unmarked one under
every seam position; overwritten whole Blocked zones are not reported.
---------
Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
The time estimate added 260 s for every G29 on non-Bambu printers. Prusa MK4, MK4S and CORE One start G-code splits bed leveling across six G29 commands, so those printers showed about 26 extra minutes. The 260 s is now added once per G-code processing run. Bambu printers still only count a G29 inside an M622 J1 block, and their estimates are unchanged.
Fixes#15088
Print::validate sizes the pre-slice prime tower from Print::extruders(),
which lists every mixed filament slot under its own id, so the estimator
planned one purge block per slot. The tool ordering resolves a mixed slot
to one physical component on every layer, with or without colour
sublayers, and the generated tower only purges those. The GUI preview and
its placement clamp already expand the slots, so the tower was drawn
inside the bed and then refused as partially outside it: with 8 mixed
slots at 0.08 mm layers the estimate was 114 mm for a tower that prints
at 64 mm.
The estimator now expands mixed slots to their components itself, so
validation, the GUI and the CLI placement size the same tower.
* Add orca-translations Claude skill and PO tool
Add a .claude skill that guides translation passes over the localization/i18n gettext catalogs. It covers the workflow: run gettext, settle new glossary terms, translate in batches, verify, and report.
Includes translation-rules.md, which condenses the placeholder, line-break and glossary rules plus the guidance on review notes.
Also adds scripts/po_tool.py (standard library only). It lists pending entries with glossary hints, validates and applies translations, adding '# AI Translated' and '# Needs human review' comments, and rewrites only the entries it changes. It can also check catalogs, look up existing translations, suggest glossary candidates and update the wiki glossary TSV.
* Let po_tool apply translations by entry id
pending now gives each entry a short id, so a translation file can name
entries by id instead of repeating the English msgid. apply accepts either.
A "review": "" item clears an earlier review note when overwriting an
entry, and check gives each msgfmt run its own temporary output file so
parallel checks do not collide.
* Fill all empty translations
Regenerate the template with run_gettext --full and translate every empty
entry in the 22 catalogs (7,089 entries) with the orca-translations skill,
following the localization glossary, including the new belt printer,
IDEX/IQEX and plugin terms. Every new entry is marked "# AI Translated";
122 also carry "# Needs human review" with what to check.
* Show entry ids in po_tool lookup and search translations
lookup now prints each entry's id, so an entry found there can be
rewritten with apply --overwrite without repeating the English, and
--msgstr searches the translations instead of the msgids, which finds
every entry that still uses a term being changed.
SKILL.md describes how to change an established term: check the
catalog's usage first, update the glossary cell, then rewrite only the
entries where the term has that meaning.
* Fix mistranslated terms and align catalogs with the glossary
Correct labels that the glossary had copied, and the entries that used
them:
- ca: Raft was rendered as the Brim term; it is now "Rai". Exhaust fan,
Monotonic line, Unretract, Slice, Lateral Honeycomb and PA Tower
labels fixed.
- cs: Lightning infill is "Blesk", not "Osvětlení" (illumination).
- sv: Retraction is "Retraktion", not "Reduktion"; Unretract,
Lagerhöjd, Delkylningsfläkt, Utsugsfläkt, Aligned Rectilinear and the
Preset label fixed.
- de: Brim is "Rand" and Skirt is "Umrandung", as most entries already
had them.
- lt: brim entries used the Skirt word "apvadas"; they now use "kraštas".
- es: Sparse infill is "relleno de baja densidad", the catalog majority.
- eu: nozzle wipe is "garbiketa", not purge.
- th: the project plate is "เพลต", distinct from the bed.
- uk: Quarter Cubic, Latin "PA" in PA Tower, and Belt purge tower.
- pl: Cross Hatch, Tri-hexagon, Volumetric speed and Raft labels.
- zh_TW: Brim stays "Brim", as the existing labels have it.
- tr: "Prime Tower" read "Prime Minister Tower".
- ko: the plugin "Capabilities" label read "performance".
- Build Volume labels fixed in tr, de, cs and eu.
All 242 rewritten entries are marked "# AI Translated".
* Make more UI text translatable and fix pluralization and context
Audit the sources for text that translators could not translate
correctly and fix it.
Mark text that reached users in English only: IDEX/IQEX role names,
plugin permission prompts and errors, 3MF/preset loading errors, G-code
placeholder parser errors, calibration and device messages, notification
texts, file dialog filters, and the config validation messages.
Replace sentences built from translated fragments, such as the prime
tower warnings, "left"/"right" nozzle names, and "Filament " + number,
with single msgids that have placeholders, so translators can reorder
and inflect them.
Use plural forms for texts with a count ("%1% mixed filaments",
"%d objects", "%1% triangles") instead of "(s)" and mismatched verbs.
Fix the swapped singular/plural pair in "The following presets inherit
this preset".
Add translation contexts where one English word has several meanings
(Subscribed/Local, Standard, Pause, View, Step, Model, Camera, Flow,
Filter, Others, Prepare, the Design tools). Show "Size" instead of
"Build Volume" in the Cut tool, which displays the object size.
Fix code that compared translated text with English (the Edit G-code
dialog group, the plugin registration failure check), and add the
bundled web pages' missing string-table entries. Use the single
character for degrees Celsius, say "G-code", and describe the head
filament map without internal jargon.
Install the libslic3r translate callback before the presets load, so
their load errors are translated, and list the 28 source files that had
marked strings but were never extracted into localization/i18n/list.txt.
* Suggest earlier translations and list fuzzy entries in po_tool pending
pending now attaches the closest earlier translation of a similar
English text (from obsolete or translated entries), so a reworded or
split string keeps its wording, and it lists fuzzy entries by default,
since users never see them. A fuzzy entry also carries its stale
translation as previous_translation.
* Fix wording of the non-boolean operands error
The logical operation error said "operators" where it means the
operands the operation was applied to.
* Translate the newly translatable strings in all languages
Regenerate the template after the translatability changes and fill every
new or changed entry in the 22 catalogs (about 12,800 entries): the
strings that became translatable, the plural forms, the entries split by
context, and the previously fuzzy singular entries that became plurals.
Every new entry is marked "# AI Translated", and about 360 also carry a
"# Needs human review" note saying what to check. Terms follow the
localization glossary. Earlier translations of reworded strings were
reused where the meaning was unchanged. Existing entries were not
changed, and obsolete entries are kept.
* Document the source translatability audit in the orca-translations skill
Add a reference describing how strings reach translators, what to look
for (untranslated text, spliced sentences, missing plurals, ambiguous
words), what not to translate, where a context cannot be carried, and
what to do after the edits, plus a scanner that lists untranslated
user-facing string literals.
* Document how to write translatable strings in AGENTS.md
Tell developers to keep each message complete in one msgid: use
placeholders instead of concatenating translated fragments, plural forms
for counts, and contexts for ambiguous words, and to list new source
files in localization/i18n/list.txt. Add a matching code review item.
* Translate the strings added since the rebase
Regenerate the template against the current main and translate the 26
new entries per language: the Fix Model commands and messages, and the
texture displacement image adjustment panel. Each new entry is marked
"# AI Translated"; existing entries are unchanged.
* tidy
Opened or drag-dropped G-code files ignored `; MANUAL_TOOL_CHANGE` comments, so the preview showed every move on the first filament. Only `apply_config(const PrintConfig&)` read `manual_filament_change`, and loading a file goes through `apply_config(const DynamicPrintConfig&)`. Read the option there too, initialize the flag to false, and add a regression test.
FanMover could split a move inside change_filament_gcode to place a delayed fan command. It computed the split point from the last position the G-code set, but on Bambu printers the firmware moves the head during the T command, so the inserted waypoint sent the head to a spot the template never visits (#15789).
Both toolchange paths, set_extruder() and the Type1 append_tcr(), now wrap the template output in ;_FAN_MOVER_SKIP_START/END tags when fan speed-up or kick-start is on. FanMover keeps fan commands inside them where they are and drops the tags from the output. multifilament_config() also sizes the per-filament options that the wipe tower reads by index.