diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2012-09-23 16:48:58 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2012-09-23 16:48:58 +0400 |
commit | 77625894ffaa2cdcbccdac9c946411e763f4ff9c (patch) | |
tree | a3c055f3ec56f7e26bef6e75646e6cb47398cfaa /utils | |
parent | bbe0a45b58cddc93cf8e008526901fc3ce7fdee8 (diff) |
New command to combine multiple STL files into a single multi-material AMF file
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/stl-to-amf.pl | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/utils/stl-to-amf.pl b/utils/stl-to-amf.pl index e6fc1fa8d..e1adec7ce 100755 --- a/utils/stl-to-amf.pl +++ b/utils/stl-to-amf.pl @@ -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 { |