mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	Merge branch 'stable'
Conflicts: lib/Slic3r/Geometry/Clipper.pm lib/Slic3r/Layer/Region.pm
This commit is contained in:
		
						commit
						bd8c430afd
					
				
					 10 changed files with 32 additions and 17 deletions
				
			
		|  | @ -8,6 +8,7 @@ use Slic3r::Geometry::Clipper qw(union_ex); | |||
| use Slic3r::Surface ':types'; | ||||
| 
 | ||||
| has 'config'             => (is => 'ro', required => 1); | ||||
| has 'extra_variables'    => (is => 'rw', default => sub {{}}); | ||||
| has 'extruders'          => (is => 'ro', required => 1); | ||||
| has 'multiple_extruders' => (is => 'lazy'); | ||||
| has 'standby_points'     => (is => 'rw'); | ||||
|  | @ -549,7 +550,8 @@ sub unretract { | |||
|             $gcode .= "G11 ; unretract\n"; | ||||
|         } elsif ($self->config->extrusion_axis) { | ||||
|             # use G1 instead of G0 because G0 will blend the restart with the previous travel move | ||||
|             $gcode .= sprintf "G1 E%.5f F%.3f", | ||||
|             $gcode .= sprintf "G1 %s%.5f F%.3f", | ||||
|                 $self->config->extrusion_axis, | ||||
|                 $self->extruder->extrude($to_unretract), | ||||
|                 $self->extruder->retract_speed_mm_min; | ||||
|             $gcode .= " ; compensate retraction" if $self->config->gcode_comments; | ||||
|  | @ -644,7 +646,7 @@ sub set_extruder { | |||
|      | ||||
|     # append custom toolchange G-code | ||||
|     if (defined $self->extruder && $self->config->toolchange_gcode) { | ||||
|         $gcode .= sprintf "%s\n", $self->print->replace_variables($self->config->toolchange_gcode, { | ||||
|         $gcode .= sprintf "%s\n", $self->replace_variables($self->config->toolchange_gcode, { | ||||
|             previous_extruder   => $self->extruder->id, | ||||
|             next_extruder       => $extruder->id, | ||||
|         }); | ||||
|  | @ -743,4 +745,9 @@ sub set_bed_temperature { | |||
|     return $gcode; | ||||
| } | ||||
| 
 | ||||
| sub replace_variables { | ||||
|     my ($self, $string, $extra) = @_; | ||||
|     return $self->config->replace_options($string, { %{$self->extra_variables}, %{ $extra || {} } }); | ||||
| } | ||||
| 
 | ||||
| 1; | ||||
|  |  | |||
|  | @ -66,7 +66,7 @@ sub process_layer { | |||
|      | ||||
|     # set new layer - this will change Z and force a retraction if retract_layer_change is enabled | ||||
|     $gcode .= $self->gcodegen->change_layer($layer); | ||||
|     $gcode .= $self->print->replace_variables($Slic3r::Config->layer_gcode, { | ||||
|     $gcode .= $self->gcodegen->replace_variables($Slic3r::Config->layer_gcode, { | ||||
|         layer_num => $self->gcodegen->layer->id, | ||||
|     }) . "\n" if $Slic3r::Config->layer_gcode; | ||||
|      | ||||
|  |  | |||
|  | @ -594,8 +594,10 @@ sub split_object { | |||
|             input_file_object_id    => undef, | ||||
|             model                   => $new_model, | ||||
|             model_object_idx        => $#{$new_model->objects}, | ||||
|             instances               => [ map $bb->min_point, 1..$current_copies_num ], | ||||
|             mesh_stats              => $mesh->stats,  # so that we can free model | ||||
|             instances               => [ map $bb->min_point->pp, 1..$current_copies_num ], | ||||
|         ); | ||||
|          | ||||
|         push @{ $self->{objects} }, $object; | ||||
|         $self->object_loaded($#{ $self->{objects} }, no_arrange => 1); | ||||
|     } | ||||
|  | @ -1289,7 +1291,7 @@ has 'thumbnail_scaling_factor' => (is => 'rw', trigger => \&_transform_thumbnail | |||
| has 'config'                => (is => 'rw', default => sub { Slic3r::Config->new }); | ||||
| has 'layer_height_ranges'   => (is => 'rw', default => sub { [] }); # [ z_min, z_max, layer_height ] | ||||
| has 'material_mapping'      => (is => 'rw', default => sub { {} }); # { material_id => extruder_idx } | ||||
| has 'mesh_stats'            => (is => 'rw'); | ||||
| has 'mesh_stats'            => (is => 'ro', required => 1); | ||||
| 
 | ||||
| # statistics | ||||
| has 'facets'                => (is => 'rw'); | ||||
|  |  | |||
|  | @ -308,7 +308,7 @@ use Storable qw(dclone); | |||
| has 'input_file' => (is => 'rw'); | ||||
| has 'model'     => (is => 'ro', weak_ref => 1, required => 1); | ||||
| has 'volumes'   => (is => 'ro', default => sub { [] }); | ||||
| has 'instances' => (is => 'rw'); | ||||
| has 'instances' => (is => 'rw'); # in unscaled coordinates | ||||
| has 'config'    => (is => 'rw', default => sub { Slic3r::Config->new }); | ||||
| has 'layer_height_ranges' => (is => 'rw', default => sub { [] }); # [ z_min, z_max, layer_height ] | ||||
| has 'material_mapping'      => (is => 'rw', default => sub { {} }); # { material_id => extruder_idx } | ||||
|  |  | |||
|  | @ -721,6 +721,7 @@ sub write_gcode { | |||
|     # set up our extruder object | ||||
|     my $gcodegen = Slic3r::GCode->new( | ||||
|         config              => $self->config, | ||||
|         extra_variables     => $self->extra_variables, | ||||
|         extruders           => $self->extruders,    # we should only pass the *used* extruders (but maintain the Tx indices right!) | ||||
|         layer_count         => $self->layer_count, | ||||
|     ); | ||||
|  | @ -744,7 +745,7 @@ sub write_gcode { | |||
|         } | ||||
|     }; | ||||
|     $print_first_layer_temperature->(0); | ||||
|     printf $fh "%s\n", $self->replace_variables($Slic3r::Config->start_gcode); | ||||
|     printf $fh "%s\n", $gcodegen->replace_variables($Slic3r::Config->start_gcode); | ||||
|     $print_first_layer_temperature->(1); | ||||
|      | ||||
|     # set other general things | ||||
|  | @ -897,7 +898,7 @@ sub write_gcode { | |||
|     # write end commands to file | ||||
|     print $fh $gcodegen->retract if $gcodegen->extruder;  # empty prints don't even set an extruder | ||||
|     print $fh $gcodegen->set_fan(0); | ||||
|     printf $fh "%s\n", $self->replace_variables($Slic3r::Config->end_gcode); | ||||
|     printf $fh "%s\n", $gcodegen->replace_variables($Slic3r::Config->end_gcode); | ||||
|      | ||||
|     foreach my $extruder (@{$self->extruders}) { | ||||
|         printf $fh "; filament used = %.1fmm (%.1fcm3)\n", | ||||
|  | @ -944,12 +945,7 @@ sub expanded_output_filepath { | |||
|         # path is a full path to a file so we use it as it is | ||||
|     } | ||||
|      | ||||
|     return $self->replace_variables($path, $extra_variables); | ||||
| } | ||||
| 
 | ||||
| sub replace_variables { | ||||
|     my ($self, $string, $extra) = @_; | ||||
|     return $self->config->replace_options($string, { %{$self->extra_variables}, %{ $extra || {} } }); | ||||
|     return $self->config->replace_options($path, { %{$self->extra_variables}, %$extra_variables }); | ||||
| } | ||||
| 
 | ||||
| # given the path to a file, this function returns its filename with and without extension | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci