From ed71f2ccd72f1ad864ec3c6c7a5e18ac9d6aa6bf Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 29 Jan 2019 16:11:53 +0100 Subject: [PATCH 1/5] Fix of #1713 --- src/slic3r/GUI/GLCanvas3D.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 5828c0e89..128a21966 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3250,6 +3250,7 @@ bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection) if (!m_enabled || selection.is_empty()) return false; + EType old_current = m_current; bool handled = false; for (GizmosMap::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) { @@ -3273,7 +3274,12 @@ bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection) handled = true; } } - else + } + + if (handled && (old_current != Undefined) && (old_current != m_current)) + { + GizmosMap::const_iterator it = m_gizmos.find(old_current); + if (it != m_gizmos.end()) it->second->set_state(GLGizmoBase::Off); } From a99c82340100847e56fa712f4a60c927ce4a3500 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 29 Jan 2019 15:48:30 +0100 Subject: [PATCH 2/5] Build: MSVC 2017 compat (w/o xs code - Perl unit tests) --- deps/deps-windows.cmake | 23 ++++++++++++++++++----- src/avrdude/windows/unistd.h | 2 ++ src/libslic3r/Int128.hpp | 5 +++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/deps/deps-windows.cmake b/deps/deps-windows.cmake index 44a1843bb..7276277e6 100644 --- a/deps/deps-windows.cmake +++ b/deps/deps-windows.cmake @@ -1,8 +1,21 @@ +if (MSVC_VERSION EQUAL 1800) + set(DEP_VS_VER "12") + set(DEP_BOOST_TOOLSET "msvc-12.0") +elseif (MSVC_VERSION EQUAL 1900) + set(DEP_VS_VER "14") + set(DEP_BOOST_TOOLSET "msvc-14.0") +elseif (MSVC_VERSION GREATER 1900) + set(DEP_VS_VER "15") + set(DEP_BOOST_TOOLSET "msvc-14.1") +else () + message(FATAL_ERROR "Unsupported MSVC version") +endif () + if (${DEPS_BITS} EQUAL 32) - set(DEP_MSVC_GEN "Visual Studio 12") + set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}") else () - set(DEP_MSVC_GEN "Visual Studio 12 Win64") + set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER} Win64") endif () @@ -29,7 +42,7 @@ ExternalProject_Add(dep_boost --with-regex "--prefix=${DESTDIR}/usr/local" "address-model=${DEPS_BITS}" - toolset=msvc-12.0 + "toolset=${DEP_BOOST_TOOLSET}" link=static variant=release threading=multi @@ -204,7 +217,7 @@ ExternalProject_Add(dep_libcurl URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115 BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "" - BUILD_COMMAND cd winbuild && nmake /f Makefile.vc mode=static VC=12 GEN_PDB=yes DEBUG=no "MACHINE=${DEP_LIBCURL_TARGET}" + BUILD_COMMAND cd winbuild && nmake /f Makefile.vc mode=static "VC=${DEP_VS_VER}" GEN_PDB=yes DEBUG=no "MACHINE=${DEP_LIBCURL_TARGET}" INSTALL_COMMAND cd builds\\libcurl-*-release-*-winssl && "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include" && "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib" @@ -214,7 +227,7 @@ if (${DEP_DEBUG}) ExternalProject_Add_Step(dep_libcurl build_debug DEPENDEES build DEPENDERS install - COMMAND cd winbuild && nmake /f Makefile.vc mode=static VC=12 GEN_PDB=yes DEBUG=yes "MACHINE=${DEP_LIBCURL_TARGET}" + COMMAND cd winbuild && nmake /f Makefile.vc mode=static "VC=${DEP_VS_VER}" GEN_PDB=yes DEBUG=yes "MACHINE=${DEP_LIBCURL_TARGET}" WORKING_DIRECTORY "${SOURCE_DIR}" ) ExternalProject_Add_Step(dep_libcurl install_debug diff --git a/src/avrdude/windows/unistd.h b/src/avrdude/windows/unistd.h index b1bc6bf7f..95ba79a34 100644 --- a/src/avrdude/windows/unistd.h +++ b/src/avrdude/windows/unistd.h @@ -45,7 +45,9 @@ extern "C" { #define chdir _chdir #define isatty _isatty #define lseek _lseek +#if _MSC_VER < 1900 #define snprintf _snprintf +#endif #define strncasecmp _strnicmp #define strcasecmp _stricmp #define stat _stat diff --git a/src/libslic3r/Int128.hpp b/src/libslic3r/Int128.hpp index d54b75342..56dc5f461 100644 --- a/src/libslic3r/Int128.hpp +++ b/src/libslic3r/Int128.hpp @@ -53,6 +53,11 @@ #define HAS_INTRINSIC_128_TYPE #endif +#if defined(_MSC_VER) && defined(_WIN64) + #include + #pragma intrinsic(_mul128) +#endif + //------------------------------------------------------------------------------ // Int128 class (enables safe math on signed 64bit integers) // eg Int128 val1((int64_t)9223372036854775807); //ie 2^63 -1 From f7529dbef5cf60ab9f3a7e7e2737f28ad4247a76 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 29 Jan 2019 15:57:22 +0100 Subject: [PATCH 3/5] Tab: Update print host address and cafile properly, fix #1687 --- src/slic3r/GUI/Field.hpp | 4 +++- src/slic3r/GUI/Tab.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Field.hpp b/src/slic3r/GUI/Field.hpp index 3273f84c9..8391a111b 100644 --- a/src/slic3r/GUI/Field.hpp +++ b/src/slic3r/GUI/Field.hpp @@ -115,7 +115,7 @@ public: /// subclasses should overload with a specific version /// Postcondition: Method does not fire the on_change event. virtual void set_value(const boost::any& value, bool change_event) = 0; - + /// Gets a boost::any representing this control. /// subclasses should overload with a specific version virtual boost::any& get_value() = 0; @@ -128,6 +128,8 @@ public: virtual wxString get_tooltip_text(const wxString& default_string); + void field_changed() { on_change_field(); } + // set icon to "UndoToSystemValue" button according to an inheritance of preset // void set_nonsys_btn_icon(const wxBitmap& icon); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 79952f184..c37e04ab9 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1587,11 +1587,11 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup) auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(btn); - btn->Bind(wxEVT_BUTTON, [this, parent, optgroup](wxCommandEvent e) { + btn->Bind(wxEVT_BUTTON, [this, parent, optgroup](wxCommandEvent &e) { BonjourDialog dialog(parent); if (dialog.show_and_lookup()) { optgroup->set_value("print_host", std::move(dialog.get_selected()), true); - // FIXME: emit killfocus on the edit widget + optgroup->get_field("print_host")->field_changed(); } }); @@ -1605,7 +1605,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup) auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(btn); - btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { + btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { std::unique_ptr host(PrintHost::get_print_host(m_config)); if (! host) { const auto text = wxString::Format("%s", @@ -1646,6 +1646,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup) wxFileDialog openFileDialog(this, _(L("Open CA certificate file")), "", "", filemasks, wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (openFileDialog.ShowModal() != wxID_CANCEL) { optgroup->set_value("printhost_cafile", std::move(openFileDialog.GetPath()), true); + optgroup->get_field("printhost_cafile")->field_changed(); } }); From 57bd0889c384b4a2420adbfa306de8c8d191b9b4 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 29 Jan 2019 18:07:45 +0100 Subject: [PATCH 4/5] Disabled the experimental pressure equalizer. --- src/libslic3r/CMakeLists.txt | 4 ++-- src/libslic3r/GCode.cpp | 10 ++++++++++ src/libslic3r/GCode.hpp | 7 ++++++- src/libslic3r/Print.cpp | 2 ++ src/libslic3r/PrintConfig.cpp | 5 +++++ src/libslic3r/PrintConfig.hpp | 6 ++++++ src/slic3r/GUI/Preset.cpp | 5 ++++- src/slic3r/GUI/Tab.cpp | 2 ++ 8 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index baf860bd4..270905fce 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -71,8 +71,8 @@ add_library(libslic3r STATIC GCode/CoolingBuffer.hpp GCode/PostProcessor.cpp GCode/PostProcessor.hpp - GCode/PressureEqualizer.cpp - GCode/PressureEqualizer.hpp +# GCode/PressureEqualizer.cpp +# GCode/PressureEqualizer.hpp GCode/PreviewData.cpp GCode/PreviewData.hpp GCode/PrintExtents.cpp diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 2a53e0444..66698d4ad 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -662,10 +662,14 @@ void GCode::_do_export(Print &print, FILE *file) m_cooling_buffer = make_unique(*this); if (print.config().spiral_vase.value) m_spiral_vase = make_unique(print.config()); +#ifdef HAS_PRESSURE_EQUALIZER if (print.config().max_volumetric_extrusion_rate_slope_positive.value > 0 || print.config().max_volumetric_extrusion_rate_slope_negative.value > 0) m_pressure_equalizer = make_unique(&print.config()); m_enable_extrusion_role_markers = (bool)m_pressure_equalizer; +#else /* HAS_PRESSURE_EQUALIZER */ + m_enable_extrusion_role_markers = false; +#endif /* HAS_PRESSURE_EQUALIZER */ // Write information on the generator. _write_format(file, "; %s\n\n", Slic3r::header_slic3r_generated().c_str()); @@ -918,8 +922,10 @@ void GCode::_do_export(Print &print, FILE *file) this->process_layer(file, print, lrs, tool_ordering.tools_for_layer(ltp.print_z()), © - object.copies().data()); print.throw_if_canceled(); } +#ifdef HAS_PRESSURE_EQUALIZER if (m_pressure_equalizer) _write(file, m_pressure_equalizer->process("", true)); +#endif /* HAS_PRESSURE_EQUALIZER */ ++ finished_objects; // Flag indicating whether the nozzle temperature changes from 1st to 2nd layer were performed. // Reset it when starting another object from 1st layer. @@ -974,8 +980,10 @@ void GCode::_do_export(Print &print, FILE *file) this->process_layer(file, print, layer.second, layer_tools, size_t(-1)); print.throw_if_canceled(); } +#ifdef HAS_PRESSURE_EQUALIZER if (m_pressure_equalizer) _write(file, m_pressure_equalizer->process("", true)); +#endif /* HAS_PRESSURE_EQUALIZER */ if (m_wipe_tower) // Purge the extruder, pull out the active filament. _write(file, m_wipe_tower->finalize(*this)); @@ -1656,11 +1664,13 @@ void GCode::process_layer( if (m_cooling_buffer) gcode = m_cooling_buffer->process_layer(gcode, layer.id()); +#ifdef HAS_PRESSURE_EQUALIZER // Apply pressure equalization if enabled; // printf("G-code before filter:\n%s\n", gcode.c_str()); if (m_pressure_equalizer) gcode = m_pressure_equalizer->process(gcode.c_str(), false); // printf("G-code after filter:\n%s\n", out.c_str()); +#endif /* HAS_PRESSURE_EQUALIZER */ _write(file, gcode); BOOST_LOG_TRIVIAL(trace) << "Exported layer " << layer.id() << " print_z " << print_z << diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index faa6384cd..21957d32c 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -11,7 +11,6 @@ #include "Print.hpp" #include "PrintConfig.hpp" #include "GCode/CoolingBuffer.hpp" -#include "GCode/PressureEqualizer.hpp" #include "GCode/SpiralVase.hpp" #include "GCode/ToolOrdering.hpp" #include "GCode/WipeTower.hpp" @@ -22,6 +21,10 @@ #include #include +#ifdef HAS_PRESSURE_EQUALIZER +#include "GCode/PressureEqualizer.hpp" +#endif /* HAS_PRESSURE_EQUALIZER */ + namespace Slic3r { // Forward declarations. @@ -306,7 +309,9 @@ protected: std::unique_ptr m_cooling_buffer; std::unique_ptr m_spiral_vase; +#ifdef HAS_PRESSURE_EQUALIZER std::unique_ptr m_pressure_equalizer; +#endif /* HAS_PRESSURE_EQUALIZER */ std::unique_ptr m_wipe_tower; // Heights at which the skirt has already been extruded. diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index ea2d9b03d..3efb18599 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -135,8 +135,10 @@ bool Print::invalidate_state_by_config_options(const std::vectormode = comExpert; def->default_value = new ConfigOptionFloat(0); +#ifdef HAS_PRESSURE_EQUALIZER def = this->add("max_volumetric_extrusion_rate_slope_positive", coFloat); def->label = L("Max volumetric slope positive"); def->tooltip = L("This experimental setting is used to limit the speed of change in extrusion rate. " @@ -1231,6 +1232,7 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->mode = comExpert; def->default_value = new ConfigOptionFloat(0); +#endif /* HAS_PRESSURE_EQUALIZER */ def = this->add("min_fan_speed", coInts); def->label = L("Min"); @@ -2740,6 +2742,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va "start_perimeters_at_concave_points", "start_perimeters_at_non_overhang", "randomize_start", "seal_position", "vibration_limit", "bed_size", "print_center", "g0", "threads", "pressure_advance", "wipe_tower_per_color_wipe" +#ifndef HAS_PRESSURE_EQUALIZER + , "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative" +#endif /* HAS_PRESSURE_EQUALIZER */ }; if (ignore.find(opt_key) != ignore.end()) { diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 4842156d6..1b218a192 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -20,6 +20,8 @@ #include "libslic3r.h" #include "Config.hpp" +// #define HAS_PRESSURE_EQUALIZER + namespace Slic3r { enum PrinterTechnology @@ -620,8 +622,10 @@ public: ConfigOptionString layer_gcode; ConfigOptionFloat max_print_speed; ConfigOptionFloat max_volumetric_speed; +#ifdef HAS_PRESSURE_EQUALIZER ConfigOptionFloat max_volumetric_extrusion_rate_slope_positive; ConfigOptionFloat max_volumetric_extrusion_rate_slope_negative; +#endif ConfigOptionPercents retract_before_wipe; ConfigOptionFloats retract_length; ConfigOptionFloats retract_length_toolchange; @@ -689,8 +693,10 @@ protected: OPT_PTR(layer_gcode); OPT_PTR(max_print_speed); OPT_PTR(max_volumetric_speed); +#ifdef HAS_PRESSURE_EQUALIZER OPT_PTR(max_volumetric_extrusion_rate_slope_positive); OPT_PTR(max_volumetric_extrusion_rate_slope_negative); +#endif /* HAS_PRESSURE_EQUALIZER */ OPT_PTR(retract_before_wipe); OPT_PTR(retract_length); OPT_PTR(retract_length_toolchange); diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index f0473b823..ef1caf035 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -323,7 +323,10 @@ const std::vector& Preset::print_options() "seam_position", "external_perimeters_first", "fill_density", "fill_pattern", "external_fill_pattern", "infill_every_layers", "infill_only_where_needed", "solid_infill_every_layers", "fill_angle", "bridge_angle", "solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first", "max_print_speed", - "max_volumetric_speed", "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative", + "max_volumetric_speed", +#ifdef HAS_PRESSURE_EQUALIZER + "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative", +#endif /* HAS_PRESSURE_EQUALIZER */ "perimeter_speed", "small_perimeter_speed", "external_perimeter_speed", "infill_speed", "solid_infill_speed", "top_solid_infill_speed", "support_material_speed", "support_material_xy_spacing", "support_material_interface_speed", "bridge_speed", "gap_fill_speed", "travel_speed", "first_layer_speed", "perimeter_acceleration", "infill_acceleration", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 79952f184..d8997f954 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1028,8 +1028,10 @@ void TabPrint::build() optgroup = page->new_optgroup(_(L("Autospeed (advanced)"))); optgroup->append_single_option_line("max_print_speed"); optgroup->append_single_option_line("max_volumetric_speed"); +#ifdef HAS_PRESSURE_EQUALIZER optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive"); optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative"); +#endif /* HAS_PRESSURE_EQUALIZER */ page = add_options_page(_(L("Multiple Extruders")), "funnel.png"); optgroup = page->new_optgroup(_(L("Extruders"))); From 49bb90523a9cff9f2688958fdad2e644bb13a811 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 29 Jan 2019 18:28:52 +0100 Subject: [PATCH 5/5] Fix of a G-code comment. Fixes Incorrect filament profile being used during purge - always set to PLA. #1691 --- src/libslic3r/GCode/WipeTowerPrusaMM.cpp | 34 +++++++++++++----------- src/libslic3r/GCode/WipeTowerPrusaMM.hpp | 1 + 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/libslic3r/GCode/WipeTowerPrusaMM.cpp b/src/libslic3r/GCode/WipeTowerPrusaMM.cpp index f87969505..031fd9a28 100644 --- a/src/libslic3r/GCode/WipeTowerPrusaMM.cpp +++ b/src/libslic3r/GCode/WipeTowerPrusaMM.cpp @@ -381,22 +381,7 @@ public: Writer& comment_material(WipeTowerPrusaMM::material_type material) { m_gcode += "; material : "; - switch (material) - { - case WipeTowerPrusaMM::PVA: - m_gcode += "#8 (PVA)"; - break; - case WipeTowerPrusaMM::SCAFF: - m_gcode += "#5 (Scaffold)"; - break; - case WipeTowerPrusaMM::FLEX: - m_gcode += "#4 (Flex)"; - break; - default: - m_gcode += "DEFAULT (PLA)"; - break; - } - m_gcode += "\n"; + m_gcode += WipeTowerPrusaMM::to_string(material) + "\n"; return *this; }; @@ -487,6 +472,23 @@ WipeTowerPrusaMM::material_type WipeTowerPrusaMM::parse_material(const char *nam return INVALID; } +std::string WipeTowerPrusaMM::to_string(material_type material) +{ + switch (material) { + case PLA: return "PLA"; + case ABS: return "ABS"; + case PET: return "PET"; + case HIPS: return "HIPS"; + case FLEX: return "FLEX"; + case SCAFF: return "SCAFF"; + case EDGE: return "EDGE"; + case NGEN: return "NGEN"; + case PVA: return "PVA"; + case INVALID: + default: return "INVALID"; + } +} + // Returns gcode to prime the nozzles at the front edge of the print bed. WipeTower::ToolChangeResult WipeTowerPrusaMM::prime( // print_z of the first layer. diff --git a/src/libslic3r/GCode/WipeTowerPrusaMM.hpp b/src/libslic3r/GCode/WipeTowerPrusaMM.hpp index 70c9526e6..3f904a483 100644 --- a/src/libslic3r/GCode/WipeTowerPrusaMM.hpp +++ b/src/libslic3r/GCode/WipeTowerPrusaMM.hpp @@ -38,6 +38,7 @@ public: // Parse material name into material_type. static material_type parse_material(const char *name); + static std::string to_string(material_type material); // x -- x coordinates of wipe tower in mm ( left bottom corner ) // y -- y coordinates of wipe tower in mm ( left bottom corner )