mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-28 05:12:27 +00:00
Remove unnecessary middleman PatternSettings
This commit is contained in:
@@ -341,17 +341,6 @@ void CalibPressureAdvanceLine::delta_modify_start(double& startx, double& starty
|
|||||||
starty = -(count * m_space_y) / 2;
|
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(
|
CalibPressureAdvancePattern::CalibPressureAdvancePattern(
|
||||||
const Calib_Params& params,
|
const Calib_Params& params,
|
||||||
DynamicPrintConfig& config,
|
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.travel_to_z(height_first_layer(), "Move to start Z position");
|
||||||
gcode << writer.set_pressure_advance(m_params.start);
|
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
|
// create anchor frame
|
||||||
gcode << draw_box(
|
gcode << draw_box(
|
||||||
@@ -428,7 +417,7 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(Model& model, const Vec
|
|||||||
);
|
);
|
||||||
|
|
||||||
std::vector<CustomGCode::Item> gcode_items;
|
std::vector<CustomGCode::Item> 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
|
const int num_patterns = get_num_patterns(); // "cache" for use in loops
|
||||||
|
|
||||||
// draw pressure advance pattern
|
// draw pressure advance pattern
|
||||||
@@ -557,7 +546,6 @@ void CalibPressureAdvancePattern::refresh_pattern_config(const Model& model)
|
|||||||
|
|
||||||
m_is_delta = (updated_config.option<ConfigOptionPoints>("printable_area")->values.size() > 4);
|
m_is_delta = (updated_config.option<ConfigOptionPoints>("printable_area")->values.size() > 4);
|
||||||
set_starting_point(model);
|
set_starting_point(model);
|
||||||
m_pattern_settings = PatternSettings(*this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GCodeWriter CalibPressureAdvancePattern::pattern_writer(const Model& model, const Vec3d& origin)
|
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");
|
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.height = opt_args.height;
|
||||||
line_opt_args.line_width = opt_args.line_width;
|
line_opt_args.line_width = opt_args.line_width;
|
||||||
line_opt_args.speed = opt_args.speed;
|
line_opt_args.speed = opt_args.speed;
|
||||||
|
|||||||
@@ -115,58 +115,6 @@ private:
|
|||||||
bool m_draw_numbers {true};
|
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 {
|
struct SuggestedCalibPressureAdvancePatternConfig {
|
||||||
const std::vector<std::pair<std::string, double>> float_pairs {
|
const std::vector<std::pair<std::string, double>> float_pairs {
|
||||||
{"initial_layer_print_height", 0.25},
|
{"initial_layer_print_height", 0.25},
|
||||||
@@ -186,7 +134,9 @@ struct SuggestedCalibPressureAdvancePatternConfig {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class CalibPressureAdvancePattern : public CalibPressureAdvance {
|
class CalibPressureAdvancePattern : public CalibPressureAdvance {
|
||||||
friend struct PatternSettings;
|
friend struct DrawLineOptArgs;
|
||||||
|
friend struct DrawBoxOptArgs;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CalibPressureAdvancePattern(
|
CalibPressureAdvancePattern(
|
||||||
const Calib_Params& params,
|
const Calib_Params& params,
|
||||||
@@ -203,15 +153,43 @@ public:
|
|||||||
void set_starting_point(const Model& model);
|
void set_starting_point(const Model& model);
|
||||||
|
|
||||||
void generate_custom_gcodes(Model& model, const Vec3d& origin);
|
void generate_custom_gcodes(Model& model, const Vec3d& origin);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double speed_first_layer() const { return m_config.option<ConfigOptionFloat>("initial_layer_speed")->value; };
|
double speed_first_layer() const { return m_config.option<ConfigOptionFloat>("initial_layer_speed")->value; };
|
||||||
double speed_perimeter() const { return m_config.option<ConfigOptionFloat>("outer_wall_speed")->value; };
|
double speed_perimeter() const { return m_config.option<ConfigOptionFloat>("outer_wall_speed")->value; };
|
||||||
double line_width() const { return m_config.option<ConfigOptionFloat>("line_width")->value; };
|
|
||||||
double line_width_anchor() const { return m_config.option<ConfigOptionFloat>("initial_layer_line_width")->value; };
|
double line_width_anchor() const { return m_config.option<ConfigOptionFloat>("initial_layer_line_width")->value; };
|
||||||
|
double line_width() const { return m_config.option<ConfigOptionFloat>("line_width")->value; };
|
||||||
int wall_count() const { return m_config.option<ConfigOptionInt>("wall_loops")->value; };
|
int wall_count() const { return m_config.option<ConfigOptionInt>("wall_loops")->value; };
|
||||||
|
|
||||||
double encroachment() const { return m_encroachment; };
|
|
||||||
private:
|
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);
|
void refresh_pattern_config(const Model& model);
|
||||||
GCodeWriter pattern_writer(
|
GCodeWriter pattern_writer(
|
||||||
const Model& model,
|
const Model& model,
|
||||||
@@ -272,7 +250,6 @@ private:
|
|||||||
DynamicPrintConfig m_config;
|
DynamicPrintConfig m_config;
|
||||||
bool m_is_delta;
|
bool m_is_delta;
|
||||||
Vec3d m_starting_point;
|
Vec3d m_starting_point;
|
||||||
PatternSettings m_pattern_settings;
|
|
||||||
|
|
||||||
const double m_handle_xy_size {5};
|
const double m_handle_xy_size {5};
|
||||||
const int m_num_layers {4};
|
const int m_num_layers {4};
|
||||||
|
|||||||
Reference in New Issue
Block a user