Skip to content

Commit

Permalink
Merge branch 'master' into sender
Browse files Browse the repository at this point in the history
Conflicts:
	Build.PL
  • Loading branch information
alranel committed Feb 1, 2015
2 parents 766b301 + bb3bf28 commit 3ae6f26
Show file tree
Hide file tree
Showing 106 changed files with 2,253 additions and 985 deletions.
12 changes: 8 additions & 4 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ my %prereqs = qw(
Moo 1.003001
POSIX 0
Scalar::Util 0
Test::Harness 0
Test::More 0
Thread::Semaphore 0
IO::Scalar 0
Expand All @@ -28,9 +27,8 @@ my %prereqs = qw(
);
my %recommends = qw(
Class::XSAccessor 0
LWP::UserAgent 0
Net::Bonjour 0
XML::SAX::ExpatXS 0
Test::Harness 0
);

my $sudo = grep { $_ eq '--sudo' } @ARGV;
Expand All @@ -40,14 +38,20 @@ if ($gui) {
%prereqs = qw(
Class::Accessor 0
Wx 0.9918
Socket 2.016
);
%recommends = qw(
Growl::GNTP 0.15
Wx::GLCanvas 0
OpenGL 0
LWP::UserAgent 0
Net::Bonjour 0
);
if ($^O eq 'MSWin32') {
$recommends{"Win32::TieRegistry"} = 0;

# we need an up-to-date Win32::API because older aren't thread-safe (GH #2517)
$prereqs{'Win32::API'} = 0.79;
}
} elsif ($xs_only) {
%prereqs = %recommends = ();
Expand Down Expand Up @@ -115,7 +119,7 @@ EOF
foreach my $module (sort keys %modules) {
my $version = $modules{$module};
my @cmd = ($cpanm, @cpanm_args);
push @cmd, '-f', if $module eq 'OpenGL'; # temporary workaround for upstream bug in test
push @cmd, '--notest', if $module eq 'OpenGL'; # temporary workaround for upstream bug in test
push @cmd, "$module~$version";
if ($module eq 'XML::SAX::ExpatXS' && $^O eq 'MSWin32') {
my $mingw = 'C:\dev\CitrusPerl\mingw64';
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ If you want to compile the source yourself just do the following (checkout
```
$ git clone https://github.com/alexrj/Slic3r.git
$ cd Slic3r
$ sudo perl Build.PL
$ sudo perl Build.PL --gui
$ perl Build.PL --sudo
$ perl Build.PL --sudo --gui
$ ./slic3r.pl
```

Expand Down Expand Up @@ -219,7 +219,8 @@ The author of the Silk icon set is Mark James.
--end-gcode Load final G-code from the supplied file. This will overwrite
the default commands (turn off temperature [M104 S0],
home X axis [G28 X], disable motors [M84]).
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
--before-layer-gcode Load before-layer-change G-code from the supplied file (default: nothing).
--layer-gcode Load after-layer-change G-code from the supplied file (default: nothing).
--toolchange-gcode Load tool-change G-code from the supplied file (default: nothing).
--seam-position Position of loop starting points (random/nearest/aligned, default: aligned).
--external-perimeters-first Reverse perimeter order. (default: no)
Expand Down Expand Up @@ -253,6 +254,9 @@ The author of the Silk icon set is Mark James.
Spacing between pattern lines (mm, default: 2.5)
--support-material-angle
Support material angle in degrees (range: 0-90, default: 0)
--support-material-contact-distance
Vertical distance between object and support material
(0+, default: 0.2)
--support-material-interface-layers
Number of perpendicular layers between support material and object (0+, default: 3)
--support-material-interface-spacing
Expand All @@ -279,8 +283,8 @@ The author of the Silk icon set is Mark James.

Retraction options for multi-extruder setups:
--retract-length-toolchange
Length of retraction in mm when disabling tool (default: 1)
--retract-restart-extra-toolchnage
Length of retraction in mm when disabling tool (default: 10)
--retract-restart-extra-toolchange
Additional amount of filament in mm to push after
switching tool (default: 0)

Expand Down Expand Up @@ -346,6 +350,7 @@ The author of the Silk icon set is Mark James.
Set a different extrusion width for top infill
--support-material-extrusion-width
Set a different extrusion width for support material
--infill-overlap Overlap between infill and perimeters (default: 15%)
--bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: 1)

Multiple extruder options:
Expand Down
3 changes: 2 additions & 1 deletion lib/Slic3r.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ use constant RESOLUTION => 0.0125;
use constant SCALED_RESOLUTION => RESOLUTION / SCALING_FACTOR;
use constant SMALL_PERIMETER_LENGTH => (6.5 / SCALING_FACTOR) * 2 * PI;
use constant LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER => 0.15;
use constant INFILL_OVERLAP_OVER_SPACING => 0.45;
use constant INFILL_OVERLAP_OVER_SPACING => 0.3;
use constant EXTERNAL_INFILL_MARGIN => 3;
use constant INSET_OVERLAP_TOLERANCE => 0.4;

Expand Down Expand Up @@ -211,6 +211,7 @@ sub thread_cleanup {
*Slic3r::Polyline::DESTROY = sub {};
*Slic3r::Polyline::Collection::DESTROY = sub {};
*Slic3r::Print::DESTROY = sub {};
*Slic3r::Print::Object::DESTROY = sub {};
*Slic3r::Print::Region::DESTROY = sub {};
*Slic3r::Surface::DESTROY = sub {};
*Slic3r::Surface::Collection::DESTROY = sub {};
Expand Down
2 changes: 2 additions & 0 deletions lib/Slic3r/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ sub validate {
# --first-layer-height
die "Invalid value for --first-layer-height\n"
if $self->first_layer_height !~ /^(?:\d*(?:\.\d+)?)%?$/;
die "Invalid value for --first-layer-height\n"
if $self->get_value('first_layer_height') <= 0;

# --filament-diameter
die "Invalid value for --filament-diameter\n"
Expand Down
2 changes: 1 addition & 1 deletion lib/Slic3r/Fill.pm
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ sub make_fill {
# we are going to grow such regions by overlapping them with the void (if any)
# TODO: detect and investigate whether there could be narrow regions without
# any void neighbors
my $distance_between_surfaces = $infill_flow->scaled_spacing * &Slic3r::INFILL_OVERLAP_OVER_SPACING;
my $distance_between_surfaces = $infill_flow->scaled_spacing;
{
my $collapsed = diff(
[ map @{$_->expolygon}, @surfaces ],
Expand Down
4 changes: 1 addition & 3 deletions lib/Slic3r/Fill/Concentric.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ sub fill_surface {
$self->spacing(unscale $distance);
}

# compensate the overlap which is good for rectilinear but harmful for concentric
# where the perimeter/infill spacing should be equal to any other loop spacing
my @loops = my @last = @{offset(\@$expolygon, -&Slic3r::INFILL_OVERLAP_OVER_SPACING * $min_spacing / 2)};
my @loops = my @last = map $_->clone, @$expolygon;
while (@last) {
push @loops, @last = @{offset2(\@last, -($distance + 0.5*$min_spacing), +0.5*$min_spacing)};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Slic3r/Fill/Honeycomb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ sub fill_surface {
}

my @paths;
if ($params{complete}) {
if ($params{complete} || 1) {
# we were requested to complete each loop;
# in this case we don't try to make more continuous paths
@paths = map $_->split_at_first_point,
Expand Down
13 changes: 12 additions & 1 deletion lib/Slic3r/Fill/Rectilinear.pm
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,21 @@ sub fill_surface {
# the minimum offset for preventing edge lines from being clipped is scaled_epsilon;
# however we use a larger offset to support expolygons with slightly skewed sides and
# not perfectly straight
my @polylines = @{intersection_pl(\@vertical_lines, $expolygon->offset(scale 0.02))};
my @polylines = @{intersection_pl(\@vertical_lines, $expolygon->offset(+scale 0.02))};

my $extra = $self->_min_spacing * &Slic3r::INFILL_OVERLAP_OVER_SPACING;
foreach my $polyline (@polylines) {
my ($first_point, $last_point) = @$polyline[0,-1];
if ($first_point->y > $last_point->y) { #>
($first_point, $last_point) = ($last_point, $first_point);
}
$first_point->set_y($first_point->y - $extra); #--
$last_point->set_y($last_point->y + $extra); #++
}

# connect lines
unless ($params{dont_connect} || !@polylines) { # prevent calling leftmost_point() on empty collections
# offset the expolygon by max(min_spacing/2, extra)
my ($expolygon_off) = @{$expolygon->offset_ex($self->_min_spacing/2)};
my $collection = Slic3r::Polyline::Collection->new(@polylines);
@polylines = ();
Expand Down
3 changes: 3 additions & 0 deletions lib/Slic3r/Format/STL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ sub read_file {
$mesh->ReadSTLFile($path);
$mesh->repair;

die "This STL file couldn't be read because it's empty.\n"
if $mesh->facets_count == 0;

my $model = Slic3r::Model->new;

my $basename = basename($file);
Expand Down
15 changes: 9 additions & 6 deletions lib/Slic3r/GCode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ sub extrude_loop {
my $obj_ptr = 0;
if (defined $self->layer) {
$obj_ptr = $self->layer->object->ptr;
if (defined $self->_seam_position->{$self->layer->object}) {
if (defined $self->_seam_position->{$obj_ptr}) {
$last_pos = $self->_seam_position->{$obj_ptr};
}
}
Expand Down Expand Up @@ -500,11 +500,14 @@ sub pre_toolchange {

# move to the nearest standby point
if (@{$self->standby_points}) {
my $last_pos = $gcodegen->last_pos->clone;
$last_pos->translate(scale +$gcodegen->origin->x, scale +$gcodegen->origin->y); #))
my $standby_point = $last_pos->nearest_point($self->standby_points);
$standby_point->translate(scale -$gcodegen->origin->x, scale -$gcodegen->origin->y); #))
$gcode .= $gcodegen->travel_to($standby_point, undef, 'move to standby position');
# get current position in print coordinates
my $pos = Slic3r::Point->new_scale(@{$gcodegen->writer->get_position}[0,1]);

my $standby_point = Slic3r::Pointf->new_unscale(@{$pos->nearest_point($self->standby_points)});
# We don't call $gcodegen->travel_to() because we don't need retraction (it was already
# triggered by the caller) nor avoid_crossing_perimeters and also because the coordinates
# of the destination point must not be transformed by origin nor current extruder offset.
$gcode .= $gcodegen->writer->travel_to_xy($standby_point, 'move to standby position');
}

if ($gcodegen->config->standby_temperature_delta != 0) {
Expand Down
28 changes: 15 additions & 13 deletions lib/Slic3r/GUI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use Slic3r::GUI::Plater;
use Slic3r::GUI::Plater::2D;
use Slic3r::GUI::Plater::2DToolpaths;
use Slic3r::GUI::Plater::3D;
use Slic3r::GUI::Plater::3DPreview;
use Slic3r::GUI::Plater::ObjectPartsPanel;
use Slic3r::GUI::Plater::ObjectCutDialog;
use Slic3r::GUI::Plater::ObjectPreviewDialog;
use Slic3r::GUI::Plater::ObjectSettingsDialog;
use Slic3r::GUI::Plater::OverrideSettingsPanel;
use Slic3r::GUI::Preferences;
Expand All @@ -29,7 +29,7 @@ use Slic3r::GUI::OptionsGroup::Field;
use Slic3r::GUI::SimpleTab;
use Slic3r::GUI::Tab;

our $have_OpenGL = eval "use Slic3r::GUI::PreviewCanvas; 1";
our $have_OpenGL = eval "use Slic3r::GUI::3DScene; 1";
our $have_LWP = eval "use LWP::UserAgent; 1";

use Wx 0.9901 qw(:bitmap :dialog :icon :id :misc :systemsettings :toplevelwindow
Expand Down Expand Up @@ -86,9 +86,13 @@ sub OnInit {
# just checking for existence of $datadir is not enough: it may be an empty directory
# supplied as argument to --datadir; in that case we should still run the wizard
my $run_wizard = (-d $enc_datadir && -e "$enc_datadir/slic3r.ini") ? 0 : 1;
for ($enc_datadir, "$enc_datadir/print", "$enc_datadir/filament", "$enc_datadir/printer") {
mkdir or $self->fatal_error("Slic3r was unable to create its data directory at $_ (errno: $!).")
unless -d $_;
foreach my $dir ($enc_datadir, "$enc_datadir/print", "$enc_datadir/filament", "$enc_datadir/printer") {
next if -d $dir;
if (!mkdir $dir) {
my $error = "Slic3r was unable to create its data directory at $dir ($!).";
warn "$error\n";
fatal_error(undef, $error);
}
}

# load settings
Expand Down Expand Up @@ -165,22 +169,19 @@ sub catch_error {

# static method accepting a wxWindow object as first parameter
sub show_error {
my $self = shift;
my ($message) = @_;
Wx::MessageDialog->new($self, $message, 'Error', wxOK | wxICON_ERROR)->ShowModal;
my ($parent, $message) = @_;
Wx::MessageDialog->new($parent, $message, 'Error', wxOK | wxICON_ERROR)->ShowModal;
}

# static method accepting a wxWindow object as first parameter
sub show_info {
my $self = shift;
my ($message, $title) = @_;
Wx::MessageDialog->new($self, $message, $title || 'Notice', wxOK | wxICON_INFORMATION)->ShowModal;
my ($parent, $message, $title) = @_;
Wx::MessageDialog->new($parent, $message, $title || 'Notice', wxOK | wxICON_INFORMATION)->ShowModal;
}

# static method accepting a wxWindow object as first parameter
sub fatal_error {
my $self = shift;
$self->show_error(@_);
show_error(@_);
exit 1;
}

Expand Down Expand Up @@ -220,6 +221,7 @@ sub presets {
opendir my $dh, Slic3r::encode_path("$Slic3r::GUI::datadir/$section")
or die "Failed to read directory $Slic3r::GUI::datadir/$section (errno: $!)\n";
foreach my $file (grep /\.ini$/i, readdir $dh) {
$file = Slic3r::decode_path($file);
my $name = basename($file);
$name =~ s/\.ini$//;
$presets{$name} = "$Slic3r::GUI::datadir/$section/$file";
Expand Down
Loading

0 comments on commit 3ae6f26

Please sign in to comment.