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 --help Output this usage screen and exit
--save <file> Save configuration to the specified file --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 -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 into the same directory as the input file using the
--output-filename-format to generate the filename) --output-filename-format to generate the filename)
Output options: Output options:
--output-filament-format --output-filename-format
Output file name format; all config options enclosed in brackets Output file name format; all config options enclosed in brackets
will be replaced by their values, as well as [input_filename_base] will be replaced by their values, as well as [input_filename_base]
and [input_filename] (default: [input_filename_base].gcode) 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-x Number of items along X axis (1+, default: 1)
--duplicate-y Number of items along Y axis (1+, default: 1) --duplicate-y Number of items along Y axis (1+, default: 1)
--duplicate-distance Distance in mm between copies (default: 6) --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): Flow options (advanced):
--extrusion-width-ratio --extrusion-width-ratio

View File

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

View File

@ -7,6 +7,18 @@ use constant PI => 4 * atan2(1, 1);
our $Options = { 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 options
'output_filename_format' => { 'output_filename_format' => {
label => 'Output filename format', label => 'Output filename format',

View File

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

View File

@ -463,6 +463,9 @@ sub export_gcode {
my @lt = localtime; my @lt = localtime;
printf $fh "; generated by Slic3r $Slic3r::VERSION on %02d-%02d-%02d at %02d:%02d:%02d\n\n", 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]; $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 for (qw(layer_height perimeters solid_layers fill_density nozzle_diameter filament_diameter
perimeter_speed infill_speed travel_speed extrusion_width_ratio scale)) { 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-filename-format to generate the filename)
Output options: Output options:
--output-filament-format --output-filename-format
Output file name format; all config options enclosed in brackets Output file name format; all config options enclosed in brackets
will be replaced by their values, as well as [input_filename_base] will be replaced by their values, as well as [input_filename_base]
and [input_filename] (default: $Slic3r::output_filename_format) 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-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-y Number of items along Y axis (1+, default: $Slic3r::duplicate_y)
--duplicate-distance Distance in mm between copies (default: $Slic3r::duplicate_distance) --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): Flow options (advanced):
--extrusion-width-ratio --extrusion-width-ratio