diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index f9703b893..59ba13a2c 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -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; diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index bfb7eaf1a..acc4dcce0 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -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, diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 0942e5bfc..159953c5d 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -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 });