#668, #932 : parameter for external infill margin

This commit is contained in:
supermerill 2018-06-27 13:52:22 +02:00
parent fdf8c71206
commit d21c33e9b5
9 changed files with 19 additions and 9 deletions

View File

@ -157,7 +157,7 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams &para
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"

View File

@ -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());

View File

@ -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");

View File

@ -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");

View File

@ -392,6 +392,7 @@ public:
ConfigOptionEnum<InfillPattern> top_fill_pattern;
ConfigOptionEnum<InfillPattern> 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);

View File

@ -192,6 +192,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|| opt_key == "bottom_solid_layers"
|| opt_key == "top_solid_layers"
|| opt_key == "solid_infill_below_area"
|| opt_key == "external_infill_margin"
|| opt_key == "infill_extruder"
|| opt_key == "solid_infill_extruder"
|| opt_key == "infill_extrusion_width"
@ -1874,7 +1875,7 @@ void PrintObject::discover_horizontal_shells()
// not work in some situations, as there won't be any grown region in the perimeter
// area (this was seen in a model where the top layer had one extra perimeter, thus
// its fill_surfaces were thinner than the lower layer's infill), however it's the best
// solution so far. Growing the external slices by EXTERNAL_INFILL_MARGIN will put
// solution so far. Growing the external slices by external_infill_margin will put
// too much solid infill inside nearly-vertical slopes.
// Surfaces including the area of perimeters. Everything, that is visible from the top / bottom

View File

@ -39,9 +39,6 @@ typedef double coordf_t;
// Maximum perimeter length for the loop to apply the small perimeter speed.
#define SMALL_PERIMETER_LENGTH (6.5 / SCALING_FACTOR) * 2 * PI
#define INSET_OVERLAP_TOLERANCE 0.4
// 3mm ring around the top / bottom / bridging areas.
//FIXME This is quite a lot.
#define EXTERNAL_INFILL_MARGIN 3.
//FIXME Better to use an inline function with an explicit return type.
//inline coord_t scale_(coordf_t v) { return coord_t(floor(v / SCALING_FACTOR + 0.5f)); }
#define scale_(val) ((val) / SCALING_FACTOR)

View File

@ -297,7 +297,7 @@ const std::vector<std::string>& 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"
};

View File

@ -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);