Some initial work for stateful Print object
This commit is contained in:
parent
14c97978c7
commit
2eff7c238e
@ -49,6 +49,7 @@ sub new {
|
|||||||
bed_size print_center complete_objects extruder_clearance_radius skirts skirt_distance
|
bed_size print_center complete_objects extruder_clearance_radius skirts skirt_distance
|
||||||
));
|
));
|
||||||
$self->{model} = Slic3r::Model->new;
|
$self->{model} = Slic3r::Model->new;
|
||||||
|
$self->{print} = Slic3r::Print->new;
|
||||||
$self->{objects} = [];
|
$self->{objects} = [];
|
||||||
|
|
||||||
$self->{canvas} = Wx::Panel->new($self, -1, wxDefaultPosition, CANVAS_SIZE, wxTAB_TRAVERSAL);
|
$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]);
|
$o->add_instance(offset => [0,0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->{print}->add_model_object($o);
|
||||||
|
|
||||||
$self->object_loaded($#{ $self->{objects} }, no_arrange => !$need_arrange);
|
$self->object_loaded($#{ $self->{objects} }, no_arrange => !$need_arrange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,6 +477,7 @@ sub increase {
|
|||||||
scaling_factor => $last_instance->scaling_factor,
|
scaling_factor => $last_instance->scaling_factor,
|
||||||
rotation => $last_instance->rotation,
|
rotation => $last_instance->rotation,
|
||||||
);
|
);
|
||||||
|
$self->{print}->objects->[$obj_idx]->copies;
|
||||||
$self->{list}->SetItem($obj_idx, 1, $model_object->instances_count);
|
$self->{list}->SetItem($obj_idx, 1, $model_object->instances_count);
|
||||||
$self->arrange;
|
$self->arrange;
|
||||||
}
|
}
|
||||||
@ -712,10 +716,9 @@ sub export_gcode2 {
|
|||||||
threads->exit();
|
threads->exit();
|
||||||
} if $Slic3r::have_threads;
|
} if $Slic3r::have_threads;
|
||||||
|
|
||||||
my $print = Slic3r::Print->new(
|
my $print = $self->{print};
|
||||||
config => $config,
|
$print->config->apply($config);
|
||||||
extra_variables => $extra_variables,
|
$print->extra_variables($extra_variables);
|
||||||
);
|
|
||||||
|
|
||||||
eval {
|
eval {
|
||||||
$print->config->validate;
|
$print->config->validate;
|
||||||
|
@ -139,6 +139,7 @@ sub add_model_object {
|
|||||||
print => $self,
|
print => $self,
|
||||||
meshes => [ map $meshes{$_}, 0..$#{$self->regions} ],
|
meshes => [ map $meshes{$_}, 0..$#{$self->regions} ],
|
||||||
copies => [ @copies ],
|
copies => [ @copies ],
|
||||||
|
input_bounding_box => $bb1,
|
||||||
size => $scaled_bb->size, # transformed size
|
size => $scaled_bb->size, # transformed size
|
||||||
input_file => $object->input_file,
|
input_file => $object->input_file,
|
||||||
config_overrides => $object->config,
|
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 'meshes' => (is => 'rw', default => sub { [] }); # by region_id
|
||||||
has 'size' => (is => 'rw', required => 1); # XYZ in scaled coordinates
|
has 'size' => (is => 'rw', required => 1); # XYZ in scaled coordinates
|
||||||
has 'copies' => (is => 'rw', trigger => 1); # 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 'layers' => (is => 'rw', default => sub { [] });
|
||||||
has 'support_layers' => (is => 'rw', default => sub { [] });
|
has 'support_layers' => (is => 'rw', default => sub { [] });
|
||||||
has 'config_overrides' => (is => 'rw', default => sub { Slic3r::Config->new });
|
has 'config_overrides' => (is => 'rw', default => sub { Slic3r::Config->new });
|
||||||
|
Loading…
Reference in New Issue
Block a user