mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	New command line option: --dont-arrange
Don't arrange the objects on the build plate. The model coordinates define the absolute positions on the build plate. The option --print-center will be ignored. Also there is a fix in the command line invocation of --duplicate-grid so it will run, but still there is something broken there and the results are not correct.
This commit is contained in:
		
							parent
							
								
									ab357c75a5
								
							
						
					
					
						commit
						ca98e2655a
					
				
					 3 changed files with 16 additions and 3 deletions
				
			
		|  | @ -322,6 +322,9 @@ The author of the Silk icon set is Mark James. | ||||||
|         --duplicate         Number of items with auto-arrange (1+, default: 1) |         --duplicate         Number of items with auto-arrange (1+, default: 1) | ||||||
|         --duplicate-grid    Number of items with grid arrangement (default: 1,1) |         --duplicate-grid    Number of items with grid arrangement (default: 1,1) | ||||||
|         --duplicate-distance Distance in mm between copies (default: 6) |         --duplicate-distance Distance in mm between copies (default: 6) | ||||||
|  |         --dont-arrange      Don't arrange the objects on the build plate. The model coordinates | ||||||
|  |                             define the absolute positions on the build plate.  | ||||||
|  |                             The option --print-center will be ignored. | ||||||
|         --xy-size-compensation |         --xy-size-compensation | ||||||
|                             Grow/shrink objects by the configured absolute distance (mm, default: 0) |                             Grow/shrink objects by the configured absolute distance (mm, default: 0) | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -41,6 +41,11 @@ has 'print_center' => ( | ||||||
|     default => sub { Slic3r::Pointf->new(100,100) }, |     default => sub { Slic3r::Pointf->new(100,100) }, | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
|  | has 'dont_arrange' => ( | ||||||
|  |     is      => 'rw', | ||||||
|  |     default => sub { 0 }, | ||||||
|  | ); | ||||||
|  | 
 | ||||||
| has 'output_file' => ( | has 'output_file' => ( | ||||||
|     is      => 'rw', |     is      => 'rw', | ||||||
| ); | ); | ||||||
|  | @ -52,7 +57,7 @@ sub set_model { | ||||||
|     $self->_print->clear_objects; |     $self->_print->clear_objects; | ||||||
|      |      | ||||||
|     # make sure all objects have at least one defined instance |     # make sure all objects have at least one defined instance | ||||||
|     my $need_arrange = $model->add_default_instances; |     my $need_arrange = $model->add_default_instances && ! $self->dont_arrange; | ||||||
|      |      | ||||||
|     # apply scaling and rotation supplied from command line if any |     # apply scaling and rotation supplied from command line if any | ||||||
|     foreach my $instance (map @{$_->instances}, @{$model->objects}) { |     foreach my $instance (map @{$_->instances}, @{$model->objects}) { | ||||||
|  | @ -61,7 +66,7 @@ sub set_model { | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     if ($self->duplicate_grid->[X] > 1 || $self->duplicate_grid->[Y] > 1) { |     if ($self->duplicate_grid->[X] > 1 || $self->duplicate_grid->[Y] > 1) { | ||||||
|         $model->duplicate_objects_grid($self->duplicate_grid, $self->_print->config->duplicate_distance); |         $model->duplicate_objects_grid($self->duplicate_grid->[X], $self->duplicate_grid->[Y], $self->_print->config->duplicate_distance); | ||||||
|     } elsif ($need_arrange) { |     } elsif ($need_arrange) { | ||||||
|         $model->duplicate_objects($self->duplicate, $self->_print->config->min_object_distance); |         $model->duplicate_objects($self->duplicate, $self->_print->config->min_object_distance); | ||||||
|     } elsif ($self->duplicate > 1) { |     } elsif ($self->duplicate > 1) { | ||||||
|  | @ -69,7 +74,7 @@ sub set_model { | ||||||
|         $model->duplicate($self->duplicate, $self->_print->config->min_object_distance); |         $model->duplicate($self->duplicate, $self->_print->config->min_object_distance); | ||||||
|     } |     } | ||||||
|     $_->translate(0,0,-$_->bounding_box->z_min) for @{$model->objects}; |     $_->translate(0,0,-$_->bounding_box->z_min) for @{$model->objects}; | ||||||
|     $model->center_instances_around_point($self->print_center); |     $model->center_instances_around_point($self->print_center) if (! $self->dont_arrange); | ||||||
|      |      | ||||||
|     foreach my $model_object (@{$model->objects}) { |     foreach my $model_object (@{$model->objects}) { | ||||||
|         $self->_print->auto_assign_extruders($model_object); |         $self->_print->auto_assign_extruders($model_object); | ||||||
|  |  | ||||||
|  | @ -48,6 +48,7 @@ my %cli_options = (); | ||||||
|         'duplicate=i'           => \$opt{duplicate}, |         'duplicate=i'           => \$opt{duplicate}, | ||||||
|         'duplicate-grid=s'      => \$opt{duplicate_grid}, |         'duplicate-grid=s'      => \$opt{duplicate_grid}, | ||||||
|         'print-center=s'        => \$opt{print_center}, |         'print-center=s'        => \$opt{print_center}, | ||||||
|  |         'dont-arrange'          => \$opt{dont_arrange}, | ||||||
|     ); |     ); | ||||||
|     foreach my $opt_key (keys %{$Slic3r::Config::Options}) { |     foreach my $opt_key (keys %{$Slic3r::Config::Options}) { | ||||||
|         my $cli = $Slic3r::Config::Options->{$opt_key}->{cli} or next; |         my $cli = $Slic3r::Config::Options->{$opt_key}->{cli} or next; | ||||||
|  | @ -204,6 +205,7 @@ if (@ARGV) {  # slicing from command line | ||||||
|             duplicate       => $opt{duplicate}      // 1, |             duplicate       => $opt{duplicate}      // 1, | ||||||
|             duplicate_grid  => $opt{duplicate_grid} // [1,1], |             duplicate_grid  => $opt{duplicate_grid} // [1,1], | ||||||
|             print_center    => $opt{print_center}   // Slic3r::Pointf->new(100,100), |             print_center    => $opt{print_center}   // Slic3r::Pointf->new(100,100), | ||||||
|  |             dont_arrange    => $opt{dont_arrange}   // 0, | ||||||
|             status_cb       => sub { |             status_cb       => sub { | ||||||
|                 my ($percent, $message) = @_; |                 my ($percent, $message) = @_; | ||||||
|                 printf "=> %s\n", $message; |                 printf "=> %s\n", $message; | ||||||
|  | @ -485,6 +487,9 @@ $j | ||||||
|     --duplicate         Number of items with auto-arrange (1+, default: 1) |     --duplicate         Number of items with auto-arrange (1+, default: 1) | ||||||
|     --duplicate-grid    Number of items with grid arrangement (default: 1,1) |     --duplicate-grid    Number of items with grid arrangement (default: 1,1) | ||||||
|     --duplicate-distance Distance in mm between copies (default: $config->{duplicate_distance}) |     --duplicate-distance Distance in mm between copies (default: $config->{duplicate_distance}) | ||||||
|  |     --dont-arrange      Don't arrange the objects on the build plate. The model coordinates | ||||||
|  |                         define the absolute positions on the build plate.  | ||||||
|  |                         The option --print-center will be ignored. | ||||||
|     --xy-size-compensation |     --xy-size-compensation | ||||||
|                         Grow/shrink objects by the configured absolute distance (mm, default: $config->{xy_size_compensation}) |                         Grow/shrink objects by the configured absolute distance (mm, default: $config->{xy_size_compensation}) | ||||||
|     |     | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv