Disabling pad edge radius and adding the "wall tilt" parameter.

This commit is contained in:
tamasmeszaros 2019-02-25 12:06:38 +01:00
parent 3aee6ddc4c
commit 01c9b13ade
7 changed files with 45 additions and 15 deletions

View file

@ -2730,6 +2730,17 @@ void PrintConfigDef::init_sla_params()
def->cli = "";
def->min = 0;
def->default_value = new ConfigOptionFloat(1.0);
def = this->add("pad_wall_tilt", coFloat);
def->label = L("Pad wall tilt");
def->category = L("Pad");
def->tooltip = L("The tilt of the pad wall relative to the bed plane. "
"90 degrees means straight walls.");
def->sidetext = L("degrees");
def->cli = "";
def->min = 0.1; // What should be the minimum?
def->max = 90;
def->default_value = new ConfigOptionFloat(45.0);
}
void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value)

View file

@ -1028,6 +1028,9 @@ public:
// The smoothing radius of the pad edges
ConfigOptionFloat pad_edge_radius /*= 1*/;
// The tilt of the pad wall...
ConfigOptionFloat pad_wall_tilt;
protected:
void initialize(StaticCacheBase &cache, const char *base_ptr)
{
@ -1053,6 +1056,7 @@ protected:
OPT_PTR(pad_wall_height);
OPT_PTR(pad_max_merge_distance);
OPT_PTR(pad_edge_radius);
OPT_PTR(pad_wall_tilt);
}
};

View file

