Fine tuning the new parameters and adding max_pillar_link_distance

This commit is contained in:
tamasmeszaros 2019-03-08 11:39:34 +01:00
parent e0b1551790
commit 1cb1c12812
8 changed files with 41 additions and 11 deletions

View File

@ -2672,6 +2672,15 @@ void PrintConfigDef::init_sla_params()
def->min = 0;
def->default_value = new ConfigOptionFloat(15.0);
def = this->add("support_max_pillar_link_distance", coFloat);
def->label = L("Max pillar linking distance");
def->category = L("Supports");
def->tooltip = L("The max distance of two pillars to get linked with each other.");
def->sidetext = L("mm");
def->cli = "";
def->min = 0; // 0 means no linking
def->default_value = new ConfigOptionFloat(10.0);
def = this->add("support_object_elevation", coFloat);
def->label = L("Object elevation");
def->category = L("Supports");

View File

@ -1006,6 +1006,9 @@ public:
// The max length of a bridge in mm
ConfigOptionFloat support_max_bridge_length /*= 15.0*/;
// The max distance of two pillars to get cross linked.
ConfigOptionFloat support_max_pillar_link_distance;
// The elevation in Z direction upwards. This is the space between the pad
// and the model object's bounding box bottom. Units in mm.
ConfigOptionFloat support_object_elevation /*= 5.0*/;
@ -1053,6 +1056,7 @@ protected:
OPT_PTR(support_base_height);
OPT_PTR(support_critical_angle);
OPT_PTR(support_max_bridge_length);
OPT_PTR(support_max_pillar_link_distance);
OPT_PTR(support_points_density_relative);
OPT_PTR(support_points_minimal_distance);
OPT_PTR(support_object_elevation);

View File

@ -71,7 +71,7 @@ const double SupportConfig::normal_cutoff_angle = 150.0 * M_PI / 180.0;
// The shortest distance of any support structure from the model surface
const double SupportConfig::safety_distance_mm = 0.1;
const double SupportConfig::max_solo_pillar_height_mm = 5.0;
const double SupportConfig::max_solo_pillar_height_mm = 15.0;
const double SupportConfig::max_dual_pillar_height_mm = 35.0;
const double SupportConfig::optimizer_rel_score_diff = 1e-6;
const unsigned SupportConfig::optimizer_max_iterations = 500;
@ -678,11 +678,15 @@ public:
}
void increment_bridges(const Pillar& pillar) {
assert(pillar.id >= 0 && size_t(pillar.id) < m_pillars.size());
if(pillar.id >= 0 && size_t(pillar.id) < m_pillars.size())
m_pillars[size_t(pillar.id)].bridges++;
}
void increment_links(const Pillar& pillar) {
assert(pillar.id >= 0 && size_t(pillar.id) < m_pillars.size());
if(pillar.id >= 0 && size_t(pillar.id) < m_pillars.size())
m_pillars[size_t(pillar.id)].links++;
}
@ -1169,8 +1173,8 @@ class SLASupportTree::Algorithm {
double bridge_distance = pillar_dist / std::cos(-m_cfg.bridge_slope);
double zstep = pillar_dist * std::tan(-m_cfg.bridge_slope);
if(pillar_dist < 2*m_cfg.head_back_radius_mm) return false;
if(bridge_distance > m_cfg.max_bridge_length_mm) return false;
if(pillar_dist < 2 * m_cfg.head_back_radius_mm ||
pillar_dist > m_cfg.max_pillar_link_distance_mm) return false;
if(supper(Z) < slower(Z)) supper.swap(slower);
if(eupper(Z) < elower(Z)) eupper.swap(elower);
@ -1659,8 +1663,8 @@ public:
// Could not find a pillar, create one
auto& pillar = m_result.add_pillar(unsigned(sidehead.id),
pend, pradius)
.add_base(m_cfg.base_height_mm,
m_cfg.base_radius_mm);
.add_base(m_cfg.base_height_mm,
m_cfg.base_radius_mm);
// connects to ground, eligible for bridging
m_pillar_index.insert(pend, unsigned(pillar.id));
@ -1962,7 +1966,7 @@ public:
alpha += 0.1 * PI;
}
std::vector<std::reference_wrapper<const Pillar>> newpills;
std::vector<long> newpills;
newpills.reserve(needpillars);
if(found) for(unsigned n = 0; n < needpillars; n++) {
@ -1982,13 +1986,16 @@ public:
if(pillar.endpoint()(Z) > m_result.ground_level)
m_result.add_junction(pillar.endpoint(), pillar.r);
newpills.emplace_back(pp);
newpills.emplace_back(pp.id);
}
}
if(!newpills.empty())
for(auto it = newpills.begin(), nx = std::next(it);
nx != newpills.end(); ++it, ++nx) interconnect(*it, *nx);
nx != newpills.end(); ++it, ++nx) {
interconnect(m_result.pillars()[size_t(*it)],
m_result.pillars()[size_t(*nx)]);
}
}
}

View File

@ -72,7 +72,10 @@ struct SupportConfig {
double bridge_slope = M_PI/4;
// The max length of a bridge in mm
double max_bridge_length_mm = 15.0;
double max_bridge_length_mm = 10.0;
// The max distance of a pillar to pillar link.
double max_pillar_link_distance_mm = 10.0;
// The elevation in Z direction upwards. This is the space between the pad
// and the model object's bounding box bottom.

View File

@ -546,6 +546,7 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) {
scfg.object_elevation_mm = c.support_object_elevation.getFloat();
scfg.bridge_slope = c.support_critical_angle.getFloat() * PI / 180.0 ;
scfg.max_bridge_length_mm = c.support_max_bridge_length.getFloat();
scfg.max_pillar_link_distance_mm = c.support_max_pillar_link_distance.getFloat();
switch(c.support_pillar_connection_mode.getInt()) {
case slapcmZigZag:
scfg.pillar_connection_mode = sla::PillarConnectionMode::zigzag; break;
@ -1386,6 +1387,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|| opt_key == "support_base_height"
|| opt_key == "support_critical_angle"
|| opt_key == "support_max_bridge_length"
|| opt_key == "support_max_pillar_link_distance"
|| opt_key == "support_object_elevation") {
steps.emplace_back(slaposSupportTree);
} else if (

View File

@ -247,6 +247,11 @@ private:
// Invalidate steps based on a set of parameters changed.
bool invalidate_state_by_config_options(const std::vector<t_config_option_key> &opt_keys);
std::vector<float> calculate_heights(const BoundingBoxf3& bb,
float elevation,
float initial_layer_height,
float layer_height) const;
void fill_statistics();
SLAPrintConfig m_print_config;
@ -270,8 +275,6 @@ private:
lref(std::cref(lyr)), copies(std::cref(cp)) {}
};
std::vector<float> calculate_heights(const BoundingBoxf3& bb, float elevation, float initial_layer_height, float layer_height) const;
// One level may contain multiple slices from multiple objects and their
// supports
using LayerRefs = std::vector<LayerRef>;

View File

@ -457,6 +457,7 @@ const std::vector<std::string>& Preset::sla_print_options()
"support_base_height",
"support_critical_angle",
"support_max_bridge_length",
"support_max_pillar_link_distance",
"support_object_elevation",
"support_points_density_relative",
"support_points_minimal_distance",

View File

@ -3277,6 +3277,7 @@ void TabSLAPrint::build()
optgroup = page->new_optgroup(_(L("Connection of the support sticks and junctions")));
optgroup->append_single_option_line("support_critical_angle");
optgroup->append_single_option_line("support_max_bridge_length");
optgroup->append_single_option_line("support_max_pillar_link_distance");
optgroup = page->new_optgroup(_(L("Automatic generation")));
optgroup->append_single_option_line("support_points_density_relative");