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)
This commit is contained in:
supermerill 2020-01-09 13:47:39 +01:00
parent b88c58c324
commit c5fbfae095
6 changed files with 30 additions and 33 deletions

View File

@ -256,7 +256,6 @@ spiral_vase = 0
standby_temperature_delta = -5 standby_temperature_delta = -5
support_material = 0 support_material = 0
support_material_extruder = 0 support_material_extruder = 0
support_material_extrusion_width = 110%
support_material_interface_extruder = 0 support_material_interface_extruder = 0
support_material_angle = 0 support_material_angle = 0
support_material_buildplate_only = 0 support_material_buildplate_only = 0

View File

@ -38,10 +38,13 @@ enum ExtrusionRole : uint8_t {
// bridge // bridge
// Special flags describing loop // Special flags describing loop
enum ExtrusionLoopRole { enum ExtrusionLoopRole : uint16_t {
elrDefault, elrDefault=0x1,
elrContourInternalPerimeter, // doesn't contains more contour: it's the most internal one
elrSkirt, elrInternal=0x10,
elrSkirt = 0x100,
//it's a modifier that indicate that the loop is around a hole, not around the infill
elrHole = 0x1000,
}; };

View File

@ -2544,7 +2544,7 @@ std::string GCode::extrude_loop_vase(const ExtrusionLoop &original_loop, const s
// extrude all loops ccw // extrude all loops ccw
//no! this was decided in perimeter_generator //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); 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). //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 a = paths.front().polyline.points[1]; // second point
Point b = *(paths.back().polyline.points.end() - 3); // second to last point Point b = *(paths.back().polyline.points.end() - 3); // second to last point
if (loop.polygon().is_clockwise()) { if (is_hole_loop) {
// swap points // swap points
Point c = a; a = b; b = c; 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; double angle = paths.front().first_point().ccw_angle(a, b) / 3;
// turn left if contour, turn right if hole // 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 // 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 // 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_ptr<EdgeGrid::Gri
loop.split_at(polygon.points[idx_min], true); loop.split_at(polygon.points[idx_min], true);
} else if (seam_position == spRandom) { } else if (seam_position == spRandom) {
if (loop.loop_role() == elrContourInternalPerimeter) { if (loop.loop_role() & elrInternal != 0) {
// This loop does not contain any other loop. Set a random position. // This loop does not contain any other (not-hole) loop. Set a random position.
// The other loops will get a seam close to the random point chosen // The other loops will get a seam close to the random point chosen
// on the inner most contour. // on the inner most contour.
//FIXME This works correctly for inner contours first only. //FIXME This works correctly for inner contours first only.
@ -2949,10 +2949,13 @@ std::string GCode::extrude_loop(const ExtrusionLoop &original_loop, const std::s
// extrude all loops ccw // extrude all loops ccw
//no! this was decided in perimeter_generator //no! this was decided in perimeter_generator
bool was_clockwise = false;// loop.make_counter_clockwise(); //but we need to know where is "inside", so we will use is_hole_loop. if is_hole_loop, then we need toconsider that the right direction is clockwise, else counter clockwise.
bool is_hole_loop = (loop.loop_role() & ExtrusionLoopRole::elrHole) != 0;// loop.make_counter_clockwise();
//if spiral vase, we have to ensure that all loops are in the same orientation. //if spiral vase, we have to ensure that all loops are in the same orientation.
if (this->m_config.spiral_vase) { if (this->m_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); 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). //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 a = paths.front().polyline.points[1]; // second point
Point b = *(paths.back().polyline.points.end()-3); // second to last 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 // swap points
Point c = a; a = b; b = c; 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; double angle = paths.front().first_point().ccw_angle(a, b) / 3;
// turn left if contour, turn right if hole // 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 // 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 // we make sure we don't exceed the segment length because we don't know

View File

@ -299,7 +299,7 @@ void PerimeterGenerator::process()
ExPolygons lower_without_holes; ExPolygons lower_without_holes;
for (const ExPolygon &exp : *this->lower_slices) for (const ExPolygon &exp : *this->lower_slices)
lower_without_holes.emplace_back(to_expolygon(exp.contour)); 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()) { if (!overhangs_unsupported.empty()) {
//only consider overhangs and let bridges alone //only consider overhangs and let bridges alone
//only consider the part that can be bridged (really, by the bridge algorithm) //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); bridgeable_simplified = offset_ex(bridgeable_simplified, double(perimeter_spacing) / 1.9);
if (!bridgeable_simplified.empty()) { if (!bridgeable_simplified.empty()) {
//offset by perimeter spacing because the simplify may have reduced it a bit. //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 // 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 for (int i = 0;; ++ i) { // outer loop is 0
// We can add more perimeters if there are uncovered overhangs // We can add more perimeters if there are uncovered overhangs
// improvement for future: find a way to add perimeters only where it's needed. // improvement for future: find a way to add perimeters only where it's needed.
bool has_overhang = false; bool has_overhang = false;
if (this->config->extra_perimeters && !last.empty() && !overhangs_unsupported.empty()) { 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) { if (overhangs_unsupported.size() > 0) {
//add fake perimeters here //add fake perimeters here
has_overhang = true; has_overhang = true;
@ -714,10 +712,13 @@ ExtrusionEntityCollection PerimeterGenerator::_traverse_loops(
// Note that we set loop role to ContourInternalPerimeter // Note that we set loop role to ContourInternalPerimeter
// also when loop is both internal and external (i.e. // also when loop is both internal and external (i.e.
// there's only one contour loop). // there's only one contour loop).
loop_role = elrContourInternalPerimeter; loop_role = elrInternal;
} else { } else {
loop_role = elrDefault; loop_role = elrDefault;
} }
if (!loop.is_contour) {
loop_role = (ExtrusionLoopRole)(loop_role | elrHole);
}
// detect overhanging/bridging perimeters // detect overhanging/bridging perimeters
ExtrusionPaths paths; ExtrusionPaths paths;
@ -986,10 +987,13 @@ PerimeterGenerator::_extrude_and_cut_loop(const PerimeterGeneratorLoop &loop, co
// Note that we set loop role to ContourInternalPerimeter // Note that we set loop role to ContourInternalPerimeter
// also when loop is both internal and external (i.e. // also when loop is both internal and external (i.e.
// there's only one contour loop). // there's only one contour loop).
loop_role = elrContourInternalPerimeter; loop_role = elrInternal;
} else { } else {
loop_role = elrDefault; loop_role = elrDefault;
} }
if (!loop.is_contour) {
loop_role = (ExtrusionLoopRole)(loop_role | elrHole);
}
// detect overhanging/bridging perimeters // detect overhanging/bridging perimeters
if (this->config->overhangs && this->layer_id > 0 if (this->config->overhangs && this->layer_id > 0

View File

@ -82,15 +82,6 @@ void PrintConfigDef::init_common_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.2)); 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 = this->add("max_print_height", coFloat);
def->label = L("Max print height"); def->label = L("Max print height");
def->category = OptionCategory::general; def->category = OptionCategory::general;

View File

@ -1989,9 +1989,6 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c
layer_height_profile.clear(); layer_height_profile.clear();
if (layer_height_profile.empty()) { 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); layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges);
updated = true; updated = true;
} }