Added parameter for pillar connection mode

This commit is contained in:
tamasmeszaros 2019-01-09 12:21:43 +01:00
parent 41d189a355
commit 1947925263
10 changed files with 69 additions and 1 deletions

View File

@ -2527,6 +2527,22 @@ void PrintConfigDef::init_sla_params()
def->min = 0; def->min = 0;
def->default_value = new ConfigOptionFloat(1.0); def->default_value = new ConfigOptionFloat(1.0);
def = this->add("support_pillar_connection_mode", coEnum);
def->label = L("Support pillar connection mode");
def->tooltip = L("Controls the bridge type between two neigboring pillars."
" Can be zig-zag, cross (double zig-zag) or dynamic which"
" will automatically switch between the first two depending"
" on the distance of the two pillars.");
def->cli = "";
def->enum_keys_map = &ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_values();
def->enum_values.push_back("zigzag");
def->enum_values.push_back("cross");
def->enum_values.push_back("dynamic");
def->enum_labels.push_back(L("Zig-Zag"));
def->enum_labels.push_back(L("Cross"));
def->enum_labels.push_back(L("Dynamic"));
def->default_value = new ConfigOptionEnum<SLAPillarConnectionMode>(slapcmDynamic);
def = this->add("support_pillar_widening_factor", coFloat); def = this->add("support_pillar_widening_factor", coFloat);
def->label = L("Pillar widening factor"); def->label = L("Pillar widening factor");
def->category = L("Supports"); def->category = L("Supports");

View File

