mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-29 19:53:44 -06:00
Read OBJ and AMF
This commit is contained in:
parent
a821eb7f3c
commit
4c96a52012
3 changed files with 27 additions and 8 deletions
|
|
@ -25,7 +25,9 @@ sub merge {
|
|||
my $class = shift;
|
||||
my @models = @_;
|
||||
|
||||
my $new_model = $class->new;
|
||||
my $new_model = ref($class)
|
||||
? $class
|
||||
: $class->new;
|
||||
foreach my $model (@models) {
|
||||
# merge material attributes (should we rename them in case of duplicates?)
|
||||
$new_model->set_material($_, { %{$model->materials->{$_}}, %{$model->materials->{$_} || {}} })
|
||||
|
|
@ -34,14 +36,13 @@ sub merge {
|
|||
foreach my $object (@{$model->objects}) {
|
||||
my $new_object = $new_model->add_object(
|
||||
input_file => $object->input_file,
|
||||
vertices => $object->vertices,
|
||||
config => $object->config,
|
||||
layer_height_ranges => $object->layer_height_ranges,
|
||||
);
|
||||
|
||||
$new_object->add_volume(
|
||||
material_id => $_->material_id,
|
||||
facets => $_->facets,
|
||||
mesh => $_->mesh->clone,
|
||||
) for @{$object->volumes};
|
||||
|
||||
$new_object->add_instance(
|
||||
|
|
@ -431,6 +432,13 @@ sub needed_repair {
|
|||
return (first { !$_->mesh->needed_repair } @{$self->volumes}) ? 0 : 1;
|
||||
}
|
||||
|
||||
sub mesh_stats {
|
||||
my $self = shift;
|
||||
|
||||
# TODO: sum values from all volumes
|
||||
return $self->volumes->[0]->mesh->stats;
|
||||
}
|
||||
|
||||
sub print_info {
|
||||
my $self = shift;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue