mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-30 04:02:52 -06:00
Removed print_center option (but left --print-center from CLI)
This commit is contained in:
parent
4d8ecccc5e
commit
928335f186
15 changed files with 54 additions and 53 deletions
|
|
@ -53,14 +53,6 @@ sub run {
|
|||
# it would be cleaner to have these defined inside each page class,
|
||||
# in some event getting called before leaving the page
|
||||
{
|
||||
# set print_center to center of bed_shape
|
||||
{
|
||||
my $bed_shape = $self->{config}->bed_shape;
|
||||
my $polygon = Slic3r::Polygon->new_scale(@$bed_shape);
|
||||
my $center = $polygon->centroid;
|
||||
$self->{config}->set('print_center', [ map unscale($_), @$center ]);
|
||||
}
|
||||
|
||||
# set first_layer_height + layer_height based on nozzle_diameter
|
||||
my $nozzle = $self->{config}->nozzle_diameter;
|
||||
$self->{config}->set('first_layer_height', $nozzle->[0]);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ sub new {
|
|||
my ($parent) = @_;
|
||||
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
$self->{config} = Slic3r::Config->new_from_defaults(qw(
|
||||
bed_shape print_center complete_objects extruder_clearance_radius skirts skirt_distance
|
||||
bed_shape complete_objects extruder_clearance_radius skirts skirt_distance
|
||||
));
|
||||
$self->{model} = Slic3r::Model->new;
|
||||
$self->{print} = Slic3r::Print->new;
|
||||
|
|
@ -420,6 +420,8 @@ sub load_file {
|
|||
sub load_model_objects {
|
||||
my ($self, @model_objects) = @_;
|
||||
|
||||
my $bed_centerf = $self->bed_centerf;
|
||||
|
||||
my $need_arrange = 0;
|
||||
my @obj_idx = ();
|
||||
foreach my $model_object (@model_objects) {
|
||||
|
|
@ -436,7 +438,7 @@ sub load_model_objects {
|
|||
|
||||
# add a default instance and center object around origin
|
||||
$o->center_around_origin;
|
||||
$o->add_instance(offset => Slic3r::Pointf->new(@{$self->{config}->print_center}));
|
||||
$o->add_instance(offset => $bed_centerf);
|
||||
}
|
||||
|
||||
$self->{print}->auto_assign_extruders($o);
|
||||
|
|
@ -476,6 +478,14 @@ sub objects_loaded {
|
|||
$self->schedule_background_process;
|
||||
}
|
||||
|
||||
sub bed_centerf {
|
||||
my ($self) = @_;
|
||||
|
||||
my $bed_shape = Slic3r::Polygon->new_scale(@{$self->{config}->bed_shape});
|
||||
my $bed_center = $bed_shape->bounding_box->center;
|
||||
return Slic3r::Pointf->new(unscale($bed_center->x), unscale($bed_center->y)); #)
|
||||
}
|
||||
|
||||
sub remove {
|
||||
my $self = shift;
|
||||
my ($obj_idx) = @_;
|
||||
|
|
@ -1105,7 +1115,7 @@ sub update {
|
|||
my ($self, $force_autocenter) = @_;
|
||||
|
||||
if ($Slic3r::GUI::Settings->{_}{autocenter} || $force_autocenter) {
|
||||
$self->{model}->center_instances_around_point($self->{config}->print_center);
|
||||
$self->{model}->center_instances_around_point($self->bed_centerf);
|
||||
}
|
||||
|
||||
# sync model and print object instances
|
||||
|
|
@ -1147,7 +1157,6 @@ sub on_config_change {
|
|||
$self->{canvas}->update_bed_size;
|
||||
$self->update;
|
||||
}
|
||||
$self->update if $opt_key eq 'print_center';
|
||||
}
|
||||
|
||||
return if !$self->GetFrame->is_loaded;
|
||||
|
|
|
|||
|
|
@ -87,14 +87,14 @@ sub repaint {
|
|||
|
||||
# draw print center
|
||||
if (@{$self->{objects}} && $Slic3r::GUI::Settings->{_}{autocenter}) {
|
||||
my $center = $self->unscaled_point_to_pixel($self->{config}->print_center);
|
||||
my $center = $self->unscaled_point_to_pixel($self->{print_center});
|
||||
$dc->SetPen($self->{print_center_pen});
|
||||
$dc->DrawLine($center->[X], 0, $center->[X], $size[Y]);
|
||||
$dc->DrawLine(0, $center->[Y], $size[X], $center->[Y]);
|
||||
$dc->SetTextForeground(Wx::Colour->new(0,0,0));
|
||||
$dc->SetFont(Wx::Font->new(10, wxDEFAULT, wxNORMAL, wxNORMAL));
|
||||
$dc->DrawLabel("X = " . $self->{config}->print_center->[X], Wx::Rect->new(0, 0, $center->[X]*2, $self->GetSize->GetHeight), wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM);
|
||||
$dc->DrawRotatedText("Y = " . $self->{config}->print_center->[Y], 0, $center->[Y]+15, 90);
|
||||
$dc->DrawLabel("X = " . $self->{print_center}->[X], Wx::Rect->new(0, 0, $center->[X]*2, $self->GetSize->GetHeight), wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM);
|
||||
$dc->DrawRotatedText("Y = " . $self->{print_center}->[Y], 0, $center->[Y]+15, 90);
|
||||
}
|
||||
|
||||
# draw frame
|
||||
|
|
@ -258,6 +258,10 @@ sub update_bed_size {
|
|||
$canvas_h - ($self->GetSize->GetHeight/2 - (unscale($bb->y_max + $bb->y_min)/2 * $self->{scaling_factor})),
|
||||
];
|
||||
|
||||
# calculate print center
|
||||
my $center = $bb->center;
|
||||
$self->{print_center} = [ unscale($center->x), unscale($center->y) ]; #))
|
||||
|
||||
# cache bed contours and grid
|
||||
{
|
||||
my $step = scale 10; # 1cm grid
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ sub build {
|
|||
|
||||
$self->append_optgroup(
|
||||
title => 'Size and coordinates',
|
||||
options => [qw(bed_size print_center z_offset)],
|
||||
options => [qw(bed_size z_offset)],
|
||||
);
|
||||
|
||||
$self->append_optgroup(
|
||||
|
|
|
|||
|
|
@ -704,14 +704,13 @@ sub build {
|
|||
$self->add_options_page('General', 'printer_empty.png', optgroups => [
|
||||
{
|
||||
title => 'Size and coordinates',
|
||||
options => [qw(bed_shape print_center z_offset)],
|
||||
options => [qw(bed_shape z_offset)],
|
||||
lines => [
|
||||
{
|
||||
label => 'Bed shape',
|
||||
widget => $bed_shape_widget,
|
||||
options => ['bed_shape'],
|
||||
},
|
||||
Slic3r::GUI::OptionsGroup->single_option_line('print_center'),
|
||||
Slic3r::GUI::OptionsGroup->single_option_line('z_offset'),
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue