From c5fbfae0957315068ee3fb267642a34868ca57e1 Mon Sep 17 00:00:00 2001 From: supermerill Date: Thu, 9 Jan 2020 13:47:39 +0100 Subject: [PATCH] remove layer_height_adaptive, because prusa has created a new one. bugfix "move inwards before travel" when extruding perimeter clockwise bugfix too thin overhang detection bugfix basic ini (duplicate key) --- resources/profiles/Basic.ini | 1 - src/libslic3r/ExtrusionEntity.hpp | 11 +++++++---- src/libslic3r/GCode.cpp | 21 ++++++++++++--------- src/libslic3r/PerimeterGenerator.cpp | 18 +++++++++++------- src/libslic3r/PrintConfig.cpp | 9 --------- src/libslic3r/PrintObject.cpp | 3 --- 6 files changed, 30 insertions(+), 33 deletions(-) diff --git a/resources/profiles/Basic.ini b/resources/profiles/Basic.ini index b09cdcfda..c8a1a9519 100644 --- a/resources/profiles/Basic.ini +++ b/resources/profiles/Basic.ini @@ -256,7 +256,6 @@ spiral_vase = 0 standby_temperature_delta = -5 support_material = 0 support_material_extruder = 0 -support_material_extrusion_width = 110% support_material_interface_extruder = 0 support_material_angle = 0 support_material_buildplate_only = 0 diff --git a/src/libslic3r/ExtrusionEntity.hpp b/src/libslic3r/ExtrusionEntity.hpp index c487ea27f..ca1ccdf50 100644 --- a/src/libslic3r/ExtrusionEntity.hpp +++ b/src/libslic3r/ExtrusionEntity.hpp @@ -38,10 +38,13 @@ enum ExtrusionRole : uint8_t { // bridge // Special flags describing loop -enum ExtrusionLoopRole { - elrDefault, - elrContourInternalPerimeter, - elrSkirt, +enum ExtrusionLoopRole : uint16_t { + elrDefault=0x1, + // doesn't contains more contour: it's the most internal one + elrInternal=0x10, + elrSkirt = 0x100, + //it's a modifier that indicate that the loop is around a hole, not around the infill + elrHole = 0x1000, }; diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 4a7632602..74289e0f1 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2544,7 +2544,7 @@ std::string GCode::extrude_loop_vase(const ExtrusionLoop &original_loop, const s // extrude all loops ccw //no! this was decided in perimeter_generator - bool was_cw_and_now_ccw = false;// loop.make_counter_clockwise(); + bool is_hole_loop = loop.loop_role() & ExtrusionLoopRole::elrHole != 0;// loop.make_counter_clockwise(); split_at_seam_pos(loop, lower_layer_edge_grid); @@ -2680,7 +2680,7 @@ std::string GCode::extrude_loop_vase(const ExtrusionLoop &original_loop, const s //FIXME improve the algorithm in case the loop is split into segments with a low number of points (see the Point b query). Point a = paths.front().polyline.points[1]; // second point Point b = *(paths.back().polyline.points.end() - 3); // second to last point - if (loop.polygon().is_clockwise()) { + if (is_hole_loop) { // swap points Point c = a; a = b; b = c; } @@ -2688,7 +2688,7 @@ std::string GCode::extrude_loop_vase(const ExtrusionLoop &original_loop, const s double angle = paths.front().first_point().ccw_angle(a, b) / 3; // turn left if contour, turn right if hole - if (loop.polygon().is_clockwise()) angle *= -1; + if (is_hole_loop) angle *= -1; // create the destination point along the first segment and rotate it // we make sure we don't exceed the segment length because we don't know @@ -2879,8 +2879,8 @@ void GCode::split_at_seam_pos(ExtrusionLoop &loop, std::unique_ptrm_config.spiral_vase) { - was_clockwise = loop.make_counter_clockwise(); + loop.make_counter_clockwise(); + is_hole_loop = false; } split_at_seam_pos(loop, lower_layer_edge_grid); @@ -2996,7 +2999,7 @@ std::string GCode::extrude_loop(const ExtrusionLoop &original_loop, const std::s //FIXME improve the algorithm in case the loop is split into segments with a low number of points (see the Point b query). Point a = paths.front().polyline.points[1]; // second point Point b = *(paths.back().polyline.points.end()-3); // second to last point - if (was_clockwise) { + if (is_hole_loop ? loop.polygon().is_counter_clockwise() : loop.polygon().is_clockwise()) { // swap points Point c = a; a = b; b = c; } @@ -3004,7 +3007,7 @@ std::string GCode::extrude_loop(const ExtrusionLoop &original_loop, const std::s double angle = paths.front().first_point().ccw_angle(a, b) / 3; // turn left if contour, turn right if hole - if (was_clockwise) angle *= -1; + if (is_hole_loop ? loop.polygon().is_counter_clockwise() : loop.polygon().is_clockwise()) angle *= -1; // create the destination point along the first segment and rotate it // we make sure we don't exceed the segment length because we don't know diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index d31e9d4f3..622fc6d19 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -299,7 +299,7 @@ void PerimeterGenerator::process() ExPolygons lower_without_holes; for (const ExPolygon &exp : *this->lower_slices) lower_without_holes.emplace_back(to_expolygon(exp.contour)); - overhangs_unsupported = diff_ex(last, lower_without_holes); + overhangs_unsupported = offset2_ex(diff_ex(last, lower_without_holes, true), -SCALED_RESOLUTION, SCALED_RESOLUTION); if (!overhangs_unsupported.empty()) { //only consider overhangs and let bridges alone //only consider the part that can be bridged (really, by the bridge algorithm) @@ -322,7 +322,7 @@ void PerimeterGenerator::process() bridgeable_simplified = offset_ex(bridgeable_simplified, double(perimeter_spacing) / 1.9); if (!bridgeable_simplified.empty()) { //offset by perimeter spacing because the simplify may have reduced it a bit. - overhangs_unsupported = diff_ex(overhangs_unsupported, bridgeable_simplified); + overhangs_unsupported = diff_ex(overhangs_unsupported, bridgeable_simplified, true); } } } @@ -336,13 +336,11 @@ void PerimeterGenerator::process() // we loop one time more than needed in order to find gaps after the last perimeter was applied for (int i = 0;; ++ i) { // outer loop is 0 - - // We can add more perimeters if there are uncovered overhangs // improvement for future: find a way to add perimeters only where it's needed. bool has_overhang = false; if (this->config->extra_perimeters && !last.empty() && !overhangs_unsupported.empty()) { - overhangs_unsupported = intersection_ex(overhangs_unsupported, last); + overhangs_unsupported = intersection_ex(overhangs_unsupported, last, true); if (overhangs_unsupported.size() > 0) { //add fake perimeters here has_overhang = true; @@ -714,10 +712,13 @@ ExtrusionEntityCollection PerimeterGenerator::_traverse_loops( // Note that we set loop role to ContourInternalPerimeter // also when loop is both internal and external (i.e. // there's only one contour loop). - loop_role = elrContourInternalPerimeter; + loop_role = elrInternal; } else { loop_role = elrDefault; } + if (!loop.is_contour) { + loop_role = (ExtrusionLoopRole)(loop_role | elrHole); + } // detect overhanging/bridging perimeters ExtrusionPaths paths; @@ -986,10 +987,13 @@ PerimeterGenerator::_extrude_and_cut_loop(const PerimeterGeneratorLoop &loop, co // Note that we set loop role to ContourInternalPerimeter // also when loop is both internal and external (i.e. // there's only one contour loop). - loop_role = elrContourInternalPerimeter; + loop_role = elrInternal; } else { loop_role = elrDefault; } + if (!loop.is_contour) { + loop_role = (ExtrusionLoopRole)(loop_role | elrHole); + } // detect overhanging/bridging perimeters if (this->config->overhangs && this->layer_id > 0 diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index acd261ad1..8a52f278f 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -82,15 +82,6 @@ void PrintConfigDef::init_common_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0.2)); - def = this->add("layer_height_adaptive", coBool); - def->label = L("Automatic questionable layer height"); - def->category = OptionCategory::perimeter; - def->tooltip = L("This setting enable the adaptive layer height algorithm. It erase the layer height table but it's also erased by the result of the manual variable layer height feature. " - "Personally, I don't recommand to use it, it's not that good and you can do a much better job in some seconds with the manual 'variable layer height' tool.\n" - "note: it uses the min_height and max_height defined in the printer/hardware profile."); - def->mode = comExpert; - def->set_default_value(new ConfigOptionBool(false)); - def = this->add("max_print_height", coFloat); def->label = L("Max print height"); def->category = OptionCategory::general; diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 5bbe3dd67..659a60a8e 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1989,9 +1989,6 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c layer_height_profile.clear(); if (layer_height_profile.empty()) { - if(slicing_parameters.layer_height_adaptive) - layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object.layer_config_ranges, model_object.volumes); - else layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges); updated = true; }