From f91c27b2ffefbdd57b2aac9d233218b952701c3f Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 13 May 2020 14:53:05 +0200 Subject: [PATCH] Do reprojection also after netfabb repair --- src/libslic3r/SLA/ReprojectPointsOnMesh.hpp | 17 +++++++++++++++++ src/slic3r/GUI/Plater.cpp | 12 ++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/libslic3r/SLA/ReprojectPointsOnMesh.hpp b/src/libslic3r/SLA/ReprojectPointsOnMesh.hpp index 1479eb430..fa919a117 100644 --- a/src/libslic3r/SLA/ReprojectPointsOnMesh.hpp +++ b/src/libslic3r/SLA/ReprojectPointsOnMesh.hpp @@ -5,6 +5,7 @@ #include "SupportPoint.hpp" #include "Hollowing.hpp" #include "EigenMesh3D.hpp" +#include "libslic3r/Model.hpp" #include @@ -24,5 +25,21 @@ void reproject_support_points(const EigenMesh3D &mesh, std::vector &p }); } +inline void reproject_points_and_holes(ModelObject *object) +{ + bool has_sppoints = !object->sla_support_points.empty(); + bool has_holes = !object->sla_drain_holes.empty(); + + if (!object || (!has_holes && !has_sppoints)) return; + + EigenMesh3D emesh{object->raw_mesh()}; + + if (has_sppoints) + reproject_support_points(emesh, object->sla_support_points); + + if (has_holes) + reproject_support_points(emesh, object->sla_drain_holes); +} + }} #endif // REPROJECTPOINTSONMESH_HPP diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 2ef7417d4..ca91967e1 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3124,16 +3124,7 @@ void Plater::priv::reload_from_disk() old_model_object->delete_volume(old_model_object->volumes.size() - 1); old_model_object->ensure_on_bed(); - std::unique_ptr emesh; - if (!old_model_object->sla_support_points.empty()) { - emesh = std::make_unique(old_model_object->raw_mesh()); - sla::reproject_support_points(*emesh, old_model_object->sla_support_points); - } - - if (!old_model_object->sla_drain_holes.empty()) { - if (!emesh) emesh = std::make_unique(old_model_object->raw_mesh()); - sla::reproject_support_points(*emesh, old_model_object->sla_drain_holes); - } + sla::reproject_points_and_holes(old_model_object); } } } @@ -3189,6 +3180,7 @@ void Plater::priv::fix_through_netfabb(const int obj_idx, const int vol_idx/* = Plater::TakeSnapshot snapshot(q, _L("Fix Throught NetFabb")); fix_model_by_win10_sdk_gui(*model.objects[obj_idx], vol_idx); + sla::reproject_points_and_holes(model.objects[obj_idx]); this->update(); this->object_list_changed(); this->schedule_background_process();