mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-16 21:42:43 +00:00
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:
committed by
Joseph Robertson
parent
7ff6bc42b1
commit
b297f68921
@@ -37,18 +37,40 @@ void GCodeWriter::set_build_volume_max(const Vec3d &max)
|
||||
m_build_vol_max = max;
|
||||
}
|
||||
|
||||
void GCodeWriter::set_belt_back_transform(const PrintConfig &config)
|
||||
{
|
||||
m_belt_back_transform.init_from_config(config);
|
||||
}
|
||||
|
||||
void GCodeWriter::set_origin_snap(int axis, bool enable, double offset, double bbox_min)
|
||||
{
|
||||
if (axis >= 0 && axis < 3) {
|
||||
m_origin_snap[axis] = enable;
|
||||
m_origin_offset[axis] = offset;
|
||||
m_origin_bbox_min[axis] = bbox_min;
|
||||
}
|
||||
}
|
||||
|
||||
Vec3d GCodeWriter::to_machine_coords(const Vec3d &pos) const
|
||||
{
|
||||
if (!is_belt_printer())
|
||||
return pos;
|
||||
// Step 1: Undo the shear/scale applied during slicing.
|
||||
Vec3d p = m_belt_back_transform.apply(pos);
|
||||
// Step 2: Apply axis remapping for the machine's coordinate convention.
|
||||
// BeltRemapAxis: 0-2 = +X/+Y/+Z, 3-5 = -X/-Y/-Z, 6-8 = Rev X/Y/Z
|
||||
auto remap = [this, &pos](int r) -> double {
|
||||
auto remap = [this, &p](int r) -> double {
|
||||
int axis = r % 3;
|
||||
if (r < 3) return pos[axis];
|
||||
if (r < 6) return -pos[axis];
|
||||
return m_build_vol_max[axis] - pos[axis];
|
||||
if (r < 3) return p[axis];
|
||||
if (r < 6) return -p[axis];
|
||||
return m_build_vol_max[axis] - p[axis];
|
||||
};
|
||||
return { remap(m_remap_x), remap(m_remap_y), remap(m_remap_z) };
|
||||
Vec3d result = { remap(m_remap_x), remap(m_remap_y), remap(m_remap_z) };
|
||||
// Per-axis origin snap: shift so bbox min on each enabled axis = offset.
|
||||
for (int i = 0; i < 3; ++i)
|
||||
if (m_origin_snap[i])
|
||||
result[i] -= (m_origin_bbox_min[i] - m_origin_offset[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool GCodeWriter::supports_separate_travel_acceleration(GCodeFlavor flavor)
|
||||
|
||||
Reference in New Issue
Block a user