diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 7286c5cd8..cc644fc74 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -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) diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 1ea556773..21bc32ed9 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -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); } }; diff --git a/src/libslic3r/SLA/SLABasePool.cpp b/src/libslic3r/SLA/SLABasePool.cpp index 6f85c43dc..42b22acb9 100644 --- a/src/libslic3r/SLA/SLABasePool.cpp +++ b/src/libslic3r/SLA/SLABasePool.cpp @@ -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)); diff --git a/src/libslic3r/SLA/SLABasePool.hpp b/src/libslic3r/SLA/SLABasePool.hpp index 3917d995b..69b4561b1 100644 --- a/src/libslic3r/SLA/SLABasePool.hpp +++ b/src/libslic3r/SLA/SLABasePool.hpp @@ -3,6 +3,7 @@ #include #include +#include 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 diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 3a08cddf1..d83e756e8 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -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& 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", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 7e9a0c3a2..783527026 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -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")));