Merge branch 'master' into new-support2

Conflicts:
	lib/Slic3r/Layer.pm
	lib/Slic3r/Print/Object.pm
new-support2
Alessandro Ranellucci 2013-07-29 00:30:33 +02:00
commit bd11e51da6
5 changed files with 14 additions and 22 deletions

View File

@ -119,12 +119,11 @@ sub change_layer {
return $gcode;
}
# this method accepts Z in scaled coordinates
# this method accepts Z in unscaled coordinates
sub move_z {
my $self = shift;
my ($z, $comment) = @_;
$z *= &Slic3r::SCALING_FACTOR;
$z += $self->config->z_offset;
my $gcode = "";

View File

@ -16,7 +16,7 @@ sub process_layer {
my $new_gcode = "";
my $layer_height = $layer->height;
my $z = unscale($layer->print_z) - $layer_height;
my $z = $layer->print_z - $layer_height;
my $newlayer = 0;
Slic3r::GCode::Reader->new(gcode => $gcode)->parse(sub {
my ($reader, $cmd, $args, $info) = @_;

View File

@ -11,7 +11,7 @@ has 'regions' => (is => 'ro', default => sub { [] });
has 'slicing_errors' => (is => 'rw');
has 'slice_z' => (is => 'ro', required => 1); # Z used for slicing in scaled coordinates
has 'print_z' => (is => 'ro', required => 1); # Z used for printing in scaled coordinates
has 'print_z' => (is => 'ro', required => 1); # Z used for printing in unscaled coordinates
has 'height' => (is => 'ro', required => 1); # layer height in unscaled coordinates
# collection of expolygons generated by slicing the original geometry;

View File

@ -18,7 +18,6 @@ has 'support_layers' => (is => 'rw', default => sub { [] });
has 'layer_height_ranges' => (is => 'rw', default => sub { [] }); # [ z_min, z_max, layer_height ]
has 'fill_maker' => (is => 'lazy');
has '_slice_z_table' => (is => 'lazy');
has '_print_z_table' => (is => 'lazy');
sub BUILD {
my $self = shift;
@ -38,7 +37,7 @@ sub BUILD {
object => $self,
id => $id,
height => $height,
print_z => scale $print_z,
print_z => $print_z,
slice_z => -1,
);
}
@ -73,7 +72,7 @@ sub BUILD {
object => $self,
id => $id,
height => $height,
print_z => scale $print_z,
print_z => $print_z,
slice_z => scale $slice_z,
);
@ -91,11 +90,6 @@ sub _build__slice_z_table {
return Slic3r::Object::XS::ZTable->new([ map $_->slice_z, @{$self->layers} ]);
}
sub _build__print_z_table {
my $self = shift;
return Slic3r::Object::XS::ZTable->new([ map $_->print_z, @{$self->layers} ]);
}
# This should be probably moved in Print.pm at the point where we sort Layer objects
sub _trigger_copies {
my $self = shift;
@ -912,8 +906,8 @@ sub generate_support_material {
@{$layer->regions};
my $nozzle_diameter = sum(@nozzle_diameters)/@nozzle_diameters;
my $contact_z = unscale($layer->print_z) - $nozzle_diameter * 1.5;
###$contact_z = unscale($layer->print_z) - $layer->height;
my $contact_z = $layer->print_z - $nozzle_diameter * 1.5;
###$contact_z = $layer->print_z - $layer->height;
$contact{$contact_z} = [ @contact ];
$overhang{$contact_z} = [ @overhang ];
}
@ -931,14 +925,13 @@ sub generate_support_material {
# first add all the 'new' contact areas to the current projection
# ('new' means all the areas that are lower than the last top layer
# we considered)
my $unscaled_print_z = unscale $layer->print_z;
my $min_top = min(keys %top) // max(keys %contact);
push @$projection, map @{$contact{$_}}, grep { $_ > $unscaled_print_z && $_ < $min_top } keys %contact;
push @$projection, map @{$contact{$_}}, grep { $_ > $layer->print_z && $_ < $min_top } keys %contact;
# now find whether any projection falls onto this top surface
my $touching = intersection($projection, [ map $_->p, @top ]);
if (@$touching) {
$top{ unscale($layer->print_z) } = $touching;
$top{ $layer->print_z } = $touching;
}
# remove the areas that touched from the projection that will continue on
@ -1006,7 +999,7 @@ sub generate_support_material {
object => $self,
id => $_,
height => ($_ == 0) ? $support_layers[$_] : ($support_layers[$_] - $support_layers[$_-1]),
print_z => scale $support_layers[$_],
print_z => $support_layers[$_],
slice_z => -1,
slices => [],
), 0 .. $#support_layers;

View File

@ -25,7 +25,7 @@ sub export_svg {
my ($filename) = @_;
my $print_size = $self->print->size;
$self->height(unscale max(map $_->print_z, map @{$_->layers}, @{$self->print->objects}));
$self->height(max(map $_->print_z, map @{$_->layers}, @{$self->print->objects}));
my $svg = SVG->new(
width => $self->scale * unscale($print_size->[X]),
height => $self->scale * $self->height,
@ -106,7 +106,7 @@ sub _plot {
# we're cutting the path in the longitudinal direction, so we've got a rectangle
push @rectangles, {
'x' => $self->scale * unscale $line->[A][X],
'y' => $self->scale * $self->_y(unscale($layer->print_z)),
'y' => $self->scale * $self->_y($layer->print_z),
'width' => $self->scale * $width,
'height' => $self->scale * $radius * 2,
'rx' => $self->scale * $radius * 0.35,
@ -115,7 +115,7 @@ sub _plot {
} else {
push @circles, {
'cx' => $self->scale * (unscale($line->[A][X]) + $radius),
'cy' => $self->scale * $self->_y(unscale($layer->print_z) - $radius),
'cy' => $self->scale * $self->_y($layer->print_z - $radius),
'r' => $self->scale * $radius,
};
}
@ -125,7 +125,7 @@ sub _plot {
my $height = $path->height // $layer->height;
{
'x' => $self->scale * unscale $_->[A][X],
'y' => $self->scale * $self->_y(unscale($layer->print_z)),
'y' => $self->scale * $self->_y($layer->print_z),
'width' => $self->scale * unscale(abs($_->[B][X] - $_->[A][X])),
'height' => $self->scale * $height,
'rx' => $self->scale * $height * 0.35,