Fine tuning parameters and fixing pad wings when greater gaps are used.

This commit is contained in:
tamasmeszaros 2019-06-12 13:15:42 +02:00
parent c80aae1bdb
commit 12396c3051
8 changed files with 64 additions and 33 deletions

View File

@ -2502,7 +2502,7 @@ void PrintConfigDef::init_sla_params()
def->min = 0;
def->max = 10;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.5));
def->set_default_value(new ConfigOptionFloat(1));
def = this->add("support_critical_angle", coFloat);
def->label = L("Critical angle");
@ -2625,6 +2625,17 @@ void PrintConfigDef::init_sla_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(45.0));
def = this->add("pad_object_gap", coFloat);
def->label = L("Pad object gap");
def->category = L("Pad");
def->tooltip = L("The gap between the object bottom and the generated "
"pad in zero elevation mode.");
def->sidetext = L("mm");
def->min = 0;
def->max = 10;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(1));
def = this->add("pad_object_connector_stride", coFloat);
def->label = L("Pad object connector stride");
def->category = L("Pad");
@ -2643,7 +2654,7 @@ void PrintConfigDef::init_sla_params()
def->sidetext = L("mm");
def->min = 0;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.3));
def->set_default_value(new ConfigOptionFloat(0.5));
def = this->add("pad_object_connector_penetration", coFloat);
def->label = L("Pad object connector penetration");

View File

@ -1033,6 +1033,9 @@ public:
// - The two pads will be connected with tiny connector sticks
// /////////////////////////////////////////////////////////////////////////
// This is the gap between the object bottom and the generated pad
ConfigOptionFloat pad_object_gap;
// How far to place the connector sticks on the object pad perimeter
ConfigOptionFloat pad_object_connector_stride;
@ -1071,6 +1074,7 @@ protected:
OPT_PTR(pad_max_merge_distance);
OPT_PTR(pad_edge_radius);
OPT_PTR(pad_wall_slope);
OPT_PTR(pad_object_gap);
OPT_PTR(pad_object_connector_stride);
OPT_PTR(pad_object_connector_width);
OPT_PTR(pad_object_connector_penetration);

View File

