Merge branch 'master' of https://github.com/Prusa3d/PrusaSlicer
This commit is contained in:
commit
72ba890091
@ -169,8 +169,19 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE
|
|||||||
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
|
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
|
||||||
add_compile_options(-Werror=return-type)
|
add_compile_options(-Werror=return-type)
|
||||||
|
|
||||||
#removes LOTS of extraneous Eigen warnings
|
#removes LOTS of extraneous Eigen warnings (GCC only supports it since 6.1)
|
||||||
|
#if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.1)
|
||||||
# add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM
|
# add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
#GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
|
||||||
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
|
||||||
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
|
||||||
|
# We will turn the warning of for GCC for now:
|
||||||
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
add_compile_options(-Wno-unknown-pragmas)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if (SLIC3R_ASAN)
|
if (SLIC3R_ASAN)
|
||||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||||
|
@ -146,10 +146,10 @@ void EdgeGrid::Grid::create_from_m_contours(coord_t resolution)
|
|||||||
coord_t iy = p1(1) / m_resolution;
|
coord_t iy = p1(1) / m_resolution;
|
||||||
coord_t ixb = p2(0) / m_resolution;
|
coord_t ixb = p2(0) / m_resolution;
|
||||||
coord_t iyb = p2(1) / m_resolution;
|
coord_t iyb = p2(1) / m_resolution;
|
||||||
assert(ix >= 0 && ix < m_cols);
|
assert(ix >= 0 && size_t(ix) < m_cols);
|
||||||
assert(iy >= 0 && iy < m_rows);
|
assert(iy >= 0 && size_t(iy) < m_rows);
|
||||||
assert(ixb >= 0 && ixb < m_cols);
|
assert(ixb >= 0 && size_t(ixb) < m_cols);
|
||||||
assert(iyb >= 0 && iyb < m_rows);
|
assert(iyb >= 0 && size_t(iyb) < m_rows);
|
||||||
// Account for the end points.
|
// Account for the end points.
|
||||||
++ m_cells[iy*m_cols+ix].end;
|
++ m_cells[iy*m_cols+ix].end;
|
||||||
if (ix == ixb && iy == iyb)
|
if (ix == ixb && iy == iyb)
|
||||||
@ -290,10 +290,10 @@ void EdgeGrid::Grid::create_from_m_contours(coord_t resolution)
|
|||||||
coord_t iy = p1(1) / m_resolution;
|
coord_t iy = p1(1) / m_resolution;
|
||||||
coord_t ixb = p2(0) / m_resolution;
|
coord_t ixb = p2(0) / m_resolution;
|
||||||
coord_t iyb = p2(1) / m_resolution;
|
coord_t iyb = p2(1) / m_resolution;
|
||||||
assert(ix >= 0 && ix < m_cols);
|
assert(ix >= 0 && size_t(ix) < m_cols);
|
||||||
assert(iy >= 0 && iy < m_rows);
|
assert(iy >= 0 && size_t(iy) < m_rows);
|
||||||
assert(ixb >= 0 && ixb < m_cols);
|
assert(ixb >= 0 && size_t(ixb) < m_cols);
|
||||||
assert(iyb >= 0 && iyb < m_rows);
|
assert(iyb >= 0 && size_t(iyb) < m_rows);
|
||||||
// Account for the end points.
|
// Account for the end points.
|
||||||
m_cell_data[m_cells[iy*m_cols + ix].end++] = std::pair<size_t, size_t>(i, j);
|
m_cell_data[m_cells[iy*m_cols + ix].end++] = std::pair<size_t, size_t>(i, j);
|
||||||
if (ix == ixb && iy == iyb)
|
if (ix == ixb && iy == iyb)
|
||||||
@ -775,11 +775,11 @@ void EdgeGrid::Grid::calculate_sdf()
|
|||||||
// For each corner of this cell and its 1 ring neighbours:
|
// For each corner of this cell and its 1 ring neighbours:
|
||||||
for (int corner_y = -1; corner_y < 3; ++ corner_y) {
|
for (int corner_y = -1; corner_y < 3; ++ corner_y) {
|
||||||
coord_t corner_r = r + corner_y;
|
coord_t corner_r = r + corner_y;
|
||||||
if (corner_r < 0 || corner_r >= nrows)
|
if (corner_r < 0 || (size_t)corner_r >= nrows)
|
||||||
continue;
|
continue;
|
||||||
for (int corner_x = -1; corner_x < 3; ++ corner_x) {
|
for (int corner_x = -1; corner_x < 3; ++ corner_x) {
|
||||||
coord_t corner_c = c + corner_x;
|
coord_t corner_c = c + corner_x;
|
||||||
if (corner_c < 0 || corner_c >= ncols)
|
if (corner_c < 0 || (size_t)corner_c >= ncols)
|
||||||
continue;
|
continue;
|
||||||
float &d_min = m_signed_distance_field[corner_r * ncols + corner_c];
|
float &d_min = m_signed_distance_field[corner_r * ncols + corner_c];
|
||||||
Slic3r::Point pt(m_bbox.min(0) + corner_c * m_resolution, m_bbox.min(1) + corner_r * m_resolution);
|
Slic3r::Point pt(m_bbox.min(0) + corner_c * m_resolution, m_bbox.min(1) + corner_r * m_resolution);
|
||||||
@ -1137,9 +1137,9 @@ bool EdgeGrid::Grid::signed_distance_edges(const Point &pt, coord_t search_radiu
|
|||||||
return false;
|
return false;
|
||||||
bbox.max(0) /= m_resolution;
|
bbox.max(0) /= m_resolution;
|
||||||
bbox.max(1) /= m_resolution;
|
bbox.max(1) /= m_resolution;
|
||||||
if (bbox.max(0) >= m_cols)
|
if ((size_t)bbox.max(0) >= m_cols)
|
||||||
bbox.max(0) = m_cols - 1;
|
bbox.max(0) = m_cols - 1;
|
||||||
if (bbox.max(1) >= m_rows)
|
if ((size_t)bbox.max(1) >= m_rows)
|
||||||
bbox.max(1) = m_rows - 1;
|
bbox.max(1) = m_rows - 1;
|
||||||
// Lower boundary, round to grid and test validity.
|
// Lower boundary, round to grid and test validity.
|
||||||
bbox.min(0) -= search_radius;
|
bbox.min(0) -= search_radius;
|
||||||
|
@ -78,8 +78,8 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
bool cell_inside_or_crossing(int r, int c) const
|
bool cell_inside_or_crossing(int r, int c) const
|
||||||
{
|
{
|
||||||
if (r < 0 || r >= m_rows ||
|
if (r < 0 || (size_t)r >= m_rows ||
|
||||||
c < 0 || c >= m_cols)
|
c < 0 || (size_t)c >= m_cols)
|
||||||
// The cell is outside the domain. Hoping that the contours were correctly oriented, so
|
// The cell is outside the domain. Hoping that the contours were correctly oriented, so
|
||||||
// there is a CCW outmost contour so the out of domain cells are outside.
|
// there is a CCW outmost contour so the out of domain cells are outside.
|
||||||
return false;
|
return false;
|
||||||
|
@ -660,7 +660,7 @@ void gcode_spread_points(
|
|||||||
for (ExtrusionPoints::const_iterator it = points.begin(); it != points.end(); ++ it) {
|
for (ExtrusionPoints::const_iterator it = points.begin(); it != points.end(); ++ it) {
|
||||||
const V2f ¢er = it->center;
|
const V2f ¢er = it->center;
|
||||||
const float radius = it->radius;
|
const float radius = it->radius;
|
||||||
const float radius2 = radius * radius;
|
//const float radius2 = radius * radius;
|
||||||
const float height_target = it->height;
|
const float height_target = it->height;
|
||||||
B2f bbox(center - V2f(radius, radius), center + V2f(radius, radius));
|
B2f bbox(center - V2f(radius, radius), center + V2f(radius, radius));
|
||||||
B2i bboxi(
|
B2i bboxi(
|
||||||
@ -774,8 +774,8 @@ void gcode_spread_points(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
float area_circle_total2 = float(M_PI) * sqr(radius);
|
// float area_circle_total2 = float(M_PI) * sqr(radius);
|
||||||
float area_err = fabs(area_circle_total2 - area_circle_total) / area_circle_total2;
|
// float area_err = fabs(area_circle_total2 - area_circle_total) / area_circle_total2;
|
||||||
// printf("area_circle_total: %f, %f, %f\n", area_circle_total, area_circle_total2, area_err);
|
// printf("area_circle_total: %f, %f, %f\n", area_circle_total, area_circle_total2, area_err);
|
||||||
float volume_full = float(M_PI) * sqr(radius) * height_target;
|
float volume_full = float(M_PI) * sqr(radius) * height_target;
|
||||||
// if (true) {
|
// if (true) {
|
||||||
@ -905,8 +905,8 @@ void ExtrusionSimulator::set_image_size(const Point &image_size)
|
|||||||
// printf("Allocating image data, allocated\n");
|
// printf("Allocating image data, allocated\n");
|
||||||
|
|
||||||
//FIXME fill the image with red vertical lines.
|
//FIXME fill the image with red vertical lines.
|
||||||
for (size_t r = 0; r < image_size.y(); ++ r) {
|
for (size_t r = 0; r < size_t(image_size.y()); ++ r) {
|
||||||
for (size_t c = 0; c < image_size.x(); c += 2) {
|
for (size_t c = 0; c < size_t(image_size.x()); c += 2) {
|
||||||
// Color red
|
// Color red
|
||||||
pimpl->image_data[r * image_size.x() * 4 + c * 4] = 255;
|
pimpl->image_data[r * image_size.x() * 4 + c * 4] = 255;
|
||||||
// Opacity full
|
// Opacity full
|
||||||
@ -958,7 +958,7 @@ void ExtrusionSimulator::extrude_to_accumulator(const ExtrusionPath &path, const
|
|||||||
float scalex = float(viewport.size().x()) / float(bbox.size().x());
|
float scalex = float(viewport.size().x()) / float(bbox.size().x());
|
||||||
float scaley = float(viewport.size().y()) / float(bbox.size().y());
|
float scaley = float(viewport.size().y()) / float(bbox.size().y());
|
||||||
float w = scale_(path.width) * scalex;
|
float w = scale_(path.width) * scalex;
|
||||||
float h = scale_(path.height) * scalex;
|
//float h = scale_(path.height) * scalex;
|
||||||
w = scale_(path.mm3_per_mm / path.height) * scalex;
|
w = scale_(path.mm3_per_mm / path.height) * scalex;
|
||||||
// printf("scalex: %f, scaley: %f\n", scalex, scaley);
|
// printf("scalex: %f, scaley: %f\n", scalex, scaley);
|
||||||
// printf("bbox: %d,%d %d,%d\n", bbox.min.x(), bbox.min.y, bbox.max.x(), bbox.max.y);
|
// printf("bbox: %d,%d %d,%d\n", bbox.min.x(), bbox.min.y, bbox.max.x(), bbox.max.y);
|
||||||
@ -993,8 +993,8 @@ void ExtrusionSimulator::evaluate_accumulator(ExtrusionSimulationType simulation
|
|||||||
for (int r = 0; r < sz.y(); ++r) {
|
for (int r = 0; r < sz.y(); ++r) {
|
||||||
for (int c = 0; c < sz.x(); ++c) {
|
for (int c = 0; c < sz.x(); ++c) {
|
||||||
float p = 0;
|
float p = 0;
|
||||||
for (int j = 0; j < pimpl->bitmap_oversampled; ++ j) {
|
for (unsigned int j = 0; j < pimpl->bitmap_oversampled; ++ j) {
|
||||||
for (int i = 0; i < pimpl->bitmap_oversampled; ++ i) {
|
for (unsigned int i = 0; i < pimpl->bitmap_oversampled; ++ i) {
|
||||||
if (pimpl->bitmap[r * pimpl->bitmap_oversampled + j][c * pimpl->bitmap_oversampled + i])
|
if (pimpl->bitmap[r * pimpl->bitmap_oversampled + j][c * pimpl->bitmap_oversampled + i])
|
||||||
p += 1.f;
|
p += 1.f;
|
||||||
}
|
}
|
||||||
|
@ -130,14 +130,14 @@ static inline Point hilbert_n_to_xy(const size_t n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int state = (ndigits & 1) ? 4 : 0;
|
int state = (ndigits & 1) ? 4 : 0;
|
||||||
int dirstate = (ndigits & 1) ? 0 : 4;
|
// int dirstate = (ndigits & 1) ? 0 : 4;
|
||||||
coord_t x = 0;
|
coord_t x = 0;
|
||||||
coord_t y = 0;
|
coord_t y = 0;
|
||||||
for (int i = (int)ndigits - 1; i >= 0; -- i) {
|
for (int i = (int)ndigits - 1; i >= 0; -- i) {
|
||||||
int digit = (n >> (i * 2)) & 3;
|
int digit = (n >> (i * 2)) & 3;
|
||||||
state += digit;
|
state += digit;
|
||||||
if (digit != 3)
|
// if (digit != 3)
|
||||||
dirstate = state; // lowest non-3 digit
|
// dirstate = state; // lowest non-3 digit
|
||||||
x |= digit_to_x[state] << i;
|
x |= digit_to_x[state] << i;
|
||||||
y |= digit_to_y[state] << i;
|
y |= digit_to_y[state] << i;
|
||||||
state = next_state[state];
|
state = next_state[state];
|
||||||
|
@ -287,7 +287,8 @@ public:
|
|||||||
assert(aoffset1 < 0);
|
assert(aoffset1 < 0);
|
||||||
assert(aoffset2 < 0);
|
assert(aoffset2 < 0);
|
||||||
assert(aoffset2 < aoffset1);
|
assert(aoffset2 < aoffset1);
|
||||||
bool sticks_removed = remove_sticks(polygons_src);
|
// bool sticks_removed =
|
||||||
|
remove_sticks(polygons_src);
|
||||||
// if (sticks_removed) printf("Sticks removed!\n");
|
// if (sticks_removed) printf("Sticks removed!\n");
|
||||||
polygons_outer = offset(polygons_src, aoffset1,
|
polygons_outer = offset(polygons_src, aoffset1,
|
||||||
ClipperLib::jtMiter,
|
ClipperLib::jtMiter,
|
||||||
@ -481,7 +482,7 @@ static inline IntersectionTypeOtherVLine intersection_type_on_prev_next_vertical
|
|||||||
{
|
{
|
||||||
// This routine will propose a connecting line even if the connecting perimeter segment intersects
|
// This routine will propose a connecting line even if the connecting perimeter segment intersects
|
||||||
// iVertical line multiple times before reaching iIntersectionOther.
|
// iVertical line multiple times before reaching iIntersectionOther.
|
||||||
if (iIntersectionOther == -1)
|
if (iIntersectionOther == size_t(-1))
|
||||||
return INTERSECTION_TYPE_OTHER_VLINE_UNDEFINED;
|
return INTERSECTION_TYPE_OTHER_VLINE_UNDEFINED;
|
||||||
assert(dir_is_next ? (iVerticalLine + 1 < segs.size()) : (iVerticalLine > 0));
|
assert(dir_is_next ? (iVerticalLine + 1 < segs.size()) : (iVerticalLine > 0));
|
||||||
const SegmentedIntersectionLine &il_this = segs[iVerticalLine];
|
const SegmentedIntersectionLine &il_this = segs[iVerticalLine];
|
||||||
@ -858,8 +859,8 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
|
|||||||
if (il > ir)
|
if (il > ir)
|
||||||
// No vertical line intersects this segment.
|
// No vertical line intersects this segment.
|
||||||
continue;
|
continue;
|
||||||
assert(il >= 0 && il < segs.size());
|
assert(il >= 0 && size_t(il) < segs.size());
|
||||||
assert(ir >= 0 && ir < segs.size());
|
assert(ir >= 0 && size_t(ir) < segs.size());
|
||||||
for (int i = il; i <= ir; ++ i) {
|
for (int i = il; i <= ir; ++ i) {
|
||||||
coord_t this_x = segs[i].pos;
|
coord_t this_x = segs[i].pos;
|
||||||
assert(this_x == i * line_spacing + x0);
|
assert(this_x == i * line_spacing + x0);
|
||||||
@ -1159,8 +1160,8 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
|
|||||||
int iSegAbove = -1;
|
int iSegAbove = -1;
|
||||||
int iSegBelow = -1;
|
int iSegBelow = -1;
|
||||||
{
|
{
|
||||||
SegmentIntersection::SegmentIntersectionType type_crossing = (intrsctn->type == SegmentIntersection::INNER_LOW) ?
|
// SegmentIntersection::SegmentIntersectionType type_crossing = (intrsctn->type == SegmentIntersection::INNER_LOW) ?
|
||||||
SegmentIntersection::INNER_HIGH : SegmentIntersection::INNER_LOW;
|
// SegmentIntersection::INNER_HIGH : SegmentIntersection::INNER_LOW;
|
||||||
// Does the perimeter intersect the current vertical line above intrsctn?
|
// Does the perimeter intersect the current vertical line above intrsctn?
|
||||||
for (size_t i = i_intersection + 1; i + 1 < seg.intersections.size(); ++ i)
|
for (size_t i = i_intersection + 1; i + 1 < seg.intersections.size(); ++ i)
|
||||||
// if (seg.intersections[i].iContour == intrsctn->iContour && seg.intersections[i].type == type_crossing) {
|
// if (seg.intersections[i].iContour == intrsctn->iContour && seg.intersections[i].type == type_crossing) {
|
||||||
|
@ -849,7 +849,7 @@ static inline IntersectionTypeOtherVLine intersection_type_on_prev_next_vertical
|
|||||||
{
|
{
|
||||||
// This routine will propose a connecting line even if the connecting perimeter segment intersects
|
// This routine will propose a connecting line even if the connecting perimeter segment intersects
|
||||||
// iVertical line multiple times before reaching iIntersectionOther.
|
// iVertical line multiple times before reaching iIntersectionOther.
|
||||||
if (iIntersectionOther == -1)
|
if (iIntersectionOther == size_t(-1))
|
||||||
return INTERSECTION_TYPE_OTHER_VLINE_UNDEFINED;
|
return INTERSECTION_TYPE_OTHER_VLINE_UNDEFINED;
|
||||||
assert(dir_is_next ? (iVerticalLine + 1 < segs.size()) : (iVerticalLine > 0));
|
assert(dir_is_next ? (iVerticalLine + 1 < segs.size()) : (iVerticalLine > 0));
|
||||||
const SegmentedIntersectionLine &il_this = segs[iVerticalLine];
|
const SegmentedIntersectionLine &il_this = segs[iVerticalLine];
|
||||||
@ -1284,8 +1284,8 @@ static bool fill_hatching_segments_legacy(
|
|||||||
int iSegAbove = -1;
|
int iSegAbove = -1;
|
||||||
int iSegBelow = -1;
|
int iSegBelow = -1;
|
||||||
{
|
{
|
||||||
SegmentIntersection::SegmentIntersectionType type_crossing = (intrsctn->type == SegmentIntersection::INNER_LOW) ?
|
// SegmentIntersection::SegmentIntersectionType type_crossing = (intrsctn->type == SegmentIntersection::INNER_LOW) ?
|
||||||
SegmentIntersection::INNER_HIGH : SegmentIntersection::INNER_LOW;
|
// SegmentIntersection::INNER_HIGH : SegmentIntersection::INNER_LOW;
|
||||||
// Does the perimeter intersect the current vertical line above intrsctn?
|
// Does the perimeter intersect the current vertical line above intrsctn?
|
||||||
for (size_t i = i_intersection + 1; i + 1 < seg.intersections.size(); ++ i)
|
for (size_t i = i_intersection + 1; i + 1 < seg.intersections.size(); ++ i)
|
||||||
// if (seg.intersections[i].iContour == intrsctn->iContour && seg.intersections[i].type == type_crossing) {
|
// if (seg.intersections[i].iContour == intrsctn->iContour && seg.intersections[i].type == type_crossing) {
|
||||||
|
@ -696,7 +696,7 @@ namespace Slic3r {
|
|||||||
if (!XML_ParseBuffer(m_xml_parser, (int)stat.m_uncomp_size, 1))
|
if (!XML_ParseBuffer(m_xml_parser, (int)stat.m_uncomp_size, 1))
|
||||||
{
|
{
|
||||||
char error_buf[1024];
|
char error_buf[1024];
|
||||||
::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), XML_GetCurrentLineNumber(m_xml_parser));
|
::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), (int)XML_GetCurrentLineNumber(m_xml_parser));
|
||||||
add_error(error_buf);
|
add_error(error_buf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -976,7 +976,7 @@ namespace Slic3r {
|
|||||||
if (!XML_ParseBuffer(m_xml_parser, (int)stat.m_uncomp_size, 1))
|
if (!XML_ParseBuffer(m_xml_parser, (int)stat.m_uncomp_size, 1))
|
||||||
{
|
{
|
||||||
char error_buf[1024];
|
char error_buf[1024];
|
||||||
::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), XML_GetCurrentLineNumber(m_xml_parser));
|
::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), (int)XML_GetCurrentLineNumber(m_xml_parser));
|
||||||
add_error(error_buf);
|
add_error(error_buf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1533,7 +1533,7 @@ namespace Slic3r {
|
|||||||
object->second.metadata.emplace_back(key, value);
|
object->second.metadata.emplace_back(key, value);
|
||||||
else if (type == VOLUME_TYPE)
|
else if (type == VOLUME_TYPE)
|
||||||
{
|
{
|
||||||
if (m_curr_config.volume_id < object->second.volumes.size())
|
if (size_t(m_curr_config.volume_id) < object->second.volumes.size())
|
||||||
object->second.volumes[m_curr_config.volume_id].metadata.emplace_back(key, value);
|
object->second.volumes[m_curr_config.volume_id].metadata.emplace_back(key, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -722,8 +722,8 @@ bool load_amf_file(const char *path, DynamicPrintConfig *config, Model *model)
|
|||||||
}
|
}
|
||||||
int done = feof(pFile);
|
int done = feof(pFile);
|
||||||
if (XML_Parse(parser, buff, len, done) == XML_STATUS_ERROR) {
|
if (XML_Parse(parser, buff, len, done) == XML_STATUS_ERROR) {
|
||||||
printf("AMF parser: Parse error at line %ul:\n%s\n",
|
printf("AMF parser: Parse error at line %d:\n%s\n",
|
||||||
XML_GetCurrentLineNumber(parser),
|
(int)XML_GetCurrentLineNumber(parser),
|
||||||
XML_ErrorString(XML_GetErrorCode(parser)));
|
XML_ErrorString(XML_GetErrorCode(parser)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -781,7 +781,7 @@ bool extract_model_from_archive(mz_zip_archive& archive, const mz_zip_archive_fi
|
|||||||
|
|
||||||
if (!XML_ParseBuffer(parser, (int)stat.m_uncomp_size, 1))
|
if (!XML_ParseBuffer(parser, (int)stat.m_uncomp_size, 1))
|
||||||
{
|
{
|
||||||
printf("Error (%s) while parsing xml file at line %d\n", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
printf("Error (%s) while parsing xml file at line %d\n", XML_ErrorString(XML_GetErrorCode(parser)), (int)XML_GetCurrentLineNumber(parser));
|
||||||
close_zip_reader(&archive);
|
close_zip_reader(&archive);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1010,7 +1010,7 @@ bool store_amf(const char *path, Model *model, const DynamicPrintConfig *config)
|
|||||||
stream << " <metadata type=\"slic3r.modifier\">1</metadata>\n";
|
stream << " <metadata type=\"slic3r.modifier\">1</metadata>\n";
|
||||||
stream << " <metadata type=\"slic3r.volume_type\">" << ModelVolume::type_to_string(volume->type()) << "</metadata>\n";
|
stream << " <metadata type=\"slic3r.volume_type\">" << ModelVolume::type_to_string(volume->type()) << "</metadata>\n";
|
||||||
const indexed_triangle_set &its = volume->mesh().its;
|
const indexed_triangle_set &its = volume->mesh().its;
|
||||||
for (size_t i = 0; i < (int)its.indices.size(); ++i) {
|
for (size_t i = 0; i < its.indices.size(); ++i) {
|
||||||
stream << " <triangle>\n";
|
stream << " <triangle>\n";
|
||||||
for (int j = 0; j < 3; ++j)
|
for (int j = 0; j < 3; ++j)
|
||||||
stream << " <v" << j + 1 << ">" << its.indices[i][j] + vertices_offset << "</v" << j + 1 << ">\n";
|
stream << " <v" << j + 1 << ">" << its.indices[i][j] + vertices_offset << "</v" << j + 1 << ">\n";
|
||||||
|
@ -176,8 +176,7 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
EATWS();
|
EATWS();
|
||||||
if (*line == 0)
|
if (*line == 0)
|
||||||
return false;
|
return false;
|
||||||
// number of vertices of this face
|
|
||||||
int n = 0;
|
|
||||||
// current vertex to be parsed
|
// current vertex to be parsed
|
||||||
ObjVertex vertex;
|
ObjVertex vertex;
|
||||||
char *endptr = 0;
|
char *endptr = 0;
|
||||||
@ -266,7 +265,6 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
{
|
{
|
||||||
// o [object name]
|
// o [object name]
|
||||||
EATWS();
|
EATWS();
|
||||||
const char *name = line;
|
|
||||||
while (*line != ' ' && *line != '\t' && *line != 0)
|
while (*line != ' ' && *line != '\t' && *line != 0)
|
||||||
++ line;
|
++ line;
|
||||||
// copy name to line.
|
// copy name to line.
|
||||||
|
@ -375,10 +375,10 @@ std::string WipeTowerIntegration::prime(GCode &gcodegen)
|
|||||||
std::string WipeTowerIntegration::tool_change(GCode &gcodegen, int extruder_id, bool finish_layer)
|
std::string WipeTowerIntegration::tool_change(GCode &gcodegen, int extruder_id, bool finish_layer)
|
||||||
{
|
{
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
assert(m_layer_idx >= 0 && m_layer_idx <= m_tool_changes.size());
|
assert(m_layer_idx >= 0 && size_t(m_layer_idx) <= m_tool_changes.size());
|
||||||
if (! m_brim_done || gcodegen.writer().need_toolchange(extruder_id) || finish_layer) {
|
if (! m_brim_done || gcodegen.writer().need_toolchange(extruder_id) || finish_layer) {
|
||||||
if (m_layer_idx < m_tool_changes.size()) {
|
if (m_layer_idx < (int)m_tool_changes.size()) {
|
||||||
assert(m_tool_change_idx < m_tool_changes[m_layer_idx].size());
|
assert(size_t(m_tool_change_idx) < m_tool_changes[m_layer_idx].size());
|
||||||
gcode += append_tcr(gcodegen, m_tool_changes[m_layer_idx][m_tool_change_idx++], extruder_id);
|
gcode += append_tcr(gcodegen, m_tool_changes[m_layer_idx][m_tool_change_idx++], extruder_id);
|
||||||
}
|
}
|
||||||
m_brim_done = true;
|
m_brim_done = true;
|
||||||
@ -1311,7 +1311,7 @@ void GCode::_print_first_layer_extruder_temperatures(FILE *file, Print &print, c
|
|||||||
int temp = print.config().first_layer_temperature.get_at(first_printing_extruder_id);
|
int temp = print.config().first_layer_temperature.get_at(first_printing_extruder_id);
|
||||||
if (temp_by_gcode >= 0 && temp_by_gcode < 1000)
|
if (temp_by_gcode >= 0 && temp_by_gcode < 1000)
|
||||||
temp = temp_by_gcode;
|
temp = temp_by_gcode;
|
||||||
m_writer.set_temperature(temp_by_gcode, wait, first_printing_extruder_id);
|
m_writer.set_temperature(temp, wait, first_printing_extruder_id);
|
||||||
} else {
|
} else {
|
||||||
// Custom G-code does not set the extruder temperature. Do it now.
|
// Custom G-code does not set the extruder temperature. Do it now.
|
||||||
if (print.config().single_extruder_multi_material.value) {
|
if (print.config().single_extruder_multi_material.value) {
|
||||||
@ -1402,11 +1402,11 @@ void GCode::process_layer(
|
|||||||
// Check whether it is possible to apply the spiral vase logic for this layer.
|
// Check whether it is possible to apply the spiral vase logic for this layer.
|
||||||
// Just a reminder: A spiral vase mode is allowed for a single object, single material print only.
|
// Just a reminder: A spiral vase mode is allowed for a single object, single material print only.
|
||||||
if (m_spiral_vase && layers.size() == 1 && support_layer == nullptr) {
|
if (m_spiral_vase && layers.size() == 1 && support_layer == nullptr) {
|
||||||
bool enable = (layer.id() > 0 || print.config().brim_width.value == 0.) && (layer.id() >= print.config().skirt_height.value && ! print.has_infinite_skirt());
|
bool enable = (layer.id() > 0 || print.config().brim_width.value == 0.) && (layer.id() >= (size_t)print.config().skirt_height.value && ! print.has_infinite_skirt());
|
||||||
if (enable) {
|
if (enable) {
|
||||||
for (const LayerRegion *layer_region : layer.regions())
|
for (const LayerRegion *layer_region : layer.regions())
|
||||||
if (layer_region->region()->config().bottom_solid_layers.value > layer.id() ||
|
if (size_t(layer_region->region()->config().bottom_solid_layers.value) > layer.id() ||
|
||||||
layer_region->perimeters.items_count() > 1 ||
|
layer_region->perimeters.items_count() > 1u ||
|
||||||
layer_region->fills.items_count() > 0) {
|
layer_region->fills.items_count() > 0) {
|
||||||
enable = false;
|
enable = false;
|
||||||
break;
|
break;
|
||||||
@ -1474,11 +1474,11 @@ void GCode::process_layer(
|
|||||||
bool extrude_skirt =
|
bool extrude_skirt =
|
||||||
! print.skirt().entities.empty() &&
|
! print.skirt().entities.empty() &&
|
||||||
// Not enough skirt layers printed yet.
|
// Not enough skirt layers printed yet.
|
||||||
(m_skirt_done.size() < print.config().skirt_height.value || print.has_infinite_skirt()) &&
|
(m_skirt_done.size() < (size_t)print.config().skirt_height.value || print.has_infinite_skirt()) &&
|
||||||
// This print_z has not been extruded yet
|
// This print_z has not been extruded yet
|
||||||
(m_skirt_done.empty() ? 0. : m_skirt_done.back()) < print_z - EPSILON &&
|
(m_skirt_done.empty() ? 0. : m_skirt_done.back()) < print_z - EPSILON &&
|
||||||
// and this layer is the 1st layer, or it is an object layer, or it is a raft layer.
|
// and this layer is the 1st layer, or it is an object layer, or it is a raft layer.
|
||||||
(first_layer || object_layer != nullptr || support_layer->id() < m_config.raft_layers.value);
|
(first_layer || object_layer != nullptr || support_layer->id() < (size_t)m_config.raft_layers.value);
|
||||||
std::map<unsigned int, std::pair<size_t, size_t>> skirt_loops_per_extruder;
|
std::map<unsigned int, std::pair<size_t, size_t>> skirt_loops_per_extruder;
|
||||||
coordf_t skirt_height = 0.;
|
coordf_t skirt_height = 0.;
|
||||||
if (extrude_skirt) {
|
if (extrude_skirt) {
|
||||||
@ -2127,19 +2127,18 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||||||
|
|
||||||
// Retrieve the last start position for this object.
|
// Retrieve the last start position for this object.
|
||||||
float last_pos_weight = 1.f;
|
float last_pos_weight = 1.f;
|
||||||
switch (seam_position) {
|
|
||||||
case spAligned:
|
if (seam_position == spAligned) {
|
||||||
// Seam is aligned to the seam at the preceding layer.
|
// Seam is aligned to the seam at the preceding layer.
|
||||||
if (m_layer != NULL && m_seam_position.count(m_layer->object()) > 0) {
|
if (m_layer != NULL && m_seam_position.count(m_layer->object()) > 0) {
|
||||||
last_pos = m_seam_position[m_layer->object()];
|
last_pos = m_seam_position[m_layer->object()];
|
||||||
last_pos_weight = 1.f;
|
last_pos_weight = 1.f;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case spRear:
|
else if (seam_position == spRear) {
|
||||||
last_pos = m_layer->object()->bounding_box().center();
|
last_pos = m_layer->object()->bounding_box().center();
|
||||||
last_pos(1) += coord_t(3. * m_layer->object()->bounding_box().radius());
|
last_pos(1) += coord_t(3. * m_layer->object()->bounding_box().radius());
|
||||||
last_pos_weight = 5.f;
|
last_pos_weight = 5.f;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert a projection of last_pos into the polygon.
|
// Insert a projection of last_pos into the polygon.
|
||||||
@ -2148,7 +2147,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||||||
Points::iterator it = project_point_to_polygon_and_insert(polygon, last_pos, 0.1 * nozzle_r);
|
Points::iterator it = project_point_to_polygon_and_insert(polygon, last_pos, 0.1 * nozzle_r);
|
||||||
last_pos_proj_idx = it - polygon.points.begin();
|
last_pos_proj_idx = it - polygon.points.begin();
|
||||||
}
|
}
|
||||||
Point last_pos_proj = polygon.points[last_pos_proj_idx];
|
|
||||||
// Parametrize the polygon by its length.
|
// Parametrize the polygon by its length.
|
||||||
std::vector<float> lengths = polygon_parameter_by_length(polygon);
|
std::vector<float> lengths = polygon_parameter_by_length(polygon);
|
||||||
|
|
||||||
@ -2158,7 +2157,6 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||||||
// No penalty for reflex points, slight penalty for convex points, high penalty for flat surfaces.
|
// No penalty for reflex points, slight penalty for convex points, high penalty for flat surfaces.
|
||||||
const float penaltyConvexVertex = 1.f;
|
const float penaltyConvexVertex = 1.f;
|
||||||
const float penaltyFlatSurface = 5.f;
|
const float penaltyFlatSurface = 5.f;
|
||||||
const float penaltySeam = 1.3f;
|
|
||||||
const float penaltyOverhangHalf = 10.f;
|
const float penaltyOverhangHalf = 10.f;
|
||||||
// Penalty for visible seams.
|
// Penalty for visible seams.
|
||||||
for (size_t i = 0; i < polygon.points.size(); ++ i) {
|
for (size_t i = 0; i < polygon.points.size(); ++ i) {
|
||||||
@ -2203,7 +2201,11 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||||||
// Signed distance is positive outside the object, negative inside the object.
|
// Signed distance is positive outside the object, negative inside the object.
|
||||||
// The point is considered at an overhang, if it is more than nozzle radius
|
// The point is considered at an overhang, if it is more than nozzle radius
|
||||||
// outside of the lower layer contour.
|
// outside of the lower layer contour.
|
||||||
|
#ifdef NDEBUG // to suppress unused variable warning in release mode
|
||||||
|
(*lower_layer_edge_grid)->signed_distance(p, search_r, dist);
|
||||||
|
#else
|
||||||
bool found = (*lower_layer_edge_grid)->signed_distance(p, search_r, dist);
|
bool found = (*lower_layer_edge_grid)->signed_distance(p, search_r, dist);
|
||||||
|
#endif
|
||||||
// If the approximate Signed Distance Field was initialized over lower_layer_edge_grid,
|
// If the approximate Signed Distance Field was initialized over lower_layer_edge_grid,
|
||||||
// then the signed distnace shall always be known.
|
// then the signed distnace shall always be known.
|
||||||
assert(found);
|
assert(found);
|
||||||
|
@ -672,7 +672,7 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
|||||||
#define EXTRUDER_CONFIG(OPT) config.OPT.get_at(m_current_extruder)
|
#define EXTRUDER_CONFIG(OPT) config.OPT.get_at(m_current_extruder)
|
||||||
int min_fan_speed = EXTRUDER_CONFIG(min_fan_speed);
|
int min_fan_speed = EXTRUDER_CONFIG(min_fan_speed);
|
||||||
int fan_speed_new = EXTRUDER_CONFIG(fan_always_on) ? min_fan_speed : 0;
|
int fan_speed_new = EXTRUDER_CONFIG(fan_always_on) ? min_fan_speed : 0;
|
||||||
if (layer_id >= EXTRUDER_CONFIG(disable_fan_first_layers)) {
|
if (layer_id >= (size_t)EXTRUDER_CONFIG(disable_fan_first_layers)) {
|
||||||
int max_fan_speed = EXTRUDER_CONFIG(max_fan_speed);
|
int max_fan_speed = EXTRUDER_CONFIG(max_fan_speed);
|
||||||
float slowdown_below_layer_time = float(EXTRUDER_CONFIG(slowdown_below_layer_time));
|
float slowdown_below_layer_time = float(EXTRUDER_CONFIG(slowdown_below_layer_time));
|
||||||
float fan_below_layer_time = float(EXTRUDER_CONFIG(fan_below_layer_time));
|
float fan_below_layer_time = float(EXTRUDER_CONFIG(fan_below_layer_time));
|
||||||
|
@ -404,6 +404,8 @@ std::string GCodePreviewData::get_legend_title() const
|
|||||||
return L("Tool");
|
return L("Tool");
|
||||||
case Extrusion::ColorPrint:
|
case Extrusion::ColorPrint:
|
||||||
return L("Color Print");
|
return L("Color Print");
|
||||||
|
case Extrusion::Num_View_Types:
|
||||||
|
break; // just to supress warning about non-handled value
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@ -508,6 +510,8 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case Extrusion::Num_View_Types:
|
||||||
|
break; // just to supress warning about non-handled value
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
@ -24,7 +24,7 @@ std::string SpiralVase::process_layer(const std::string &gcode)
|
|||||||
// Get total XY length for this layer by summing all extrusion moves.
|
// Get total XY length for this layer by summing all extrusion moves.
|
||||||
float total_layer_length = 0;
|
float total_layer_length = 0;
|
||||||
float layer_height = 0;
|
float layer_height = 0;
|
||||||
float z;
|
float z = 0.f;
|
||||||
bool set_z = false;
|
bool set_z = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -324,9 +324,8 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
|
|||||||
m_layer_tools[j].has_wipe_tower = true;
|
m_layer_tools[j].has_wipe_tower = true;
|
||||||
} else {
|
} else {
|
||||||
LayerTools <_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);
|
LayerTools <_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);
|
||||||
LayerTools <_prev = m_layer_tools[j - 1];
|
|
||||||
LayerTools <_next = m_layer_tools[j + 1];
|
LayerTools <_next = m_layer_tools[j + 1];
|
||||||
assert(! lt_prev.extruders.empty() && ! lt_next.extruders.empty());
|
assert(! m_layer_tools[j - 1].extruders.empty() && ! lt_next.extruders.empty());
|
||||||
// FIXME: Following assert tripped when running combine_infill.t. I decided to comment it out for now.
|
// FIXME: Following assert tripped when running combine_infill.t. I decided to comment it out for now.
|
||||||
// If it is a bug, it's likely not critical, because this code is unchanged for a long time. It might
|
// If it is a bug, it's likely not critical, because this code is unchanged for a long time. It might
|
||||||
// still be worth looking into it more and decide if it is a bug or an obsolete assert.
|
// still be worth looking into it more and decide if it is a bug or an obsolete assert.
|
||||||
@ -495,9 +494,6 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
|
|||||||
if (!is_overriddable(*fill, print.config(), *object, region))
|
if (!is_overriddable(*fill, print.config(), *object, region))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// What extruder would this normally be printed with?
|
|
||||||
unsigned int correct_extruder = Print::get_extruder(*fill, region);
|
|
||||||
|
|
||||||
if (volume_to_wipe<=0)
|
if (volume_to_wipe<=0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ MedialAxis::build(ThickPolylines* polylines)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef const VD::vertex_type vert_t;
|
//typedef const VD::vertex_type vert_t;
|
||||||
typedef const VD::edge_type edge_t;
|
typedef const VD::edge_type edge_t;
|
||||||
|
|
||||||
// collect valid edges (i.e. prune those not belonging to MAT)
|
// collect valid edges (i.e. prune those not belonging to MAT)
|
||||||
|
@ -201,7 +201,7 @@ void LayerRegion::process_external_surfaces(const Layer* lower_layer)
|
|||||||
size_t n_groups = 0;
|
size_t n_groups = 0;
|
||||||
for (size_t i = 0; i < bridges.size(); ++ i) {
|
for (size_t i = 0; i < bridges.size(); ++ i) {
|
||||||
// A grup id for this bridge.
|
// A grup id for this bridge.
|
||||||
size_t group_id = (bridge_group[i] == -1) ? (n_groups ++) : bridge_group[i];
|
size_t group_id = (bridge_group[i] == size_t(-1)) ? (n_groups ++) : bridge_group[i];
|
||||||
bridge_group[i] = group_id;
|
bridge_group[i] = group_id;
|
||||||
// For all possibly overlaping bridges:
|
// For all possibly overlaping bridges:
|
||||||
for (size_t j = i + 1; j < bridges.size(); ++ j) {
|
for (size_t j = i + 1; j < bridges.size(); ++ j) {
|
||||||
@ -210,7 +210,7 @@ void LayerRegion::process_external_surfaces(const Layer* lower_layer)
|
|||||||
if (intersection(bridges_grown[i], bridges_grown[j], false).empty())
|
if (intersection(bridges_grown[i], bridges_grown[j], false).empty())
|
||||||
continue;
|
continue;
|
||||||
// The two bridge regions intersect. Give them the same group id.
|
// The two bridge regions intersect. Give them the same group id.
|
||||||
if (bridge_group[j] != -1) {
|
if (bridge_group[j] != size_t(-1)) {
|
||||||
// The j'th bridge has been merged with some other bridge before.
|
// The j'th bridge has been merged with some other bridge before.
|
||||||
size_t group_id_new = bridge_group[j];
|
size_t group_id_new = bridge_group[j];
|
||||||
for (size_t k = 0; k < j; ++ k)
|
for (size_t k = 0; k < j; ++ k)
|
||||||
|
@ -22,7 +22,6 @@ Linef3 transform(const Linef3& line, const Transform3d& t)
|
|||||||
bool Line::intersection_infinite(const Line &other, Point* point) const
|
bool Line::intersection_infinite(const Line &other, Point* point) const
|
||||||
{
|
{
|
||||||
Vec2d a1 = this->a.cast<double>();
|
Vec2d a1 = this->a.cast<double>();
|
||||||
Vec2d a2 = other.a.cast<double>();
|
|
||||||
Vec2d v12 = (other.a - this->a).cast<double>();
|
Vec2d v12 = (other.a - this->a).cast<double>();
|
||||||
Vec2d v1 = (this->b - this->a).cast<double>();
|
Vec2d v1 = (this->b - this->a).cast<double>();
|
||||||
Vec2d v2 = (other.b - other.a).cast<double>();
|
Vec2d v2 = (other.b - other.a).cast<double>();
|
||||||
|
@ -332,7 +332,7 @@ Polyline MotionPlannerGraph::shortest_path(size_t node_start, size_t node_end) c
|
|||||||
queue.pop();
|
queue.pop();
|
||||||
map_node_to_queue_id[u] = size_t(-1);
|
map_node_to_queue_id[u] = size_t(-1);
|
||||||
// Stop searching if we reached our destination.
|
// Stop searching if we reached our destination.
|
||||||
if (u == node_end)
|
if (size_t(u) == node_end)
|
||||||
break;
|
break;
|
||||||
// Visit each edge starting at node u.
|
// Visit each edge starting at node u.
|
||||||
for (const Neighbor& neighbor : m_adjacency_list[u])
|
for (const Neighbor& neighbor : m_adjacency_list[u])
|
||||||
|
@ -175,7 +175,7 @@ void PerimeterGenerator::process()
|
|||||||
const PerimeterGeneratorLoop &loop = contours_d[i];
|
const PerimeterGeneratorLoop &loop = contours_d[i];
|
||||||
// find the contour loop that contains it
|
// find the contour loop that contains it
|
||||||
for (int t = d - 1; t >= 0; -- t) {
|
for (int t = d - 1; t >= 0; -- t) {
|
||||||
for (int j = 0; j < contours[t].size(); ++ j) {
|
for (size_t j = 0; j < contours[t].size(); ++ j) {
|
||||||
PerimeterGeneratorLoop &candidate_parent = contours[t][j];
|
PerimeterGeneratorLoop &candidate_parent = contours[t][j];
|
||||||
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
||||||
candidate_parent.children.push_back(loop);
|
candidate_parent.children.push_back(loop);
|
||||||
@ -397,7 +397,7 @@ static inline ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyli
|
|||||||
pp.push_back(line.b);
|
pp.push_back(line.b);
|
||||||
width.push_back(line.b_width);
|
width.push_back(line.b_width);
|
||||||
|
|
||||||
assert(pp.size() == segments + 1);
|
assert(pp.size() == segments + 1u);
|
||||||
assert(width.size() == segments*2);
|
assert(width.size() == segments*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +521,6 @@ namespace client
|
|||||||
static void regex_op(expr &lhs, boost::iterator_range<Iterator> &rhs, char op)
|
static void regex_op(expr &lhs, boost::iterator_range<Iterator> &rhs, char op)
|
||||||
{
|
{
|
||||||
const std::string *subject = nullptr;
|
const std::string *subject = nullptr;
|
||||||
const std::string *mask = nullptr;
|
|
||||||
if (lhs.type == TYPE_STRING) {
|
if (lhs.type == TYPE_STRING) {
|
||||||
// One type is string, the other could be converted to string.
|
// One type is string, the other could be converted to string.
|
||||||
subject = &lhs.s();
|
subject = &lhs.s();
|
||||||
@ -563,7 +562,6 @@ namespace client
|
|||||||
|
|
||||||
static void ternary_op(expr &lhs, expr &rhs1, expr &rhs2)
|
static void ternary_op(expr &lhs, expr &rhs1, expr &rhs2)
|
||||||
{
|
{
|
||||||
bool value = false;
|
|
||||||
if (lhs.type != TYPE_BOOL)
|
if (lhs.type != TYPE_BOOL)
|
||||||
lhs.throw_exception("Not a boolean expression");
|
lhs.throw_exception("Not a boolean expression");
|
||||||
if (lhs.b())
|
if (lhs.b())
|
||||||
@ -975,7 +973,7 @@ namespace client
|
|||||||
// depending on the context->just_boolean_expression flag. This way a single static expression parser
|
// depending on the context->just_boolean_expression flag. This way a single static expression parser
|
||||||
// could serve both purposes.
|
// could serve both purposes.
|
||||||
start = eps[px::bind(&MyContext::evaluate_full_macro, _r1, _a)] >
|
start = eps[px::bind(&MyContext::evaluate_full_macro, _r1, _a)] >
|
||||||
( eps(_a==true) > text_block(_r1) [_val=_1]
|
( (eps(_a==true) > text_block(_r1) [_val=_1])
|
||||||
| conditional_expression(_r1) [ px::bind(&expr<Iterator>::evaluate_boolean_to_string, _1, _val) ]
|
| conditional_expression(_r1) [ px::bind(&expr<Iterator>::evaluate_boolean_to_string, _1, _val) ]
|
||||||
) > eoi;
|
) > eoi;
|
||||||
start.name("start");
|
start.name("start");
|
||||||
@ -1245,7 +1243,7 @@ static std::string process_macro(const std::string &templ, client::MyContext &co
|
|||||||
std::string::const_iterator end = templ.end();
|
std::string::const_iterator end = templ.end();
|
||||||
// Accumulator for the processed template.
|
// Accumulator for the processed template.
|
||||||
std::string output;
|
std::string output;
|
||||||
bool res = phrase_parse(iter, end, macro_processor_instance(&context), space, output);
|
phrase_parse(iter, end, macro_processor_instance(&context), space, output);
|
||||||
if (!context.error_message.empty()) {
|
if (!context.error_message.empty()) {
|
||||||
if (context.error_message.back() != '\n' && context.error_message.back() != '\r')
|
if (context.error_message.back() != '\n' && context.error_message.back() != '\r')
|
||||||
context.error_message += '\n';
|
context.error_message += '\n';
|
||||||
|
@ -61,7 +61,7 @@ Polylines PolylineCollection::_chained_path_from(
|
|||||||
while (! endpoints.empty()) {
|
while (! endpoints.empty()) {
|
||||||
// find nearest point
|
// find nearest point
|
||||||
int endpoint_index = nearest_point_index<double>(endpoints, start_near, no_reverse);
|
int endpoint_index = nearest_point_index<double>(endpoints, start_near, no_reverse);
|
||||||
assert(endpoint_index >= 0 && endpoint_index < endpoints.size() * 2);
|
assert(endpoint_index >= 0 && size_t(endpoint_index) < endpoints.size() * 2);
|
||||||
if (move_from_src) {
|
if (move_from_src) {
|
||||||
retval.push_back(std::move(src[endpoints[endpoint_index/2].idx]));
|
retval.push_back(std::move(src[endpoints[endpoint_index/2].idx]));
|
||||||
} else {
|
} else {
|
||||||
|
@ -995,7 +995,7 @@ Print::ApplyStatus Print::apply(const Model &model, const DynamicPrintConfig &co
|
|||||||
region_id = regions_in_object[idx_region_in_object ++];
|
region_id = regions_in_object[idx_region_in_object ++];
|
||||||
// Assign volume to a region.
|
// Assign volume to a region.
|
||||||
if (fresh) {
|
if (fresh) {
|
||||||
if (region_id >= print_object.region_volumes.size() || print_object.region_volumes[region_id].empty())
|
if ((size_t)region_id >= print_object.region_volumes.size() || print_object.region_volumes[region_id].empty())
|
||||||
++ m_regions[region_id]->m_refcnt;
|
++ m_regions[region_id]->m_refcnt;
|
||||||
print_object.add_region_volume(region_id, volume_id, it_range->first);
|
print_object.add_region_volume(region_id, volume_id, it_range->first);
|
||||||
}
|
}
|
||||||
@ -1137,11 +1137,10 @@ std::string Print::validate() const
|
|||||||
if (has_custom_layering) {
|
if (has_custom_layering) {
|
||||||
const std::vector<coordf_t> &layer_height_profile_tallest = layer_height_profiles[tallest_object_idx];
|
const std::vector<coordf_t> &layer_height_profile_tallest = layer_height_profiles[tallest_object_idx];
|
||||||
for (size_t idx_object = 0; idx_object < m_objects.size(); ++ idx_object) {
|
for (size_t idx_object = 0; idx_object < m_objects.size(); ++ idx_object) {
|
||||||
const PrintObject *object = m_objects[idx_object];
|
|
||||||
const std::vector<coordf_t> &layer_height_profile = layer_height_profiles[idx_object];
|
const std::vector<coordf_t> &layer_height_profile = layer_height_profiles[idx_object];
|
||||||
bool failed = false;
|
bool failed = false;
|
||||||
if (layer_height_profile_tallest.size() >= layer_height_profile.size()) {
|
if (layer_height_profile_tallest.size() >= layer_height_profile.size()) {
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
while (i < layer_height_profile.size() && i < layer_height_profile_tallest.size()) {
|
while (i < layer_height_profile.size() && i < layer_height_profile_tallest.size()) {
|
||||||
if (std::abs(layer_height_profile_tallest[i] - layer_height_profile[i])) {
|
if (std::abs(layer_height_profile_tallest[i] - layer_height_profile[i])) {
|
||||||
failed = true;
|
failed = true;
|
||||||
@ -1506,7 +1505,7 @@ void Print::_make_skirt()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Number of skirt loops per skirt layer.
|
// Number of skirt loops per skirt layer.
|
||||||
int n_skirts = m_config.skirts.value;
|
size_t n_skirts = m_config.skirts.value;
|
||||||
if (this->has_infinite_skirt() && n_skirts == 0)
|
if (this->has_infinite_skirt() && n_skirts == 0)
|
||||||
n_skirts = 1;
|
n_skirts = 1;
|
||||||
|
|
||||||
@ -1518,7 +1517,7 @@ void Print::_make_skirt()
|
|||||||
// Draw outlines from outside to inside.
|
// Draw outlines from outside to inside.
|
||||||
// Loop while we have less skirts than required or any extruder hasn't reached the min length if any.
|
// Loop while we have less skirts than required or any extruder hasn't reached the min length if any.
|
||||||
std::vector<coordf_t> extruded_length(extruders.size(), 0.);
|
std::vector<coordf_t> extruded_length(extruders.size(), 0.);
|
||||||
for (int i = n_skirts, extruder_idx = 0; i > 0; -- i) {
|
for (size_t i = n_skirts, extruder_idx = 0; i > 0; -- i) {
|
||||||
this->throw_if_canceled();
|
this->throw_if_canceled();
|
||||||
// Offset the skirt outside.
|
// Offset the skirt outside.
|
||||||
distance += float(scale_(spacing));
|
distance += float(scale_(spacing));
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
void clear_support_layers();
|
void clear_support_layers();
|
||||||
SupportLayer* get_support_layer(int idx) { return m_support_layers[idx]; }
|
SupportLayer* get_support_layer(int idx) { return m_support_layers[idx]; }
|
||||||
SupportLayer* add_support_layer(int id, coordf_t height, coordf_t print_z);
|
SupportLayer* add_support_layer(int id, coordf_t height, coordf_t print_z);
|
||||||
SupportLayerPtrs::const_iterator insert_support_layer(SupportLayerPtrs::const_iterator pos, int id, coordf_t height, coordf_t print_z, coordf_t slice_z);
|
SupportLayerPtrs::const_iterator insert_support_layer(SupportLayerPtrs::const_iterator pos, size_t id, coordf_t height, coordf_t print_z, coordf_t slice_z);
|
||||||
void delete_support_layer(int idx);
|
void delete_support_layer(int idx);
|
||||||
|
|
||||||
// Initialize the layer_height_profile from the model_object's layer_height_profile, from model_object's layer height table, or from slicing parameters.
|
// Initialize the layer_height_profile from the model_object's layer_height_profile, from model_object's layer height table, or from slicing parameters.
|
||||||
|
@ -36,7 +36,6 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
|
|
||||||
void PrintConfigDef::init_common_params()
|
void PrintConfigDef::init_common_params()
|
||||||
{
|
{
|
||||||
t_optiondef_map &Options = this->options;
|
|
||||||
ConfigOptionDef* def;
|
ConfigOptionDef* def;
|
||||||
|
|
||||||
def = this->add("printer_technology", coEnum);
|
def = this->add("printer_technology", coEnum);
|
||||||
@ -102,7 +101,6 @@ void PrintConfigDef::init_common_params()
|
|||||||
|
|
||||||
void PrintConfigDef::init_fff_params()
|
void PrintConfigDef::init_fff_params()
|
||||||
{
|
{
|
||||||
t_optiondef_map &Options = this->options;
|
|
||||||
ConfigOptionDef* def;
|
ConfigOptionDef* def;
|
||||||
|
|
||||||
// Maximum extruder temperature, bumped to 1500 to support printing of glass.
|
// Maximum extruder temperature, bumped to 1500 to support printing of glass.
|
||||||
@ -1089,16 +1087,16 @@ void PrintConfigDef::init_fff_params()
|
|||||||
// Add the machine feedrate limits for XYZE axes. (M203)
|
// Add the machine feedrate limits for XYZE axes. (M203)
|
||||||
def = this->add("machine_max_feedrate_" + axis.name, coFloats);
|
def = this->add("machine_max_feedrate_" + axis.name, coFloats);
|
||||||
def->full_label = (boost::format("Maximum feedrate %1%") % axis_upper).str();
|
def->full_label = (boost::format("Maximum feedrate %1%") % axis_upper).str();
|
||||||
L("Maximum feedrate X");
|
(void)L("Maximum feedrate X");
|
||||||
L("Maximum feedrate Y");
|
(void)L("Maximum feedrate Y");
|
||||||
L("Maximum feedrate Z");
|
(void)L("Maximum feedrate Z");
|
||||||
L("Maximum feedrate E");
|
(void)L("Maximum feedrate E");
|
||||||
def->category = L("Machine limits");
|
def->category = L("Machine limits");
|
||||||
def->tooltip = (boost::format("Maximum feedrate of the %1% axis") % axis_upper).str();
|
def->tooltip = (boost::format("Maximum feedrate of the %1% axis") % axis_upper).str();
|
||||||
L("Maximum feedrate of the X axis");
|
(void)L("Maximum feedrate of the X axis");
|
||||||
L("Maximum feedrate of the Y axis");
|
(void)L("Maximum feedrate of the Y axis");
|
||||||
L("Maximum feedrate of the Z axis");
|
(void)L("Maximum feedrate of the Z axis");
|
||||||
L("Maximum feedrate of the E axis");
|
(void)L("Maximum feedrate of the E axis");
|
||||||
def->sidetext = L("mm/s");
|
def->sidetext = L("mm/s");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_limits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
@ -1107,16 +1105,16 @@ void PrintConfigDef::init_fff_params()
|
|||||||
// Add the machine acceleration limits for XYZE axes (M201)
|
// Add the machine acceleration limits for XYZE axes (M201)
|
||||||
def = this->add("machine_max_acceleration_" + axis.name, coFloats);
|
def = this->add("machine_max_acceleration_" + axis.name, coFloats);
|
||||||
def->full_label = (boost::format("Maximum acceleration %1%") % axis_upper).str();
|
def->full_label = (boost::format("Maximum acceleration %1%") % axis_upper).str();
|
||||||
L("Maximum acceleration X");
|
(void)L("Maximum acceleration X");
|
||||||
L("Maximum acceleration Y");
|
(void)L("Maximum acceleration Y");
|
||||||
L("Maximum acceleration Z");
|
(void)L("Maximum acceleration Z");
|
||||||
L("Maximum acceleration E");
|
(void)L("Maximum acceleration E");
|
||||||
def->category = L("Machine limits");
|
def->category = L("Machine limits");
|
||||||
def->tooltip = (boost::format("Maximum acceleration of the %1% axis") % axis_upper).str();
|
def->tooltip = (boost::format("Maximum acceleration of the %1% axis") % axis_upper).str();
|
||||||
L("Maximum acceleration of the X axis");
|
(void)L("Maximum acceleration of the X axis");
|
||||||
L("Maximum acceleration of the Y axis");
|
(void)L("Maximum acceleration of the Y axis");
|
||||||
L("Maximum acceleration of the Z axis");
|
(void)L("Maximum acceleration of the Z axis");
|
||||||
L("Maximum acceleration of the E axis");
|
(void)L("Maximum acceleration of the E axis");
|
||||||
def->sidetext = L("mm/s²");
|
def->sidetext = L("mm/s²");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_limits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
@ -1125,16 +1123,16 @@ void PrintConfigDef::init_fff_params()
|
|||||||
// Add the machine jerk limits for XYZE axes (M205)
|
// Add the machine jerk limits for XYZE axes (M205)
|
||||||
def = this->add("machine_max_jerk_" + axis.name, coFloats);
|
def = this->add("machine_max_jerk_" + axis.name, coFloats);
|
||||||
def->full_label = (boost::format("Maximum jerk %1%") % axis_upper).str();
|
def->full_label = (boost::format("Maximum jerk %1%") % axis_upper).str();
|
||||||
L("Maximum jerk X");
|
(void)L("Maximum jerk X");
|
||||||
L("Maximum jerk Y");
|
(void)L("Maximum jerk Y");
|
||||||
L("Maximum jerk Z");
|
(void)L("Maximum jerk Z");
|
||||||
L("Maximum jerk E");
|
(void)L("Maximum jerk E");
|
||||||
def->category = L("Machine limits");
|
def->category = L("Machine limits");
|
||||||
def->tooltip = (boost::format("Maximum jerk of the %1% axis") % axis_upper).str();
|
def->tooltip = (boost::format("Maximum jerk of the %1% axis") % axis_upper).str();
|
||||||
L("Maximum jerk of the X axis");
|
(void)L("Maximum jerk of the X axis");
|
||||||
L("Maximum jerk of the Y axis");
|
(void)L("Maximum jerk of the Y axis");
|
||||||
L("Maximum jerk of the Z axis");
|
(void)L("Maximum jerk of the Z axis");
|
||||||
L("Maximum jerk of the E axis");
|
(void)L("Maximum jerk of the E axis");
|
||||||
def->sidetext = L("mm/s");
|
def->sidetext = L("mm/s");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_limits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
@ -2234,7 +2232,6 @@ void PrintConfigDef::init_fff_params()
|
|||||||
|
|
||||||
void PrintConfigDef::init_sla_params()
|
void PrintConfigDef::init_sla_params()
|
||||||
{
|
{
|
||||||
t_optiondef_map &Options = this->options;
|
|
||||||
ConfigOptionDef* def;
|
ConfigOptionDef* def;
|
||||||
|
|
||||||
// SLA Printer settings
|
// SLA Printer settings
|
||||||
|
@ -430,7 +430,7 @@ SupportLayer* PrintObject::add_support_layer(int id, coordf_t height, coordf_t p
|
|||||||
return m_support_layers.back();
|
return m_support_layers.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
SupportLayerPtrs::const_iterator PrintObject::insert_support_layer(SupportLayerPtrs::const_iterator pos, int id, coordf_t height, coordf_t print_z, coordf_t slice_z)
|
SupportLayerPtrs::const_iterator PrintObject::insert_support_layer(SupportLayerPtrs::const_iterator pos, size_t id, coordf_t height, coordf_t print_z, coordf_t slice_z)
|
||||||
{
|
{
|
||||||
return m_support_layers.insert(pos, new SupportLayer(id, this, height, print_z, slice_z));
|
return m_support_layers.insert(pos, new SupportLayer(id, this, height, print_z, slice_z));
|
||||||
}
|
}
|
||||||
@ -625,7 +625,7 @@ void PrintObject::detect_surfaces_type()
|
|||||||
// should be visible.
|
// should be visible.
|
||||||
bool interface_shells = m_config.interface_shells.value;
|
bool interface_shells = m_config.interface_shells.value;
|
||||||
|
|
||||||
for (int idx_region = 0; idx_region < this->region_volumes.size(); ++ idx_region) {
|
for (size_t idx_region = 0; idx_region < this->region_volumes.size(); ++ idx_region) {
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << idx_region << " in parallel - start";
|
BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << idx_region << " in parallel - start";
|
||||||
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
|
||||||
for (Layer *layer : m_layers)
|
for (Layer *layer : m_layers)
|
||||||
@ -811,8 +811,6 @@ void PrintObject::process_external_surfaces()
|
|||||||
BOOST_LOG_TRIVIAL(info) << "Processing external surfaces..." << log_memory_info();
|
BOOST_LOG_TRIVIAL(info) << "Processing external surfaces..." << log_memory_info();
|
||||||
|
|
||||||
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++region_id) {
|
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++region_id) {
|
||||||
const PrintRegion ®ion = *m_print->regions()[region_id];
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Processing external surfaces for region " << region_id << " in parallel - start";
|
BOOST_LOG_TRIVIAL(debug) << "Processing external surfaces for region " << region_id << " in parallel - start";
|
||||||
tbb::parallel_for(
|
tbb::parallel_for(
|
||||||
tbb::blocked_range<size_t>(0, m_layers.size()),
|
tbb::blocked_range<size_t>(0, m_layers.size()),
|
||||||
@ -1033,7 +1031,6 @@ void PrintObject::discover_vertical_shells()
|
|||||||
bool hole_first = true;
|
bool hole_first = true;
|
||||||
for (int n = (int)idx_layer - n_extra_bottom_layers; n <= (int)idx_layer + n_extra_top_layers; ++ n)
|
for (int n = (int)idx_layer - n_extra_bottom_layers; n <= (int)idx_layer + n_extra_top_layers; ++ n)
|
||||||
if (n >= 0 && n < (int)m_layers.size()) {
|
if (n >= 0 && n < (int)m_layers.size()) {
|
||||||
Layer &neighbor_layer = *m_layers[n];
|
|
||||||
const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[n];
|
const DiscoverVerticalShellsCacheEntry &cache = cache_top_botom_regions[n];
|
||||||
if (hole_first) {
|
if (hole_first) {
|
||||||
hole_first = false;
|
hole_first = false;
|
||||||
@ -2308,7 +2305,7 @@ void PrintObject::discover_horizontal_shells()
|
|||||||
BOOST_LOG_TRIVIAL(trace) << "discover_horizontal_shells()";
|
BOOST_LOG_TRIVIAL(trace) << "discover_horizontal_shells()";
|
||||||
|
|
||||||
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++ region_id) {
|
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++ region_id) {
|
||||||
for (int i = 0; i < int(m_layers.size()); ++ i) {
|
for (size_t i = 0; i < m_layers.size(); ++ i) {
|
||||||
m_print->throw_if_canceled();
|
m_print->throw_if_canceled();
|
||||||
LayerRegion *layerm = m_layers[i]->regions()[region_id];
|
LayerRegion *layerm = m_layers[i]->regions()[region_id];
|
||||||
const PrintRegionConfig ®ion_config = layerm->region()->config();
|
const PrintRegionConfig ®ion_config = layerm->region()->config();
|
||||||
@ -2325,7 +2322,7 @@ void PrintObject::discover_horizontal_shells()
|
|||||||
if (region_config.ensure_vertical_shell_thickness.value)
|
if (region_config.ensure_vertical_shell_thickness.value)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (int idx_surface_type = 0; idx_surface_type < 3; ++ idx_surface_type) {
|
for (size_t idx_surface_type = 0; idx_surface_type < 3; ++ idx_surface_type) {
|
||||||
m_print->throw_if_canceled();
|
m_print->throw_if_canceled();
|
||||||
SurfaceType type = (idx_surface_type == 0) ? stTop : (idx_surface_type == 1) ? stBottom : stBottomBridge;
|
SurfaceType type = (idx_surface_type == 0) ? stTop : (idx_surface_type == 1) ? stBottom : stBottomBridge;
|
||||||
// Find slices of current type for current layer.
|
// Find slices of current type for current layer.
|
||||||
@ -2499,7 +2496,7 @@ void PrintObject::combine_infill()
|
|||||||
// Work on each region separately.
|
// Work on each region separately.
|
||||||
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++ region_id) {
|
for (size_t region_id = 0; region_id < this->region_volumes.size(); ++ region_id) {
|
||||||
const PrintRegion *region = this->print()->regions()[region_id];
|
const PrintRegion *region = this->print()->regions()[region_id];
|
||||||
const int every = region->config().infill_every_layers.value;
|
const size_t every = region->config().infill_every_layers.value;
|
||||||
if (every < 2 || region->config().fill_density == 0.)
|
if (every < 2 || region->config().fill_density == 0.)
|
||||||
continue;
|
continue;
|
||||||
// Limit the number of combined layers to the maximum height allowed by this regions' nozzle.
|
// Limit the number of combined layers to the maximum height allowed by this regions' nozzle.
|
||||||
|
@ -59,8 +59,6 @@ SLAAutoSupports::SLAAutoSupports(const TriangleMesh& mesh, const sla::EigenMesh3
|
|||||||
void SLAAutoSupports::project_onto_mesh(std::vector<sla::SupportPoint>& points) const
|
void SLAAutoSupports::project_onto_mesh(std::vector<sla::SupportPoint>& points) const
|
||||||
{
|
{
|
||||||
// The function makes sure that all the points are really exactly placed on the mesh.
|
// The function makes sure that all the points are really exactly placed on the mesh.
|
||||||
igl::Hit hit_up{0, 0, 0.f, 0.f, 0.f};
|
|
||||||
igl::Hit hit_down{0, 0, 0.f, 0.f, 0.f};
|
|
||||||
|
|
||||||
// Use a reasonable granularity to account for the worker thread synchronization cost.
|
// Use a reasonable granularity to account for the worker thread synchronization cost.
|
||||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size(), 64),
|
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size(), 64),
|
||||||
@ -140,7 +138,6 @@ static std::vector<SLAAutoSupports::MyLayer> make_layers(
|
|||||||
SLAAutoSupports::MyLayer &layer_above = layers[layer_id];
|
SLAAutoSupports::MyLayer &layer_above = layers[layer_id];
|
||||||
SLAAutoSupports::MyLayer &layer_below = layers[layer_id - 1];
|
SLAAutoSupports::MyLayer &layer_below = layers[layer_id - 1];
|
||||||
//FIXME WTF?
|
//FIXME WTF?
|
||||||
const float height = (layer_id>2 ? heights[layer_id-3] : heights[0]-(heights[1]-heights[0]));
|
|
||||||
const float layer_height = (layer_id!=0 ? heights[layer_id]-heights[layer_id-1] : heights[0]);
|
const float layer_height = (layer_id!=0 ? heights[layer_id]-heights[layer_id-1] : heights[0]);
|
||||||
const float safe_angle = 5.f * (float(M_PI)/180.f); // smaller number - less supports
|
const float safe_angle = 5.f * (float(M_PI)/180.f); // smaller number - less supports
|
||||||
const float between_layers_offset = float(scale_(layer_height / std::tan(safe_angle)));
|
const float between_layers_offset = float(scale_(layer_height / std::tan(safe_angle)));
|
||||||
@ -212,7 +209,7 @@ void SLAAutoSupports::process(const std::vector<ExPolygons>& slices, const std::
|
|||||||
for (Structure &top : layer_top->islands)
|
for (Structure &top : layer_top->islands)
|
||||||
for (Structure::Link &bottom_link : top.islands_below) {
|
for (Structure::Link &bottom_link : top.islands_below) {
|
||||||
Structure &bottom = *bottom_link.island;
|
Structure &bottom = *bottom_link.island;
|
||||||
float centroids_dist = (bottom.centroid - top.centroid).norm();
|
//float centroids_dist = (bottom.centroid - top.centroid).norm();
|
||||||
// Penalization resulting from centroid offset:
|
// Penalization resulting from centroid offset:
|
||||||
// bottom.supports_force *= std::min(1.f, 1.f - std::min(1.f, (1600.f * layer_height) * centroids_dist * centroids_dist / bottom.area));
|
// bottom.supports_force *= std::min(1.f, 1.f - std::min(1.f, (1600.f * layer_height) * centroids_dist * centroids_dist / bottom.area));
|
||||||
float &support_force = support_force_bottom[&bottom - layer_bottom->islands.data()];
|
float &support_force = support_force_bottom[&bottom - layer_bottom->islands.data()];
|
||||||
@ -239,7 +236,7 @@ void SLAAutoSupports::process(const std::vector<ExPolygons>& slices, const std::
|
|||||||
// s.supports_force_inherited /= std::max(1.f, (layer_height / 0.3f) * e_area / s.area);
|
// s.supports_force_inherited /= std::max(1.f, (layer_height / 0.3f) * e_area / s.area);
|
||||||
s.supports_force_inherited /= std::max(1.f, 0.17f * (s.overhangs_area) / s.area);
|
s.supports_force_inherited /= std::max(1.f, 0.17f * (s.overhangs_area) / s.area);
|
||||||
|
|
||||||
float force_deficit = s.support_force_deficit(m_config.tear_pressure());
|
//float force_deficit = s.support_force_deficit(m_config.tear_pressure());
|
||||||
if (s.islands_below.empty()) { // completely new island - needs support no doubt
|
if (s.islands_below.empty()) { // completely new island - needs support no doubt
|
||||||
uniformly_cover({ *s.polygon }, s, point_grid, true);
|
uniformly_cover({ *s.polygon }, s, point_grid, true);
|
||||||
} else if (! s.dangling_areas.empty()) {
|
} else if (! s.dangling_areas.empty()) {
|
||||||
@ -380,7 +377,7 @@ static inline std::vector<Vec2f> poisson_disk_from_samples(const std::vector<Vec
|
|||||||
{
|
{
|
||||||
typename Cells::iterator last_cell_id_it;
|
typename Cells::iterator last_cell_id_it;
|
||||||
Vec2i last_cell_id(-1, -1);
|
Vec2i last_cell_id(-1, -1);
|
||||||
for (int i = 0; i < raw_samples_sorted.size(); ++ i) {
|
for (size_t i = 0; i < raw_samples_sorted.size(); ++ i) {
|
||||||
const RawSample &sample = raw_samples_sorted[i];
|
const RawSample &sample = raw_samples_sorted[i];
|
||||||
if (sample.cell_id == last_cell_id) {
|
if (sample.cell_id == last_cell_id) {
|
||||||
// This sample is in the same cell as the previous, so just increase the count. Cells are
|
// This sample is in the same cell as the previous, so just increase the count. Cells are
|
||||||
|
@ -196,7 +196,6 @@ std::vector<coordf_t> layer_height_profile_from_ranges(
|
|||||||
coordf_t hi = it_range->first.second;
|
coordf_t hi = it_range->first.second;
|
||||||
coordf_t height = it_range->second;
|
coordf_t height = it_range->second;
|
||||||
coordf_t last_z = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 2];
|
coordf_t last_z = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 2];
|
||||||
coordf_t last_height = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 1];
|
|
||||||
if (lo > last_z + EPSILON) {
|
if (lo > last_z + EPSILON) {
|
||||||
// Insert a step of normal layer height.
|
// Insert a step of normal layer height.
|
||||||
layer_height_profile.push_back(last_z);
|
layer_height_profile.push_back(last_z);
|
||||||
@ -212,7 +211,6 @@ std::vector<coordf_t> layer_height_profile_from_ranges(
|
|||||||
}
|
}
|
||||||
|
|
||||||
coordf_t last_z = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 2];
|
coordf_t last_z = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 2];
|
||||||
coordf_t last_height = layer_height_profile.empty() ? 0. : layer_height_profile[layer_height_profile.size() - 1];
|
|
||||||
if (last_z < slicing_params.object_print_z_height()) {
|
if (last_z < slicing_params.object_print_z_height()) {
|
||||||
// Insert a step of normal layer height up to the object top.
|
// Insert a step of normal layer height up to the object top.
|
||||||
layer_height_profile.push_back(last_z);
|
layer_height_profile.push_back(last_z);
|
||||||
@ -254,7 +252,6 @@ std::vector<coordf_t> layer_height_profile_adaptive(
|
|||||||
}
|
}
|
||||||
coordf_t slice_z = slicing_params.first_object_layer_height;
|
coordf_t slice_z = slicing_params.first_object_layer_height;
|
||||||
coordf_t height = slicing_params.first_object_layer_height;
|
coordf_t height = slicing_params.first_object_layer_height;
|
||||||
coordf_t cusp_height = 0.;
|
|
||||||
int current_facet = 0;
|
int current_facet = 0;
|
||||||
while ((slice_z - height) <= slicing_params.object_print_z_height()) {
|
while ((slice_z - height) <= slicing_params.object_print_z_height()) {
|
||||||
height = 999;
|
height = 999;
|
||||||
@ -410,7 +407,6 @@ void adjust_layer_height_profile(
|
|||||||
}
|
}
|
||||||
// Adjust height by layer_thickness_delta.
|
// Adjust height by layer_thickness_delta.
|
||||||
coordf_t weight = std::abs(zz - z) < 0.5 * band_width ? (0.5 + 0.5 * cos(2. * M_PI * (zz - z) / band_width)) : 0.;
|
coordf_t weight = std::abs(zz - z) < 0.5 * band_width ? (0.5 + 0.5 * cos(2. * M_PI * (zz - z) / band_width)) : 0.;
|
||||||
coordf_t height_new = height;
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case LAYER_HEIGHT_EDIT_ACTION_INCREASE:
|
case LAYER_HEIGHT_EDIT_ACTION_INCREASE:
|
||||||
case LAYER_HEIGHT_EDIT_ACTION_DECREASE:
|
case LAYER_HEIGHT_EDIT_ACTION_DECREASE:
|
||||||
|
@ -361,17 +361,17 @@ void PrintObjectSupportMaterial::generate(PrintObject &object)
|
|||||||
std::sort(layers_sorted.begin(), layers_sorted.end(), MyLayersPtrCompare());
|
std::sort(layers_sorted.begin(), layers_sorted.end(), MyLayersPtrCompare());
|
||||||
int layer_id = 0;
|
int layer_id = 0;
|
||||||
assert(object.support_layers().empty());
|
assert(object.support_layers().empty());
|
||||||
for (int i = 0; i < int(layers_sorted.size());) {
|
for (size_t i = 0; i < layers_sorted.size();) {
|
||||||
// Find the last layer with roughly the same print_z, find the minimum layer height of all.
|
// Find the last layer with roughly the same print_z, find the minimum layer height of all.
|
||||||
// Due to the floating point inaccuracies, the print_z may not be the same even if in theory they should.
|
// Due to the floating point inaccuracies, the print_z may not be the same even if in theory they should.
|
||||||
int j = i + 1;
|
size_t j = i + 1;
|
||||||
coordf_t zmax = layers_sorted[i]->print_z + EPSILON;
|
coordf_t zmax = layers_sorted[i]->print_z + EPSILON;
|
||||||
for (; j < layers_sorted.size() && layers_sorted[j]->print_z <= zmax; ++j) ;
|
for (; j < layers_sorted.size() && layers_sorted[j]->print_z <= zmax; ++j) ;
|
||||||
// Assign an average print_z to the set of layers with nearly equal print_z.
|
// Assign an average print_z to the set of layers with nearly equal print_z.
|
||||||
coordf_t zavg = 0.5 * (layers_sorted[i]->print_z + layers_sorted[j - 1]->print_z);
|
coordf_t zavg = 0.5 * (layers_sorted[i]->print_z + layers_sorted[j - 1]->print_z);
|
||||||
coordf_t height_min = layers_sorted[i]->height;
|
coordf_t height_min = layers_sorted[i]->height;
|
||||||
bool empty = true;
|
bool empty = true;
|
||||||
for (int u = i; u < j; ++u) {
|
for (size_t u = i; u < j; ++u) {
|
||||||
MyLayer &layer = *layers_sorted[u];
|
MyLayer &layer = *layers_sorted[u];
|
||||||
if (! layer.polygons.empty())
|
if (! layer.polygons.empty())
|
||||||
empty = false;
|
empty = false;
|
||||||
@ -1042,7 +1042,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
|||||||
float fw = float(layerm->flow(frExternalPerimeter).scaled_width());
|
float fw = float(layerm->flow(frExternalPerimeter).scaled_width());
|
||||||
no_interface_offset = (no_interface_offset == 0.f) ? fw : std::min(no_interface_offset, fw);
|
no_interface_offset = (no_interface_offset == 0.f) ? fw : std::min(no_interface_offset, fw);
|
||||||
float lower_layer_offset =
|
float lower_layer_offset =
|
||||||
(layer_id < m_object_config->support_material_enforce_layers.value) ?
|
(layer_id < (size_t)m_object_config->support_material_enforce_layers.value) ?
|
||||||
// Enforce a full possible support, ignore the overhang angle.
|
// Enforce a full possible support, ignore the overhang angle.
|
||||||
0.f :
|
0.f :
|
||||||
(threshold_rad > 0. ?
|
(threshold_rad > 0. ?
|
||||||
@ -1352,7 +1352,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
|||||||
{
|
{
|
||||||
// Find the span of layers, which are to be printed at the first layer height.
|
// Find the span of layers, which are to be printed at the first layer height.
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (; j < contact_out.size() && contact_out[j]->print_z < m_slicing_params.first_print_layer_height + this->m_support_layer_height_min - EPSILON; ++ j);
|
for (; j < (int)contact_out.size() && contact_out[j]->print_z < m_slicing_params.first_print_layer_height + this->m_support_layer_height_min - EPSILON; ++ j);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
// Merge the contact_out layers (0) to (j - 1) into the contact_out[0].
|
// Merge the contact_out layers (0) to (j - 1) into the contact_out[0].
|
||||||
MyLayer &dst = *contact_out.front();
|
MyLayer &dst = *contact_out.front();
|
||||||
@ -1377,7 +1377,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
|||||||
// Find the span of layers closer than m_support_layer_height_min.
|
// Find the span of layers closer than m_support_layer_height_min.
|
||||||
int j = i + 1;
|
int j = i + 1;
|
||||||
coordf_t zmax = contact_out[i]->print_z + m_support_layer_height_min + EPSILON;
|
coordf_t zmax = contact_out[i]->print_z + m_support_layer_height_min + EPSILON;
|
||||||
for (; j < contact_out.size() && contact_out[j]->print_z < zmax; ++ j) ;
|
for (; j < (int)contact_out.size() && contact_out[j]->print_z < zmax; ++ j) ;
|
||||||
if (i + 1 < j) {
|
if (i + 1 < j) {
|
||||||
// Merge the contact_out layers (i + 1) to (j - 1) into the contact_out[i].
|
// Merge the contact_out layers (i + 1) to (j - 1) into the contact_out[i].
|
||||||
MyLayer &dst = *contact_out[i];
|
MyLayer &dst = *contact_out[i];
|
||||||
@ -1395,7 +1395,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
|||||||
contact_out[k] = contact_out[i];
|
contact_out[k] = contact_out[i];
|
||||||
i = j;
|
i = j;
|
||||||
}
|
}
|
||||||
if (k < contact_out.size())
|
if (k < (int)contact_out.size())
|
||||||
contact_out.erase(contact_out.begin() + k, contact_out.end());
|
contact_out.erase(contact_out.begin() + k, contact_out.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2566,11 +2566,11 @@ void LoopInterfaceProcessor::generate(MyLayerExtruded &top_contact_layer, const
|
|||||||
{
|
{
|
||||||
// make more loops
|
// make more loops
|
||||||
Polygons loop_polygons = loops0;
|
Polygons loop_polygons = loops0;
|
||||||
for (size_t i = 1; i < n_contact_loops; ++ i)
|
for (int i = 1; i < n_contact_loops; ++ i)
|
||||||
polygons_append(loop_polygons,
|
polygons_append(loop_polygons,
|
||||||
offset2(
|
offset2(
|
||||||
loops0,
|
loops0,
|
||||||
- int(i) * flow.scaled_spacing() - 0.5f * flow.scaled_spacing(),
|
- i * flow.scaled_spacing() - 0.5f * flow.scaled_spacing(),
|
||||||
0.5f * flow.scaled_spacing()));
|
0.5f * flow.scaled_spacing()));
|
||||||
// Clip such loops to the side oriented towards the object.
|
// Clip such loops to the side oriented towards the object.
|
||||||
// Collect split points, so they will be recognized after the clipping.
|
// Collect split points, so they will be recognized after the clipping.
|
||||||
|
@ -414,13 +414,13 @@ std::string format_memsize_MB(size_t n)
|
|||||||
scale *= 1000;
|
scale *= 1000;
|
||||||
}
|
}
|
||||||
char buf[8];
|
char buf[8];
|
||||||
sprintf(buf, "%d", n);
|
sprintf(buf, "%d", (int)n);
|
||||||
out = buf;
|
out = buf;
|
||||||
while (scale != 1) {
|
while (scale != 1) {
|
||||||
scale /= 1000;
|
scale /= 1000;
|
||||||
n = n2 / scale;
|
n = n2 / scale;
|
||||||
n2 = n2 % scale;
|
n2 = n2 % scale;
|
||||||
sprintf(buf, ",%03d", n);
|
sprintf(buf, ",%03d", (int)n);
|
||||||
out += buf;
|
out += buf;
|
||||||
}
|
}
|
||||||
return out + "MB";
|
return out + "MB";
|
||||||
|
Loading…
Reference in New Issue
Block a user