Skip to content

Commit

Permalink
seam notch ease of use fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Feb 21, 2024
2 parents 9380f7e + 627c2e0 commit e95393a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
15 changes: 11 additions & 4 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4111,9 +4111,11 @@ void GCode::seam_notch(const ExtrusionLoop& original_loop,
bool is_convex = false;
if (is_hole_loop) {
//test if convex (as it's clockwise bc it's a hole, we have to do the opposite)
is_convex = polygon_to_test.convex_points().empty();
// 3.07 instead of PI to allow for some convex outliers (sometimes, stl can be a bit imprecise)
is_convex = polygon_to_test.convex_points(3.07).empty();
} else {
is_convex = polygon_to_test.concave_points().empty();
// 3.3 instead of PI to allow for some concave outliers (sometimes, stl can be a bit imprecise)
is_convex = polygon_to_test.concave_points(3.3).empty();
}
if (is_convex) {
// Computing circle center
Expand Down Expand Up @@ -4196,19 +4198,24 @@ void GCode::seam_notch(const ExtrusionLoop& original_loop,

//check if the current angle isn't too sharp
double check_angle = 0;
// get min angle (and if at min or max value, push it a bit more to avoid not filtering outliers)
double min_angle = this->m_config.seam_notch_angle.value;
if(min_angle <= 179.9) min_angle -= 1;
if(min_angle >= 359.9) min_angle += 1;
min_angle *= PI / 180.;
if (end_point.distance_to_square(start_point) < SCALED_EPSILON * SCALED_EPSILON) {
check_angle = start_point.ccw_angle(prev_point, next_point);
} else {
check_angle = end_point.ccw_angle(prev_point, start_point);
if ((is_hole_loop ? -check_angle : check_angle) > this->m_config.seam_notch_angle.value * PI / 180.) {
if ((is_hole_loop ? -check_angle : check_angle) > min_angle) {
BOOST_LOG_TRIVIAL(debug) << "notch abord: too big angle\n";
return;
}
check_angle = start_point.ccw_angle(end_point, next_point);
}
assert(end_point != start_point);
assert(end_point != next_point);
if ((is_hole_loop ? -check_angle : check_angle) > this->m_config.seam_notch_angle.value * PI / 180.) {
if ((is_hole_loop ? -check_angle : check_angle) > min_angle) {
BOOST_LOG_TRIVIAL(debug) << "notch abord: too big angle\n";
return;
}
Expand Down
7 changes: 4 additions & 3 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1889,7 +1889,7 @@ void PrintConfigDef::init_fff_params()
"\nA value that only takes values as 'true' or 'false' will be a boolean)"
"\nEvery other value will be parsed as a string as-is."
"\nThese variables will be available as an array in the custom gcode (one item per extruder), don't forget to use them with the {current_extruder} index to get the current value."
" If a filament has a typo on the variable that change its type, then the parser will convert evrything to strings."
" If a filament has a typo on the variable that change its type, then the parser will convert everything to strings."
"\nAdvice: before using a variable, it's safer to use the function 'default_XXX(variable_name, default_value)'"
" (enclosed in bracket as it's a script) in case it's not set. You can replace XXX by 'int' 'bool' 'double' 'string'.");
def->multiline = true;
Expand Down Expand Up @@ -4708,9 +4708,10 @@ void PrintConfigDef::init_fff_params()
def->label = L("max angle");
def->full_label = L("Seam notch maximum angle");
def->category = OptionCategory::perimeter;
def->tooltip = L("If the (external) angle at the seam is higher than this value, then no notch will be set. If the angle is too high, there isn't enough room for the notch.");
def->tooltip = L("If the (external) angle at the seam is higher than this value, then no notch will be set. If the angle is too high, there isn't enough room for the notch."
"\nCan't be lower than 180° or it filters everything. At 360, it allows everything.");
def->sidetext = L("°");
def->min = 0;
def->min = 180;
def->max = 360;
def->mode = comExpert | comSuSi;
def->set_default_value(new ConfigOptionFloat(250));
Expand Down

0 comments on commit e95393a

Please sign in to comment.