From 72f348658ff8e00e055559eea9971422820a9d4b Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 6 Jun 2017 10:36:14 +0200 Subject: [PATCH] Testing for the required parameter combinations before enabling the wipe tower. The wipe tower needs to be made more general in the future to overcome these limitations. --- lib/Slic3r/GUI/Tab.pm | 42 ++++++++++++++++++++++++++++++++++---- xs/src/libslic3r/Print.cpp | 10 +++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index 0749e3fca..35a7f6682 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -841,19 +841,53 @@ sub _update { . "- no ensure_vertical_shell_thickness\n" . "\nShall I adjust those settings in order to enable Spiral Vase?", 'Spiral Vase', wxICON_WARNING | wxYES | wxNO); + my $new_conf = Slic3r::Config->new; if ($dialog->ShowModal() == wxID_YES) { - my $new_conf = Slic3r::Config->new; $new_conf->set("perimeters", 1); $new_conf->set("top_solid_layers", 0); $new_conf->set("fill_density", 0); $new_conf->set("support_material", 0); $new_conf->set("ensure_vertical_shell_thickness", 0); - $self->load_config($new_conf); } else { - my $new_conf = Slic3r::Config->new; $new_conf->set("spiral_vase", 0); - $self->load_config($new_conf); } + $self->load_config($new_conf); + } + + if ($config->wipe_tower && + ($config->first_layer_height != 0.2 || ($config->layer_height != 0.15 && $config->layer_height != 0.2))) { + my $dialog = Wx::MessageDialog->new($self, + "The Wipe Tower currently supports only:\n" + . "- first layer height 0.2mm\n" + . "- layer height 0.15mm or 0.2mm\n" + . "\nShall I adjust those settings in order to enable the Wipe Tower?", + 'Wipe Tower', wxICON_WARNING | wxYES | wxNO); + my $new_conf = Slic3r::Config->new; + if ($dialog->ShowModal() == wxID_YES) { + $new_conf->set("first_layer_height", 0.2); + $new_conf->set("layer_height", 0.15) if $config->layer_height != 0.15 && $config->layer_height != 0.2; + } else { + $new_conf->set("wipe_tower", 0); + } + $self->load_config($new_conf); + } + + if ($config->wipe_tower && $config->support_material && $config->support_material_contact_distance > 0. && + ($config->support_material_extruder != 0 || $config->support_material_interface_extruder != 0)) { + my $dialog = Wx::MessageDialog->new($self, + "The Wipe Tower currently supports the non-soluble supports only\n" + . "if they are printed with the current extruder without triggering a tool change.\n" + . "(both support_material_extruder and support_material_interface_extruder need to be set to 0).\n" + . "\nShall I adjust those settings in order to enable the Wipe Tower?", + 'Wipe Tower', wxICON_WARNING | wxYES | wxNO); + my $new_conf = Slic3r::Config->new; + if ($dialog->ShowModal() == wxID_YES) { + $new_conf->set("support_material_extruder", 0); + $new_conf->set("support_material_interface_extruder", 0); + } else { + $new_conf->set("wipe_tower", 0); + } + $self->load_config($new_conf); } if ($keys_modified->{'layer_height'}) { diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 6c13513c0..81718d7bb 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -564,6 +564,16 @@ std::string Print::validate() const if (this->regions.size() > 1) return "The Spiral Vase option can only be used when printing single material objects."; } + + if (this->config.wipe_tower) { + for (auto dmr : this->config.nozzle_diameter.values) + if (std::abs(dmr - 0.4) > EPSILON) + return "The Wipe Tower is currently only supported for the 0.4mm nozzle diameter."; + if (this->config.gcode_flavor != gcfRepRap) + return "The Wipe Tower is currently only supported for the RepRap (Marlin / Sprinter) G-code flavor."; + if (! this->config.use_relative_e_distances) + return "The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1)."; + } { // find the smallest nozzle diameter