Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libslic3r/EdgeGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class Grid
assert(ixb >= 0 && size_t(ixb) < m_cols);
assert(iyb >= 0 && size_t(iyb) < m_rows);
// Account for the end points.
if (! visitor(iy, ix) || (ix == ixb && iy == iyb))
if ((ix == ixb && iy == iyb) || ! visitor(iy, ix))
// Both ends fall into the same cell.
return;
// Raster the centeral part of the line.
Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/GCode/CoolingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
if (*line_end == '\n')
++ line_end;
CoolingLine line(0, line_start - gcode.c_str(), line_end - gcode.c_str());
if (line.length() == 0)
continue; // Empty line.
if (boost::starts_with(sline, "G0 "))
line.type = CoolingLine::TYPE_G0;
else if (boost::starts_with(sline, "G1 "))
Expand Down
15 changes: 12 additions & 3 deletions src/libslic3r/Polyline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,18 @@ void ThickPolyline::clip_end(double distance)

void ThickPolyline::start_at_index(int index)
{
assert(index >= 0 && index < this->points.size());
assert(this->points.front() == this->points.back() && this->width.front() == this->width.back());
if (index != 0 && index + 1 != int(this->points.size()) && this->points.front() == this->points.back() && this->width.front() == this->width.back()) {
assert(index >= 0 && index < (int)this->points.size());

// Operate only on properly closed ThickPolylines
if (this->points.empty())
return;
if (!(this->points.front() == this->points.back() &&
!this->width.empty() && this->width.front() == this->width.back())) {
// Not a properly closed ThickPolyline — nothing to rotate.
return;
}

if (index != 0 && index + 1 != int(this->points.size())) {
this->points.pop_back();
assert(this->points.size() * 2 == this->width.size());
std::rotate(this->points.begin(), this->points.begin() + index, this->points.end());
Expand Down
12 changes: 8 additions & 4 deletions src/slic3r/GUI/DoubleSliderForLayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,10 +1045,14 @@ bool DSForLayers::is_wipe_tower_layer(int tick) const
return false;
if (tick == 0 || (tick == (int)m_values.size() - 1 && m_values[tick] > m_values[tick - 1]))
return false;
if ((m_values[tick - 1] == m_values[tick + 1] && m_values[tick] < m_values[tick + 1]) ||
(tick > 0 && m_values[tick] < m_values[tick - 1]) ) // if there is just one wiping on the layer
return true;

// Make sure we don't access past the end of m_values (tick+1 must be valid).
if (tick > 0) {
if (tick + 1 < (int)m_values.size() &&
m_values[tick - 1] == m_values[tick + 1] && m_values[tick] < m_values[tick + 1])
return true;
if (m_values[tick] < m_values[tick - 1]) // if there is just one wiping on the layer
return true;
}
return false;
}

Expand Down