Skip to content

fix: brim missing when mixed filament + painted brim + local-z whole objects are all enabled#466

Open
zackaree-shen wants to merge 1 commit into
mainfrom
bugfix_printed_brim_local_z
Open

fix: brim missing when mixed filament + painted brim + local-z whole objects are all enabled#466
zackaree-shen wants to merge 1 commit into
mainfrom
bugfix_printed_brim_local_z

Conversation

@zackaree-shen

Copy link
Copy Markdown

@

Bug Description

When all three conditions are enabled simultaneously, the object brim is completely missing from the first layer gcode:

  • Mixed filament (multi-color printing)
  • Painted brim (btPainted)
  • Full domain local-z (dithering_local_z_whole_objects = true)

Root Cause

In GCode.cpp, when dithering_local_z_whole_objects = true, the Local-Z phase-b routing logic routes all first-layer extrusions to pass_bucket.by_extruder. This leaves the main by_extruder empty for the first layer.

The per-extruder loop then hits by_extruder.find(extruder_id) == end()continue, skipping the entire loop body. The brim emission code originally lived inside the island loop within the per-extruder body, so it was never reached.

Fix

GCode.cpp — Two mutually-exclusive brim emission points

  1. Fix point 1 (per-extruder bypass): Before by_extruder.find(), iterate m_objsWithBrim and emit brim even when by_extruder is empty for this extruder.

  2. Fix point 2 (island bypass): Before the island loop, emit brim as a safety net even when the island vector is empty.

Both points are mutually exclusive via m_objsWithBrim.erase().

Brim.cpp — Extruder matching condition split

When btPainted, skip the extruder matching check — firstLayerObjGroups() already handles extruder association internally.

Files Changed

File + - Description
src/libslic3r/GCode.cpp +39 -14 Two brim emission fallback points
src/libslic3r/Brim.cpp +6 -1 Extruder matching condition split

Analysis Report

https://snapmaker.feishu.cn/wiki/C8D9wBU6YiPyPXkTaEPc3HZsnsg
@

…objects are all enabled

Root cause: When dithering_local_z_whole_objects=true, Local-Z phase-b
routes all first-layer extrusions to pass_bucket.by_extruder, leaving
the main by_extruder empty. The per-extruder loop then skips via
continue, and the brim emission code inside the island loop never executes.

Two fixes in GCode.cpp:
1. Emit brim before by_extruder.find() check, even when by_extruder is
   empty (handles the per-extruder empty case)
2. Emit brim before island loop, even when islands vector is empty
   (safety net for edge cases)
Both are mutually exclusive via m_objsWithBrim.erase().

Also in Brim.cpp: skip extruder matching when brim type is btPainted,
since firstLayerObjGroups() already handles extruder association internally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant