mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
Changing the internal representation of Point / Pointf / Point3 / Pointf3 to Eigen Matrix types, first step
This commit is contained in:
parent
077680b806
commit
86da661097
60 changed files with 1228 additions and 1206 deletions
|
@ -278,12 +278,12 @@ std::string GCodeWriter::set_speed(double F, const std::string &comment, const s
|
|||
|
||||
std::string GCodeWriter::travel_to_xy(const Pointf &point, const std::string &comment)
|
||||
{
|
||||
m_pos.x = point.x;
|
||||
m_pos.y = point.y;
|
||||
m_pos.x() = point.x();
|
||||
m_pos.y() = point.y();
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << "G1 X" << XYZF_NUM(point.x)
|
||||
<< " Y" << XYZF_NUM(point.y)
|
||||
gcode << "G1 X" << XYZF_NUM(point.x())
|
||||
<< " Y" << XYZF_NUM(point.y())
|
||||
<< " F" << XYZF_NUM(this->config.travel_speed.value * 60.0);
|
||||
COMMENT(comment);
|
||||
gcode << "\n";
|
||||
|
@ -296,9 +296,9 @@ std::string GCodeWriter::travel_to_xyz(const Pointf3 &point, const std::string &
|
|||
don't perform the Z move but we only move in the XY plane and
|
||||
adjust the nominal Z by reducing the lift amount that will be
|
||||
used for unlift. */
|
||||
if (!this->will_move_z(point.z)) {
|
||||
double nominal_z = m_pos.z - m_lifted;
|
||||
m_lifted = m_lifted - (point.z - nominal_z);
|
||||
if (!this->will_move_z(point.z())) {
|
||||
double nominal_z = m_pos.z() - m_lifted;
|
||||
m_lifted = m_lifted - (point.z() - nominal_z);
|
||||
return this->travel_to_xy(point);
|
||||
}
|
||||
|
||||
|
@ -308,9 +308,9 @@ std::string GCodeWriter::travel_to_xyz(const Pointf3 &point, const std::string &
|
|||
m_pos = point;
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << "G1 X" << XYZF_NUM(point.x)
|
||||
<< " Y" << XYZF_NUM(point.y)
|
||||
<< " Z" << XYZF_NUM(point.z)
|
||||
gcode << "G1 X" << XYZF_NUM(point.x())
|
||||
<< " Y" << XYZF_NUM(point.y())
|
||||
<< " Z" << XYZF_NUM(point.z())
|
||||
<< " F" << XYZF_NUM(this->config.travel_speed.value * 60.0);
|
||||
COMMENT(comment);
|
||||
gcode << "\n";
|
||||
|
@ -323,7 +323,7 @@ std::string GCodeWriter::travel_to_z(double z, const std::string &comment)
|
|||
we don't perform the move but we only adjust the nominal Z by
|
||||
reducing the lift amount that will be used for unlift. */
|
||||
if (!this->will_move_z(z)) {
|
||||
double nominal_z = m_pos.z - m_lifted;
|
||||
double nominal_z = m_pos.z() - m_lifted;
|
||||
m_lifted = m_lifted - (z - nominal_z);
|
||||
return "";
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ std::string GCodeWriter::travel_to_z(double z, const std::string &comment)
|
|||
|
||||
std::string GCodeWriter::_travel_to_z(double z, const std::string &comment)
|
||||
{
|
||||
m_pos.z = z;
|
||||
m_pos.z() = z;
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << "G1 Z" << XYZF_NUM(z)
|
||||
|
@ -351,8 +351,8 @@ bool GCodeWriter::will_move_z(double z) const
|
|||
/* If target Z is lower than current Z but higher than nominal Z
|
||||
we don't perform an actual Z move. */
|
||||
if (m_lifted > 0) {
|
||||
double nominal_z = m_pos.z - m_lifted;
|
||||
if (z >= nominal_z && z <= m_pos.z)
|
||||
double nominal_z = m_pos.z() - m_lifted;
|
||||
if (z >= nominal_z && z <= m_pos.z())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -360,13 +360,13 @@ bool GCodeWriter::will_move_z(double z) const
|
|||
|
||||
std::string GCodeWriter::extrude_to_xy(const Pointf &point, double dE, const std::string &comment)
|
||||
{
|
||||
m_pos.x = point.x;
|
||||
m_pos.y = point.y;
|
||||
m_pos.x() = point.x();
|
||||
m_pos.y() = point.y();
|
||||
m_extruder->extrude(dE);
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << "G1 X" << XYZF_NUM(point.x)
|
||||
<< " Y" << XYZF_NUM(point.y)
|
||||
gcode << "G1 X" << XYZF_NUM(point.x())
|
||||
<< " Y" << XYZF_NUM(point.y())
|
||||
<< " " << m_extrusion_axis << E_NUM(m_extruder->E());
|
||||
COMMENT(comment);
|
||||
gcode << "\n";
|
||||
|
@ -380,9 +380,9 @@ std::string GCodeWriter::extrude_to_xyz(const Pointf3 &point, double dE, const s
|
|||
m_extruder->extrude(dE);
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << "G1 X" << XYZF_NUM(point.x)
|
||||
<< " Y" << XYZF_NUM(point.y)
|
||||
<< " Z" << XYZF_NUM(point.z)
|
||||
gcode << "G1 X" << XYZF_NUM(point.x())
|
||||
<< " Y" << XYZF_NUM(point.y())
|
||||
<< " Z" << XYZF_NUM(point.z())
|
||||
<< " " << m_extrusion_axis << E_NUM(m_extruder->E());
|
||||
COMMENT(comment);
|
||||
gcode << "\n";
|
||||
|
@ -486,12 +486,12 @@ std::string GCodeWriter::lift()
|
|||
{
|
||||
double above = this->config.retract_lift_above.get_at(m_extruder->id());
|
||||
double below = this->config.retract_lift_below.get_at(m_extruder->id());
|
||||
if (m_pos.z >= above && (below == 0 || m_pos.z <= below))
|
||||
if (m_pos.z() >= above && (below == 0 || m_pos.z() <= below))
|
||||
target_lift = this->config.retract_lift.get_at(m_extruder->id());
|
||||
}
|
||||
if (m_lifted == 0 && target_lift > 0) {
|
||||
m_lifted = target_lift;
|
||||
return this->_travel_to_z(m_pos.z + target_lift, "lift Z");
|
||||
return this->_travel_to_z(m_pos.z() + target_lift, "lift Z");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ std::string GCodeWriter::unlift()
|
|||
{
|
||||
std::string gcode;
|
||||
if (m_lifted > 0) {
|
||||
gcode += this->_travel_to_z(m_pos.z - m_lifted, "restore layer Z");
|
||||
gcode += this->_travel_to_z(m_pos.z() - m_lifted, "restore layer Z");
|
||||
m_lifted = 0;
|
||||
}
|
||||
return gcode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue