Some minor fixes needed after the xsdata merge. #1421

This commit is contained in:
Alessandro Ranellucci 2013-09-06 22:52:56 +02:00
parent f104659020
commit 907ba55aab
5 changed files with 16 additions and 8 deletions

View File

@ -427,7 +427,7 @@ sub _plan {
my ($self, $mp, $point, $comment) = @_; my ($self, $mp, $point, $comment) = @_;
my $gcode = ""; my $gcode = "";
my @travel = $mp->shortest_path($self->last_pos, $point)->lines; my @travel = @{$mp->shortest_path($self->last_pos, $point)->lines};
# if the path is not contained in a single island we need to retract # if the path is not contained in a single island we need to retract
my $need_retract = !$self->config->only_retract_when_crossing_perimeters; my $need_retract = !$self->config->only_retract_when_crossing_perimeters;

View File

@ -52,7 +52,7 @@ sub BUILD {
: $self->islands->[$i]->offset_ex(-$self->_inner_margin); : $self->islands->[$i]->offset_ex(-$self->_inner_margin);
# offset the island outwards to make the boundaries for external movements # offset the island outwards to make the boundaries for external movements
$self->_outer->[$i] = offset([ $self->islands->[$i]->contour], $self->_outer_margin); $self->_outer->[$i] = offset([ $self->islands->[$i]->contour ], $self->_outer_margin);
# if internal motion is enabled, build a set of utility expolygons representing # if internal motion is enabled, build a set of utility expolygons representing
# the outer boundaries (as contours) and the inner boundaries (as holes). whenever # the outer boundaries (as contours) and the inner boundaries (as holes). whenever
@ -74,7 +74,7 @@ sub BUILD {
{ {
my @outer = (map @$_, @{$self->_outer}); my @outer = (map @$_, @{$self->_outer});
my @outer_ex = map [$_], @outer; # as ExPolygons my @outer_ex = map Slic3r::ExPolygon->new($_), @outer; # build ExPolygons for Boost
# lines of outer polygons connect visible points # lines of outer polygons connect visible points
for my $i (0 .. $#outer) { for my $i (0 .. $#outer) {
@ -91,7 +91,7 @@ sub BUILD {
for my $m (0 .. $#{$outer[$i]}) { for my $m (0 .. $#{$outer[$i]}) {
for my $n (0 .. $#{$outer[$j]}) { for my $n (0 .. $#{$outer[$j]}) {
my $line = Slic3r::Line->new($outer[$i][$m], $outer[$j][$n]); my $line = Slic3r::Line->new($outer[$i][$m], $outer[$j][$n]);
if (!@{Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection(\@outer_ex, [$line])}) { if (!@{Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection([ map $_->pp, @outer_ex ], [$line->pp])}) {
# this line does not cross any polygon # this line does not cross any polygon
my $dist = $line->length; my $dist = $line->length;
$edges->{$outer[$i][$m]}{$outer[$j][$n]} = $dist; $edges->{$outer[$i][$m]}{$outer[$j][$n]} = $dist;
@ -106,13 +106,13 @@ sub BUILD {
# lines connecting inner polygons contours are visible but discouraged # lines connecting inner polygons contours are visible but discouraged
if (!$self->no_internal) { if (!$self->no_internal) {
my @inner = (map $_->contour, map @$_, @{$self->_inner}); my @inner = (map $_->contour, map @$_, @{$self->_inner});
my @inner_ex = map [$_], @inner; # as ExPolygons my @inner_ex = map Slic3r::ExPolygon->new($_), @inner; # build ExPolygons for Boost
for my $i (0 .. $#inner) { for my $i (0 .. $#inner) {
for my $j (($i+1) .. $#inner) { for my $j (($i+1) .. $#inner) {
for my $m (0 .. $#{$inner[$i]}) { for my $m (0 .. $#{$inner[$i]}) {
for my $n (0 .. $#{$inner[$j]}) { for my $n (0 .. $#{$inner[$j]}) {
my $line = Slic3r::Line->new($inner[$i][$m], $inner[$j][$n]); my $line = Slic3r::Line->new($inner[$i][$m], $inner[$j][$n]);
if (!@{Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection(\@inner_ex, [$line])}) { if (!@{Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection([ map $_->pp, @inner_ex ], [$line->pp])}) {
# this line does not cross any polygon # this line does not cross any polygon
my $dist = $line->length * CROSSING_FACTOR; my $dist = $line->length * CROSSING_FACTOR;
$edges->{$inner[$i][$m]}{$inner[$j][$n]} = $dist; $edges->{$inner[$i][$m]}{$inner[$j][$n]} = $dist;

View File

@ -934,7 +934,7 @@ sub generate_support_material {
{ {
my $projection = []; my $projection = [];
foreach my $layer (reverse @{$self->layers}) { foreach my $layer (reverse @{$self->layers}) {
if (my @top = grep $_->surface_type == S_TYPE_TOP, map @{$_->slices}, @{$layer->regions}) { if (my @top = map @{$_->slices->filter_by_type(S_TYPE_TOP)}, @{$layer->regions}) {
# compute projection of the contact areas above this top layer # compute projection of the contact areas above this top layer
# first add all the 'new' contact areas to the current projection # first add all the 'new' contact areas to the current projection
# ('new' means all the areas that are lower than the last top layer # ('new' means all the areas that are lower than the last top layer
@ -950,7 +950,7 @@ sub generate_support_material {
# grow top surfaces so that interface and support generation are generated # grow top surfaces so that interface and support generation are generated
# with some spacing from object - it looks we don't need the actual # with some spacing from object - it looks we don't need the actual
# top shapes so this can be done here # top shapes so this can be done here
$top{ $layer->print_z } = [ offset($touching, $flow->scaled_spacing) ]; $top{ $layer->print_z } = offset($touching, $flow->scaled_spacing);
} }
# remove the areas that touched from the projection that will continue on # remove the areas that touched from the projection that will continue on

View File

@ -13,6 +13,10 @@
%code{% const char* CLASS = "Slic3r::ExtrusionPath::Collection"; RETVAL = THIS->chained_path(no_reverse); %}; %code{% const char* CLASS = "Slic3r::ExtrusionPath::Collection"; RETVAL = THIS->chained_path(no_reverse); %};
ExtrusionEntityCollection* chained_path_from(Point* start_near, bool no_reverse) ExtrusionEntityCollection* chained_path_from(Point* start_near, bool no_reverse)
%code{% const char* CLASS = "Slic3r::ExtrusionPath::Collection"; RETVAL = THIS->chained_path_from(start_near, no_reverse); %}; %code{% const char* CLASS = "Slic3r::ExtrusionPath::Collection"; RETVAL = THIS->chained_path_from(start_near, no_reverse); %};
Point* first_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->first_point(); %};
Point* last_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->last_point(); %};
%{ %{
void void

View File

@ -18,6 +18,10 @@
ExtrusionPath* split_at_first_point() ExtrusionPath* split_at_first_point()
%code{% const char* CLASS = "Slic3r::ExtrusionPath"; RETVAL = THIS->split_at_first_point(); %}; %code{% const char* CLASS = "Slic3r::ExtrusionPath"; RETVAL = THIS->split_at_first_point(); %};
bool make_counter_clockwise(); bool make_counter_clockwise();
Point* first_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->first_point(); %};
Point* last_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->last_point(); %};
%{ %{
ExtrusionLoop* ExtrusionLoop*