diff --git a/src/libslic3r/calib.cpp b/src/libslic3r/calib.cpp index 9664089be8..4a2014ae69 100644 --- a/src/libslic3r/calib.cpp +++ b/src/libslic3r/calib.cpp @@ -341,17 +341,6 @@ void CalibPressureAdvanceLine::delta_modify_start(double& startx, double& starty starty = -(count * m_space_y) / 2; } -PatternSettings::PatternSettings(const CalibPressureAdvancePattern& cpap) : - anchor_line_width(cpap.line_width_anchor()), - anchor_perimeters(cpap.wall_count()), - encroachment(cpap.encroachment()), - first_layer_height(cpap.height_first_layer()), - first_layer_speed(cpap.speed_adjust(cpap.speed_first_layer())), - layer_height(cpap.height_layer()), - line_width(cpap.line_width()), - perim_speed(cpap.speed_adjust(cpap.speed_perimeter())) -{ }; - CalibPressureAdvancePattern::CalibPressureAdvancePattern( const Calib_Params& params, DynamicPrintConfig& config, @@ -400,7 +389,7 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(Model& model, const Vec gcode << writer.travel_to_z(height_first_layer(), "Move to start Z position"); gcode << writer.set_pressure_advance(m_params.start); - const DrawBoxOptArgs default_box_opt_args(m_pattern_settings); + const DrawBoxOptArgs default_box_opt_args(*this); // create anchor frame gcode << draw_box( @@ -428,7 +417,7 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(Model& model, const Vec ); std::vector gcode_items; - const DrawLineOptArgs default_line_opt_args(m_pattern_settings); + const DrawLineOptArgs default_line_opt_args(*this); const int num_patterns = get_num_patterns(); // "cache" for use in loops // draw pressure advance pattern @@ -557,7 +546,6 @@ void CalibPressureAdvancePattern::refresh_pattern_config(const Model& model) m_is_delta = (updated_config.option("printable_area")->values.size() > 4); set_starting_point(model); - m_pattern_settings = PatternSettings(*this); } GCodeWriter CalibPressureAdvancePattern::pattern_writer(const Model& model, const Vec3d& origin) @@ -639,7 +627,7 @@ std::string CalibPressureAdvancePattern::draw_box( gcode << move_to(Vec2d(min_x, min_y), writer, "Move to box start"); - DrawLineOptArgs line_opt_args(m_pattern_settings); + DrawLineOptArgs line_opt_args(*this); line_opt_args.height = opt_args.height; line_opt_args.line_width = opt_args.line_width; line_opt_args.speed = opt_args.speed; diff --git a/src/libslic3r/calib.hpp b/src/libslic3r/calib.hpp index 23e38f799b..ce02872e87 100644 --- a/src/libslic3r/calib.hpp +++ b/src/libslic3r/calib.hpp @@ -115,58 +115,6 @@ private: bool m_draw_numbers {true}; }; -class CalibPressureAdvancePattern; - -struct PatternSettings { -friend class CalibPressureAdvancePattern; -friend struct DrawLineOptArgs; -friend struct DrawBoxOptArgs; -private: - PatternSettings() { }; - PatternSettings(const CalibPressureAdvancePattern& cpap); - - double anchor_line_width; - int anchor_perimeters; - double encroachment; - double first_layer_height; - int first_layer_speed; - double layer_height; - double line_width; - int perim_speed; -}; - -struct DrawLineOptArgs { -friend class CalibPressureAdvancePattern; -private: - DrawLineOptArgs(const PatternSettings& ps) { - height = ps.layer_height; - line_width = ps.line_width; - speed = ps.perim_speed; - }; - - double height; - double line_width; - int speed; - std::string comment {"Print line"}; -}; - -struct DrawBoxOptArgs { -friend class CalibPressureAdvancePattern; -private: - DrawBoxOptArgs(const PatternSettings& ps) { - num_perimeters = ps.anchor_perimeters; - height = ps.first_layer_height; - line_width = ps.anchor_line_width; - speed = ps.first_layer_speed; - }; - - bool is_filled {false}; - int num_perimeters; - double height; - double line_width; - double speed; -}; - struct SuggestedCalibPressureAdvancePatternConfig { const std::vector> float_pairs { {"initial_layer_print_height", 0.25}, @@ -186,7 +134,9 @@ struct SuggestedCalibPressureAdvancePatternConfig { }; class CalibPressureAdvancePattern : public CalibPressureAdvance { -friend struct PatternSettings; +friend struct DrawLineOptArgs; +friend struct DrawBoxOptArgs; + public: CalibPressureAdvancePattern( const Calib_Params& params, @@ -203,15 +153,43 @@ public: void set_starting_point(const Model& model); void generate_custom_gcodes(Model& model, const Vec3d& origin); + protected: double speed_first_layer() const { return m_config.option("initial_layer_speed")->value; }; double speed_perimeter() const { return m_config.option("outer_wall_speed")->value; }; - double line_width() const { return m_config.option("line_width")->value; }; double line_width_anchor() const { return m_config.option("initial_layer_line_width")->value; }; + double line_width() const { return m_config.option("line_width")->value; }; int wall_count() const { return m_config.option("wall_loops")->value; }; - - double encroachment() const { return m_encroachment; }; + private: + struct DrawLineOptArgs { + DrawLineOptArgs(const CalibPressureAdvancePattern& p) : + height {p.height_layer()}, + line_width {p.line_width()}, + speed {p.speed_adjust(p.speed_perimeter())} + { }; + + double height; + double line_width; + double speed; + std::string comment {"Print line"}; + }; + + struct DrawBoxOptArgs { + DrawBoxOptArgs(const CalibPressureAdvancePattern& p) : + num_perimeters {p.wall_count()}, + height {p.height_first_layer()}, + line_width {p.line_width()}, + speed {p.speed_adjust(p.speed_first_layer())} + { }; + + bool is_filled {false}; + int num_perimeters; + double height; + double line_width; + double speed; + }; + void refresh_pattern_config(const Model& model); GCodeWriter pattern_writer( const Model& model, @@ -272,7 +250,6 @@ private: DynamicPrintConfig m_config; bool m_is_delta; Vec3d m_starting_point; - PatternSettings m_pattern_settings; const double m_handle_xy_size {5}; const int m_num_layers {4};