Added additional checkbox to enable zero elevation

This commit is contained in:
tamasmeszaros 2019-08-06 16:51:32 +02:00
parent b43f7c3880
commit 3c09473f2a
5 changed files with 2626 additions and 2568 deletions

View File

@ -2676,14 +2676,14 @@ void PrintConfigDef::init_sla_params()
def->set_default_value(new ConfigOptionFloat(50.0)); def->set_default_value(new ConfigOptionFloat(50.0));
// This is disabled on the UI. I hope it will never be enabled. // This is disabled on the UI. I hope it will never be enabled.
def = this->add("pad_edge_radius", coFloat); // def = this->add("pad_edge_radius", coFloat);
def->label = L("Pad edge radius"); // def->label = L("Pad edge radius");
def->category = L("Pad"); // def->category = L("Pad");
// def->tooltip = L(""); //// def->tooltip = L("");
def->sidetext = L("mm"); // def->sidetext = L("mm");
def->min = 0; // def->min = 0;
def->mode = comAdvanced; // def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(1.0)); // def->set_default_value(new ConfigOptionFloat(1.0));
def = this->add("pad_wall_slope", coFloat); def = this->add("pad_wall_slope", coFloat);
def->label = L("Pad wall slope"); def->label = L("Pad wall slope");
@ -2696,6 +2696,13 @@ void PrintConfigDef::init_sla_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(45.0)); def->set_default_value(new ConfigOptionFloat(45.0));
def = this->add("pad_zero_elevation", coBool);
def->label = L("Pad around object");
def->category = L("Pad");
def->tooltip = L("Create pad around object and ignore the support elevation");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("pad_object_gap", coFloat); def = this->add("pad_object_gap", coFloat);
def->label = L("Pad object gap"); def->label = L("Pad object gap");
def->category = L("Pad"); def->category = L("Pad");

View File

@ -1028,7 +1028,7 @@ public:
ConfigOptionFloat pad_max_merge_distance /*= 50*/; ConfigOptionFloat pad_max_merge_distance /*= 50*/;
// The smoothing radius of the pad edges // The smoothing radius of the pad edges
ConfigOptionFloat pad_edge_radius /*= 1*/; // ConfigOptionFloat pad_edge_radius /*= 1*/;
// The slope of the pad wall... // The slope of the pad wall...
ConfigOptionFloat pad_wall_slope; ConfigOptionFloat pad_wall_slope;
@ -1041,6 +1041,9 @@ public:
// - The two pads will be connected with tiny connector sticks // - The two pads will be connected with tiny connector sticks
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
// Disable the elevation (ignore its value) and use the zero elevation mode
ConfigOptionBool pad_zero_elevation;
// This is the gap between the object bottom and the generated pad // This is the gap between the object bottom and the generated pad
ConfigOptionFloat pad_object_gap; ConfigOptionFloat pad_object_gap;
@ -1080,8 +1083,9 @@ protected:
OPT_PTR(pad_wall_thickness); OPT_PTR(pad_wall_thickness);
OPT_PTR(pad_wall_height); OPT_PTR(pad_wall_height);
OPT_PTR(pad_max_merge_distance); OPT_PTR(pad_max_merge_distance);
OPT_PTR(pad_edge_radius); // OPT_PTR(pad_edge_radius);
OPT_PTR(pad_wall_slope); OPT_PTR(pad_wall_slope);
OPT_PTR(pad_zero_elevation);
OPT_PTR(pad_object_gap); OPT_PTR(pad_object_gap);
OPT_PTR(pad_object_connector_stride); OPT_PTR(pad_object_connector_stride);
OPT_PTR(pad_object_connector_width); OPT_PTR(pad_object_connector_width);

View File

