Part 2.7: Add G-code back-transform and tree support belt floor clipping

- Add BeltBackTransform class that inverts the shear/scale matrix and
  applies it in GCodeWriter::to_machine_coords() so G-code outputs in
  the machine's physical coordinate space, gated by new
  belt_gcode_back_transform config option
- Extend belt floor clipping to all three tree support pipelines
  (Prusa-style, Orca organic, TreeModelVolumes) with per-layer polygon
  clipping, anti-overhang integration, and belt raft extension layers
- Fix tree drop_nodes() belt termination, organic support global Z
  offset, collision calculation index bug, and first-layer brim/empty
  layer checks for belt printers

two-shot - first build built but didn't plumb to UI.  Woah.

add pre-slice axis remap, because Y needs to be Z

going to change tactic and move based on bbox min

switch to per axis snapping

per axis swap snap now per object

build plate tilt wasn't invalidating slicer settings

support upper bound now correct, need to get lower bound corrected

axis swapped support termination corrected

Z Shear works with and without pre-slice remap now
This commit is contained in:
harrierpigeon
2026-03-30 13:25:40 -05:00
committed by Joseph Robertson
parent 7ff6bc42b1
commit b297f68921
20 changed files with 767 additions and 36 deletions
+16 -3
View File
@@ -3402,9 +3402,16 @@ void PrintObject::update_slicing_parameters()
double belt_floor_shear_factor_out = 0.0;
int belt_floor_from_axis_out = 1;
double belt_floor_z_shift_out = 0.0;
// Belt shear/scale may change the effective Z height.
// Belt shear/scale/pre-remap may change the effective Z height.
const auto &pcfg = this->print()->config();
if (pcfg.belt_printer.value) {
BoundingBoxf3 bb = belt_remapped_bbox(*this->model_object(), pcfg);
bool has_preslice_remap = (int(pcfg.belt_preslice_remap_x.value) != int(BeltRemapAxis::PosX) ||
int(pcfg.belt_preslice_remap_y.value) != int(BeltRemapAxis::PosY) ||
int(pcfg.belt_preslice_remap_z.value) != int(BeltRemapAxis::PosZ));
if (has_preslice_remap)
object_height = bb.size().z();
bool has_z_shear = pcfg.belt_shear_z.value != BeltShearMode::None;
bool has_z_scale = pcfg.belt_scale_z.value != BeltScaleMode::None;
if (has_z_shear || has_z_scale) {
@@ -3435,7 +3442,6 @@ void PrintObject::update_slicing_parameters()
double scale_z = compute_scale_factor(pcfg.belt_scale_z.value, pcfg.belt_scale_z_angle.value);
if (has_z_shear && std::abs(shear_factor) > EPSILON) {
int from = int(pcfg.belt_shear_z_from.value);
BoundingBoxf3 bb = this->model_object()->raw_bounding_box();
double min_rz = std::numeric_limits<double>::max();
double max_rz = std::numeric_limits<double>::lowest();
for (double vz : {bb.min.z(), bb.max.z()})
@@ -3507,8 +3513,15 @@ SlicingParameters PrintObject::slicing_parameters(const DynamicPrintConfig &full
if (object_max_z <= 0.f) {
BoundingBoxf3 bb = model_object.raw_bounding_box();
object_max_z = (float)bb.size().z();
// Belt shear/scale may change the effective Z height.
// Belt pre-remap/shear/scale may change the effective Z height.
if (print_config.belt_printer.value) {
bb = belt_remapped_bbox(model_object, print_config);
bool has_preslice_remap = (int(print_config.belt_preslice_remap_x.value) != int(BeltRemapAxis::PosX) ||
int(print_config.belt_preslice_remap_y.value) != int(BeltRemapAxis::PosY) ||
int(print_config.belt_preslice_remap_z.value) != int(BeltRemapAxis::PosZ));
if (has_preslice_remap)
object_max_z = (float)bb.size().z();
bool has_z_shear = print_config.belt_shear_z.value != BeltShearMode::None;
bool has_z_scale = print_config.belt_scale_z.value != BeltScaleMode::None;
if (has_z_shear || has_z_scale) {