mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-31 09:02:53 +00:00
Parse and write multi-material AMF files. Convert multiple STL files into a single multi-material AMF
This commit is contained in:
@@ -25,14 +25,16 @@ sub go {
|
||||
# each layer has surfaces with holes
|
||||
$self->status_cb->(10, "Processing triangulated mesh");
|
||||
my $print;
|
||||
{
|
||||
my $mesh = $self->input_file =~ /\.stl$/i
|
||||
? Slic3r::STL->read_file($self->input_file)
|
||||
: $self->input_file =~ /\.amf(\.xml)?$/i
|
||||
? Slic3r::AMF->read_file($self->input_file)
|
||||
: die "Input file must have .stl or .amf(.xml) extension\n";
|
||||
if ($self->input_file =~ /\.stl$/i) {
|
||||
my $mesh = Slic3r::STL->read_file($self->input_file);
|
||||
$mesh->check_manifoldness;
|
||||
$print = Slic3r::Print->new_from_mesh($mesh);
|
||||
} elsif ( $self->input_file =~ /\.amf(\.xml)?$/i) {
|
||||
my ($materials, $meshes_by_material) = Slic3r::AMF->read_file($self->input_file);
|
||||
$_->check_manifoldness for values %$meshes_by_material;
|
||||
$print = Slic3r::Print->new_from_mesh($meshes_by_material->{_} || +(values %$meshes_by_material)[0]);
|
||||
} else {
|
||||
die "Input file must have .stl or .amf(.xml) extension\n";
|
||||
}
|
||||
|
||||
# make perimeters
|
||||
|
||||
Reference in New Issue
Block a user