brim: setting to exclude holes.

#112
This commit is contained in:
supermerill 2019-11-02 00:32:37 +01:00
parent 5c46a60f33
commit 7802f276e4
6 changed files with 33 additions and 6 deletions

View File

@ -176,6 +176,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
steps.emplace_back(psSkirt);
} else if (
opt_key == "complete_objects"
|| opt_key == "brim_inside_holes"
|| opt_key == "brim_width"
|| opt_key == "brim_ears"
|| opt_key == "brim_ears_max_angle") {
@ -1783,12 +1784,18 @@ ExPolygons Print::_make_brim(const PrintObjectPtrs &objects, ExtrusionEntityColl
for (PrintObject *object : objects) {
ExPolygons object_islands;
for (ExPolygon &expoly : object->m_layers.front()->slices.expolygons)
object_islands.push_back(expoly);
if(config().brim_inside_holes || config().brim_width_interior > 0)
object_islands.push_back(expoly);
else
object_islands.emplace_back(to_expolygon(expoly.contour));
if (!object->support_layers().empty()) {
Polygons polys = object->support_layers().front()->support_fills.polygons_covered_by_spacing(float(SCALED_EPSILON));
for (Polygon poly : polys)
for (ExPolygon & expoly2 : union_ex(poly))
object_islands.emplace_back(expoly2);
if (config().brim_inside_holes || config().brim_width_interior > 0)
object_islands.emplace_back(expoly2);
else
object_islands.emplace_back(to_expolygon(expoly2.contour));
}
islands.reserve(islands.size() + object_islands.size() * object->m_copies.size());
for (const Point &pt : object->m_copies)
@ -1912,12 +1919,18 @@ ExPolygons Print::_make_brim_ears(const PrintObjectPtrs &objects, ExtrusionEntit
for (PrintObject *object : objects) {
ExPolygons object_islands;
for (ExPolygon &expoly : object->m_layers.front()->slices.expolygons)
object_islands.push_back(expoly);
if (config().brim_inside_holes || config().brim_width_interior > 0)
object_islands.push_back(expoly);
else
object_islands.emplace_back(to_expolygon(expoly.contour));
if (!object->support_layers().empty()) {
Polygons polys = object->support_layers().front()->support_fills.polygons_covered_by_spacing(float(SCALED_EPSILON));
for (Polygon poly : polys)
for (ExPolygon & expoly2 : union_ex(poly))
object_islands.push_back(expoly2);
if (config().brim_inside_holes || config().brim_width_interior > 0)
object_islands.push_back(expoly2);
else
object_islands.emplace_back(to_expolygon(expoly2.contour));
}
islands.reserve(islands.size() + object_islands.size() * object->m_copies.size());
for (const Point &copy_pt : object->m_copies)

View File

@ -239,6 +239,13 @@ void PrintConfigDef::init_fff_params()
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(60));
def = this->add("brim_inside_holes", coBool);
def->label = L("Brim inside holes");
def->full_label = L("Brim inside holes");
def->tooltip = L("Allow to create brim when over an island when this one is inside a hole.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("brim_width", coFloat);
def->label = L("Brim width");
@ -260,6 +267,7 @@ void PrintConfigDef::init_fff_params()
def->label = L(" ");
def->full_label = L("Brim ears");
def->tooltip = L("Only draw brim over the sharp edges of the model.");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("brim_ears_max_angle", coFloat);
@ -268,6 +276,7 @@ void PrintConfigDef::init_fff_params()
def->sidetext = L("°");
def->min = 0;
def->max = 180;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(125));
def = this->add("chamber_temperature", coInts);

View File

@ -950,6 +950,7 @@ public:
ConfigOptionInts bed_temperature;
ConfigOptionFloat bridge_acceleration;
ConfigOptionInts bridge_fan_speed;
ConfigOptionBool brim_inside_holes;
ConfigOptionFloat brim_width;
ConfigOptionFloat brim_width_interior;
ConfigOptionBool brim_ears;
@ -1027,6 +1028,7 @@ protected:
OPT_PTR(bed_temperature);
OPT_PTR(bridge_acceleration);
OPT_PTR(bridge_fan_speed);
OPT_PTR(brim_inside_holes);
OPT_PTR(brim_width);
OPT_PTR(brim_width_interior);
OPT_PTR(brim_ears);

View File

@ -295,11 +295,12 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
for (auto el : { "skirt_distance", "skirt_height" })
toggle_field(el, have_skirt);
bool have_brim = config->opt_float("brim_width") > 0;
bool have_brim = config->opt_float("brim_width") > 0 || config->opt_float("brim_width_interior") > 0;
// perimeter_extruder uses the same logic as in Print::extruders()
toggle_field("perimeter_extruder", have_perimeters || have_brim);
toggle_field("brim_ears", have_brim);
toggle_field("brim_ears", config->opt_float("brim_width") > 0);
toggle_field("brim_inside_holes", config->opt_float("brim_width") > 0 && config->opt_float("brim_width_interior") == 0);
toggle_field("brim_ears_max_angle", have_brim && config->opt_bool("brim_ears"));
bool have_raft = config->opt_int("raft_layers") > 0;

View File

@ -406,6 +406,7 @@ const std::vector<std::string>& Preset::print_options()
"travel_speed", "first_layer_speed", "perimeter_acceleration", "infill_acceleration",
"bridge_acceleration", "first_layer_acceleration", "default_acceleration", "skirts", "skirt_distance", "skirt_height",
"min_skirt_length",
"brim_inside_holes",
"brim_width",
"brim_width_interior",
"brim_ears",

View File

@ -1162,6 +1162,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(_(L("Brim")));
optgroup->append_single_option_line("brim_width");
optgroup->append_single_option_line("brim_inside_holes");
optgroup->append_single_option_line("brim_width_interior");
line = { _(L("Brim ears")), "" };
line.append_option(optgroup->get_option("brim_ears"));