Skip to content

Commit

Permalink
Port overhang extra perimeters from PrusaSlicer (#1939)
Browse files Browse the repository at this point in the history
* Port overhang extra perimeters from PrusaSlicer

* Reduce duplicated code

* Add credits

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
Co-authored-by: PavelMikus <pavel.mikus.mail@seznam.cz>
  • Loading branch information
3 people committed Aug 28, 2023
1 parent 6710d18 commit b9ca1c8
Show file tree
Hide file tree
Showing 10 changed files with 475 additions and 4 deletions.
457 changes: 457 additions & 0 deletions src/libslic3r/PerimeterGenerator.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/libslic3r/PerimeterGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class PerimeterGenerator {
private:
std::map<int, Polygons> generate_lower_polygons_series(float width);
void split_top_surfaces(const ExPolygons &orig_polygons, ExPolygons &top_fills, ExPolygons &non_top_polygons, ExPolygons &fill_clip) const;
void apply_extra_perimeters();

private:
bool m_spiral_vase;
Expand Down
3 changes: 3 additions & 0 deletions src/libslic3r/Polyline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ class Polyline : public MultiPoint {
void append(const Polyline& src);
void append(Polyline&& src);

Point& operator[](Points::size_type idx) { return this->points[idx]; }
const Point& operator[](Points::size_type idx) const { return this->points[idx]; }

const Point& last_point() const override { return this->points.back(); }
const Point& leftmost_point() const;
Lines lines() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ bool Preset::has_cali_lines(PresetBundle* preset_bundle)
static std::vector<std::string> s_Preset_print_options {
"layer_height", "initial_layer_print_height", "wall_loops", "slice_closing_radius", "spiral_mode", "slicing_mode",
"top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness",
"ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall",
"extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall",
"seam_position", "staggered_inner_seams", "wall_infill_order", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern",
"infill_direction",
"minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern",
Expand Down
7 changes: 7 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,13 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Use only one wall on first layer, to give more space to the bottom infill pattern");
def->set_default_value(new ConfigOptionBool(false));

def = this->add("extra_perimeters_on_overhangs", coBool);
def->label = L("Extra perimeters on overhangs");
def->category = L("Quality");
def->tooltip = L("Create additional perimeter paths over steep overhangs and areas where bridges cannot be anchored. ");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));

def = this->add("overhang_speed_classic", coBool);
def->label = L("Classic mode");
def->category = L("Speed");
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloatOrPercent, infill_anchor_max))

// Orca
((ConfigOptionBool, make_overhang_printable))
((ConfigOptionBool, make_overhang_printable))
((ConfigOptionBool, extra_perimeters_on_overhangs))
)

PRINT_CONFIG_CLASS_DEFINE(
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ bool PrintObject::invalidate_state_by_config_options(
opt_key == "wall_loops"
|| opt_key == "only_one_wall_top"
|| opt_key == "only_one_wall_first_layer"
|| opt_key == "extra_perimeters_on_overhangs"
|| opt_key == "initial_layer_line_width"
|| opt_key == "inner_wall_line_width"
|| opt_key == "infill_wall_overlap"
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/SupportMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ namespace SupportMaterialInternal {
// remove the entire bridges and only support the unsupported edges
//FIXME the brided regions are already collected as layerm.bridged. Use it?
for (const Surface &surface : layerm.fill_surfaces.surfaces)
if (surface.surface_type == stBottomBridge && surface.bridge_angle != -1)
if (surface.surface_type == stBottomBridge && surface.bridge_angle >= 0.0)
polygons_append(bridges, surface.expolygon);
//FIXME add the gap filled areas. Extrude the gaps with a bridge flow?
// Remove the unsupported ends of the bridges from the bridged areas.
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/ConfigManipulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
auto gcflavor = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;

bool have_perimeters = config->opt_int("wall_loops") > 0;
for (auto el : { "ensure_vertical_shell_thickness", "detect_thin_wall", "detect_overhang_wall",
for (auto el : { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "detect_thin_wall", "detect_overhang_wall",
"seam_position", "staggered_inner_seams", "wall_infill_order", "outer_wall_line_width",
"inner_wall_speed", "outer_wall_speed", "small_perimeter_speed", "small_perimeter_threshold" })
toggle_field(el, have_perimeters);
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,7 @@ void TabPrint::build()
optgroup->append_single_option_line("make_overhang_printable_hole_size");
optgroup->append_single_option_line("reduce_crossing_wall");
optgroup->append_single_option_line("max_travel_detour_distance");
optgroup->append_single_option_line("extra_perimeters_on_overhangs");

page = add_options_page(L("Strength"), "empty");
optgroup = page->new_optgroup(L("Walls"), L"param_wall");
Expand Down

0 comments on commit b9ca1c8

Please sign in to comment.