Satisfy test suite and CLI

This commit is contained in:
Alessandro Ranellucci 2014-01-02 17:24:23 +01:00
parent e2f1040a76
commit 5bf0942f45
20 changed files with 300 additions and 272 deletions

View file

@ -1,6 +1,7 @@
package Slic3r::Fill;
use Moo;
use Slic3r::ExtrusionPath ':roles';
use Slic3r::Fill::ArchimedeanChords;
use Slic3r::Fill::Base;
use Slic3r::Fill::Concentric;
@ -11,7 +12,7 @@ use Slic3r::Fill::Line;
use Slic3r::Fill::OctagramSpiral;
use Slic3r::Fill::PlanePath;
use Slic3r::Fill::Rectilinear;
use Slic3r::ExtrusionPath ':roles';
use Slic3r::Flow ':roles';
use Slic3r::Geometry qw(X Y PI scale chained_path);
use Slic3r::Geometry::Clipper qw(union union_ex diff diff_ex intersection_ex offset offset2);
use Slic3r::Surface ':types';
@ -50,7 +51,10 @@ sub make_fill {
my ($layerm) = @_;
Slic3r::debugf "Filling layer %d:\n", $layerm->id;
my $fill_density = $layerm->config->fill_density;
my $fill_density = $layerm->config->fill_density;
my $infill_flow = $layerm->flow(FLOW_ROLE_INFILL);
my $solid_infill_flow = $layerm->flow(FLOW_ROLE_SOLID_INFILL);
my @surfaces = ();
@ -95,7 +99,7 @@ sub make_fill {
# we are going to grow such regions by overlapping them with the void (if any)
# TODO: detect and investigate whether there could be narrow regions without
# any void neighbors
my $distance_between_surfaces = $layerm->solid_infill_flow->scaled_spacing * &Slic3r::INFILL_OVERLAP_OVER_SPACING;
my $distance_between_surfaces = $infill_flow->scaled_spacing * &Slic3r::INFILL_OVERLAP_OVER_SPACING;
{
my $collapsed = diff(
[ map @{$_->expolygon}, @surfaces ],
@ -133,11 +137,10 @@ sub make_fill {
my $filler = $layerm->config->fill_pattern;
my $density = $fill_density;
my $flow = ($surface->surface_type == S_TYPE_TOP)
? $layerm->top_infill_flow
? $layerm->flow(FLOW_ROLE_TOP_SOLID_INFILL)
: $surface->is_solid
? $layerm->solid_infill_flow
: $layerm->infill_flow;
my $flow_spacing = $flow->spacing;
? $solid_infill_flow
: $infill_flow;
my $is_bridge = $layerm->id > 0 && $surface->is_bridge;
my $is_solid = $surface->is_solid;
@ -147,7 +150,7 @@ sub make_fill {
$filler = $layerm->config->solid_fill_pattern;
if ($is_bridge) {
$filler = 'rectilinear';
$flow_spacing = $layerm->extruders->{infill}->bridge_flow->spacing;
$flow = $layerm->flow(FLOW_ROLE_SOLID_INFILL, 1);
} elsif ($surface->surface_type == S_TYPE_INTERNALSOLID) {
$filler = 'rectilinear';
}
@ -155,6 +158,8 @@ sub make_fill {
next SURFACE unless $density > 0;
}
my $flow_spacing = $flow->spacing;
my $f = $self->filler($filler);
$f->layer_id($layerm->id);
$f->angle($layerm->config->fill_angle);
@ -166,7 +171,7 @@ sub make_fill {
next unless @polylines;
# ugly hack(tm) to get the right amount of flow (GCode.pm should be fixed)
$params->{flow_spacing} = $layerm->extruders->{infill}->bridge_flow->width if $is_bridge;
$params->{flow_spacing} = $flow->width if $is_bridge;
# save into layer
push @fills, my $collection = Slic3r::ExtrusionPath::Collection->new;