Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2015-03-06 11:56:58 +0300
committerAlessandro Ranellucci <aar@cpan.org>2015-03-06 11:56:58 +0300
commit722e94513c50b26996d9fb8ebda0b607b8f92232 (patch)
tree29a3505cc5c4278221cc3489d2d9356bfcf4c1d4
parenta3b843b24e4426c18ab9179d26e543a83071be24 (diff)
Refactoring: removed the non-idempotent init_extruders() step. Also, infill_extruder was not limited to the available number of extruders when slicing from the plater, and support material extruder was considered also when support material was disabled
-rw-r--r--lib/Slic3r/GUI/MainFrame.pm2
-rw-r--r--lib/Slic3r/GUI/Plater/2DToolpaths.pm2
-rw-r--r--lib/Slic3r/Print.pm16
-rw-r--r--lib/Slic3r/Print/GCode.pm6
-rw-r--r--lib/Slic3r/Print/Object.pm2
-rw-r--r--lib/Slic3r/Print/State.pm2
-rw-r--r--t/combineinfill.t1
-rw-r--r--t/fill.t1
-rw-r--r--t/perimeters.t1
-rw-r--r--t/support.t1
-rw-r--r--xs/src/libslic3r/Print.cpp48
-rw-r--r--xs/src/libslic3r/Print.hpp6
-rw-r--r--xs/src/libslic3r/PrintConfig.cpp34
-rw-r--r--xs/src/libslic3r/PrintConfig.hpp33
-rw-r--r--xs/src/libslic3r/PrintObject.cpp8
-rw-r--r--xs/xsp/Print.xsp4
16 files changed, 83 insertions, 84 deletions
diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm
index 81031c5ad..f3bc6a238 100644
--- a/lib/Slic3r/GUI/MainFrame.pm
+++ b/lib/Slic3r/GUI/MainFrame.pm
@@ -670,7 +670,7 @@ sub config {
} else {
my $extruders_count = $self->{options_tabs}{printer}{extruders_count};
$config->set("${_}_extruder", min($config->get("${_}_extruder"), $extruders_count))
- for qw(perimeter infill support_material support_material_interface);
+ for qw(perimeter infill solid_infill support_material support_material_interface);
}
return $config;
diff --git a/lib/Slic3r/GUI/Plater/2DToolpaths.pm b/lib/Slic3r/GUI/Plater/2DToolpaths.pm
index 3e6f09b27..8ab289855 100644
--- a/lib/Slic3r/GUI/Plater/2DToolpaths.pm
+++ b/lib/Slic3r/GUI/Plater/2DToolpaths.pm
@@ -291,7 +291,7 @@ sub Render {
$brim_drawn = 1;
}
if ($self->print->step_done(STEP_SKIRT)
- && ($self->print->config->skirt_height == -1 || $self->print->config->skirt_height > $layer->id)
+ && ($self->print->has_infinite_skirt() || $self->print->config->skirt_height > $layer->id)
&& !$skirt_drawn) {
$self->color([0, 0, 0]);
$self->_draw(undef, $print_z, $_) for @{$self->print->skirt};
diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm
index cd03fc265..2837e0db7 100644
--- a/lib/Slic3r/Print.pm
+++ b/lib/Slic3r/Print.pm
@@ -102,9 +102,6 @@ sub export_svg {
my $self = shift;
my %params = @_;
- # is this needed?
- $self->init_extruders;
-
$_->slice for @{$self->objects};
my $fh = $params{output_fh};
@@ -209,8 +206,7 @@ sub make_skirt {
# checking whether we need to generate them
$self->skirt->clear;
- if (($self->config->skirts == 0 || $self->config->skirt_height == 0)
- && (!$self->config->ooze_prevention || @{$self->extruders} == 1)) {
+ if (!$self->has_skirt) {
$self->set_step_done(STEP_SKIRT);
return;
}
@@ -220,7 +216,7 @@ sub make_skirt {
# The skirt_height option from config is expressed in layers, but our
# object might have different layer heights, so we need to find the print_z
# of the highest layer involved.
- # Note that unless skirt_height == -1 (which means it's printed on all layers)
+ # Note that unless has_infinite_skirt() == true
# the actual skirt might not reach this $skirt_height_z value since the print
# order of objects on each layer is not guaranteed and will not generally
# include the thickest object first. It is just guaranteed that a skirt is
@@ -228,10 +224,9 @@ sub make_skirt {
# $skirt_height_z in this case is the highest possible skirt height for safety.
my $skirt_height_z = -1;
foreach my $object (@{$self->objects}) {
- my $skirt_height = ($self->config->skirt_height == -1 || $self->config->ooze_prevention)
+ my $skirt_height = $self->has_infinite_skirt
? scalar(@{$object->layers})
: min($self->config->skirt_height, scalar(@{$object->layers}));
-
my $highest_layer = $object->get_layer($skirt_height - 1);
$skirt_height_z = max($skirt_height_z, $highest_layer->print_z);
}
@@ -279,10 +274,13 @@ sub make_skirt {
my @extruders_e_per_mm = ();
my $extruder_idx = 0;
+ my $skirts = $self->config->skirts;
+ $skirts ||= 1 if $self->has_infinite_skirt;
+
# draw outlines from outside to inside
# loop while we have less skirts than required or any extruder hasn't reached the min length if any
my $distance = scale max($self->config->skirt_distance, $self->config->brim_width);
- for (my $i = $self->config->skirts; $i > 0; $i--) {
+ for (my $i = $skirts; $i > 0; $i--) {
$distance += scale $spacing;
my $loop = offset([$convex_hull], $distance, 1, JT_ROUND, scale(0.1))->[0];
$self->skirt->append(Slic3r::ExtrusionLoop->new_from_paths(
diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm
index bdc928685..e9901b192 100644
--- a/lib/Slic3r/Print/GCode.pm
+++ b/lib/Slic3r/Print/GCode.pm
@@ -298,7 +298,7 @@ sub process_layer {
if (defined $self->_spiral_vase) {
$self->_spiral_vase->enable(
($layer->id > 0 || $self->print->config->brim_width == 0)
- && ($layer->id >= $self->print->config->skirt_height && $self->print->config->skirt_height != -1)
+ && ($layer->id >= $self->print->config->skirt_height && !$self->print->has_infinite_skirt)
&& !defined(first { $_->config->bottom_solid_layers > $layer->id } @{$layer->regions})
&& !defined(first { @{$_->perimeters} > 1 } @{$layer->regions})
&& !defined(first { @{$_->fills} > 0 } @{$layer->regions})
@@ -331,7 +331,7 @@ sub process_layer {
}) . "\n" if $self->print->config->layer_gcode;
# extrude skirt
- if (((values %{$self->_skirt_done}) < $self->print->config->skirt_height || $self->print->config->skirt_height == -1)
+ if (((values %{$self->_skirt_done}) < $self->print->config->skirt_height || $self->print->has_infinite_skirt)
&& !$self->_skirt_done->{$layer->print_z}
&& !$layer->isa('Slic3r::Layer::Support')) {
$self->_gcodegen->set_origin(Slic3r::Pointf->new(0,0));
@@ -339,7 +339,7 @@ sub process_layer {
my @extruder_ids = map { $_->id } @{$self->_gcodegen->writer->extruders};
$gcode .= $self->_gcodegen->set_extruder($extruder_ids[0]);
# skip skirt if we have a large brim
- if ($layer->id < $self->print->config->skirt_height || $self->print->config->skirt_height == -1) {
+ if ($layer->id < $self->print->config->skirt_height || $self->print->has_infinite_skirt) {
my $skirt_flow = $self->print->skirt_flow;
# distribute skirt loops across all extruders
diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm
index 4921e79ff..aa24eedf3 100644
--- a/lib/Slic3r/Print/Object.pm
+++ b/lib/Slic3r/Print/Object.pm
@@ -344,7 +344,6 @@ sub make_perimeters {
my $self = shift;
# prerequisites
- $self->print->init_extruders;
$self->slice;
return if $self->step_done(STEP_PERIMETERS);
@@ -532,7 +531,6 @@ sub generate_support_material {
my $self = shift;
# prerequisites
- $self->print->init_extruders;
$self->slice;
return if $self->step_done(STEP_SUPPORTMATERIAL);
diff --git a/lib/Slic3r/Print/State.pm b/lib/Slic3r/Print/State.pm
index 437f66a70..7220aa818 100644
--- a/lib/Slic3r/Print/State.pm
+++ b/lib/Slic3r/Print/State.pm
@@ -4,7 +4,7 @@ use warnings;
require Exporter;
our @ISA = qw(Exporter);
-our @EXPORT_OK = qw(STEP_INIT_EXTRUDERS STEP_SLICE STEP_PERIMETERS STEP_PREPARE_INFILL
+our @EXPORT_OK = qw(STEP_SLICE STEP_PERIMETERS STEP_PREPARE_INFILL
STEP_INFILL STEP_SUPPORTMATERIAL STEP_SKIRT STEP_BRIM);
our %EXPORT_TAGS = (steps => \@EXPORT_OK);
diff --git a/t/combineinfill.t b/t/combineinfill.t
index 24cd2bb71..6661cdd6c 100644
--- a/t/combineinfill.t
+++ b/t/combineinfill.t
@@ -124,7 +124,6 @@ if (0) {
# copy of Print::export_gcode() up to the point
# after fill surfaces are combined
- $self->init_extruders;
$_->slice for @{$self->objects};
$_->make_perimeters for @{$self->objects};
$_->detect_surfaces_type for @{$self->objects};
diff --git a/t/fill.t b/t/fill.t
index 2a7a4521f..e43bdaadc 100644
--- a/t/fill.t
+++ b/t/fill.t
@@ -20,7 +20,6 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
{
my $print = Slic3r::Print->new;
- $print->init_extruders;
my $filler = Slic3r::Fill::Rectilinear->new(
print => $print,
bounding_box => Slic3r::Geometry::BoundingBox->new_from_points([ Slic3r::Point->new(0, 0), Slic3r::Point->new(10, 10) ]),
diff --git a/t/perimeters.t b/t/perimeters.t
index e2a5bc344..11cc0cbd4 100644
--- a/t/perimeters.t
+++ b/t/perimeters.t
@@ -172,7 +172,6 @@ use Slic3r::Test;
# we just need a pre-filled Print object
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
- $print->print->init_extruders;
# override a layer's slices
my $expolygon = Slic3r::ExPolygon->new([[-71974463,-139999376],[-71731792,-139987456],[-71706544,-139985616],[-71682119,-139982639],[-71441248,-139946912],[-71417487,-139942895],[-71379384,-139933984],[-71141800,-139874480],[-71105247,-139862895],[-70873544,-139779984],[-70838592,-139765856],[-70614943,-139660064],[-70581783,-139643567],[-70368368,-139515680],[-70323751,-139487872],[-70122160,-139338352],[-70082399,-139306639],[-69894800,-139136624],[-69878679,-139121327],[-69707992,-138933008],[-69668575,-138887343],[-69518775,-138685359],[-69484336,-138631632],[-69356423,-138418207],[-69250040,-138193296],[-69220920,-138128976],[-69137992,-137897168],[-69126095,-137860255],[-69066568,-137622608],[-69057104,-137582511],[-69053079,-137558751],[-69017352,-137317872],[-69014392,-137293456],[-69012543,-137268207],[-68999369,-137000000],[-63999999,-137000000],[-63705947,-136985551],[-63654984,-136977984],[-63414731,-136942351],[-63364756,-136929840],[-63129151,-136870815],[-62851950,-136771631],[-62585807,-136645743],[-62377483,-136520895],[-62333291,-136494415],[-62291908,-136463728],[-62096819,-136319023],[-62058644,-136284432],[-61878676,-136121328],[-61680968,-135903184],[-61650275,-135861807],[-61505591,-135666719],[-61354239,-135414191],[-61332211,-135367615],[-61228359,-135148063],[-61129179,-134870847],[-61057639,-134585262],[-61014451,-134294047],[-61000000,-134000000],[-61000000,-107999999],[-61014451,-107705944],[-61057639,-107414736],[-61129179,-107129152],[-61228359,-106851953],[-61354239,-106585808],[-61505591,-106333288],[-61680967,-106096816],[-61878675,-105878680],[-62096820,-105680967],[-62138204,-105650279],[-62333292,-105505591],[-62585808,-105354239],[-62632384,-105332207],[-62851951,-105228360],[-62900463,-105211008],[-63129152,-105129183],[-63414731,-105057640],[-63705947,-105014448],[-63999999,-105000000],[-68999369,-105000000],[-69012543,-104731792],[-69014392,-104706544],[-69017352,-104682119],[-69053079,-104441248],[-69057104,-104417487],[-69066008,-104379383],[-69125528,-104141799],[-69137111,-104105248],[-69220007,-103873544],[-69234136,-103838591],[-69339920,-103614943],[-69356415,-103581784],[-69484328,-103368367],[-69512143,-103323752],[-69661647,-103122160],[-69693352,-103082399],[-69863383,-102894800],[-69878680,-102878679],[-70066999,-102707992],[-70112656,-102668576],[-70314648,-102518775],[-70368367,-102484336],[-70581783,-102356424],[-70806711,-102250040],[-70871040,-102220919],[-71102823,-102137992],[-71139752,-102126095],[-71377383,-102066568],[-71417487,-102057104],[-71441248,-102053079],[-71682119,-102017352],[-71706535,-102014392],[-71731784,-102012543],[-71974456,-102000624],[-71999999,-102000000],[-104000000,-102000000],[-104025536,-102000624],[-104268207,-102012543],[-104293455,-102014392],[-104317880,-102017352],[-104558751,-102053079],[-104582512,-102057104],[-104620616,-102066008],[-104858200,-102125528],[-104894751,-102137111],[-105126455,-102220007],[-105161408,-102234136],[-105385056,-102339920],[-105418215,-102356415],[-105631632,-102484328],[-105676247,-102512143],[-105877839,-102661647],[-105917600,-102693352],[-106105199,-102863383],[-106121320,-102878680],[-106292007,-103066999],[-106331424,-103112656],[-106481224,-103314648],[-106515663,-103368367],[-106643575,-103581783],[-106749959,-103806711],[-106779080,-103871040],[-106862007,-104102823],[-106873904,-104139752],[-106933431,-104377383],[-106942896,-104417487],[-106946920,-104441248],[-106982648,-104682119],[-106985607,-104706535],[-106987456,-104731784],[-107000630,-105000000],[-112000000,-105000000],[-112294056,-105014448],[-112585264,-105057640],[-112870848,-105129184],[-112919359,-105146535],[-113148048,-105228360],[-113194624,-105250392],[-113414191,-105354239],[-113666711,-105505591],[-113708095,-105536279],[-113903183,-105680967],[-114121320,-105878679],[-114319032,-106096816],[-114349720,-106138200],[-114494408,-106333288],[-114645760,-106585808],[-114667792,-106632384],[-114771640,-106851952],[-114788991,-106900463],[-114870815,-107129151],[-114942359,-107414735],[-114985551,-107705943],[-115000000,-107999999],[-115000000,-134000000],[-114985551,-134294048],[-114942359,-134585263],[-114870816,-134870847],[-114853464,-134919359],[-114771639,-135148064],[-114645759,-135414192],[-114494407,-135666720],[-114319031,-135903184],[-114121320,-136121327],[-114083144,-136155919],[-113903184,-136319023],[-113861799,-136349712],[-113666711,-136494416],[-113458383,-136619264],[-113414192,-136645743],[-113148049,-136771631],[-112870848,-136870815],[-112820872,-136883327],[-112585264,-136942351],[-112534303,-136949920],[-112294056,-136985551],[-112000000,-137000000],[-107000630,-137000000],[-106987456,-137268207],[-106985608,-137293440],[-106982647,-137317872],[-106946920,-137558751],[-106942896,-137582511],[-106933991,-137620624],[-106874471,-137858208],[-106862888,-137894751],[-106779992,-138126463],[-106765863,-138161424],[-106660080,-138385055],[-106643584,-138418223],[-106515671,-138631648],[-106487855,-138676256],[-106338352,-138877839],[-106306647,-138917600],[-106136616,-139105199],[-106121320,-139121328],[-105933000,-139291999],[-105887344,-139331407],[-105685351,-139481232],[-105631632,-139515663],[-105418216,-139643567],[-105193288,-139749951],[-105128959,-139779072],[-104897175,-139862016],[-104860247,-139873904],[-104622616,-139933423],[-104582511,-139942896],[-104558751,-139946912],[-104317880,-139982656],[-104293463,-139985616],[-104268216,-139987456],[-104025544,-139999376],[-104000000,-140000000],[-71999999,-140000000]],[[-105000000,-138000000],[-105000000,-104000000],[-71000000,-104000000],[-71000000,-138000000]],[[-69000000,-132000000],[-69000000,-110000000],[-64991180,-110000000],[-64991180,-132000000]],[[-111008824,-132000000],[-111008824,-110000000],[-107000000,-110000000],[-107000000,-132000000]]);
diff --git a/t/support.t b/t/support.t
index 9cc38b2b1..5ecf27b0c 100644
--- a/t/support.t
+++ b/t/support.t
@@ -20,7 +20,6 @@ use Slic3r::Test;
my $test = sub {
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
- $print->print->init_extruders;
my $flow = $print->print->objects->[0]->support_material_flow;
my $support = Slic3r::Print::SupportMaterial->new(
object_config => $print->print->objects->[0]->config,
diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp
index 1944f22d3..2128095fa 100644
--- a/xs/src/libslic3r/Print.cpp
+++ b/xs/src/libslic3r/Print.cpp
@@ -166,13 +166,14 @@ Print::invalidate_state_by_config_options(const std::vector<t_config_option_key>
if (*opt_key == "skirts"
|| *opt_key == "skirt_height"
|| *opt_key == "skirt_distance"
- || *opt_key == "min_skirt_length") {
+ || *opt_key == "min_skirt_length"
+ || *opt_key == "ooze_prevention") {
steps.insert(psSkirt);
} else if (*opt_key == "brim_width") {
steps.insert(psBrim);
steps.insert(psSkirt);
} else if (*opt_key == "nozzle_diameter") {
- steps.insert(psInitExtruders);
+ osteps.insert(posSlice);
} else if (*opt_key == "avoid_crossing_perimeters"
|| *opt_key == "bed_shape"
|| *opt_key == "bed_temperature"
@@ -266,11 +267,6 @@ Print::invalidate_step(PrintStep step)
// propagate to dependent steps
if (step == psSkirt) {
this->invalidate_step(psBrim);
- } else if (step == psInitExtruders) {
- FOREACH_OBJECT(this, object) {
- (*object)->invalidate_step(posPerimeters);
- (*object)->invalidate_step(posSupportMaterial);
- }
}
return invalidated;
@@ -314,8 +310,10 @@ Print::extruders() const
extruders.insert((*region)->config.solid_infill_extruder - 1);
}
FOREACH_OBJECT(this, object) {
- extruders.insert((*object)->config.support_material_extruder - 1);
- extruders.insert((*object)->config.support_material_interface_extruder - 1);
+ if ((*object)->has_support_material()) {
+ extruders.insert((*object)->config.support_material_extruder - 1);
+ extruders.insert((*object)->config.support_material_interface_extruder - 1);
+ }
}
return extruders;
@@ -534,20 +532,16 @@ Print::apply_config(DynamicPrintConfig config)
return invalidated;
}
-void
-Print::init_extruders()
+bool Print::has_infinite_skirt() const
{
- if (this->state.is_done(psInitExtruders)) return;
- this->state.set_done(psInitExtruders);
-
- // enforce tall skirt if using ooze_prevention
- // FIXME: this is not idempotent (i.e. switching ooze_prevention off will not revert skirt settings)
- if (this->config.ooze_prevention && this->extruders().size() > 1) {
- this->config.skirt_height.value = -1;
- if (this->config.skirts == 0) this->config.skirts.value = 1;
- }
-
- this->state.set_done(psInitExtruders);
+ return (this->config.skirt_height == -1 && this->config.skirts > 0)
+ || (this->config.ooze_prevention && this->extruders().size() > 1);
+}
+
+bool Print::has_skirt() const
+{
+ return (this->config.skirt_height > 0 && this->config.skirts > 0)
+ || this->has_infinite_skirt();
}
void
@@ -682,13 +676,15 @@ Print::total_bounding_box() const
Flow brim_flow = this->brim_flow();
extra = std::max(extra, this->config.brim_width.value + brim_flow.width/2);
}
- if (this->config.skirts.value > 0) {
+ if (this->has_skirt()) {
+ int skirts = this->config.skirts.value;
+ if (skirts == 0 && this->has_infinite_skirt()) skirts = 1;
Flow skirt_flow = this->skirt_flow();
extra = std::max(
extra,
this->config.brim_width.value
+ this->config.skirt_distance.value
- + this->config.skirts.value * skirt_flow.spacing()
+ + skirts * skirt_flow.spacing()
+ skirt_flow.width/2
);
}
@@ -773,9 +769,7 @@ bool
Print::has_support_material() const
{
FOREACH_OBJECT(this, object) {
- PrintObjectConfig &config = (*object)->config;
- if (config.support_material || config.raft_layers > 0 || config.support_material_enforce_layers > 0)
- return true;
+ if ((*object)->has_support_material()) return true;
}
return false;
}
diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp
index ff93c0704..53c28833b 100644
--- a/xs/src/libslic3r/Print.hpp
+++ b/xs/src/libslic3r/Print.hpp
@@ -22,7 +22,7 @@ class ModelObject;
enum PrintStep {
- psInitExtruders, psSkirt, psBrim,
+ psSkirt, psBrim,
};
enum PrintObjectStep {
posSlice, posPerimeters, posPrepareInfill,
@@ -134,6 +134,7 @@ class PrintObject
bool invalidate_step(PrintObjectStep step);
bool invalidate_all_steps();
+ bool has_support_material() const;
void bridge_over_infill();
private:
@@ -188,7 +189,8 @@ class Print
void add_model_object(ModelObject* model_object, int idx = -1);
bool apply_config(DynamicPrintConfig config);
- void init_extruders();
+ bool has_infinite_skirt() const;
+ bool has_skirt() const;
void validate() const;
BoundingBox bounding_box() const;
BoundingBox total_bounding_box() const;
diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp
index da74dcdc5..b5c42ec0b 100644
--- a/xs/src/libslic3r/PrintConfig.cpp
+++ b/xs/src/libslic3r/PrintConfig.cpp
@@ -1011,6 +1011,40 @@ PrintConfigDef::build_def() {
t_optiondef_map PrintConfigDef::def = PrintConfigDef::build_def();
+void
+DynamicPrintConfig::normalize() {
+ if (this->has("extruder")) {
+ int extruder = this->option("extruder")->getInt();
+ this->erase("extruder");
+ if (extruder != 0) {
+ if (!this->has("infill_extruder"))
+ this->option("infill_extruder", true)->setInt(extruder);
+ if (!this->has("perimeter_extruder"))
+ this->option("perimeter_extruder", true)->setInt(extruder);
+ if (!this->has("support_material_extruder"))
+ this->option("support_material_extruder", true)->setInt(extruder);
+ if (!this->has("support_material_interface_extruder"))
+ this->option("support_material_interface_extruder", true)->setInt(extruder);
+ }
+ }
+
+ if (!this->has("solid_infill_extruder") && this->has("infill_extruder"))
+ this->option("solid_infill_extruder", true)->setInt(this->option("infill_extruder")->getInt());
+
+ if (this->has("spiral_vase") && this->opt<ConfigOptionBool>("spiral_vase", true)->value) {
+ {
+ // this should be actually done only on the spiral layers instead of all
+ ConfigOptionBools* opt = this->opt<ConfigOptionBools>("retract_layer_change", true);
+ opt->values.assign(opt->values.size(), false); // set all values to false
+ }
+ {
+ this->opt<ConfigOptionInt>("perimeters", true)->value = 1;
+ this->opt<ConfigOptionInt>("top_solid_layers", true)->value = 0;
+ this->opt<ConfigOptionPercent>("fill_density", true)->value = 0;
+ }
+ }
+}
+
#ifdef SLIC3RXS
REGISTER_CLASS(DynamicPrintConfig, "Config");
REGISTER_CLASS(PrintObjectConfig, "Config::PrintObject");
diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp
index 869ae5caa..14c3fc79f 100644
--- a/xs/src/libslic3r/PrintConfig.hpp
+++ b/xs/src/libslic3r/PrintConfig.hpp
@@ -79,38 +79,7 @@ class DynamicPrintConfig : public DynamicConfig
this->def = &PrintConfigDef::def;
};
- void normalize() {
- if (this->has("extruder")) {
- int extruder = this->option("extruder")->getInt();
- this->erase("extruder");
- if (extruder != 0) {
- if (!this->has("infill_extruder"))
- this->option("infill_extruder", true)->setInt(extruder);
- if (!this->has("perimeter_extruder"))
- this->option("perimeter_extruder", true)->setInt(extruder);
- if (!this->has("support_material_extruder"))
- this->option("support_material_extruder", true)->setInt(extruder);
- if (!this->has("support_material_interface_extruder"))
- this->option("support_material_interface_extruder", true)->setInt(extruder);
- }
- }
-
- if (!this->has("solid_infill_extruder") && this->has("infill_extruder"))
- this->option("solid_infill_extruder", true)->setInt(this->option("infill_extruder")->getInt());
-
- if (this->has("spiral_vase") && this->opt<ConfigOptionBool>("spiral_vase", true)->value) {
- {
- // this should be actually done only on the spiral layers instead of all
- ConfigOptionBools* opt = this->opt<ConfigOptionBools>("retract_layer_change", true);
- opt->values.assign(opt->values.size(), false); // set all values to false
- }
- {
- this->opt<ConfigOptionInt>("perimeters", true)->value = 1;
- this->opt<ConfigOptionInt>("top_solid_layers", true)->value = 0;
- this->opt<ConfigOptionPercent>("fill_density", true)->value = 0;
- }
- }
- };
+ void normalize();
};
class StaticPrintConfig : public virtual StaticConfig
diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp
index fdf3116b7..071247072 100644
--- a/xs/src/libslic3r/PrintObject.cpp
+++ b/xs/src/libslic3r/PrintObject.cpp
@@ -333,6 +333,14 @@ PrintObject::invalidate_all_steps()
return invalidated;
}
+bool
+PrintObject::has_support_material() const
+{
+ return this->config.support_material
+ || this->config.raft_layers > 0
+ || this->config.support_material_enforce_layers > 0;
+}
+
void
PrintObject::bridge_over_infill()
{
diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp
index ad240d282..e1329c449 100644
--- a/xs/xsp/Print.xsp
+++ b/xs/xsp/Print.xsp
@@ -12,7 +12,6 @@
IV
_constant()
ALIAS:
- STEP_INIT_EXTRUDERS = psInitExtruders
STEP_SLICE = posSlice
STEP_PERIMETERS = posPerimeters
STEP_PREPARE_INFILL = posPrepareInfill
@@ -177,7 +176,8 @@ _constant()
void add_model_object(ModelObject* model_object, int idx = -1);
bool apply_config(DynamicPrintConfig* config)
%code%{ RETVAL = THIS->apply_config(*config); %};
- void init_extruders();
+ bool has_infinite_skirt();
+ bool has_skirt();
void validate()
%code%{
try {