mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Some initial work for stateful Print object
This commit is contained in:
		
							parent
							
								
									14c97978c7
								
							
						
					
					
						commit
						2eff7c238e
					
				
					 3 changed files with 9 additions and 4 deletions
				
			
		|  | @ -49,6 +49,7 @@ sub new { | |||
|         bed_size print_center complete_objects extruder_clearance_radius skirts skirt_distance | ||||
|     )); | ||||
|     $self->{model} = Slic3r::Model->new; | ||||
|     $self->{print} = Slic3r::Print->new; | ||||
|     $self->{objects} = []; | ||||
|      | ||||
|     $self->{canvas} = Wx::Panel->new($self, -1, wxDefaultPosition, CANVAS_SIZE, wxTAB_TRAVERSAL); | ||||
|  | @ -408,6 +409,8 @@ sub load_model_object { | |||
|         $o->add_instance(offset => [0,0]); | ||||
|     } | ||||
|      | ||||
|     $self->{print}->add_model_object($o); | ||||
|      | ||||
|     $self->object_loaded($#{ $self->{objects} }, no_arrange => !$need_arrange); | ||||
| } | ||||
| 
 | ||||
|  | @ -474,6 +477,7 @@ sub increase { | |||
|         scaling_factor  => $last_instance->scaling_factor, | ||||
|         rotation        => $last_instance->rotation, | ||||
|     ); | ||||
|     $self->{print}->objects->[$obj_idx]->copies; | ||||
|     $self->{list}->SetItem($obj_idx, 1, $model_object->instances_count); | ||||
|     $self->arrange; | ||||
| } | ||||
|  | @ -712,10 +716,9 @@ sub export_gcode2 { | |||
|         threads->exit(); | ||||
|     } if $Slic3r::have_threads; | ||||
|      | ||||
|     my $print = Slic3r::Print->new( | ||||
|         config          => $config, | ||||
|         extra_variables => $extra_variables, | ||||
|     ); | ||||
|     my $print = $self->{print}; | ||||
|     $print->config->apply($config); | ||||
|     $print->extra_variables($extra_variables); | ||||
|      | ||||
|     eval { | ||||
|         $print->config->validate; | ||||
|  |  | |||
|  | @ -139,6 +139,7 @@ sub add_model_object { | |||
|         print               => $self, | ||||
|         meshes              => [ map $meshes{$_}, 0..$#{$self->regions} ], | ||||
|         copies              => [ @copies ], | ||||
|         input_bounding_box  => $bb1, | ||||
|         size                => $scaled_bb->size,  # transformed size | ||||
|         input_file          => $object->input_file, | ||||
|         config_overrides    => $object->config, | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ has 'input_file'        => (is => 'rw', required => 0); | |||
| has 'meshes'            => (is => 'rw', default => sub { [] });  # by region_id | ||||
| has 'size'              => (is => 'rw', required => 1); # XYZ in scaled coordinates | ||||
| has 'copies'            => (is => 'rw', trigger => 1);  # in scaled coordinates | ||||
| has 'copies_shift'      => (is => 'rw');  # scaled coordinates to add to copies (to compensate for the alignment operated when creating the object but still preserving a coherent API for external callers) | ||||
| has 'layers'            => (is => 'rw', default => sub { [] }); | ||||
| has 'support_layers'    => (is => 'rw', default => sub { [] }); | ||||
| has 'config_overrides'  => (is => 'rw', default => sub { Slic3r::Config->new }); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci