mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 07:03:59 -06:00
New command to combine multiple STL files into a single multi-material AMF file
This commit is contained in:
parent
bbe0a45b58
commit
77625894ff
5 changed files with 89 additions and 24 deletions
|
@ -35,19 +35,11 @@ my %opt = ();
|
|||
my $new_object = $new_model->add_object;
|
||||
for my $m (0 .. $#models) {
|
||||
my $model = $models[$m];
|
||||
my $v_offset = @{$new_object->vertices};
|
||||
push @{$new_object->vertices}, @{$model->objects->[0]->vertices};
|
||||
my @new_facets = map {
|
||||
my $f = [@$_];
|
||||
$f->[$_] += $v_offset for -3..-1;
|
||||
$f;
|
||||
} @{ $model->objects->[0]->volumes->[0]->facets };
|
||||
|
||||
my $material_id = scalar keys %{$new_model->materials};
|
||||
$new_model->set_material($material_id, { Name => basename($ARGV[$m]) });
|
||||
$new_model->set_material($m, { Name => basename($ARGV[$m]) });
|
||||
$new_object->add_volume(
|
||||
material_id => $material_id,
|
||||
facets => [@new_facets],
|
||||
material_id => $m,
|
||||
facets => $model->objects->[0]->volumes->[0]->facets,
|
||||
vertices => $model->objects->[0]->vertices,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue