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
path: root/utils
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-07-03 11:24:19 +0400
committerAlessandro Ranellucci <aar@cpan.org>2014-07-03 11:24:19 +0400
commit907de1011fba78b8273fae40acb5a4ae064fdc46 (patch)
treed5d51959b62b37fd9ba3332026704aadd597c10d /utils
parentd8b1eff62f44f62dd7ad674d46c7f26968cc8d28 (diff)
Toolpaths preview
Diffstat (limited to 'utils')
-rwxr-xr-xutils/view-toolpaths.pl85
1 files changed, 85 insertions, 0 deletions
diff --git a/utils/view-toolpaths.pl b/utils/view-toolpaths.pl
new file mode 100755
index 000000000..4b03bbbea
--- /dev/null
+++ b/utils/view-toolpaths.pl
@@ -0,0 +1,85 @@
+#!/usr/bin/perl
+# This script displays 3D preview of a mesh
+
+use strict;
+use warnings;
+
+BEGIN {
+ use FindBin;
+ use lib "$FindBin::Bin/../lib";
+}
+
+use Getopt::Long qw(:config no_auto_abbrev);
+use Slic3r;
+use Slic3r::GUI;
+use Slic3r::GUI::PreviewCanvas;
+$|++;
+
+my %opt = ();
+{
+ my %options = (
+ 'help' => sub { usage() },
+ 'load=s' => \$opt{load},
+ );
+ GetOptions(%options) or usage(1);
+ $ARGV[0] or usage(1);
+}
+
+{
+ # load model
+ my $model = Slic3r::Model->read_from_file($ARGV[0]);
+
+ # load config
+ my $config = Slic3r::Config->new_from_defaults;
+ $config->set('skirts', 0);
+ if ($opt{load}) {
+ $config->apply(Slic3r::Config->load($opt{load}));
+ }
+
+ # init print
+ my $sprint = Slic3r::Print::Simple->new;
+ $sprint->apply_config($config);
+ $sprint->set_model($model);
+ $sprint->process;
+
+ # visualize toolpaths
+ $Slic3r::ViewToolpaths::print = $sprint->_print;
+ my $app = Slic3r::ViewToolpaths->new;
+ $app->MainLoop;
+}
+
+
+sub usage {
+ my ($exit_code) = @_;
+
+ print <<"EOF";
+Usage: view-toolpaths.pl [ OPTIONS ] file.stl
+
+ --help Output this usage screen and exit
+ --load CONFIG Loads the supplied config file
+
+EOF
+ exit ($exit_code || 0);
+}
+
+
+package Slic3r::ViewToolpaths;
+use Wx qw(:sizer);
+use base qw(Wx::App);
+
+our $print;
+
+sub OnInit {
+ my $self = shift;
+
+ my $frame = Wx::Frame->new(undef, -1, 'Toolpaths', [-1, -1], [500, 500]);
+ my $panel = Wx::Panel->new($frame, -1);
+
+ my $sizer = Wx::BoxSizer->new(wxVERTICAL);
+ $sizer->Add(Slic3r::GUI::Plater::2DToolpaths->new($panel, $print), 1, wxEXPAND, 0);
+ $panel->SetSizer($sizer);
+
+ $frame->Show(1);
+}
+
+__END__