mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-20 07:11:12 -06:00 
			
		
		
		
	Fix tests here and there
This commit is contained in:
		
							parent
							
								
									e485f0b130
								
							
						
					
					
						commit
						159a009f96
					
				
					 6 changed files with 17 additions and 15 deletions
				
			
		|  | @ -40,7 +40,7 @@ sub clip_with_expolygon { | |||
|     my ($expolygon) = @_; | ||||
|      | ||||
|     return map $self->clone(polyline => $_), | ||||
|         $self->polyline->clip_with_expolygon($expolygon); | ||||
|         $self->as_polyline->clip_with_expolygon($expolygon); | ||||
| } | ||||
| 
 | ||||
| sub intersect_expolygons { | ||||
|  |  | |||
|  | @ -450,7 +450,7 @@ sub process_external_surfaces { | |||
|         # subtract the new top surfaces from the other non-top surfaces and re-add them | ||||
|         my @other = grep $_->surface_type != S_TYPE_TOP && $_->surface_type != S_TYPE_BOTTOM, @{$self->fill_surfaces}; | ||||
|         foreach my $group (Slic3r::Surface->group(@other)) { | ||||
|             push @new_surfaces, map $group->[0]->clone(expolygon => $_), @{diff_ex( | ||||
|             push @new_surfaces, map $_->clone, map $group->[0]->clone(expolygon => $_), @{diff_ex( | ||||
|                 [ map $_->p, @$group ], | ||||
|                 [ map $_->p, @new_surfaces ], | ||||
|             )}; | ||||
|  |  | |||
|  | @ -113,7 +113,7 @@ sub clip_with_expolygon { | |||
|     my $self = shift; | ||||
|     my ($expolygon) = @_; | ||||
|      | ||||
|     my $result = Boost::Geometry::Utils::polygon_multi_linestring_intersection($expolygon->arrayref, [$self]); | ||||
|     my $result = Boost::Geometry::Utils::polygon_multi_linestring_intersection($expolygon->arrayref, [$self->arrayref]); | ||||
|     bless $_, 'Slic3r::Polyline' for @$result; | ||||
|     bless $_, 'Slic3r::Point' for map @$_, @$result; | ||||
|     return @$result; | ||||
|  |  | |||
|  | @ -305,11 +305,11 @@ sub _simplify_slices { | |||
|     my ($distance) = @_; | ||||
|      | ||||
|     foreach my $layer (map @{$_->layers}, @{$self->objects}) { | ||||
|         my @new = map $_->simplify($distance), @{$layer->slices}; | ||||
|         my @new = map $_->simplify($distance), map $_->clone, @{$layer->slices}; | ||||
|         $layer->slices->clear; | ||||
|         $layer->slices->append(@new); | ||||
|         foreach my $layerm (@{$layer->regions}) { | ||||
|             my @new = map $_->simplify($distance), @{$layerm->slices}; | ||||
|             my @new = map $_->simplify($distance), map $_->clone, @{$layerm->slices}; | ||||
|             $layerm->slices->clear; | ||||
|             $layerm->slices->append(@new); | ||||
|         } | ||||
|  |  | |||
|  | @ -383,7 +383,8 @@ sub detect_surfaces_type { | |||
|                 ); | ||||
|             } else { | ||||
|                 # if no upper layer, all surfaces of this one are solid | ||||
|                 @top = @{$layerm->slices}; | ||||
|                 # we clone surfaces because we're going to clear the slices collection | ||||
|                 @top = map $_->clone, @{$layerm->slices}; | ||||
|                 $_->surface_type(S_TYPE_TOP) for @top; | ||||
|             } | ||||
|              | ||||
|  | @ -399,7 +400,8 @@ sub detect_surfaces_type { | |||
|                 ); | ||||
|             } else { | ||||
|                 # if no lower layer, all surfaces of this one are solid | ||||
|                 @bottom = @{$layerm->slices}; | ||||
|                 # we clone surfaces because we're going to clear the slices collection | ||||
|                 @bottom = map $_->clone, @{$layerm->slices}; | ||||
|                 $_->surface_type(S_TYPE_BOTTOM) for @bottom; | ||||
|             } | ||||
|              | ||||
|  | @ -431,7 +433,7 @@ sub detect_surfaces_type { | |||
|         # clip surfaces to the fill boundaries | ||||
|         foreach my $layer (@{$self->layers}) { | ||||
|             my $layerm = $layer->regions->[$region_id]; | ||||
|             my $fill_boundaries = [ map $_->p, @{$layerm->fill_surfaces} ]; | ||||
|             my $fill_boundaries = [ map $_->clone->p, @{$layerm->fill_surfaces} ]; | ||||
|             $layerm->fill_surfaces->clear; | ||||
|             foreach my $surface (@{$layerm->slices}) { | ||||
|                 my $intersection = intersection_ex( | ||||
|  | @ -471,7 +473,7 @@ sub clip_fill_surfaces { | |||
|                 )}; | ||||
|             my @new_surfaces = ( | ||||
|                 @new_internal, | ||||
|                 (grep $_->surface_type != S_TYPE_INTERNAL, @{$layerm->fill_surfaces}), | ||||
|                 (map $_->clone, grep $_->surface_type != S_TYPE_INTERNAL, @{$layerm->fill_surfaces}), | ||||
|             ); | ||||
|             $layerm->fill_surfaces->clear; | ||||
|             $layerm->fill_surfaces->append(@new_surfaces); | ||||
|  | @ -516,7 +518,7 @@ sub bridge_over_infill { | |||
|              | ||||
|             # build the new collection of fill_surfaces | ||||
|             { | ||||
|                 my @new_surfaces = grep $_->surface_type != S_TYPE_INTERNALSOLID, @{$layerm->fill_surfaces}; | ||||
|                 my @new_surfaces = map $_->clone, grep $_->surface_type != S_TYPE_INTERNALSOLID, @{$layerm->fill_surfaces}; | ||||
|                 push @new_surfaces, map Slic3r::Surface->new( | ||||
|                         expolygon       => $_, | ||||
|                         surface_type    => S_TYPE_INTERNALBRIDGE, | ||||
|  | @ -756,7 +758,7 @@ sub combine_infill { | |||
|                  | ||||
|                 foreach my $layerm (@layerms) { | ||||
|                     my @this_type   = grep $_->surface_type == $type, @{$layerm->fill_surfaces}; | ||||
|                     my @other_types = grep $_->surface_type != $type, @{$layerm->fill_surfaces}; | ||||
|                     my @other_types = map $_->clone, grep $_->surface_type != $type, @{$layerm->fill_surfaces}; | ||||
|                      | ||||
|                     my @new_this_type = map Slic3r::Surface->new(expolygon => $_, surface_type => $type), | ||||
|                         @{diff_ex( | ||||
|  | @ -919,7 +921,7 @@ sub generate_support_material { | |||
|             my ($expolygon, $density) = @_; | ||||
|              | ||||
|             my @paths = $filler->fill_surface( | ||||
|                 Slic3r::Surface->new(expolygon => $expolygon), | ||||
|                 Slic3r::Surface->new(expolygon => $expolygon, surface_type => S_TYPE_INTERNAL), | ||||
|                 density         => $density, | ||||
|                 flow_spacing    => $flow->spacing, | ||||
|             ); | ||||
|  | @ -1003,7 +1005,7 @@ sub generate_support_material { | |||
|                 $filler->angle($Slic3r::Config->support_material_angle + 90); | ||||
|                 foreach my $expolygon (@$islands) { | ||||
|                     my @paths = $filler->fill_surface( | ||||
|                         Slic3r::Surface->new(expolygon => $expolygon), | ||||
|                         Slic3r::Surface->new(expolygon => $expolygon, surface_type => S_TYPE_INTERNAL), | ||||
|                         density         => 0.5, | ||||
|                         flow_spacing    => $self->print->first_layer_support_material_flow->spacing, | ||||
|                     ); | ||||
|  |  | |||
|  | @ -42,11 +42,11 @@ use Slic3r::Test; | |||
|         fail "insufficient number of bottom solid layers" | ||||
|             unless !defined(first { !$_ } @shells[0..$config->bottom_solid_layers-1]); | ||||
|         fail "excessive number of bottom solid layers" | ||||
|             unless scalar(grep $_, @shells[0 .. $#shells/2]) != $config->bottom_solid_layers; | ||||
|             unless scalar(grep $_, @shells[0 .. $#shells/2]) == $config->bottom_solid_layers; | ||||
|         fail "insufficient number of top solid layers" | ||||
|             unless !defined(first { !$_ } @shells[-$config->top_solid_layers..-1]); | ||||
|         fail "excessive number of top solid layers" | ||||
|             unless scalar(grep $_, @shells[($#shells/2)..$#shells]) != $config->top_solid_layers; | ||||
|             unless scalar(grep $_, @shells[($#shells/2)..$#shells]) == $config->top_solid_layers; | ||||
|         1; | ||||
|     }; | ||||
|      | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci