mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 13:34:05 -06:00
First working implementation of a GUI for cutting
This commit is contained in:
parent
882a98ed44
commit
4f17c2b7d1
6 changed files with 27 additions and 5 deletions
|
@ -1103,7 +1103,7 @@ sub mouse_event {
|
|||
$self->{drag_object} = undef;
|
||||
$self->SetCursor(wxSTANDARD_CURSOR);
|
||||
} elsif ($event->ButtonDClick) {
|
||||
$parent->object_preview_dialog if $parent->selected_object;
|
||||
$parent->object_cut_dialog if $parent->selected_object;
|
||||
} elsif ($event->Dragging) {
|
||||
return if !$self->{drag_start_pos}; # concurrency problems
|
||||
my ($obj_idx, $instance_idx) = @{ $self->{drag_object} };
|
||||
|
@ -1146,7 +1146,7 @@ sub list_item_activated {
|
|||
my ($self, $event, $obj_idx) = @_;
|
||||
|
||||
$obj_idx //= $event->GetIndex;
|
||||
$self->object_preview_dialog($obj_idx);
|
||||
$self->object_cut_dialog($obj_idx);
|
||||
}
|
||||
|
||||
sub object_cut_dialog {
|
||||
|
@ -1171,6 +1171,7 @@ sub object_cut_dialog {
|
|||
if (my @new_objects = $dlg->NewModelObjects) {
|
||||
$self->remove($obj_idx);
|
||||
$self->load_model_objects(@new_objects);
|
||||
$self->arrange;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@ sub perform_cut {
|
|||
if $self->{cut_options}{keep_upper} && defined $upper_object;
|
||||
push @{$self->{new_model_objects}}, $lower_object
|
||||
if $self->{cut_options}{keep_lower} && defined $lower_object;
|
||||
|
||||
$self->Close;
|
||||
}
|
||||
|
||||
sub NewModelObjects {
|
||||
|
|
|
@ -571,15 +571,19 @@ sub cut {
|
|||
model => $self->model,
|
||||
config => $self->config->clone,
|
||||
layer_height_ranges => $self->layer_height_ranges,
|
||||
origin_translation => $self->origin_translation->clone,
|
||||
);
|
||||
my $lower = Slic3r::Model::Object->new(
|
||||
input_file => $self->input_file,
|
||||
model => $self->model,
|
||||
config => $self->config->clone,
|
||||
layer_height_ranges => $self->layer_height_ranges,
|
||||
origin_translation => $self->origin_translation->clone,
|
||||
);
|
||||
$upper->add_instance(offset => Slic3r::Point->new(0,0));
|
||||
$lower->add_instance(offset => Slic3r::Point->new(0,0));
|
||||
foreach my $instance (@{$self->instances}) {
|
||||
$upper->add_instance(offset => $instance->offset);
|
||||
$lower->add_instance(offset => $instance->offset);
|
||||
}
|
||||
|
||||
foreach my $volume (@{$self->volumes}) {
|
||||
if ($volume->modifier) {
|
||||
|
@ -589,9 +593,11 @@ sub cut {
|
|||
} else {
|
||||
my $upper_mesh = Slic3r::TriangleMesh->new;
|
||||
my $lower_mesh = Slic3r::TriangleMesh->new;
|
||||
$volume->mesh->cut($z, $upper_mesh, $lower_mesh);
|
||||
$volume->mesh->cut($z + $volume->mesh->bounding_box->z_min, $upper_mesh, $lower_mesh);
|
||||
$upper_mesh->repair;
|
||||
$lower_mesh->repair;
|
||||
$upper_mesh->reset_repair_stats;
|
||||
$lower_mesh->reset_repair_stats;
|
||||
|
||||
$upper->add_volume(
|
||||
material_id => $volume->material_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue