Removed factor 4 from layer height gradation, don't apply min/max layer height limitation after gradation. Fixes #4235 (#4241)

This commit is contained in:
platsch 2017-12-21 17:39:47 +01:00 committed by Joseph Lenox
parent 93c898f4bc
commit 6dd400914e
3 changed files with 13 additions and 6 deletions

View File

@ -138,7 +138,7 @@ subtest 'widen to match horizontal facets' => sub {
subtest 'layer height gradation' => sub {
plan tests => 5;
foreach my $gradation (1/0.001*4, 1/0.01*4, 1/0.02*4, 1/0.05*4, 1/0.08*4) {
foreach my $gradation (1/0.001, 1/0.01, 1/0.02, 1/0.05, 1/0.08) {
$config->set('z_steps_per_mm', $gradation);
$height_gradation_test->();
}

View File

@ -1671,7 +1671,7 @@ PrintConfigDef::PrintConfigDef()
def = this->add("z_steps_per_mm", coFloat);
def->label = "Z full steps/mm";
def->tooltip = "Set this to the number of *full* steps (not microsteps) needed for moving the Z axis by 1mm; you can calculate this by dividing the number of microsteps configured in your firmware by the microstepping amount (8, 16, 32). Slic3r will round your configured layer height to the nearest multiple of that value in order to ensure the best accuracy. This is most useful for machines with imperial leadscrews or belt-driven Z or for unusual layer heights with metric leadscrews. Set to zero to disable this experimental feature.";
def->tooltip = "Set this to the number of *full* steps (not microsteps) needed for moving the Z axis by 1mm; you can calculate this by dividing the number of microsteps configured in your firmware by the microstepping amount (8, 16, 32). Slic3r will round your configured layer height to the nearest multiple of that value in order to ensure the best accuracy. This is most useful for machines with imperial leadscrews or belt-driven Z or for unusual layer heights with metric leadscrews. If you still experience wobbling, try using 4 * full_step to achieve the same motor phase pattern for every layer (important for belt driven z-axis). Set to zero to disable this experimental feature.";
def->cli = "z-steps-per-mm=f";
def->default_value = new ConfigOptionFloat(0);

View File

@ -548,7 +548,7 @@ coordf_t PrintObject::adjust_layer_height(coordf_t layer_height) const
{
coordf_t result = layer_height;
if(this->_print->config.z_steps_per_mm > 0) {
coordf_t min_dz = 1 / this->_print->config.z_steps_per_mm * 4;
coordf_t min_dz = 1 / this->_print->config.z_steps_per_mm;
result = int(layer_height / min_dz + 0.5) * min_dz;
}
@ -688,9 +688,13 @@ std::vector<coordf_t> PrintObject::generate_object_layers(coordf_t first_layer_h
// push modified spline object back to model
this->_model_object->layer_height_spline = this->layer_height_spline;
// apply z-gradation (this is redundant for static layer height...)
coordf_t gradation = 1 / this->_print->config.z_steps_per_mm * 4;
// apply z-gradation.
// For static layer height: the adjusted layer height is still useful
// to have the layer height a multiple of a printable z-interval.
// If we don't do this, we might get aliasing effects if a small error accumulates
// over multiple layer until we get a slightly thicker layer.
if(this->_print->config.z_steps_per_mm > 0) {
coordf_t gradation = 1 / this->_print->config.z_steps_per_mm;
coordf_t last_z = 0;
coordf_t height;
for(std::vector<coordf_t>::iterator l = result.begin(); l != result.end(); ++l) {
@ -702,7 +706,10 @@ std::vector<coordf_t> PrintObject::generate_object_layers(coordf_t first_layer_h
}else{ // round down
height = height - gradation_effect;
}
height = std::min(std::max(height, min_layer_height), max_layer_height);
// limiting the height to max_ / min_layer_height can violate the gradation requirement
// we now might exceed the layer height limits a bit, but that is probably better than having
// systematic errors introduced by the steppers...
//height = std::min(std::max(height, min_layer_height), max_layer_height);
*l = last_z + height;
last_z = *l;
}