From 8f789da99f7fbd6970ae8de30c02cc793267bdf4 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 30 Mar 2017 19:42:26 +0200 Subject: [PATCH 01/85] Too much stripping --- package/osx/make_dmg.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/package/osx/make_dmg.sh b/package/osx/make_dmg.sh index f82464daa..8167e6d06 100755 --- a/package/osx/make_dmg.sh +++ b/package/osx/make_dmg.sh @@ -133,7 +133,6 @@ find -d $macosfolder/local-lib -type d -path '*/Wx/*' \( -name WebView \ -or -name Ribbon \) -exec rm -rf "{}" \; find -d $macosfolder/local-lib -name libwx_osx_cocoau_ribbon-3.0.0.2.0.dylib -delete find -d $macosfolder/local-lib -name libwx_osx_cocoau_aui-3.0.0.2.0.dylib -delete -find -d $macosfolder/local-lib -name libwx_osx_cocoau_media-3.0.0.2.0.dylib -delete find -d $macosfolder/local-lib -name libwx_osx_cocoau_stc-3.0.0.2.0.dylib -delete find -d $macosfolder/local-lib -name libwx_osx_cocoau_webview-3.0.0.2.0.dylib -delete rm -rf $macosfolder/local-lib/lib/perl5/darwin-thread-multi-2level/Alien/wxWidgets/osx_cocoa_3_0_2_uni/include From ff42ad55127b804056a8f24869978fa42def75a2 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 31 Mar 2017 14:05:01 +0200 Subject: [PATCH 02/85] Added "Move to bed center" in the object menu --- lib/Slic3r/GUI/Plater.pm | 20 ++++++++++++++++++++ var/arrow_in.png | Bin 0 -> 600 bytes 2 files changed, 20 insertions(+) create mode 100755 var/arrow_in.png diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 60027cb5d..6b21b8aad 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1073,6 +1073,23 @@ sub set_number_of_copies { } } +sub center_selected_object_on_bed { + my ($self) = @_; + + my ($obj_idx, $object) = $self->selected_object; + return if !defined $obj_idx; + + my $model_object = $self->{model}->objects->[$obj_idx]; + my $bb = $model_object->bounding_box; + my $size = $bb->size; + my $vector = Slic3r::Pointf->new( + -$bb->x_min - $size->x/2, + -$bb->y_min - $size->y/2, #// + ); + $_->offset->translate(@$vector) for @{$model_object->instances}; + $self->refresh_canvases; +} + sub rotate { my $self = shift; my ($angle, $axis) = @_; @@ -2309,6 +2326,9 @@ sub object_menu { $self->set_number_of_copies; }, undef, 'textfield.png'); $menu->AppendSeparator(); + $frame->_append_menu_item($menu, "Move to bed center", 'Center object around bed center', sub { + $self->center_selected_object_on_bed; + }, undef, 'arrow_in.png'); $frame->_append_menu_item($menu, "Rotate 45° clockwise", 'Rotate the selected object by 45° clockwise', sub { $self->rotate(-45); }, undef, 'arrow_rotate_clockwise.png'); diff --git a/var/arrow_in.png b/var/arrow_in.png new file mode 100755 index 0000000000000000000000000000000000000000..745c65134db478a64016d63a7104e585452f2b9f GIT binary patch literal 600 zcmV-e0;m0nP)PbXFR5;7s zk=srhQ51%Gi+LO^77wV16dAzbG@wAMB7&i`(b(8xDqyU&#ij;pOFf{D;3PUo6_qH7 z@zCD%DY)SY{?6Vev}G>5=v^;XviDy5`&RNV6#!MZ;uAv`-s;%-AVco=6~AW@oV#X; zoCz$&Z(d;jHilq%pcXjuFe4{!G(v;>9DU>S79m;;B2ox|%Nj+MJXx5%p2GUiG!j?S z2%Y&cbj&LR9?=RJ#?#^`7Ar|SI}E|PVW`sPXn8=Gxtzq(^&D1yr10dMQz3B4@Y_lP zuSye$7RF#%H`Lg#dZzwixa6krr|(Pf7aR(KLtwFRkwCIM1ACSQfoTSJFpr@l7akX# z@D=Rv9@rED+g2a?Hy@G7U^9C3eb%8a_?P-$1a5i9WKAS#+qN85)~E=vH{A*SvKG1z z?dVFiLHkbgJ49E`%y@DfW=~%tej1}mHwt<_YB9MVMN|yeVJaZ7Jh>K;f_N^45j&cq zYibm9%abEw2)<1>?5kF^y-^EP;Mg%$3H-V=jgh?XuO0tco$p(rOKHJp92n09(Vu4V zFxf1qxGkd?5d9d=dtu7-P^)33OCji3)S!K#g=w8v*PN>ytji{-6HO9rn%8 Date: Fri, 31 Mar 2017 14:11:08 +0200 Subject: [PATCH 03/85] Fix regression from 35fc1de which hides settings from PresetEditor but leaves Controller tab always visible --- lib/Slic3r/GUI/MainFrame.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index c4ceb7780..e5ae478f9 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -99,9 +99,7 @@ sub _init_tabpanel { }); $panel->AddPage($self->{plater} = Slic3r::GUI::Plater->new($panel), "Plater"); - if (!$self->{no_controller}) { - $panel->AddPage($self->{controller} = Slic3r::GUI::Controller->new($panel), "Controller"); - } + $panel->AddPage($self->{controller} = Slic3r::GUI::Controller->new($panel), "Controller") unless ($Slic3r::GUI::Settings->{_}{no_controller}); } sub _init_menubar { @@ -259,7 +257,7 @@ sub _init_menubar { }, undef, 'application_view_tile.png'); $self->_append_menu_item($windowMenu, "&Controller\tCtrl+Y", 'Show the printer controller', sub { $self->select_tab(1); - }, undef, 'printer_empty.png') if !$self->{no_controller}; + }, undef, 'printer_empty.png') unless ($Slic3r::GUI::Settings->{_}{no_controller}); $self->_append_menu_item($windowMenu, "DLP Projector…\tCtrl+P", 'Open projector window for DLP printing', sub { $self->{plater}->pause_background_process; Slic3r::GUI::SLAPrintOptions->new($self)->ShowModal; From 478b89d9095e1c85c865bac33f98b15f78113d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xoan=20Sampai=C3=B1o?= Date: Fri, 31 Mar 2017 14:26:18 +0200 Subject: [PATCH 04/85] Minor change: break long line --- lib/Slic3r/GUI/MainFrame.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index e5ae478f9..1b07d37ef 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -99,7 +99,8 @@ sub _init_tabpanel { }); $panel->AddPage($self->{plater} = Slic3r::GUI::Plater->new($panel), "Plater"); - $panel->AddPage($self->{controller} = Slic3r::GUI::Controller->new($panel), "Controller") unless ($Slic3r::GUI::Settings->{_}{no_controller}); + $panel->AddPage($self->{controller} = Slic3r::GUI::Controller->new($panel), "Controller") + unless ($Slic3r::GUI::Settings->{_}{no_controller}); } sub _init_menubar { From 1ee70c33d57827bec83c9406c0426548d0be9d31 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 31 Mar 2017 17:04:35 +0200 Subject: [PATCH 05/85] Bugfix in flowrate.pl: negative coordinates were not parsed --- utils/post-processing/flowrate.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/post-processing/flowrate.pl b/utils/post-processing/flowrate.pl index ac09d5e9a..a928d734f 100755 --- a/utils/post-processing/flowrate.pl +++ b/utils/post-processing/flowrate.pl @@ -16,7 +16,7 @@ while (<>) { if (/^G1.*? F([0-9.]+)/) { $F = $1; } - if (/^G1 X([0-9.]+) Y([0-9.]+).*? E([0-9.]+)/) { + if (/^G1 X([0-9.-]+) Y([0-9.-]+).*? E([0-9.-]+)/) { my ($x, $y, $e) = ($1, $2, $3); my $e_length = $e - $E; if ($e_length > 0 && defined $X && defined $Y) { From 3e5ef744d76636b2e2edb1e56dc1cc4f3f230b8a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 31 Mar 2017 12:40:12 -0500 Subject: [PATCH 06/85] Suppress perl console window in slic3r.exe Also added a third executable that preserves the console, slic3r-debug-console.exe --- package/win/compile_wrapper.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/win/compile_wrapper.ps1 b/package/win/compile_wrapper.ps1 index 5704788ff..a66715e43 100644 --- a/package/win/compile_wrapper.ps1 +++ b/package/win/compile_wrapper.ps1 @@ -13,5 +13,6 @@ windres slic3r.rc -O coff -o slic3r.res g++ -c -I'C:\strawberry\perl\lib\CORE\' shell.cpp -o slic3r.o g++ -c -I'C:\strawberry\perl\lib\CORE\' -DFORCE_GUI shell.cpp -o slic3r-gui.o g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r.o slic3r.res -o slic3r-console.exe | Write-Host -g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r.exe | Write-Host +g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -mwindows -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r.exe | Write-Host +g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -mwindows -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r-debug-console.exe | Write-Host From 4480c27dc6980a2cdcb22c08f5edb540d8ffb058 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 31 Mar 2017 12:41:45 -0500 Subject: [PATCH 07/85] Added slicer-debug-console, fixed mistake Accidentally packaged slic3r-console.exe and slic3r.exe as slic3r.exe. Fixed. --- package/win/package_win32.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/win/package_win32.ps1 b/package/win/package_win32.ps1 index 302eded3d..1a98bcf27 100644 --- a/package/win/package_win32.ps1 +++ b/package/win/package_win32.ps1 @@ -44,7 +44,8 @@ cpanm "PAR::Packer" pp ` -a "slic3r.exe;slic3r.exe" ` --a "slic3r.exe;slic3r-console.exe" ` +-a "slic3r-console.exe;slic3r-console.exe" ` +-a "slic3r-debug-console.exe;slic3r-debug-console.exe" ` -a "../../lib;lib" ` -a "../../local-lib;local-lib" ` -a "../../slic3r.pl;slic3r.pl" ` From d81ad0ebc75ab5d1ba1fd5384a01bd6ce5903775 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Fri, 31 Mar 2017 12:44:50 -0500 Subject: [PATCH 08/85] Fail less at copypasta. --- package/win/compile_wrapper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/win/compile_wrapper.ps1 b/package/win/compile_wrapper.ps1 index a66715e43..a0e550d0c 100644 --- a/package/win/compile_wrapper.ps1 +++ b/package/win/compile_wrapper.ps1 @@ -14,5 +14,5 @@ g++ -c -I'C:\strawberry\perl\lib\CORE\' shell.cpp -o slic3r.o g++ -c -I'C:\strawberry\perl\lib\CORE\' -DFORCE_GUI shell.cpp -o slic3r-gui.o g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r.o slic3r.res -o slic3r-console.exe | Write-Host g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -mwindows -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r.exe | Write-Host -g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -mwindows -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r-debug-console.exe | Write-Host +g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r-debug-console.exe | Write-Host From 3271010226faf55fb050a58c3dbdbb1864f3ffd3 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 31 Mar 2017 18:44:02 +0200 Subject: [PATCH 09/85] Write mm^3/s to the G-code comments --- lib/Slic3r/GUI/OptionsGroup/Field.pm | 14 ++++--- lib/Slic3r/Print/GCode.pm | 62 +++++++++++++++++++++------- xs/src/libslic3r/Print.cpp | 20 ++++----- xs/src/libslic3r/PrintConfig.cpp | 2 +- 4 files changed, 67 insertions(+), 31 deletions(-) diff --git a/lib/Slic3r/GUI/OptionsGroup/Field.pm b/lib/Slic3r/GUI/OptionsGroup/Field.pm index 920d4cec1..9d3fb7e0e 100644 --- a/lib/Slic3r/GUI/OptionsGroup/Field.pm +++ b/lib/Slic3r/GUI/OptionsGroup/Field.pm @@ -22,9 +22,7 @@ sub get_value { sub set_tooltip { my ($self, $tooltip) = @_; - - $self->SetToolTipString($tooltip) - if $tooltip && $self->can('SetToolTipString'); + die "Method not implemented"; } sub toggle { @@ -67,8 +65,14 @@ sub _default_size { sub _trigger_wxWindow { my ($self) = @_; - $self->wxWindow->SetToolTipString($self->option->tooltip) - if $self->option->tooltip && $self->wxWindow->can('SetToolTipString'); + $self->set_tooltip($self->option->tooltip); +} + +sub set_tooltip { + my ($self, $tooltip) = @_; + + $self->wxWindow->SetToolTipString($tooltip) + if $self->wxWindow->can('SetToolTipString'); } sub set_value { diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 3faad8317..02f719d4d 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -80,22 +80,56 @@ sub export { my $layer_height = $first_object->config->layer_height; for my $region_id (0..$#{$self->print->regions}) { my $region = $self->print->regions->[$region_id]; - printf $fh "; external perimeters extrusion width = %.2fmm\n", - $region->flow(FLOW_ROLE_EXTERNAL_PERIMETER, $layer_height, 0, 0, -1, $first_object)->width; - printf $fh "; perimeters extrusion width = %.2fmm\n", - $region->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 0, -1, $first_object)->width; - printf $fh "; infill extrusion width = %.2fmm\n", - $region->flow(FLOW_ROLE_INFILL, $layer_height, 0, 0, -1, $first_object)->width; - printf $fh "; solid infill extrusion width = %.2fmm\n", - $region->flow(FLOW_ROLE_SOLID_INFILL, $layer_height, 0, 0, -1, $first_object)->width; - printf $fh "; top infill extrusion width = %.2fmm\n", - $region->flow(FLOW_ROLE_TOP_SOLID_INFILL, $layer_height, 0, 0, -1, $first_object)->width; - printf $fh "; support material extrusion width = %.2fmm\n", - $self->objects->[0]->support_material_flow->width - if $self->print->has_support_material; - printf $fh "; first layer extrusion width = %.2fmm\n", + + { + my $flow = $region->flow(FLOW_ROLE_EXTERNAL_PERIMETER, $layer_height, 0, 0, -1, $first_object); + my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('external_perimeter_speed'); + $vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0; + printf $fh "; external perimeters extrusion width = %.2fmm (%.2fmm^3/s)\n", + $flow->width, $vol_speed; + } + { + my $flow = $region->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 0, -1, $first_object); + my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('perimeter_speed'); + $vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0; + printf $fh "; perimeters extrusion width = %.2fmm (%.2fmm^3/s)\n", + $flow->width, $vol_speed; + } + { + my $flow = $region->flow(FLOW_ROLE_INFILL, $layer_height, 0, 0, -1, $first_object); + my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('infill_speed'); + $vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0; + printf $fh "; infill extrusion width = %.2fmm (%.2fmm^3/s)\n", + $flow->width, $vol_speed; + } + { + my $flow = $region->flow(FLOW_ROLE_SOLID_INFILL, $layer_height, 0, 0, -1, $first_object); + my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('solid_infill_speed'); + $vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0; + printf $fh "; solid infill extrusion width = %.2fmm (%.2fmm^3/s)\n", + $flow->width, $vol_speed; + } + { + my $flow = $region->flow(FLOW_ROLE_TOP_SOLID_INFILL, $layer_height, 0, 0, -1, $first_object); + my $vol_speed = $flow->mm3_per_mm * $region->config->get_abs_value('top_solid_infill_speed'); + $vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0; + printf $fh "; top infill extrusion width = %.2fmm (%.2fmm^3/s)\n", + $flow->width, $vol_speed; + } + + if ($self->print->has_support_material) { + my $object0 = $self->objects->[0]; + my $flow = $object0->support_material_flow; + my $vol_speed = $flow->mm3_per_mm / $object0->config->get_abs_value('support_material_speed'); + $vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0; + printf $fh "; support material extrusion width = %.2fmm (%.2fmm^3/s)\n", + $flow->width, $vol_speed; + } + + printf $fh "; first layer extrusion width = %.2fmm (%.2fmm^3/s)\n", $region->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 1, -1, $self->objects->[0])->width if $region->config->first_layer_extrusion_width; + print $fh "\n"; } diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 35f6e13e4..a54e9e1ab 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -813,21 +813,19 @@ Print::_make_brim() const coord_t grow_distance = flow.scaled_width()/2; Polygons islands; - FOREACH_OBJECT(this, object) { - const Layer &layer0 = *(*object)->get_layer(0); + for (PrintObject* object : this->objects) { + const Layer* layer0 = object->get_layer(0); - Polygons object_islands = layer0.slices.contours(); + Polygons object_islands = layer0->slices.contours(); - if (!(*object)->support_layers.empty()) { - const SupportLayer &support_layer0 = *(*object)->get_support_layer(0); + if (!object->support_layers.empty()) { + const SupportLayer* support_layer0 = object->get_support_layer(0); - for (ExtrusionEntitiesPtr::const_iterator it = support_layer0.support_fills.entities.begin(); - it != support_layer0.support_fills.entities.end(); ++it) - append_to(object_islands, offset((*it)->as_polyline(), grow_distance)); + for (const ExtrusionEntity* e : support_layer0.support_fills.entities) + append_to(object_islands, offset(e->as_polyline(), grow_distance)); - for (ExtrusionEntitiesPtr::const_iterator it = support_layer0.support_interface_fills.entities.begin(); - it != support_layer0.support_interface_fills.entities.end(); ++it) - append_to(object_islands, offset((*it)->as_polyline(), grow_distance)); + for (const ExtrusionEntity* e : support_layer0.support_interface_fills.entities) + append_to(object_islands, offset(e->as_polyline(), grow_distance)); } for (const Point © : (*object)->_shifted_copies) { for (Polygon p : object_islands) { diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index c76a3fa24..a8e346c80 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -751,7 +751,7 @@ PrintConfigDef::PrintConfigDef() def = this->add("max_volumetric_speed", coFloat); def->label = "Max volumetric speed"; def->category = "Speed"; - def->tooltip = "This experimental setting is used to set the maximum volumetric speed your extruder supports."; + def->tooltip = "If set to a non-zero value, extrusion will be limited to this volumetric speed. You may want to set it to your extruder maximum. As a hint, you can read calculated volumetric speeds in the comments of any G-code file you export from Slic3r."; def->sidetext = "mm³/s"; def->cli = "max-volumetric-speed=f"; def->min = 0; From 5a54c79df620aff5fddf2ea3bf001dc2c0ac6762 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 1 Apr 2017 10:50:47 +0200 Subject: [PATCH 10/85] Fixed regression, bad commit --- xs/src/libslic3r/Print.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index a54e9e1ab..36ce27a8a 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -821,13 +821,13 @@ Print::_make_brim() if (!object->support_layers.empty()) { const SupportLayer* support_layer0 = object->get_support_layer(0); - for (const ExtrusionEntity* e : support_layer0.support_fills.entities) + for (const ExtrusionEntity* e : support_layer0->support_fills.entities) append_to(object_islands, offset(e->as_polyline(), grow_distance)); - for (const ExtrusionEntity* e : support_layer0.support_interface_fills.entities) + for (const ExtrusionEntity* e : support_layer0->support_interface_fills.entities) append_to(object_islands, offset(e->as_polyline(), grow_distance)); } - for (const Point © : (*object)->_shifted_copies) { + for (const Point © : object->_shifted_copies) { for (Polygon p : object_islands) { p.translate(copy); islands.push_back(p); From 1709e20aedd5b9c629b5a9c0787605e95be70a00 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 1 Apr 2017 23:40:06 -0500 Subject: [PATCH 11/85] Slic3r packaging for Linux via TravisCI (#3831) * linux packaging script should be functional now (from travis) * Updated travis to build with distribution * Moved cache management to script. * Add perlbrew download * Point to my server and use the correct perlbrew path. * added bintray encrypted link * used right script name * fixed deploy path and used correct deploy * Updated to use TRAVIS_COMMIT env variable * updating deployment for travis * oops, inverted logic * Cleanup of files, renamed make_par to make_archive. Factored out some functions to common/util.sh * replaced slic3r dir with current dir (not script dir) * ensured PAR::Packer is installed. * added -v to install * can't mix globbing and shell replacement in the same thing. * adding some debug code, setting sudo: false * factored out get_app_name * added set version to utils * prototype appimage * cache perlbrew, added ./ to WD in make_archive * added more noise * sudo-false takes twice as long to build for some stupid reason. * make unzip quiet. * run ldd bundle to see output * quiet down tar, set ld library path --- .travis.yml | 42 ++++++----- package/common/util.sh | 84 ++++++++++++++++++++++ package/deploy-bintray.sh | 37 ++-------- package/linux/appimage-bundler.sh | 45 ++++++++++++ package/linux/make_archive.sh | 116 ++++++++++++++++++++++++++++++ package/linux/package_linux.sh | 6 -- package/linux/slic3r.desktop.in | 13 ++++ package/linux/startup_script.sh | 5 ++ package/linux/travis-setup.sh | 17 +++++ 9 files changed, 310 insertions(+), 55 deletions(-) create mode 100644 package/common/util.sh create mode 100755 package/linux/appimage-bundler.sh create mode 100755 package/linux/make_archive.sh delete mode 100755 package/linux/package_linux.sh create mode 100644 package/linux/slic3r.desktop.in create mode 100644 package/linux/startup_script.sh create mode 100755 package/linux/travis-setup.sh diff --git a/.travis.yml b/.travis.yml index a34433a9b..ede2099d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,43 @@ language: perl -install: export LDLOADLIBS=-lstdc++ -script: perl ./Build.PL -perl: - - "5.14" - - "5.18" - - "5.20" +install: +- export LDLOADLIBS=-lstdc++ +- export BOOST_DIR=$HOME/boost_1_63_0 +- export SLIC3R_STATIC=1 +- export CXX=g++-4.9 +- export CC=g++-4.9 +- source $HOME/perl5/perlbrew/etc/bashrc +script: +- bash package/linux/travis-setup.sh +- perlbrew switch slic3r-perl +- perl ./Build.PL +after_success: +- package/linux/make_archive.sh linux-x64 +- package/deploy-bintray.sh *.bz2 branches: only: - - master - - xsgui -sudo: false + - master + - xsgui cache: apt: true directories: - - local-lib + - "$HOME/cache" + - "$HOME/perl5/perlbrew" addons: apt: sources: - - boost-latest - ubuntu-toolchain-r-test packages: - - libboost-thread1.55-dev - - libboost-system1.55-dev - - libboost-filesystem1.55-dev - - liblocal-lib-perl - g++-4.9 -env: CC=g++-4.9 + - gcc-4.9 notifications: irc: channels: - - "chat.freenode.net#slic3r" + - chat.freenode.net#slic3r on_success: change on_failure: always use_notice: true +sudo: required +dist: trusty +env: + matrix: + - secure: esNwHmYdri6Wn/AruRMLqk+HWelnLaPPNtLysGvdwp4K26K81Ys++1/M00IRgZi2LDqXWNlIUAcDCFMlKpZ0m6o0r0q4ukIiMRFFbg2cTGHW8qBuHIEmNliex9uFquU1r5PVEl4eVbHbhNjUDeMwlF74A+3PUxTEvI2X0rLdMKM= diff --git a/package/common/util.sh b/package/common/util.sh new file mode 100644 index 000000000..e27151d83 --- /dev/null +++ b/package/common/util.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +# must be run from the root +function set_version () +{ +SLIC3R_VERSION=$(grep "VERSION" xs/src/libslic3r/libslic3r.h | awk -F\" '{print $2}') +} +# Cache the SHA1 for this build commit. +function get_commit () { + if [ ! -z ${TRAVIS_COMMIT+x} ]; then + # Travis sets the sha1 in TRAVIS_COMMIT + COMMIT_SHA1=$(git rev-parse --short $TRAVIS_COMMIT) + else + # should be able to get it properly + COMMIT_SHA1=$(git rev-parse --short HEAD) + fi +} +function set_build_id () +{ +echo "Setting SLIC3R_BUILD_ID" +if [ $(git describe &>/dev/null) ]; then + SLIC3R_BUILD_ID=$(git describe) + TAGGED=true +else + SLIC3R_BUILD_ID=${SLIC3R_VERSION}-${COMMIT_SHA1} +fi + +} + +function set_branch () +{ + echo "Setting current_branch" + if [ -z ${TRAVIS_BRANCH} ] && [ -z ${GIT_BRANCH+x} ] && [ -z ${APPVEYOR_REPO_BRANCH+x} ]; then + current_branch=$(git symbolic-ref HEAD | sed 's!refs\/heads\/!!') + else + current_branch="unknown" + if [ ! -z ${GIT_BRANCH+x} ]; then + echo "Setting to GIT_BRANCH" + current_branch=$(echo $GIT_BRANCH | cut -d / -f 2) + fi + if [ ! -z ${APPVEYOR_REPO_BRANCH+x} ]; then + echo "Setting to APPVEYOR_REPO_BRANCH" + current_branch=$APPVEYOR_REPO_BRANCH + fi + if [ ! -z ${TRAVIS_BRANCH} ]; then + echo "Setting to TRAVIS_BRANCH" + current_branch=$TRAVIS_BRANCH + fi + fi + + if [ -z ${current_branch+x} ]; then + current_branch="unknown" + fi +} + +function set_app_name () +{ + set_branch + if [ "$current_branch" == "master" ]; then + appname=Slic3r + else + appname=Slic3r-${current_branch} + fi +} + + +function set_pr_id () +{ + echo "Setting PR_ID if available." + if [ ! -z ${GITHUB_PR_NUMBER+x} ]; then + PR_ID=$GITHUB_PR_NUMBER + fi + if [ ! -z ${APPVEYOR_PULL_REQUEST_NUMBER+x} ]; then + PR_ID=$APPVEYOR_PULL_REQUEST_NUMBER + fi + if [ ! -z ${TRAVIS_PULL_REQUEST_BRANCH+x} ]; then + PR_ID=$TRAVIS_PULL_REQUEST + fi +} + +function install_par () +{ + cpanm PAR::Packer +} diff --git a/package/deploy-bintray.sh b/package/deploy-bintray.sh index c24fa62b8..35b73da49 100755 --- a/package/deploy-bintray.sh +++ b/package/deploy-bintray.sh @@ -5,39 +5,12 @@ # BINTRAY_API_USER - Bintray username. # Run this from the repository root (required to get slic3r version) +source $(dirname $0)/common/util.sh SLIC3R_VERSION=$(grep "VERSION" xs/src/libslic3r/libslic3r.h | awk -F\" '{print $2}') -if [ $(git describe &>/dev/null) ]; then - SLIC3R_BUILD_ID=$(git describe) - TAGGED=true -else - SLIC3R_BUILD_ID=${SLIC3R_VERSION}-$(git rev-parse --short HEAD) -fi -if [ -z ${GIT_BRANCH+x} ] && [ -z ${APPVEYOR_REPO_BRANCH+x} ]; then - current_branch=$(git symbolic-ref HEAD | sed 's!refs\/heads\/!!') -else - current_branch="unknown" - if [ ! -z ${GIT_BRANCH+x} ]; then - echo "Setting to GIT_BRANCH" - current_branch=$(echo $GIT_BRANCH | cut -d / -f 2) - fi - if [ ! -z ${APPVEYOR_REPO_BRANCH+x} ]; then - echo "Setting to APPVEYOR_REPO_BRANCH" - current_branch=$APPVEYOR_REPO_BRANCH - fi -fi - -if [ -z ${current_branch+x} ]; then - current_branch="unknown" -fi - -if [ ! -z ${GITHUB_PR_NUMBER+x} ]; then - PR_ID=$GITHUB_PR_NUMBER -fi -if [ ! -z ${APPVEYOR_PULL_REQUEST_NUMBER+x} ]; then - PR_ID=$APPVEYOR_PULL_REQUEST_NUMBER -fi - - +get_commit +set_build_id +set_branch +set_pr_id if [ "$current_branch" == "master" ] && [ -z ${PR_ID} ]; then # If building master, goes in slic3r_dev or slic3r, depending on whether or not this is a tagged build if [ -z ${TAGGED+x} ]; then diff --git a/package/linux/appimage-bundler.sh b/package/linux/appimage-bundler.sh new file mode 100755 index 000000000..d12cb2129 --- /dev/null +++ b/package/linux/appimage-bundler.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +WD=$(dirname $0) +source $(dirname $0)/../common/util.sh +set_version +set_app_name +LOWERAPP=${appname,,} +wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh +. ./functions.sh + +srcfolder="$WD/${appname}" +if [ ! -e $srcfolder ]; then + echo "Run make_archive first." + exit 1 +fi + +cd $srcfolder + +# make shell exec and call it Slic3r + +mkdir -p /usr/{lib,bin} +mv -R Slic3r local-lib var perl-local slic3r.pl /usr/bin +mv -R bin/* /usr/lib +rm -rf bin + +get_apprun + +# Copy desktop and icon file to application root dir for Apprun to pick them up. +sed -e "s|SLIC3R_VERSION|$SLIC3R_VERSION|" -e"s|APPLICATION_NAME|$appname|" ../slic3r.desktop.in > ../slic3r.desktop +cp ../slic3r.desktop $LOWERAPP.desktop +cp ./var/Slic3r_192px_transparent.png ./slic3r.png + +# archive directory has everything we need. +delete_blacklisted + +get_desktopintegration $LOWERAPP + +GLIBC_NEEDED=$(glibc_needed) +VERSION=git$GIT_REV-glibc$GLIBC_NEEDED + +cd .. +mkdir -p out +generate_appimage + +transfer ../out/* diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh new file mode 100755 index 000000000..92ce34e68 --- /dev/null +++ b/package/linux/make_archive.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +# Assembles an installation archive from a built copy of Slic3r. +# Requires PAR::Packer to be installed for the version of +# perl copied. +# Adapted from script written by bubnikv for Prusa3D. +# Run from slic3r repo root directory. + +if [ "$#" -ne 1 ]; then + echo "Usage: $(basename $0) arch_name" + exit 1; +fi +libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) +WD=./$(dirname $0) +source $(dirname $0)/../common/util.sh +# Determine if this is a tagged (release) commit. +# Change the build id accordingly. + +set_version +get_commit +set_build_id +set_branch +set_app_name +set_pr_id +install_par + +# If we're on a branch, add the branch name to the app name. +if [ "$current_branch" == "master" ]; then + dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}.tar.bz2 +else + dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}-${current_branch}.tar.bz2 +fi + +rm -rf $WD/_tmp +mkdir -p $WD/_tmp + +# Set the application folder infomation. +appfolder="$WD/${appname}" +archivefolder=$appfolder +resourcefolder=$appfolder + +echo "Appfolder: $appfolder, archivefolder: $archivefolder" + +# Our slic3r dir and location of perl +PERL_BIN=$(which perl) +PP_BIN=$(which pp) +SLIC3R_DIR="./" + +if [[ -d "${appfolder}" ]]; then + echo "Deleting old working folder: ${appfolder}" + rm -rf ${appfolder} +fi + +if [[ -e "${dmgfile}" ]]; then + echo "Deleting old archive: ${dmgfile}" + rm -rf ${dmgfile} +fi + +echo "Creating new app folder: $appfolder" +mkdir -p $appfolder + +echo "Copying resources..." +cp -rf $SLIC3R_DIR/var $resourcefolder/ +mv $resourcefolder/var/Slic3r.icns $resourcefolder + +echo "Copying Slic3r..." +cp $SLIC3R_DIR/slic3r.pl $archivefolder/slic3r.pl +cp -fRP $SLIC3R_DIR/local-lib $archivefolder/local-lib +cp -fRP $SLIC3R_DIR/lib/* $archivefolder/local-lib/lib/perl5/ + +mkdir $archivefolder/bin +echo "Symlinking libraries to $archivefolder/bin ..." +for bundle in $(find $archivefolder/local-lib/lib/perl5 -name '*.so' | grep "Wx") $(find $archivefolder/local-lib/lib/perl5 -name '*.so' -type f | grep "wxWidgets"); do + echo "$(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}')" + for dylib in $(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}'); do + install -v $dylib $archivefolder/bin + done +done + +echo "Copying startup script..." +cp -f $WD/startup_script.sh $archivefolder/$appname +chmod +x $archivefolder/$appname + +echo "Copying perl from $PERL_BIN" +cp -f $PERL_BIN $archivefolder/perl-local +${PP_BIN} -M attributes -M base -M bytes -M B -M POSIX \ + -M FindBin -M Unicode::Normalize -M Tie::Handle \ + -M Time::Local -M Math::Trig \ + -M lib -M overload \ + -M warnings -M local::lib \ + -M strict -M utf8 -M parent \ + -B -p -e "print 123" -o $WD/_tmp/test.par +unzip -qq -o $WD/_tmp/test.par -d $WD/_tmp/ +cp -rf $WD/_tmp/lib/* $archivefolder/local-lib/lib/perl5/ +rm -rf $WD/_tmp + +echo "Cleaning local-lib" +rm -rf $archivefolder/local-lib/bin +rm -rf $archivefolder/local-lib/man +rm -f $archivefolder/local-lib/lib/perl5/Algorithm/*.pl +rm -rf $archivefolder/local-lib/lib/perl5/unicore +rm -rf $archivefolder/local-lib/lib/perl5/App +rm -rf $archivefolder/local-lib/lib/perl5/Devel/CheckLib.pm +rm -rf $archivefolder/local-lib/lib/perl5/ExtUtils +rm -rf $archivefolder/local-lib/lib/perl5/Module/Build* +rm -rf $(pwd)$archivefolder/local-lib/lib/perl5/TAP +rm -rf $(pwd)/$archivefolder/local-lib/lib/perl5/Test* +find $(pwd)/$archivefolder/local-lib -type d -path '*/Wx/*' \( -name WebView \ + -or -name DocView -or -name STC -or -name IPC \ + -or -name AUI -or -name Calendar -or -name DataView \ + -or -name DateTime -or -name Media -or -name PerlTest \ + -or -name Ribbon \) -exec rm -rf "{}" \; +rm -rf $archivefolder/local-lib/lib/perl5/*/Alien/wxWidgets/*/include +find $archivefolder/local-lib -depth -type d -empty -exec rmdir "{}" \; + +tar -C$(pwd)/$(dirname $appfolder) -cjf $(pwd)/$dmgfile "$appname" diff --git a/package/linux/package_linux.sh b/package/linux/package_linux.sh deleted file mode 100755 index 9133f23b2..000000000 --- a/package/linux/package_linux.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Written by Joseph Lenox -# Licensed under the same license as the rest of Slic3r. -# ------------------------ - -pp -a "../../utils;utils" -a "../../var;var" -a "../../lib;lib" -a "../../local-lib;local-lib" -a "../../slic3r.pl;slic3r.pl" -M AutoLoader -M B -M Carp -M Class::Accessor -M Class::XSAccessor -M Class::XSAccessor::Heavy -M Config -M Cwd -M Devel::GlobalDestruction -M Digest -M Digest::MD5 -M Digest::SHA -M Digest::base -M DynaLoader -M Errno -M Exporter -M Exporter::Heavy -M Fcntl -M File::Basename -M File::Glob -M File::Spec -M File::Spec::Unix -M File::Spec::Win32 -M FindBin -M HTTP::Config -M HTTP::Date -M HTTP::Headers -M HTTP::Headers::Util -M HTTP::Message -M HTTP::Request -M HTTP::Request::Common -M HTTP::Response -M HTTP::Status -M IO -M IO::Handle -M IO::Select -M LWP -M LWP::MediaTypes -M LWP::MemberMixin -M LWP::Protocol -M LWP::Protocol::http -M LWP::UserAgent -M List::Util -M Math::Trig -M Method::Generate::Accessor -M Method::Generate::BuildAll -M Method::Generate::Constructor -M Module::Runtime -M POSIX -M Pod::Escapes -M Pod::Text -M Pod::Usage -M SelectSaver -M Socket -M Socket6 -M Storable -M Sub::Defer -M Sub::Exporter -M Sub::Exporter::Progressive -M Sub::Name -M Symbol -M Term::Cap -M Text::ParseWords -M Thread -M Thread::Queue -M Thread::Semaphore -M Tie::Handle -M Tie::Hash -M Tie::StdHandle -M Time::Local -M URI -M URI::Escape -M URI::http -M Unicode::Normalize -M XSLoader -B -M lib -p ../../slic3r.pl -o ../../slic3r.par diff --git a/package/linux/slic3r.desktop.in b/package/linux/slic3r.desktop.in new file mode 100644 index 000000000..0e1203ebf --- /dev/null +++ b/package/linux/slic3r.desktop.in @@ -0,0 +1,13 @@ +[Desktop Entry] + +Type=Application + +Version=SLIC3R_VERSION + +Name=APPLICATION_NAME + +Comment=Prepare 3D Models for printing + +Icon=slic3r + +Exec=Slic3r diff --git a/package/linux/startup_script.sh b/package/linux/startup_script.sh new file mode 100644 index 000000000..82757118b --- /dev/null +++ b/package/linux/startup_script.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +DIR=$(dirname "$0") +export LD_LIBRARY_PATH=./bin +exec "$DIR/perl-local" -I"$DIR/local-lib/lib/perl5" "$DIR/slic3r.pl" $@ diff --git a/package/linux/travis-setup.sh b/package/linux/travis-setup.sh new file mode 100755 index 000000000..cfc67227b --- /dev/null +++ b/package/linux/travis-setup.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Script to configure travis environment prior to build +if [ ! -e $HOME/cache/slic3r-perlbrew-5.24.tar.bz2 ]; then + curl -L "https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=slic3r-perl.524.travis.tar.bz2" -o $HOME/cache/slic3r-perlbrew-5.24.tar.bz2; +fi + +if [ ! -e $HOME/cache/boost-compiled.tar.bz2 ]; then + curl -L "http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2" -o $HOME/cache/boost-compiled.tar.bz2 +fi + +if [ ! -e $HOME/cache/local-lib.tar.bz2 ]; then + curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis.tar.bz2" -o $HOME/cache/local-lib.tar.bz2 +fi + +tar -C$TRAVIS_BUILD_DIR -xjf $HOME/cache/local-lib.tar.bz2 +tar -C$HOME/perl5/perlbrew/perls -xjf $HOME/cache/slic3r-perlbrew-5.24.tar.bz2 +tar -C$HOME -xjf $HOME/cache/boost-compiled.tar.bz2 From cc45494a2dd72c5de8b69da0a376f0b67231300a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 08:24:44 -0500 Subject: [PATCH 12/85] Switched to using wx 3.0.2 --- package/linux/travis-setup.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/linux/travis-setup.sh b/package/linux/travis-setup.sh index cfc67227b..b0ba36316 100755 --- a/package/linux/travis-setup.sh +++ b/package/linux/travis-setup.sh @@ -1,5 +1,7 @@ #!/bin/bash # Script to configure travis environment prior to build +WXVERSION=302 + if [ ! -e $HOME/cache/slic3r-perlbrew-5.24.tar.bz2 ]; then curl -L "https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=slic3r-perl.524.travis.tar.bz2" -o $HOME/cache/slic3r-perlbrew-5.24.tar.bz2; fi @@ -8,10 +10,10 @@ if [ ! -e $HOME/cache/boost-compiled.tar.bz2 ]; then curl -L "http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2" -o $HOME/cache/boost-compiled.tar.bz2 fi -if [ ! -e $HOME/cache/local-lib.tar.bz2 ]; then - curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis.tar.bz2" -o $HOME/cache/local-lib.tar.bz2 +if [ ! -e $HOME/cache/local-lib-wx$WXVERSION.tar.bz2 ]; then + curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx$WXVERSION.tar.bz2" -o $HOME/cache/local-lib-wx$WXVERSION.tar.bz2 fi -tar -C$TRAVIS_BUILD_DIR -xjf $HOME/cache/local-lib.tar.bz2 +tar -C$TRAVIS_BUILD_DIR -xjf $HOME/cache/local-lib-wx$WXVERSION.tar.bz2 tar -C$HOME/perl5/perlbrew/perls -xjf $HOME/cache/slic3r-perlbrew-5.24.tar.bz2 tar -C$HOME -xjf $HOME/cache/boost-compiled.tar.bz2 From b7aa965fc88bfdb0360cdefb5d756ad7a5ccad84 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 08:43:05 -0500 Subject: [PATCH 13/85] Gee thanks travis for not just unsetting variables if they have nonsense data in them --- package/common/util.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/common/util.sh b/package/common/util.sh index e27151d83..d8d515925 100644 --- a/package/common/util.sh +++ b/package/common/util.sh @@ -43,8 +43,10 @@ function set_branch () current_branch=$APPVEYOR_REPO_BRANCH fi if [ ! -z ${TRAVIS_BRANCH} ]; then - echo "Setting to TRAVIS_BRANCH" - current_branch=$TRAVIS_BRANCH + if [ "${TRAVIS_BRANCH}" != "false" ]; then + echo "Setting to TRAVIS_BRANCH" + current_branch=$TRAVIS_BRANCH + fi fi fi From d325248baf56a979eb38f9eba30878538a96e09a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 09:23:42 -0500 Subject: [PATCH 14/85] Load precached wxlibs --- package/linux/travis-setup.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/package/linux/travis-setup.sh b/package/linux/travis-setup.sh index b0ba36316..fc843a57a 100755 --- a/package/linux/travis-setup.sh +++ b/package/linux/travis-setup.sh @@ -10,10 +10,17 @@ if [ ! -e $HOME/cache/boost-compiled.tar.bz2 ]; then curl -L "http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2" -o $HOME/cache/boost-compiled.tar.bz2 fi -if [ ! -e $HOME/cache/local-lib-wx$WXVERSION.tar.bz2 ]; then - curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx$WXVERSION.tar.bz2" -o $HOME/cache/local-lib-wx$WXVERSION.tar.bz2 +if [ ! -e $HOME/cache/local-lib-wx${WXVERSION}.tar.bz2 ]; then + curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx${WXVERSION}.tar.bz2" -o $HOME/cache/local-lib-wx${WXVERSION}.tar.bz2 fi -tar -C$TRAVIS_BUILD_DIR -xjf $HOME/cache/local-lib-wx$WXVERSION.tar.bz2 +if [ ! -e $HOME/cache/wx${WXVERSION}.tar.bz2 ]; then + curl -L "http://www.siusgs.com/slic3r/buildserver/wx${WXVERSION}-libs.tar.bz2" -o $HOME/cache/wx${WXVERSION}.tar.bz2 +fi + + + +tar -C$TRAVIS_BUILD_DIR -xjf $HOME/cache/local-lib-wx${WXVERSION}.tar.bz2 tar -C$HOME/perl5/perlbrew/perls -xjf $HOME/cache/slic3r-perlbrew-5.24.tar.bz2 tar -C$HOME -xjf $HOME/cache/boost-compiled.tar.bz2 +tar -C$HOME -xjf $HOME/cache/wx${WXVERSION}.tar.bz2 From 25dce5a1985b414f468c40ff0e42399d0557d9ab Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 09:50:36 -0500 Subject: [PATCH 15/85] fixing PR_ID calculation because travis --- package/common/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/common/util.sh b/package/common/util.sh index d8d515925..3a30c74e9 100644 --- a/package/common/util.sh +++ b/package/common/util.sh @@ -75,7 +75,7 @@ function set_pr_id () if [ ! -z ${APPVEYOR_PULL_REQUEST_NUMBER+x} ]; then PR_ID=$APPVEYOR_PULL_REQUEST_NUMBER fi - if [ ! -z ${TRAVIS_PULL_REQUEST_BRANCH+x} ]; then + if [ ! -z ${TRAVIS_PULL_REQUEST_BRANCH+x} ] && [ "${TRAVIS_PULL_REQUEST_BRANCH}" != "false" ] ; then PR_ID=$TRAVIS_PULL_REQUEST fi } From 4304c2a1f456a240b23e5e4f59b683b0f12b470b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 10:12:03 -0500 Subject: [PATCH 16/85] fixed this time? --- package/common/util.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package/common/util.sh b/package/common/util.sh index 3a30c74e9..5efeacac5 100644 --- a/package/common/util.sh +++ b/package/common/util.sh @@ -75,9 +75,14 @@ function set_pr_id () if [ ! -z ${APPVEYOR_PULL_REQUEST_NUMBER+x} ]; then PR_ID=$APPVEYOR_PULL_REQUEST_NUMBER fi - if [ ! -z ${TRAVIS_PULL_REQUEST_BRANCH+x} ] && [ "${TRAVIS_PULL_REQUEST_BRANCH}" != "false" ] ; then + if [ ! -z ${TRAVIS_PULL_REQUEST_BRANCH+x} ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ] ; then PR_ID=$TRAVIS_PULL_REQUEST fi + if [ ! -z ${PR_ID+x} ]; then + echo "Setting PR_ID to $PR_ID." + else + echo "PR_ID remains unset." + fi } function install_par () From 678ae9de72a920dc919c23ad1093dcdbd8d7c607 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 1 Apr 2017 17:23:07 +0200 Subject: [PATCH 17/85] Keep brim always attached to the object when support material is enabled. #2981 --- lib/Slic3r/Print/SupportMaterial.pm | 17 +++++++++++++---- xs/src/libslic3r/Fill/Fill.cpp | 3 +++ xs/src/libslic3r/Flow.cpp | 5 +++++ xs/src/libslic3r/Flow.hpp | 2 +- xs/src/libslic3r/Print.cpp | 14 +++++++++++--- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/Slic3r/Print/SupportMaterial.pm b/lib/Slic3r/Print/SupportMaterial.pm index 4314e4fa6..d9b8b3313 100644 --- a/lib/Slic3r/Print/SupportMaterial.pm +++ b/lib/Slic3r/Print/SupportMaterial.pm @@ -8,7 +8,7 @@ use Slic3r::ExtrusionPath ':roles'; use Slic3r::Flow ':roles'; use Slic3r::Geometry qw(epsilon scale scaled_epsilon PI rad2deg deg2rad convex_hull); use Slic3r::Geometry::Clipper qw(offset diff union union_ex intersection offset_ex offset2 - intersection_pl offset2_ex diff_pl); + intersection_pl offset2_ex diff_pl diff_ex); use Slic3r::Surface ':types'; has 'print_config' => (is => 'rw', required => 1); @@ -782,7 +782,7 @@ sub generate_toolpaths { my $base_flow = $_flow; # find centerline of the external loop/extrusions - my $to_infill = offset2_ex($base, +scaled_epsilon, -(scaled_epsilon + $_flow->scaled_width/2)); + my $to_infill = offset2($base, +scaled_epsilon, -(scaled_epsilon + $_flow->scaled_width/2)); my @paths = (); @@ -796,6 +796,15 @@ sub generate_toolpaths { # use the proper spacing for first layer as we don't need to align # its pattern to the other layers $filler->set_min_spacing($base_flow->spacing); + + # subtract brim so that it goes around the object fully (and support gets its own brim) + if ($self->print_config->brim_width > 0) { + my $d = +scale $self->print_config->brim_width*2; + $to_infill = diff_ex( + $to_infill, + offset($object->get_layer(0)->slices->polygons, $d), + ); + } } else { # draw a perimeter all around support infill # TODO: use brim ordering algorithm @@ -806,10 +815,10 @@ sub generate_toolpaths { mm3_per_mm => $mm3_per_mm, width => $_flow->width, height => $layer->height, - ), map @$_, @$to_infill; + ), @$to_infill; # TODO: use offset2_ex() - $to_infill = offset_ex([ map @$_, @$to_infill ], -$_flow->scaled_spacing); + $to_infill = offset_ex($to_infill, -$_flow->scaled_spacing); } my $mm3_per_mm = $base_flow->mm3_per_mm; diff --git a/xs/src/libslic3r/Fill/Fill.cpp b/xs/src/libslic3r/Fill/Fill.cpp index c88a32514..555081616 100644 --- a/xs/src/libslic3r/Fill/Fill.cpp +++ b/xs/src/libslic3r/Fill/Fill.cpp @@ -1,3 +1,6 @@ +#define DEBUG +#undef NDEBUG +#include #include #include diff --git a/xs/src/libslic3r/Flow.cpp b/xs/src/libslic3r/Flow.cpp index 6131534e7..a0cd62236 100644 --- a/xs/src/libslic3r/Flow.cpp +++ b/xs/src/libslic3r/Flow.cpp @@ -50,6 +50,11 @@ Flow::spacing() const { return this->width - OVERLAP_FACTOR * (this->width - min_flow_spacing); } +void +Flow::set_spacing(float spacing) { + this->width = Flow::_width_from_spacing(spacing, this->nozzle_diameter, this->height, this->bridge); +} + /* This method returns the centerline spacing between an extrusion using this flow and another one using another flow. this->spacing(other) shall return the same value as other.spacing(*this) */ diff --git a/xs/src/libslic3r/Flow.hpp b/xs/src/libslic3r/Flow.hpp index fdfcac695..8284cc6d6 100644 --- a/xs/src/libslic3r/Flow.hpp +++ b/xs/src/libslic3r/Flow.hpp @@ -30,6 +30,7 @@ class Flow : width(_w), height(_h), nozzle_diameter(_nd), bridge(_bridge) {}; float spacing() const; float spacing(const Flow &other) const; + void set_spacing(float spacing); double mm3_per_mm() const; coord_t scaled_width() const { return scale_(this->width); @@ -48,7 +49,6 @@ class Flow static float _bridge_width(float nozzle_diameter, float bridge_flow_ratio); static float _auto_width(FlowRole role, float nozzle_diameter, float height); static float _width_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge); - static float _spacing(float width, float nozzle_diameter, float height, float bridge_flow_ratio); }; } diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 36ce27a8a..118c73e96 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -163,6 +163,10 @@ Print::invalidate_state_by_config(const PrintConfigBase &config) || opt_key == "min_skirt_length" || opt_key == "ooze_prevention") { steps.insert(psSkirt); + } else if (opt_key == "brim_width") { + steps.insert(psBrim); + steps.insert(psSkirt); + osteps.insert(posSupportMaterial); } else if (opt_key == "brim_width" || opt_key == "interior_brim_width" || opt_key == "brim_connections_width") { @@ -759,13 +763,17 @@ Print::brim_flow() const extruders and take the one with, say, the smallest index. The same logic should be applied to the code that selects the extruder during G-code generation as well. */ - return Flow::new_from_config_width( + Flow flow = Flow::new_from_config_width( frPerimeter, width, this->config.nozzle_diameter.get_at(this->regions.front()->config.perimeter_extruder-1), this->skirt_first_layer_height(), 0 ); + + flow.set_spacing(unscale(Fill::adjust_solid_spacing(scale_(this->config.brim_width.value), scale_(flow.spacing())))); + + return flow; } Flow @@ -844,8 +852,8 @@ Print::_make_brim() // perimeters because here we're offsetting outwards) append_to(loops, offset2( islands, - flow.scaled_width() + flow.scaled_spacing() * (i - 1.0 + 0.5), - flow.scaled_spacing() * -1.0, + flow.scaled_width() + flow.scaled_spacing() * (i - 1.5 + 0.5), + flow.scaled_spacing() * -0.5, 100000, ClipperLib::jtSquare )); From 3f0fea75859a7fdc31c3d4c6b31b2f422995a310 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 2 Apr 2017 13:57:49 +0200 Subject: [PATCH 18/85] Refactoring: moved Fill::adjust_solid_spacing() to Flow::solid_spacing(). --- lib/Slic3r/Print/SupportMaterial.pm | 2 ++ t/fill.t | 2 +- xs/src/libslic3r/Fill/Fill.cpp | 30 --------------------- xs/src/libslic3r/Fill/Fill.hpp | 1 - xs/src/libslic3r/Fill/FillConcentric.cpp | 3 ++- xs/src/libslic3r/Fill/FillRectilinear.cpp | 3 ++- xs/src/libslic3r/Flow.cpp | 33 +++++++++++++++++++++++ xs/src/libslic3r/Flow.hpp | 7 +++++ xs/src/libslic3r/Print.cpp | 3 ++- xs/xsp/Filler.xsp | 5 ---- xs/xsp/Flow.xsp | 3 +++ 11 files changed, 52 insertions(+), 40 deletions(-) diff --git a/lib/Slic3r/Print/SupportMaterial.pm b/lib/Slic3r/Print/SupportMaterial.pm index d9b8b3313..214a2a634 100644 --- a/lib/Slic3r/Print/SupportMaterial.pm +++ b/lib/Slic3r/Print/SupportMaterial.pm @@ -804,6 +804,8 @@ sub generate_toolpaths { $to_infill, offset($object->get_layer(0)->slices->polygons, $d), ); + } else { + $to_infill = union_ex($to_infill); } } else { # draw a perimeter all around support infill diff --git a/t/fill.t b/t/fill.t index 710e60536..765cfd479 100644 --- a/t/fill.t +++ b/t/fill.t @@ -22,7 +22,7 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ } { my $print = Slic3r::Print->new; my $surface_width = 250; - my $distance = Slic3r::Filler::adjust_solid_spacing($surface_width, 47); + my $distance = Slic3r::Flow::solid_spacing($surface_width, 47); is $distance, 50, 'adjusted solid distance'; is $surface_width % $distance, 0, 'adjusted solid distance'; } diff --git a/xs/src/libslic3r/Fill/Fill.cpp b/xs/src/libslic3r/Fill/Fill.cpp index 555081616..39c9107b9 100644 --- a/xs/src/libslic3r/Fill/Fill.cpp +++ b/xs/src/libslic3r/Fill/Fill.cpp @@ -72,36 +72,6 @@ Fill::fill_surface(const Surface &surface) return polylines_out; } -// Calculate a new spacing to fill width with possibly integer number of lines, -// the first and last line being centered at the interval ends. -// This function possibly increases the spacing, never decreases, -// and for a narrow width the increase in spacing may become severe, -// therefore the adjustment is limited to 20% increase. -coord_t -Fill::adjust_solid_spacing(const coord_t width, const coord_t distance) -{ - assert(width >= 0); - assert(distance > 0); - const int number_of_intervals = floor(width / distance); - if (number_of_intervals == 0) return distance; - - coord_t distance_new = (width / number_of_intervals); - - const coordf_t factor = coordf_t(distance_new) / coordf_t(distance); - assert(factor > 1. - 1e-5); - - // How much could the extrusion width be increased? By 20%. - // Because of this limit, this method is not idempotent: each run - // will increment distance by 20%. - const coordf_t factor_max = 1.2; - if (factor > factor_max) - distance_new = floor((double)distance * factor_max + 0.5); - - assert((distance_new * number_of_intervals) <= width); - - return distance_new; -} - // Returns orientation of the infill and the reference point of the infill pattern. // For a normal print, the reference point is the center of a bounding box of the STL. Fill::direction_t diff --git a/xs/src/libslic3r/Fill/Fill.hpp b/xs/src/libslic3r/Fill/Fill.hpp index abb9e1c65..a72d5528c 100644 --- a/xs/src/libslic3r/Fill/Fill.hpp +++ b/xs/src/libslic3r/Fill/Fill.hpp @@ -64,7 +64,6 @@ public: public: static Fill* new_from_type(const InfillPattern type); static Fill* new_from_type(const std::string &type); - static coord_t adjust_solid_spacing(const coord_t width, const coord_t distance); virtual Fill* clone() const = 0; virtual ~Fill() {}; diff --git a/xs/src/libslic3r/Fill/FillConcentric.cpp b/xs/src/libslic3r/Fill/FillConcentric.cpp index 24d8f318a..992dfaa3b 100644 --- a/xs/src/libslic3r/Fill/FillConcentric.cpp +++ b/xs/src/libslic3r/Fill/FillConcentric.cpp @@ -1,5 +1,6 @@ #include "../ClipperUtils.hpp" #include "../ExPolygon.hpp" +#include "../Flow.hpp" #include "../Surface.hpp" #include "FillConcentric.hpp" @@ -20,7 +21,7 @@ FillConcentric::_fill_surface_single( if (this->density > 0.9999f && !this->dont_adjust) { BoundingBox bounding_box = expolygon.contour.bounding_box(); - distance = this->adjust_solid_spacing(bounding_box.size().x, distance); + distance = Flow::solid_spacing(bounding_box.size().x, distance); this->_spacing = unscale(distance); } diff --git a/xs/src/libslic3r/Fill/FillRectilinear.cpp b/xs/src/libslic3r/Fill/FillRectilinear.cpp index e02c3a298..bfee321ed 100644 --- a/xs/src/libslic3r/Fill/FillRectilinear.cpp +++ b/xs/src/libslic3r/Fill/FillRectilinear.cpp @@ -6,6 +6,7 @@ #include "../ClipperUtils.hpp" #include "../ExPolygon.hpp" +#include "../Flow.hpp" #include "../PolylineCollection.hpp" #include "../Surface.hpp" #include @@ -48,7 +49,7 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon, // define flow spacing according to requested density if (this->density > 0.9999f && !this->dont_adjust) { - line_spacing = this->adjust_solid_spacing(bounding_box.size().x, line_spacing); + line_spacing = Flow::solid_spacing(bounding_box.size().x, line_spacing); this->_spacing = unscale(line_spacing); } else { // extend bounding box so that our pattern will be aligned with other layers diff --git a/xs/src/libslic3r/Flow.cpp b/xs/src/libslic3r/Flow.cpp index a0cd62236..42caf9f1a 100644 --- a/xs/src/libslic3r/Flow.cpp +++ b/xs/src/libslic3r/Flow.cpp @@ -120,4 +120,37 @@ Flow::_width_from_spacing(float spacing, float nozzle_diameter, float height, bo return spacing + OVERLAP_FACTOR * height * (1 - PI/4.0); } +// Calculate a new spacing to fill width with possibly integer number of lines, +// the first and last line being centered at the interval ends. +// This function possibly increases the spacing, never decreases, +// and for a narrow width the increase in spacing may become severe, +// therefore the adjustment is limited to 20% increase. +template +T +Flow::solid_spacing(const T total_width, const T spacing) +{ + assert(total_width >= 0); + assert(spacing > 0); + const int number_of_intervals = floor(total_width / spacing); + if (number_of_intervals == 0) return spacing; + + T spacing_new = (total_width / number_of_intervals); + + const double factor = (double)spacing_new / (double)spacing; + assert(factor > 1. - 1e-5); + + // How much could the extrusion width be increased? By 20%. + // Because of this limit, this method is not idempotent: each run + // will increment spacing by 20%. + const double factor_max = 1.2; + if (factor > factor_max) + spacing_new = floor((double)spacing * factor_max + 0.5); + + assert((spacing_new * number_of_intervals) <= total_width); + + return spacing_new; +} +template coord_t Flow::solid_spacing(const coord_t total_width, const coord_t spacing); +template coordf_t Flow::solid_spacing(const coordf_t total_width, const coordf_t spacing); + } diff --git a/xs/src/libslic3r/Flow.hpp b/xs/src/libslic3r/Flow.hpp index 8284cc6d6..7149df6b4 100644 --- a/xs/src/libslic3r/Flow.hpp +++ b/xs/src/libslic3r/Flow.hpp @@ -31,6 +31,12 @@ class Flow float spacing() const; float spacing(const Flow &other) const; void set_spacing(float spacing); + void set_solid_spacing(const coord_t total_width) { + this->set_spacing(Flow::solid_spacing(total_width, this->scaled_spacing())); + }; + void set_solid_spacing(const coordf_t total_width) { + this->set_spacing(Flow::solid_spacing(total_width, (coordf_t)this->spacing())); + }; double mm3_per_mm() const; coord_t scaled_width() const { return scale_(this->width); @@ -44,6 +50,7 @@ class Flow static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height, float bridge_flow_ratio); static Flow new_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge); + template static T solid_spacing(const T total_width, const T spacing); private: static float _bridge_width(float nozzle_diameter, float bridge_flow_ratio); diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 118c73e96..deb1d3135 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -771,7 +771,8 @@ Print::brim_flow() const 0 ); - flow.set_spacing(unscale(Fill::adjust_solid_spacing(scale_(this->config.brim_width.value), scale_(flow.spacing())))); + // Adjust extrusion width in order to fill the total brim width with an integer number of lines. + flow.set_solid_spacing(this->config.brim_width.value); return flow; } diff --git a/xs/xsp/Filler.xsp b/xs/xsp/Filler.xsp index 0c5c08b6c..3208ac29a 100644 --- a/xs/xsp/Filler.xsp +++ b/xs/xsp/Filler.xsp @@ -78,8 +78,3 @@ new_from_type(CLASS, type) %} }; - -%package{Slic3r::Filler}; - -coord_t adjust_solid_spacing(coord_t width, coord_t distance) - %code{% RETVAL = Fill::adjust_solid_spacing(width, distance); %}; diff --git a/xs/xsp/Flow.xsp b/xs/xsp/Flow.xsp index d09f0b351..05cc828b9 100644 --- a/xs/xsp/Flow.xsp +++ b/xs/xsp/Flow.xsp @@ -81,3 +81,6 @@ _constant() %} +coord_t solid_spacing(coord_t width, coord_t distance) + %code{% RETVAL = Flow::solid_spacing(width, distance); %}; + From bc35063a57788a23381b9e789289c27110fe07b7 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 2 Apr 2017 15:23:18 +0200 Subject: [PATCH 19/85] Refactoring and cleanup of BridgeDetector --- xs/src/libslic3r/BridgeDetector.cpp | 134 ++++++++++++---------------- xs/src/libslic3r/BridgeDetector.hpp | 13 +++ 2 files changed, 72 insertions(+), 75 deletions(-) diff --git a/xs/src/libslic3r/BridgeDetector.cpp b/xs/src/libslic3r/BridgeDetector.cpp index f9061e405..228f9a4e6 100644 --- a/xs/src/libslic3r/BridgeDetector.cpp +++ b/xs/src/libslic3r/BridgeDetector.cpp @@ -5,24 +5,6 @@ namespace Slic3r { -class BridgeDirectionComparator { - public: - std::map dir_coverage; // angle => score - - BridgeDirectionComparator(double _extrusion_width) - : extrusion_width(_extrusion_width) - {}; - - // the best direction is the one causing most lines to be bridged (thus most coverage) - bool operator() (double a, double b) { - // Initial sort by coverage only - comparator must obey strict weak ordering - return (this->dir_coverage[a] > this->dir_coverage[b]); - }; - - private: - double extrusion_width; -}; - BridgeDetector::BridgeDetector(const ExPolygon &_expolygon, const ExPolygonCollection &_lower_slices, coord_t _extrusion_width) : expolygon(_expolygon), lower_slices(_lower_slices), extrusion_width(_extrusion_width), @@ -59,6 +41,8 @@ BridgeDetector::BridgeDetector(const ExPolygon &_expolygon, const ExPolygonColle bool BridgeDetector::detect_angle() { + // Do nothing if the bridging region is completely in the air + // and there are no anchors available at the layer below. if (this->_edges.empty() || this->_anchors.empty()) return false; /* Outset the bridge expolygon by half the amount we used for detecting anchors; @@ -70,60 +54,65 @@ BridgeDetector::detect_angle() bridge in several directions and then sum the length of lines having both endpoints within anchors */ - // we test angles according to configured resolution - std::vector angles; - for (int i = 0; i <= PI/this->resolution; ++i) - angles.push_back(i * this->resolution); - - // we also test angles of each bridge contour + // generate the list of candidate angles + std::vector candidates; { - Polygons pp = this->expolygon; - for (Polygons::const_iterator p = pp.begin(); p != pp.end(); ++p) { - Lines lines = p->lines(); - for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) - angles.push_back(line->direction()); + // we test angles according to configured resolution + std::vector angles; + for (int i = 0; i <= PI/this->resolution; ++i) + angles.push_back(i * this->resolution); + + // we also test angles of each bridge contour + { + Polygons pp = this->expolygon; + for (Polygons::const_iterator p = pp.begin(); p != pp.end(); ++p) { + Lines lines = p->lines(); + for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) + angles.push_back(line->direction()); + } } - } - /* we also test angles of each open supporting edge - (this finds the optimal angle for C-shaped supports) */ - for (Polylines::const_iterator edge = this->_edges.begin(); edge != this->_edges.end(); ++edge) { - if (edge->first_point().coincides_with(edge->last_point())) continue; - angles.push_back(Line(edge->first_point(), edge->last_point()).direction()); - } - - // remove duplicates - double min_resolution = PI/180.0; // 1 degree - std::sort(angles.begin(), angles.end()); - for (size_t i = 1; i < angles.size(); ++i) { - if (Slic3r::Geometry::directions_parallel(angles[i], angles[i-1], min_resolution)) { - angles.erase(angles.begin() + i); - --i; + /* we also test angles of each open supporting edge + (this finds the optimal angle for C-shaped supports) */ + for (Polylines::const_iterator edge = this->_edges.begin(); edge != this->_edges.end(); ++edge) { + if (edge->first_point().coincides_with(edge->last_point())) continue; + angles.push_back(Line(edge->first_point(), edge->last_point()).direction()); } - } - /* compare first value with last one and remove the greatest one (PI) - in case they are parallel (PI, 0) */ - if (Slic3r::Geometry::directions_parallel(angles.front(), angles.back(), min_resolution)) - angles.pop_back(); - BridgeDirectionComparator bdcomp(this->extrusion_width); - std::map dir_avg_length; + // remove duplicates + double min_resolution = PI/180.0; // 1 degree + std::sort(angles.begin(), angles.end()); + for (size_t i = 1; i < angles.size(); ++i) { + if (Slic3r::Geometry::directions_parallel(angles[i], angles[i-1], min_resolution)) { + angles.erase(angles.begin() + i); + --i; + } + } + /* compare first value with last one and remove the greatest one (PI) + in case they are parallel (PI, 0) */ + if (Slic3r::Geometry::directions_parallel(angles.front(), angles.back(), min_resolution)) + angles.pop_back(); + + for (auto angle : angles) + candidates.push_back(BridgeDirection(angle)); + } + double line_increment = this->extrusion_width; bool have_coverage = false; - for (std::vector::const_iterator angle = angles.begin(); angle != angles.end(); ++angle) { + for (BridgeDirection &candidate : candidates) { Polygons my_clip_area = clip_area; ExPolygons my_anchors = this->_anchors; // rotate everything - the center point doesn't matter - for (Polygons::iterator it = my_clip_area.begin(); it != my_clip_area.end(); ++it) - it->rotate(-*angle, Point(0,0)); - for (ExPolygons::iterator it = my_anchors.begin(); it != my_anchors.end(); ++it) - it->rotate(-*angle, Point(0,0)); + for (Polygon &p : my_clip_area) + p.rotate(-candidate.angle, Point(0,0)); + for (ExPolygon &e : my_anchors) + e.rotate(-candidate.angle, Point(0,0)); // generate lines in this direction BoundingBox bb; - for (ExPolygons::const_iterator it = my_anchors.begin(); it != my_anchors.end(); ++it) - bb.merge((Points)*it); + for (const ExPolygon &e : my_anchors) + bb.merge((Points)e); Lines lines; for (coord_t y = bb.min.y; y <= bb.max.y; y += line_increment) @@ -143,44 +132,39 @@ BridgeDetector::detect_angle() std::vector lengths; double total_length = 0; - for (Lines::const_iterator line = clipped_lines.begin(); line != clipped_lines.end(); ++line) { - double len = line->length(); + for (const Line &line : clipped_lines) { + const double len = line.length(); lengths.push_back(len); total_length += len; } if (total_length) have_coverage = true; // sum length of bridged lines - bdcomp.dir_coverage[*angle] = total_length; + candidate.coverage = total_length; /* The following produces more correct results in some cases and more broken in others. TODO: investigate, as it looks more reliable than line clipping. */ // $directions_coverage{$angle} = sum(map $_->area, @{$self->coverage($angle)}) // 0; // max length of bridged lines - dir_avg_length[*angle] = !lengths.empty() - ? *std::max_element(lengths.begin(), lengths.end()) - : 0; + if (!lengths.empty()) + candidate.max_length = *std::max_element(lengths.begin(), lengths.end()); } // if no direction produced coverage, then there's no bridge direction if (!have_coverage) return false; // sort directions by coverage - most coverage first - std::sort(angles.begin(), angles.end(), bdcomp); - this->angle = angles.front(); + std::sort(candidates.begin(), candidates.end()); // if any other direction is within extrusion width of coverage, prefer it if shorter // TODO: There are two options here - within width of the angle with most coverage, or within width of the currently perferred? - double most_coverage_angle = this->angle; - for (std::vector::const_iterator angle = angles.begin() + 1; - angle != angles.end() && bdcomp.dir_coverage[most_coverage_angle] - bdcomp.dir_coverage[*angle] < this->extrusion_width; - ++angle - ) { - if (dir_avg_length[*angle] < dir_avg_length[this->angle]) { - this->angle = *angle; - } - } + size_t i_best = 0; + for (size_t i = 1; i < candidates.size() && candidates[i_best].coverage - candidates[i].coverage < this->extrusion_width; ++ i) + if (candidates[i].max_length < candidates[i_best].max_length) + i_best = i; + + this->angle = candidates[i_best].angle; if (this->angle >= PI) this->angle -= PI; diff --git a/xs/src/libslic3r/BridgeDetector.hpp b/xs/src/libslic3r/BridgeDetector.hpp index bbbd26df9..3ba054f5d 100644 --- a/xs/src/libslic3r/BridgeDetector.hpp +++ b/xs/src/libslic3r/BridgeDetector.hpp @@ -31,6 +31,19 @@ private: Polylines _edges; // Closed polygons representing the supporting areas. ExPolygons _anchors; + + class BridgeDirection { + public: + BridgeDirection(double a = -1.) : angle(a), coverage(0.), max_length(0.) {} + // the best direction is the one causing most lines to be bridged (thus most coverage) + bool operator<(const BridgeDirection &other) const { + // Initial sort by coverage only - comparator must obey strict weak ordering + return this->coverage > other.coverage; + }; + double angle; + double coverage; + double max_length; + }; }; } From ea28afba1d4a62e398699b2dc8fc08e00a8f9d9d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 11:46:18 -0500 Subject: [PATCH 20/85] Add WXDIR to library search path for finding wx libs for custom libraries --- .travis.yml | 1 + package/linux/make_archive.sh | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ede2099d9..31a5a1c41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ install: - export SLIC3R_STATIC=1 - export CXX=g++-4.9 - export CC=g++-4.9 +- export WXDIR=$HOME/wx302 - source $HOME/perl5/perlbrew/etc/bashrc script: - bash package/linux/travis-setup.sh diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index 92ce34e68..8a8acc9b5 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -10,7 +10,11 @@ if [ "$#" -ne 1 ]; then echo "Usage: $(basename $0) arch_name" exit 1; fi -libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) +if [ -z ${WXDIR+x} ]; then + libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) +else + libdirs=$(find {$WXDIR,./local-lib} -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) +fi WD=./$(dirname $0) source $(dirname $0)/../common/util.sh # Determine if this is a tagged (release) commit. From 077ff68b8fb18467f02fe652009d65cd2bb2d3c0 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 12:07:15 -0500 Subject: [PATCH 21/85] moved all build cache priming to @lordofhyphens web server to avoid loading bintray more --- package/linux/travis-setup.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/package/linux/travis-setup.sh b/package/linux/travis-setup.sh index fc843a57a..3c9f55ecf 100755 --- a/package/linux/travis-setup.sh +++ b/package/linux/travis-setup.sh @@ -1,26 +1,30 @@ #!/bin/bash # Script to configure travis environment prior to build WXVERSION=302 +CACHE=$HOME/cache +mkdir -p $CACHE -if [ ! -e $HOME/cache/slic3r-perlbrew-5.24.tar.bz2 ]; then - curl -L "https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=slic3r-perl.524.travis.tar.bz2" -o $HOME/cache/slic3r-perlbrew-5.24.tar.bz2; +if [ ! -e $CACHE/slic3r-perlbrew-5.24.tar.bz2 ]; then + echo "Downloading http://www.siusgs.com/slic3r/buildserver/slic3r-perl.524.travis.tar.bz2 => $CACHE/slic3r-perlbrew-5.24.tar.bz2" + curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-perl.524.travis.tar.bz2" -o $CACHE/slic3r-perlbrew-5.24.tar.bz2; fi -if [ ! -e $HOME/cache/boost-compiled.tar.bz2 ]; then - curl -L "http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2" -o $HOME/cache/boost-compiled.tar.bz2 +if [ ! -e $CACHE/boost-compiled.tar.bz2 ]; then + echo "Downloading http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2 => $CACHE/boost-compiled.tar.bz2" + curl -L "http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2" -o $CACHE/boost-compiled.tar.bz2 fi -if [ ! -e $HOME/cache/local-lib-wx${WXVERSION}.tar.bz2 ]; then - curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx${WXVERSION}.tar.bz2" -o $HOME/cache/local-lib-wx${WXVERSION}.tar.bz2 +if [ ! -e $CACHE/local-lib-wx${WXVERSION}.tar.bz2 ]; then + echo "Downloading http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx${WXVERSION}.tar.bz2 => $CACHE/local-lib-wx${WXVERSION}.tar.bz2" + curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx${WXVERSION}.tar.bz2" -o $CACHE/local-lib-wx${WXVERSION}.tar.bz2 fi -if [ ! -e $HOME/cache/wx${WXVERSION}.tar.bz2 ]; then - curl -L "http://www.siusgs.com/slic3r/buildserver/wx${WXVERSION}-libs.tar.bz2" -o $HOME/cache/wx${WXVERSION}.tar.bz2 +if [ ! -e $CACHE/wx${WXVERSION}.tar.bz2 ]; then + echo "Downloading http://www.siusgs.com/slic3r/buildserver/wx${WXVERSION}-libs.tar.bz2 => $CACHE/wx${WXVERSION}.tar.bz2" + curl -L "http://www.siusgs.com/slic3r/buildserver/wx${WXVERSION}-libs.tar.bz2" -o $CACHE/wx${WXVERSION}.tar.bz2 fi - - -tar -C$TRAVIS_BUILD_DIR -xjf $HOME/cache/local-lib-wx${WXVERSION}.tar.bz2 -tar -C$HOME/perl5/perlbrew/perls -xjf $HOME/cache/slic3r-perlbrew-5.24.tar.bz2 -tar -C$HOME -xjf $HOME/cache/boost-compiled.tar.bz2 -tar -C$HOME -xjf $HOME/cache/wx${WXVERSION}.tar.bz2 +tar -C$TRAVIS_BUILD_DIR -xjf $CACHE/local-lib-wx${WXVERSION}.tar.bz2 +tar -C$HOME/perl5/perlbrew/perls -xjf $CACHE/slic3r-perlbrew-5.24.tar.bz2 +tar -C$HOME -xjf $CACHE/boost-compiled.tar.bz2 +tar -C$HOME -xjf $CACHE/wx${WXVERSION}.tar.bz2 From bbb4b653ea67bf0670199fa5525ce28d314baad5 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 12:10:31 -0500 Subject: [PATCH 22/85] re-caching perbrew dir is pointless --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 31a5a1c41..c6904f562 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ cache: apt: true directories: - "$HOME/cache" - - "$HOME/perl5/perlbrew" addons: apt: sources: From 6bbf56641e910df047c8fb889bcacc800e480fc6 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 14:19:56 -0500 Subject: [PATCH 23/85] see if wx_dir is set --- package/linux/make_archive.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index 8a8acc9b5..9a3cccbcb 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -13,6 +13,7 @@ fi if [ -z ${WXDIR+x} ]; then libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) else + echo "WXDIR => $WXDIR" libdirs=$(find {$WXDIR,./local-lib} -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) fi WD=./$(dirname $0) From c77c524c07f203bf1e261945237b2c2e05f833ba Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 14:37:04 -0500 Subject: [PATCH 24/85] just used completely different processing if WXDIR is used. --- package/linux/make_archive.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index 9a3cccbcb..88ffdfdef 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -10,12 +10,7 @@ if [ "$#" -ne 1 ]; then echo "Usage: $(basename $0) arch_name" exit 1; fi -if [ -z ${WXDIR+x} ]; then - libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) -else - echo "WXDIR => $WXDIR" - libdirs=$(find {$WXDIR,./local-lib} -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) -fi +libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) WD=./$(dirname $0) source $(dirname $0)/../common/util.sh # Determine if this is a tagged (release) commit. @@ -74,13 +69,20 @@ cp -fRP $SLIC3R_DIR/local-lib $archivefolder/local-lib cp -fRP $SLIC3R_DIR/lib/* $archivefolder/local-lib/lib/perl5/ mkdir $archivefolder/bin -echo "Symlinking libraries to $archivefolder/bin ..." -for bundle in $(find $archivefolder/local-lib/lib/perl5 -name '*.so' | grep "Wx") $(find $archivefolder/local-lib/lib/perl5 -name '*.so' -type f | grep "wxWidgets"); do - echo "$(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}')" - for dylib in $(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}'); do +echo "Installing libraries to $archivefolder/bin ..." +if [ -z ${WXDIR+x} ]; then + for bundle in $(find $archivefolder/local-lib/lib/perl5 -name '*.so' | grep "Wx") $(find $archivefolder/local-lib/lib/perl5 -name '*.so' -type f | grep "wxWidgets"); do + echo "$(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}')" + for dylib in $(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}'); do + install -v $dylib $archivefolder/bin + done + done +else + echo "Copying libraries from $WXDIR/lib to $archivefolder/bin" + for dylib in $(find $WXDIR/lib -type f | grep "so"); do install -v $dylib $archivefolder/bin done -done +fi echo "Copying startup script..." cp -f $WD/startup_script.sh $archivefolder/$appname From 01afaa0ec6c403b21f9bf8fce864deb11a699f4a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 15:04:52 -0500 Subject: [PATCH 25/85] On travis build server, use build wxlibs and not ubuntu system libs (#3832) * see if wx_dir is set * just used completely different processing if WXDIR is used. --- package/linux/make_archive.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index 8a8acc9b5..88ffdfdef 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -10,11 +10,7 @@ if [ "$#" -ne 1 ]; then echo "Usage: $(basename $0) arch_name" exit 1; fi -if [ -z ${WXDIR+x} ]; then - libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) -else - libdirs=$(find {$WXDIR,./local-lib} -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) -fi +libdirs=$(find ./local-lib -iname *.so -exec dirname {} \; | sort -u | paste -sd ";" -) WD=./$(dirname $0) source $(dirname $0)/../common/util.sh # Determine if this is a tagged (release) commit. @@ -73,13 +69,20 @@ cp -fRP $SLIC3R_DIR/local-lib $archivefolder/local-lib cp -fRP $SLIC3R_DIR/lib/* $archivefolder/local-lib/lib/perl5/ mkdir $archivefolder/bin -echo "Symlinking libraries to $archivefolder/bin ..." -for bundle in $(find $archivefolder/local-lib/lib/perl5 -name '*.so' | grep "Wx") $(find $archivefolder/local-lib/lib/perl5 -name '*.so' -type f | grep "wxWidgets"); do - echo "$(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}')" - for dylib in $(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}'); do +echo "Installing libraries to $archivefolder/bin ..." +if [ -z ${WXDIR+x} ]; then + for bundle in $(find $archivefolder/local-lib/lib/perl5 -name '*.so' | grep "Wx") $(find $archivefolder/local-lib/lib/perl5 -name '*.so' -type f | grep "wxWidgets"); do + echo "$(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}')" + for dylib in $(LD_LIBRARY_PATH=$libdirs ldd $bundle | grep .so | grep local-lib | awk '{print $3}'); do + install -v $dylib $archivefolder/bin + done + done +else + echo "Copying libraries from $WXDIR/lib to $archivefolder/bin" + for dylib in $(find $WXDIR/lib -type f | grep "so"); do install -v $dylib $archivefolder/bin done -done +fi echo "Copying startup script..." cp -f $WD/startup_script.sh $archivefolder/$appname From 23f3df4b1fb03d80a94142b33e8cf480cf7a717b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 15:34:53 -0500 Subject: [PATCH 26/85] Moved shell.cpp to ../common, borrowed and modified for FORCE_GUI from @bubnikv Changed path in compile_wrapper, made makefile for linux with default paths pointed at where they would be on Travis. --- package/{win => common}/shell.cpp | 30 +++++++++++++++++++++++++++--- package/linux/build_shell.mk | 31 +++++++++++++++++++++++++++++++ package/win/compile_wrapper.ps1 | 5 +++-- 3 files changed, 61 insertions(+), 5 deletions(-) rename package/{win => common}/shell.cpp (83%) create mode 100644 package/linux/build_shell.mk diff --git a/package/win/shell.cpp b/package/common/shell.cpp similarity index 83% rename from package/win/shell.cpp rename to package/common/shell.cpp index e4fe45d20..166f72111 100644 --- a/package/win/shell.cpp +++ b/package/common/shell.cpp @@ -1,16 +1,19 @@ #include // from the Perl distribution #include // from the Perl distribution + +#ifdef WIN32 // Perl win32 specific includes, found in perl\\lib\\CORE\\win32.h // Defines the windows specific convenience RunPerl() function, // which is not available on other operating systems. #include -// the standard Windows. include -//#include +#include +#endif + #include #include -#include +#ifdef WIN32 int main(int argc, char **argv, char **env) { @@ -95,4 +98,25 @@ int main(int argc, char **argv, char **env) #endif free(command_line); } +#else +int main(int argc, char **argv, char **env) +{ + PerlInterpreter *my_perl = perl_alloc(); + if (my_perl == NULL) { + fprintf(stderr, "Cannot start perl interpreter. Exiting.\n"); + return -1; + } + perl_construct(my_perl); + +#ifdef FORCE_GUI + char* command_line[] = { "slic3r", "slic3r.pl", "--gui" }; +#else + char* command_line[] = { "slic3r", "slic3r.pl" }; +#endif + perl_parse(my_perl, NULL, 3, command_line, (char **)NULL); + perl_run(my_perl); + perl_destruct(my_perl); + perl_free(my_perl); +} +#endif diff --git a/package/linux/build_shell.mk b/package/linux/build_shell.mk new file mode 100644 index 000000000..5f7a56f75 --- /dev/null +++ b/package/linux/build_shell.mk @@ -0,0 +1,31 @@ +src=../common/shell.cpp + +# override with environment variable +CXX ?= g++ + +# Path to perl header files +INCLUDEDIR ?= ${HOME}/perl5/perlbrew/perls/slic3r-perl/lib/5.24.0/x86_64-linux-thread-multi/CORE + +# path to library files for perl +LIBDIR ?= ${HOME}/perl5/perlbrew/perls/slic3r-perl/lib/5.24.0/x86_64-linux-thread-multi/CORE + +LIBS += -lperl -lpthread -lcrypt + +CXXFLAGS += -std=c++11 -static-libgcc -static-libstdc++ -I${INCLUDEDIR} +LDFLAGS += -L${LIBDIR} + +.PHONY: all clean +all: Slic3r Slic3r-console + +Slic3r: slic3r.o + ${CXX} ${LDFLAGS} -o $@ $< ${LIBS} + +Slic3r-console: slic3r-console.o + ${CXX} ${LDFLAGS} -o $@ $< ${LIBS} +slic3r-console.o: ${src} + ${CXX} -c ${CXXFLAGS} -o $@ $< +slic3r.o: ${src} + ${CXX} -c -DFORCE_GUI ${CXXFLAGS} -o $@ $< + +clean: + rm *.o Slic3r* diff --git a/package/win/compile_wrapper.ps1 b/package/win/compile_wrapper.ps1 index a0e550d0c..abd929287 100644 --- a/package/win/compile_wrapper.ps1 +++ b/package/win/compile_wrapper.ps1 @@ -8,10 +8,11 @@ if ($args[0]) } $perllib = "-lperl$perlver" +$shell_loc = "..\common\shell.cpp" windres slic3r.rc -O coff -o slic3r.res -g++ -c -I'C:\strawberry\perl\lib\CORE\' shell.cpp -o slic3r.o -g++ -c -I'C:\strawberry\perl\lib\CORE\' -DFORCE_GUI shell.cpp -o slic3r-gui.o +g++ -c -I'C:\strawberry\perl\lib\CORE\' $shell_loc -o slic3r.o +g++ -c -I'C:\strawberry\perl\lib\CORE\' -DFORCE_GUI $shell_loc -o slic3r-gui.o g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r.o slic3r.res -o slic3r-console.exe | Write-Host g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -mwindows -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r.exe | Write-Host g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r-debug-console.exe | Write-Host From bc846d2bdabe9be18798f6a24cb8ab84ddb205ab Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 15:44:56 -0500 Subject: [PATCH 27/85] Copy symlinks too properly --- package/linux/make_archive.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index 88ffdfdef..fd4fad26b 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -79,8 +79,8 @@ if [ -z ${WXDIR+x} ]; then done else echo "Copying libraries from $WXDIR/lib to $archivefolder/bin" - for dylib in $(find $WXDIR/lib -type f | grep "so"); do - install -v $dylib $archivefolder/bin + for dylib in $(find $WXDIR/lib | grep "so"); do + cp -P -v $dylib $archivefolder/bin done fi From d08dd487fcd7a4e55f13a2ba90d15a50777578df Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 16:57:42 -0500 Subject: [PATCH 28/85] Made cpanm quiet --- package/common/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/common/util.sh b/package/common/util.sh index 5efeacac5..389617eb0 100644 --- a/package/common/util.sh +++ b/package/common/util.sh @@ -87,5 +87,5 @@ function set_pr_id () function install_par () { - cpanm PAR::Packer + cpanm -q PAR::Packer } From 068ef7b9af3a8772d0c249367527a9648ad6a56f Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 22:08:38 -0500 Subject: [PATCH 29/85] Use multiplication for support material speed It's initialized same as infill, caused division by 0 when 'auto' speed for support material was selected. Fixes #3837 --- lib/Slic3r/Print/GCode.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 02f719d4d..c0e6237c7 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -120,7 +120,7 @@ sub export { if ($self->print->has_support_material) { my $object0 = $self->objects->[0]; my $flow = $object0->support_material_flow; - my $vol_speed = $flow->mm3_per_mm / $object0->config->get_abs_value('support_material_speed'); + my $vol_speed = $flow->mm3_per_mm * $object0->config->get_abs_value('support_material_speed'); $vol_speed = min($vol_speed, $self->config->max_volumetric_speed) if $self->config->max_volumetric_speed > 0; printf $fh "; support material extrusion width = %.2fmm (%.2fmm^3/s)\n", $flow->width, $vol_speed; From c110a9d517f8988d80905c96567ab8be518edd71 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 2 Apr 2017 23:35:20 -0500 Subject: [PATCH 30/85] Adds printer notes item and tab. Fixes #3806 --- lib/Slic3r/GUI/PresetEditor.pm | 16 +++++++++++++++- xs/src/libslic3r/PrintConfig.cpp | 13 +++++++++++++ xs/src/libslic3r/PrintConfig.hpp | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index 2f2ed604f..52b8067ab 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -1167,10 +1167,12 @@ sub options { use_firmware_retraction pressure_advance vibration_limit use_volumetric_e start_gcode end_gcode before_layer_gcode layer_gcode toolchange_gcode + notes nozzle_diameter extruder_offset retract_length retract_lift retract_speed retract_restart_extra retract_before_travel retract_layer_change wipe retract_length_toolchange retract_restart_extra_toolchange retract_lift_above retract_lift_below printer_settings_id + printer_notes ); } @@ -1367,9 +1369,21 @@ sub build { $optgroup->append_single_option_line($option); } } - + $self->{extruder_pages} = []; $self->_build_extruder_pages; + { + my $page = $self->add_options_page('Notes', 'note.png'); + { + my $optgroup = $page->new_optgroup('Notes', + label_width => 0, + ); + my $option = $optgroup->get_option('notes'); + $option->full_width(1); + $option->height(250); + $optgroup->append_single_option_line($option); + } + } $self->_update_serial_ports unless $Slic3r::GUI::Settings->{_}{no_controller}; } diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index a8e346c80..914a8e7bf 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -914,6 +914,19 @@ PrintConfigDef::PrintConfigDef() def->height = 60; def->default_value = new ConfigOptionStrings(); + def = this->add("printer_notes", coStrings); + def->label = "Printer notes"; + def->tooltip = "You can put your notes regarding the printer here."; + def->cli = "printer-notes=s@"; + def->multiline = true; + def->full_width = true; + def->height = 130; + { + ConfigOptionStrings* opt = new ConfigOptionStrings(); + opt->values.push_back(""); + def->default_value = opt; + } + def = this->add("print_settings_id", coString); def->default_value = new ConfigOptionString(""); diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 88890667b..28d674fa7 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -418,6 +418,7 @@ class PrintConfig : public GCodeConfig ConfigOptionString output_filename_format; ConfigOptionFloat perimeter_acceleration; ConfigOptionStrings post_process; + ConfigOptionStrings printer_notes; ConfigOptionFloat resolution; ConfigOptionFloats retract_before_travel; ConfigOptionBools retract_layer_change; @@ -480,6 +481,7 @@ class PrintConfig : public GCodeConfig OPT_PTR(output_filename_format); OPT_PTR(perimeter_acceleration); OPT_PTR(post_process); + OPT_PTR(printer_notes); OPT_PTR(resolution); OPT_PTR(retract_before_travel); OPT_PTR(retract_layer_change); From 6a3eb3d0389e404fb2f2fbe3d367a43bd8c6d321 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 3 Apr 2017 11:33:19 -0500 Subject: [PATCH 31/85] Validate support material threshold in Config.pm (#3845) straight value of 0 is illegal. --- lib/Slic3r/Config.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index b68ef2a3e..8de55e259 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -269,6 +269,13 @@ sub validate { qw(perimeter infill solid_infill top_infill support_material first_layer); } + # support material + if ($self->support_material) { + die "Angle value of 0 is illegal. Use some % value instead (e.g. 150%)\n" + if $self->support_material_threshold == 0 || $self->support_material_threshold eq '0'; + } + + # general validation, quick and dirty foreach my $opt_key (@{$self->get_keys}) { my $opt = $Options->{$opt_key}; From ef3d235e79219f4210617ee23dd7e607c4798b8f Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 3 Apr 2017 17:18:56 +0200 Subject: [PATCH 32/85] Further cleanup of BridgeDetector and other minor things --- t/bridges.t | 24 +++++++++++- xs/src/libslic3r/BridgeDetector.cpp | 57 +++++++++++++---------------- xs/src/libslic3r/ExPolygon.hpp | 2 + xs/src/libslic3r/LayerRegion.cpp | 7 ++-- xs/src/libslic3r/SVG.cpp | 26 ++++++++++--- xs/src/libslic3r/SVG.hpp | 5 ++- xs/src/libslic3r/libslic3r.h | 1 + 7 files changed, 78 insertions(+), 44 deletions(-) diff --git a/t/bridges.t b/t/bridges.t index 51dda5c64..e042ab746 100644 --- a/t/bridges.t +++ b/t/bridges.t @@ -82,8 +82,27 @@ use Slic3r::Test; ok check_angle($lower, $bridge, 45, undef, $bridge->area/2), 'correct bridge angle for square overhang with L-shaped anchors'; } +if (0) { + # GH #2477: + # This rectangle-shaped bridge is actually unsupported (i.e. the potential anchors are + # a bit far away from the contour of the bridge area) because perimeters are reducing + # its area. + my $bridge = Slic3r::ExPolygon->new( + Slic3r::Polygon->new([30023195,14023195],[1776805,14023195],[1776805,1776805],[30023195,1776805]), + ); + my $lower = [ + Slic3r::ExPolygon->new( + Slic3r::Polygon->new([31800000,15800000],[0,15800000],[0,0],[31800000,0]), + Slic3r::Polygon->new([1499999,1500000],[1499999,14300000],[30300000,14300000],[30300000,1500000]), + ), + ]; + + ok check_angle($lower, $bridge, 90, undef, $bridge->area, 500000), + 'correct bridge angle for rectangle'; +} + sub check_angle { - my ($lower, $bridge, $expected, $tolerance, $expected_coverage) = @_; + my ($lower, $bridge, $expected, $tolerance, $expected_coverage, $extrusion_width) = @_; if (ref($lower) eq 'ARRAY') { $lower = Slic3r::ExPolygon::Collection->new(@$lower); @@ -91,8 +110,9 @@ sub check_angle { $expected_coverage //= -1; $expected_coverage = $bridge->area if $expected_coverage == -1; + $extrusion_width //= scale 0.5; - my $bd = Slic3r::BridgeDetector->new($bridge, $lower, scale 0.5); + my $bd = Slic3r::BridgeDetector->new($bridge, $lower, $extrusion_width); $tolerance //= rad2deg($bd->resolution) + epsilon; $bd->detect_angle; diff --git a/xs/src/libslic3r/BridgeDetector.cpp b/xs/src/libslic3r/BridgeDetector.cpp index 228f9a4e6..3e3837a5c 100644 --- a/xs/src/libslic3r/BridgeDetector.cpp +++ b/xs/src/libslic3r/BridgeDetector.cpp @@ -26,16 +26,16 @@ BridgeDetector::BridgeDetector(const ExPolygon &_expolygon, const ExPolygonColle // safety offset required to avoid Clipper from detecting empty intersection while Boost actually found some edges this->_anchors = intersection_ex(grown, this->lower_slices, true); - /* - if (0) { - require "Slic3r/SVG.pm"; - Slic3r::SVG::output("bridge.svg", - expolygons => [ $self->expolygon ], - red_expolygons => $self->lower_slices, - polylines => $self->_edges, - ); + #if 0 + { + SVG svg("bridge.svg"); + svg.draw(this->expolygon); + svg.draw(this->lower_slices, "red"); + svg.draw(this->_anchors, "yellow"); + //svg.draw(this->_edges, "black", scale_(0.2)); + svg.Close(); } - */ + #endif } bool @@ -48,7 +48,7 @@ BridgeDetector::detect_angle() /* Outset the bridge expolygon by half the amount we used for detecting anchors; we'll use this one to clip our test lines and be sure that their endpoints are inside the anchors and not on their contours leading to false negatives. */ - Polygons clip_area = offset(this->expolygon, +this->extrusion_width/2); + const Polygons clip_area = offset(this->expolygon, +this->extrusion_width/2); /* we'll now try several directions using a rudimentary visibility check: bridge in several directions and then sum the length of lines having both @@ -74,13 +74,13 @@ BridgeDetector::detect_angle() /* we also test angles of each open supporting edge (this finds the optimal angle for C-shaped supports) */ - for (Polylines::const_iterator edge = this->_edges.begin(); edge != this->_edges.end(); ++edge) { - if (edge->first_point().coincides_with(edge->last_point())) continue; - angles.push_back(Line(edge->first_point(), edge->last_point()).direction()); + for (const Polyline &edge : this->_edges) { + if (edge.first_point().coincides_with(edge.last_point())) continue; + angles.push_back(Line(edge.first_point(), edge.last_point()).direction()); } // remove duplicates - double min_resolution = PI/180.0; // 1 degree + constexpr double min_resolution = PI/180.0; // 1 degree std::sort(angles.begin(), angles.end()); for (size_t i = 1; i < angles.size(); ++i) { if (Slic3r::Geometry::directions_parallel(angles[i], angles[i-1], min_resolution)) { @@ -97,7 +97,7 @@ BridgeDetector::detect_angle() candidates.push_back(BridgeDirection(angle)); } - double line_increment = this->extrusion_width; + const double line_increment = this->extrusion_width; bool have_coverage = false; for (BridgeDirection &candidate : candidates) { Polygons my_clip_area = clip_area; @@ -112,27 +112,22 @@ BridgeDetector::detect_angle() // generate lines in this direction BoundingBox bb; for (const ExPolygon &e : my_anchors) - bb.merge((Points)e); + bb.merge(e.bounding_box()); Lines lines; for (coord_t y = bb.min.y; y <= bb.max.y; y += line_increment) lines.push_back(Line(Point(bb.min.x, y), Point(bb.max.x, y))); - Lines clipped_lines = intersection_ln(lines, my_clip_area); - - // remove any line not having both endpoints within anchors - for (size_t i = 0; i < clipped_lines.size(); ++i) { - Line &line = clipped_lines[i]; - if (!Slic3r::Geometry::contains(my_anchors, line.a) - || !Slic3r::Geometry::contains(my_anchors, line.b)) { - clipped_lines.erase(clipped_lines.begin() + i); - --i; - } - } + const Lines clipped_lines = intersection_ln(lines, my_clip_area); std::vector lengths; double total_length = 0; for (const Line &line : clipped_lines) { + // skip any line not having both endpoints within anchors + if (!Slic3r::Geometry::contains(my_anchors, line.a) + || !Slic3r::Geometry::contains(my_anchors, line.b)) + continue; + const double len = line.length(); lengths.push_back(len); total_length += len; @@ -220,13 +215,13 @@ BridgeDetector::coverage(double angle) const } // merge trapezoids and rotate them back - Polygons _coverage = union_(covered); - for (Polygons::iterator p = _coverage.begin(); p != _coverage.end(); ++p) - p->rotate(-(PI/2.0 - angle), Point(0,0)); + covered = union_(covered); + for (Polygon &p : covered) + p.rotate(-(PI/2.0 - angle), Point(0,0)); // intersect trapezoids with actual bridge area to remove extra margins // and append it to result - return intersection(_coverage, this->expolygon); + return intersection(covered, this->expolygon); /* if (0) { diff --git a/xs/src/libslic3r/ExPolygon.hpp b/xs/src/libslic3r/ExPolygon.hpp index 404a4385e..565a7ae2a 100644 --- a/xs/src/libslic3r/ExPolygon.hpp +++ b/xs/src/libslic3r/ExPolygon.hpp @@ -2,6 +2,7 @@ #define slic3r_ExPolygon_hpp_ #include "libslic3r.h" +#include "BoundingBox.hpp" #include "Polygon.hpp" #include "Polyline.hpp" #include @@ -30,6 +31,7 @@ class ExPolygon bool contains(const Point &point) const; bool contains_b(const Point &point) const; bool has_boundary_point(const Point &point) const; + BoundingBox bounding_box() const { return this->contour.bounding_box(); }; void remove_vertical_collinear_points(coord_t tolerance); void simplify_p(double tolerance, Polygons* polygons) const; Polygons simplify_p(double tolerance) const; diff --git a/xs/src/libslic3r/LayerRegion.cpp b/xs/src/libslic3r/LayerRegion.cpp index 1baaa0bef..4d1eb77a6 100644 --- a/xs/src/libslic3r/LayerRegion.cpp +++ b/xs/src/libslic3r/LayerRegion.cpp @@ -71,13 +71,12 @@ void LayerRegion::process_external_surfaces() { const Surfaces &surfaces = this->fill_surfaces.surfaces; - const double margin = scale_(EXTERNAL_INFILL_MARGIN); SurfaceCollection bottom; for (Surfaces::const_iterator surface = surfaces.begin(); surface != surfaces.end(); ++surface) { if (!surface->is_bottom()) continue; - const ExPolygons grown = offset_ex(surface->expolygon, +margin); + const ExPolygons grown = offset_ex(surface->expolygon, +SCALED_EXTERNAL_INFILL_MARGIN); /* detect bridge direction before merging grown surfaces otherwise adjacent bridges would get merged into a single one while they need different directions @@ -92,7 +91,7 @@ LayerRegion::process_external_surfaces() ); #ifdef SLIC3R_DEBUG - printf("Processing bridge at layer %zu:\n", this->layer()->id()); + printf("Processing bridge at layer %zu (z = %f):\n", this->layer()->id(), this->layer()->print_z); #endif if (bd.detect_angle()) { @@ -119,7 +118,7 @@ LayerRegion::process_external_surfaces() // give priority to bottom surfaces ExPolygons grown = diff_ex( - offset(surface->expolygon, +margin), + offset(surface->expolygon, +SCALED_EXTERNAL_INFILL_MARGIN), (Polygons)bottom ); for (ExPolygons::const_iterator it = grown.begin(); it != grown.end(); ++it) { diff --git a/xs/src/libslic3r/SVG.cpp b/xs/src/libslic3r/SVG.cpp index 5fb0e7d5f..a2961d5c7 100644 --- a/xs/src/libslic3r/SVG.cpp +++ b/xs/src/libslic3r/SVG.cpp @@ -35,6 +35,11 @@ SVG::SVG(const char* filename, const BoundingBox &bbox) h, w); } +SVG::~SVG() +{ + this->Close(); +} + void SVG::draw(const Line &line, std::string stroke, coord_t stroke_width) { @@ -68,10 +73,10 @@ void SVG::draw(const ThickLine &line, const std::string &fill, const std::string } void -SVG::draw(const Lines &lines, std::string stroke) +SVG::draw(const Lines &lines, std::string stroke, coord_t stroke_width) { for (Lines::const_iterator it = lines.begin(); it != lines.end(); ++it) - this->draw(*it, stroke); + this->draw(*it, stroke, stroke_width); } void @@ -94,6 +99,12 @@ SVG::draw(const ExPolygon &expolygon, std::string fill) this->path(d, true); } +void +SVG::draw(const ExPolygonCollection &coll, std::string fill) +{ + this->draw(coll.expolygons, fill); +} + void SVG::draw(const ExPolygons &expolygons, std::string fill) { @@ -126,7 +137,7 @@ void SVG::draw(const Polylines &polylines, std::string stroke, coord_t stroke_width) { for (Polylines::const_iterator it = polylines.begin(); it != polylines.end(); ++it) - this->draw(*it, fill, stroke_width); + this->draw(*it, stroke, stroke_width); } void SVG::draw(const ThickLines &thicklines, const std::string &fill, const std::string &stroke, coord_t stroke_width) @@ -202,9 +213,12 @@ SVG::get_path_d(const MultiPoint &mp, bool closed) const void SVG::Close() { - fprintf(this->f, "\n"); - fclose(this->f); - printf("SVG written to %s\n", this->filename.c_str()); + if (this->f != NULL) { + fprintf(this->f, "\n"); + fclose(this->f); + this->f = NULL; + printf("SVG written to %s\n", this->filename.c_str()); + } } } diff --git a/xs/src/libslic3r/SVG.hpp b/xs/src/libslic3r/SVG.hpp index 94cfc27dd..60ae23549 100644 --- a/xs/src/libslic3r/SVG.hpp +++ b/xs/src/libslic3r/SVG.hpp @@ -3,6 +3,7 @@ #include "libslic3r.h" #include "ExPolygon.hpp" +#include "ExPolygonCollection.hpp" #include "Line.hpp" #include "TriangleMesh.hpp" @@ -17,12 +18,14 @@ class SVG SVG(const char* filename); SVG(const char* filename, const BoundingBox &bbox); + ~SVG(); void draw(const Line &line, std::string stroke = "black", coord_t stroke_width = 0); void draw(const ThickLine &line, const std::string &fill, const std::string &stroke, coord_t stroke_width = 0); - void draw(const Lines &lines, std::string stroke = "black"); + void draw(const Lines &lines, std::string stroke = "black", coord_t stroke_width = 0); void draw(const IntersectionLines &lines, std::string stroke = "black"); void draw(const ExPolygon &expolygon, std::string fill = "grey"); void draw(const ExPolygons &expolygons, std::string fill = "grey"); + void draw(const ExPolygonCollection &coll, std::string fill = "grey"); void draw(const Polygon &polygon, std::string fill = "grey"); void draw(const Polygons &polygons, std::string fill = "grey"); void draw(const Polyline &polyline, std::string stroke = "black", coord_t stroke_width = 0); diff --git a/xs/src/libslic3r/libslic3r.h b/xs/src/libslic3r/libslic3r.h index 94b8141de..780b3b442 100644 --- a/xs/src/libslic3r/libslic3r.h +++ b/xs/src/libslic3r/libslic3r.h @@ -64,6 +64,7 @@ constexpr auto LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER = 0.15; constexpr coord_t SMALL_PERIMETER_LENGTH = scale_(6.5) * 2 * PI; constexpr coordf_t INSET_OVERLAP_TOLERANCE = 0.4; constexpr coordf_t EXTERNAL_INFILL_MARGIN = 3; +constexpr coord_t SCALED_EXTERNAL_INFILL_MARGIN = scale_(EXTERNAL_INFILL_MARGIN); enum Axis { X=0, Y, Z }; From 4926e2c76c52cecf9c4422fd3dcc50edd9212e7e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 3 Apr 2017 19:17:37 +0200 Subject: [PATCH 33/85] Minor cleanup of process_external_surfaces() --- xs/src/libslic3r/LayerRegion.cpp | 71 ++++++++++++-------------------- 1 file changed, 27 insertions(+), 44 deletions(-) diff --git a/xs/src/libslic3r/LayerRegion.cpp b/xs/src/libslic3r/LayerRegion.cpp index 4d1eb77a6..7ea5feb97 100644 --- a/xs/src/libslic3r/LayerRegion.cpp +++ b/xs/src/libslic3r/LayerRegion.cpp @@ -73,19 +73,19 @@ LayerRegion::process_external_surfaces() const Surfaces &surfaces = this->fill_surfaces.surfaces; SurfaceCollection bottom; - for (Surfaces::const_iterator surface = surfaces.begin(); surface != surfaces.end(); ++surface) { - if (!surface->is_bottom()) continue; + for (const Surface &surface : surfaces) { + if (!surface.is_bottom()) continue; - const ExPolygons grown = offset_ex(surface->expolygon, +SCALED_EXTERNAL_INFILL_MARGIN); + const ExPolygons grown = offset_ex(surface.expolygon, +SCALED_EXTERNAL_INFILL_MARGIN); /* detect bridge direction before merging grown surfaces otherwise adjacent bridges would get merged into a single one while they need different directions also, supply the original expolygon instead of the grown one, because in case of very thin (but still working) anchors, the grown expolygon would go beyond them */ double angle = -1; - if (this->layer()->lower_layer != NULL && surface->is_bridge()) { + if (this->layer()->lower_layer != NULL && surface.is_bridge()) { BridgeDetector bd( - surface->expolygon, + surface.expolygon, this->layer()->lower_layer->slices, this->flow(frInfill, true).scaled_width() ); @@ -104,28 +104,21 @@ LayerRegion::process_external_surfaces() } } - for (ExPolygons::const_iterator it = grown.begin(); it != grown.end(); ++it) { - Surface s = *surface; - s.expolygon = *it; - s.bridge_angle = angle; - bottom.surfaces.push_back(s); - } + Surface templ = surface; + templ.bridge_angle = angle; + bottom.append(grown, templ); } SurfaceCollection top; - for (Surfaces::const_iterator surface = surfaces.begin(); surface != surfaces.end(); ++surface) { - if (surface->surface_type != stTop) continue; + for (const Surface &surface : surfaces) { + if (surface.surface_type != stTop) continue; // give priority to bottom surfaces ExPolygons grown = diff_ex( - offset(surface->expolygon, +SCALED_EXTERNAL_INFILL_MARGIN), + offset(surface.expolygon, +SCALED_EXTERNAL_INFILL_MARGIN), (Polygons)bottom ); - for (ExPolygons::const_iterator it = grown.begin(); it != grown.end(); ++it) { - Surface s = *surface; - s.expolygon = *it; - top.surfaces.push_back(s); - } + top.append(grown, surface); } /* if we're slicing with no infill, we can't extend external surfaces @@ -134,10 +127,9 @@ LayerRegion::process_external_surfaces() if (this->region()->config.fill_density.value > 0) { fill_boundaries = SurfaceCollection(surfaces); } else { - for (Surfaces::const_iterator it = surfaces.begin(); it != surfaces.end(); ++it) { - if (it->surface_type != stInternal) - fill_boundaries.surfaces.push_back(*it); - } + for (const Surface &s : surfaces) + if (s.surface_type != stInternal) + fill_boundaries.surfaces.push_back(s); } // intersect the grown surfaces with the actual fill boundaries @@ -151,10 +143,10 @@ LayerRegion::process_external_surfaces() std::vector groups; tb.group(&groups); - for (std::vector::const_iterator g = groups.begin(); g != groups.end(); ++g) { + for (const SurfacesConstPtr &g : groups) { Polygons subject; - for (SurfacesConstPtr::const_iterator s = g->begin(); s != g->end(); ++s) - append_to(subject, (Polygons)**s); + for (const Surface* s : g) + append_to(subject, (Polygons)*s); ExPolygons expp = intersection_ex( subject, @@ -162,45 +154,36 @@ LayerRegion::process_external_surfaces() true // to ensure adjacent expolygons are unified ); - for (ExPolygons::const_iterator ex = expp.begin(); ex != expp.end(); ++ex) { - Surface s = *g->front(); - s.expolygon = *ex; - new_surfaces.surfaces.push_back(s); - } + new_surfaces.append(expp, *g.front()); } } /* subtract the new top surfaces from the other non-top surfaces and re-add them */ { SurfaceCollection other; - for (Surfaces::const_iterator s = surfaces.begin(); s != surfaces.end(); ++s) { - if (s->surface_type != stTop && !s->is_bottom()) - other.surfaces.push_back(*s); - } + for (const Surface &s : surfaces) + if (s.surface_type != stTop && !s.is_bottom()) + other.surfaces.push_back(s); // group surfaces std::vector groups; other.group(&groups); - for (std::vector::const_iterator g = groups.begin(); g != groups.end(); ++g) { + for (const SurfacesConstPtr &g : groups) { Polygons subject; - for (SurfacesConstPtr::const_iterator s = g->begin(); s != g->end(); ++s) - append_to(subject, (Polygons)**s); + for (const Surface* s : g) + append_to(subject, (Polygons)*s); ExPolygons expp = diff_ex( subject, (Polygons)new_surfaces ); - for (ExPolygons::const_iterator ex = expp.begin(); ex != expp.end(); ++ex) { - Surface s = *g->front(); - s.expolygon = *ex; - new_surfaces.surfaces.push_back(s); - } + new_surfaces.append(expp, *g.front()); } } - this->fill_surfaces = new_surfaces; + this->fill_surfaces = std::move(new_surfaces); } void From 91e7ef7a66928b91d8b14ba262ae33bdcdddda10 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 3 Apr 2017 20:49:45 +0200 Subject: [PATCH 34/85] Improve bridge detection algorithm. #2477 --- t/bridges.t | 12 ++-- xs/src/libslic3r/BridgeDetector.cpp | 82 +++++++++++--------------- xs/src/libslic3r/BridgeDetector.hpp | 2 +- xs/src/libslic3r/Geometry.cpp | 20 ++++++- xs/src/libslic3r/Geometry.hpp | 1 + xs/src/libslic3r/LayerRegion.cpp | 48 +++++++++++++-- xs/src/libslic3r/SVG.cpp | 18 ++++-- xs/src/libslic3r/SVG.hpp | 2 + xs/src/libslic3r/SurfaceCollection.hpp | 1 + 9 files changed, 116 insertions(+), 70 deletions(-) diff --git a/t/bridges.t b/t/bridges.t index e042ab746..95db67daf 100644 --- a/t/bridges.t +++ b/t/bridges.t @@ -1,4 +1,4 @@ -use Test::More tests => 16; +use Test::More tests => 18; use strict; use warnings; @@ -82,13 +82,11 @@ use Slic3r::Test; ok check_angle($lower, $bridge, 45, undef, $bridge->area/2), 'correct bridge angle for square overhang with L-shaped anchors'; } -if (0) { - # GH #2477: - # This rectangle-shaped bridge is actually unsupported (i.e. the potential anchors are - # a bit far away from the contour of the bridge area) because perimeters are reducing - # its area. +{ + # GH #2477: This test case failed when we computed coverage by summing length of centerlines + # instead of summing their covered area. my $bridge = Slic3r::ExPolygon->new( - Slic3r::Polygon->new([30023195,14023195],[1776805,14023195],[1776805,1776805],[30023195,1776805]), + Slic3r::Polygon->new([30299990,14299990],[1500010,14299990],[1500010,1500010],[30299990,1500010]), ); my $lower = [ Slic3r::ExPolygon->new( diff --git a/xs/src/libslic3r/BridgeDetector.cpp b/xs/src/libslic3r/BridgeDetector.cpp index 3e3837a5c..507ecca58 100644 --- a/xs/src/libslic3r/BridgeDetector.cpp +++ b/xs/src/libslic3r/BridgeDetector.cpp @@ -3,6 +3,8 @@ #include "Geometry.hpp" #include +#include "SVG.hpp" + namespace Slic3r { BridgeDetector::BridgeDetector(const ExPolygon &_expolygon, const ExPolygonCollection &_lower_slices, @@ -32,7 +34,7 @@ BridgeDetector::BridgeDetector(const ExPolygon &_expolygon, const ExPolygonColle svg.draw(this->expolygon); svg.draw(this->lower_slices, "red"); svg.draw(this->_anchors, "yellow"); - //svg.draw(this->_edges, "black", scale_(0.2)); + svg.draw(this->_edges, "black", scale_(0.2)); svg.Close(); } #endif @@ -63,14 +65,9 @@ BridgeDetector::detect_angle() angles.push_back(i * this->resolution); // we also test angles of each bridge contour - { - Polygons pp = this->expolygon; - for (Polygons::const_iterator p = pp.begin(); p != pp.end(); ++p) { - Lines lines = p->lines(); - for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) - angles.push_back(line->direction()); - } - } + for (const Polygon &p : (Polygons)this->expolygon) + for (const Line &line : p.lines()) + angles.push_back(line.direction()); /* we also test angles of each open supporting edge (this finds the optimal angle for C-shaped supports) */ @@ -97,7 +94,7 @@ BridgeDetector::detect_angle() candidates.push_back(BridgeDirection(angle)); } - const double line_increment = this->extrusion_width; + const coord_t line_increment = this->extrusion_width; bool have_coverage = false; for (BridgeDirection &candidate : candidates) { Polygons my_clip_area = clip_area; @@ -120,30 +117,24 @@ BridgeDetector::detect_angle() const Lines clipped_lines = intersection_ln(lines, my_clip_area); - std::vector lengths; - double total_length = 0; for (const Line &line : clipped_lines) { // skip any line not having both endpoints within anchors if (!Slic3r::Geometry::contains(my_anchors, line.a) || !Slic3r::Geometry::contains(my_anchors, line.b)) continue; - const double len = line.length(); - lengths.push_back(len); - total_length += len; + candidate.max_length = std::max(candidate.max_length, line.length()); + // Calculate coverage as actual covered area, because length of centerlines + // is not accurate enough when such lines are slightly skewed and not parallel + // to the sides; calculating area will compute them as triangles. + // TODO: use a faster algorithm for computing covered area by using a sweep line + // instead of intersecting many lines. + candidate.coverage += Slic3r::Geometry::area(intersection( + my_clip_area, + offset((Polyline)line, +this->extrusion_width/2) + )); } - if (total_length) have_coverage = true; - - // sum length of bridged lines - candidate.coverage = total_length; - - /* The following produces more correct results in some cases and more broken in others. - TODO: investigate, as it looks more reliable than line clipping. */ - // $directions_coverage{$angle} = sum(map $_->area, @{$self->coverage($angle)}) // 0; - - // max length of bridged lines - if (!lengths.empty()) - candidate.max_length = *std::max_element(lengths.begin(), lengths.end()); + if (candidate.coverage > 0) have_coverage = true; } // if no direction produced coverage, then there's no bridge direction @@ -187,21 +178,21 @@ BridgeDetector::coverage(double angle) const // Compute trapezoids according to a vertical orientation Polygons trapezoids; - for (ExPolygons::const_iterator it = grown.begin(); it != grown.end(); ++it) - it->get_trapezoids2(&trapezoids, PI/2.0); + for (const ExPolygon &e : grown) + e.get_trapezoids2(&trapezoids, PI/2.0); // get anchors, convert them to Polygons and rotate them too Polygons anchors; - for (ExPolygons::const_iterator anchor = this->_anchors.begin(); anchor != this->_anchors.end(); ++anchor) { - Polygons pp = *anchor; - for (Polygons::iterator p = pp.begin(); p != pp.end(); ++p) - p->rotate(PI/2.0 - angle, Point(0,0)); - anchors.insert(anchors.end(), pp.begin(), pp.end()); + for (const ExPolygon &anchor : this->_anchors) { + Polygons pp = anchor; + for (Polygon &p : pp) + p.rotate(PI/2.0 - angle, Point(0,0)); + append_to(anchors, pp); } Polygons covered; - for (Polygons::const_iterator trapezoid = trapezoids.begin(); trapezoid != trapezoids.end(); ++trapezoid) { - Lines supported = intersection_ln(trapezoid->lines(), anchors); + for (const Polygon &trapezoid : trapezoids) { + Lines supported = intersection_ln(trapezoid.lines(), anchors); // not nice, we need a more robust non-numeric check for (size_t i = 0; i < supported.size(); ++i) { @@ -211,7 +202,7 @@ BridgeDetector::coverage(double angle) const } } - if (supported.size() >= 2) covered.push_back(*trapezoid); + if (supported.size() >= 2) covered.push_back(trapezoid); } // merge trapezoids and rotate them back @@ -251,10 +242,8 @@ BridgeDetector::unsupported_edges(double angle) const // get bridge edges (both contour and holes) Polylines bridge_edges; - { - Polygons pp = this->expolygon; - bridge_edges.insert(bridge_edges.end(), pp.begin(), pp.end()); // this uses split_at_first_point() - } + for (const Polygon &p : (Polygons)this->expolygon) + bridge_edges.push_back(p.split_at_first_point()); // get unsupported edges Polylines _unsupported = diff_pl( @@ -269,13 +258,10 @@ BridgeDetector::unsupported_edges(double angle) const direction might still benefit from anchors if long enough) double angle_tolerance = PI / 180.0 * 5.0; */ Polylines unsupported; - for (Polylines::const_iterator polyline = _unsupported.begin(); polyline != _unsupported.end(); ++polyline) { - Lines lines = polyline->lines(); - for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) { - if (!Slic3r::Geometry::directions_parallel(line->direction(), angle)) - unsupported.push_back(*line); - } - } + for (const Polyline &polyline : _unsupported) + for (const Line &line : polyline.lines()) + if (!Slic3r::Geometry::directions_parallel(line.direction(), angle)) + unsupported.push_back(line); return unsupported; /* diff --git a/xs/src/libslic3r/BridgeDetector.hpp b/xs/src/libslic3r/BridgeDetector.hpp index 3ba054f5d..84f9f3848 100644 --- a/xs/src/libslic3r/BridgeDetector.hpp +++ b/xs/src/libslic3r/BridgeDetector.hpp @@ -15,7 +15,7 @@ public: // Lower slices, all regions. ExPolygonCollection lower_slices; // Scaled extrusion width of the infill. - double extrusion_width; + coord_t extrusion_width; // Angle resolution for the brute force search of the best bridging angle. double resolution; // The final optimal angle. diff --git a/xs/src/libslic3r/Geometry.cpp b/xs/src/libslic3r/Geometry.cpp index b8584000f..6012fd53b 100644 --- a/xs/src/libslic3r/Geometry.cpp +++ b/xs/src/libslic3r/Geometry.cpp @@ -296,13 +296,27 @@ template bool contains(const std::vector &vector, const Point &point) { - for (typename std::vector::const_iterator it = vector.begin(); it != vector.end(); ++it) { - if (it->contains(point)) return true; - } + for (const T &it : vector) + if (it.contains(point)) + return true; + return false; } +template bool contains(const Polygons &vector, const Point &point); template bool contains(const ExPolygons &vector, const Point &point); +template +double +area(const std::vector &vector) +{ + double area = 0; + for (const T &it : vector) + area += it.area(); + + return area; +} +template double area(const Polygons &vector); + double rad2deg(double angle) { diff --git a/xs/src/libslic3r/Geometry.hpp b/xs/src/libslic3r/Geometry.hpp index 55c760f7e..7a4c304f4 100644 --- a/xs/src/libslic3r/Geometry.hpp +++ b/xs/src/libslic3r/Geometry.hpp @@ -20,6 +20,7 @@ void chained_path(const Points &points, std::vector &retval); template void chained_path_items(Points &points, T &items, T &retval); bool directions_parallel(double angle1, double angle2, double max_diff = 0); template bool contains(const std::vector &vector, const Point &point); +template double area(const std::vector &vector); double rad2deg(double angle); double rad2deg_dir(double angle); double deg2rad(double angle); diff --git a/xs/src/libslic3r/LayerRegion.cpp b/xs/src/libslic3r/LayerRegion.cpp index 7ea5feb97..c8dacf10c 100644 --- a/xs/src/libslic3r/LayerRegion.cpp +++ b/xs/src/libslic3r/LayerRegion.cpp @@ -1,10 +1,16 @@ #include "Layer.hpp" #include "BridgeDetector.hpp" #include "ClipperUtils.hpp" +#include "Geometry.hpp" #include "PerimeterGenerator.hpp" #include "Print.hpp" #include "Surface.hpp" +#include "SVG.hpp" + + + + namespace Slic3r { Flow @@ -65,19 +71,50 @@ LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection* g.process(); } -// This function reads lower_layer->slices and writes this->bridged and this->fill_surfaces, -// so it's thread-safe. +// This function reads layer->slices andlower_layer->slices +// and writes this->bridged and this->fill_surfaces, so it's thread-safe. void LayerRegion::process_external_surfaces() { - const Surfaces &surfaces = this->fill_surfaces.surfaces; + Surfaces &surfaces = this->fill_surfaces.surfaces; + + for (size_t j = 0; j < surfaces.size(); ++j) { + Surface &surface = surfaces[j]; + + if (this->layer()->lower_layer != NULL && surface.is_bridge()) { + // If this bridge has one or more holes that are internal surfaces + // (thus not visible from the outside), like a slab sustained by + // pillars, include them in the bridge in order to have better and + // more continuous bridging. + Polygons &holes = surface.expolygon.holes; + for (int i = 0; i < holes.size(); ++i) { + // reverse the hole and consider it a polygon + Polygon h = holes[i]; + h.reverse(); + + // Is this hole fully contained in the layer slices? + if (diff(h, this->layer()->slices).empty()) { + // remove any other surface contained in this hole + for (int k = 0; k < surfaces.size(); ++k) { + if (k == j) continue; + if (h.contains(surfaces[k].expolygon.contour.first_point())) { + surfaces.erase(surfaces.begin() + k); + --k; + } + } + + holes.erase(holes.begin() + i); + --i; + } + } + } + } SurfaceCollection bottom; + Polygons removed_holes; for (const Surface &surface : surfaces) { if (!surface.is_bottom()) continue; - const ExPolygons grown = offset_ex(surface.expolygon, +SCALED_EXTERNAL_INFILL_MARGIN); - /* detect bridge direction before merging grown surfaces otherwise adjacent bridges would get merged into a single one while they need different directions also, supply the original expolygon instead of the grown one, because in case @@ -104,6 +141,7 @@ LayerRegion::process_external_surfaces() } } + const ExPolygons grown = offset_ex(surface.expolygon, +SCALED_EXTERNAL_INFILL_MARGIN); Surface templ = surface; templ.bridge_angle = angle; bottom.append(grown, templ); diff --git a/xs/src/libslic3r/SVG.cpp b/xs/src/libslic3r/SVG.cpp index a2961d5c7..c0a2f1ff4 100644 --- a/xs/src/libslic3r/SVG.cpp +++ b/xs/src/libslic3r/SVG.cpp @@ -92,10 +92,9 @@ SVG::draw(const ExPolygon &expolygon, std::string fill) this->fill = fill; std::string d; - Polygons pp = expolygon; - for (Polygons::const_iterator p = pp.begin(); p != pp.end(); ++p) { - d += this->get_path_d(*p, true) + " "; - } + for (const Polygon &p : (Polygons)expolygon) + d += this->get_path_d(p, true) + " "; + this->path(d, true); } @@ -105,11 +104,18 @@ SVG::draw(const ExPolygonCollection &coll, std::string fill) this->draw(coll.expolygons, fill); } +void +SVG::draw(const SurfaceCollection &coll, std::string fill) +{ + for (const Surface &s : coll.surfaces) + this->draw(s.expolygon, fill); +} + void SVG::draw(const ExPolygons &expolygons, std::string fill) { - for (ExPolygons::const_iterator it = expolygons.begin(); it != expolygons.end(); ++it) - this->draw(*it, fill); + for (const ExPolygon &e : expolygons) + this->draw(e, fill); } void diff --git a/xs/src/libslic3r/SVG.hpp b/xs/src/libslic3r/SVG.hpp index 60ae23549..b66af152a 100644 --- a/xs/src/libslic3r/SVG.hpp +++ b/xs/src/libslic3r/SVG.hpp @@ -5,6 +5,7 @@ #include "ExPolygon.hpp" #include "ExPolygonCollection.hpp" #include "Line.hpp" +#include "SurfaceCollection.hpp" #include "TriangleMesh.hpp" namespace Slic3r { @@ -26,6 +27,7 @@ class SVG void draw(const ExPolygon &expolygon, std::string fill = "grey"); void draw(const ExPolygons &expolygons, std::string fill = "grey"); void draw(const ExPolygonCollection &coll, std::string fill = "grey"); + void draw(const SurfaceCollection &coll, std::string fill = "grey"); void draw(const Polygon &polygon, std::string fill = "grey"); void draw(const Polygons &polygons, std::string fill = "grey"); void draw(const Polyline &polyline, std::string stroke = "black", coord_t stroke_width = 0); diff --git a/xs/src/libslic3r/SurfaceCollection.hpp b/xs/src/libslic3r/SurfaceCollection.hpp index 590ea4aae..bb75e0d0d 100644 --- a/xs/src/libslic3r/SurfaceCollection.hpp +++ b/xs/src/libslic3r/SurfaceCollection.hpp @@ -41,6 +41,7 @@ class SurfaceCollection bool empty() const { return this->surfaces.empty(); }; size_t size() const { return this->surfaces.size(); }; void clear() { this->surfaces.clear(); }; + void erase(size_t i) { this->surfaces.erase(this->surfaces.begin() + i); }; }; } From 5c2ab11fcdfccc8901d57c9f51cd7abbb621d628 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 3 Apr 2017 20:53:11 +0200 Subject: [PATCH 35/85] Removed debugging lines --- xs/src/libslic3r/BridgeDetector.cpp | 2 -- xs/src/libslic3r/LayerRegion.cpp | 5 ----- 2 files changed, 7 deletions(-) diff --git a/xs/src/libslic3r/BridgeDetector.cpp b/xs/src/libslic3r/BridgeDetector.cpp index 507ecca58..33c239d6f 100644 --- a/xs/src/libslic3r/BridgeDetector.cpp +++ b/xs/src/libslic3r/BridgeDetector.cpp @@ -3,8 +3,6 @@ #include "Geometry.hpp" #include -#include "SVG.hpp" - namespace Slic3r { BridgeDetector::BridgeDetector(const ExPolygon &_expolygon, const ExPolygonCollection &_lower_slices, diff --git a/xs/src/libslic3r/LayerRegion.cpp b/xs/src/libslic3r/LayerRegion.cpp index c8dacf10c..fdf0777e3 100644 --- a/xs/src/libslic3r/LayerRegion.cpp +++ b/xs/src/libslic3r/LayerRegion.cpp @@ -6,11 +6,6 @@ #include "Print.hpp" #include "Surface.hpp" -#include "SVG.hpp" - - - - namespace Slic3r { Flow From f725b519e848694ea9ced856846161192b291d84 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 3 Apr 2017 22:12:13 -0500 Subject: [PATCH 36/85] Fixed validator to properly only trigger on 0% or 0. --- lib/Slic3r/Config.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 8de55e259..167c733dd 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -271,8 +271,8 @@ sub validate { # support material if ($self->support_material) { - die "Angle value of 0 is illegal. Use some % value instead (e.g. 150%)\n" - if $self->support_material_threshold == 0 || $self->support_material_threshold eq '0'; + die "Value of 0 is illegal. Use some % value instead (e.g. 150%) for auto.\n" + if $self->support_material_threshold =~ /^0+/; } From c41510e86b6e86b041dbf18314c6cb03edc80def Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Tue, 4 Apr 2017 03:58:20 +0000 Subject: [PATCH 37/85] Use wxpar to pull the shared libs to ./shlib/ --- package/common/util.sh | 1 + package/linux/make_archive.sh | 8 +++++--- package/linux/startup_script.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package/common/util.sh b/package/common/util.sh index 389617eb0..6292d15e4 100644 --- a/package/common/util.sh +++ b/package/common/util.sh @@ -88,4 +88,5 @@ function set_pr_id () function install_par () { cpanm -q PAR::Packer + cpanm -q Wx::Perl::Packager } diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index fd4fad26b..ed4d9cd70 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -43,7 +43,7 @@ echo "Appfolder: $appfolder, archivefolder: $archivefolder" # Our slic3r dir and location of perl PERL_BIN=$(which perl) -PP_BIN=$(which pp) +PP_BIN=$(which wxpar) SLIC3R_DIR="./" if [[ -d "${appfolder}" ]]; then @@ -61,7 +61,6 @@ mkdir -p $appfolder echo "Copying resources..." cp -rf $SLIC3R_DIR/var $resourcefolder/ -mv $resourcefolder/var/Slic3r.icns $resourcefolder echo "Copying Slic3r..." cp $SLIC3R_DIR/slic3r.pl $archivefolder/slic3r.pl @@ -90,7 +89,8 @@ chmod +x $archivefolder/$appname echo "Copying perl from $PERL_BIN" cp -f $PERL_BIN $archivefolder/perl-local -${PP_BIN} -M attributes -M base -M bytes -M B -M POSIX \ +${PP_BIN} wxextension .0 \ + -M attributes -M base -M bytes -M B -M POSIX \ -M FindBin -M Unicode::Normalize -M Tie::Handle \ -M Time::Local -M Math::Trig \ -M lib -M overload \ @@ -99,6 +99,8 @@ ${PP_BIN} -M attributes -M base -M bytes -M B -M POSIX \ -B -p -e "print 123" -o $WD/_tmp/test.par unzip -qq -o $WD/_tmp/test.par -d $WD/_tmp/ cp -rf $WD/_tmp/lib/* $archivefolder/local-lib/lib/perl5/ +cp -rf $WD/_tmp/shlib $archivefolder/ + rm -rf $WD/_tmp echo "Cleaning local-lib" diff --git a/package/linux/startup_script.sh b/package/linux/startup_script.sh index 82757118b..53cea63d6 100644 --- a/package/linux/startup_script.sh +++ b/package/linux/startup_script.sh @@ -1,5 +1,5 @@ #!/bin/bash DIR=$(dirname "$0") -export LD_LIBRARY_PATH=./bin +export LD_LIBRARY_PATH=./shlib/x86_64-linux-thread-multi/ exec "$DIR/perl-local" -I"$DIR/local-lib/lib/perl5" "$DIR/slic3r.pl" $@ From 43506ee376f7bf72d7aa92de991fc06a5b8c3694 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 11:59:08 +0200 Subject: [PATCH 38/85] Prevent rare crashes --- lib/Slic3r.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 37f242e72..d759d1b34 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -103,11 +103,14 @@ sub spawn_thread { my $parent_tid = threads->tid; lock @threads; + # Set up a default handler for preventing crashes in case signals are received before + # thread sets its handlers. + $SIG{'STOP'} = sub {}; + @_ = (); my $thread = threads->create(sub { @my_threads = (); - Slic3r::debugf "Starting thread %d (parent: %d)...\n", threads->tid, $parent_tid; local $SIG{'KILL'} = sub { Slic3r::debugf "Exiting thread %d...\n", threads->tid; $parallel_sema->up if $parallel_sema; @@ -119,6 +122,7 @@ sub spawn_thread { $pause_sema->down; $pause_sema->up; }; + Slic3r::debugf "Starting thread %d (parent: %d)...\n", threads->tid, $parent_tid; $cb->(); }); push @my_threads, $thread->tid; From e47a1e7d90a4daffbe367742471d72343a09fd5a Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 11:59:51 +0200 Subject: [PATCH 39/85] Fix the Send to Printer dialog. #3789 #3811 --- lib/Slic3r/GUI/Plater.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 6b21b8aad..b641398dc 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -2573,7 +2573,7 @@ sub new { EVT_BUTTON($self, wxID_OK, sub { wxTheApp->save_settings; $self->EndModal(wxID_OK); - $self->Close; # needed on Linux + $self->Destroy; }); $self->SetSizer($sizer); From 557f1e234dcde3eda4369a877560ba909683de0d Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 15:01:46 +0200 Subject: [PATCH 40/85] Potential fix for regression in solid_infill_below_area on Windows. #3794 --- xs/src/libslic3r/LayerRegion.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xs/src/libslic3r/LayerRegion.cpp b/xs/src/libslic3r/LayerRegion.cpp index fdf0777e3..148dd843c 100644 --- a/xs/src/libslic3r/LayerRegion.cpp +++ b/xs/src/libslic3r/LayerRegion.cpp @@ -249,7 +249,8 @@ LayerRegion::prepare_fill_surfaces() const float &fill_density = this->region()->config.fill_density; if (fill_density > 0 && fill_density < 100) { // scaling an area requires two calls! - const double min_area = scale_(scale_(this->region()->config.solid_infill_below_area.value)); + // (we don't use scale_() because it would overflow the coord_t range + const double min_area = this->region()->config.solid_infill_below_area.value / SCALING_FACTOR / SCALING_FACTOR; for (Surface &surface : this->fill_surfaces.surfaces) { if (surface.surface_type == stInternal && surface.area() <= min_area) surface.surface_type = stInternalSolid; From 99c86bcf91e6a19976d7313a9d57f771367dba51 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 15:35:31 +0200 Subject: [PATCH 41/85] Make FillRectilinear more tolerant with degenerate polygons. #2941 --- xs/src/libslic3r/Fill/FillRectilinear.cpp | 36 +++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/xs/src/libslic3r/Fill/FillRectilinear.cpp b/xs/src/libslic3r/Fill/FillRectilinear.cpp index bfee321ed..f2e5ba7a3 100644 --- a/xs/src/libslic3r/Fill/FillRectilinear.cpp +++ b/xs/src/libslic3r/Fill/FillRectilinear.cpp @@ -340,7 +340,12 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon, // Get the first lower point. vertical_t::iterator it = v.begin(); // minimum x,y IntersectionPoint p = it->second; - assert(p.type == IntersectionPoint::ipTypeLower); + if (p.type != IntersectionPoint::ipTypeLower) { + // Degenerate polygon, this shouldn't happen. + // We used to have an assert here, but let's be tolerant. + grid.erase(p.x); + continue; + } // Start our polyline. Polyline polyline; @@ -351,17 +356,32 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon, // Complete the vertical line by finding the corresponding upper or lower point. if (p.type == IntersectionPoint::ipTypeUpper) { // find first point along c.x with y < c.y - assert(it != grid[p.x].begin()); + if (it == grid[p.x].begin()) { + // Degenerate polygon, this shouldn't happen. + // We used to have an assert here, but let's be tolerant. + grid.erase(p.x); + break; + } --it; } else { // find first point along c.x with y > c.y ++it; - assert(it != grid[p.x].end()); + if (it == grid[p.x].end()) { + // Degenerate polygon, this shouldn't happen. + // We used to have an assert here, but let's be tolerant. + grid.erase(p.x); + break; + } } // Append the point to our polyline. IntersectionPoint b = it->second; - assert(b.type != p.type); + if (b.type == p.type) { + // Degenerate polygon, this shouldn't happen. + // We used to have an assert here, but let's be tolerant. + grid.erase(p.x); + break; + } polyline.append(b); polyline.points.back().y += this->endpoints_overlap * (b.type == IntersectionPoint::ipTypeUpper ? 1 : -1); @@ -409,8 +429,12 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon, // If the connection brought us to another x coordinate, we expect the point // type to be the same. - assert((p.type == b.type && p.x > b.x) - || (p.type != b.type && p.x == b.x)); + if (!(p.type == b.type && p.x > b.x) && !(p.type != b.type && p.x == b.x)) { + // Degenerate polygon, this shouldn't happen. + // We used to have an assert here, but let's be tolerant. + grid.erase(p.x); + break; + } } // Yay, we have a polyline! From 1cd4bca6482a154fe030c858ed9561588704d9ee Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 15:47:00 +0200 Subject: [PATCH 42/85] Fixed regression causing background processing to be partially active regardless of preferences. #3843 --- lib/Slic3r/GUI/Plater.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index b641398dc..364f9c191 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1398,12 +1398,12 @@ sub async_apply_config { $self->{toolpaths2D}->reload_print if $self->{toolpaths2D}; $self->{preview3D}->reload_print if $self->{preview3D}; + if (!$Slic3r::GUI::Settings->{_}{background_processing}) { + $self->hide_preview if $invalidated; + return; + } + if ($invalidated) { - if (!$Slic3r::GUI::Settings->{_}{background_processing}) { - $self->hide_preview; - return; - } - # kill current thread if any $self->stop_background_process; # remove the sliced statistics box because something changed. From de1c900d8fd1551207761949631d80041b60f568 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 17:10:43 +0200 Subject: [PATCH 43/85] Since prepare_infill is not actually idempotent, recalculate perimeters every time. #3827 --- lib/Slic3r/Print/Object.pm | 14 ++++++++++---- xs/src/libslic3r/LayerRegion.cpp | 3 +-- xs/src/libslic3r/PrintRegion.cpp | 14 +++++++++++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 3e9f38d22..368a23406 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -155,12 +155,18 @@ sub detect_surfaces_type { sub prepare_infill { my ($self) = @_; - # prerequisites - $self->make_perimeters; # do we need them? TODO: check - $self->detect_surfaces_type; - return if $self->step_done(STEP_PREPARE_INFILL); $self->set_step_started(STEP_PREPARE_INFILL); + + # This prepare_infill() is not really idempotent. + # TODO: It should clear and regenerate fill_surfaces at every run + # instead of modifying it in place. + $self->invalidate_step(STEP_PERIMETERS); + $self->make_perimeters; + + # prerequisites + $self->detect_surfaces_type; + $self->print->status_cb->(30, "Preparing infill"); # decide what surfaces are to be filled diff --git a/xs/src/libslic3r/LayerRegion.cpp b/xs/src/libslic3r/LayerRegion.cpp index 148dd843c..5b4a6cc5c 100644 --- a/xs/src/libslic3r/LayerRegion.cpp +++ b/xs/src/libslic3r/LayerRegion.cpp @@ -66,7 +66,7 @@ LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection* g.process(); } -// This function reads layer->slices andlower_layer->slices +// This function reads layer->slices and lower_layer->slices // and writes this->bridged and this->fill_surfaces, so it's thread-safe. void LayerRegion::process_external_surfaces() @@ -106,7 +106,6 @@ LayerRegion::process_external_surfaces() } SurfaceCollection bottom; - Polygons removed_holes; for (const Surface &surface : surfaces) { if (!surface.is_bottom()) continue; diff --git a/xs/src/libslic3r/PrintRegion.cpp b/xs/src/libslic3r/PrintRegion.cpp index cb4e7fa2e..c5a1c948e 100644 --- a/xs/src/libslic3r/PrintRegion.cpp +++ b/xs/src/libslic3r/PrintRegion.cpp @@ -85,11 +85,19 @@ PrintRegion::invalidate_state_by_config(const PrintConfigBase &config) steps.insert(posPerimeters); } else if (opt_key == "first_layer_extrusion_width") { steps.insert(posSupportMaterial); + } else if (opt_key == "solid_infill_below_area") { + const float &cur_value = config.opt(opt_key)->value; + const float &new_value = this->config.solid_infill_below_area.value; + if (new_value >= cur_value) { + steps.insert(posPrepareInfill); + } else { + // prepare_infill is not idempotent when solid_infill_below_area is reduced + steps.insert(posPerimeters); + } } else if (opt_key == "infill_every_layers" || opt_key == "solid_infill_every_layers" || opt_key == "bottom_solid_layers" || opt_key == "top_solid_layers" - || opt_key == "solid_infill_below_area" || opt_key == "infill_extruder" || opt_key == "solid_infill_extruder" || opt_key == "infill_extrusion_width") { @@ -108,10 +116,10 @@ PrintRegion::invalidate_state_by_config(const PrintConfigBase &config) } else if (opt_key == "fill_density") { const float &cur_value = config.opt("fill_density")->value; const float &new_value = this->config.fill_density.value; - if ((cur_value == 0) != (new_value == 0)) + if ((cur_value == 0) != (new_value == 0) || (cur_value == 100) != (new_value == 100)) steps.insert(posPerimeters); - steps.insert(posPrepareInfill); + steps.insert(posInfill); } else if (opt_key == "external_perimeter_extrusion_width" || opt_key == "perimeter_extruder") { steps.insert(posPerimeters); From bc96a1a268674b2b88edf9b9987d638ee6d9f800 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 18:51:06 +0200 Subject: [PATCH 44/85] New customizable G-code to be added between objects when using sequential printing. (by @lordofhyphens) #3264 #3275 --- lib/Slic3r/GUI/PresetEditor.pm | 11 ++++++++++- lib/Slic3r/Print/GCode.pm | 15 ++++++++++----- t/custom_gcode.t | 11 ++++++++++- xs/src/libslic3r/Print.cpp | 1 + xs/src/libslic3r/PrintConfig.cpp | 9 +++++++++ xs/src/libslic3r/PrintConfig.hpp | 2 ++ 6 files changed, 42 insertions(+), 7 deletions(-) diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index 52b8067ab..dbeae5568 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -1166,7 +1166,7 @@ sub options { octoprint_host octoprint_apikey use_firmware_retraction pressure_advance vibration_limit use_volumetric_e - start_gcode end_gcode before_layer_gcode layer_gcode toolchange_gcode + start_gcode end_gcode before_layer_gcode layer_gcode toolchange_gcode between_objects_gcode notes nozzle_diameter extruder_offset retract_length retract_lift retract_speed retract_restart_extra retract_before_travel retract_layer_change wipe @@ -1368,6 +1368,15 @@ sub build { $option->height(150); $optgroup->append_single_option_line($option); } + { + my $optgroup = $page->new_optgroup('Between objects G-code (for sequential printing)', + label_width => 0, + ); + my $option = $optgroup->get_option('between_objects_gcode'); + $option->full_width(1); + $option->height(150); + $optgroup->append_single_option_line($option); + } } $self->{extruder_pages} = []; diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index c0e6237c7..710125c5e 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -146,12 +146,14 @@ sub export { } # set extruder(s) temperature before and after start G-code - $self->_print_first_layer_temperature(0); + $self->_print_first_layer_temperature(0) + if $self->config->start_gcode !~ /M(?:109|104)/i; printf $fh "%s\n", $gcodegen->placeholder_parser->process($self->config->start_gcode); foreach my $start_gcode (@{ $self->config->start_filament_gcode }) { # process filament gcode in order printf $fh "%s\n", $gcodegen->placeholder_parser->process($start_gcode); } - $self->_print_first_layer_temperature(1); + $self->_print_first_layer_temperature(1) + if $self->config->start_gcode !~ /M(?:109|104)/i; # set other general things print $fh $gcodegen->preamble; @@ -246,8 +248,12 @@ sub export { # is triggered, so machine has more time to reach such temperatures if ($layer->id == 0 && $finished_objects > 0) { printf $fh $gcodegen->writer->set_bed_temperature($self->config->first_layer_bed_temperature), - if $self->config->first_layer_bed_temperature && $self->config->has_heatbed; - $self->_print_first_layer_temperature(0); + if $self->config->first_layer_bed_temperature + && $self->config->has_heatbed + && $self->config->between_objects_gcode !~ /M(?:190|140)/i; + $self->_print_first_layer_temperature(0) + if $self->config->between_objects_gcode !~ /M(?:109|104)/i; + printf $fh "%s\n", $gcodegen->placeholder_parser->process($self->config->between_objects_gcode); } $self->process_layer($layer, [$copy]); } @@ -336,7 +342,6 @@ sub export { sub _print_first_layer_temperature { my ($self, $wait) = @_; - return if $self->config->start_gcode =~ /M(?:109|104)/i; for my $t (@{$self->print->extruders}) { my $temp = $self->config->get_at('first_layer_temperature', $t); $temp += $self->config->standby_temperature_delta if $self->config->ooze_prevention; diff --git a/t/custom_gcode.t b/t/custom_gcode.t index 653bb26ae..9b58344ef 100644 --- a/t/custom_gcode.t +++ b/t/custom_gcode.t @@ -1,4 +1,4 @@ -use Test::More tests => 15; +use Test::More tests => 16; use strict; use warnings; @@ -132,4 +132,13 @@ use Slic3r::Test; 'layer_num grows continously'; # i.e. no duplicates or regressions } +{ + my $config = Slic3r::Config->new_from_defaults; + $config->set('complete_objects', 1); + $config->set('between_objects_gcode', '_MY_CUSTOM_GCODE_'); + my $print = Slic3r::Test::init_print('20mm_cube', config => $config, duplicate => 3); + my $gcode = Slic3r::Test::gcode($print); + is scalar(() = $gcode =~ /^_MY_CUSTOM_GCODE_/gm), 2, 'between_objects_gcode is applied correctly'; +} + __END__ diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index deb1d3135..46bd7fd0e 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -179,6 +179,7 @@ Print::invalidate_state_by_config(const PrintConfigBase &config) } else if (opt_key == "avoid_crossing_perimeters" || opt_key == "bed_shape" || opt_key == "bed_temperature" + || opt_key == "between_objects_gcode" || opt_key == "bridge_acceleration" || opt_key == "bridge_fan_speed" || opt_key == "complete_objects" diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 914a8e7bf..def3c4220 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -64,6 +64,15 @@ PrintConfigDef::PrintConfigDef() def->height = 50; def->default_value = new ConfigOptionString(""); + def = this->add("between_objects_gcode", coString); + def->label = "Between objects G-code"; + def->tooltip = "This code is inserted between objects when using sequential printing. By default extruder and bed temperature are reset using non-wait command; however if M104, M109, M140 or M190 are detected in this custom code, Slic3r will not add temperature commands. Note that you can use placeholder variables for all Slic3r settings, so you can put a \"M109 S[first_layer_temperature]\" command wherever you want."; + def->cli = "between-objects-gcode=s"; + def->multiline = true; + def->full_width = true; + def->height = 120; + def->default_value = new ConfigOptionString(""); + def = this->add("bottom_infill_pattern", external_fill_pattern); def->label = "Bottom"; def->full_label = "Bottom infill pattern"; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 28d674fa7..494e7754c 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -292,6 +292,7 @@ class GCodeConfig : public virtual StaticPrintConfig { public: ConfigOptionString before_layer_gcode; + ConfigOptionString between_objects_gcode; ConfigOptionString end_gcode; ConfigOptionStrings end_filament_gcode; ConfigOptionString extrusion_axis; @@ -329,6 +330,7 @@ class GCodeConfig : public virtual StaticPrintConfig virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) { OPT_PTR(before_layer_gcode); + OPT_PTR(between_objects_gcode); OPT_PTR(end_gcode); OPT_PTR(end_filament_gcode); OPT_PTR(extrusion_axis); From 8f66d8832038490b0e1469564fd1dabe2fb4d155 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 19:18:18 +0200 Subject: [PATCH 45/85] Bugfix: inconsistent scaling when object had multiple copies in plater. #3798 --- xs/src/libslic3r/Model.cpp | 12 +++++++----- xs/src/libslic3r/Model.hpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index 5243799ca..d3127f917 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -753,18 +753,20 @@ ModelObject::mirror(const Axis &axis) } void -ModelObject::transform_by_instance(const ModelInstance &instance, bool dont_translate) +ModelObject::transform_by_instance(ModelInstance instance, bool dont_translate) { + // We get instance by copy because we would alter it in the loop below, + // causing inconsistent values in subsequent instances. this->rotate(instance.rotation, Z); this->scale(instance.scaling_factor); if (!dont_translate) this->translate(instance.offset.x, instance.offset.y, 0); - for (ModelInstancePtrs::iterator i = this->instances.begin(); i != this->instances.end(); ++i) { - (*i)->rotation -= instance.rotation; - (*i)->scaling_factor /= instance.scaling_factor; + for (ModelInstance* i : this->instances) { + i->rotation -= instance.rotation; + i->scaling_factor /= instance.scaling_factor; if (!dont_translate) - (*i)->offset.translate(-instance.offset.x, -instance.offset.y); + i->offset.translate(-instance.offset.x, -instance.offset.y); } this->origin_translation = Pointf3(0,0,0); this->invalidate_bounding_box(); diff --git a/xs/src/libslic3r/Model.hpp b/xs/src/libslic3r/Model.hpp index 36571ff5d..fed54b601 100644 --- a/xs/src/libslic3r/Model.hpp +++ b/xs/src/libslic3r/Model.hpp @@ -160,7 +160,7 @@ class ModelObject void scale_to_fit(const Sizef3 &size); void rotate(float angle, const Axis &axis); void mirror(const Axis &axis); - void transform_by_instance(const ModelInstance &instance, bool dont_translate = false); + void transform_by_instance(ModelInstance instance, bool dont_translate = false); size_t materials_count() const; size_t facets_count() const; bool needed_repair() const; From 139aeb86ff0e9e99c8e8ca598880983c333cb9ce Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 19:57:11 +0200 Subject: [PATCH 46/85] Workaround for wxPerl not loading shared libraries when package is in a non-ASCII paths. #3763 --- lib/Slic3r/GUI.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index d90c56c34..ce94d0882 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -3,6 +3,19 @@ use strict; use warnings; use utf8; +use Wx 0.9901 qw(:bitmap :dialog :icon :id :misc :systemsettings :toplevelwindow + :filedialog :font); + +BEGIN { + # Wrap the Wx::_load_plugin() function which doesn't work with non-ASCII paths + no warnings 'redefine'; + my $orig = *Wx::_load_plugin{CODE}; + *Wx::_load_plugin = sub { + $_[0] = Slic3r::decode_path($_[0]); + $orig->(@_); + }; +} + use File::Basename qw(basename); use FindBin; use List::Util qw(first any); @@ -41,8 +54,6 @@ use Slic3r::GUI::SLAPrintOptions; 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 - :filedialog :font); use Wx::Event qw(EVT_IDLE EVT_COMMAND); use base 'Wx::App'; From 27c98d6bf001ff080d315802a8274eb9ad6b7b90 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 22:05:37 +0200 Subject: [PATCH 47/85] List @kliment among contributors --- README.md | 2 +- lib/Slic3r/GUI/AboutDialog.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2a96554fc..7f3de1b8b 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ The main author of Slic3r is Alessandro Ranellucci (@alexrj, *Sound* in IRC, [@a Joseph Lenox (@lordofhyphens, *Loh* in IRC) is the current co-maintainer. -Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others. Original manual by Gary Hodgson. Slic3r logo designed by Corey Daniels, Silk Icon Set designed by Mark James. +Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Y. Sapir, Mike Sheldrake, Kliment Yanev and numerous others. Original manual by Gary Hodgson. Slic3r logo designed by Corey Daniels, Silk Icon Set designed by Mark James. ### How can I invoke Slic3r using the command line? diff --git a/lib/Slic3r/GUI/AboutDialog.pm b/lib/Slic3r/GUI/AboutDialog.pm index 831377a1f..85d7a6fda 100644 --- a/lib/Slic3r/GUI/AboutDialog.pm +++ b/lib/Slic3r/GUI/AboutDialog.pm @@ -47,11 +47,11 @@ sub new { '' . '' . '' . - 'Copyright © 2011-2016 Alessandro Ranellucci.
' . + 'Copyright © 2011-2017 Alessandro Ranellucci.
' . 'Slic3r is licensed under the ' . 'GNU Affero General Public License, version 3.' . '


' . - 'Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others. ' . + 'Contributions by Henrik Brix Andersen, Vojtech Bubnik, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Kliment Yanev and numerous others. ' . 'Manual by Gary Hodgson. Inspired by the RepRap community.
' . 'Slic3r logo designed by Corey Daniels, Silk Icon Set designed by Mark James. ' . '
' . From 5d1f6a632acc313ba6c0f60742d6d4821416570f Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 23:28:53 +0200 Subject: [PATCH 48/85] Make the PrintConfigDef instances const --- xs/src/libslic3r/PrintConfig.cpp | 4 +- xs/src/libslic3r/PrintConfig.hpp | 4 +- xs/xsp/Config.xsp | 94 ++++++++++++++++---------------- 3 files changed, 50 insertions(+), 52 deletions(-) diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index def3c4220..8a63ef268 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -1598,7 +1598,7 @@ PrintConfigDef::PrintConfigDef() def->default_value = new ConfigOptionFloat(0); } -PrintConfigDef print_config_def; +const PrintConfigDef print_config_def; void DynamicPrintConfig::normalize() { @@ -1831,6 +1831,6 @@ CLIConfigDef::CLIConfigDef() def->default_value = new ConfigOptionPoint3(Pointf3(0,0,0)); } -CLIConfigDef cli_config_def; +const CLIConfigDef cli_config_def; } diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 494e7754c..5b4206266 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -103,7 +103,7 @@ class PrintConfigDef : public ConfigDef // The one and only global definition of SLic3r configuration options. // This definition is constant. -extern PrintConfigDef print_config_def; +extern const PrintConfigDef print_config_def; // Slic3r configuration storage with print_config_def assigned. class PrintConfigBase : public virtual ConfigBase @@ -611,7 +611,7 @@ class CLIConfigDef : public ConfigDef CLIConfigDef(); }; -extern CLIConfigDef cli_config_def; +extern const CLIConfigDef cli_config_def; class CLIConfig : public virtual ConfigBase, public StaticConfig diff --git a/xs/xsp/Config.xsp b/xs/xsp/Config.xsp index 6744a1e10..75dc35405 100644 --- a/xs/xsp/Config.xsp +++ b/xs/xsp/Config.xsp @@ -110,92 +110,90 @@ PROTOTYPES: DISABLE SV* print_config_def() CODE: - t_optiondef_map &def = Slic3r::print_config_def.options; - HV* options_hv = newHV(); - for (t_optiondef_map::iterator oit = def.begin(); oit != def.end(); ++oit) { + for (const auto &oit : Slic3r::print_config_def.options) { HV* hv = newHV(); - t_config_option_key opt_key = oit->first; - ConfigOptionDef* optdef = &oit->second; + const t_config_option_key &opt_key = oit.first; + const ConfigOptionDef &optdef = oit.second; const char* opt_type; - if (optdef->type == coFloat || optdef->type == coFloats || optdef->type == coFloatOrPercent) { + if (optdef.type == coFloat || optdef.type == coFloats || optdef.type == coFloatOrPercent) { opt_type = "f"; - } else if (optdef->type == coPercent) { + } else if (optdef.type == coPercent) { opt_type = "percent"; - } else if (optdef->type == coInt || optdef->type == coInts) { + } else if (optdef.type == coInt || optdef.type == coInts) { opt_type = "i"; - } else if (optdef->type == coString) { + } else if (optdef.type == coString) { opt_type = "s"; - } else if (optdef->type == coStrings) { + } else if (optdef.type == coStrings) { opt_type = "s@"; - } else if (optdef->type == coPoint || optdef->type == coPoint3 || optdef->type == coPoints) { + } else if (optdef.type == coPoint || optdef.type == coPoint3 || optdef.type == coPoints) { opt_type = "point"; - } else if (optdef->type == coBool || optdef->type == coBools) { + } else if (optdef.type == coBool || optdef.type == coBools) { opt_type = "bool"; - } else if (optdef->type == coEnum) { + } else if (optdef.type == coEnum) { opt_type = "select"; } else { throw "Unknown option type"; } (void)hv_stores( hv, "type", newSVpv(opt_type, 0) ); - (void)hv_stores( hv, "gui_type", newSVpvn(optdef->gui_type.c_str(), optdef->gui_type.length()) ); - (void)hv_stores( hv, "gui_flags", newSVpvn(optdef->gui_flags.c_str(), optdef->gui_flags.length()) ); - (void)hv_stores( hv, "label", newSVpvn_utf8(optdef->label.c_str(), optdef->label.length(), true) ); - if (!optdef->full_label.empty()) - (void)hv_stores( hv, "full_label", newSVpvn_utf8(optdef->full_label.c_str(), optdef->full_label.length(), true) ); - (void)hv_stores( hv, "category", newSVpvn_utf8(optdef->category.c_str(), optdef->category.length(), true) ); - (void)hv_stores( hv, "tooltip", newSVpvn_utf8(optdef->tooltip.c_str(), optdef->tooltip.length(), true) ); - (void)hv_stores( hv, "sidetext", newSVpvn_utf8(optdef->sidetext.c_str(), optdef->sidetext.length(), true) ); - (void)hv_stores( hv, "cli", newSVpvn(optdef->cli.c_str(), optdef->cli.length()) ); - (void)hv_stores( hv, "ratio_over", newSVpvn(optdef->ratio_over.c_str(), optdef->ratio_over.length()) ); - (void)hv_stores( hv, "multiline", newSViv(optdef->multiline ? 1 : 0) ); - (void)hv_stores( hv, "full_width", newSViv(optdef->full_width ? 1 : 0) ); - (void)hv_stores( hv, "readonly", newSViv(optdef->readonly ? 1 : 0) ); - (void)hv_stores( hv, "height", newSViv(optdef->height) ); - (void)hv_stores( hv, "width", newSViv(optdef->width) ); - (void)hv_stores( hv, "min", newSViv(optdef->min) ); - (void)hv_stores( hv, "max", newSViv(optdef->max) ); + (void)hv_stores( hv, "gui_type", newSVpvn(optdef.gui_type.c_str(), optdef.gui_type.length()) ); + (void)hv_stores( hv, "gui_flags", newSVpvn(optdef.gui_flags.c_str(), optdef.gui_flags.length()) ); + (void)hv_stores( hv, "label", newSVpvn_utf8(optdef.label.c_str(), optdef.label.length(), true) ); + if (!optdef.full_label.empty()) + (void)hv_stores( hv, "full_label", newSVpvn_utf8(optdef.full_label.c_str(), optdef.full_label.length(), true) ); + (void)hv_stores( hv, "category", newSVpvn_utf8(optdef.category.c_str(), optdef.category.length(), true) ); + (void)hv_stores( hv, "tooltip", newSVpvn_utf8(optdef.tooltip.c_str(), optdef.tooltip.length(), true) ); + (void)hv_stores( hv, "sidetext", newSVpvn_utf8(optdef.sidetext.c_str(), optdef.sidetext.length(), true) ); + (void)hv_stores( hv, "cli", newSVpvn(optdef.cli.c_str(), optdef.cli.length()) ); + (void)hv_stores( hv, "ratio_over", newSVpvn(optdef.ratio_over.c_str(), optdef.ratio_over.length()) ); + (void)hv_stores( hv, "multiline", newSViv(optdef.multiline ? 1 : 0) ); + (void)hv_stores( hv, "full_width", newSViv(optdef.full_width ? 1 : 0) ); + (void)hv_stores( hv, "readonly", newSViv(optdef.readonly ? 1 : 0) ); + (void)hv_stores( hv, "height", newSViv(optdef.height) ); + (void)hv_stores( hv, "width", newSViv(optdef.width) ); + (void)hv_stores( hv, "min", newSViv(optdef.min) ); + (void)hv_stores( hv, "max", newSViv(optdef.max) ); // aliases - if (!optdef->aliases.empty()) { + if (!optdef.aliases.empty()) { AV* av = newAV(); - av_fill(av, optdef->aliases.size()-1); - for (std::vector::iterator it = optdef->aliases.begin(); it != optdef->aliases.end(); ++it) - av_store(av, it - optdef->aliases.begin(), newSVpvn(it->c_str(), it->length())); + av_fill(av, optdef.aliases.size()-1); + for (std::vector::const_iterator it = optdef.aliases.begin(); it != optdef.aliases.end(); ++it) + av_store(av, it - optdef.aliases.begin(), newSVpvn(it->c_str(), it->length())); (void)hv_stores( hv, "aliases", newRV_noinc((SV*)av) ); } // shortcut - if (!optdef->shortcut.empty()) { + if (!optdef.shortcut.empty()) { AV* av = newAV(); - av_fill(av, optdef->shortcut.size()-1); - for (std::vector::iterator it = optdef->shortcut.begin(); it != optdef->shortcut.end(); ++it) - av_store(av, it - optdef->shortcut.begin(), newSVpvn(it->c_str(), it->length())); + av_fill(av, optdef.shortcut.size()-1); + for (std::vector::const_iterator it = optdef.shortcut.begin(); it != optdef.shortcut.end(); ++it) + av_store(av, it - optdef.shortcut.begin(), newSVpvn(it->c_str(), it->length())); (void)hv_stores( hv, "shortcut", newRV_noinc((SV*)av) ); } // enum_values - if (!optdef->enum_values.empty()) { + if (!optdef.enum_values.empty()) { AV* av = newAV(); - av_fill(av, optdef->enum_values.size()-1); - for (std::vector::iterator it = optdef->enum_values.begin(); it != optdef->enum_values.end(); ++it) - av_store(av, it - optdef->enum_values.begin(), newSVpvn(it->c_str(), it->length())); + av_fill(av, optdef.enum_values.size()-1); + for (std::vector::const_iterator it = optdef.enum_values.begin(); it != optdef.enum_values.end(); ++it) + av_store(av, it - optdef.enum_values.begin(), newSVpvn(it->c_str(), it->length())); (void)hv_stores( hv, "values", newRV_noinc((SV*)av) ); } // enum_labels - if (!optdef->enum_labels.empty()) { + if (!optdef.enum_labels.empty()) { AV* av = newAV(); - av_fill(av, optdef->enum_labels.size()-1); - for (std::vector::iterator it = optdef->enum_labels.begin(); it != optdef->enum_labels.end(); ++it) - av_store(av, it - optdef->enum_labels.begin(), newSVpvn_utf8(it->c_str(), it->length(), true)); + av_fill(av, optdef.enum_labels.size()-1); + for (std::vector::const_iterator it = optdef.enum_labels.begin(); it != optdef.enum_labels.end(); ++it) + av_store(av, it - optdef.enum_labels.begin(), newSVpvn_utf8(it->c_str(), it->length(), true)); (void)hv_stores( hv, "labels", newRV_noinc((SV*)av) ); } - if (optdef->default_value != NULL) - (void)hv_stores( hv, "default", ConfigOption_to_SV(*optdef->default_value, *optdef) ); + if (optdef.default_value != NULL) + (void)hv_stores( hv, "default", ConfigOption_to_SV(*optdef.default_value, optdef) ); (void)hv_store( options_hv, opt_key.c_str(), opt_key.length(), newRV_noinc((SV*)hv), 0 ); } From e4b6aeb4cd51125ecf88619dfa3528a2e4fbbd64 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 4 Apr 2017 23:35:13 +0200 Subject: [PATCH 49/85] Support Retina displays. #3695 #2888 --- package/osx/plist.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/osx/plist.sh b/package/osx/plist.sh index 38e03edbc..2d305f405 100644 --- a/package/osx/plist.sh +++ b/package/osx/plist.sh @@ -93,6 +93,8 @@ cat << EOF >> $plistfile 10.7 NSPrincipalClass NSApplication + NSHighResolutionCapable + EOF From e36e821f724409fc895ba6ffce18df14ce5d64f1 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 18:48:19 -0500 Subject: [PATCH 50/85] Travis uploads files to slic3r.org now. --- .travis.yml | 11 ++++++++--- .../{deploy-bintray.sh => deploy/bintray.sh} | 0 package/deploy/sftp.sh | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) rename package/{deploy-bintray.sh => deploy/bintray.sh} (100%) create mode 100755 package/deploy/sftp.sh diff --git a/.travis.yml b/.travis.yml index c6904f562..ea244ed3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: perl +before_install: +- openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv + -in slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa -d install: - export LDLOADLIBS=-lstdc++ - export BOOST_DIR=$HOME/boost_1_63_0 @@ -13,7 +16,7 @@ script: - perl ./Build.PL after_success: - package/linux/make_archive.sh linux-x64 -- package/deploy-bintray.sh *.bz2 +- package/deploy/sftp.sh linux ~/slic3r-upload.rsa *.bz2 branches: only: - master @@ -39,5 +42,7 @@ notifications: sudo: required dist: trusty env: - matrix: - - secure: esNwHmYdri6Wn/AruRMLqk+HWelnLaPPNtLysGvdwp4K26K81Ys++1/M00IRgZi2LDqXWNlIUAcDCFMlKpZ0m6o0r0q4ukIiMRFFbg2cTGHW8qBuHIEmNliex9uFquU1r5PVEl4eVbHbhNjUDeMwlF74A+3PUxTEvI2X0rLdMKM= + matrix: + global: + - secure: eEVRZNMv7FM6jrOU9iAFkDhWxFQ1WtHBEaObImcvtFUxy6vWSt3ehFFeTRouj3uHQAnbvUzziDyvPPm8/95alv5g/du8ML6YzzqKBKfazM0xQ7SF6R2DQL8lfFIp+RSV7T02byEP1f1g7Zva7xH9szIlDcSfU0pXW4KWbkBFMd8= + - secure: hNd9SL178twKGKlx4xZsTuVzwKoMwhxIwqHuVFC3A4sdQXQysm14FbLootz6hri81tHuhjrx6owOjFQ24o8RIWfM9Rj3MnBZKfQK3HkB7gBoAkjIaJBgiYTjJBNbXGhQxG+Cvx6HqQVFkU/sLPkrvOiK0Z2/5wlNIjuMJ1gYAJI= diff --git a/package/deploy-bintray.sh b/package/deploy/bintray.sh similarity index 100% rename from package/deploy-bintray.sh rename to package/deploy/bintray.sh diff --git a/package/deploy/sftp.sh b/package/deploy/sftp.sh new file mode 100755 index 000000000..dce9762a4 --- /dev/null +++ b/package/deploy/sftp.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Prerequisites +# Environment Variables: +# UPLOAD_USER - user to upload to sftp server +# KEY is assumed to be path to a ssh key for UPLOAD_USER + +DIR=$1 +shift +KEY=$1 +shift +FILES=$* + +for i in $FILES; do + filepath=$(readlink -f "$i") + echo "echo put $filepath | sftp -i$KEY \"${UPLOAD_USER}@dl.slic3r.org:$DIR/\"" + #echo put $filepath | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/" +done From 30076331bd85b556935c22bd518a5e7cf4bb40e3 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 18:55:29 -0500 Subject: [PATCH 51/85] Fixed path to encoded key --- .travis.yml | 2 +- package/deploy/slic3r-upload.rsa.enc | Bin 0 -> 1680 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 package/deploy/slic3r-upload.rsa.enc diff --git a/.travis.yml b/.travis.yml index ea244ed3c..abacecb58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: perl before_install: - openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv - -in slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa -d + -in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa -d install: - export LDLOADLIBS=-lstdc++ - export BOOST_DIR=$HOME/boost_1_63_0 diff --git a/package/deploy/slic3r-upload.rsa.enc b/package/deploy/slic3r-upload.rsa.enc new file mode 100644 index 0000000000000000000000000000000000000000..9f3b9935bf8474e7fca53a278285867c0d6db873 GIT binary patch literal 1680 zcmV;B25wLe5 zkY-cb5`*Kl*=Vg|@&<5_DM3b2895wmJdzlNZM&S8cVM(&wC2K(PC?4>)#LX!%GQ}s zs1tuaci{%J@gq}y6{C*2v~;Hut<~zoD3eO%Lml#8NvN&1T-?2u)KcdPK>fhn%X+1= z8F!1R{B=G(&2988HozxZnI;~*zEP_JRNBxFz716tC&jXYSD`TELi9*C%?zpd^E+sM z-SL1CN1=J2v`_fYAtUH^6sQ9=v^2Fcy##EYVwu$jydan|L^QHx22=gxRx5;$NDaqg zkEY|6j+cNt-UL=}{-;EHapTr`5!V>6rKk_eDum`>f#@-Yg6%}dIzCh*(WONmM(xMp z*zVCGs|NTRWqu?7#jfvvW4L-M}BRW#UBSgGQ zN|rR-oJvgc-DC{%pyZ&d%sgwI$kzwe?5n`mbS}w8u0Lo%&fji%@+fP#-~{Q=pgs?; z(bYn5++VYX$fLB{=}J&Q%vI ze|d^o7Rc-Oq`SlXD~Qvw^@s<-9z$j}6_J0C4SM;;U!@R; z;ot6YqS(vnuHORP(gbFauq^M6?JXb_DpCIQy$^Z3UlxQ-Yp<6y9f{aNLw6GhvKuCR zQv5p2QG*vu+ZV}|y)wb5@tE!4T0RAqIGwc!uwO%LV5yaU!pD(1=D#N$seUE{M)ZS5 z`suMmnIKTG*~1m0!f6O+HIP!myisJoWmP04IzJ4u_Ir$hVRA0hcXQ)u6J+RL3VRoy zz>e~*mZB!{)^L*mk*>-)o@9q_gc)=a@9g4}xU?>^(;B-j>@4NT zo`S#AyUlnkBT8E`dD1P$kxgp19T1U=wMfagM*e~YZt3uA8Na=-Y+^K#p9gcySu`(yW| zg~NNr{9n&ovJ55ze99MP&N|RhV0$^ZS?<0Dtjk}s9E1Pg_La`%r_HK! zX_$z;Y4uUyn<5qO6*i`B!n%j^Nb>^s_*(F8E+h2HChDeR(;G{Es-rv#q~898L_`Y9 zDFWl${n>67KZpN9YDrCx@IxQv_l!gY0JG<$elnVJU5wnn`Bumjx`@F5zl%zwx6j_+ zIxm_k)aNmn{aQSN(Js+3JWci^F(?7@Hp%}GDuJQBAZK{hP59X=ch}TcdM7O#fkxqa z0dEX8bDZi6(A~Q(_0!INr|U>C^Zwv2NuD94H%+@LI_vZ6FNSr`q~l{Oe2KaW@vVv% zabGDF*jj?9G@!5DFf!8Ir9I7^wXB2(lsMzt&2KB@Ct0rKUztE~X3|fcDJv!LdrukdYg(wV}&WYE} zz=V%+;6a&h;vL2g9K9*z(A1w&YPrI&#FTbSFTCcKW;#gJ5qA@ aaTdgdUrE>#x+JiIIj)#o-X&!QoeNZYf?aO_ literal 0 HcmV?d00001 From 7fadcddb3e2498adef449f1eb86798dcdf2b4588 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 19:10:02 -0500 Subject: [PATCH 52/85] Adding appveyor upload key, removed bintray deployment --- appveyor.yml | 72 ++++++++++++++++++ package/deploy/slic3r-upload.rsa.appveyor.enc | Bin 0 -> 1712 bytes 2 files changed, 72 insertions(+) create mode 100644 appveyor.yml create mode 100644 package/deploy/slic3r-upload.rsa.appveyor.enc diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..a2b5e23fe --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,72 @@ +version: 1.3.0-{branch}-{build} +image: WMF 5 +init: +- ps: +environment: + LDLOADLIBS: -lstdc++ + SLIC3R_STATIC: 1 + SLIC3R_VERSION: 1.3.0 + BOOST_DIR: C:\dev\boost_1_63_0 + WXSHARED: SHARED=0 + FORCE_WX_BUILD: 0 + FORCE_BOOST_REINSTALL: 0 + ENC_SECRET: + secure: QfeTOSKXz1uFCEACqFKLNw== + UPLOAD_USER: + secure: fYPwnI3p6HNR+eMRJR3JfmyNolFn+Uc0MUn2bBXp9uU= + +install: + - nuget install secure-file -ExcludeVersion + - secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.rsa.appveyor.enc -secret %ENC_SECRET% +- ps: "mkdir C:\\projects\\slic3r\\FreeGLUT\nif (!(Test-Path \"C:\\users\\appveyor\\freeglut.7z\")) \n{\nwget \"http://www.siusgs.com/slic3r/buildserver/win/freeglut-mingw-3.0.0.win64.7z\" -o C:\\users\\appveyor\\freeglut.7z\n}\ncmd /c \"7z x C:\\Users\\appveyor\\freeglut.7z -oC:\\projects\\slic3r\\FreeGLUT\"\n\nif (!(Test-Path \"C:\\users\\appveyor\\strawberry.msi\")) {\nwget \"https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=slic3r-perl-5.24.1.4-64bit.msi\" -o \"C:\\users\\appveyor\\strawberry.msi\" | Write-Output\n}\nif (!(Test-Path \"C:\\users\\appveyor\\extra_perl.7z\")) {\nwget \"https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=Strawberry-6.3.0-seg-archive.7z\" -o \"C:\\users\\appveyor\\extra_perl.7z\" | Write-Output\n}\nmsiexec.exe /i \"C:\\users\\appveyor\\strawberry.msi\" /quiet\ncmd /c \"7z x -aoa C:\\Users\\appveyor\\extra_perl.7z -oC:\\\"\n\nif (!(Test-Path \"C:\\users\\appveyor\\winscp.zip\")) {\nwget \"https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=WinSCP-5.9.4-Portable.zip\" -o \"C:\\users\\appveyor\\winscp.zip\" | Write-Output\n}\ncmd /c \"7z x C:\\Users\\appveyor\\winscp.zip -oC:\\Strawberry\\c\\bin\"\n\nrm -r C:\\min* -Force\nrm -r C:\\msys64\\mingw* -Force\nrm -r C:\\cygwin* -Force\nrm -r C:\\Perl -Force\n$PERLDIR = 'C:\\Strawberry'\n$env:Path = \"C:\\Strawberry\\c\\bin;C:\\Strawberry\\perl\\bin;C:\\Strawberry\\perl\\vendor\\bin;\" + $env:Path\nif(Test-Path -Path 'C:\\Strawberry' ) {\ncopy C:\\Strawberry\\c\\bin\\gcc.exe C:\\Strawberry\\c\\bin\\cc.exe\ncmd /c mklink /D C:\\Perl C:\\Strawberry\\perl\nmkdir C:\\dev\nif (!(Test-Path \"C:\\users\\appveyor\\boost.1.63.0.7z\") -Or $env:FORCE_BOOST_REINSTALL -eq 1) {\nwget \"https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=boost_1_63_0-x64-gcc-6.3.0-seh.7z\" -O \"C:\\users\\appveyor\\boost.1.63.0.7z\" | Write-Output\n}\nAdd-AppveyorCompilationMessage -Message \"Extracting cached archive.\"\ncmd /c \"7z x C:\\Users\\appveyor\\boost.1.63.0.7z -oC:\\dev\"\n\nmkdir C:\\dev\\CitrusPerl\ncmd /C mklink /D C:\\dev\\CitrusPerl\\mingw32 C:\\Strawberry\\c\ncd C:\\projects\\slic3r\ncpanm ExtUtils::Typemaps::Basic\ncpanm ExtUtils::Typemaps::Default\ncpanm local::lib\nAdd-AppveyorCompilationMessage -Message \"Finished install script.\"\nrm -r 'C:\\Program Files\\Git\\usr\\bin' -Force\n} else {\nAdd-AppveyorCompilationMessage -Message \"No strawberry perl!\"\n}\n\n\nAdd-AppveyorCompilationMessage -Message \"Installing wxWidgets (xsgui dependency))\"\nif ($env:FORCE_WX_BUILD -eq 1) {\nrm \"C:\\Users\\appveyor\\wxwidgets.7z\" -Force\n}\nif (!(Test-Path \"C:\\Users\\appveyor\\wxwidgets.7z\")) {\n Add-AppveyorCompilationMessage -Message \"Compiling wxWidgets\"\n git clone https://github.com/wxWidgets/wxWidgets -b \"v3.1.0\" -q C:\\dev\\wxWidgets\n cd C:\\dev\\wxwidgets\n cp .\\include\\wx\\msw\\setup0.h include/wx/msw/setup.h\n cd build\\msw\n mingw32-make -f makefile.gcc CXXFLAGS=\"-std=gnu++11\" BUILD=release VENDOR=Slic3r \n cd C:\\dev\n 7z a C:\\Users\\appveyor\\wxwidgets.7z wxwidgets\n cd C:\\projects\\slic3r\n} else {\n Add-AppveyorCompilationMessage -Message \"Extracting prebuilt wxWidgets.\"\n 7z x \"C:\\Users\\appveyor\\wxwidgets.7z\" -oC:\\dev\n}" +cache: +- C:\Users\appveyor\boost.1.63.0.7z +- C:\Users\appveyor\local-lib.7z +- C:\Strawberry\perl\site +- C:\Users\appveyor\freeglut.7z +- C:\users\appveyor\strawberry.msi +- C:\Users\appveyor\winscp.zip +- C:\Users\appveyor\extra_perl.7z +- C:\Users\appveyor\wxwidgets.7z +build_script: +- ps: >- + if (!(Test-Path "C:\users\appveyor\local-lib.7z")) { + + wget "http://www.siusgs.com/slic3r/buildserver/win/slic3r-perl-dependencies-5.24.0-win-seh-gcc6.3.0-x64.7z" -o "C:\users\appveyor\local-lib.7z" | Write-Output + + } + + if (Test-Path "C:\users\appveyor\local-lib.7z") { + + cmd /c "7z x C:\Users\appveyor\local-lib.7z -oC:\projects\slic3r" -y | Write-Output + + rm -r 'C:\projects\slic3r\local-lib\Slic3r*' + + } + + + $env:Path = "C:\Strawberry\c\bin;C:\Strawberry\perl\bin;" + $env:Path + cd C:\projects\slic3r + rm -r 'C:\Program Files (x86)\Microsoft Vis*\bin' -Force + Add-AppveyorCompilationMessage -Message "Building Slic3r XS" + perl Build.pl + if (-NOT ($LASTEXITCODE -eq 0)) { + Add-AppveyorCompilationMessage -Message "XS Failed to Build" -Category Error + } + Add-AppveyorCompilationMessage -Message "Making ZIP package" + cd package/win + ./compile_wrapper.ps1 524| Write-Output + ./package_win32.ps1 524| Write-Output +test_script: +- ps: "mkdir C:\\Andrés\nwget \"http://www.thingiverse.com/download:73351\" -o\"C:\\Andrés\\5mm.stl\"\necho \"bed_temperature=60\" > C:\\Andrés\\test.ini\n\ncd C:\\projects\\slic3r\nperl slic3r.pl --load \"C:\\Andrés\\test.ini\" \"C:\\Andrés\\5mm.stl\"\n\nif (!(Test-Path \"C:\\Andrés\\5mm.gcode\")) {\necho \"IS IT HERE\"\n}" +artifacts: +- path: .\slic3r*zip + name: slic3r-dev +deploy_script: +- ps: "Add-AppveyorCompilationMessage -Message \"Making ZIP package\"\ncd package/win\n./compile_wrapper.ps1 524 | Write-Output\n./package_win32.ps1 524| Write-Output\ncd ../../\n$myPath = $(pwd) -replace \"\\\\\", \"/\"\n$myPath = $myPath -replace \"C:\", \"/c\" \n& 'C:\\msys64\\usr\\bin\\bash.exe' -c \"PATH=/c/msys64/usr/bin:$PATH BUILD_DIR=$env:APPVEYOR_BUILD_FOLDER UPLOAD_USER=$env:UPLOAD_USER $mypath/package/deploy/sftp.sh win $BUILD_FOLDER/slic3r-upload.rsa.appveyor *.zip\"\n\nif (!(Test-Path C:\\project\\slic3r\\slic3r.par)) {\n Add-AppveyorCompilationMessage -Message \"Failed to package!\" -Category Error\nreturn 1\n}" +on_success: +- ps: +on_failure: +- ps: +on_finish: +- ps: diff --git a/package/deploy/slic3r-upload.rsa.appveyor.enc b/package/deploy/slic3r-upload.rsa.appveyor.enc new file mode 100644 index 0000000000000000000000000000000000000000..88de6ae04f7b9739cd8c8863ce2baa3051bfc4b3 GIT binary patch literal 1712 zcmV;h22c46Ns8y=JOyAV_P#Z3&F{Tyr+;g`@_DzRjK6vqYO(Xn{I=&iAu5_1E0AOF z3T;&z#mlgR-^Ij}BTZKYv)fYz19xbwaa-k=xw!@sJ)1%G2ytOw4!EmQ};Ar%xzF{k$Zqdxe zEMTb)W#9{peD>!bYG9-D6>QnqIOvENnfyP^Fcli4+1WY-CC_E;-Sew+K_!+F;0rif zIt|9%&Z)v)hxwXj;dvE{+W()GA^n1; z4}ygl@SM|~%FvzHPt8Xoj6WC%^iDsKu+w;}_wzmHT(0oFwk?tAtyE!U@_I!x zOVjIO;SSEhy)ktqbT~vf-2vSX0YrrDweNff7c!7oQTYPXB19W0WSN1W6+g$DXSOZ0CM5Ybwb=`SGPF<2qPIEDWv2M{%#O=3(3UGni{eV7Rl)K;$h8?@?s6!5 zMVKi#ep~aDYxr#HW!NCNC$U zO;*UfB6;mwt*T`9!lD!j1#D&_5&bHR3|%Go@9o;LRvpFJo+OXCR-2BIm$$ zjd9+a=y@4CB4ke~$cyWIKKkKRdV?9eI&q@I1gGUqYa%(rsm@ID;aY|scUJOG$G)n$ z4|!BNJT%)({GjencpI@094~mm!pDT;)y}A^>i&I=gxm0Cw#8eoyWz2#hlsqPu~uk= zQ0f~3cT56)o`b!UVIJ?*FA>BEdJA6N#?r12;rdOlJ|Mh55KtkGUcvH zVnWI;`U$p^FV^jPwj)6ZLu64~a6ZuJqSKLxwC_S6Q+cw6c|_)yKXf1s<$8#OxtJ6| zz>+xXW0`E{7>DA07mhF|`yorf9g1YyM|p}ZAM}#90qJ6XMFIYgms}X{52Uq+jY)ly z&OL3W|2Z{*x6v26?m5|?&;sO(9F69lVa3`A0`(dVZo5Xz2cOexv0xq*$oy|U-E_N3 z=jQ&{M8M&;&NFe2Cs^rtgE8>3PK~x*zK{3-C5xGJ-1Ohbl_PR%77HwYhM2kTNWBFm zl@4<^%KS!hj-FvdQI3mq^G}uDR+jByVSS;)di*(`eY@n96dC3kVhmeqjih*h55R6d`&v#^3zc z%1gTWwQtCLr2iM@g(rrkYXz+(WBaCWia(54*Yl2l3pmlVfReqwNg;4L*WZ+UQ_4&6 z+V-H#nmt>YZ6gO`jTikN7qDa-D%O}C*KWd$pGVqW`l#2UGA^KD1!u4A|6tZ+#X?0! zl9K-EXu&c+0t+8*D~^!>xp{hIFtq`cAUio GeSz)T@>+lZ literal 0 HcmV?d00001 From 15ccd507f60dd951fadf65cdca60be05ebc0f812 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 19:20:15 -0500 Subject: [PATCH 53/85] Moved appveyor powershell out to separate scripts. --- appveyor.yml | 33 ++----------- package/win/appveyor_buildscript.ps1 | 21 ++++++++ package/win/appveyor_deploy.ps1 | 13 +++++ package/win/appveyor_preinstall.ps1 | 71 ++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 30 deletions(-) create mode 100644 package/win/appveyor_buildscript.ps1 create mode 100644 package/win/appveyor_deploy.ps1 create mode 100644 package/win/appveyor_preinstall.ps1 diff --git a/appveyor.yml b/appveyor.yml index a2b5e23fe..e8284663b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,7 +18,7 @@ environment: install: - nuget install secure-file -ExcludeVersion - secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.rsa.appveyor.enc -secret %ENC_SECRET% -- ps: "mkdir C:\\projects\\slic3r\\FreeGLUT\nif (!(Test-Path \"C:\\users\\appveyor\\freeglut.7z\")) \n{\nwget \"http://www.siusgs.com/slic3r/buildserver/win/freeglut-mingw-3.0.0.win64.7z\" -o C:\\users\\appveyor\\freeglut.7z\n}\ncmd /c \"7z x C:\\Users\\appveyor\\freeglut.7z -oC:\\projects\\slic3r\\FreeGLUT\"\n\nif (!(Test-Path \"C:\\users\\appveyor\\strawberry.msi\")) {\nwget \"https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=slic3r-perl-5.24.1.4-64bit.msi\" -o \"C:\\users\\appveyor\\strawberry.msi\" | Write-Output\n}\nif (!(Test-Path \"C:\\users\\appveyor\\extra_perl.7z\")) {\nwget \"https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=Strawberry-6.3.0-seg-archive.7z\" -o \"C:\\users\\appveyor\\extra_perl.7z\" | Write-Output\n}\nmsiexec.exe /i \"C:\\users\\appveyor\\strawberry.msi\" /quiet\ncmd /c \"7z x -aoa C:\\Users\\appveyor\\extra_perl.7z -oC:\\\"\n\nif (!(Test-Path \"C:\\users\\appveyor\\winscp.zip\")) {\nwget \"https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=WinSCP-5.9.4-Portable.zip\" -o \"C:\\users\\appveyor\\winscp.zip\" | Write-Output\n}\ncmd /c \"7z x C:\\Users\\appveyor\\winscp.zip -oC:\\Strawberry\\c\\bin\"\n\nrm -r C:\\min* -Force\nrm -r C:\\msys64\\mingw* -Force\nrm -r C:\\cygwin* -Force\nrm -r C:\\Perl -Force\n$PERLDIR = 'C:\\Strawberry'\n$env:Path = \"C:\\Strawberry\\c\\bin;C:\\Strawberry\\perl\\bin;C:\\Strawberry\\perl\\vendor\\bin;\" + $env:Path\nif(Test-Path -Path 'C:\\Strawberry' ) {\ncopy C:\\Strawberry\\c\\bin\\gcc.exe C:\\Strawberry\\c\\bin\\cc.exe\ncmd /c mklink /D C:\\Perl C:\\Strawberry\\perl\nmkdir C:\\dev\nif (!(Test-Path \"C:\\users\\appveyor\\boost.1.63.0.7z\") -Or $env:FORCE_BOOST_REINSTALL -eq 1) {\nwget \"https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=boost_1_63_0-x64-gcc-6.3.0-seh.7z\" -O \"C:\\users\\appveyor\\boost.1.63.0.7z\" | Write-Output\n}\nAdd-AppveyorCompilationMessage -Message \"Extracting cached archive.\"\ncmd /c \"7z x C:\\Users\\appveyor\\boost.1.63.0.7z -oC:\\dev\"\n\nmkdir C:\\dev\\CitrusPerl\ncmd /C mklink /D C:\\dev\\CitrusPerl\\mingw32 C:\\Strawberry\\c\ncd C:\\projects\\slic3r\ncpanm ExtUtils::Typemaps::Basic\ncpanm ExtUtils::Typemaps::Default\ncpanm local::lib\nAdd-AppveyorCompilationMessage -Message \"Finished install script.\"\nrm -r 'C:\\Program Files\\Git\\usr\\bin' -Force\n} else {\nAdd-AppveyorCompilationMessage -Message \"No strawberry perl!\"\n}\n\n\nAdd-AppveyorCompilationMessage -Message \"Installing wxWidgets (xsgui dependency))\"\nif ($env:FORCE_WX_BUILD -eq 1) {\nrm \"C:\\Users\\appveyor\\wxwidgets.7z\" -Force\n}\nif (!(Test-Path \"C:\\Users\\appveyor\\wxwidgets.7z\")) {\n Add-AppveyorCompilationMessage -Message \"Compiling wxWidgets\"\n git clone https://github.com/wxWidgets/wxWidgets -b \"v3.1.0\" -q C:\\dev\\wxWidgets\n cd C:\\dev\\wxwidgets\n cp .\\include\\wx\\msw\\setup0.h include/wx/msw/setup.h\n cd build\\msw\n mingw32-make -f makefile.gcc CXXFLAGS=\"-std=gnu++11\" BUILD=release VENDOR=Slic3r \n cd C:\\dev\n 7z a C:\\Users\\appveyor\\wxwidgets.7z wxwidgets\n cd C:\\projects\\slic3r\n} else {\n Add-AppveyorCompilationMessage -Message \"Extracting prebuilt wxWidgets.\"\n 7z x \"C:\\Users\\appveyor\\wxwidgets.7z\" -oC:\\dev\n}" + - ps: "& package/win/appveyor_preinstall.ps1" cache: - C:\Users\appveyor\boost.1.63.0.7z - C:\Users\appveyor\local-lib.7z @@ -29,41 +29,14 @@ cache: - C:\Users\appveyor\extra_perl.7z - C:\Users\appveyor\wxwidgets.7z build_script: -- ps: >- - if (!(Test-Path "C:\users\appveyor\local-lib.7z")) { - - wget "http://www.siusgs.com/slic3r/buildserver/win/slic3r-perl-dependencies-5.24.0-win-seh-gcc6.3.0-x64.7z" -o "C:\users\appveyor\local-lib.7z" | Write-Output - - } - - if (Test-Path "C:\users\appveyor\local-lib.7z") { - - cmd /c "7z x C:\Users\appveyor\local-lib.7z -oC:\projects\slic3r" -y | Write-Output - - rm -r 'C:\projects\slic3r\local-lib\Slic3r*' - - } - - - $env:Path = "C:\Strawberry\c\bin;C:\Strawberry\perl\bin;" + $env:Path - cd C:\projects\slic3r - rm -r 'C:\Program Files (x86)\Microsoft Vis*\bin' -Force - Add-AppveyorCompilationMessage -Message "Building Slic3r XS" - perl Build.pl - if (-NOT ($LASTEXITCODE -eq 0)) { - Add-AppveyorCompilationMessage -Message "XS Failed to Build" -Category Error - } - Add-AppveyorCompilationMessage -Message "Making ZIP package" - cd package/win - ./compile_wrapper.ps1 524| Write-Output - ./package_win32.ps1 524| Write-Output +- ps: "& package/win/appveyor_buildscript.ps1" test_script: - ps: "mkdir C:\\Andrés\nwget \"http://www.thingiverse.com/download:73351\" -o\"C:\\Andrés\\5mm.stl\"\necho \"bed_temperature=60\" > C:\\Andrés\\test.ini\n\ncd C:\\projects\\slic3r\nperl slic3r.pl --load \"C:\\Andrés\\test.ini\" \"C:\\Andrés\\5mm.stl\"\n\nif (!(Test-Path \"C:\\Andrés\\5mm.gcode\")) {\necho \"IS IT HERE\"\n}" artifacts: - path: .\slic3r*zip name: slic3r-dev deploy_script: -- ps: "Add-AppveyorCompilationMessage -Message \"Making ZIP package\"\ncd package/win\n./compile_wrapper.ps1 524 | Write-Output\n./package_win32.ps1 524| Write-Output\ncd ../../\n$myPath = $(pwd) -replace \"\\\\\", \"/\"\n$myPath = $myPath -replace \"C:\", \"/c\" \n& 'C:\\msys64\\usr\\bin\\bash.exe' -c \"PATH=/c/msys64/usr/bin:$PATH BUILD_DIR=$env:APPVEYOR_BUILD_FOLDER UPLOAD_USER=$env:UPLOAD_USER $mypath/package/deploy/sftp.sh win $BUILD_FOLDER/slic3r-upload.rsa.appveyor *.zip\"\n\nif (!(Test-Path C:\\project\\slic3r\\slic3r.par)) {\n Add-AppveyorCompilationMessage -Message \"Failed to package!\" -Category Error\nreturn 1\n}" +- ps: "& package/win/appveyor_deploy.ps1" on_success: - ps: on_failure: diff --git a/package/win/appveyor_buildscript.ps1 b/package/win/appveyor_buildscript.ps1 new file mode 100644 index 000000000..4f98dcbf4 --- /dev/null +++ b/package/win/appveyor_buildscript.ps1 @@ -0,0 +1,21 @@ +if (!(Test-Path "C:\users\appveyor\local-lib.7z")) { + wget "http://www.siusgs.com/slic3r/buildserver/win/slic3r-perl-dependencies-5.24.0-win-seh-gcc6.3.0-x64.7z" -o "C:\users\appveyor\local-lib.7z" | Write-Output +} + +if (Test-Path "C:\users\appveyor\local-lib.7z") { + cmd /c "7z x C:\Users\appveyor\local-lib.7z -oC:\projects\slic3r" -y | Write-Output + rm -r 'C:\projects\slic3r\local-lib\Slic3r*' +} + +$env:Path = "C:\Strawberry\c\bin;C:\Strawberry\perl\bin;" + $env:Path +cd C:\projects\slic3r +rm -r 'C:\Program Files (x86)\Microsoft Vis*\bin' -Force +Add-AppveyorCompilationMessage -Message "Building Slic3r XS" +perl Build.pl +if (-NOT ($LASTEXITCODE -eq 0)) { + Add-AppveyorCompilationMessage -Message "XS Failed to Build" -Category Error +} +Add-AppveyorCompilationMessage -Message "Making ZIP package" +cd package/win +./compile_wrapper.ps1 524| Write-Output +./package_win32.ps1 524| Write-Output diff --git a/package/win/appveyor_deploy.ps1 b/package/win/appveyor_deploy.ps1 new file mode 100644 index 000000000..c78a13dc9 --- /dev/null +++ b/package/win/appveyor_deploy.ps1 @@ -0,0 +1,13 @@ +Add-AppveyorCompilationMessage -Message "Making ZIP package" +cd package/win +./compile_wrapper.ps1 524 | Write-Output +./package_win32.ps1 524| Write-Output +cd ../../ +$myPath = $(pwd) -replace "\\", "/" +$myPath = $myPath -replace "C:", "/c" +& 'C:\msys64\usr\bin\bash.exe' -c "PATH=/c/msys64/usr/bin:$PATH BUILD_DIR=$env:APPVEYOR_BUILD_FOLDER UPLOAD_USER=$env:UPLOAD_USER $mypath/package/deploy/sftp.sh win $BUILD_FOLDER/slic3r-upload.rsa.appveyor *.zip" + +if (!(Test-Path C:\project\slic3r\slic3r.par)) { + Add-AppveyorCompilationMessage -Message "Failed to package!" -Category Error + return 1 +} diff --git a/package/win/appveyor_preinstall.ps1 b/package/win/appveyor_preinstall.ps1 new file mode 100644 index 000000000..4ba912e14 --- /dev/null +++ b/package/win/appveyor_preinstall.ps1 @@ -0,0 +1,71 @@ +mkdir C:\projects\slic3r\FreeGLUT +if (!(Test-Path "C:\users\appveyor\freeglut.7z")) +{ + wget "http://www.siusgs.com/slic3r/buildserver/win/freeglut-mingw-3.0.0.win64.7z" -o C:\users\appveyor\freeglut.7z +} +cmd /c "7z x C:\Users\appveyor\freeglut.7z -oC:\projects\slic3r\FreeGLUT" + +if (!(Test-Path "C:\users\appveyor\strawberry.msi")) { + wget "https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=slic3r-perl-5.24.1.4-64bit.msi" -o "C:\users\appveyor\strawberry.msi" | Write-Output +} +if (!(Test-Path "C:\users\appveyor\extra_perl.7z")) { + wget "https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=Strawberry-6.3.0-seg-archive.7z" -o "C:\users\appveyor\extra_perl.7z" | Write-Output +} + +msiexec.exe /i "C:\users\appveyor\strawberry.msi" /quiet +cmd /c "7z x -aoa C:\Users\appveyor\extra_perl.7z -oC:\" + +if (!(Test-Path "C:\users\appveyor\winscp.zip")) { + wget "https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=WinSCP-5.9.4-Portable.zip" -o "C:\users\appveyor\winscp.zip" | Write-Output +} +cmd /c "7z x C:\Users\appveyor\winscp.zip -oC:\Strawberry\c\bin" + +rm -r C:\min* -Force +rm -r C:\msys64\mingw* -Force +rm -r C:\cygwin* -Force +rm -r C:\Perl -Force + +$PERLDIR = 'C:\Strawberry' +$env:Path = "C:\Strawberry\c\bin;C:\Strawberry\perl\bin;C:\Strawberry\perl\vendor\bin;" + $env:Path + +if(Test-Path -Path 'C:\Strawberry' ) { + copy C:\Strawberry\c\bin\gcc.exe C:\Strawberry\c\bin\cc.exe + cmd /c mklink /D C:\Perl C:\Strawberry\perl + mkdir C:\dev + if (!(Test-Path "C:\users\appveyor\boost.1.63.0.7z") -Or $env:FORCE_BOOST_REINSTALL -eq 1) { + wget "https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=boost_1_63_0-x64-gcc-6.3.0-seh.7z" -O "C:\users\appveyor\boost.1.63.0.7z" | Write-Output + } + Add-AppveyorCompilationMessage -Message "Extracting cached archive." + cmd /c "7z x C:\Users\appveyor\boost.1.63.0.7z -oC:\dev" + + mkdir C:\dev\CitrusPerl + cmd /C mklink /D C:\dev\CitrusPerl\mingw32 C:\Strawberry\c + cd C:\projects\slic3r + cpanm ExtUtils::Typemaps::Basic + cpanm ExtUtils::Typemaps::Default + cpanm local::lib + Add-AppveyorCompilationMessage -Message "Finished install script." + rm -r 'C:\Program Files\Git\usr\bin' -Force +} else { + Add-AppveyorCompilationMessage -Message "No strawberry perl!" +} + + +Add-AppveyorCompilationMessage -Message "Installing wxWidgets (xsgui dependency))" +if ($env:FORCE_WX_BUILD -eq 1) { + rm "C:\Users\appveyor\wxwidgets.7z" -Force +} +if (!(Test-Path "C:\Users\appveyor\wxwidgets.7z")) { + Add-AppveyorCompilationMessage -Message "Compiling wxWidgets" + git clone https://github.com/wxWidgets/wxWidgets -b "v3.1.0" -q C:\dev\wxWidgets + cd C:\dev\wxwidgets + cp .\include\wx\msw\setup0.h include/wx/msw/setup.h + cd build\msw + mingw32-make -f makefile.gcc CXXFLAGS="-std=gnu++11" BUILD=release VENDOR=Slic3r + cd C:\dev + 7z a C:\Users\appveyor\wxwidgets.7z wxwidgets + cd C:\projects\slic3r +} else { + Add-AppveyorCompilationMessage -Message "Extracting prebuilt wxWidgets." + 7z x "C:\Users\appveyor\wxwidgets.7z" -oC:\dev +} From cf34a5293d913b1e67754d914abba266a66a059a Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 19:21:43 -0500 Subject: [PATCH 54/85] Actually deploy. --- package/deploy/sftp.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/deploy/sftp.sh b/package/deploy/sftp.sh index dce9762a4..2ef0d48a3 100755 --- a/package/deploy/sftp.sh +++ b/package/deploy/sftp.sh @@ -12,6 +12,5 @@ FILES=$* for i in $FILES; do filepath=$(readlink -f "$i") - echo "echo put $filepath | sftp -i$KEY \"${UPLOAD_USER}@dl.slic3r.org:$DIR/\"" - #echo put $filepath | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/" + echo put $filepath | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/" done From a3130272e6a9a7a0b910d523ebd19e51242cded7 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 19:37:36 -0500 Subject: [PATCH 55/85] add dl.slic3r.org to known hosts. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index abacecb58..d1bca905b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,3 +46,5 @@ env: global: - secure: eEVRZNMv7FM6jrOU9iAFkDhWxFQ1WtHBEaObImcvtFUxy6vWSt3ehFFeTRouj3uHQAnbvUzziDyvPPm8/95alv5g/du8ML6YzzqKBKfazM0xQ7SF6R2DQL8lfFIp+RSV7T02byEP1f1g7Zva7xH9szIlDcSfU0pXW4KWbkBFMd8= - secure: hNd9SL178twKGKlx4xZsTuVzwKoMwhxIwqHuVFC3A4sdQXQysm14FbLootz6hri81tHuhjrx6owOjFQ24o8RIWfM9Rj3MnBZKfQK3HkB7gBoAkjIaJBgiYTjJBNbXGhQxG+Cvx6HqQVFkU/sLPkrvOiK0Z2/5wlNIjuMJ1gYAJI= +addons: + ssh_known_hosts: dl.slic3r.org From 207742ea0fb062f6269460077867da023ecc46f3 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 20:05:39 -0500 Subject: [PATCH 56/85] Added winscp deployment script --- package/deploy/winscp.ps1 | 13 +++++++++++++ package/win/appveyor_deploy.ps1 | 4 +--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100755 package/deploy/winscp.ps1 diff --git a/package/deploy/winscp.ps1 b/package/deploy/winscp.ps1 new file mode 100755 index 000000000..174dd23fb --- /dev/null +++ b/package/deploy/winscp.ps1 @@ -0,0 +1,13 @@ +# Prerequisites +# Environment Variables: +# UPLOAD_USER - user to upload to sftp server +# KEY is assumed to be path to a ssh key for UPLOAD_USER + +param ( + [parameter(Mandatory=$true, ParameterSetName="dir")] [string]$DIR, + [parameter(Mandatory=$true, ParameterSetName="key")] [string]$KEY, + [parameter(Mandatory=$true, ParameterSetName="file")] [string]$FILES, + +) +UUSER=$env:UPLOAD_USER +winscp.exe scp://$UUSER@dl.slic3r.org:$DIR /hostkey=* /privatekey=$KEY /upload $FILES diff --git a/package/win/appveyor_deploy.ps1 b/package/win/appveyor_deploy.ps1 index c78a13dc9..39d101c1a 100644 --- a/package/win/appveyor_deploy.ps1 +++ b/package/win/appveyor_deploy.ps1 @@ -3,9 +3,7 @@ cd package/win ./compile_wrapper.ps1 524 | Write-Output ./package_win32.ps1 524| Write-Output cd ../../ -$myPath = $(pwd) -replace "\\", "/" -$myPath = $myPath -replace "C:", "/c" -& 'C:\msys64\usr\bin\bash.exe' -c "PATH=/c/msys64/usr/bin:$PATH BUILD_DIR=$env:APPVEYOR_BUILD_FOLDER UPLOAD_USER=$env:UPLOAD_USER $mypath/package/deploy/sftp.sh win $BUILD_FOLDER/slic3r-upload.rsa.appveyor *.zip" +& package/deploy/winscp.ps1 -dir win -key $BUILD_FOLDER/package/deploy/slic3r-upload.rsa.appveyor -file *.zip: if (!(Test-Path C:\project\slic3r\slic3r.par)) { Add-AppveyorCompilationMessage -Message "Failed to package!" -Category Error From 510ef65fae6168bf6f0278275ebd2e2dc30affa3 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 20:16:34 -0500 Subject: [PATCH 57/85] travis, pls. y u do that --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d1bca905b..e7aa0ea57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ addons: packages: - g++-4.9 - gcc-4.9 + ssh_known_hosts: dl.slic3r.org notifications: irc: channels: @@ -46,5 +47,3 @@ env: global: - secure: eEVRZNMv7FM6jrOU9iAFkDhWxFQ1WtHBEaObImcvtFUxy6vWSt3ehFFeTRouj3uHQAnbvUzziDyvPPm8/95alv5g/du8ML6YzzqKBKfazM0xQ7SF6R2DQL8lfFIp+RSV7T02byEP1f1g7Zva7xH9szIlDcSfU0pXW4KWbkBFMd8= - secure: hNd9SL178twKGKlx4xZsTuVzwKoMwhxIwqHuVFC3A4sdQXQysm14FbLootz6hri81tHuhjrx6owOjFQ24o8RIWfM9Rj3MnBZKfQK3HkB7gBoAkjIaJBgiYTjJBNbXGhQxG+Cvx6HqQVFkU/sLPkrvOiK0Z2/5wlNIjuMJ1gYAJI= -addons: - ssh_known_hosts: dl.slic3r.org From 77ffa5616f417aac260a3316c2a488497fc755a3 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 20:48:57 -0500 Subject: [PATCH 58/85] made private keyfile 600 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e7aa0ea57..363f10bad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: perl before_install: - openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv -in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa -d +- chmod 600 ~/slic3r-upload.rsa install: - export LDLOADLIBS=-lstdc++ - export BOOST_DIR=$HOME/boost_1_63_0 From 327ef47c84f636e62b71d064047ab9c51600db2b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 21:22:04 -0500 Subject: [PATCH 59/85] typo in winscp --- package/deploy/winscp.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/deploy/winscp.ps1 b/package/deploy/winscp.ps1 index 174dd23fb..699faa383 100755 --- a/package/deploy/winscp.ps1 +++ b/package/deploy/winscp.ps1 @@ -6,8 +6,7 @@ param ( [parameter(Mandatory=$true, ParameterSetName="dir")] [string]$DIR, [parameter(Mandatory=$true, ParameterSetName="key")] [string]$KEY, - [parameter(Mandatory=$true, ParameterSetName="file")] [string]$FILES, - + [parameter(Mandatory=$true, ParameterSetName="file")] [string]$FILES ) UUSER=$env:UPLOAD_USER winscp.exe scp://$UUSER@dl.slic3r.org:$DIR /hostkey=* /privatekey=$KEY /upload $FILES From 3d0e5bf351bd4c4c8d8b32fa4b8ebc71edd5c5ae Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 21:42:04 -0500 Subject: [PATCH 60/85] wrong username --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 363f10bad..f5ebc1e04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: perl before_install: - openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv - -in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa -d + -in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa + -d - chmod 600 ~/slic3r-upload.rsa install: - export LDLOADLIBS=-lstdc++ @@ -47,4 +48,4 @@ env: matrix: global: - secure: eEVRZNMv7FM6jrOU9iAFkDhWxFQ1WtHBEaObImcvtFUxy6vWSt3ehFFeTRouj3uHQAnbvUzziDyvPPm8/95alv5g/du8ML6YzzqKBKfazM0xQ7SF6R2DQL8lfFIp+RSV7T02byEP1f1g7Zva7xH9szIlDcSfU0pXW4KWbkBFMd8= - - secure: hNd9SL178twKGKlx4xZsTuVzwKoMwhxIwqHuVFC3A4sdQXQysm14FbLootz6hri81tHuhjrx6owOjFQ24o8RIWfM9Rj3MnBZKfQK3HkB7gBoAkjIaJBgiYTjJBNbXGhQxG+Cvx6HqQVFkU/sLPkrvOiK0Z2/5wlNIjuMJ1gYAJI= + - secure: gj338h+qHGccTD/VQFmEJkqdg2McIe2pO0iZ4Ae9BvY5vxkIML4BpoYZQXQTqiAOETnUjlcknY9lx0hI/PfkDD9MSJc5BC/3fMYRCu3SgAclEwklWf9vvtodUeT69mtnZuw1zze1nTbExuOw2mepbqFjxKKMl+9l5oCz4O54fXU= From 21aa301729b870ae11685b966c09613e3d40cbbc Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 21:47:24 -0500 Subject: [PATCH 61/85] working on script for winscp --- appveyor.yml | 2 +- package/deploy/winscp.ps1 | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e8284663b..e76ea6939 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,4 +42,4 @@ on_success: on_failure: - ps: on_finish: -- ps: + - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/package/deploy/winscp.ps1 b/package/deploy/winscp.ps1 index 699faa383..d3b9f150d 100755 --- a/package/deploy/winscp.ps1 +++ b/package/deploy/winscp.ps1 @@ -3,10 +3,10 @@ # UPLOAD_USER - user to upload to sftp server # KEY is assumed to be path to a ssh key for UPLOAD_USER -param ( - [parameter(Mandatory=$true, ParameterSetName="dir")] [string]$DIR, - [parameter(Mandatory=$true, ParameterSetName="key")] [string]$KEY, - [parameter(Mandatory=$true, ParameterSetName="file")] [string]$FILES +Param( + [string]$DIR, + [string]$KEY, + [string]$FILE ) UUSER=$env:UPLOAD_USER -winscp.exe scp://$UUSER@dl.slic3r.org:$DIR /hostkey=* /privatekey=$KEY /upload $FILES +winscp.exe scp://$UUSER@dl.slic3r.org:$DIR/ /hostkey=* /privatekey=$KEY /upload $FILES From f364f1290b2329dd2d48bbebb4638a4aa60d709b Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 22:18:59 -0500 Subject: [PATCH 62/85] converted key to PuTTY format --- appveyor.yml | 2 +- package/deploy/slic3r-upload.ppk.enc | Bin 0 -> 1472 bytes package/deploy/slic3r-upload.rsa.appveyor.enc | Bin 1712 -> 0 bytes package/win/appveyor_deploy.ps1 | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 package/deploy/slic3r-upload.ppk.enc delete mode 100644 package/deploy/slic3r-upload.rsa.appveyor.enc diff --git a/appveyor.yml b/appveyor.yml index e76ea6939..a98cdef08 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,7 @@ environment: install: - nuget install secure-file -ExcludeVersion - - secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.rsa.appveyor.enc -secret %ENC_SECRET% + - secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.ppk.appveyor.enc -secret %ENC_SECRET% - ps: "& package/win/appveyor_preinstall.ps1" cache: - C:\Users\appveyor\boost.1.63.0.7z diff --git a/package/deploy/slic3r-upload.ppk.enc b/package/deploy/slic3r-upload.ppk.enc new file mode 100644 index 0000000000000000000000000000000000000000..0bc2ead4fa3445d34e51156e31e116053b84e4eb GIT binary patch literal 1472 zcmV;x1wZ;Is?+oVIfNJV92duO61CU5v0}wq=1Mb14%q9SJ5n0&%2>0Sz{}qxTu_DI znxr7#HSC}|70JYbL-riopEmtj)ncJJ^5@{T7^Jmr=bti*b;zE3r^y2kqheX&3a}D; z0}Fn4K!==FY5L8iiE4f!eKca=ZvtAH^~MjEoOJ_-vQJ?#|G5{(U4eM@MaYcKewUIv z+l^Xbn1LjWD|)S=aec&Z-*MaDhA_*ZA3$fpqg^01E{*kUf|N89i|KI(NA>)E$S;2s z``Qp4Ci}DYEd#cteHE0%XERC(l4py@M`GWo6$}n$*1w}FLi{+c^|^&EX?9e59oI=U z2kw|@^wQ2H*~wU>+okU79{U<@qZZpC+Nnzz?+vzK&=?Vy^1n)ml$KH5!oTuv#buu$3A-aQhZ_?C_Yfb9>7w=G8UBpMcF>_)yZ0M;TMQqJ)!t3$LtBL!Nf|tZ}R1Bxepee>+uQIYh z5P~$7gyKsU#J@|W)2tgoOjfh)r;bE?@;_K=xR(O(=2$S)CxoR=jkE<3W3QZVn>zRFm7b=6&f*y^7dx?6L)r0a3TijY{U4G z^H>d5=mmNOTF7G;BCB?<44$*c*U7n3+)WM#1}!TGH4E00G$0ZmX|z;|XnI}zI656) zl2f5-5__7U2dPsSUd*<9?PQQDo7@C9iGm{dN zgM-`4=LFEE54FNMnKiuby?7J^Ly6B;eEp<@&`@9^yz(m)uz#^xj`ngpWHD+GHJ~jN zrE{6b2>GNOJ>RobLTSN(Y6xoY`8q)EM1?!sW&a`9Udf2vix^Fkpgy%x%Fd}Z#9C{_ zznA7OCW6(wCu?+KMaGltXCL3Y*{??SJbLNT-J-7|ckI}udbfV*JIlmc>+Ob%11eOR zUEyK5RthK0jgytcHobI2IsxYVj63yWWA)Y^CVanfK@GitNy51&r$HM@Az8+es^krO zv8~ohp=Fc?3PLiQXl{aL1$`LAgz=QYul~>_vYz|yLmeoe{U8O- zqzS90ei7cXJC6L+?Zk?#aVu+nz#UfA7q!6Y|fU`5ghu5n$OL_;dT~Y$W)x zRD6TUf7>P+RGrAAiOT-A&Z2`G_co(P3nEA};aHxaOzbDwK2glz##$`qZSk}yTaIQEcjHO$@I@A1-{P}ro1a5UqL40 z_KsKq?F2#Y$>XL0(S~(Gd(bi{%~w literal 0 HcmV?d00001 diff --git a/package/deploy/slic3r-upload.rsa.appveyor.enc b/package/deploy/slic3r-upload.rsa.appveyor.enc deleted file mode 100644 index 88de6ae04f7b9739cd8c8863ce2baa3051bfc4b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1712 zcmV;h22c46Ns8y=JOyAV_P#Z3&F{Tyr+;g`@_DzRjK6vqYO(Xn{I=&iAu5_1E0AOF z3T;&z#mlgR-^Ij}BTZKYv)fYz19xbwaa-k=xw!@sJ)1%G2ytOw4!EmQ};Ar%xzF{k$Zqdxe zEMTb)W#9{peD>!bYG9-D6>QnqIOvENnfyP^Fcli4+1WY-CC_E;-Sew+K_!+F;0rif zIt|9%&Z)v)hxwXj;dvE{+W()GA^n1; z4}ygl@SM|~%FvzHPt8Xoj6WC%^iDsKu+w;}_wzmHT(0oFwk?tAtyE!U@_I!x zOVjIO;SSEhy)ktqbT~vf-2vSX0YrrDweNff7c!7oQTYPXB19W0WSN1W6+g$DXSOZ0CM5Ybwb=`SGPF<2qPIEDWv2M{%#O=3(3UGni{eV7Rl)K;$h8?@?s6!5 zMVKi#ep~aDYxr#HW!NCNC$U zO;*UfB6;mwt*T`9!lD!j1#D&_5&bHR3|%Go@9o;LRvpFJo+OXCR-2BIm$$ zjd9+a=y@4CB4ke~$cyWIKKkKRdV?9eI&q@I1gGUqYa%(rsm@ID;aY|scUJOG$G)n$ z4|!BNJT%)({GjencpI@094~mm!pDT;)y}A^>i&I=gxm0Cw#8eoyWz2#hlsqPu~uk= zQ0f~3cT56)o`b!UVIJ?*FA>BEdJA6N#?r12;rdOlJ|Mh55KtkGUcvH zVnWI;`U$p^FV^jPwj)6ZLu64~a6ZuJqSKLxwC_S6Q+cw6c|_)yKXf1s<$8#OxtJ6| zz>+xXW0`E{7>DA07mhF|`yorf9g1YyM|p}ZAM}#90qJ6XMFIYgms}X{52Uq+jY)ly z&OL3W|2Z{*x6v26?m5|?&;sO(9F69lVa3`A0`(dVZo5Xz2cOexv0xq*$oy|U-E_N3 z=jQ&{M8M&;&NFe2Cs^rtgE8>3PK~x*zK{3-C5xGJ-1Ohbl_PR%77HwYhM2kTNWBFm zl@4<^%KS!hj-FvdQI3mq^G}uDR+jByVSS;)di*(`eY@n96dC3kVhmeqjih*h55R6d`&v#^3zc z%1gTWwQtCLr2iM@g(rrkYXz+(WBaCWia(54*Yl2l3pmlVfReqwNg;4L*WZ+UQ_4&6 z+V-H#nmt>YZ6gO`jTikN7qDa-D%O}C*KWd$pGVqW`l#2UGA^KD1!u4A|6tZ+#X?0! zl9K-EXu&c+0t+8*D~^!>xp{hIFtq`cAUio GeSz)T@>+lZ diff --git a/package/win/appveyor_deploy.ps1 b/package/win/appveyor_deploy.ps1 index 39d101c1a..b5f0a2525 100644 --- a/package/win/appveyor_deploy.ps1 +++ b/package/win/appveyor_deploy.ps1 @@ -3,7 +3,7 @@ cd package/win ./compile_wrapper.ps1 524 | Write-Output ./package_win32.ps1 524| Write-Output cd ../../ -& package/deploy/winscp.ps1 -dir win -key $BUILD_FOLDER/package/deploy/slic3r-upload.rsa.appveyor -file *.zip: +& package/deploy/winscp.ps1 -dir win -key $BUILD_FOLDER/package/deploy/slic3r-upload.ppk.appveyor -file *.zip: if (!(Test-Path C:\project\slic3r\slic3r.par)) { Add-AppveyorCompilationMessage -Message "Failed to package!" -Category Error From 37f0468fdd027116de31313e6539f9821613d585 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 22:20:33 -0500 Subject: [PATCH 63/85] fixed winscp script --- package/deploy/winscp.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/deploy/winscp.ps1 b/package/deploy/winscp.ps1 index d3b9f150d..496d2a3c3 100755 --- a/package/deploy/winscp.ps1 +++ b/package/deploy/winscp.ps1 @@ -8,5 +8,5 @@ Param( [string]$KEY, [string]$FILE ) -UUSER=$env:UPLOAD_USER -winscp.exe scp://$UUSER@dl.slic3r.org:$DIR/ /hostkey=* /privatekey=$KEY /upload $FILES +Set-Variable -Name "UUSER" -Value "$env:UPLOAD_USER" +winscp.exe /command sftp://$UUSER@dl.slic3r.org:$DIR/ /hostkey=* /privatekey=$KEY /upload "put $FILE" From 4e330063ca22eec0f4865e30090670d43e553816 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 22:29:11 -0500 Subject: [PATCH 64/85] wrong decrypt name --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a98cdef08..6b12e8596 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,7 @@ environment: install: - nuget install secure-file -ExcludeVersion - - secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.ppk.appveyor.enc -secret %ENC_SECRET% + - secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.ppk.enc -secret %ENC_SECRET% - ps: "& package/win/appveyor_preinstall.ps1" cache: - C:\Users\appveyor\boost.1.63.0.7z From 493461e504424fa49087c2e81d0e92a8e16a2abd Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 22:41:19 -0500 Subject: [PATCH 65/85] do build with local-lib set to get wxpar --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f5ebc1e04..84f2ee845 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ script: - perlbrew switch slic3r-perl - perl ./Build.PL after_success: +- eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib) - package/linux/make_archive.sh linux-x64 - package/deploy/sftp.sh linux ~/slic3r-upload.rsa *.bz2 branches: From c33179b4e0ef8de6454b992641178c985b3a9d70 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 23:06:11 -0500 Subject: [PATCH 66/85] working upload script for windows/winscp. No more bintray. --- appveyor.yml | 2 +- package/deploy/winscp.ps1 | 3 ++- package/win/appveyor_deploy.ps1 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6b12e8596..23289e5ce 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,4 +42,4 @@ on_success: on_failure: - ps: on_finish: - - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +- ps: diff --git a/package/deploy/winscp.ps1 b/package/deploy/winscp.ps1 index 496d2a3c3..20dc034ac 100755 --- a/package/deploy/winscp.ps1 +++ b/package/deploy/winscp.ps1 @@ -9,4 +9,5 @@ Param( [string]$FILE ) Set-Variable -Name "UUSER" -Value "$env:UPLOAD_USER" -winscp.exe /command sftp://$UUSER@dl.slic3r.org:$DIR/ /hostkey=* /privatekey=$KEY /upload "put $FILE" +Set-Variable -Name "UPLOAD" -Value "$($FILE | Resolve-Path)" +winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR -hostkey=*" "put $UPLOAD ./$FILE" "exit" diff --git a/package/win/appveyor_deploy.ps1 b/package/win/appveyor_deploy.ps1 index b5f0a2525..dc4d44b9b 100644 --- a/package/win/appveyor_deploy.ps1 +++ b/package/win/appveyor_deploy.ps1 @@ -3,7 +3,7 @@ cd package/win ./compile_wrapper.ps1 524 | Write-Output ./package_win32.ps1 524| Write-Output cd ../../ -& package/deploy/winscp.ps1 -dir win -key $BUILD_FOLDER/package/deploy/slic3r-upload.ppk.appveyor -file *.zip: +& package/deploy/winscp.ps1 -DIR win -KEY $BUILD_FOLDER/package/deploy/slic3r-upload.ppk -FILE *.zip: if (!(Test-Path C:\project\slic3r\slic3r.par)) { Add-AppveyorCompilationMessage -Message "Failed to package!" -Category Error From a07dec03164f94af4e59dd7209e9a9fd338a669f Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 23:47:48 -0500 Subject: [PATCH 67/85] Redirect winscp output to local log to avoid leaking secret names. --- package/win/appveyor_deploy.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/win/appveyor_deploy.ps1 b/package/win/appveyor_deploy.ps1 index dc4d44b9b..818565820 100644 --- a/package/win/appveyor_deploy.ps1 +++ b/package/win/appveyor_deploy.ps1 @@ -3,7 +3,8 @@ cd package/win ./compile_wrapper.ps1 524 | Write-Output ./package_win32.ps1 524| Write-Output cd ../../ -& package/deploy/winscp.ps1 -DIR win -KEY $BUILD_FOLDER/package/deploy/slic3r-upload.ppk -FILE *.zip: +Add-AppveyorCompilationMessage -Message "Uploading to server." +& ./package/deploy/winscp.ps1 -DIR win -KEY $env:APPVEYOR_BUILD_FOLDER/package/deploy/slic3r-upload.ppk -FILE *.zip *>> ./sftplog.txt if (!(Test-Path C:\project\slic3r\slic3r.par)) { Add-AppveyorCompilationMessage -Message "Failed to package!" -Category Error From 66c7eb72b586a99982eff761336b9c2dff1561cf Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 4 Apr 2017 23:52:33 -0500 Subject: [PATCH 68/85] set ld library path for archive build so wxpar can find things --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 84f2ee845..f277585b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ script: - perl ./Build.PL after_success: - eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib) -- package/linux/make_archive.sh linux-x64 +- LD_LIBRARY_PATH=$WXDIR/lib package/linux/make_archive.sh linux-x64 - package/deploy/sftp.sh linux ~/slic3r-upload.rsa *.bz2 branches: only: From 04b59affce17be5a5374273c12c85ee0d9190360 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 5 Apr 2017 11:27:04 -0500 Subject: [PATCH 69/85] only decrypt if the key is available (#3858) * only decrypt if the key is available * Use script instead of explicit command * Don't deploy if the keyfile is missing/empty. * Don't deploy if key is not available. * Don't decrypt appveyor key if no secret * wrong name * Fix the logic and a typo --- .travis.yml | 5 +---- appveyor.yml | 4 ++-- package/deploy/sftp.sh | 12 ++++++++---- package/deploy/winscp.ps1 | 4 +++- package/linux/travis-decrypt-key | 7 +++++++ 5 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 package/linux/travis-decrypt-key diff --git a/.travis.yml b/.travis.yml index f277585b9..dc2cefdcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,6 @@ language: perl before_install: -- openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv - -in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa - -d -- chmod 600 ~/slic3r-upload.rsa +- sh package/linux/travis-decrypt-key install: - export LDLOADLIBS=-lstdc++ - export BOOST_DIR=$HOME/boost_1_63_0 diff --git a/appveyor.yml b/appveyor.yml index 23289e5ce..701f5ca6c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,8 +16,8 @@ environment: secure: fYPwnI3p6HNR+eMRJR3JfmyNolFn+Uc0MUn2bBXp9uU= install: - - nuget install secure-file -ExcludeVersion - - secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.ppk.enc -secret %ENC_SECRET% + - IF DEFINED ENC_SECRET nuget install secure-file -ExcludeVersion + - IF DEFINED ENC_SECRET secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.ppk.enc -secret %ENC_SECRET% - ps: "& package/win/appveyor_preinstall.ps1" cache: - C:\Users\appveyor\boost.1.63.0.7z diff --git a/package/deploy/sftp.sh b/package/deploy/sftp.sh index 2ef0d48a3..c69e177d0 100755 --- a/package/deploy/sftp.sh +++ b/package/deploy/sftp.sh @@ -10,7 +10,11 @@ KEY=$1 shift FILES=$* -for i in $FILES; do - filepath=$(readlink -f "$i") - echo put $filepath | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/" -done +if [ -s $KEY ]; then + for i in $FILES; do + filepath=$(readlink -f "$i") + echo put $filepath | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/" + done +else + echo "$KEY is not available, not deploying." +fi diff --git a/package/deploy/winscp.ps1 b/package/deploy/winscp.ps1 index 20dc034ac..af8fc407a 100755 --- a/package/deploy/winscp.ps1 +++ b/package/deploy/winscp.ps1 @@ -10,4 +10,6 @@ Param( ) Set-Variable -Name "UUSER" -Value "$env:UPLOAD_USER" Set-Variable -Name "UPLOAD" -Value "$($FILE | Resolve-Path)" -winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR -hostkey=*" "put $UPLOAD ./$FILE" "exit" +if (Test-Path $KEY) { + winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR -hostkey=*" "put $UPLOAD ./$FILE" "exit" +} diff --git a/package/linux/travis-decrypt-key b/package/linux/travis-decrypt-key new file mode 100644 index 000000000..cfc6bc911 --- /dev/null +++ b/package/linux/travis-decrypt-key @@ -0,0 +1,7 @@ +#!/bin/bash +# Script to only decrypt if it is available + +if [ ! -z ${encrypted_daaf322d08bf_key+x} ]; then + openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv -in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa -d + chmod 600 ~/slic3r-upload.rsa +fi From ab278f03e17873dc423e011b49da4a480fb806fd Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 6 Apr 2017 20:37:53 -0500 Subject: [PATCH 70/85] Deploy PRs to branches/ subdir. (#3865) * Deploy PRs to branches/ subdir. * wrong path to util * added PR number to file name * check for appveyor pr variable * also use branches if pushing a branch on windows * also use branches if pushing a branch on unix * wrong or operator on powershell --- package/deploy/sftp.sh | 6 ++++++ package/deploy/winscp.ps1 | 6 +++++- package/linux/make_archive.sh | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package/deploy/sftp.sh b/package/deploy/sftp.sh index c69e177d0..3fc786fc3 100755 --- a/package/deploy/sftp.sh +++ b/package/deploy/sftp.sh @@ -9,6 +9,12 @@ shift KEY=$1 shift FILES=$* +source $(dirname $0)/../common/util.sh +set_pr_id +set_branch +if [ ! -z ${PR_ID+x} ] || [ $current_branch != "master" ]; then + DIR=${DIR}/branches +fi if [ -s $KEY ]; then for i in $FILES; do diff --git a/package/deploy/winscp.ps1 b/package/deploy/winscp.ps1 index af8fc407a..422d950e8 100755 --- a/package/deploy/winscp.ps1 +++ b/package/deploy/winscp.ps1 @@ -11,5 +11,9 @@ Param( Set-Variable -Name "UUSER" -Value "$env:UPLOAD_USER" Set-Variable -Name "UPLOAD" -Value "$($FILE | Resolve-Path)" if (Test-Path $KEY) { - winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR -hostkey=*" "put $UPLOAD ./$FILE" "exit" + if ($env:APPVEYOR_PULL_REQUEST_NUMBER -Or $env:APPVEYOR_REPO_BRANCH -ne "master" ) { + winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR/branches -hostkey=*" "put $UPLOAD ./$FILE" "exit" + } else { + winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR -hostkey=*" "put $UPLOAD ./$FILE" "exit" + } } diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index ed4d9cd70..1e34dc49a 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -26,7 +26,11 @@ install_par # If we're on a branch, add the branch name to the app name. if [ "$current_branch" == "master" ]; then - dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}.tar.bz2 + if [ ! -z ${PR_ID+x} ]; then + dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}-PR${PR_ID}.tar.bz2 + else + dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}.tar.bz2 + fi else dmgfile=slic3r-${SLIC3R_BUILD_ID}-${1}-${current_branch}.tar.bz2 fi From 5c21237e516edd919648884b8aa26dd7684d2e73 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 7 Apr 2017 22:14:38 +0200 Subject: [PATCH 71/85] Restored/updated the tests about adaptive extrusion width --- lib/Slic3r/ExPolygon.pm | 7 --- t/adaptive_width.t | 92 +++++++++++++++++++++++++++ t/dynamic.t | 93 ---------------------------- xs/src/libslic3r/ExtrusionEntity.hpp | 1 - xs/xsp/ExtrusionLoop.xsp | 2 +- 5 files changed, 93 insertions(+), 102 deletions(-) create mode 100644 t/adaptive_width.t delete mode 100644 t/dynamic.t diff --git a/lib/Slic3r/ExPolygon.pm b/lib/Slic3r/ExPolygon.pm index ec3d92f56..8f244ecb7 100644 --- a/lib/Slic3r/ExPolygon.pm +++ b/lib/Slic3r/ExPolygon.pm @@ -30,13 +30,6 @@ sub offset_ex { return Slic3r::Geometry::Clipper::offset_ex(\@$self, @_); } -sub noncollapsing_offset_ex { - my $self = shift; - my ($distance, @params) = @_; - - return $self->offset_ex($distance + 1, @params); -} - sub bounding_box { my $self = shift; return $self->contour->bounding_box; diff --git a/t/adaptive_width.t b/t/adaptive_width.t new file mode 100644 index 000000000..7a0baa752 --- /dev/null +++ b/t/adaptive_width.t @@ -0,0 +1,92 @@ +use Test::More; +use strict; +use warnings; + +plan tests => 32; + +BEGIN { + use FindBin; + use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; +} + +use List::Util qw(first); +use Slic3r; +use Slic3r::Geometry qw(X Y scale epsilon); +use Slic3r::Surface ':types'; + +sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ } + +{ + my $test = sub { + my ($expolygon, $fw, $expected, $descr) = @_; + + my $flow = Slic3r::Flow->new( + nozzle_diameter => 0.5, + height => 0.4, + width => $fw, + ); + my $slices = Slic3r::Surface::Collection->new; + $slices->append(Slic3r::Surface->new( + surface_type => S_TYPE_INTERNAL, + expolygon => $expolygon, + )); + my $config = Slic3r::Config::Full->new; + my $loops = Slic3r::ExtrusionPath::Collection->new; + my $gap_fill = Slic3r::ExtrusionPath::Collection->new; + my $fill_surfaces = Slic3r::Surface::Collection->new; + my $pg = Slic3r::Layer::PerimeterGenerator->new( + $slices, $flow->height, $flow, + $config, $config, $config, + $loops, $gap_fill, $fill_surfaces, + ); + $pg->process; + + $loops = $loops->flatten; + my @single = grep $_->isa('Slic3r::ExtrusionPath'), @$loops; + my @loops = grep $_->isa('Slic3r::ExtrusionLoop'), @$loops; + + if (0) { + require "Slic3r/SVG.pm"; + Slic3r::SVG::output( + "output.svg", + expolygons => [$expolygon], + polylines => [ map $_->isa('Slic3r::ExtrusionPath') ? $_->polyline : $_->polygon->split_at_first_point, @$loops ], + red_polylines => [ map $_->polyline, @$gap_fill ], + ); + } + + is scalar(@single), $expected->{single} // 0, "expected number of single lines ($descr)"; + is scalar(@loops), $expected->{loops} // 0, "expected number of loops ($descr)"; + is scalar(@$gap_fill), $expected->{gaps} // 0, "expected number of gap fills ($descr)"; + + if ($expected->{single}) { + ok abs($loops->[0]->width - $expected->{width}) < epsilon, "single line covers the full width ($descr)"; + } + if ($expected->{loops}) { + my $loop_width = $loops[0][0]->width; + my $gap_fill_width = @$gap_fill ? $gap_fill->[0]->width : 0; + ok $loop_width * $expected->{loops} * 2 + $gap_fill_width > $expected->{width} - epsilon, + "loop total width + gap fill covers the full width ($descr)"; + } + }; + + my $fw = 0.7; + my $test_rect = sub { + my ($width, $expected) = @_; + + my $e = Slic3r::ExPolygon->new([ scale_points [0,0], [100,0], [100,$width], [0,$width] ]); + $expected->{width} = $width; + $test->($e, $fw, $expected, $width); + }; + $test_rect->($fw * 1, { single => 1, gaps => 0 }); + $test_rect->($fw * 1.3, { single => 1, gaps => 0 }); + $test_rect->($fw * 1.5, { single => 1, gaps => 0 }); + $test_rect->($fw * 2, { loops => 1, gaps => 0 }); + $test_rect->($fw * 2.5, { loops => 1, gaps => 1 }); + $test_rect->($fw * 3, { loops => 1, gaps => 1 }); + $test_rect->($fw * 3.5, { loops => 2, gaps => 0 }); + $test_rect->($fw * 4, { loops => 2, gaps => 1 }); +} + +__END__ diff --git a/t/dynamic.t b/t/dynamic.t deleted file mode 100644 index 5d4d3ceb4..000000000 --- a/t/dynamic.t +++ /dev/null @@ -1,93 +0,0 @@ -use Test::More; -use strict; -use warnings; - -plan skip_all => 'variable-width paths are currently disabled'; -plan tests => 20; - -BEGIN { - use FindBin; - use lib "$FindBin::Bin/../lib"; - use local::lib "$FindBin::Bin/../local-lib"; -} - -use List::Util qw(first); -use Slic3r; -use Slic3r::Geometry qw(X Y scale epsilon); -use Slic3r::Surface ':types'; - -sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ } - -{ - my $square = Slic3r::ExPolygon->new([ - scale_points [0,0], [10,0], [10,10], [0,10], - ]); - - my @offsets = @{$square->noncollapsing_offset_ex(- scale 5)}; - is scalar @offsets, 1, 'non-collapsing offset'; -} - -{ - local $Slic3r::Config = Slic3r::Config->new( - perimeters => 3, - ); - my $w = 0.7; - my $perimeter_flow = Slic3r::Flow->new( - nozzle_diameter => 0.5, - layer_height => 0.4, - width => $w, - ); - - my $print = Slic3r::Print->new; - my $region = Slic3r::Print::Region->new( - print => $print, - flows => { perimeter => $perimeter_flow }, - ); - push @{$print->regions}, $region; - my $object = Slic3r::Print::Object->new( - print => $print, - size => [1,1], - ); - my $make_layer = sub { - my ($width) = @_; - my $layer = Slic3r::Layer->new( - object => $object, - id => 1, - slices => [ - Slic3r::Surface->new( - surface_type => S_TYPE_INTERNAL, - expolygon => Slic3r::ExPolygon->new([ scale_points [0,0], [50,0], [50,$width], [0,$width] ]), - ), - ], - thin_walls => [], - ); - my $layerm = $layer->region(0); - $layer->make_perimeters; - return $layerm; - }; - - my %widths = ( - 1 * $w => { perimeters => 1, gaps => 0 }, - 1.3 * $w => { perimeters => 1, gaps => 1, gap_flow_spacing => $perimeter_flow->clone(width => 0.2 * $w)->spacing }, - 1.5 * $w => { perimeters => 1, gaps => 1, gap_flow_spacing => $perimeter_flow->clone(width => 0.5 * $w)->spacing }, - 2 * $w => { perimeters => 1, gaps => 1, gap_flow_spacing => $perimeter_flow->spacing }, - 2.5 * $w => { perimeters => 1, gaps => 1, gap_flow_spacing => $perimeter_flow->clone(width => 1.5 * $w)->spacing }, - 3 * $w => { perimeters => 2, gaps => 0 }, - 4 * $w => { perimeters => 2, gaps => 1, gap_flow_spacing => $perimeter_flow->spacing }, - ); - - foreach my $width (sort keys %widths) { - my $layerm = $make_layer->($width); - is scalar @{$layerm->perimeters}, $widths{$width}{perimeters}, 'right number of perimeters'; - is scalar @{$layerm->thin_fills} ? 1 : 0, $widths{$width}{gaps}, - ($widths{$width}{gaps} ? 'gaps were filled' : 'no gaps detected'); # TODO: we should check the exact number of gaps, but we need a better medial axis algorithm - - my @gaps = map $_, @{$layerm->thin_fills}; - if (@gaps) { - ok +(!first { abs($_->flow_spacing - $widths{$width}{gap_flow_spacing}) > epsilon } @gaps), - 'flow spacing was dynamically adjusted'; - } - } -} - -__END__ diff --git a/xs/src/libslic3r/ExtrusionEntity.hpp b/xs/src/libslic3r/ExtrusionEntity.hpp index 73b64e286..b5bff5ab3 100644 --- a/xs/src/libslic3r/ExtrusionEntity.hpp +++ b/xs/src/libslic3r/ExtrusionEntity.hpp @@ -142,7 +142,6 @@ class ExtrusionLoop : public ExtrusionEntity void split_at(const Point &point, bool prefer_non_overhang = false); void clip_end(double distance, ExtrusionPaths* paths) const; // Test, whether the point is extruded by a bridging flow. - // This used to be used to avoid placing seams on overhangs, but now the EdgeGrid is used instead. bool has_overhang_point(const Point &point) const; bool is_perimeter() const { return this->paths.front().role == erPerimeter diff --git a/xs/xsp/ExtrusionLoop.xsp b/xs/xsp/ExtrusionLoop.xsp index 11b728a91..290265b19 100644 --- a/xs/xsp/ExtrusionLoop.xsp +++ b/xs/xsp/ExtrusionLoop.xsp @@ -37,7 +37,7 @@ SV* ExtrusionLoop::arrayref() CODE: AV* av = newAV(); - av_fill(av, THIS->paths.size()-1); + if (!THIS->paths.empty()) av_extend(av, THIS->paths.size()-1); for (ExtrusionPaths::iterator it = THIS->paths.begin(); it != THIS->paths.end(); ++it) { av_store(av, it - THIS->paths.begin(), perl_to_SV_ref(*it)); } From ef8695da1d64d14616887295cbd0cb88f3b805d9 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 8 Apr 2017 10:57:16 +0200 Subject: [PATCH 72/85] Update and restore t/loops.t --- t/loops.t | 64 ++++++++++++++----------------- xs/src/libslic3r/TriangleMesh.cpp | 7 ++++ xs/src/libslic3r/TriangleMesh.hpp | 1 + xs/xsp/TriangleMesh.xsp | 1 + 4 files changed, 38 insertions(+), 35 deletions(-) diff --git a/t/loops.t b/t/loops.t index e662469ca..d2bf77176 100644 --- a/t/loops.t +++ b/t/loops.t @@ -2,7 +2,6 @@ use Test::More; use strict; use warnings; -plan skip_all => 'temporarily disabled'; plan tests => 4; BEGIN { @@ -12,46 +11,41 @@ BEGIN { } use Slic3r; +use Slic3r::Geometry qw(Z epsilon scale); use Slic3r::Test; { - # We only need to slice at one height, so we'll build a non-manifold mesh - # that still produces complete loops at that height. Triangular walls are - # enough for this purpose. - # Basically we want to check what happens when three concentric loops happen + # We want to check what happens when three concentric loops happen # to be at the same height, the two external ones being ccw and the other being - # a hole, thus cw. - my (@vertices, @facets) = (); - Slic3r::Test::add_facet($_, \@vertices, \@facets) for - # external surface below the slicing Z - [ [0,0,0], [20,0,10], [0,0,10] ], - [ [20,0,0], [20,20,10], [20,0,10] ], - [ [20,20,0], [0,20,10], [20,20,10] ], - [ [0,20,0], [0,0,10], [0,20,10] ], - - # external insetted surface above the slicing Z - [ [2,2,10], [18,2,10], [2,2,20] ], - [ [18,2,10], [18,18,10], [18,2,20] ], - [ [18,18,10], [2,18,10], [18,18,20] ], - [ [2,18,10], [2,2,10], [2,18,20] ], - - # insetted hole below the slicing Z - [ [15,5,0], [5,5,10], [15,5,10] ], - [ [15,15,0], [15,5,10], [15,15,10] ], - [ [5,15,0], [15,15,10], [5,15,10] ], - [ [5,5,0], [5,15,10], [5,5,10] ]; + # a hole, thus cw. So we create three cubes, centered around origin, the internal + # one having reversed normals. + my $mesh1 = Slic3r::Test::mesh('20mm_cube'); - my $mesh = Slic3r::TriangleMesh->new; - $mesh->ReadFromPerl(\@vertices, \@facets); - $mesh->analyze; - my @lines = map $mesh->intersect_facet($_, 10), 0..$#facets; - my $loops = Slic3r::TriangleMesh::make_loops(\@lines); - is scalar(@$loops), 3, 'correct number of loops detected'; - is scalar(grep $_->is_counter_clockwise, @$loops), 2, 'correct number of ccw loops detected'; + # center around origin + my $bb = $mesh1->bounding_box; + $mesh1->translate( + -($bb->x_min + $bb->size->x/2), + -($bb->y_min + $bb->size->y/2), #// + -($bb->z_min + $bb->size->z/2), + ); - my @surfaces = Slic3r::Layer::Region::_merge_loops($loops, 0); - is scalar(@surfaces), 1, 'one surface detected'; - is scalar(@{$surfaces[0]->expolygon})-1, 1, 'surface has one hole'; + my $mesh2 = $mesh1->clone; + $mesh2->scale(1.2); + + my $mesh3 = $mesh2->clone; + $mesh3->scale(1.2); + + $mesh1->reverse_normals; + ok $mesh1->volume < 0, 'reverse_normals'; + + my $all_meshes = Slic3r::TriangleMesh->new; + $all_meshes->merge($_) for $mesh1, $mesh2, $mesh3; + + my $loops = $all_meshes->slice_at(Z, 0); + is scalar(@$loops), 1, 'one expolygon returned'; + is scalar(@{$loops->[0]->holes}), 1, 'expolygon has one hole'; + ok abs(-$loops->[0]->holes->[0]->area - scale($bb->size->x)*scale($bb->size->y)) < epsilon, #)) + 'hole has expected size'; } __END__ diff --git a/xs/src/libslic3r/TriangleMesh.cpp b/xs/src/libslic3r/TriangleMesh.cpp index 2a52c865f..cba0a7977 100644 --- a/xs/src/libslic3r/TriangleMesh.cpp +++ b/xs/src/libslic3r/TriangleMesh.cpp @@ -511,6 +511,13 @@ TriangleMesh::require_shared_vertices() if (this->stl.v_shared == NULL) stl_generate_shared_vertices(&(this->stl)); } +void +TriangleMesh::reverse_normals() +{ + stl_reverse_all_facets(&this->stl); + if (this->stl.stats.volume != -1) this->stl.stats.volume *= -1.0; +} + void TriangleMesh::extrude_tin(float offset) { diff --git a/xs/src/libslic3r/TriangleMesh.hpp b/xs/src/libslic3r/TriangleMesh.hpp index 51a4e9df4..271324282 100644 --- a/xs/src/libslic3r/TriangleMesh.hpp +++ b/xs/src/libslic3r/TriangleMesh.hpp @@ -59,6 +59,7 @@ class TriangleMesh size_t facets_count() const; void extrude_tin(float offset); void require_shared_vertices(); + void reverse_normals(); static TriangleMesh make_cube(double x, double y, double z); static TriangleMesh make_cylinder(double r, double h, double fa=(2*PI/360)); diff --git a/xs/xsp/TriangleMesh.xsp b/xs/xsp/TriangleMesh.xsp index 373cba12e..47f7c7558 100644 --- a/xs/xsp/TriangleMesh.xsp +++ b/xs/xsp/TriangleMesh.xsp @@ -41,6 +41,7 @@ %code{% RETVAL = THIS->bounding_box().center(); %}; int facets_count(); void reset_repair_stats(); + void reverse_normals(); %{ From ad8326592769b857d39b9cde04e436283c545921 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 11 Apr 2017 00:04:03 +0200 Subject: [PATCH 73/85] Bugfix: "Move to bed center" moved to origin instead. #3855 --- lib/Slic3r/GUI/Plater.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 364f9c191..5df6e6766 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1083,8 +1083,8 @@ sub center_selected_object_on_bed { my $bb = $model_object->bounding_box; my $size = $bb->size; my $vector = Slic3r::Pointf->new( - -$bb->x_min - $size->x/2, - -$bb->y_min - $size->y/2, #// + $self->bed_centerf->x - $bb->x_min - $size->x/2, + $self->bed_centerf->y - $bb->y_min - $size->y/2, #// ); $_->offset->translate(@$vector) for @{$model_object->instances}; $self->refresh_canvases; From 5cc2d346a273f287464b2ec8474167dd4e95bc7c Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 10 Apr 2017 19:16:30 -0500 Subject: [PATCH 74/85] Wrong logic on detecting use of % for support threshold. Fixes #3842. --- lib/Slic3r/Print/SupportMaterial.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Slic3r/Print/SupportMaterial.pm b/lib/Slic3r/Print/SupportMaterial.pm index 214a2a634..c533aa433 100644 --- a/lib/Slic3r/Print/SupportMaterial.pm +++ b/lib/Slic3r/Print/SupportMaterial.pm @@ -96,7 +96,7 @@ sub contact_area { # if user specified a custom angle threshold, convert it to radians my $threshold_rad; - if (!$self->object_config->support_material_threshold =~ /%$/) { + if (!($self->object_config->support_material_threshold =~ /%$/)) { $threshold_rad = deg2rad($self->object_config->support_material_threshold + 1); # +1 makes the threshold inclusive Slic3r::debugf "Threshold angle = %d°\n", rad2deg($threshold_rad); } From 5c2a05cd3a494a4d13852d8dd8da772939656109 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 12 Apr 2017 00:06:08 +0200 Subject: [PATCH 75/85] Accept and ignore --no-plater and --gui-mode. #3876 --- slic3r.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/slic3r.pl b/slic3r.pl index 75bf3b961..9526ab6c2 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -51,6 +51,10 @@ my %cli_options = (); 'duplicate-grid=s' => \$opt{duplicate_grid}, 'print-center=s' => \$opt{print_center}, 'dont-arrange' => \$opt{dont_arrange}, + + # legacy options, ignored + 'no-plater' => \$opt{no_plater}, + 'gui-mode=s' => \$opt{gui_mode}, ); foreach my $opt_key (keys %{$Slic3r::Config::Options}) { my $cli = $Slic3r::Config::Options->{$opt_key}->{cli} or next; @@ -60,6 +64,9 @@ my %cli_options = (); @ARGV = grep !/^-psn_\d/, @ARGV if $^O eq 'darwin'; GetOptions(%options) or usage(1); + + warn "--no-plater option is deprecated; ignoring\n" if $opt{no_plater}; + warn "--gui-mode option is deprecated (Slic3r now has only Expert Mode); ignoring\n" if $opt{gui_mode}; } # load configuration files From b78ccc6d4f3e7766da6dc3e9bc05c36da8b09193 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Thu, 13 Apr 2017 16:04:07 -0500 Subject: [PATCH 76/85] Ignore vim swap files. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index f24586461..c8c13aed4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ xs/assertlib* local-lib package/osx/Slic3r*.app *.dmg +*.swp +*.swo From 075adca8bb94d527275b8812693c314dc31cb090 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 15 Apr 2017 10:39:11 -0500 Subject: [PATCH 77/85] Resize & Rotate modifier mesh (#3879) * Prototype scaling-to-size for modifier meshes. Currently the rescale doesn't seem to operate as expected. * Added scaling to size for modifier meshes. * Added rotation for modifier meshes. * Used correct UTF8 encoded ellipse. --- lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm | 120 +++++++++++++++++- lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm | 15 ++- xs/xsp/Model.xsp | 9 ++ 3 files changed, 140 insertions(+), 4 deletions(-) diff --git a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm index 1898ac6a0..17090438d 100644 --- a/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm +++ b/lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm @@ -9,7 +9,9 @@ use utf8; use File::Basename qw(basename); use Wx qw(:misc :sizer :treectrl :button wxTAB_TRAVERSAL wxSUNKEN_BORDER wxBITMAP_TYPE_PNG wxID_CANCEL wxTheApp); -use Wx::Event qw(EVT_BUTTON EVT_TREE_ITEM_COLLAPSING EVT_TREE_SEL_CHANGED); +use List::Util qw(max); +use Wx::Event qw(EVT_BUTTON EVT_TREE_ITEM_COLLAPSING EVT_TREE_SEL_CHANGED EVT_TREE_ITEM_RIGHT_CLICK); +use Slic3r::Geometry qw(X Y Z MIN MAX scale unscale deg2rad rad2deg); use base 'Wx::Panel'; use constant ICON_OBJECT => 0; @@ -156,11 +158,47 @@ sub new { return if $self->{disable_tree_sel_changed_event}; $self->selection_changed; }); + EVT_TREE_ITEM_RIGHT_CLICK($self, $tree, sub { + my ($self, $event) = @_; + my $item = $event->GetItem; + my $frame = $self->GetFrame; + my $menu = Wx::Menu->new; + + my $scaleToSizeMenu = Wx::Menu->new; + my $scaleToSizeMenuItem = $menu->AppendSubMenu($scaleToSizeMenu, "Scale to size", 'Scale the selected object along a single axis'); + wxTheApp->set_menu_item_icon($scaleToSizeMenuItem, 'arrow_out.png'); + $frame->_append_menu_item($scaleToSizeMenu, "Uniformly… ", 'Scale the selected object along the XYZ axes', sub { + $self->changescale(undef, 1); + }); + $frame->_append_menu_item($scaleToSizeMenu, "Along X axis…", 'Scale the selected object along the X axis', sub { + $self->changescale(X, 1); + }, undef, 'bullet_red.png'); + $frame->_append_menu_item($scaleToSizeMenu, "Along Y axis…", 'Scale the selected object along the Y axis', sub { + $self->changescale(Y, 1); + }, undef, 'bullet_green.png'); + $frame->_append_menu_item($scaleToSizeMenu, "Along Z axis…", 'Scale the selected object along the Z axis', sub { + $self->changescale(Z, 1); + }, undef, 'bullet_blue.png'); + my $rotateMenu = Wx::Menu->new; + my $rotateMenuItem = $menu->AppendSubMenu($rotateMenu, "Rotate", 'Rotate the selected object by an arbitrary angle'); + wxTheApp->set_menu_item_icon($rotateMenuItem, 'textfield.png'); + $frame->_append_menu_item($rotateMenu, "Around X axis…", 'Rotate the selected object by an arbitrary angle around X axis', sub { + $self->rotate(undef, X); + }, undef, 'bullet_red.png'); + $frame->_append_menu_item($rotateMenu, "Around Y axis…", 'Rotate the selected object by an arbitrary angle around Y axis', sub { + $self->rotate(undef, Y); + }, undef, 'bullet_green.png'); + $frame->_append_menu_item($rotateMenu, "Around Z axis…", 'Rotate the selected object by an arbitrary angle around Z axis', sub { + $self->rotate(undef, Z); + }, undef, 'bullet_blue.png'); + + $frame->PopupMenu($menu, $event->GetPoint); + }); EVT_BUTTON($self, $self->{btn_load_part}, sub { $self->on_btn_load(0) }); EVT_BUTTON($self, $self->{btn_load_modifier}, sub { $self->on_btn_load(1) }); EVT_BUTTON($self, $self->{btn_load_lambda_modifier}, sub { $self->on_btn_lambda(1) }); EVT_BUTTON($self, $self->{btn_delete}, \&on_btn_delete); - + $self->reload_tree; return $self; @@ -450,4 +488,82 @@ sub _update { $self->{canvas}->Render; } +sub changescale { + my ($self, $axis, $tosize) = @_; + my $itemData = $self->get_selection; + if ($itemData && $itemData->{type} eq 'volume') { + my $volume = $self->{model_object}->volumes->[$itemData->{volume_id}]; + my $object_size = $volume->bounding_box->size; + if (defined $axis) { + my $axis_name = $axis == X ? 'X' : $axis == Y ? 'Y' : 'Z'; + my $scale; + if (defined $tosize) { + my $cursize = $object_size->[$axis]; + # Wx::GetNumberFromUser() does not support decimal numbers + my $newsize = Wx::GetTextFromUser( + sprintf("Enter the new size for the selected mesh:"), + "Scale along $axis_name", + $cursize, $self); + return if !$newsize || $newsize !~ /^\d*(?:\.\d*)?$/ || $newsize < 0; + $scale = $newsize / $cursize * 100; + } else { + # Wx::GetNumberFromUser() does not support decimal numbers + $scale = Wx::GetTextFromUser("Enter the scale % for the selected object:", + "Scale along $axis_name", 100, $self); + $scale =~ s/%$//; + return if !$scale || $scale !~ /^\d*(?:\.\d*)?$/ || $scale < 0; + } + my $versor = [1,1,1]; + $versor->[$axis] = $scale/100; + $volume->mesh->scale_xyz(Slic3r::Pointf3->new(@$versor)); + } else { + my $scale; + if ($tosize) { + my $cursize = max(@$object_size); + # Wx::GetNumberFromUser() does not support decimal numbers + my $newsize = Wx::GetTextFromUser("Enter the new max size for the selected object:", + "Scale", $cursize, $self); + return if !$newsize || $newsize !~ /^\d*(?:\.\d*)?$/ || $newsize < 0; + $scale = $newsize / $cursize; + } else { + # max scale factor should be above 2540 to allow importing files exported in inches + # Wx::GetNumberFromUser() does not support decimal numbers + $scale = Wx::GetTextFromUser("Enter the scale % for the selected object:", 'Scale', + 100, $self); + return if !$scale || $scale !~ /^\d*(?:\.\d*)?$/ || $scale < 0; + } + return if !$scale || $scale < 0; + $volume->mesh->scale($scale); + } + $self->_parts_changed; + } +} + +sub rotate { + my $self = shift; + my ($angle, $axis) = @_; + # angle is in degrees + my $itemData = $self->get_selection; + if ($itemData && $itemData->{type} eq 'volume') { + my $volume = $self->{model_object}->volumes->[$itemData->{volume_id}]; + if (!defined $angle) { + my $axis_name = $axis == X ? 'X' : $axis == Y ? 'Y' : 'Z'; + my $default = $axis == Z ? 0 : 0; + # Wx::GetNumberFromUser() does not support decimal numbers + $angle = Wx::GetTextFromUser("Enter the rotation angle:", "Rotate around $axis_name axis", + $default, $self); + return if !$angle || $angle !~ /^-?\d*(?:\.\d*)?$/ || $angle == -1; + } + if ($axis == X) { $volume->mesh->rotate_x(deg2rad($angle)); } + + if ($axis == Y) { $volume->mesh->rotate_y(deg2rad($angle)); } + if ($axis == Z) { $volume->mesh->rotate_z(deg2rad($angle)); } + + $self->_parts_changed; + } +} +sub GetFrame { + my ($self) = @_; + return &Wx::GetTopLevelParent($self); +} 1; diff --git a/lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm b/lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm index c0979cd13..2cca0d901 100644 --- a/lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm +++ b/lib/Slic3r/GUI/Plater/ObjectSettingsDialog.pm @@ -7,8 +7,8 @@ use strict; use warnings; use utf8; -use Wx qw(:dialog :id :misc :sizer :systemsettings :notebook wxTAB_TRAVERSAL); -use Wx::Event qw(EVT_BUTTON); +use Wx qw(:dialog :id :misc :sizer :systemsettings :notebook wxTAB_TRAVERSAL wxTheApp); +use Wx::Event qw(EVT_BUTTON EVT_MENU); use base 'Wx::Dialog'; sub new { @@ -53,6 +53,17 @@ sub PartSettingsChanged { my ($self) = @_; return $self->{parts}->PartSettingsChanged || $self->{layers}->LayersChanged; } +sub _append_menu_item { + my ($self, $menu, $string, $description, $cb, $id, $icon, $kind) = @_; + + $id //= &Wx::NewId(); + my $item = $menu->Append($id, $string, $description, $kind); + wxTheApp->set_menu_item_icon($item, $icon); + + EVT_MENU($self, $id, $cb); + return $item; +} + package Slic3r::GUI::Plater::ObjectDialog::BaseTab; use base 'Wx::Panel'; diff --git a/xs/xsp/Model.xsp b/xs/xsp/Model.xsp index cb415ad14..a53065236 100644 --- a/xs/xsp/Model.xsp +++ b/xs/xsp/Model.xsp @@ -248,6 +248,15 @@ ModelMaterial::attributes() void set_material_id(t_model_material_id material_id) %code%{ THIS->material_id(material_id); %}; Ref material(); + + Clone bounding_box() + %code%{ + try { + RETVAL = THIS->mesh.bounding_box(); + } catch (std::exception& e) { + croak("%s", e.what()); + } + %}; Ref config() %code%{ RETVAL = &THIS->config; %}; From 1857bf63910a7ade053390157fbd1bb9533629a0 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 15 Apr 2017 14:31:31 -0500 Subject: [PATCH 78/85] SupportMaterial operates in angle, underling XS Fill operates in radians. Convert degrees->radians Fixes #3861 --- lib/Slic3r/Print/SupportMaterial.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/Print/SupportMaterial.pm b/lib/Slic3r/Print/SupportMaterial.pm index c533aa433..ecb044068 100644 --- a/lib/Slic3r/Print/SupportMaterial.pm +++ b/lib/Slic3r/Print/SupportMaterial.pm @@ -722,7 +722,7 @@ sub generate_toolpaths { # interface and contact infill if (@$interface || @$contact_infill) { - $fillers{interface}->set_angle($interface_angle); + $fillers{interface}->set_angle(deg2rad($interface_angle)); $fillers{interface}->set_min_spacing($_interface_flow->spacing); # find centerline of the external loop @@ -772,7 +772,7 @@ sub generate_toolpaths { # support or flange if (@$base) { my $filler = $fillers{support}; - $filler->set_angle($angles[ ($layer_id) % @angles ]); + $filler->set_angle(deg2rad($angles[ ($layer_id) % @angles ])); # We don't use $base_flow->spacing because we need a constant spacing # value that guarantees that all layers are correctly aligned. @@ -789,7 +789,7 @@ sub generate_toolpaths { # base flange if ($layer_id == 0) { $filler = $fillers{interface}; - $filler->set_angle($self->object_config->support_material_angle + 90); + $filler->set_angle(deg2rad($self->object_config->support_material_angle + 90)); $density = 0.5; $base_flow = $self->first_layer_flow; From 3776f1afc64d5bcf8079b4e83e0376a79f91573e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 15 Apr 2017 11:10:53 +0200 Subject: [PATCH 79/85] Fixed regression causing posPrepareInfill invalidation to have no effects. #3874 --- lib/Slic3r/Print/Object.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 368a23406..300b8e361 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -156,7 +156,6 @@ sub prepare_infill { my ($self) = @_; return if $self->step_done(STEP_PREPARE_INFILL); - $self->set_step_started(STEP_PREPARE_INFILL); # This prepare_infill() is not really idempotent. # TODO: It should clear and regenerate fill_surfaces at every run @@ -164,6 +163,9 @@ sub prepare_infill { $self->invalidate_step(STEP_PERIMETERS); $self->make_perimeters; + # Do this after invalidating STEP_PERIMETERS because that would re-invalidate STEP_PREPARE_INFILL + $self->set_step_started(STEP_PREPARE_INFILL); + # prerequisites $self->detect_surfaces_type; From cf984e17a3b4e1ea560c6e6951e12ed5d62700ae Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 18 Apr 2017 19:25:18 +0200 Subject: [PATCH 80/85] Fix SLAPrint default overrides --- lib/Slic3r/GUI/SLAPrintOptions.pm | 4 ++++ xs/src/libslic3r/PrintConfig.hpp | 12 ------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/Slic3r/GUI/SLAPrintOptions.pm b/lib/Slic3r/GUI/SLAPrintOptions.pm index 042ddc288..289f4e5a1 100644 --- a/lib/Slic3r/GUI/SLAPrintOptions.pm +++ b/lib/Slic3r/GUI/SLAPrintOptions.pm @@ -12,6 +12,10 @@ sub new { $self->config(Slic3r::Config::SLAPrint->new); $self->config->apply_dynamic(wxTheApp->{mainframe}->{plater}->config); + # Set some defaults + $self->config->set('infill_extrusion_width', 0.5) if $self->config->infill_extrusion_width == 0; + $self->config->set('perimeter_extrusion_width', 1) if $self->config->perimeter_extrusion_width == 0; + my $sizer = Wx::BoxSizer->new(wxVERTICAL); my $new_optgroup = sub { my ($title) = @_; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 5b4206266..ce5162ffa 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -574,18 +574,6 @@ class SLAPrintConfig ConfigOptionFloat support_material_spacing; ConfigOptionInt threads; - SLAPrintConfig() : StaticPrintConfig() { - this->set_defaults(); - - // override some defaults - this->fill_density.value = 100; - this->fill_pattern.value = ipGrid; - this->infill_extrusion_width.value = 0.5; - this->infill_extrusion_width.percent = false; - this->perimeter_extrusion_width.value = 1; - this->perimeter_extrusion_width.percent = false; - }; - virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) { OPT_PTR(fill_angle); OPT_PTR(fill_density); From e0301acad991f5a0e273a85497cd30d4c57746b2 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 18 Apr 2017 15:47:41 -0500 Subject: [PATCH 81/85] abort download if no package. --- package/win/appveyor_deploy.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/win/appveyor_deploy.ps1 b/package/win/appveyor_deploy.ps1 index 818565820..d596190ca 100644 --- a/package/win/appveyor_deploy.ps1 +++ b/package/win/appveyor_deploy.ps1 @@ -3,10 +3,10 @@ cd package/win ./compile_wrapper.ps1 524 | Write-Output ./package_win32.ps1 524| Write-Output cd ../../ -Add-AppveyorCompilationMessage -Message "Uploading to server." -& ./package/deploy/winscp.ps1 -DIR win -KEY $env:APPVEYOR_BUILD_FOLDER/package/deploy/slic3r-upload.ppk -FILE *.zip *>> ./sftplog.txt - if (!(Test-Path C:\project\slic3r\slic3r.par)) { Add-AppveyorCompilationMessage -Message "Failed to package!" -Category Error return 1 } + +Add-AppveyorCompilationMessage -Message "Uploading to server." +& ./package/deploy/winscp.ps1 -DIR win -KEY $env:APPVEYOR_BUILD_FOLDER/package/deploy/slic3r-upload.ppk -FILE *.zip *>> ./sftplog.txt From 85374b8c30b66991fec2d2db72275477e3220d9f Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Tue, 18 Apr 2017 16:11:38 -0500 Subject: [PATCH 82/85] Removed useless test. --- package/win/appveyor_deploy.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package/win/appveyor_deploy.ps1 b/package/win/appveyor_deploy.ps1 index d596190ca..28616f02c 100644 --- a/package/win/appveyor_deploy.ps1 +++ b/package/win/appveyor_deploy.ps1 @@ -3,10 +3,6 @@ cd package/win ./compile_wrapper.ps1 524 | Write-Output ./package_win32.ps1 524| Write-Output cd ../../ -if (!(Test-Path C:\project\slic3r\slic3r.par)) { - Add-AppveyorCompilationMessage -Message "Failed to package!" -Category Error - return 1 -} Add-AppveyorCompilationMessage -Message "Uploading to server." & ./package/deploy/winscp.ps1 -DIR win -KEY $env:APPVEYOR_BUILD_FOLDER/package/deploy/slic3r-upload.ppk -FILE *.zip *>> ./sftplog.txt From 5f6a12c16348cd796e81e291ef2c9f9cea391481 Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Wed, 19 Apr 2017 02:03:11 +0000 Subject: [PATCH 83/85] stable-ish libraries for Linux --- package/linux/libpaths.txt | 28 ++++++++++++++++++++++++++++ package/linux/make_archive.sh | 6 ++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 package/linux/libpaths.txt diff --git a/package/linux/libpaths.txt b/package/linux/libpaths.txt new file mode 100644 index 000000000..798e9103d --- /dev/null +++ b/package/linux/libpaths.txt @@ -0,0 +1,28 @@ +/home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_baseu-3.0.so.0 +/home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_adv-3.0.so.0 +/home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_core-3.0.so.0 +/lib/x86_64-linux-gnu/liblzma.so.5 +/lib/x86_64-linux-gnu/libm.so.6 +/lib/x86_64-linux-gnu/libpcre.so.3 +/lib/x86_64-linux-gnu/libpng12.so.0 +/lib/x86_64-linux-gnu/libresolv.so.2 +/lib/x86_64-linux-gnu/libuuid.so.1 +/usr/lib/x86_64-linux-gnu/libSM.so.6 +/usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 +/usr/lib/x86_64-linux-gnu/libdatrie.so.1 +/usr/lib/x86_64-linux-gnu/libfreetype.so.6 +/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 +/usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 +/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 +/usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 +/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 +/usr/lib/x86_64-linux-gnu/libgraphite2.so.3 +/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 +/usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 +/usr/lib/x86_64-linux-gnu/libjbig.so.0 +/usr/lib/x86_64-linux-gnu/libjpeg.so.8 +/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 +/usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 +/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 +/usr/lib/x86_64-linux-gnu/libpixman-1.so.0 +/usr/lib/x86_64-linux-gnu/libtiff.so.5 diff --git a/package/linux/make_archive.sh b/package/linux/make_archive.sh index 1e34dc49a..422ac19a0 100755 --- a/package/linux/make_archive.sh +++ b/package/linux/make_archive.sh @@ -47,7 +47,7 @@ echo "Appfolder: $appfolder, archivefolder: $archivefolder" # Our slic3r dir and location of perl PERL_BIN=$(which perl) -PP_BIN=$(which wxpar) +PP_BIN=$(which pp) SLIC3R_DIR="./" if [[ -d "${appfolder}" ]]; then @@ -104,8 +104,10 @@ ${PP_BIN} wxextension .0 \ unzip -qq -o $WD/_tmp/test.par -d $WD/_tmp/ cp -rf $WD/_tmp/lib/* $archivefolder/local-lib/lib/perl5/ cp -rf $WD/_tmp/shlib $archivefolder/ - rm -rf $WD/_tmp +for i in $(cat $WD/libpaths.txt); do + install -v $i $archivefolder/bin +done echo "Cleaning local-lib" rm -rf $archivefolder/local-lib/bin From b26681ef58b964d9889cd4d7e0eff6c606c323ff Mon Sep 17 00:00:00 2001 From: Travis CI User Date: Wed, 19 Apr 2017 02:09:54 +0000 Subject: [PATCH 84/85] updated travis for new linux package script --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dc2cefdcb..f399c1de8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ install: - export SLIC3R_STATIC=1 - export CXX=g++-4.9 - export CC=g++-4.9 -- export WXDIR=$HOME/wx302 - source $HOME/perl5/perlbrew/etc/bashrc script: - bash package/linux/travis-setup.sh @@ -32,6 +31,8 @@ addons: packages: - g++-4.9 - gcc-4.9 + - libgtk2.0-0 + - libgtk2.0-dev ssh_known_hosts: dl.slic3r.org notifications: irc: From 3274b75e5fca595f90b471890a9033dbd30d8ae1 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 19 Apr 2017 02:30:19 +0000 Subject: [PATCH 85/85] Update file encodings and add some commentary. Also make 524 the default perl lib --- package/common/shell.cpp | 6 ------ package/win/autorun.bat | 1 - package/win/compile_wrapper.ps1 | 13 ++++++++++++- package/win/package_win32.ps1 | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) delete mode 100644 package/win/autorun.bat diff --git a/package/common/shell.cpp b/package/common/shell.cpp index 166f72111..4ce3c9afa 100644 --- a/package/common/shell.cpp +++ b/package/common/shell.cpp @@ -1,7 +1,6 @@ #include // from the Perl distribution #include // from the Perl distribution - #ifdef WIN32 // Perl win32 specific includes, found in perl\\lib\\CORE\\win32.h // Defines the windows specific convenience RunPerl() function, @@ -17,13 +16,8 @@ int main(int argc, char **argv, char **env) { - // replaces following Windows batch file: @"%~dp0\perl5.24.0.exe" - // "%~dp0\slic3r.pl" --DataDir "C:\Users\Public\Documents\Prusa3D\Slic3r - // settings MK2"%* - // If the Slic3r is installed in a localized directory (containing non-iso // characters), spaces or semicolons, use short file names. - char exe_path[MAX_PATH] = {0}; char script_path[MAX_PATH]; char gui_flag[6] = {"--gui"}; diff --git a/package/win/autorun.bat b/package/win/autorun.bat deleted file mode 100644 index be2c7b3f0..000000000 --- a/package/win/autorun.bat +++ /dev/null @@ -1 +0,0 @@ -@perl5.24.0.exe slic3r.pl %* diff --git a/package/win/compile_wrapper.ps1 b/package/win/compile_wrapper.ps1 index abd929287..c5d603ef3 100644 --- a/package/win/compile_wrapper.ps1 +++ b/package/win/compile_wrapper.ps1 @@ -4,16 +4,27 @@ if ($args[0]) $perlver = $args[0] } else { - $perlver = 518 + $perlver = 524 } $perllib = "-lperl$perlver" $shell_loc = "..\common\shell.cpp" +# Build the resource file (used to load icon, etc) windres slic3r.rc -O coff -o slic3r.res + +# Compile an object file that does not have gui forced. g++ -c -I'C:\strawberry\perl\lib\CORE\' $shell_loc -o slic3r.o + +# Compile an object file with --gui automatically passed as an argument g++ -c -I'C:\strawberry\perl\lib\CORE\' -DFORCE_GUI $shell_loc -o slic3r-gui.o + +# Build the EXE for the unforced version as slic3r-console g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r.o slic3r.res -o slic3r-console.exe | Write-Host + +# Build the EXE for the forced GUI g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -mwindows -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r.exe | Write-Host + +# Build an extra copy of the GUI version that creates a console window g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r-debug-console.exe | Write-Host diff --git a/package/win/package_win32.ps1 b/package/win/package_win32.ps1 index 1a98bcf27..07396ea37 100644 --- a/package/win/package_win32.ps1 +++ b/package/win/package_win32.ps1 @@ -1,7 +1,7 @@ -# Written by Joseph Lenox +# Written by Joseph Lenox # Licensed under the same license as the rest of Slic3r. # ------------------------ -# You need to have Strawberry Perl 5.24.0.1 installed for this to work, +# You need to have Strawberry Perl 5.24.0.1 (or slic3r-perl) installed for this to work, param ( [switch]$exe = $false )