mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-09 08:41:14 +00:00
Guard the layer count and the per-object layer collection against an object that is left without a layer to print on a belt (the counting loop stepped before begin() and front() was taken of an empty vector). Check the belt temperature tower's embossed model before the current project is replaced, not after. Only invalidate the support step of objects that own a belt brim when an object is added or removed. The empty-layers test now counts an extrusion only where material is laid down along a move. The BeltBrim.cpp SEQUENCING note says exactly which layers are read, and the machine-frame scale is 1/|sin|. Remove more code that nothing calls: the kinematics inverse (to_logical, apply_axis_remap_inverse, to_build_volume and the state kept for them), the world_coordinates(), is_active() and belt_brim_areas_by_layer() accessors, the PrintConfig overload of physical_tilt() and the DynamicPrintConfig overload of compute_belt_height_and_floor(). Comments in GCode.hpp, BeltSliceStrategy.hpp/.cpp and PrintObjectSlice.cpp that described the retired pre-slice remap and plane-evaluator still did; the purge-tower width tooltip named the wrong switch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
51 lines
2.2 KiB
C++
51 lines
2.2 KiB
C++
#include "BeltGCode.hpp"
|
|
#include "GCodeWriter.hpp"
|
|
#include "GCode/BeltKinematics.hpp"
|
|
#include "BeltTransform.hpp"
|
|
#include "Print.hpp"
|
|
#include "Point.hpp"
|
|
#include "PrintConfig.hpp"
|
|
#include "libslic3r.h"
|
|
#include <cstdlib>
|
|
|
|
namespace Slic3r {
|
|
|
|
void BeltGCode::init_belt_writer(Print &print)
|
|
{
|
|
// Axis remap and build volume max are set by base GCode after init_belt_writer
|
|
// returns; set_kinematics() replays them, so install order does not matter.
|
|
install_belt_kinematics(m_writer, print.config());
|
|
m_writer.set_force_normal_lift(true);
|
|
}
|
|
|
|
void BeltGCode::write_belt_header(GCodeOutputStream &file, const Print &print)
|
|
{
|
|
const auto &full_cfg = print.full_print_config();
|
|
// Slicing rotation: the belt tilt (axis + angle) and the single source of truth
|
|
// for the physical tilt the G-code viewer uses to enable belt view.
|
|
file.write_format("; belt_slice_rotation = %s\n", full_cfg.opt_serialize("belt_slice_rotation").c_str());
|
|
file.write_format("; belt_slice_rotation_angle = %.1f\n", print.config().belt_slice_rotation_angle.value);
|
|
// Machine-frame transform: shear (cot) + scale (1/|sin|) derived from the belt
|
|
// tilt angle (or belt_frame_tilt_angle when decoupled).
|
|
file.write_format("; belt_frame_tilt_decouple = %d\n", print.config().belt_frame_tilt_decouple.value ? 1 : 0);
|
|
file.write_format("; belt_frame_tilt_angle = %.1f\n", print.config().belt_frame_tilt_angle.value);
|
|
}
|
|
|
|
void BeltGCode::on_set_origin(const PrintObject * /*obj*/, const Point & /*inst_shift*/)
|
|
{
|
|
// Matches the per-instance Z-offset added in PrintObjectSlice.cpp: transform
|
|
// the origin through the belt pipeline so that back_transform(T * origin) =
|
|
// origin (correct machine position). The back_transform applied during
|
|
// G-code emission is the inverse of the forward transform.
|
|
|
|
// Adjust origin: transform through belt forward pipeline so that
|
|
// the back-transform correctly recovers model-space positions.
|
|
Transform3d T = BeltTransformPipeline::build_forward_transform(m_config);
|
|
Vec2d cur_origin = this->origin();
|
|
Vec3d origin3d(cur_origin.x(), cur_origin.y(), 0.);
|
|
Vec3d adjusted = T.linear() * origin3d;
|
|
this->set_origin(Vec2d(adjusted.x(), adjusted.y()));
|
|
}
|
|
|
|
} // namespace Slic3r
|