mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Don't combine retract and travel anymore when using G0. #1289
This commit is contained in:
		
							parent
							
								
									e6b59aef4e
								
							
						
					
					
						commit
						bc0b9e1b72
					
				
					 1 changed files with 27 additions and 45 deletions
				
			
		|  | @ -404,7 +404,7 @@ sub travel_to { | ||||||
|         $gcode .= $self->G0($point, undef, 0, $comment || ""); |         $gcode .= $self->G0($point, undef, 0, $comment || ""); | ||||||
|     } elsif (!$self->config->avoid_crossing_perimeters || $self->straight_once) { |     } elsif (!$self->config->avoid_crossing_perimeters || $self->straight_once) { | ||||||
|         $self->straight_once(0); |         $self->straight_once(0); | ||||||
|         $gcode .= $self->retract(travel_to => $point); |         $gcode .= $self->retract; | ||||||
|         $self->speed('travel'); |         $self->speed('travel'); | ||||||
|         $gcode .= $self->G0($point, undef, 0, $comment || ""); |         $gcode .= $self->G0($point, undef, 0, $comment || ""); | ||||||
|     } else { |     } else { | ||||||
|  | @ -448,7 +448,7 @@ sub _plan { | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     # do the retract (the travel_to argument is broken) |     # do the retract (the travel_to argument is broken) | ||||||
|     $gcode .= $self->retract(travel_to => $point) if $need_retract; |     $gcode .= $self->retract if $need_retract; | ||||||
|      |      | ||||||
|     # append the actual path and return |     # append the actual path and return | ||||||
|     $self->speed('travel'); |     $self->speed('travel'); | ||||||
|  | @ -484,52 +484,34 @@ sub retract { | ||||||
|         ? undef |         ? undef | ||||||
|         : [undef, $self->z + $self->extruder->retract_lift, 0, 'lift plate during travel']; |         : [undef, $self->z + $self->extruder->retract_lift, 0, 'lift plate during travel']; | ||||||
|      |      | ||||||
|     if (($self->config->g0 || $self->config->gcode_flavor eq 'mach3') && $params{travel_to}) { |     # check that we have a positive wipe length | ||||||
|  |     if ($wipe_path && (my $total_wipe_length = $wipe_path->length)) { | ||||||
|         $self->speed('travel'); |         $self->speed('travel'); | ||||||
|         if ($lift) { |          | ||||||
|             # combine lift and retract |         # subdivide the retraction | ||||||
|             $lift->[2] = $retract->[2]; |         my $retracted = 0; | ||||||
|             $gcode .= $self->G0(@$lift); |         for (1 .. $#$wipe_path) { | ||||||
|         } else { |             my $segment_length = $wipe_path->[$_-1]->distance_to($wipe_path->[$_]); | ||||||
|             # combine travel and retract |             $retracted += my $e = $retract->[2] * ($segment_length / $total_wipe_length); | ||||||
|             my $travel = [$params{travel_to}, undef, $retract->[2], "travel and $comment"]; |             $gcode .= $self->G1($wipe_path->[$_], undef, $e, $retract->[3] . ";_WIPE"); | ||||||
|             $gcode .= $self->G0(@$travel); |         } | ||||||
|  |         if ($retracted > $retract->[2]) { | ||||||
|  |             # if we retracted less than we had to, retract the remainder | ||||||
|  |             # TODO: add regression test | ||||||
|  |             $gcode .= $self->G1(undef, undef, $retract->[2] - $retracted, $comment); | ||||||
|         } |         } | ||||||
|     } elsif (($self->config->g0 || $self->config->gcode_flavor eq 'mach3') && defined $params{move_z}) { |  | ||||||
|         # combine Z change and retraction |  | ||||||
|         $self->speed('travel'); |  | ||||||
|         my $travel = [undef, $params{move_z}, $retract->[2], "change layer and $comment"]; |  | ||||||
|         $gcode .= $self->G0(@$travel); |  | ||||||
|     } else { |     } else { | ||||||
|         # check that we have a positive wipe length |         $self->speed('retract'); | ||||||
|         if ($wipe_path && (my $total_wipe_length = $wipe_path->length)) { |         $gcode .= $self->G1(@$retract); | ||||||
|             $self->speed('travel'); |     } | ||||||
|              |     if (!$self->lifted) { | ||||||
|             # subdivide the retraction |         $self->speed('travel'); | ||||||
|             my $retracted = 0; |         if (defined $params{move_z} && $self->extruder->retract_lift > 0) { | ||||||
|             for (1 .. $#$wipe_path) { |             my $travel = [undef, $params{move_z} + $self->extruder->retract_lift, 0, 'move to next layer (' . $self->layer->id . ') and lift']; | ||||||
|                 my $segment_length = $wipe_path->[$_-1]->distance_to($wipe_path->[$_]); |             $gcode .= $self->G0(@$travel); | ||||||
|                 $retracted += my $e = $retract->[2] * ($segment_length / $total_wipe_length); |             $self->lifted($self->extruder->retract_lift); | ||||||
|                 $gcode .= $self->G1($wipe_path->[$_], undef, $e, $retract->[3] . ";_WIPE"); |         } elsif ($lift) { | ||||||
|             } |             $gcode .= $self->G1(@$lift); | ||||||
|             if ($retracted > $retract->[2]) { |  | ||||||
|                 # if we retracted less than we had to, retract the remainder |  | ||||||
|                 # TODO: add regression test |  | ||||||
|                 $gcode .= $self->G1(undef, undef, $retract->[2] - $retracted, $comment); |  | ||||||
|             } |  | ||||||
|         } else { |  | ||||||
|             $self->speed('retract'); |  | ||||||
|             $gcode .= $self->G1(@$retract); |  | ||||||
|         } |  | ||||||
|         if (!$self->lifted) { |  | ||||||
|             $self->speed('travel'); |  | ||||||
|             if (defined $params{move_z} && $self->extruder->retract_lift > 0) { |  | ||||||
|                 my $travel = [undef, $params{move_z} + $self->extruder->retract_lift, 0, 'move to next layer (' . $self->layer->id . ') and lift']; |  | ||||||
|                 $gcode .= $self->G0(@$travel); |  | ||||||
|                 $self->lifted($self->extruder->retract_lift); |  | ||||||
|             } elsif ($lift) { |  | ||||||
|                 $gcode .= $self->G1(@$lift); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     $self->extruder->retracted($self->extruder->retracted + $length); |     $self->extruder->retracted($self->extruder->retracted + $length); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci