From 384b9987f9efeb85914ed8bdf46b5d66f7dd97f9 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 18 Jan 2024 14:43:54 +0100 Subject: [PATCH] Closing-op. could leave artifacts in raft; prevent this by opening-op. Do an opening operation with the line-width to get rid of too-small islands in the raft. done to finish up CURA-11395 --- src/raft.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/raft.cpp b/src/raft.cpp index 2115996110..cce6d77053 100644 --- a/src/raft.cpp +++ b/src/raft.cpp @@ -57,7 +57,7 @@ void Raft::generate(SliceDataStorage& storage) storage.raftInterfaceOutline = storage.raftInterfaceOutline.unionPolygons(ooze_shield_raft); } - const auto remove_inside_corners = [](Polygons& outline, bool remove_inside_corners, coord_t smoothing) + const auto remove_inside_corners = [](Polygons& outline, bool remove_inside_corners, coord_t smoothing, coord_t line_width) { if (remove_inside_corners) { @@ -106,12 +106,17 @@ void Raft::generate(SliceDataStorage& storage) } else { + // Closing operation for smoothing: outline = outline.offset(smoothing, ClipperLib::jtRound).offset(-smoothing, ClipperLib::jtRound); + + // Opening operation to get rid of articfacts created by the closing operation: + outline = outline.offset(-(line_width + 5), ClipperLib::jtRound).offset(line_width, ClipperLib::jtRound); } }; - remove_inside_corners(storage.raftBaseOutline, settings.get("raft_base_remove_inside_corners"), settings.get("raft_base_smoothing")); - remove_inside_corners(storage.raftInterfaceOutline, settings.get("raft_interface_remove_inside_corners"), settings.get("raft_interface_smoothing")); - remove_inside_corners(storage.raftSurfaceOutline, settings.get("raft_surface_remove_inside_corners"), settings.get("raft_surface_smoothing")); + const auto nominal_raft_line_width = settings.get("skirt_brim_line_width"); + remove_inside_corners(storage.raftBaseOutline, settings.get("raft_base_remove_inside_corners"), settings.get("raft_base_smoothing"), nominal_raft_line_width); + remove_inside_corners(storage.raftInterfaceOutline, settings.get("raft_interface_remove_inside_corners"), settings.get("raft_interface_smoothing"), nominal_raft_line_width); + remove_inside_corners(storage.raftSurfaceOutline, settings.get("raft_surface_remove_inside_corners"), settings.get("raft_surface_smoothing"), nominal_raft_line_width); if (storage.primeTower.enabled_ && ! storage.primeTower.would_have_actual_tower_) {