From d7141abcb4d161857115f9b7614fe9223b808f7d Mon Sep 17 00:00:00 2001 From: supermerill Date: Thu, 14 Feb 2019 11:00:03 +0100 Subject: [PATCH] vase mode fix: * if the object is hollow and has only thin walls loops, the orientation must be enforced on gcode.cpp * add extra_perimeters as unwanted setting for spiral vase. * add dense infill as unwanted setting for spiral vase. --- src/libslic3r/GCode.cpp | 7 +++++-- src/libslic3r/PrintConfig.cpp | 10 ++++++++-- src/slic3r/GUI/Tab.cpp | 8 +++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index e843d34c9..461eaa3b1 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1323,7 +1323,7 @@ void GCode::process_layer( m_spiral_vase->enable = enable; } // If we're going to apply spiralvase to this layer, disable loop clipping - m_enable_loop_clipping = ! m_spiral_vase || ! m_spiral_vase->enable; + m_enable_loop_clipping = !m_spiral_vase || !m_spiral_vase->enable; std::string gcode; @@ -2021,6 +2021,10 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou // extrude all loops ccw //no! this was decided in perimeter_generator bool was_clockwise = false;// loop.make_counter_clockwise(); + //if spiral vase, we have to ensure that all loops are in the same orientation. + if (this->m_config.spiral_vase) { + was_clockwise = loop.make_counter_clockwise(); + } SeamPosition seam_position = m_config.seam_position; if (loop.loop_role() == elrSkirt) @@ -2088,7 +2092,6 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou } //TODO: ignore the angle penalty if the new point is not in an external path (bot/top/ext_peri) for (size_t i = 0; i < polygon.points.size(); ++i) { - //std::cout << "check point @" << unscale(polygon.points[i].x) << ":" << unscale(polygon.points[i].y); float ccwAngle = penalties[i]; if (was_clockwise) ccwAngle = - ccwAngle; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index d010b381f..58e6af401 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3231,8 +3231,10 @@ void DynamicPrintConfig::normalize() this->opt("fill_density", true)->value = 0; this->opt("support_material", true)->value = false; this->opt("support_material_enforce_layers")->value = 0; - this->opt("exact_last_layer_height", true)->value = false; - this->opt("ensure_vertical_shell_thickness", true)->value = false; + this->opt("exact_last_layer_height", true)->value = false; + this->opt("ensure_vertical_shell_thickness", true)->value = false; + this->opt("infill_dense", true)->value = false; + this->opt("extra_perimeters", true)->value = false; } } } @@ -3390,6 +3392,10 @@ std::string FullPrintConfig::validate() return "Spiral vase mode is not compatible with top solid layers"; if (this->support_material || this->support_material_enforce_layers > 0) return "Spiral vase mode is not compatible with support material"; + if (this->infill_dense) + return "Spiral vase mode can only print hollow objects and have no top surface, so you don't need any dense infill"; + if (this->extra_perimeters) + return "Can't make more than one perimeter when spiral vase mode is enabled"; } // extrusion widths diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 01d3630ba..0578a76ea 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1228,6 +1228,8 @@ void TabPrint::update() && m_config->opt_int("support_material_enforce_layers") == 0 && m_config->opt_bool("exact_last_layer_height") == false && m_config->opt_bool("ensure_vertical_shell_thickness") == false + && m_config->opt_bool("infill_dense") == false + && m_config->opt_bool("extra_perimeters") == false )) { wxString msg_text = _(L("The Spiral Vase mode requires:\n" "- one perimeter\n" @@ -1236,6 +1238,8 @@ void TabPrint::update() "- no support material\n" "- no ensure_vertical_shell_thickness\n" "- unchecked 'exact last layer height'\n" + "- unchecked 'dense infill'\n" + "- unchecked 'extra perimeters'\n" "\nShall I adjust those settings in order to enable Spiral Vase?")); auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Spiral Vase")), wxICON_WARNING | wxYES | wxNO); is_msg_dlg_already_exist = true; @@ -1247,7 +1251,9 @@ void TabPrint::update() new_conf.set_key_value("support_material", new ConfigOptionBool(false)); new_conf.set_key_value("support_material_enforce_layers", new ConfigOptionInt(0)); new_conf.set_key_value("exact_last_layer_height", new ConfigOptionBool(false)); - new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionBool(false)); + new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionBool(false)); + new_conf.set_key_value("infill_dense", new ConfigOptionBool(false)); + new_conf.set_key_value("extra_perimeters", new ConfigOptionBool(false)); fill_density = 0; } else {