Add max_numbering_height function

This commit is contained in:
thewildmage
2023-05-27 22:46:15 -06:00
parent 142f92808c
commit bed8351f05
2 changed files with 16 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ namespace Slic3r {
std::stringstream gcode;
const double lw = 0.48;
Flow line_flow = Flow(lw, 0.2, mp_gcodegen->config().nozzle_diameter.get_at(0));
const double len = 2;
const double len = m_digit_len;
const double gap = lw / 2.0;
const double e = line_flow.mm3_per_mm() / 2.40528; // filament_mm/extrusion_mm
const auto dE = e * len;
@@ -209,7 +209,6 @@ namespace Slic3r {
}
std::string calib_pressure_advance_line::print_pa_lines(double start_x, double start_y, double start_pa, double step_pa, int num) {
auto& writer = mp_gcodegen->writer();
Flow line_flow = Flow(m_line_width, 0.2, mp_gcodegen->config().nozzle_diameter.get_at(0));
Flow thin_line_flow = Flow(0.44, 0.2, mp_gcodegen->config().nozzle_diameter.get_at(0));
@@ -264,7 +263,19 @@ namespace Slic3r {
double max_numbering_height(double start_pa, double step_pa, int count) {
int max_length = 0;
for (int i = 0; i < count; i += 2) {
std::string sNumber = convert_number_to_string(start_pa + (i * step_pa));
if (sNumber.length > max_length) { max_length = sNumber.length; }
}
max_length = std::min(max_characters, m_max_number_length);
return (max_length * m_digit_len) + ((max_length - 1) * m_number_spacing);
}
Calib_Params::Calib_Params() : mode(CalibMode::Calib_None) {}
} // namespace Slic3r

View File

@@ -41,6 +41,7 @@ private:
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);
private:
double m_digit_len {2};
int m_max_number_length {5};
double m_number_spacing {3.0};
}
@@ -87,8 +88,8 @@ class calib_pressure_advance_pattern: public calib_pressure_advance
double line_spacing() { return line_width() - mp_gcodegen->config().layer_height.value * (1 - M_PI / 4); };
double line_spacing_anchor() { return line_width_anchor() - mp_gcodegen->config().initial_layer_print_height.value * (1 - M_PI / 4); };
double line_spacing_angle() { return line_spacing() / sin(to_radians(m_corner_angle) / 2); };
private:
std::string move_to(Vec2d pt);
double max_numbering_height();
private:
Gcode* mp_gcodegen;
int m_anchor_layer_line_ratio {140};