Merge pull request #194 from henrikbrixandersen/master

Fix for #130, #165 and potential fix for #180
This commit is contained in:
Alessandro Ranellucci 2012-02-06 06:54:08 -08:00
commit a0250b1606
6 changed files with 46 additions and 7 deletions

View file

@ -80,13 +80,14 @@ The author is Alessandro Ranellucci (me).
--help Output this usage screen and exit
--save <file> Save configuration to the specified file
--load <file> Load configuration from the specified file
--load <file> Load configuration from the specified file. It can be used
more than once to load options from multiple files.
-o, --output <file> File to output gcode to (by default, the file will be saved
into the same directory as the input file using the
--output-filename-format to generate the filename)
Output options:
--output-filament-format
--output-filename-format
Output file name format; all config options enclosed in brackets
will be replaced by their values, as well as [input_filename_base]
and [input_filename] (default: [input_filename_base].gcode)
@ -173,6 +174,9 @@ The author is Alessandro Ranellucci (me).
--duplicate-x Number of items along X axis (1+, default: 1)
--duplicate-y Number of items along Y axis (1+, default: 1)
--duplicate-distance Distance in mm between copies (default: 6)
Miscellaneous options:
--notes Notes to be added as comments to the output file
Flow options (advanced):
--extrusion-width-ratio

View file

@ -38,6 +38,9 @@ use Slic3r::TriangleMesh::IntersectionLine;
our $threads = 4;
# miscellaneous options
our $notes = '';
# output options
our $output_filename_format = '[input_filename_base].gcode';

View file

@ -7,6 +7,18 @@ use constant PI => 4 * atan2(1, 1);
our $Options = {
# miscellaneous options
'notes' => {
label => 'Configuraton notes',
cli => 'notes=s',
type => 's',
multiline => 1,
width => 350,
height => 300,
serialize => sub { join '\n', split /\R/, $_[0] },
deserialize => sub { join "\n", split /\\n/, $_[0] },
},
# output options
'output_filename_format' => {
label => 'Output filename format',

View file

@ -4,8 +4,8 @@ use warnings;
use utf8;
use File::Basename qw(basename dirname);
use Wx qw(:sizer :progressdialog wxOK wxICON_INFORMATION wxICON_WARNING wxICON_ERROR wxID_OK wxFD_OPEN
wxFD_SAVE wxDEFAULT wxNORMAL);
use Wx qw(:sizer :progressdialog wxOK wxICON_INFORMATION wxICON_WARNING wxICON_ERROR wxICON_QUESTION
wxOK wxCANCEL wxID_OK wxFD_OPEN wxFD_SAVE wxDEFAULT wxNORMAL);
use Wx::Event qw(EVT_BUTTON);
use base 'Wx::Panel';
@ -67,6 +67,10 @@ sub new {
title => 'Output',
options => [qw(output_filename_format)],
},
notes => {
title => 'Notes',
options => [qw(notes)],
},
);
$self->{panels} = \%panels;
@ -99,13 +103,15 @@ sub new {
$make_tab->([qw(transform accuracy skirt)], [qw(print retract)]),
$make_tab->([qw(printer filament)], [qw(print_speed speed)]),
$make_tab->([qw(gcode)]),
$make_tab->([qw(notes)]),
$make_tab->([qw(extrusion)], [qw(output)]),
);
$tabpanel->AddPage($tabs[0], "Print Settings");
$tabpanel->AddPage($tabs[1], "Printer and Filament");
$tabpanel->AddPage($tabs[2], "Start/End GCODE");
$tabpanel->AddPage($tabs[3], "Advanced");
$tabpanel->AddPage($tabs[3], "Notes");
$tabpanel->AddPage($tabs[4], "Advanced");
my $buttons_sizer;
{
@ -152,6 +158,14 @@ sub do_slice {
eval {
# validate configuration
Slic3r::Config->validate;
# confirm slicing of more than one copies
my $copies = Slic3r::Config->get('duplicate_x') * Slic3r::Config->get('duplicate_y');
if ($copies > 1) {
my $confirmation = Wx::MessageDialog->new($self, "Are you sure you want to slice $copies copies?",
'Confirm', wxICON_QUESTION | wxOK | wxCANCEL);
return unless $confirmation->ShowModal == wxID_OK;
}
# select input file
my $dir = $last_skein_dir || $last_config_dir || "";
@ -183,7 +197,7 @@ sub do_slice {
# show processbar dialog
$process_dialog = Wx::ProgressDialog->new('Slicing...', "Processing $input_file_basename...",
100, $self, wxPD_APP_MODAL);
100, $self, 0);
$process_dialog->Pulse;
{

View file

@ -463,6 +463,9 @@ sub export_gcode {
my @lt = localtime;
printf $fh "; generated by Slic3r $Slic3r::VERSION on %02d-%02d-%02d at %02d:%02d:%02d\n\n",
$lt[5] + 1900, $lt[4]+1, $lt[3], $lt[2], $lt[1], $lt[0];
print $fh "; $_\n" foreach split /\R/, $Slic3r::notes;
print $fh "\n" if $Slic3r::notes;
for (qw(layer_height perimeters solid_layers fill_density nozzle_diameter filament_diameter
perimeter_speed infill_speed travel_speed extrusion_width_ratio scale)) {

View file

@ -104,7 +104,7 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
--output-filename-format to generate the filename)
Output options:
--output-filament-format
--output-filename-format
Output file name format; all config options enclosed in brackets
will be replaced by their values, as well as [input_filename_base]
and [input_filename] (default: $Slic3r::output_filename_format)
@ -191,6 +191,9 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
--duplicate-x Number of items along X axis (1+, default: $Slic3r::duplicate_x)
--duplicate-y Number of items along Y axis (1+, default: $Slic3r::duplicate_y)
--duplicate-distance Distance in mm between copies (default: $Slic3r::duplicate_distance)
Miscellaneous options:
--notes Notes to be added as comments to the output file
Flow options (advanced):
--extrusion-width-ratio