diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 113d8ce7..ae191212 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -335,7 +335,7 @@ sub validate { die "Can't make less than one perimeter when spiral vase mode is enabled\n" if $self->perimeters < 1; - die "Spiral vase mode is not compatible with non-zero fill density\n" + die "Spiral vase mode can only print hollow objects, so you need to set Fill density to 0\n" if $self->fill_density > 0; die "Spiral vase mode is not compatible with top solid layers\n" @@ -343,11 +343,6 @@ sub validate { die "Spiral vase mode is not compatible with support material\n" if $self->support_material || $self->support_material_enforce_layers > 0; - - # This should be enforce automatically only on spiral layers and - # done on the others - die "Spiral vase mode is not compatible with retraction on layer change\n" - if defined first { $_ } @{ $self->retract_layer_change }; } # extrusion widths diff --git a/xs/src/Config.cpp b/xs/src/Config.cpp index 27986210..4d03b36a 100644 --- a/xs/src/Config.cpp +++ b/xs/src/Config.cpp @@ -320,6 +320,15 @@ DynamicConfig::option(const t_config_option_key opt_key, bool create) { return this->options[opt_key]; } +template +T* +DynamicConfig::opt(const t_config_option_key opt_key, bool create) { + return dynamic_cast(this->option(opt_key, create)); +} +template ConfigOptionInt* DynamicConfig::opt(const t_config_option_key opt_key, bool create); +template ConfigOptionBool* DynamicConfig::opt(const t_config_option_key opt_key, bool create); +template ConfigOptionBools* DynamicConfig::opt(const t_config_option_key opt_key, bool create); + const ConfigOption* DynamicConfig::option(const t_config_option_key opt_key) const { return const_cast(this)->option(opt_key, false); diff --git a/xs/src/Config.hpp b/xs/src/Config.hpp index fe521746..df678131 100644 --- a/xs/src/Config.hpp +++ b/xs/src/Config.hpp @@ -491,6 +491,7 @@ class DynamicConfig : public ConfigBase DynamicConfig& operator= (DynamicConfig other); void swap(DynamicConfig &other); ~DynamicConfig(); + template T* opt(const t_config_option_key opt_key, bool create = false); ConfigOption* option(const t_config_option_key opt_key, bool create = false); const ConfigOption* option(const t_config_option_key opt_key) const; void keys(t_config_option_keys *keys) const; diff --git a/xs/src/PrintConfig.hpp b/xs/src/PrintConfig.hpp index cd31d899..0aef25c0 100644 --- a/xs/src/PrintConfig.hpp +++ b/xs/src/PrintConfig.hpp @@ -985,6 +985,13 @@ class DynamicPrintConfig : public DynamicConfig if (!this->has("support_material_interface_extruder")) this->option("support_material_interface_extruder", true)->setInt(extruder); } + if (this->has("spiral_vase") && this->opt("spiral_vase", true)->value) { + { + // this should be actually done only on the spiral layers instead of all + ConfigOptionBools* opt = this->opt("retract_layer_change", true); + opt->values.assign(opt->values.size(), false); // set all values to false + } + } }; }; diff --git a/xs/t/15_config.t b/xs/t/15_config.t index 28267008..9541f431 100644 --- a/xs/t/15_config.t +++ b/xs/t/15_config.t @@ -4,7 +4,7 @@ use strict; use warnings; use Slic3r::XS; -use Test::More tests => 114; +use Test::More tests => 115; foreach my $config (Slic3r::Config->new, Slic3r::Config::Full->new) { $config->set('layer_height', 0.3); @@ -176,4 +176,12 @@ foreach my $config (Slic3r::Config->new, Slic3r::Config::Full->new) { is $config->get('perimeter_extruder'), 3, 'defined extruder is not overwritten by default extruder'; } +{ + my $config = Slic3r::Config->new; + $config->set('spiral_vase', 1); + $config->set('retract_layer_change', [1,0]); + $config->normalize; + is_deeply $config->get('retract_layer_change'), [0,0], 'retract_layer_change is disabled with spiral_vase'; +} + __END__