Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-04-25 12:20:30 +0400
committerAlessandro Ranellucci <aar@cpan.org>2014-04-25 12:20:30 +0400
commitfe1691c1518e776fbb6db5580af6dba423f2226c (patch)
tree5a5bc8c0f06fc9e67a2404406b4faef4a256160e /slic3r.pl
parent37c7b958d432b00851686a8d5d8bf2b7be083d60 (diff)
New --cut feature
Diffstat (limited to 'slic3r.pl')
-rwxr-xr-xslic3r.pl22
1 files changed, 22 insertions, 0 deletions
diff --git a/slic3r.pl b/slic3r.pl
index f9e6f6372..73b6c373f 100755
--- a/slic3r.pl
+++ b/slic3r.pl
@@ -36,6 +36,7 @@ my %cli_options = ();
'export-svg' => \$opt{export_svg},
'merge|m' => \$opt{merge},
'repair' => \$opt{repair},
+ 'cut=f' => \$opt{cut},
'info' => \$opt{info},
'scale=f' => \$opt{scale},
@@ -120,6 +121,25 @@ if (@ARGV) { # slicing from command line
exit;
}
+ if ($opt{cut}) {
+ foreach my $file (@ARGV) {
+ my $model = Slic3r::Model->read_from_file($file);
+ $model->add_default_instances;
+ my $mesh = $model->mesh;
+ $mesh->translate(0, 0, -$mesh->bounding_box->z_min);
+ my $upper = Slic3r::TriangleMesh->new;
+ my $lower = Slic3r::TriangleMesh->new;
+ $mesh->cut($opt{cut}, $upper, $lower);
+ $upper->repair;
+ $lower->repair;
+ Slic3r::Format::STL->write_file("${file}_upper.stl", $upper, binary => 0)
+ if $upper->facets_count > 0;
+ Slic3r::Format::STL->write_file("${file}_lower.stl", $lower, binary => 0)
+ if $lower->facets_count > 0;
+ }
+ exit;
+ }
+
while (my $input_file = shift @ARGV) {
my $model;
if ($opt{merge}) {
@@ -203,6 +223,8 @@ Usage: slic3r.pl [ OPTIONS ] [ file.stl ] [ file2.stl ] ...
Non-slicing actions (no G-code will be generated):
--repair Repair given STL files and save them as <name>_fixed.obj
+ --cut <z> Cut given input files at given Z (relative) and export
+ them as <name>_upper.stl and <name>_lower.stl
--info Output information about the supplied file(s) and exit
$j