diff --git a/xs/src/libslic3r/Fill/FillBase.cpp b/xs/src/libslic3r/Fill/FillBase.cpp index 604943914..f7db9cf72 100644 --- a/xs/src/libslic3r/Fill/FillBase.cpp +++ b/xs/src/libslic3r/Fill/FillBase.cpp @@ -157,7 +157,7 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶ double poylineVolume = 0; /// un-overlap the surface (it's done in perimeterGenerator, it just pass the surface polys a bit bigger to us, /// so we have to shrink it, it's silly, it should be here we should decide how to use the overlap setting!) - ExPolygons noOffsetPolys = offset2_ex(surface->expolygon, -scale_(this->overlap), 0); + ExPolygons noOffsetPolys = offset_ex(surface->expolygon, -scale_(this->overlap)); for (auto poly = noOffsetPolys.begin(); poly != noOffsetPolys.end(); ++poly){ poylineVolume += flow.height*unscale(unscale(poly->area())); // add external "perimeter gap" diff --git a/xs/src/libslic3r/Fill/FillSmooth.cpp b/xs/src/libslic3r/Fill/FillSmooth.cpp index ad359b2ee..345f0fa89 100644 --- a/xs/src/libslic3r/Fill/FillSmooth.cpp +++ b/xs/src/libslic3r/Fill/FillSmooth.cpp @@ -35,7 +35,7 @@ namespace Slic3r { //a small under-overlap to prevent over-extrudion on thin surfaces (i.e. remove the overlap) Surface surfaceNoOverlap(*surface); //remove the overlap (prevent over-extruding) if possible - ExPolygons noOffsetPolys = offset2_ex(surfaceNoOverlap.expolygon, -scale_(this->overlap) * (flow.bridge?0:1), 0); + ExPolygons noOffsetPolys = offset_ex(surfaceNoOverlap.expolygon, -scale_(this->overlap) * (flow.bridge?0:1)); //printf("FillSmooth::fill_surface() : overlap=%f->%f.\n", overlap, -scale_(this->overlap)); //printf("FillSmooth::polys : 1->%i.\n", noOffsetPolys.size()); //printf("FillSmooth::polys : %f %f->%f.\n", surface->expolygon.area(), surfaceNoOverlap.expolygon.area(), noOffsetPolys[0].area()); diff --git a/xs/src/libslic3r/LayerRegion.cpp b/xs/src/libslic3r/LayerRegion.cpp index 27ed4ee2d..9ffc0dda2 100644 --- a/xs/src/libslic3r/LayerRegion.cpp +++ b/xs/src/libslic3r/LayerRegion.cpp @@ -93,7 +93,7 @@ LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection* void LayerRegion::process_external_surfaces(const Layer* lower_layer) { const Surfaces &surfaces = this->fill_surfaces.surfaces; - const double margin = scale_(EXTERNAL_INFILL_MARGIN); + const double margin = scale_(this->region()->config.external_infill_margin.getFloat()); #ifdef SLIC3R_DEBUG_SLICE_PROCESSING export_region_fill_surfaces_to_svg_debug("3_process_external_surfaces-initial"); diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 3909a78ed..01f1a97bf 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -342,6 +342,15 @@ PrintConfigDef::PrintConfigDef() def->cli = "enforce-full-fill-volume!"; def->default_value = new ConfigOptionBool(true); + def = this->add("external_infill_margin", coFloat); + def->label = L("Anchor the top by X mm"); + def->category = L("Infill"); + def->tooltip = L("This parameter grow the top/bottom layers by some mm to anchor them into the part. Put 0 to deactivate it."); + def->sidetext = L("mm"); + def->cli = "top-layer-anchor=f"; + def->min = 0; + def->default_value = new ConfigOptionFloat(3); + def = this->add("external_perimeter_extrusion_width", coFloatOrPercent); def->label = L("External perimeters"); def->category = L("Extrusion Width"); diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index fb326400b..f69b806d3 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -392,6 +392,7 @@ public: ConfigOptionEnum top_fill_pattern; ConfigOptionEnum bottom_fill_pattern; ConfigOptionBool enforce_full_fill_volume; + ConfigOptionFloat external_infill_margin; ConfigOptionFloatOrPercent external_perimeter_extrusion_width; ConfigOptionFloatOrPercent external_perimeter_speed; ConfigOptionBool external_perimeters_first; @@ -434,6 +435,7 @@ protected: OPT_PTR(top_fill_pattern); OPT_PTR(bottom_fill_pattern); OPT_PTR(enforce_full_fill_volume); + OPT_PTR(external_infill_margin); OPT_PTR(external_perimeter_extrusion_width); OPT_PTR(external_perimeter_speed); OPT_PTR(external_perimeters_first); diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index c4bf255ba..938fff712 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -192,6 +192,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector& Preset::print_options() "ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width", "perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width", "top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "bridge_flow_ratio", - "over_bridge_flow_ratio", "clip_multipart_objects", "enforce_full_fill_volume", + "over_bridge_flow_ratio", "clip_multipart_objects", "enforce_full_fill_volume", "external_infill_margin", "elefant_foot_compensation", "xy_size_compensation", "threads", "resolution", "wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "only_one_perimeter_top", "compatible_printers", "compatible_printers_condition","inherits" }; diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp index 38b9f3b5f..0d9301e76 100644 --- a/xs/src/slic3r/GUI/Tab.cpp +++ b/xs/src/slic3r/GUI/Tab.cpp @@ -861,6 +861,7 @@ void TabPrint::build() optgroup->append_single_option_line("solid_infill_every_layers"); optgroup->append_single_option_line("fill_angle"); optgroup->append_single_option_line("solid_infill_below_area"); + optgroup->append_single_option_line("external_infill_margin"); optgroup->append_single_option_line("bridge_angle"); optgroup->append_single_option_line("only_retract_when_crossing_perimeters"); optgroup->append_single_option_line("infill_first"); @@ -1191,7 +1192,7 @@ void TabPrint::update() bool have_solid_infill = m_config->opt_int("top_solid_layers") > 0 || m_config->opt_int("bottom_solid_layers") > 0; // solid_infill_extruder uses the same logic as in Print::extruders() - for (auto el : {"top_fill_pattern", "bottom_fill_pattern", "enforce_full_fill_volume", "infill_first", + for (auto el : {"top_fill_pattern", "bottom_fill_pattern", "enforce_full_fill_volume", "external_infill_margin", "infill_first", "solid_infill_extruder", "solid_infill_extrusion_width", "solid_infill_speed" }) get_field(el)->toggle(have_solid_infill);