@ -569,6 +569,16 @@ std::string SLAPrint::output_filename(const std::string &filename_base) const
} }
namespace { namespace {
bool is_zero_elevation(const SLAPrintObjectConfig &c) {
bool en_implicit = c.support_object_elevation.getFloat() <= EPSILON &&
c.pad_enable.getBool() && c.supports_enable.getBool();
bool en_explicit = c.pad_zero_elevation.getBool() &&
c.supports_enable.getBool();
return en_implicit || en_explicit;
}
// Compile the argument for support creation from the static print config. // Compile the argument for support creation from the static print config.
sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) { sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) {
sla::SupportConfig scfg; sla::SupportConfig scfg;
@ -577,7 +587,8 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) {
scfg.head_back_radius_mm = 0.5*c.support_pillar_diameter.getFloat(); scfg.head_back_radius_mm = 0.5*c.support_pillar_diameter.getFloat();
scfg.head_penetration_mm = c.support_head_penetration.getFloat(); scfg.head_penetration_mm = c.support_head_penetration.getFloat();
scfg.head_width_mm = c.support_head_width.getFloat(); scfg.head_width_mm = c.support_head_width.getFloat();
scfg.object_elevation_mm = c.support_object_elevation.getFloat(); scfg.object_elevation_mm = is_zero_elevation(c) ?
0. : c.support_object_elevation.getFloat();
scfg.bridge_slope = c.support_critical_angle.getFloat() * PI / 180.0 ; scfg.bridge_slope = 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.max_pillar_link_distance_mm = c.support_max_pillar_link_distance.getFloat(); scfg.max_pillar_link_distance_mm = c.support_max_pillar_link_distance.getFloat();
@ -603,8 +614,7 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) {
sla::PoolConfig::EmbedObject builtin_pad_cfg(const SLAPrintObjectConfig& c) { sla::PoolConfig::EmbedObject builtin_pad_cfg(const SLAPrintObjectConfig& c) {
sla::PoolConfig::EmbedObject ret; sla::PoolConfig::EmbedObject ret;
ret.enabled = c.support_object_elevation.getFloat() <= EPSILON && ret.enabled = is_zero_elevation(c);
c.pad_enable.getBool() && c.supports_enable.getBool();
if(ret.enabled) { if(ret.enabled) {
ret.object_gap_mm = c.pad_object_gap.getFloat(); ret.object_gap_mm = c.pad_object_gap.getFloat();
@ -661,7 +671,9 @@ std::string SLAPrint::validate() const
double elv = cfg.object_elevation_mm; double elv = cfg.object_elevation_mm;
if(supports_en && elv > EPSILON && elv < pinhead_width ) if(supports_en && elv > EPSILON && elv < pinhead_width )
return L("Elevation is too low for object."); return L(
"Elevation is too low for object. Use the \"Pad around "
"obect\" feature to print the object without elevation.");
sla::PoolConfig::EmbedObject builtinpad = builtin_pad_cfg(po->config()); sla::PoolConfig::EmbedObject builtinpad = builtin_pad_cfg(po->config());
if(supports_en && builtinpad.enabled && if(supports_en && builtinpad.enabled &&
@ -879,7 +891,7 @@ void SLAPrint::process()
// If the zero elevation mode is engaged, we have to filter out all the // If the zero elevation mode is engaged, we have to filter out all the
// points that are on the bottom of the object // points that are on the bottom of the object
if (po.config().support_object_elevation.getFloat() <= EPSILON) { if (is_zero_elevation(po.config())) {
double gnd = po.m_supportdata->emesh.ground_level(); double gnd = po.m_supportdata->emesh.ground_level();
auto & pts = po.m_supportdata->support_points; auto & pts = po.m_supportdata->support_points;
double tolerance = po.config().pad_enable.getBool() double tolerance = po.config().pad_enable.getBool()
@ -1647,6 +1659,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|| opt_key == "pad_wall_thickness" || opt_key == "pad_wall_thickness"
|| opt_key == "supports_enable" || opt_key == "supports_enable"
|| opt_key == "support_object_elevation" || opt_key == "support_object_elevation"
|| opt_key == "pad_zero_elevation"
|| opt_key == "slice_closing_radius") { || opt_key == "slice_closing_radius") {
steps.emplace_back(slaposObjectSlice); steps.emplace_back(slaposObjectSlice);
} else if ( } else if (
@ -1719,7 +1732,10 @@ bool SLAPrintObject::invalidate_all_steps()
} }
double SLAPrintObject::get_elevation() const { double SLAPrintObject::get_elevation() const {
if (is_zero_elevation(m_config)) return 0.;
bool en = m_config.supports_enable.getBool(); bool en = m_config.supports_enable.getBool();
double ret = en ? m_config.support_object_elevation.getFloat() : 0.; double ret = en ? m_config.support_object_elevation.getFloat() : 0.;
if(m_config.pad_enable.getBool()) { if(m_config.pad_enable.getBool()) {
@ -1736,6 +1752,8 @@ double SLAPrintObject::get_elevation() const {
double SLAPrintObject::get_current_elevation() const double SLAPrintObject::get_current_elevation() const
{ {
if (is_zero_elevation(m_config)) return 0.;
bool has_supports = is_step_done(slaposSupportTree); bool has_supports = is_step_done(slaposSupportTree);
bool has_pad = is_step_done(slaposBasePool); bool has_pad = is_step_done(slaposBasePool);

View File

@ -477,9 +477,10 @@ const std::vector<std::string>& Preset::sla_print_options()
"pad_wall_thickness", "pad_wall_thickness",
"pad_wall_height", "pad_wall_height",
"pad_max_merge_distance", "pad_max_merge_distance",
"pad_edge_radius", // "pad_edge_radius",
"pad_wall_slope", "pad_wall_slope",
"pad_object_gap", "pad_object_gap",
"pad_zero_elevation",
"pad_object_connector_stride", "pad_object_connector_stride",
"pad_object_connector_width", "pad_object_connector_width",
"pad_object_connector_penetration", "pad_object_connector_penetration",

View File

@ -3691,6 +3691,7 @@ void TabSLAPrint::build()
// optgroup->append_single_option_line("pad_edge_radius"); // optgroup->append_single_option_line("pad_edge_radius");
optgroup->append_single_option_line("pad_wall_slope"); optgroup->append_single_option_line("pad_wall_slope");
optgroup->append_single_option_line("pad_zero_elevation");
optgroup->append_single_option_line("pad_object_gap"); optgroup->append_single_option_line("pad_object_gap");
optgroup->append_single_option_line("pad_object_connector_stride"); optgroup->append_single_option_line("pad_object_connector_stride");
optgroup->append_single_option_line("pad_object_connector_width"); optgroup->append_single_option_line("pad_object_connector_width");
@ -3740,6 +3741,32 @@ void TabSLAPrint::update()
m_update_cnt++; m_update_cnt++;
bool supports_en = m_config->opt_bool("supports_enable");
get_field("support_head_front_diameter")->toggle(supports_en);
get_field("support_head_penetration")->toggle(supports_en);
get_field("support_head_width")->toggle(supports_en);
get_field("support_pillar_diameter")->toggle(supports_en);
get_field("support_pillar_connection_mode")->toggle(supports_en);
get_field("support_buildplate_only")->toggle(supports_en);
get_field("support_base_diameter")->toggle(supports_en);
get_field("support_base_height")->toggle(supports_en);
get_field("support_base_safety_distance")->toggle(supports_en);
get_field("support_critical_angle")->toggle(supports_en);
get_field("support_max_bridge_length")->toggle(supports_en);
get_field("support_max_pillar_link_distance")->toggle(supports_en);
get_field("support_points_density_relative")->toggle(supports_en);
get_field("support_points_minimal_distance")->toggle(supports_en);
bool pad_en = m_config->opt_bool("pad_enable");
get_field("pad_wall_thickness")->toggle(pad_en);
get_field("pad_wall_height")->toggle(pad_en);
get_field("pad_max_merge_distance")->toggle(pad_en);
// get_field("pad_edge_radius")->toggle(supports_en);
get_field("pad_wall_slope")->toggle(pad_en);
get_field("pad_zero_elevation")->toggle(pad_en);
double head_penetration = m_config->opt_float("support_head_penetration"); double head_penetration = m_config->opt_float("support_head_penetration");
double head_width = m_config->opt_float("support_head_width"); double head_width = m_config->opt_float("support_head_width");
if (head_penetration > head_width) { if (head_penetration > head_width) {
@ -3780,13 +3807,14 @@ void TabSLAPrint::update()
load_config(new_conf); load_config(new_conf);
} }
// if(m_config->opt_float("support_object_elevation") < EPSILON && bool has_suppad = pad_en && supports_en;
// m_config->opt_bool("pad_enable")) { bool zero_elev = m_config->opt_bool("pad_zero_elevation") && has_suppad;
// // TODO: disable editding of:
// // pad_object_connector_stride get_field("support_object_elevation")->toggle(supports_en && !zero_elev);
// // pad_object_connector_width get_field("pad_object_gap")->toggle(zero_elev);
// // pad_object_connector_penetration get_field("pad_object_connector_stride")->toggle(zero_elev);
// } get_field("pad_object_connector_width")->toggle(zero_elev);
get_field("pad_object_connector_penetration")->toggle(zero_elev);
m_update_cnt--; m_update_cnt--;