Add belt printer transform pipeline: slicing rotation, G-code coords, preview

- Implement core belt slicing pipeline: R(-alpha, X) mesh rotation in PrintObjectSlice with corrected object height calculation for proper layer count
Add to_machine_coords() in GCodeWriter to convert slicing-frame coordinates back to machine-frame, propagated through GCode,
GCodeProcessor, and GCodeViewer
Add belt-mode UI: tilted bed visualization, slicing-direction arrow, and raw G-code toggle to switch between machine-frame and slicing-frame views

This is a combination of 6 commits.

checkpoint 1: initial MVP.  Slicing functions, but rotates instead of skews are happening and a lot of other stuff too

getting somewhere, getting to the point where I need to figure out how to verify this stuff

this appears to be a dead end.

getting somewhere I think maybe

I'm pretty sure we've completely lost the plot at this point and need to restart this process...

remove slice logic in preparation for new, more invasive plan
This commit is contained in:
harrierpigeon
2026-04-09 23:07:06 -05:00
parent a7441c7f48
commit c808653565
22 changed files with 375 additions and 31 deletions
+25
View File
@@ -4367,6 +4367,9 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line("printable_height", "printer_basic_information_printable_space#printable-height");
optgroup->append_single_option_line("build_plate_tilt_x");
optgroup->append_single_option_line("build_plate_tilt_y");
optgroup->append_single_option_line("belt_printer");
optgroup->append_single_option_line("belt_printer_angle");
optgroup->append_single_option_line("belt_printer_infinite_y");
optgroup->append_single_option_line("support_multi_bed_types","printer_basic_information_printable_space#support-multi-bed-types");
optgroup->append_single_option_line("best_object_pos", "printer_basic_information_printable_space#best-object-position");
// todo: for multi_extruder test
@@ -5225,6 +5228,11 @@ void TabPrinter::toggle_options()
auto gcf = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
toggle_line("enable_power_loss_recovery", is_BBL_printer || gcf == gcfMarlinFirmware);
// Belt printer: show belt-specific settings only when belt_printer is enabled.
bool is_belt = m_config->opt_bool("belt_printer");
toggle_line("belt_printer_angle", is_belt);
toggle_line("belt_printer_infinite_y", is_belt);
}
@@ -5396,6 +5404,23 @@ void TabPrinter::update_fff()
m_use_silent_mode = m_config->opt_bool("silent_mode");
}
// Belt printer: auto-sync build_plate_tilt_x to belt_printer_angle when belt mode is active.
// When belt mode is off, reset build_plate_tilt_x to 0 if it was set by belt mode.
if (m_config->opt_bool("belt_printer")) {
double belt_angle = m_config->opt_float("belt_printer_angle");
if (m_config->opt_float("build_plate_tilt_x") != belt_angle) {
m_config->set_key_value("build_plate_tilt_x", new ConfigOptionFloat(belt_angle));
}
} else {
// Only reset if build_plate_tilt_x matches a typical belt angle (was set by auto-sync).
// Avoid clobbering a manually-set tilt value for non-belt tilted printers.
double current_tilt = m_config->opt_float("build_plate_tilt_x");
double belt_angle = m_config->opt_float("belt_printer_angle");
if (current_tilt != 0. && std::abs(current_tilt - belt_angle) < 0.01) {
m_config->set_key_value("build_plate_tilt_x", new ConfigOptionFloat(0.));
}
}
toggle_options();
}