diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 273fc9c10..c90a05ef3 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -2733,7 +2733,7 @@ void PrintObject::project_and_append_custom_supports( std::array trianglef; for (int i=0; i<3; ++i) { trianglef[i] = Vec2f(facet[i].x(), facet[i].y()); - trianglef[i] += Vec2f(unscale(this->center_offset().x()), + trianglef[i] -= Vec2f(unscale(this->center_offset().x()), unscale(this->center_offset().y())); } @@ -2823,8 +2823,9 @@ void PrintObject::project_and_append_custom_supports( // Now append the collected polygons to respective layers. for (auto& trg : projections_of_triangles) { int layer_id = trg.first_layer_id; - for (const LightPolygon& poly : trg.polygons) { + if (layer_id >= int(expolys.size())) + break; // part of triangle could be projected above top layer expolys[layer_id].emplace_back(std::move(poly.pts)); ++layer_id; } diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp index 43f582d5f..95b4c334b 100644 --- a/src/libslic3r/SupportMaterial.cpp +++ b/src/libslic3r/SupportMaterial.cpp @@ -409,7 +409,7 @@ void PrintObjectSupportMaterial::generate(PrintObject &object) export_print_z_polygons_and_extrusions_to_svg( debug_out_path("support-w-fills-%d-%lf.svg", iRun, layers_sorted[i]->print_z).c_str(), layers_sorted.data() + i, j - i, - *object.support_layers[layer_id]); + *object.support_layers()[layer_id]); ++layer_id; } i = j; @@ -597,8 +597,8 @@ public: ::fwrite(&n_points, 4, 1, file); for (uint32_t j = 0; j < n_points; ++ j) { const Point &pt = poly.points[j]; - ::fwrite(&pt.x, sizeof(coord_t), 1, file); - ::fwrite(&pt.y, sizeof(coord_t), 1, file); + ::fwrite(&pt.x(), sizeof(coord_t), 1, file); + ::fwrite(&pt.y(), sizeof(coord_t), 1, file); } } n_polygons = m_trimming_polygons->size(); @@ -609,8 +609,8 @@ public: ::fwrite(&n_points, 4, 1, file); for (uint32_t j = 0; j < n_points; ++ j) { const Point &pt = poly.points[j]; - ::fwrite(&pt.x, sizeof(coord_t), 1, file); - ::fwrite(&pt.y, sizeof(coord_t), 1, file); + ::fwrite(&pt.x(), sizeof(coord_t), 1, file); + ::fwrite(&pt.y(), sizeof(coord_t), 1, file); } } ::fclose(file); @@ -1134,7 +1134,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_ { ::Slic3r::SVG svg(debug_out_path("support-top-contacts-raw-run%d-layer%d-region%d.svg", iRun, layer_id, - std::find_if(layer.regions.begin(), layer.regions.end(), [layerm](const LayerRegion* other){return other == layerm;}) - layer.regions.begin()), + std::find_if(layer.regions().begin(), layer.regions().end(), [layerm](const LayerRegion* other){return other == layerm;}) - layer.regions().begin()), get_extents(diff_polygons)); Slic3r::ExPolygons expolys = union_ex(diff_polygons, false); svg.draw(expolys); @@ -1152,7 +1152,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_ Slic3r::SVG::export_expolygons( debug_out_path("support-top-contacts-filtered-run%d-layer%d-region%d-z%f.svg", iRun, layer_id, - std::find_if(layer.regions.begin(), layer.regions.end(), [layerm](const LayerRegion* other){return other == layerm;}) - layer.regions.begin(), + std::find_if(layer.regions().begin(), layer.regions().end(), [layerm](const LayerRegion* other){return other == layerm;}) - layer.regions().begin(), layer.print_z), union_ex(diff_polygons, false)); #endif /* SLIC3R_DEBUG */ @@ -1482,7 +1482,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta svg.draw(union_ex(top, false), "blue", 0.5f); svg.draw(union_ex(projection_raw, true), "red", 0.5f); svg.draw_outline(union_ex(projection_raw, true), "red", "blue", scale_(0.1f)); - svg.draw(layer.slices, "green", 0.5f); + svg.draw(layer.lslices, "green", 0.5f); } #endif /* SLIC3R_DEBUG */ diff --git a/src/libslic3r/TriangleSelector.cpp b/src/libslic3r/TriangleSelector.cpp index 763bf5861..9555c42a6 100644 --- a/src/libslic3r/TriangleSelector.cpp +++ b/src/libslic3r/TriangleSelector.cpp @@ -60,8 +60,9 @@ void TriangleSelector::select_patch(const Vec3f& hit, int facet_start, if (select_triangle(facet, new_state)) { // add neighboring facets to list to be proccessed later for (int n=0; n<3; ++n) { - if (faces_camera(m_mesh->stl.neighbors_start[facet].neighbor[n])) - facets_to_check.push_back(m_mesh->stl.neighbors_start[facet].neighbor[n]); + int neighbor_idx = m_mesh->stl.neighbors_start[facet].neighbor[n]; + if (neighbor_idx >=0 && faces_camera(neighbor_idx)) + facets_to_check.push_back(neighbor_idx); } } }