Skip to content

Commit

Permalink
fix extrusion reversing check
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Jul 2, 2024
2 parents f4351d2 + 4777e60 commit 15631a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/libslic3r/ExtrusionEntityCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,21 @@ void ExtrusionEntityCollection::chained_path_from(const Point &start_near)
if (this->m_no_sort) {
if (this->m_can_reverse) {
if (m_entities.size() > 1) {
//can't sort myself, ask first and last thign to sort itself so the first point of each are the best ones
//can't sort myself, ask first and last thing to sort itself so the first point of each are the best ones
if (m_entities.front()->is_collection()) {
assert(dynamic_cast<ExtrusionEntityCollection*>(m_entities.front()) != nullptr);
static_cast<ExtrusionEntityCollection*>(m_entities.front())->chained_path_from(start_near);
} else if (m_entities.front()->can_reverse() &&
m_entities.front()->first_point().distance_to_square(start_near) >
m_entities.front()->first_point().distance_to_square(start_near)) {
m_entities.front()->last_point().distance_to_square(start_near)) {
m_entities.front()->reverse();
}
if (m_entities.back()->is_collection()) {
assert(dynamic_cast<ExtrusionEntityCollection*>(m_entities.front()) != nullptr);
static_cast<ExtrusionEntityCollection*>(m_entities.back())->chained_path_from(start_near);
} else if (m_entities.back()->can_reverse() &&
m_entities.back()->first_point().distance_to_square(start_near) >
m_entities.back()->first_point().distance_to_square(start_near)) {
m_entities.back()->last_point().distance_to_square(start_near)) {
m_entities.back()->reverse();
}
//now check if it's better for us to reverse
Expand All @@ -110,14 +110,14 @@ void ExtrusionEntityCollection::chained_path_from(const Point &start_near)
this->reverse();
}
}
// now we are in our good order, update the internals
// now we are in our good order, update the internals to the final order
Point last_point = start_near;
for (ExtrusionEntity *entity : m_entities) {
if (entity->is_collection()) {
assert(dynamic_cast<ExtrusionEntityCollection*>(entity) != nullptr);
static_cast<ExtrusionEntityCollection*>(entity)->chained_path_from(last_point);
} else if (entity->can_reverse() && entity->first_point().distance_to_square(last_point) >
entity->first_point().distance_to_square(last_point)) {
entity->last_point().distance_to_square(last_point)) {
entity->reverse();
}
last_point = entity->last_point();
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5718,7 +5718,7 @@ void GCode::_extrude_line_cut_corner(std::string& gcode_str, const Line& line, c

double GCode::compute_e_per_mm(double path_mm3_per_mm) {
// no e if no extrusion axis
if (m_writer.extrusion_axis().empty())
if (m_writer.extrusion_axis().empty() || path_mm3_per_mm <= 0)
return 0;
// compute
double e_per_mm = path_mm3_per_mm
Expand Down
4 changes: 2 additions & 2 deletions src/slic3r/GUI/DoubleSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ bool Control::ensure_correctly_filled() const
//m_layers_areas.clear();
}
if (!m_layers_values.empty()) {
ok = m_is_wipe_tower;
assert(m_is_wipe_tower);
//ok = m_is_wipe_tower;
//assert(m_is_wipe_tower);
//m_is_wipe_tower = false;
}

Expand Down

0 comments on commit 15631a3

Please sign in to comment.