#423 brim fix when no extrusions

also a warning message when offset is >= to width
This commit is contained in:
supermerill 2020-08-25 15:07:41 +02:00
parent d02921195f
commit 63b5018002
3 changed files with 21 additions and 1 deletions

View File

@ -2112,6 +2112,11 @@ void Print::_extrude_brim_from_tree(std::vector<std::vector< BrimLoop>>& loops,
};
extrude_ptr = &extrude;
if (loops.empty()) {
BOOST_LOG_TRIVIAL(error) << "Failed to extrude brim: no loops to extrude, are you sure your settings are ok?";
return;
}
//launch extrude
for (BrimLoop& loop : loops[0]) {
extrude(loop, &out);

View File

@ -368,7 +368,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("brim_offset", coFloat);
def->label = L("brim offset");
def->category = OptionCategory::skirtBrim;
def->tooltip = L("Distance between the brim and the part. Should be kept at 0 unless you encounter great difficulties to separate them. It's substracted to brim_width and brim_width_interior., so it has to be lower than them");
def->tooltip = L("Distance between the brim and the part. Should be kept at 0 unless you encounter great difficulties to separate them. It's subtracted to brim_width and brim_width_interior., so it has to be lower than them");
def->sidetext = L("mm");
def->min = 0;
def->mode = comExpert;

View File

@ -208,6 +208,21 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
}
}
if (config->opt_float("brim_width") > 0 && config->opt_float("brim_offset") >= config->opt_float("brim_width")) {
wxString msg_text = _(L("It's not possible to use a bigger value for the brim offset than the brim width, as it won't extrude anything."
" Brim offset have to be lower than the brim width."));
if (is_global_config)
msg_text += "\n\n" + _(L("Shall I switch the brim offset to 0?"));
wxMessageDialog dialog(nullptr, msg_text, _(L("Brim configuration")),
wxICON_WARNING | (is_global_config ? wxYES | wxNO : wxOK));
auto answer = dialog.ShowModal();
if (!is_global_config || answer == wxID_YES) {
DynamicPrintConfig new_conf = *config;
new_conf.set_key_value("brim_offset", new ConfigOptionFloat(0));
apply(config, &new_conf);
}
}
static bool support_material_overhangs_queried = false;
if (config->opt_bool("support_material")) {