mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-15 04:57:34 +00:00
Drop Redundant Belt Checks in BeltGCode
BeltGCode is only created for belt printers, so its hooks no longer re-check belt_printer, and the BBL-machine flag is set once on whichever writer survives init_belt_writer instead of on one about to be discarded.
This commit is contained in:
@@ -5,13 +5,9 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
void BeltGCode::init_belt_writer(Print &print, bool is_bbl_printers)
|
void BeltGCode::init_belt_writer(Print &print)
|
||||||
{
|
{
|
||||||
if (!print.config().belt_printer.value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto belt_writer = std::make_unique<BeltGCodeWriter>();
|
auto belt_writer = std::make_unique<BeltGCodeWriter>();
|
||||||
belt_writer->set_is_bbl_machine(is_bbl_printers);
|
|
||||||
// Axis remap and build volume max are set by base GCode after init_belt_writer returns.
|
// Axis remap and build volume max are set by base GCode after init_belt_writer returns.
|
||||||
belt_writer->set_belt_back_transform(print.config());
|
belt_writer->set_belt_back_transform(print.config());
|
||||||
belt_writer->set_machine_frame_transform(print.config());
|
belt_writer->set_machine_frame_transform(print.config());
|
||||||
@@ -21,9 +17,6 @@ void BeltGCode::init_belt_writer(Print &print, bool is_bbl_printers)
|
|||||||
|
|
||||||
void BeltGCode::write_belt_header(GCodeOutputStream &file, const Print &print)
|
void BeltGCode::write_belt_header(GCodeOutputStream &file, const Print &print)
|
||||||
{
|
{
|
||||||
if (!print.config().belt_printer.value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const auto &full_cfg = print.full_print_config();
|
const auto &full_cfg = print.full_print_config();
|
||||||
// Slicing rotation: the belt tilt (axis + angle) and the single source of truth
|
// 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.
|
// for the physical tilt the G-code viewer uses to enable belt view.
|
||||||
@@ -62,7 +55,7 @@ void BeltGCode::on_set_origin(const PrintObject * /*obj*/, const Point & /*inst_
|
|||||||
|| (m_config.belt_slice_rotation_global.value
|
|| (m_config.belt_slice_rotation_global.value
|
||||||
&& m_config.belt_slice_rotation.value != BeltRotationAxis::None
|
&& m_config.belt_slice_rotation.value != BeltRotationAxis::None
|
||||||
&& std::abs(m_config.belt_slice_rotation_angle.value) > EPSILON);
|
&& std::abs(m_config.belt_slice_rotation_angle.value) > EPSILON);
|
||||||
if (!use_global || !m_config.belt_printer.value)
|
if (!use_global)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Adjust origin: transform through belt forward pipeline so that
|
// Adjust origin: transform through belt forward pipeline so that
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Slic3r {
|
|||||||
class BeltGCode : public GCode
|
class BeltGCode : public GCode
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void init_belt_writer(Print &print, bool is_bbl_printers) override;
|
void init_belt_writer(Print &print) override;
|
||||||
void write_belt_header(GCodeOutputStream &file, const Print &print) override;
|
void write_belt_header(GCodeOutputStream &file, const Print &print) override;
|
||||||
void on_set_origin(const PrintObject *obj, const Point &inst_shift) override;
|
void on_set_origin(const PrintObject *obj, const Point &inst_shift) override;
|
||||||
bool should_disable_arc_fitting() const override { return true; }
|
bool should_disable_arc_fitting() const override { return true; }
|
||||||
|
|||||||
@@ -2961,10 +2961,9 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||||||
m_fan_mover.release();
|
m_fan_mover.release();
|
||||||
m_ordering_cache.clear();
|
m_ordering_cache.clear();
|
||||||
|
|
||||||
m_writer->set_is_bbl_machine(is_bbl_printers);
|
|
||||||
|
|
||||||
// Belt printer: initialize belt-specific writer via virtual hook.
|
// Belt printer: initialize belt-specific writer via virtual hook.
|
||||||
this->init_belt_writer(print, is_bbl_printers);
|
this->init_belt_writer(print);
|
||||||
|
m_writer->set_is_bbl_machine(is_bbl_printers);
|
||||||
|
|
||||||
// Standalone axis remap (works with or without belt mode).
|
// Standalone axis remap (works with or without belt mode).
|
||||||
// Sync the writer's remap state to the current export UNCONDITIONALLY — even at
|
// Sync the writer's remap state to the current export UNCONDITIONALLY — even at
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ protected:
|
|||||||
|
|
||||||
// Virtual hooks for belt printer subclass (BeltGCode).
|
// Virtual hooks for belt printer subclass (BeltGCode).
|
||||||
// No-ops in base GCode; overridden in BeltGCode.
|
// No-ops in base GCode; overridden in BeltGCode.
|
||||||
virtual void init_belt_writer(Print &print, bool is_bbl_printers) {}
|
virtual void init_belt_writer(Print &print) {}
|
||||||
virtual void write_belt_header(GCodeOutputStream &file, const Print &print) {}
|
virtual void write_belt_header(GCodeOutputStream &file, const Print &print) {}
|
||||||
virtual void on_set_origin(const PrintObject *obj, const Point &inst_shift) {}
|
virtual void on_set_origin(const PrintObject *obj, const Point &inst_shift) {}
|
||||||
virtual bool should_disable_arc_fitting() const { return false; }
|
virtual bool should_disable_arc_fitting() const { return false; }
|
||||||
|
|||||||
Reference in New Issue
Block a user