mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-14 16:02:55 +00:00
Extract shared delta helper functions
This commit is contained in:
@@ -180,15 +180,27 @@ namespace Slic3r {
|
||||
return gcode.str();
|
||||
}
|
||||
|
||||
bool calib_pressure_advance::is_delta() {
|
||||
return mp_gcodegen->config().printable_area.values.size() > 4;
|
||||
}
|
||||
|
||||
void calib_pressure_advance::delta_scale_bed_ext(BoundingBoxf& bed_ext) {
|
||||
bed_ext.scale(1.0f / 1.41421f);
|
||||
}
|
||||
|
||||
void calib_pressure_advance::delta_modify_start(double& start_x, double& start_y, int count) {
|
||||
startx = -startx;
|
||||
starty = -(count * m_space_y) / 2;
|
||||
}
|
||||
|
||||
calib_pressure_advance_line::calib_pressure_advance_line(GCode* gcodegen) :mp_gcodegen(gcodegen), m_length_short(20.0), m_length_long(40.0), m_space_y(3.5), m_line_width(0.6), m_draw_numbers(true) {}
|
||||
|
||||
std::string calib_pressure_advance_line::generate_test(double start_pa /*= 0*/, double step_pa /*= 0.002*/,
|
||||
int count /*= 10*/) {
|
||||
BoundingBoxf bed_ext = get_extents(mp_gcodegen->config().printable_area.values);
|
||||
bool is_delta = false;
|
||||
if (mp_gcodegen->config().printable_area.values.size() > 4) {
|
||||
is_delta = true;
|
||||
bed_ext.scale(1.0f / 1.41421f);
|
||||
const bool is_delta = is_delta();
|
||||
if (is_delta) {
|
||||
delta_scale_bed_ext(bed_ext);
|
||||
}
|
||||
|
||||
auto bed_sizes = mp_gcodegen->config().printable_area.values;
|
||||
@@ -201,8 +213,7 @@ namespace Slic3r {
|
||||
auto startx = (w - m_length_short * 2 - m_length_long - 20) / 2;
|
||||
auto starty = (h - count * m_space_y) / 2;
|
||||
if (is_delta) {
|
||||
startx = -startx;
|
||||
starty = -(count * m_space_y) / 2;
|
||||
delta_modify_start(startx, starty, count);
|
||||
}
|
||||
|
||||
return print_pa_lines(startx, starty, start_pa, step_pa, count);
|
||||
|
||||
@@ -40,7 +40,11 @@ private:
|
||||
std::string convert_number_to_string(double num);
|
||||
std::string draw_digit(double startx, double starty, char c, calib_pressure_advance::DrawDigitMode mode);
|
||||
std::string draw_number(double startx, double starty, double value, calib_pressure_advance::DrawDigitMode mode);
|
||||
bool is_delta();
|
||||
void delta_scale_bed_ext(BoundingBoxf& bed_ext);
|
||||
void delta_modify_start(double start_x, double start_y, int count);
|
||||
private:
|
||||
GCode* mp_gcodegen;
|
||||
double m_digit_len {2};
|
||||
int m_max_number_length {5};
|
||||
double m_number_spacing {3.0};
|
||||
@@ -63,7 +67,6 @@ public:
|
||||
private:
|
||||
std::string print_pa_lines(double start_x, double start_y, double start_pa, double step_pa, int num);
|
||||
private:
|
||||
GCode* mp_gcodegen;
|
||||
double m_length_short, m_length_long;
|
||||
double m_space_y;
|
||||
double m_slow_speed, m_fast_speed;
|
||||
@@ -95,11 +98,11 @@ class calib_pressure_advance_pattern: public calib_pressure_advance
|
||||
double max_numbering_height();
|
||||
double pattern_shift();
|
||||
private:
|
||||
Gcode* mp_gcodegen;
|
||||
int m_anchor_layer_line_ratio {140};
|
||||
int m_anchor_perimeters {4};
|
||||
int m_corner_angle {90};
|
||||
double m_glyph_padding_vertical = 1;
|
||||
double m_glyph_padding_horizontal {1};
|
||||
double m_glyph_padding_vertical {1};
|
||||
double m_line_ratio {112.5};
|
||||
int m_pattern_spacing {2};
|
||||
int m_wall_count {3};
|
||||
|
||||
Reference in New Issue
Block a user