@ -601,7 +601,7 @@ void create_base_pool(const ExPolygons &ground_layer, TriangleMesh& out,
const double thickness = cfg.min_wall_thickness_mm;
const double wingheight = cfg.min_wall_height_mm;
const double fullheight = wingheight + thickness;
const double tilt = PI/4;
const double tilt = cfg.wall_tilt;
const double wingdist = wingheight / std::tan(tilt);
// scaled values
@ -627,15 +627,22 @@ void create_base_pool(const ExPolygons &ground_layer, TriangleMesh& out,
auto outer_base = concaveh;
outer_base.holes.clear();
offset(outer_base, s_safety_dist + s_wingdist + s_thickness);
auto inner_base = outer_base;
offset(inner_base, -(s_thickness + s_wingdist));
ExPolygon bottom_poly = outer_base;
bottom_poly.holes.clear();
if(s_wingdist > 0) offset(bottom_poly, -s_wingdist);
// Punching a hole in the top plate for the cavity
ExPolygon top_poly;
ExPolygon middle_base;
ExPolygon inner_base;
top_poly.contour = outer_base.contour;
if(wingheight > 0) {
inner_base = outer_base;
offset(inner_base, -(s_thickness + s_wingdist + s_eradius));
middle_base = outer_base;
offset(middle_base, -s_thickness);
top_poly.holes.emplace_back(middle_base.contour);
@ -682,10 +689,10 @@ void create_base_pool(const ExPolygons &ground_layer, TriangleMesh& out,
thrcl,
ob, wh));
// Now that we have the rounded edge connencting the top plate with
// Now that we have the rounded edge connecting the top plate with
// the outer side walls, we can generate and merge the sidewall geometry
pool.merge(walls(ob.contour, inner_base.contour, wh, -fullheight,
(s_thickness + s_wingdist) * SCALING_FACTOR, thrcl));
pool.merge(walls(ob.contour, bottom_poly.contour, wh, -fullheight,
wingdist, thrcl));
if(wingheight > 0) {
// Generate the smoothed edge geometry
@ -700,14 +707,14 @@ void create_base_pool(const ExPolygons &ground_layer, TriangleMesh& out,
// Next is the cavity walls connecting to the top plate's
// artificially created hole.
pool.merge(walls(inner_base.contour, ob.contour, -wingheight,
wh, -s_safety_dist * SCALING_FACTOR, thrcl));
wh, -wingdist, thrcl));
}
// Now we need to triangulate the top and bottom plates as well as the
// cavity bottom plate which is the same as the bottom plate but it is
// elevated by the thickness.
pool.merge(triangulate_expolygon_3d(top_poly));
pool.merge(triangulate_expolygon_3d(inner_base, -fullheight, true));
pool.merge(triangulate_expolygon_3d(bottom_poly, -fullheight, true));
if(wingheight > 0)
pool.merge(triangulate_expolygon_3d(inner_base, -wingheight));

View file

@ -3,6 +3,7 @@
#include <vector>
#include <functional>
#include <cmath>
namespace Slic3r {
@ -27,15 +28,17 @@ struct PoolConfig {
double min_wall_height_mm = 5;
double max_merge_distance_mm = 50;
double edge_radius_mm = 1;
double wall_tilt = std::atan(1.0); // Universal constant for Pi/4
ThrowOnCancel throw_on_cancel = [](){};
inline PoolConfig() {}
inline PoolConfig(double wt, double wh, double md, double er):
inline PoolConfig(double wt, double wh, double md, double er, double tilt):
min_wall_thickness_mm(wt),
min_wall_height_mm(wh),
max_merge_distance_mm(md),
edge_radius_mm(er) {}
edge_radius_mm(er),
wall_tilt(tilt) {}
};
/// Calculate the pool for the mesh for SLA printing

View file

@ -751,11 +751,13 @@ void SLAPrint::process()
double wt = po.m_config.pad_wall_thickness.getFloat();
double h = po.m_config.pad_wall_height.getFloat();
double md = po.m_config.pad_max_merge_distance.getFloat();
double er = po.m_config.pad_edge_radius.getFloat();
// Radius is disabled for now...
double er = 0; // po.m_config.pad_edge_radius.getFloat();
double tilt = po.m_config.pad_wall_tilt.getFloat() * PI / 180.0;
double lh = po.m_config.layer_height.getFloat();
double elevation = po.m_config.support_object_elevation.getFloat();
if(!po.m_config.supports_enable.getBool()) elevation = 0;
sla::PoolConfig pcfg(wt, h, md, er);
sla::PoolConfig pcfg(wt, h, md, er, tilt);
ExPolygons bp;
double pad_h = sla::get_pad_fullheight(pcfg);
@ -766,8 +768,7 @@ void SLAPrint::process()
if(elevation < pad_h) {
// we have to count with the model geometry for the base plate
sla::base_plate(trmesh, bp, float(pad_h), float(lh),
thrfn);
sla::base_plate(trmesh, bp, float(pad_h), float(lh), thrfn);
}
pcfg.throw_on_cancel = thrfn;
@ -1368,6 +1369,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|| opt_key == "pad_wall_thickness"
|| opt_key == "pad_wall_height"
|| opt_key == "pad_max_merge_distance"
|| opt_key == "pad_wall_tilt"
|| opt_key == "pad_edge_radius") {
steps.emplace_back(slaposBasePool);
} else {

View file

@ -465,6 +465,7 @@ const std::vector<std::string>& Preset::sla_print_options()
"pad_wall_height",
"pad_max_merge_distance",
"pad_edge_radius",
"pad_wall_tilt",
"output_filename_format",
"default_sla_print_profile",
"compatible_printers",

View file

@ -3288,7 +3288,9 @@ void TabSLAPrint::build()
optgroup->append_single_option_line("pad_wall_thickness");
optgroup->append_single_option_line("pad_wall_height");
optgroup->append_single_option_line("pad_max_merge_distance");
optgroup->append_single_option_line("pad_edge_radius");
// TODO: Disabling this parameter for the beta release
// optgroup->append_single_option_line("pad_edge_radius");
optgroup->append_single_option_line("pad_wall_tilt");
page = add_options_page(_(L("Output options")), "page_white_go.png");
optgroup = page->new_optgroup(_(L("Output file")));