Use Vec3d instead of Vec2d for m_starting_point and m_last_pos

This commit is contained in:
thewildmage
2023-07-05 21:14:55 -06:00
parent f159e34998
commit 67989cd134
3 changed files with 19 additions and 12 deletions

View File

@@ -18,7 +18,7 @@ std::string CalibPressureAdvance::move_to(Vec2d pt, GCodeWriter& writer, std::st
gcode << writer.travel_to_xy(pt, comment);
gcode << writer.unretract();
m_last_pos = pt;
m_last_pos = Vec3d(pt.x(), pt.y(), 0);
return gcode.str();
}
@@ -346,15 +346,18 @@ PatternSettings::PatternSettings(const CalibPressureAdvancePattern* cpap) :
perim_speed(cpap->speed_adjust(cpap->speed_perimeter()))
{ };
void CalibPressureAdvancePattern::set_starting_point(Vec2d pt)
void CalibPressureAdvancePattern::starting_point(Vec3d pt)
{
m_starting_point = pt;
if (is_delta()) {
pt.x() *= -1;
pt.y() -= (frame_size_y() / 2);
m_starting_point.x() *= -1;
m_starting_point.y() -= (frame_size_y() / 2);
}
m_starting_point = pt;
m_last_pos = pt;
m_last_pos = m_starting_point;
}
};
CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
@@ -363,7 +366,7 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_gcodes()
gcode << "; start pressure advance pattern for layer\n";
gcode << move_to(m_starting_point, m_writer, "Move to start XY position");
gcode << move_to(Vec2d(m_starting_point.x(), m_starting_point.y()), m_writer, "Move to start XY position");
gcode << m_writer.travel_to_z(m_height_first_layer, "Move to start Z position");
gcode << m_writer.set_pressure_advance(m_params.start);
@@ -526,7 +529,8 @@ std::string CalibPressureAdvancePattern::draw_line(Vec2d to_pt, DrawLineOptArgs
auto dE = e_per_mm * length;
gcode << m_writer.extrude_to_xy(to_pt, dE, opt_args.comment);
m_last_pos = to_pt;
m_last_pos = Vec3d(to_pt.x(), to_pt.y(), 0);
return gcode.str();
}

View File

@@ -72,7 +72,8 @@ protected:
);
GCode* mp_gcodegen {nullptr};
Vec2d m_last_pos;
Vec3d m_last_pos;
DrawDigitMode m_draw_digit_mode {DrawDigitMode::Left_To_Right};
const double m_digit_segment_len {2};
@@ -200,7 +201,7 @@ public:
double height_layer() const { return m_height_layer; };
double max_layer_z() { return m_height_first_layer + ((m_num_layers - 1) * m_height_layer); };
void set_starting_point(Vec2d pt);
void starting_point(Vec3d pt);
CustomGCode::Info generate_gcodes();
protected:
@@ -249,7 +250,9 @@ private:
const Calib_Params& m_params;
const PrintConfig& m_config;
GCodeWriter& m_writer;
Vec2d m_starting_point {-1, -1};
Vec3d m_starting_point;
PatternSettings m_pattern_settings;
const double m_handle_xy_size {5};

View File

@@ -8163,7 +8163,7 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
bbox.merge(obj->instance_bounding_box(i, false));
}
}
pa_pattern.set_starting_point(Vec2d(bbox.min.x(), bbox.max.y()));
pa_pattern.starting_point(Vec3d(bbox.min.x(), bbox.max.y(), 0));
DynamicPrintConfig* print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
DynamicPrintConfig* printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;