Commit Graph
993 Commits
Author SHA1 Message Date
Kris Austin 2054242884 Fix Creality print host hanging on a printer that stops answering (#16772)
ws_connect(), query_boxes_info() and start_print() set expires_after()
deadlines, then made synchronous Beast calls. Beast only applies those
deadlines to async operations, so none of them fired. A printer that
accepted the websocket and then stopped answering blocked the caller
forever. That froze the GUI thread when the Creality send dialog opened
or the sidebar synced filaments, and left uploads stuck after the file
arrived.

Run every websocket call as an async operation on the local io_context,
so the deadlines apply. run_until_done() and the per-address connect
loop move from MoonrakerPrinterAgent.cpp into AsioUtils.hpp, and both
files share them. Each resolved address gets its own connect deadline,
and start_print() gets a reply deadline for its commands. A start-print
timeout shows the translated timeout message that HTTP timeouts already
use, now shared through PrintHost::timed_out_message(), and other
websocket errors drop Boost's source location.

The websocket port and deadlines move into a protected ws_settings
member, so the tests can use a local port and short deadlines. The new
tests run CrealityPrint against a fake printer that goes silent before
or after the handshake.
2026-10-24 22:01:15 -05:00
Eric Lin a07bc8ff5b Fix out-of-bounds config reads in the Type1 prime tower (#15183)
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.
2026-10-24 16:21:32 -05:00
Kris Austin f2037c1d48 Build OpenCV against Orca's libpng (#16828)
OpenCV compiled its bundled libpng 1.6.37 into opencv_world, so glTF
textures decoded with cv::imdecode and images loaded with cv::imread went
through that copy instead of the libpng the rest of Orca uses. Turn
BUILD_PNG off and depend on dep_PNG, the same way libjpeg is shared.

0002-clang19-macos.patch only patched the bundled copy's pngpriv.h,
which is no longer compiled, so drop it.
2026-10-24 16:11:01 -05:00
HanifKoh ca51cba597 Refuse a Filament Flow Ratio of 0 Instead of Writing NaN Extrusion (#16719)
A used filament with a flow ratio of 0 sliced in the GUI and wrote
E-92233720368547.758 on every extrusion move: GCode::_extrude multiplied
the flow by the ratio and divided by it again, giving 0 * 0 / 0 = NaN.
The CLI already rejected the value through the config check, but
Print::validate never looked at it.

Print::validate now stops the slice with an error naming the filament
when a used filament's flow ratio is 0 or nil, and _extrude converts the
flow to extrusion length with the bare filament cross-section, so the
ratio is applied once without a divide.
2026-10-25 03:39:51 +08:00
Ian Bassi 258ddc15e8 Fix a crash from the Russian extruder range warning, and check plural placeholders in CI (#16815) 2026-10-24 15:44:49 -03:00
SoftFever 3d3771f420 Merge branch 'main' into RJAudas/fix-kobra2-layer-markers 2026-10-25 02:00:54 +08:00
SoftFever 54afdaf887 Merge branch 'main' into fix/plugin-network-permissions 2026-10-24 23:58:51 +08:00
SoftFever b4a2eb8803 Merge branch 'main' into feat/plugin-wildcard-permissions 2026-10-24 23:14:26 +08:00
Damir GaleevandIan Bassi 09761a3136 Fix seam alignment, contour continuity and painted boundaries (#16447)
Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
2026-10-24 11:10:48 -03:00
Ian Bassi b1846e3408 Add top and bottom paint penetration layers (#16818) 2026-10-23 19:49:08 -03:00
TheLegendTubaGuyandSoftFever d7224f700a fix: CLI keeps a project's values when it lists no changed settings (#16703)
* fix: CLI keeps a project's values when it lists no changed settings

A project whose different_settings_to_system is missing or empty in
every entry does not say which of its values were changed: the GUI
saves it that way both when its presets match their parents and when
it cannot find those parents. The CLI still refreshed every unlisted
printer, process and filament key from the system presets, so such a
project sliced with system values instead of its own, e.g. with
supports turned off, and exited 0.

A plain run now keeps the stored values of such a project and only
fills the keys it lacks from its system printer and process presets.
Projects that list changes follow the existing rule, and --uptodate
still refreshes.

Fixes #16698

* fix: CLI fills missing filament keys of an unlisted project from its presets

Without any entry in different_settings_to_system, a plain run skipped
the filament refresh, so filament keys the project lacks, e.g. options
added after it was saved, fell back to the option defaults while
missing printer and process keys came from the system presets.

The filament presets are resolved again for such a project, and each
refreshed filament keeps every key the project has, mapped onto the
system preset's extruder variants; only the keys it lacks come from
the preset. The filament_dev_* values the project has are kept too,
unless a filament is loaded from a file. The test removes two filament
keys and a filament_dev key from the unlisted project.

---------

Co-authored-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
2026-10-24 04:38:27 +08:00
Ian Bassi 7319a2c54c Draw translucent filaments translucent in Preview (#16776) 2026-10-23 17:14:09 -03:00
Ian Bassi 5869d227b4 Fix features printing with the wrong filament and idle tool changes in filament for features (#16805) 2026-10-23 17:13:35 -03:00
Damir GaleevandIan Bassi 54e89cab74 Fix seam placement on overhanging outer walls (#16334)
Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
2026-10-23 16:59:06 -03:00
peachismomo de6861bb38 fix: tests 2026-10-24 01:40:28 +08:00
Ian Chua bc39752fa2 Merge branch 'main' into feat/plugin-wildcard-permissions 2026-10-23 23:27:17 +08:00
Ian Chua 7073bbb09c Merge branch 'main' into fix/plugin-network-permissions 2026-10-23 23:25:47 +08:00
SoftFever 30ceeee18d Fix the Newer 3MF Warning for Alpha and Beta Projects in Nightlies (#16791)
# 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)
2026-10-23 18:47:11 +08:00
Ian Chua 9739d3a9c4 fix: reject symlink and resolve relative paths to absolute 2026-10-23 16:48:34 +08:00
Hanif Koh c15d401a5d Include the Catch2 Message Header in the Semver Test 2026-10-23 16:28:34 +08:00
Hanif Koh a8d73e6456 Rank Dev Builds Above Alpha and Beta
Nightlies stay on x.y.z-dev after the alpha and beta are tagged, so
ranking dev below every prerelease made each alpha or beta project look
newer than the nightly that should open it. Dev now ranks above the other
prereleases of its version and below the release.
2026-10-23 16:20:45 +08:00
Ian Chua 3bb40bc007 Merge branch 'main' into feat/plugin-wildcard-permissions 2026-10-23 16:15:30 +08:00
Ian Chua a131aa1124 Merge branch 'main' into fix/plugin-network-permissions 2026-10-23 16:13:12 +08:00
Ian Chua 6a0223f055 fix: Tighten plugin network grants and clarify consent scope 2026-10-23 16:12:57 +08:00
Hanif Koh 19eb55d3e5 Stop Saving silent_mode
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.
2026-10-23 16:08:47 +08:00
Lam Wei Lun 71ee9c7379 Make the locale test check the wipe tower's BBL tags
GCodeProcessor::s_IsBBLPrinter is reset by export before the test asks for the tag names, so reserved_tag() returned the main G-code's ;HEIGHT: / ;WIDTH: spellings and the scan never saw the tower's lines. Use the literals the writer emits, and generate de_DE in the Linux test job so the case stops skipping there.
2026-10-23 15:50:14 +08:00
Lam Wei Lun e1d613096d Keep a Decimal Point in the Wipe Tower's Flow Tags
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.
2026-10-23 15:50:14 +08:00
Ian Chua 0439578fca Merge branch 'main' into fix/plugin-network-permissions 2026-10-23 13:56:09 +08:00
Ian Chua 557feba649 feat: introduce plugin APIs for mutable presets (#16518)
* feat: introduce plugin APIs for mutable presets

* fix: tests

* fix: tests

* doc: HLSD for preset plugin APIs

* feat: preset APIs

* fix: remove async behavior and clang-tidy

* fix: update demo plugins
2026-10-23 13:54:08 +08:00
SoftFever 19e42d8dce Keep the bed at first-layer filament temperatures with By Highest Temp 2026-10-23 01:42:08 +08:00
Ian Bassi 373ffaa13f Add a Sparse infill only mode to Arc fitting (#16747) 2026-10-22 12:51:44 -03:00
Kris Austin 3f8ff53e65 Keep keys away from the 3D view while ImGui has the keyboard (#16673)
The 3D view decided whether to run its shortcuts from ImGui's "wants the
keyboard" flag, which is updated a frame late. The first key typed after
clicking into a field could still reach the canvas.

The canvas now leaves every key to ImGui while an ImGui text field is
active, while a popup (dropdown, menu or modal) is open, or while a
slider or button is held with the mouse. A focused sidebar text field
works the same way. Global shortcuts still run unless they edit text.
Every key still goes to ImGui.

- ImGuiWrapper::claim_key_event() decides on the key-down. The key's
  repeats, char event and release follow that decision, so a key never
  both runs a shortcut and types.
- Esc closes an open dropdown or menu before the gizmo.
- Esc and Tab during a slider drag no longer close the gizmo or switch
  views.
- text_input_active() reads ImGui's text input request, so a slider
  that once had a value typed into it no longer counts as a text field
  when dragged.
- A modifier whose key-up went to a dialog no longer stays stuck. The
  canvas releases held modifiers when it loses the focus, and ImGui
  takes its modifiers from each mouse event.
- The macOS Edit menu's key equivalents follow the same rule.
2026-10-22 10:22:23 -05:00
SoftFever f92f75e0fa Feat: Add multiple and 3D bed exclusion volumes (#13777)
# 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
2026-10-22 22:04:40 +08:00
Ian Chua 2410112046 feat: add wildcard permissions for fs 2026-10-22 20:49:57 +08:00
SoftFever 7f201f4dba Bake one continuous texture across every part and stop Close from crashing
Removing a layer clears its paint on every part, tiled and view-projected
textures run on across parts, the projection tools paint every visible part,
relief under a raised part reaches down to where the object rests, and closing
the tool no longer crashes the app.
2026-10-22 18:27:32 +08:00
SoftFever 639ed05884 Merge branch 'main' into fix/arrange-scale-fit-lay-on-face 2026-10-22 15:59:09 +08:00
SoftFever 43c76f1f52 Keep Layer Pauses on Their Own Layer in the Preview (#16718)
# 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)
2026-10-22 15:00:12 +08:00
SoftFever db1824dd5d Speed up slicing of finely detailed models (#16741)
# Description

Slicing finely detailed models such as HueForge reliefs is up to twice
as fast. Two steps that ran on a single core
dominated these slices. G-code export spent most of its time working out
which object each extrusion belongs to, and
internal bridge detection stalled for tens of seconds on layers printed
over fully dense infill. On the relief
"Mensch oder Gott 2", the slice goes from 108 s to 54 s on an M5 Max and
from 116 s to 65 s on Windows.

Over a lower layer printed at full density, bridge detection now settles
most layers with a cheaper check before it
falls back to the full computation. That check can disagree with the
full computation in one case, which is accepted:
a solid sliver thinner than about 16 µm that Clipper's own offset
simplification folds. There, internal bridges can
come out differently from main.

No change to slicing output on any project tested. G-code and object
masses are identical to main.

# Screenshots/Recordings/Graphs

<!--
> Please attach relevant screenshots to showcase the UI changes.
> Please attach images that can help explain the changes.
-->

## Tests

New unit tests compare the bridge-detection helper with the full
computation, and cover the box-only island lookup.
Main and this branch were compared on the projects below. They were also
compared on OrcaCube variants that set each
density option below 100%, plus a spiral vase, a crowded plate and a
two-part assembly. Every case slices to
byte-identical G-code, ignoring the timestamp line, and to identical
object and body masses. Slice times are for the
CLI, two runs each, on an M5 Max:

| Project | main | this PR |
|---|---:|---:|
| Mensch oder Gott 2 | 107.7 s, 108.8 s | 54.3 s, 54.4 s |
| Stranger Things 169×250 | 100.6 s, 100.6 s | 65.2 s, 66.0 s |
| RDR Front 229×256 | 12.6 s, 12.6 s | 8.6 s, 8.6 s |
| Lupo+AMS | 13.0 s, 13.1 s | 10.0 s, 10.0 s |
| Eagle 200×200 | 34.6 s, 34.0 s | 33.7 s, 34.0 s |

and on Windows with an Intel Core Ultra 7 270K Plus (Release build,
clang-cl), where the G-code is identical to main's
too:

| Project | main | this PR |
|---|---:|---:|
| Mensch oder Gott 2 | 121.2 s, 111.7 s | 68.2 s, 61.0 s |
| Stranger Things 169×250 | 100.7 s, 93.0 s | 59.7 s, 65.1 s |
| RDR Front 229×256 | 13.9 s, 13.4 s | 10.3 s, 10.1 s |
| Lupo+AMS | 19.9 s, 13.9 s | 20.9 s, 11.4 s |
| Eagle 200×200 | 38.9 s, 37.5 s | 38.1 s, 37.1 s |

Eagle uses about 15 s less CPU on both machines, but its export is bound
by G-code generation, so its slice time does
not change. Lupo's first run on Windows was slow with both builds. Peak
memory is the same within run-to-run spread,
except that it is about 0.1–0.2 GB higher on Stranger Things on the M5
Max and about 0.1 GB higher on Mensch oder Gott 2
on Windows.

<!--
> 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)
2026-10-22 14:38:36 +08:00
Ian Chua 0ae2b4840b Merge branch 'main' into fix/plugin-network-permissions 2026-10-22 13:55:07 +08:00
Ian Chua 4441bcc065 fix(test): keep embedded Python alive across slic3rutils cases (#16732)
* fix(test): keep embedded Python alive across slic3rutils cases

* fix: clang-tidy
2026-10-22 13:40:14 +08:00
HanifKoh 30bfa0ef08 Only Give a Cone Wall Prime Tower a Stabilization Cone (#16726)
A Type2 tower with a rib or rectangle wall still carried the cone from
wipe_tower_cone_angle (30 degrees by default, hidden unless the wall type
is Cone) in two places that model the tower: the fake tower used by the
G-code path conflict check, and first_layer_wipe_tower_corners, which feeds
the first-layer convex hull and the skirt. On a tall tower that phantom cone
reported conflicts with objects the tower never reaches, enlarged the
first-layer print area, and could push a combined skirt off the bed.

Both now use the angle only for a Type2 tower with a cone wall, the same
rule construct_mesh and the footprint estimate already follow.
2026-10-22 13:26:53 +08:00
HanifKoh 5dc9bc6cee Keep a Decimal Point in the Wipe Tower's Travel Feedrate (#16717)
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.
2026-10-22 13:20:39 +08:00
HanifKoh 7fa9c4b4fa Move a Re-Placed Prime Tower Clear of Objects and Say So (#16728)
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.
2026-10-22 13:19:51 +08:00
Kris Austin 14a1aa333b Fix custom G-code placeholders missing on some paths and in the editor (#16680)
Some calls of the same script set fewer placeholders than the others,
so a placeholder the editor offers could stop the slice with "Variable
does not exist" on one path only:

- layer_change_gcode set max_layer_z after processing the template.
- Belt brim layers ran layer_change_gcode without
  most_used_physical_extruder_id or the mass values. Both layer change
  paths now share one helper.
- Printers that aren't bed slingers ran time_lapse_gcode with only
  layer_num, layer_z and max_layer_z. Both timelapse paths now share
  one helper for the snapshot placeholders, which picks the snapshot
  position only when the template uses it.
- The Type 1 wipe tower ran filament_start_gcode without layer_num,
  layer_z and max_layer_z, and filament_end_gcode without
  filament_extruder_id and max_layer_z. filament_extruder_id is the
  filament being unloaded, as in the Type 1 filament start G-code and
  the end-of-print filament end G-code.
- The first filament start G-code on Bambu Lab printers had no layer_z
  or max_layer_z.

The editor looks up a script's placeholder list by its option key, but
the timelapse list was keyed timelapse_gcode while the option is
time_lapse_gcode, so the editor showed no timelapse placeholders. The
list and the name passed to placeholder_parser_process, which the
placeholder validator looks up by, are now both time_lapse_gcode.

previous_extruder and next_extruder hold filament indexes, and
previous_extruder is -1 before any filament is loaded.
filament_extruder_id is the extruder index in filament end G-code at a
tool change outside the Type 1 wipe tower, and machine end G-code gets
the value from the last end-of-print filament end G-code. layer_num is
-1 before the first layer. total_wipe_tower_filament is a length in mm.
2026-10-21 15:05:16 -05:00
9b37da699b Sparse infill smoothing: round corners in equal turns, flattened to the resolution (#16694)
Co-authored-by: raistlin7447 <kris.austin@gmail.com>
Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
2026-10-21 16:08:29 -03:00
Ian Bassi 01ae2dd49a Port Bambu Studio's gap fill ordering for monotonic surfaces (#16743) 2026-10-21 16:05:44 -03:00
SoftFever 0ad175c42b Speed up internal bridge detection over fully dense layers 2026-10-21 22:47:11 +08:00
SoftFever b797ceb7fa Speed up G-code export of finely detailed objects 2026-10-21 22:12:48 +08:00
SoftFever 2e64ab3db5 Speed up brim grouping for objects with many parts 2026-10-21 19:04:43 +08:00
Lam Wei Lun 857896dc6b Make Ctrl+Q quit the application on Linux and Windows
Quit was only bound to Cmd+Q on macOS. Add a Quit entry to the shortcut
registry bound to Ctrl+Q and handle it in the global key handler, so the
shortcut reaches the app regardless of focus. The File menu shows it as
display text. The macOS-only key check is removed; Cmd+Q now goes through
the registry.
2026-10-21 17:52:48 +08:00