From a05bda534725502673810a3d7310d5d165c5787c Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Fri, 23 Nov 2018 11:51:45 +0100 Subject: [PATCH] Removed head_back_radius and added pillar widening factor to the parameter layers --- src/libslic3r/PrintConfig.cpp | 23 +++++++++++++---------- src/libslic3r/PrintConfig.hpp | 16 +++++++--------- src/libslic3r/SLA/SLASupportTree.cpp | 10 +++++----- src/libslic3r/SLA/SLASupportTree.hpp | 17 ++++++++++------- src/libslic3r/SLAPrint.cpp | 12 +++++------- src/slic3r/GUI/GLCanvas3D.cpp | 1 + src/slic3r/GUI/Preset.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 2 +- 8 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 3bbdf9246..ce952c549 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2471,15 +2471,6 @@ void PrintConfigDef::init_sla_params() def->min = 0; def->default_value = new ConfigOptionFloat(0.2); - def = this->add("support_head_back_radius", coFloat); - def->label = L("Support head back radius"); - def->category = L("Supports"); - def->tooltip = L("Radius of the back side of the 3d arrow"); - def->sidetext = L("mm"); - def->cli = ""; - def->min = 0; - def->default_value = new ConfigOptionFloat(0.5); - def = this->add("support_head_width", coFloat); def->label = L("Support head width"); def->category = L("Supports"); @@ -2496,7 +2487,19 @@ void PrintConfigDef::init_sla_params() def->sidetext = L("mm"); def->cli = ""; def->min = 0; - def->default_value = new ConfigOptionFloat(0.8); + def->default_value = new ConfigOptionFloat(0.5); + + def = this->add("support_pillar_widening_factor", coFloat); + def->label = L("Pillar widening factor"); + def->category = L("Supports"); + def->tooltip = L("Merging bridges or pillars into another pillars can " + "increase the radius. Zero means no increase, one means " + "full increase."); + def->sidetext = L(""); + def->cli = ""; + def->min = 0; + def->max = 1.0; + def->default_value = new ConfigOptionFloat(0.0); def = this->add("support_base_radius", coFloat); def->label = L("Support base radius"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index b3d0c33be..cd11c4298 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -913,20 +913,18 @@ public: // How much the pinhead has to penetrate the model surface ConfigOptionFloat support_head_penetration /*= 0.2*/; - // Radius of the back side of the 3d arrow. TODO: consider renaming this - // to actual pillar radius, because that's what it boils down to. - ConfigOptionFloat support_head_back_radius /*= 0.5*/; - // Width in mm from the back sphere center to the front sphere center. ConfigOptionFloat support_head_width /*= 1.0*/; // Radius in mm of the support pillars. - // TODO: This parameter is questionable. The pillar radius will be dynamic in - // nature. Merged pillars will have an increased thickness. This parameter - // may serve as the maximum radius, or maybe an increase when two are merged - // The default radius will be derived from head_back_radius_mm ConfigOptionFloat support_pillar_radius /*= 0.8*/; + // TODO: unimplemented at the moment. This coefficient will have an impact + // when bridges and pillars are merged. The resulting pillar should be a bit + // thicker than the ones merging into it. How much thicker? I don't know + // but it will be derived from this value. + ConfigOptionFloat support_pillar_widening_factor; + // Radius in mm of the pillar base. ConfigOptionFloat support_base_radius /*= 2.0*/; @@ -968,9 +966,9 @@ protected: OPT_PTR(supports_enable); OPT_PTR(support_head_front_radius); OPT_PTR(support_head_penetration); - OPT_PTR(support_head_back_radius); OPT_PTR(support_head_width); OPT_PTR(support_pillar_radius); + OPT_PTR(support_pillar_widening_factor); OPT_PTR(support_base_radius); OPT_PTR(support_base_height); OPT_PTR(support_critical_angle); diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index c348113f4..6591596da 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -309,7 +309,7 @@ struct Head { } double request_pillar_radius(double radius) const { - const double rmax = r_back_mm /* * 0.65*/ ; + const double rmax = r_back_mm; return radius > 0 && radius < rmax ? radius : rmax; } }; @@ -1186,7 +1186,7 @@ bool SLASupportTree::generate(const PointSet &points, // If the pillars are so close that they touch each other, // there is no need to bridge them together. - if(pillar_dist > 2*cfg.pillar_radius_mm && + if(pillar_dist > 2*cfg.head_back_radius_mm && bridge_distance < cfg.max_bridge_length_mm) while(sj(Z) > pillar.endpoint(Z) && ej(Z) > nextpillar.endpoint(Z)) @@ -1225,7 +1225,7 @@ bool SLASupportTree::generate(const PointSet &points, Result& result) { const double hbr = cfg.head_back_radius_mm; - const double pradius = cfg.pillar_radius_mm; + const double pradius = cfg.head_back_radius_mm; const double maxbridgelen = cfg.max_bridge_length_mm; const double gndlvl = result.ground_level; @@ -1478,7 +1478,7 @@ bool SLASupportTree::generate(const PointSet &points, result.add_pillar(idx, Vec3d{headend(X), headend(Y), headend(Z) - gh + hl}, - cfg.pillar_radius_mm + cfg.head_back_radius_mm ).base = base_head.mesh; } }; @@ -1493,7 +1493,7 @@ bool SLASupportTree::generate(const PointSet &points, // For now we will just generate smaller headless sticks with a sharp // ending point that connects to the mesh surface. - const double R = 0.5*cfg.pillar_radius_mm; + const double R = cfg.headless_pillar_radius_mm; const double HWIDTH_MM = R/3; // We will sink the pins into the model surface for a distance of 1/3 of diff --git a/src/libslic3r/SLA/SLASupportTree.hpp b/src/libslic3r/SLA/SLASupportTree.hpp index a24601de1..9213101f3 100644 --- a/src/libslic3r/SLA/SLASupportTree.hpp +++ b/src/libslic3r/SLA/SLASupportTree.hpp @@ -41,13 +41,16 @@ struct SupportConfig { // Width in mm from the back sphere center to the front sphere center. double head_width_mm = 1.0; - // Radius in mm of the support pillars. - // Warning: this value will be at most 65% of head_back_radius_mm - // TODO: This parameter is invalid. The pillar radius will be dynamic in - // nature. Merged pillars will have an increased thickness. This parameter - // may serve as the maximum radius, or maybe an increase when two are merged - // The default radius will be derived from head_back_radius_mm - double pillar_radius_mm = 0.8; + // Radius in mm of the support pillars. The actual radius of the pillars + // beginning with a head will not be higher than head_back_radius but the + // headless pillars will have half of this value. + double headless_pillar_radius_mm = 0.4; + + // TODO: unimplemented at the moment. This coefficient will have an impact + // when bridges and pillars are merged. The resulting pillar should be a bit + // thicker than the ones merging into it. How much thicker? I don't know + // but it will be derived from this value. + double pillar_widening_factor = 0.5; // Radius in mm of the pillar base. double base_radius_mm = 2.0; diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index cc6926a66..7c0ab2529 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -458,13 +458,16 @@ void SLAPrint::process() SLAPrintObjectConfig& c = po.m_config; scfg.head_front_radius_mm = c.support_head_front_radius.getFloat(); - scfg.head_back_radius_mm = c.support_head_back_radius.getFloat(); + scfg.head_back_radius_mm = c.support_pillar_radius.getFloat(); scfg.head_penetration_mm = c.support_head_penetration.getFloat(); scfg.head_width_mm = c.support_head_width.getFloat(); scfg.object_elevation_mm = c.support_object_elevation.getFloat(); scfg.tilt = c.support_critical_angle.getFloat() * PI / 180.0 ; scfg.max_bridge_length_mm = c.support_max_bridge_length.getFloat(); - scfg.pillar_radius_mm = c.support_pillar_radius.getFloat(); + scfg.headless_pillar_radius_mm = 0.75*c.support_pillar_radius.getFloat(); + scfg.pillar_widening_factor = c.support_pillar_widening_factor.getFloat(); + scfg.base_radius_mm = c.support_base_radius.getFloat(); + scfg.base_height_mm = c.support_base_height.getFloat(); sla::Controller ctl; @@ -521,11 +524,6 @@ void SLAPrint::process() if(elevation < pad_h) sla::base_plate(trmesh, bp, float(pad_h), float(lh)); - std::cout << "Mesh is empty: " << trmesh.empty() << std::endl; - std::cout << "Pad height: " << pad_h << std::endl; - std::cout << "Elevation " << elevation << std::endl; - std::cout << "Pad plate vertices: " << bp.size() << std::endl; - po.m_supportdata->support_tree_ptr->add_pad(bp, wt, h, md, er); } }; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d43c9adf7..431ba58b7 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4069,6 +4069,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re size_t idx = 0; const SLAPrint *sla_print = this->sla_print(); for (const SLAPrintObject *print_object : sla_print->objects()) { + std::cout << "Current elevation: "<< print_object->get_current_elevation() << std::endl; SLASupportState &state = sla_support_state[idx ++]; const ModelObject *model_object = print_object->model_object(); // Find an index of the ModelObject diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index 96191e0ff..240cfea26 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -405,9 +405,9 @@ const std::vector& Preset::sla_print_options() "supports_enable", "support_head_front_radius", "support_head_penetration", - "support_head_back_radius", "support_head_width", "support_pillar_radius", + "support_pillar_widening_factor", "support_base_radius", "support_base_height", "support_critical_angle", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 7258ce003..bed0a42d9 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3002,12 +3002,12 @@ void TabSLAPrint::build() optgroup = page->new_optgroup(_(L("Support head"))); optgroup->append_single_option_line("support_head_front_radius"); - optgroup->append_single_option_line("support_head_back_radius"); optgroup->append_single_option_line("support_head_penetration"); optgroup->append_single_option_line("support_head_width"); optgroup = page->new_optgroup(_(L("Support pillar"))); optgroup->append_single_option_line("support_pillar_radius"); + optgroup->append_single_option_line("support_pillar_widening_factor"); optgroup->append_single_option_line("support_base_radius"); optgroup->append_single_option_line("support_base_height"); optgroup->append_single_option_line("support_object_elevation");