update libslic3r

This commit is contained in:
QIDI TECH
2025-05-05 19:52:57 +08:00
parent eae8e18c3a
commit 126534997a
180 changed files with 24833 additions and 5679 deletions

View File

@@ -13,7 +13,7 @@ namespace Slic3r {
enum class LiftType {
NormalLift,
LazyLift,
SlopeLift,
SpiralLift
};
@@ -21,9 +21,10 @@ class GCodeWriter {
public:
GCodeConfig config;
bool multiple_extruders;
GCodeWriter() :
multiple_extruders(false), m_extruder(nullptr),
GCodeWriter() :
multiple_extruders(false), m_curr_filament_extruder{ nullptr,nullptr },
m_curr_extruder_id (-1),
m_single_extruder_multi_material(false),
m_last_acceleration(0), m_max_acceleration(0),
m_last_jerk(0), m_max_jerk(0),
@@ -32,18 +33,20 @@ public:
m_to_lift(0),
m_to_lift_type(LiftType::NormalLift)
{}
Extruder* extruder() { return m_extruder; }
const Extruder* extruder() const { return m_extruder; }
Extruder* filament(size_t extruder_id) { assert(extruder_id < m_curr_filament_extruder.size()); return m_curr_filament_extruder[extruder_id]; }
const Extruder* filament(size_t extruder_id) const { assert(extruder_id < m_curr_filament_extruder.size()); return m_curr_filament_extruder[extruder_id]; }
Extruder* filament() { if (m_curr_extruder_id == -1) return nullptr; return m_curr_filament_extruder[m_curr_extruder_id]; }
const Extruder* filament() const { if(m_curr_extruder_id==-1) return nullptr; return m_curr_filament_extruder[m_curr_extruder_id]; }
void apply_print_config(const PrintConfig &print_config);
// Extruders are expected to be sorted in an increasing order.
void set_extruders(std::vector<unsigned int> extruder_ids);
const std::vector<Extruder>& extruders() const { return m_extruders; }
std::vector<unsigned int> extruder_ids() const {
std::vector<unsigned int> out;
out.reserve(m_extruders.size());
for (const Extruder &e : m_extruders)
out.push_back(e.id());
const std::vector<Extruder>& extruders() const { return m_filament_extruders; }
std::vector<unsigned int> extruder_ids() const {
std::vector<unsigned int> out;
out.reserve(m_filament_extruders.size());
for (const Extruder &e : m_filament_extruders)
out.push_back(e.id());
return out;
}
std::string preamble();
@@ -51,20 +54,22 @@ public:
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
std::string set_bed_temperature(int temperature, bool wait = false);
std::string set_chamber_temperature(int temperature, bool wait = false);
std::string set_acceleration(unsigned int acceleration);
void set_acceleration(unsigned int acceleration);
void set_travel_acceleration(const std::vector<unsigned int>& travel_accelerations);
void set_first_layer_travel_acceleration(const std::vector<unsigned int>& travel_accelerations);
void set_first_layer(bool is_first_layer);
std::string set_pressure_advance(double pa) const;
std::string set_jerk_xy(double jerk);
std::string reset_e(bool force = false);
std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false) const;
// return false if this extruder was already selected
bool need_toolchange(unsigned int extruder_id) const
{ return m_extruder == nullptr || m_extruder->id() != extruder_id; }
std::string set_extruder(unsigned int extruder_id)
{ return this->need_toolchange(extruder_id) ? this->toolchange(extruder_id) : ""; }
bool need_toolchange(unsigned int filament_id) const;
std::string set_extruder(unsigned int filament_id);
void init_extruder(unsigned int filament_id);
// Prefix of the toolchange G-code line, to be used by the CoolingBuffer to separate sections of the G-code
// printed with the same extruder.
std::string toolchange_prefix() const;
std::string toolchange(unsigned int extruder_id);
std::string toolchange(unsigned int filament_id);
std::string set_speed(double F, const std::string &comment = std::string(), const std::string &cooling_marker = std::string());
double get_current_speed() { return m_current_speed; };
std::string travel_to_xy(const Vec2d &point, const std::string &comment = std::string());
@@ -78,7 +83,10 @@ public:
std::string retract(bool before_wipe = false);
std::string retract_for_toolchange(bool before_wipe = false);
std::string unretract();
std::string lift(LiftType lift_type = LiftType::NormalLift, bool spiral_vase = false);
// do lift instantly
std::string eager_lift(const LiftType type,bool tool_change = false);
// record a lift request, do realy lift in next travel
std::string lazy_lift(LiftType lift_type = LiftType::NormalLift, bool spiral_vase = false, bool tool_change=false);
std::string unlift();
Vec3d get_position() const { return m_pos; }
void set_position(Vec3d& in) { m_pos = in; }
@@ -106,16 +114,23 @@ public:
//QDS:
void set_current_position_clear(bool clear) { m_is_current_pos_clear = clear; };
bool is_current_position_clear() const { return m_is_current_pos_clear; };
void set_is_qdt_printer(bool is_qdt_printer) { m_is_qdt_printer = is_qdt_printer; };
//QDS:
static const bool full_gcode_comment;
//Radian threshold of slope for lazy lift and spiral lift;
static const double slope_threshold;
private:
std::string set_extrude_acceleration();
std::string set_travel_acceleration();
std::string set_acceleration_impl(unsigned int acceleration);
private:
// Extruders are sorted by their ID, so that binary search is possible.
std::vector<Extruder> m_extruders;
std::vector<Extruder> m_filament_extruders;
bool m_single_extruder_multi_material;
Extruder* m_extruder;
std::vector<Extruder*> m_curr_filament_extruder;
int m_curr_extruder_id;
unsigned int m_last_acceleration;
// Limit for setting the acceleration, to respect the machine limits set for the Marlin firmware.
// If set to zero, the limit is not in action.
@@ -140,11 +155,18 @@ private:
double m_x_offset{ 0 };
double m_y_offset{ 0 };
double m_current_speed{ 0 };
bool m_is_qdt_printer = false;
std::string m_gcode_label_objects_start;
std::string m_gcode_label_objects_end;
std::string _travel_to_z(double z, const std::string &comment);
std::string _spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment);
bool m_is_first_layer{false};
unsigned int m_acceleration{0};
std::vector<unsigned int> m_travel_accelerations; // multi extruder, extruder size
std::vector<unsigned int> m_first_layer_travel_accelerations; // multi extruder, extruder size
std::string _travel_to_z(double z, const std::string &comment,bool tool_change=false);
std::string _spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment, bool tool_change = false);
std::string _retract(double length, double restart_extra, const std::string &comment);
};