@ -383,18 +383,12 @@ Polygons unify(const Polygons& shapes) {
// inserted along the perimeter in every "stride" distance. The stick rectangles
// will have a with about "stick_width". The input dimensions are in world
// measure, not the scaled clipper units.
void offset_with_breakstick_holes(ExPolygon& poly,
double padding,
double stride,
double stick_width,
double penetration)
{
// We do the basic offsetting first
static const bool dont_round_edges = false;
if(padding > 0.0)
offset(poly, coord_t(padding / SCALING_FACTOR), dont_round_edges);
void breakstick_holes(ExPolygon& poly,
double padding,
double stride,
double stick_width,
double penetration)
{
// SVG svg("bridgestick_plate.svg");
// svg.draw(poly);
@ -428,8 +422,8 @@ void offset_with_breakstick_holes(ExPolygon& poly,
out.emplace_back(a);
// dodge the start point, do not make sticks on the joins
while (t < sright) t += sright;
double tend = nrm - sright;
while (t < sbottom) t += sbottom;
double tend = nrm - sbottom;
while (t < tend) { // insert the stick on the polygon perimeter

View File

@ -30,11 +30,11 @@ void base_plate(const TriangleMesh& mesh, // input mesh
// inserted along the perimeter in every "stride" distance. The stick rectangles
// will have a with about "stick_width". The input dimensions are in world
// measure, not the scaled clipper units.
void offset_with_breakstick_holes(ExPolygon& poly,
double padding,
double stride,
double stick_width,
double penetration = 0.0);
void breakstick_holes(ExPolygon &poly,
double padding,
double stride,
double stick_width,
double penetration = 0.0);
struct PoolConfig {
double min_wall_thickness_mm = 2;

View File

@ -578,23 +578,31 @@ struct Pad {
float(cfg.min_wall_height_mm + cfg.min_wall_thickness_mm),
0.1f, pcfg.throw_on_cancel);
// We don't need the holes for the base plate from the supports
for (const ExPolygon &bp : platetmp) basep.emplace_back(bp.contour);
for (const ExPolygon &bp : modelbase) basep.emplace_back(bp.contour);
if(pcfg.embed_object) {
auto modelbase_sticks = modelbase;
for(auto& poly : modelbase_sticks)
sla::offset_with_breakstick_holes(
if (pcfg.embed_object.object_gap_mm > 0.0)
modelbase_sticks
= offset_ex(modelbase_sticks,
coord_t(pcfg.embed_object.object_gap_mm
/ SCALING_FACTOR));
for(auto& poly : modelbase_sticks) {
basep.emplace_back(poly);
sla::breakstick_holes(
poly,
pcfg.embed_object.object_gap_mm, // padding
pcfg.embed_object.stick_stride_mm,
pcfg.embed_object.stick_width_mm,
pcfg.embed_object.stick_penetration_mm);
}
create_base_pool(basep, tmesh, modelbase_sticks, cfg);
} else {
for (const ExPolygon &bp : modelbase) basep.emplace_back(bp.contour);
create_base_pool(basep, tmesh, {}, cfg);
}

View File

@ -602,17 +602,18 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) {
return scfg;
}
sla::PoolConfig::EmbedObject use_builtin_pad(const SLAPrintObjectConfig& c) {
sla::PoolConfig::EmbedObject builtin_pad_cfg(const SLAPrintObjectConfig& c) {
sla::PoolConfig::EmbedObject ret;
ret.enabled = c.support_object_elevation.getFloat() <= EPSILON &&
c.pad_enable.getBool();
if(ret.enabled) {
ret.object_gap_mm = c.support_base_safety_distance.getFloat();
ret.stick_width_mm = c.pad_object_connector_width.getFloat();
ret.stick_stride_mm = c.pad_object_connector_stride.getFloat();
ret.stick_width_mm = c.pad_object_connector_penetration.getFloat();
ret.object_gap_mm = c.pad_object_gap.getFloat();
ret.stick_width_mm = c.pad_object_connector_width.getFloat();
ret.stick_stride_mm = c.pad_object_connector_stride.getFloat();
ret.stick_penetration_mm = c.pad_object_connector_penetration
.getFloat();
}
return ret;
@ -631,7 +632,7 @@ sla::PoolConfig make_pool_config(const SLAPrintObjectConfig& c) {
pcfg.min_wall_height_mm = c.pad_wall_height.getFloat();
// set builtin pad implicitly ON
pcfg.embed_object = use_builtin_pad(c);
pcfg.embed_object = builtin_pad_cfg(c);
return pcfg;
}
@ -663,6 +664,16 @@ std::string SLAPrint::validate() const
if(supports_en && elv > EPSILON && elv < pinhead_width )
return L("Elevation is too low for object.");
sla::PoolConfig::EmbedObject builtinpad = builtin_pad_cfg(po->config());
if(supports_en && builtinpad.enabled &&
cfg.pillar_base_safety_distance_mm < builtinpad.object_gap_mm) {
return L(
"The endings of the support pillars will be deployed on the "
"gap between the object and the pad. 'Support base safety "
"distance' has to be greater than the 'Pad object gap' "
"parameter to avoid this.");
}
}
return "";
@ -861,7 +872,7 @@ void SLAPrint::process()
// If the builtin pad mode is engaged, we have to filter out all the
// points that are on the bottom of the object
if(use_builtin_pad(po.m_config)) {
if(builtin_pad_cfg(po.m_config)) {
double gnd = po.m_supportdata->emesh.ground_level();
auto & pts = po.m_supportdata->support_points;
@ -1658,6 +1669,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|| opt_key == "pad_max_merge_distance"
|| opt_key == "pad_wall_slope"
|| opt_key == "pad_edge_radius"
|| opt_key == "pad_object_gap"
|| opt_key == "pad_object_connector_stride"
|| opt_key == "pad_object_connector_width"
|| opt_key == "pad_object_connector_penetration"

View File

@ -475,6 +475,7 @@ const std::vector<std::string>& Preset::sla_print_options()
"pad_max_merge_distance",
"pad_edge_radius",
"pad_wall_slope",
"pad_object_gap",
"pad_object_connector_stride",
"pad_object_connector_width",
"pad_object_connector_penetration",

View File

@ -3503,6 +3503,7 @@ void TabSLAPrint::build()
// optgroup->append_single_option_line("pad_edge_radius");
optgroup->append_single_option_line("pad_wall_slope");
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_width");
optgroup->append_single_option_line("pad_object_connector_penetration");