Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gcc11-compat and merge to CELLINKAB/master #6

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
84101d6
Force aligned infill when first layer height differs
jpnurmi Jul 26, 2019
14003a3
Add per-model command line interface for transformations
jpnurmi Jan 22, 2019
fe517be
Add per-model command line interface for configs
jpnurmi Jan 24, 2019
1b78f0c
Add before_xxx_gcode for perimeter, infill & support
jpnurmi Aug 5, 2019
881b51b
Add command line option to pass travel height while traveling between…
Sep 24, 2019
e2e7131
Merge pull request #1 from CELLINKAB/heartware-complete-objects-trave…
Sep 24, 2019
84c1c29
Windows: allow building with Boost 1.66-1.69
jpnurmi Oct 3, 2019
c109391
Add command line option to disable loop clipping
jesper-cellink Jun 8, 2022
f34baeb
Remove unneeded config
jesper-cellink Jun 8, 2022
42570c0
Merge in new sli3cer (#4)
edmundwatson Apr 25, 2023
60de607
Update PrintObject.cpp
janaperic Apr 25, 2023
41d221c
Update SupportMaterial.hpp
janaperic Apr 25, 2023
cf75563
Update TriangleMesh.cpp
janaperic Apr 25, 2023
54e5fd4
Update SLAPrint.cpp
janaperic Apr 25, 2023
710e66b
fix Boost 1.84.0 compat issues
marcus-sonestedt Mar 5, 2024
4388c97
Merge remote-tracking branch 'origin/master' into issues/gcc11_compat
marcus-sonestedt Mar 5, 2024
542e033
Fix some for-loops using value instead of const ref
marcus-sonestedt Mar 5, 2024
60d42ae
Revert "Fix some for-loops using value instead of const ref"
marcus-sonestedt Mar 5, 2024
49e4dee
Merge remote-tracking branch 'origin/issues/gcc11_compat' into heartware
marcus-sonestedt Mar 5, 2024
e165ea4
Merge remote-tracking branch 'origin/heartwaresync' into issues/gcc11…
marcus-sonestedt Mar 5, 2024
f969098
Merge remote-tracking branch 'origin/issues/gcc11_compat' into issues…
marcus-sonestedt Mar 5, 2024
dbe2850
Fix nowide def in modern cmake + and->&&
marcus-sonestedt Mar 7, 2024
68de6b2
Fix nowide def more, different #ifdefs used in code
marcus-sonestedt Mar 7, 2024
d4c9039
Fix more windows compile issues against a more recent Boost (v1.84)
marcus-sonestedt Mar 7, 2024
9d9d16c
Remove local boost nowide as it doesn't build against boost 1.84, whi…
marcus-sonestedt Mar 8, 2024
67dd5a1
Set default codepage to 1252 in windows manifest to solve perl codepa…
marcus-sonestedt Mar 8, 2024
ed95a79
Update local boost::nowide from Boost 1.78
marcus-sonestedt Mar 8, 2024
e1278a1
Temporarily disable boost search
marcus-sonestedt Apr 10, 2024
a7a88f3
Fix wrapper exec build on windows
marcus-sonestedt Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ gui_test
slic3r_test
compile_commands.json
tags
.vscode
14 changes: 7 additions & 7 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ EOF
if (!$gui) {
# clean xs directory before reinstalling, to make sure Build is called
# with current perl binary
if (-e './xs/Build') {
if ($^O eq 'MSWin32') {
system '.\xs\Build', 'distclean';
} else {
system './xs/Build', 'distclean';
}
}
#if (-e './xs/Build') {
# if ($^O eq 'MSWin32') {
# system '.\xs\Build', 'distclean';
# } else {
# system './xs/Build', 'distclean';
# }
#}
my $res = system $cpanm, @cpanm_args, '--reinstall', '--verbose', './xs';
if ($res != 0) {
die "The XS/C++ code failed to compile, aborting\n";
Expand Down
19 changes: 19 additions & 0 deletions lib/Slic3r/Print.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ use Slic3r::Print::State ':steps';
use Slic3r::Surface qw(S_TYPE_BOTTOM);

our $status_cb;
our $travel_height;
our $enable_loop_clipping;

sub set_travel_height {
my ($class, $th) = @_;
$travel_height = $th;
}
sub travel_height {
return $travel_height;
}

sub set_enable_loop_clipping {
my ($class, $th) = @_;
$enable_loop_clipping = $th;
}

sub enable_loop_clipping {
return $enable_loop_clipping;
}

sub set_status_cb {
my ($class, $cb) = @_;
Expand Down
36 changes: 21 additions & 15 deletions lib/Slic3r/Print/GCode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ has '_brim_done' => (is => 'rw');
has '_second_layer_things_done' => (is => 'rw');
has '_last_obj_copy' => (is => 'rw');
has '_autospeed' => (is => 'rw', default => sub { 0 }); # boolean
has '_enable_loop_clipping' => (is => 'rw');

use List::Util qw(first sum min max);
use Slic3r::ExtrusionPath ':roles';
Expand Down Expand Up @@ -139,6 +140,8 @@ sub export {
# but we need it for skirt/brim too
$gcodegen->set_first_layer(1);

$self->_enable_loop_clipping($self->print->enable_loop_clipping);

# disable fan
print $fh $gcodegen->writer->set_fan(0, 1)
if $self->config->cooling && $self->config->disable_fan_first_layers;
Expand Down Expand Up @@ -239,21 +242,23 @@ sub export {
# move to the origin position for the copy we're going to print.
# this happens before Z goes down to layer 0 again, so that
# no collision happens hopefully.
if ($finished_objects > 0) {
$gcodegen->set_origin(Slic3r::Pointf->new(map unscale $copy->[$_], X,Y));
$gcodegen->set_enable_cooling_markers(0); # we're not filtering these moves through CoolingBuffer
$gcodegen->avoid_crossing_perimeters->set_use_external_mp_once(1);
print $fh $gcodegen->retract;
print $fh $gcodegen->travel_to(
Slic3r::Point->new(0,0),
EXTR_ROLE_NONE,
'move to origin position for next object',
);
$gcodegen->set_enable_cooling_markers(1);

# disable motion planner when traveling to first object point
$gcodegen->avoid_crossing_perimeters->set_disable_once(1);
$gcodegen->set_origin(Slic3r::Pointf->new(map unscale $copy->[$_], X,Y));
$gcodegen->set_enable_cooling_markers(0); # we're not filtering these moves through CoolingBuffer
$gcodegen->avoid_crossing_perimeters->set_use_external_mp_once(1);
print $fh $gcodegen->retract;
if ($self->print->travel_height) {
printf $fh "G1 Z%.f 1200 ; Move the bed down to the specified height when traveling between complete objects\n",
$self->print->travel_height;
}
print $fh $gcodegen->travel_to(
Slic3r::Point->new(0,0),
EXTR_ROLE_NONE,
'move to origin position for next object',
);
$gcodegen->set_enable_cooling_markers(1);

# disable motion planner when traveling to first object point
$gcodegen->avoid_crossing_perimeters->set_disable_once(1);

my @layers = sort { $a->print_z <=> $b->print_z } @{$object->layers}, @{$object->support_layers};
for my $layer (@layers) {
Expand Down Expand Up @@ -411,7 +416,8 @@ sub process_layer {
}

# if we're going to apply spiralvase to this layer, disable loop clipping
$self->_gcodegen->set_enable_loop_clipping(!defined $self->_spiral_vase || !$self->_spiral_vase->enable);
# also disable loop clipping if it has been explicitly disabled
$self->_gcodegen->set_enable_loop_clipping((!defined $self->_spiral_vase || !$self->_spiral_vase->enable) && $self->_enable_loop_clipping);

# initialize autospeed
{
Expand Down
16 changes: 16 additions & 0 deletions lib/Slic3r/Print/Simple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ has 'output_file' => (
is => 'rw',
);

has 'travel_height' => (
is => 'rw',
);

has 'disable_loop_clipping' => (
is => 'rw',
);

sub _bed_polygon {
my ($self) = @_;

Expand Down Expand Up @@ -135,6 +143,14 @@ sub _before_export {
my ($self) = @_;

$self->_print->set_status_cb($self->status_cb);
if ($self->travel_height) {
$self->_print->set_travel_height($self->travel_height);
}
if ($self->disable_loop_clipping) {
$self->_print->set_enable_loop_clipping(0);
} else {
$self->_print->set_enable_loop_clipping(1);
}
$self->_print->validate;
}

Expand Down
4 changes: 2 additions & 2 deletions package/win/compile_wrapper.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Short Powershell script to build a wrapper exec
Param
(
[string]$perlVersion = "524",
[string]$STRAWBERRY_PATH = "C:\Strawberry",
[string]$perlVersion = "532",
[string]$STRAWBERRY_PATH = "C:\StrawberryPerl",
# Path to C++ compiler, or just name if it is in path
[string]$cxx = "g++"
)
Expand Down
5 changes: 5 additions & 0 deletions package/win/slic3r.exe.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">1252</activeCodePage> <!-- 1252 is the code page for Western Europe -->
</windowsSettings>
</application>
</assembly>
53 changes: 52 additions & 1 deletion slic3r.pl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ BEGIN

'save=s' => \$opt{save},
'load=s@' => \$opt{load},
'lm=s@' => \$opt{lm},
'autosave=s' => \$opt{autosave},
'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config},
'datadir=s' => \$opt{datadir},
Expand All @@ -51,11 +52,23 @@ BEGIN
'rotate=f' => \$opt{rotate},
'rotate-x=f' => \$opt{rotate_x},
'rotate-y=f' => \$opt{rotate_y},
'sc=f@' => \$opt{sc},
'sx=f@' => \$opt{sx},
'sy=f@' => \$opt{sy},
'sz=f@' => \$opt{sz},
'rx=f@' => \$opt{rx},
'ry=f@' => \$opt{ry},
'rz=f@' => \$opt{rz},
'tx=f@' => \$opt{tx},
'ty=f@' => \$opt{ty},
'tz=f@' => \$opt{tz},
'duplicate=i' => \$opt{duplicate},
'duplicate-grid=s' => \$opt{duplicate_grid},
'print-center=s' => \$opt{print_center},
'dont-arrange' => \$opt{dont_arrange},

'travel-height=f' => \$opt{travel_height},
'disable-loop-clipping' => \$opt{disable_loop_clipping},

# legacy options, ignored
'no-plater' => \$opt{no_plater},
'gui-mode=s' => \$opt{gui_mode},
Expand Down Expand Up @@ -92,6 +105,25 @@ BEGIN
$_->normalize for @external_configs;
}

# load model configuration files
my @model_configs = ();
if ($opt{lm}) {
foreach my $configfile (@{$opt{lm}}) {
$configfile = Slic3r::decode_path($configfile);
if (-e Slic3r::encode_path($configfile)) {
push @model_configs, Slic3r::Config->load($configfile);
} elsif (-e Slic3r::encode_path("$FindBin::Bin/$configfile")) {
printf STDERR "Loading $FindBin::Bin/$configfile\n";
push @model_configs, Slic3r::Config->load("$FindBin::Bin/$configfile");
} else {
$opt{ignore_nonexistent_config} or die "Cannot find specified configuration file ($configfile).\n";
}
}

# expand shortcuts before applying, otherwise destination values would be already filled with defaults
$_->normalize for @model_configs;
}

# process command line options
my $cli_config = Slic3r::Config->new_from_cli(%cli_options);
$cli_config->normalize; # expand shortcuts
Expand Down Expand Up @@ -240,6 +272,22 @@ BEGIN
my $model;
if ($opt{merge}) {
my @models = map Slic3r::Model->read_from_file($_), $input_file, (splice @ARGV, 0);
foreach my $i (0 .. $#models) {
foreach my $instance (@{$models[$i]->objects}) {
$instance->rotate(deg2rad($opt{rx}[$i] // 0), X);
$instance->rotate(deg2rad($opt{ry}[$i] // 0), Y);
$instance->rotate(deg2rad($opt{rz}[$i] // 0), Z);
my $sc = $opt{sc}[$i] // 1;
$instance->scale_xyz(Slic3r::Pointf3->new($opt{sx}[$i] // $sc, $opt{sy}[$i] // $sc, $opt{sz}[$i] // $sc));
$instance->translate($opt{tx}[$i] // 0, $opt{ty}[$i] // 0, $opt{tz}[$i] // 0);
if ($model_configs[$i]) {
my $config = Slic3r::Config->new_from_defaults;
$config->apply($model_configs[$i]);
$config->validate;
$instance->config()->apply($config);
}
}
}
$model = Slic3r::Model->merge(@models);
} else {
$model = Slic3r::Model->read_from_file($input_file);
Expand Down Expand Up @@ -267,6 +315,8 @@ BEGIN
duplicate_grid => $opt{duplicate_grid} // [1,1],
print_center => $opt{print_center},
dont_arrange => $opt{dont_arrange} // 0,
travel_height => $opt{travel_height},
disable_loop_clipping => $opt{disable_loop_clipping},
status_cb => sub {
my ($percent, $message) = @_;
printf "=> %s\n", $message;
Expand Down Expand Up @@ -475,6 +525,7 @@ sub usage {
--infill-only-where-needed
Only infill under ceilings (default: no)
--infill-first Make infill before perimeters (default: no)
--disable-loop-clipping Clip ends of loops to avoid overlapping extrusion (default: no)

Quality options (slower slicing):
--extra-perimeters Add more perimeters when needed (default: yes)
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ target_compile_features(libslic3r PUBLIC cxx_std_11)
target_include_directories(libslic3r SYSTEM PUBLIC ${SLIC3R_INCLUDES})
target_include_directories(libslic3r PUBLIC ${LIBSLIC3R_INCLUDES})
if (BOOST_NOWIDE_FOUND)
target_compile_options(libslic3r -DBOOST_INCLUDE_NOWIDE)
target_compile_definitions(libslic3r PUBLIC BOOST_INCLUDE_NOWIDE=1 BOOST_NOWIDE_FOUND=1)
endif()

if(NOT(${Boost_VERSION_STRING} VERSION_LESS "1.74.0"))
target_compile_definitions(libslic3r PUBLIC BOOST_BIND_GLOBAL_PLACEHOLDERS=1)
endif()

add_library(BSpline STATIC
Expand Down
16 changes: 10 additions & 6 deletions src/slic3r.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <boost/asio/socket_base.hpp> // include winsock2.h first

#include "slic3r.hpp"
#include "GCodeSender.hpp"
#include "Geometry.hpp"
Expand All @@ -8,19 +10,21 @@
#include "SimplePrint.hpp"
#include "TriangleMesh.hpp"
#include "libslic3r.h"
#include <cmath>

#include <boost/filesystem.hpp>
#include <boost/nowide/args.hpp>
#include <boost/nowide/iostream.hpp>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <boost/filesystem.hpp>
#include <boost/nowide/args.hpp>
#include <boost/nowide/iostream.hpp>
#include <stdexcept>
#include <sstream>
#include <stdexcept>
#include <string>
#include <string>

#ifdef USE_WX
Expand Down
1 change: 1 addition & 0 deletions src/test/libslic3r/test_trianglemesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <algorithm>
#include <future>
#include <chrono>
#include <array>

using namespace Slic3r;
using namespace std;
Expand Down
Loading