fix(imex): hide secondary carriages in g-code preview when firmware-managed-zones is on

The firmware-managed-zones writer offset centers the slice at bed origin,
so prim_pos and the preview toolpaths sit in a shifted frame relative to
the plate-local bed bounds the secondary-marker zone math uses. Computing
secondaries against unshifted bed bounds puts them off the build plate.

Skip the secondary-marker / toolhead-box computation when the
firmware-managed-zones option is enabled. The firmware physically fans the
centered toolpath out into the zones at print time, so the honest preview
is the single centered toolpath with no secondaries.

Reported by @Felix14-v2 on PR #13086.
This commit is contained in:
Clifford Garwood
2026-06-08 01:24:35 -04:00
parent 92de4e3f87
commit d0c6e8305d
+10 -1
View File
@@ -1644,7 +1644,16 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin)
m_imex_last_mode = mode;
}
if (!mode.empty() && mode != kImexPrimaryMode) {
// Firmware-managed-zones centers the slice at bed origin, so prim_pos
// and the preview toolpaths sit in a shifted frame relative to the
// plate-local bed bounds the zone math uses. Computing secondaries here
// would place them off-bed. The firmware physically fans the centered
// toolpath out into the zones, so the centered preview with no
// secondaries is the honest representation.
auto* fw_opt = printer_cfg.opt<ConfigOptionBool>("imex_firmware_managed_zones");
const bool firmware_managed = fw_opt && fw_opt->value;
if (!firmware_managed && !mode.empty() && mode != kImexPrimaryMode) {
auto* mode_names_opt = printer_cfg.opt<ConfigOptionStrings>("imex_mode_names");
auto* active_tools_opt = printer_cfg.opt<ConfigOptionStrings>("imex_mode_active_tools");