Always use a rectangle with semicircles as extrudate shape

This commit is contained in:
Alessandro Ranellucci 2014-07-26 15:29:24 +02:00
parent a654722f18
commit c4d70bcb85
3 changed files with 14 additions and 37 deletions

View File

@ -275,6 +275,7 @@ for my $pattern (qw(rectilinear honeycomb hilbertcurve concentric)) {
$config->set('nozzle_diameter', [0.35]);
$config->set('infill_extruder', 2);
$config->set('infill_extrusion_width', 0.52);
$config->set('solid_infill_extrusion_width', 0.52);
$config->set('first_layer_extrusion_width', 0);
my $print = Slic3r::Test::init_print('A', config => $config);
@ -299,7 +300,7 @@ for my $pattern (qw(rectilinear honeycomb hilbertcurve concentric)) {
my $grow_d = scale($config->infill_extrusion_width)/2;
my $layer0_infill = union([ map @{$_->grow($grow_d)}, @{ $infill{0.2} } ]);
my $layer1_infill = union([ map @{$_->grow($grow_d)}, @{ $infill{0.4} } ]);
my $diff = [ grep $_->area >= 4*($grow_d**2), @{diff_ex($layer0_infill, $layer1_infill)} ];
my $diff = [ grep { $_->area > 2*(($grow_d*2)**2) } @{diff_ex($layer0_infill, $layer1_infill)} ];
is scalar(@$diff), 0, 'no missing parts in solid shell when fill_density is 0';
}

View File

@ -186,12 +186,13 @@ use Slic3r::Test;
# compute the covered area
my $pflow = $layerm->flow(FLOW_ROLE_PERIMETER);
my $iflow = $layerm->flow(FLOW_ROLE_INFILL);
my $covered_by_perimeters = union_ex([
(map @{$_->polygon->split_at_first_point->grow($pflow->scaled_width/2)}, @{$layerm->perimeters}),
]);
my $covered_by_infill = union_ex([
(map $_->p, @{$layerm->fill_surfaces}),
(map @{$_->polyline->grow($pflow->scaled_width/2)}, @{$layerm->thin_fills}),
(map @{$_->polyline->grow($iflow->scaled_width/2)}, @{$layerm->thin_fills}),
]);
# compute the non covered area
@ -211,7 +212,7 @@ use Slic3r::Test;
);
}
ok !(defined first { $_->area > ($pflow->scaled_width**2) } @$non_covered), 'no gap between perimeters and infill';
ok !(defined first { $_->area > ($iflow->scaled_width**2) } @$non_covered), 'no gap between perimeters and infill';
}
{

View File

@ -43,14 +43,8 @@ Flow::spacing() const {
return this->width + BRIDGE_EXTRA_SPACING;
}
float min_flow_spacing;
if (this->width >= (this->nozzle_diameter + this->height)) {
// rectangle with semicircles at the ends
min_flow_spacing = this->width - this->height * (1 - PI/4.0);
} else {
// rectangle with shrunk semicircles at the ends
min_flow_spacing = this->nozzle_diameter * (1 - PI/4.0) + this->width * PI/4.0;
}
// rectangle with semicircles at the ends
float min_flow_spacing = this->width - this->height * (1 - PI/4.0);
return this->width - OVERLAP_FACTOR * (this->width - min_flow_spacing);
}
@ -74,13 +68,10 @@ double
Flow::mm3_per_mm() const {
if (this->bridge) {
return (this->width * this->width) * PI/4.0;
} else if (this->width >= (this->nozzle_diameter + this->height)) {
// rectangle with semicircles at the ends
return this->width * this->height + (this->height*this->height) / 4.0 * (PI-4.0);
} else {
// rectangle with shrunk semicircles at the ends
return this->nozzle_diameter * this->height * (1 - PI/4.0) + this->height * this->width * PI/4.0;
}
// rectangle with semicircles at the ends
return this->width * this->height + (this->height*this->height) / 4.0 * (PI-4.0);
}
/* This static method returns bridge width for a given nozzle diameter. */
@ -94,16 +85,8 @@ Flow::_bridge_width(float nozzle_diameter, float bridge_flow_ratio) {
float
Flow::_auto_width(FlowRole role, float nozzle_diameter, float height) {
// here we calculate a sane default by matching the flow speed (at the nozzle) and the feed rate
float volume = (nozzle_diameter*nozzle_diameter) * PI/4.0;
float shape_threshold = nozzle_diameter * height + (height*height) * PI/4.0;
float width;
if (volume >= shape_threshold) {
// rectangle with semicircles at the ends
width = ((nozzle_diameter*nozzle_diameter) * PI + (height*height) * (4.0 - PI)) / (4.0 * height);
} else {
// rectangle with squished semicircles at the ends
width = nozzle_diameter * (nozzle_diameter/height - 4.0/PI + 1);
}
// shape: rectangle with semicircles at the ends
float width = ((nozzle_diameter*nozzle_diameter) * PI + (height*height) * (4.0 - PI)) / (4.0 * height);
float min = nozzle_diameter * 1.05;
float max = -1;
@ -126,16 +109,8 @@ Flow::_width_from_spacing(float spacing, float nozzle_diameter, float height, bo
return spacing - BRIDGE_EXTRA_SPACING;
}
float w_threshold = height + nozzle_diameter;
float s_threshold = w_threshold - OVERLAP_FACTOR * (w_threshold - (w_threshold - height * (1 - PI/4.0)));
if (spacing >= s_threshold) {
// rectangle with semicircles at the ends
return spacing + OVERLAP_FACTOR * height * (1 - PI/4.0);
} else {
// rectangle with shrunk semicircles at the ends
return (spacing + nozzle_diameter * OVERLAP_FACTOR * (PI/4.0 - 1)) / (1 + OVERLAP_FACTOR * (PI/4.0 - 1));
}
// rectangle with semicircles at the ends
return spacing + OVERLAP_FACTOR * height * (1 - PI/4.0);
}
#ifdef SLIC3RXS