mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 18:42:24 +00:00
Refactoring: moved Slic3r::STL and Slic3r::AMF to Slic3r::Format::*
This commit is contained in:
@@ -22,6 +22,8 @@ use Slic3r::ExtrusionPath;
|
||||
use Slic3r::ExtrusionPath::Arc;
|
||||
use Slic3r::ExtrusionPath::Collection;
|
||||
use Slic3r::Fill;
|
||||
use Slic3r::Format::AMF;
|
||||
use Slic3r::Format::STL;
|
||||
use Slic3r::Geometry qw(PI);
|
||||
use Slic3r::Layer;
|
||||
use Slic3r::Line;
|
||||
@@ -31,8 +33,6 @@ use Slic3r::Polygon;
|
||||
use Slic3r::Polyline;
|
||||
use Slic3r::Print;
|
||||
use Slic3r::Skein;
|
||||
use Slic3r::AMF;
|
||||
use Slic3r::STL;
|
||||
use Slic3r::Surface;
|
||||
use Slic3r::TriangleMesh;
|
||||
use Slic3r::TriangleMesh::IntersectionLine;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package Slic3r::AMF;
|
||||
package Slic3r::Format::AMF;
|
||||
use Moo;
|
||||
|
||||
use Slic3r::Geometry qw(X Y Z);
|
||||
@@ -8,7 +8,7 @@ sub read_file {
|
||||
my $self = shift;
|
||||
my ($file) = @_;
|
||||
|
||||
eval "require Slic3r::AMF::Parser; 1"
|
||||
eval "require Slic3r::Format::AMF::Parser; 1"
|
||||
or die "AMF parsing requires XML::SAX::ExpatXS\n";
|
||||
|
||||
open my $fh, '<', $file or die "Failed to open $file\n";
|
||||
@@ -17,7 +17,7 @@ sub read_file {
|
||||
my $materials = {};
|
||||
my $meshes_by_material = {};
|
||||
XML::SAX::ExpatXS
|
||||
->new(Handler => Slic3r::AMF::Parser->new(
|
||||
->new(Handler => Slic3r::Format::AMF::Parser->new(
|
||||
_vertices => $vertices,
|
||||
_materials => $materials,
|
||||
_meshes_by_material => $meshes_by_material,
|
||||
@@ -1,4 +1,4 @@
|
||||
package Slic3r::AMF::Parser;
|
||||
package Slic3r::Format::AMF::Parser;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package Slic3r::STL;
|
||||
package Slic3r::Format::STL;
|
||||
use Moo;
|
||||
|
||||
use Slic3r::Geometry qw(X Y Z triangle_normal);
|
||||
@@ -27,11 +27,11 @@ sub go {
|
||||
$self->status_cb->(10, "Processing triangulated mesh");
|
||||
my $print;
|
||||
if ($self->input_file =~ /\.stl$/i) {
|
||||
my $mesh = Slic3r::STL->read_file($self->input_file);
|
||||
my $mesh = Slic3r::Format::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);
|
||||
my ($materials, $meshes_by_material) = Slic3r::Format::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 {
|
||||
|
||||
Reference in New Issue
Block a user