Refuse to drill a broken mesh
Hole parameters defaults and limits changed a bit
This commit is contained in:
parent
3f73261fdb
commit
b41c6d7d64
@ -80,6 +80,13 @@ SLAPrint::Steps::Steps(SLAPrint *print)
|
|||||||
void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
||||||
{
|
{
|
||||||
po.m_hollowing_data.reset();
|
po.m_hollowing_data.reset();
|
||||||
|
bool drilling_needed = ! po.m_model_object->sla_drain_holes.empty();
|
||||||
|
|
||||||
|
// If the mesh is broken, stop immediately, even before hollowing.
|
||||||
|
if (drilling_needed && po.transformed_mesh().needed_repair())
|
||||||
|
throw std::runtime_error(L("The mesh appears to be too broken "
|
||||||
|
"to drill holes into it reliably."));
|
||||||
|
|
||||||
if (! po.m_config.hollowing_enable.getBool())
|
if (! po.m_config.hollowing_enable.getBool())
|
||||||
BOOST_LOG_TRIVIAL(info) << "Skipping hollowing step!";
|
BOOST_LOG_TRIVIAL(info) << "Skipping hollowing step!";
|
||||||
else {
|
else {
|
||||||
@ -104,7 +111,7 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Drill holes into the hollowed/original mesh.
|
// Drill holes into the hollowed/original mesh.
|
||||||
if (po.m_model_object->sla_drain_holes.empty())
|
if (! drilling_needed)
|
||||||
BOOST_LOG_TRIVIAL(info) << "Drilling skipped (no holes).";
|
BOOST_LOG_TRIVIAL(info) << "Drilling skipped (no holes).";
|
||||||
else {
|
else {
|
||||||
BOOST_LOG_TRIVIAL(info) << "Drilling drainage holes.";
|
BOOST_LOG_TRIVIAL(info) << "Drilling drainage holes.";
|
||||||
@ -116,7 +123,7 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
|||||||
holes_mesh.merge(sla::to_triangle_mesh(holept.to_mesh()));
|
holes_mesh.merge(sla::to_triangle_mesh(holept.to_mesh()));
|
||||||
|
|
||||||
holes_mesh.require_shared_vertices();
|
holes_mesh.require_shared_vertices();
|
||||||
MeshBoolean::self_union(holes_mesh); //FIXME-fix and use the cgal version
|
MeshBoolean::self_union(holes_mesh);
|
||||||
|
|
||||||
// If there is no hollowed mesh yet, copy the original mesh.
|
// If there is no hollowed mesh yet, copy the original mesh.
|
||||||
if (! po.m_hollowing_data) {
|
if (! po.m_hollowing_data) {
|
||||||
|
@ -794,7 +794,7 @@ RENDER_AGAIN:
|
|||||||
// m_imgui->text(" "); // vertical gap
|
// m_imgui->text(" "); // vertical gap
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
float diameter_upper_cap = 5.f;
|
float diameter_upper_cap = 15.;
|
||||||
if (m_new_hole_radius > diameter_upper_cap)
|
if (m_new_hole_radius > diameter_upper_cap)
|
||||||
m_new_hole_radius = diameter_upper_cap;
|
m_new_hole_radius = diameter_upper_cap;
|
||||||
m_imgui->text(m_desc.at("hole_diameter"));
|
m_imgui->text(m_desc.at("hole_diameter"));
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
|
|
||||||
bool m_show_supports = true;
|
bool m_show_supports = true;
|
||||||
float m_new_hole_radius = 2.f; // Size of a new hole.
|
float m_new_hole_radius = 2.f; // Size of a new hole.
|
||||||
float m_new_hole_height = 5.f;
|
float m_new_hole_height = 6.f;
|
||||||
mutable std::vector<bool> m_selected; // which holes are currently selected
|
mutable std::vector<bool> m_selected; // which holes are currently selected
|
||||||
|
|
||||||
bool m_enable_hollowing = true;
|
bool m_enable_hollowing = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user