Commit Graph
12 Commits
Author SHA1 Message Date
Clifford 98b67a0227 Widen the post-slice extruder masks to 64 bits (#17002)
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.

(cherry picked from commit 5ea64864ef)
2026-11-01 09:53:53 +08:00
TheLegendTubaGuy 89fa736737 Fix center of mass details, belt preview and section view bugs (#16958)
* 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.

(cherry picked from commit e66569a966)
2026-11-01 09:53:53 +08:00
Clifford 46ede196f2 Fix false "G-code path exceeds the printable range" when an extruder area is inset on several sides (#16931)
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

(cherry picked from commit b7ecf1b295)
2026-11-01 09:53:53 +08:00
Hanif Koh 7b05bc5ea1 Keep Layer Pauses on Their Own Layer in the Preview
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.
2026-10-21 13:50:40 +08:00
hikaru0602 b920116fbd Fix manual tool change handling when loading G-code files (#15379)
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.
2026-10-12 20:03:04 -05:00
0f3e8fbf27 Add center of mass markers to Prepare and Preview (#16291)
Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
Co-authored-by: Kris Austin <kris.austin@gmail.com>
2026-10-09 16:48:48 -03:00
e0b35f9ec9 Fix garbled G-code preview when a post-processing script is used (#15005)
* Rebuild the G-code line offsets after post-processing scripts run in place

* Clamp the G-code window reads to the mapped file size

* Add tests for rebuilding the G-code line offsets

* Include <mutex>, <ios> and boost/filesystem/operations.hpp where they are used

* Keep the preview's G-code lines and highlight in step with post-processing scripts

---------

Co-authored-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
2026-10-09 23:08:43 +08:00
Kris Austin e098c933f0 perf: write post-processed G-code without per-line copies to speed up export by up to 6% (#16167)
* perf: write post-processed G-code without a per-line copy

* perf: size the post-process line map from the first pass

* test: line ends of the exported G-code

* test: include the headers the line-ends test and gcode() helper use
2026-10-06 07:50:08 -03:00
HanifKoh 5a95ba4bd5 Add Missing Includes to Code Merged Since the Include Cleanup (#16106)
* Add Missing Includes to Code Merged Since the Include Cleanup

* Add Missing Includes to Code Merged Since the Previous Sweep
2026-10-04 14:50:15 +08:00
Kris AustinandRodrigo Faselli 6e0f04815b perf: speed up G-code export by up to 7% via post-processing fixes (#16031)
Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
2026-10-03 13:29:55 -03:00
HanifKoh 84657ff11e Add Missing Includes Across the Remaining Sources and Tests (#16071)
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy

Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.

* Ignore minilzo's Config Headers in clang-tidy

lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.

* Add Missing Includes Across the Remaining Sources and Tests

Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.

* Make the GUI and Test Headers Compile on Their Own

Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.

* Keep Windows and nanosvg Setup Ahead of the Added Includes

OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.

* Add the GUI Includes the First Pass Missed

Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.

* Keep the Added Test Includes Below the NOMINMAX Guard

test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.
2026-10-03 13:45:21 +08:00
Kris Austin b4b4438a47 fix: custom G-code keyword check uses the wrong list and skips the editor (#14908) 2026-09-20 10:24:55 -03:00