@ -61,6 +61,12 @@ enum SLADisplayOrientation {
sladoPortrait sladoPortrait
}; };
enum SLAPillarConnectionMode {
slapcmZigZag,
slapcmCross,
slapcmDynamic
};
template<> inline const t_config_enum_values& ConfigOptionEnum<PrinterTechnology>::get_enum_values() { template<> inline const t_config_enum_values& ConfigOptionEnum<PrinterTechnology>::get_enum_values() {
static t_config_enum_values keys_map; static t_config_enum_values keys_map;
if (keys_map.empty()) { if (keys_map.empty()) {
@ -162,6 +168,16 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<SLADisplayOrienta
return keys_map; return keys_map;
} }
template<> inline const t_config_enum_values& ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_values() {
static const t_config_enum_values keys_map = {
{"zigzag", slapcmZigZag},
{"cross", slapcmCross},
{"dynamic", slapcmDynamic}
};
return keys_map;
}
// Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs. // Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs.
// Does not store the actual values, but defines default values. // Does not store the actual values, but defines default values.
class PrintConfigDef : public ConfigDef class PrintConfigDef : public ConfigDef
@ -949,6 +965,9 @@ public:
// Radius in mm of the support pillars. // Radius in mm of the support pillars.
ConfigOptionFloat support_pillar_diameter /*= 0.8*/; ConfigOptionFloat support_pillar_diameter /*= 0.8*/;
// How the pillars are bridged together
ConfigOptionEnum<SLAPillarConnectionMode> support_pillar_connection_mode;
// TODO: unimplemented at the moment. This coefficient will have an impact // TODO: unimplemented at the moment. This coefficient will have an impact
// when bridges and pillars are merged. The resulting pillar should be a bit // 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 // thicker than the ones merging into it. How much thicker? I don't know
@ -1003,6 +1022,7 @@ protected:
OPT_PTR(support_head_penetration); OPT_PTR(support_head_penetration);
OPT_PTR(support_head_width); OPT_PTR(support_head_width);
OPT_PTR(support_pillar_diameter); OPT_PTR(support_pillar_diameter);
OPT_PTR(support_pillar_connection_mode);
OPT_PTR(support_pillar_widening_factor); OPT_PTR(support_pillar_widening_factor);
OPT_PTR(support_base_diameter); OPT_PTR(support_base_diameter);
OPT_PTR(support_base_height); OPT_PTR(support_base_height);

View File

@ -1249,8 +1249,13 @@ bool SLASupportTree::generate(const PointSet &points,
if(chkd >= bridge_distance) { if(chkd >= bridge_distance) {
result.add_bridge(sj, ej, pillar.r); result.add_bridge(sj, ej, pillar.r);
auto pcm = cfg.pillar_connection_mode;
// double bridging: (crosses) // double bridging: (crosses)
if(pillar_dist > 2*cfg.base_radius_mm) { if( pcm == PillarConnectionMode::cross ||
(pcm == PillarConnectionMode::dynamic &&
pillar_dist > 2*cfg.base_radius_mm))
{
// If the columns are close together, no need to // If the columns are close together, no need to
// double bridge them // double bridge them
Vec3d bsj(ej(X), ej(Y), sj(Z)); Vec3d bsj(ej(X), ej(Y), sj(Z));

View File

@ -28,6 +28,12 @@ using SlicedSupports = std::vector<SliceLayer>;
namespace sla { namespace sla {
enum class PillarConnectionMode {
zigzag,
cross,
dynamic
};
struct SupportConfig { struct SupportConfig {
// Radius in mm of the pointing side of the head. // Radius in mm of the pointing side of the head.
double head_front_radius_mm = 0.2; double head_front_radius_mm = 0.2;
@ -46,6 +52,9 @@ struct SupportConfig {
// headless pillars will have half of this value. // headless pillars will have half of this value.
double headless_pillar_radius_mm = 0.4; double headless_pillar_radius_mm = 0.4;
// How to connect pillars
PillarConnectionMode pillar_connection_mode = PillarConnectionMode::dynamic;
// TODO: unimplemented at the moment. This coefficient will have an impact // TODO: unimplemented at the moment. This coefficient will have an impact
// when bridges and pillars are merged. The resulting pillar should be a bit // 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 // thicker than the ones merging into it. How much thicker? I don't know

View File

@ -407,6 +407,14 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) {
scfg.tilt = c.support_critical_angle.getFloat() * PI / 180.0 ; scfg.tilt = c.support_critical_angle.getFloat() * PI / 180.0 ;
scfg.max_bridge_length_mm = c.support_max_bridge_length.getFloat(); scfg.max_bridge_length_mm = c.support_max_bridge_length.getFloat();
scfg.headless_pillar_radius_mm = 0.375*c.support_pillar_diameter.getFloat(); scfg.headless_pillar_radius_mm = 0.375*c.support_pillar_diameter.getFloat();
switch(c.support_pillar_connection_mode.getInt()) {
case slapcmZigZag:
scfg.pillar_connection_mode = sla::PillarConnectionMode::zigzag; break;
case slapcmCross:
scfg.pillar_connection_mode = sla::PillarConnectionMode::cross; break;
case slapcmDynamic:
scfg.pillar_connection_mode = sla::PillarConnectionMode::dynamic; break;
}
scfg.pillar_widening_factor = c.support_pillar_widening_factor.getFloat(); scfg.pillar_widening_factor = c.support_pillar_widening_factor.getFloat();
scfg.base_radius_mm = 0.5*c.support_base_diameter.getFloat(); scfg.base_radius_mm = 0.5*c.support_base_diameter.getFloat();
scfg.base_height_mm = c.support_base_height.getFloat(); scfg.base_height_mm = c.support_base_height.getFloat();
@ -1058,6 +1066,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|| opt_key == "support_head_penetration" || opt_key == "support_head_penetration"
|| opt_key == "support_head_width" || opt_key == "support_head_width"
|| opt_key == "support_pillar_diameter" || opt_key == "support_pillar_diameter"
|| opt_key == "support_pillar_connection_mode"
|| opt_key == "support_base_diameter" || opt_key == "support_base_diameter"
|| opt_key == "support_base_height" || opt_key == "support_base_height"
|| opt_key == "support_critical_angle" || opt_key == "support_critical_angle"

View File

@ -718,6 +718,8 @@ boost::any& Choice::get_value()
m_value = static_cast<PrintHostType>(ret_enum); m_value = static_cast<PrintHostType>(ret_enum);
else if (m_opt_id.compare("display_orientation") == 0) else if (m_opt_id.compare("display_orientation") == 0)
m_value = static_cast<SLADisplayOrientation>(ret_enum); m_value = static_cast<SLADisplayOrientation>(ret_enum);
else if (m_opt_id.compare("support_pillar_connection_mode") == 0)
m_value = static_cast<SLAPillarConnectionMode>(ret_enum);
} }
else if (m_opt.gui_type == "f_enum_open") { else if (m_opt.gui_type == "f_enum_open") {
const int ret_enum = static_cast<wxComboBox*>(window)->GetSelection(); const int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();

View File

@ -200,6 +200,8 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value)));
else if (opt_key.compare("display_orientation") == 0) else if (opt_key.compare("display_orientation") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SLADisplayOrientation>(boost::any_cast<SLADisplayOrientation>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<SLADisplayOrientation>(boost::any_cast<SLADisplayOrientation>(value)));
else if(opt_key.compare("support_pillar_connection_mode") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SLAPillarConnectionMode>(boost::any_cast<SLAPillarConnectionMode>(value)));
} }
break; break;
case coPoints:{ case coPoints:{

View File

@ -557,6 +557,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
else if (opt_key.compare("display_orientation") == 0) { else if (opt_key.compare("display_orientation") == 0) {
ret = static_cast<int>(config.option<ConfigOptionEnum<SLADisplayOrientation>>(opt_key)->value); ret = static_cast<int>(config.option<ConfigOptionEnum<SLADisplayOrientation>>(opt_key)->value);
} }
else if (opt_key.compare("support_pillar_connection_mode") == 0) {
ret = static_cast<int>(config.option<ConfigOptionEnum<SLAPillarConnectionMode>>(opt_key)->value);
}
} }
break; break;
case coPoints: case coPoints:

View File

@ -410,6 +410,7 @@ const std::vector<std::string>& Preset::sla_print_options()
"support_head_penetration", "support_head_penetration",
"support_head_width", "support_head_width",
"support_pillar_diameter", "support_pillar_diameter",
"support_pillar_connection_mode",
"support_pillar_widening_factor", "support_pillar_widening_factor",
"support_base_diameter", "support_base_diameter",
"support_base_height", "support_base_height",

View File

@ -3153,6 +3153,7 @@ void TabSLAPrint::build()
optgroup = page->new_optgroup(_(L("Support pillar"))); optgroup = page->new_optgroup(_(L("Support pillar")));
optgroup->append_single_option_line("support_pillar_diameter"); optgroup->append_single_option_line("support_pillar_diameter");
optgroup->append_single_option_line("support_pillar_connection_mode");
optgroup->append_single_option_line("support_pillar_widening_factor"); optgroup->append_single_option_line("support_pillar_widening_factor");
optgroup->append_single_option_line("support_base_diameter"); optgroup->append_single_option_line("support_base_diameter");
optgroup->append_single_option_line("support_base_height"); optgroup->append_single_option_line("support_base_height");