Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_gcode_viewer

This commit is contained in:
enricoturri1966 2020-08-12 15:07:31 +02:00
commit 7be5860908
3 changed files with 14 additions and 12 deletions

View File

@ -2733,7 +2733,7 @@ void PrintObject::project_and_append_custom_supports(
std::array<Vec2f, 3> trianglef; std::array<Vec2f, 3> trianglef;
for (int i=0; i<3; ++i) { for (int i=0; i<3; ++i) {
trianglef[i] = Vec2f(facet[i].x(), facet[i].y()); trianglef[i] = Vec2f(facet[i].x(), facet[i].y());
trianglef[i] += Vec2f(unscale<float>(this->center_offset().x()), trianglef[i] -= Vec2f(unscale<float>(this->center_offset().x()),
unscale<float>(this->center_offset().y())); unscale<float>(this->center_offset().y()));
} }
@ -2823,8 +2823,9 @@ void PrintObject::project_and_append_custom_supports(
// Now append the collected polygons to respective layers. // Now append the collected polygons to respective layers.
for (auto& trg : projections_of_triangles) { for (auto& trg : projections_of_triangles) {
int layer_id = trg.first_layer_id; int layer_id = trg.first_layer_id;
for (const LightPolygon& poly : trg.polygons) { 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)); expolys[layer_id].emplace_back(std::move(poly.pts));
++layer_id; ++layer_id;
} }

View File

@ -409,7 +409,7 @@ void PrintObjectSupportMaterial::generate(PrintObject &object)
export_print_z_polygons_and_extrusions_to_svg( 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(), debug_out_path("support-w-fills-%d-%lf.svg", iRun, layers_sorted[i]->print_z).c_str(),
layers_sorted.data() + i, j - i, layers_sorted.data() + i, j - i,
*object.support_layers[layer_id]); *object.support_layers()[layer_id]);
++layer_id; ++layer_id;
} }
i = j; i = j;
@ -597,8 +597,8 @@ public:
::fwrite(&n_points, 4, 1, file); ::fwrite(&n_points, 4, 1, file);
for (uint32_t j = 0; j < n_points; ++ j) { for (uint32_t j = 0; j < n_points; ++ j) {
const Point &pt = poly.points[j]; const Point &pt = poly.points[j];
::fwrite(&pt.x, sizeof(coord_t), 1, file); ::fwrite(&pt.x(), sizeof(coord_t), 1, file);
::fwrite(&pt.y, sizeof(coord_t), 1, file); ::fwrite(&pt.y(), sizeof(coord_t), 1, file);
} }
} }
n_polygons = m_trimming_polygons->size(); n_polygons = m_trimming_polygons->size();
@ -609,8 +609,8 @@ public:
::fwrite(&n_points, 4, 1, file); ::fwrite(&n_points, 4, 1, file);
for (uint32_t j = 0; j < n_points; ++ j) { for (uint32_t j = 0; j < n_points; ++ j) {
const Point &pt = poly.points[j]; const Point &pt = poly.points[j];
::fwrite(&pt.x, sizeof(coord_t), 1, file); ::fwrite(&pt.x(), sizeof(coord_t), 1, file);
::fwrite(&pt.y, sizeof(coord_t), 1, file); ::fwrite(&pt.y(), sizeof(coord_t), 1, file);
} }
} }
::fclose(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", ::Slic3r::SVG svg(debug_out_path("support-top-contacts-raw-run%d-layer%d-region%d.svg",
iRun, layer_id, 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)); get_extents(diff_polygons));
Slic3r::ExPolygons expolys = union_ex(diff_polygons, false); Slic3r::ExPolygons expolys = union_ex(diff_polygons, false);
svg.draw(expolys); svg.draw(expolys);
@ -1152,7 +1152,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
Slic3r::SVG::export_expolygons( Slic3r::SVG::export_expolygons(
debug_out_path("support-top-contacts-filtered-run%d-layer%d-region%d-z%f.svg", debug_out_path("support-top-contacts-filtered-run%d-layer%d-region%d-z%f.svg",
iRun, layer_id, 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), layer.print_z),
union_ex(diff_polygons, false)); union_ex(diff_polygons, false));
#endif /* SLIC3R_DEBUG */ #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(top, false), "blue", 0.5f);
svg.draw(union_ex(projection_raw, true), "red", 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_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 */ #endif /* SLIC3R_DEBUG */

View File

@ -60,8 +60,9 @@ void TriangleSelector::select_patch(const Vec3f& hit, int facet_start,
if (select_triangle(facet, new_state)) { if (select_triangle(facet, new_state)) {
// add neighboring facets to list to be proccessed later // add neighboring facets to list to be proccessed later
for (int n=0; n<3; ++n) { for (int n=0; n<3; ++n) {
if (faces_camera(m_mesh->stl.neighbors_start[facet].neighbor[n])) int neighbor_idx = m_mesh->stl.neighbors_start[facet].neighbor[n];
facets_to_check.push_back(m_mesh->stl.neighbors_start[facet].neighbor[n]); if (neighbor_idx >=0 && faces_camera(neighbor_idx))
facets_to_check.push_back(neighbor_idx);
} }
} }
} }