From a552a7bc7889cad24a79c267c9743b7338bf0157 Mon Sep 17 00:00:00 2001 From: bubnikv <bubnikv@gmail.com> Date: Fri, 11 Jan 2019 11:15:32 +0100 Subject: [PATCH 1/4] Fixed a buggy test for a single extruder diameter for Single Extruder Multi Material prints & soluble supports. Disabled assert testing for the existence of "printer_technology" fields as it triggers on loading of legacy AMF/3MF files. --- src/libslic3r/Print.cpp | 26 +++++++++++++++----------- src/slic3r/GUI/Preset.hpp | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 16fbb3738..f8d9f054a 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1282,16 +1282,20 @@ std::string Print::validate() const } } - { - // find the smallest nozzle diameter - std::vector<unsigned int> extruders = this->extruders(); - if (extruders.empty()) - return L("The supplied settings will cause an empty print."); - - std::vector<double> nozzle_diameters; - for (unsigned int extruder_id : extruders) - nozzle_diameters.push_back(m_config.nozzle_diameter.get_at(extruder_id)); - double min_nozzle_diameter = *std::min_element(nozzle_diameters.begin(), nozzle_diameters.end()); + { + // find the smallest nozzle diameter + std::vector<unsigned int> extruders = this->extruders(); + if (extruders.empty()) + return L("The supplied settings will cause an empty print."); + + // Find the smallest used nozzle diameter and the number of unique nozzle diameters. + double min_nozzle_diameter = DBL_MAX; + double max_nozzle_diameter = 0; + for (unsigned int extruder_id : extruders) { + double dmr = m_config.nozzle_diameter.get_at(extruder_id); + min_nozzle_diameter = std::min(min_nozzle_diameter, dmr); + max_nozzle_diameter = std::max(max_nozzle_diameter, dmr); + } #if 0 // We currently allow one to assign extruders with a higher index than the number @@ -1304,7 +1308,7 @@ std::string Print::validate() const for (PrintObject *object : m_objects) { if (object->config().raft_layers > 0 || object->config().support_material.value) { - if ((object->config().support_material_extruder == 0 || object->config().support_material_interface_extruder == 0) && nozzle_diameters.size() > 1) { + if ((object->config().support_material_extruder == 0 || object->config().support_material_interface_extruder == 0) && max_nozzle_diameter - min_nozzle_diameter > EPSILON) { // The object has some form of support and either support_material_extruder or support_material_interface_extruder // will be printed with the current tool without a forced tool change. Play safe, assert that all object nozzles // are of the same diameter. diff --git a/src/slic3r/GUI/Preset.hpp b/src/slic3r/GUI/Preset.hpp index 021fea22c..eae406bef 100644 --- a/src/slic3r/GUI/Preset.hpp +++ b/src/slic3r/GUI/Preset.hpp @@ -166,7 +166,7 @@ public: auto *opt = cfg.option<ConfigOptionEnum<PrinterTechnology>>("printer_technology"); // The following assert may trigger when importing some legacy profile, // but it is safer to keep it here to capture the cases where the "printer_technology" key is queried, where it should not. - assert(opt != nullptr); +// assert(opt != nullptr); return (opt == nullptr) ? ptFFF : opt->value; } PrinterTechnology printer_technology() const { return Preset::printer_technology(this->config); } From 1e21388fe9f40589009062a1ef8e3b3d6bab4698 Mon Sep 17 00:00:00 2001 From: bubnikv <bubnikv@gmail.com> Date: Fri, 11 Jan 2019 11:46:54 +0100 Subject: [PATCH 2/4] Fix of an undefined DBL_MAX on clang / OSX --- src/libslic3r/Print.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index f8d9f054a..1981f338e 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -13,6 +13,7 @@ #include "PrintExport.hpp" #include <algorithm> +#include <limits> #include <unordered_set> #include <boost/filesystem/path.hpp> #include <boost/log/trivial.hpp> @@ -1289,7 +1290,7 @@ std::string Print::validate() const return L("The supplied settings will cause an empty print."); // Find the smallest used nozzle diameter and the number of unique nozzle diameters. - double min_nozzle_diameter = DBL_MAX; + double min_nozzle_diameter = std::numeric_limits<double>::max(); double max_nozzle_diameter = 0; for (unsigned int extruder_id : extruders) { double dmr = m_config.nozzle_diameter.get_at(extruder_id); From 04c0b59bc65b1984988b2322ffc2b477ea69cf03 Mon Sep 17 00:00:00 2001 From: YuSanka <yusanka@gmail.com> Date: Fri, 11 Jan 2019 12:47:40 +0100 Subject: [PATCH 3/4] Fixed wrong ModeButtons layout on settings tabs under OSX --- src/slic3r/GUI/Tab.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 4daaf5d63..05852097b 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -172,8 +172,8 @@ void Tab::create_preset_tab() m_mode_sizer = new PrusaModeSizer(panel); m_hsizer = new wxBoxSizer(wxHORIZONTAL); - sizer->Add(m_hsizer, 0, wxBOTTOM, 3); - m_hsizer->Add(m_presets_choice, 1, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3); + sizer->Add(m_hsizer, 0, wxEXPAND | wxBOTTOM, 3); + m_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3); m_hsizer->AddSpacer(4); m_hsizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL); m_hsizer->AddSpacer(4); @@ -185,8 +185,12 @@ void Tab::create_preset_tab() m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL); m_hsizer->AddSpacer(32); m_hsizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->AddStretchSpacer(32); - m_hsizer->Add(m_mode_sizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); + // m_hsizer->AddStretchSpacer(32); + // StretchSpacer has a strange behavior under OSX, so + // There is used just additional sizer for m_mode_sizer with right alignment + auto mode_sizer = new wxBoxSizer(wxVERTICAL); + mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT); + m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 5); //Horizontal sizer to hold the tree and the selected page. m_hsizer = new wxBoxSizer(wxHORIZONTAL); @@ -681,18 +685,16 @@ void Tab::update_visibility() page->update_visibility(mode); update_page_tree_visibility(); - m_hsizer->Layout(); - Refresh(); + // update mode for ModeSizer + m_mode_sizer->SetMode(mode); + Layout(); Thaw(); // to update tree items color wxTheApp->CallAfter([this]() { update_changed_tree_ui(); }); - - // update mode for ModeSizer - m_mode_sizer->SetMode(mode); } Field* Tab::get_field(const t_config_option_key& opt_key, int opt_index/* = -1*/) const From 6db40feaced23cc63854ae80ba955c5d4745922e Mon Sep 17 00:00:00 2001 From: Vojtech Kral <vojtech@kral.hk> Date: Fri, 11 Jan 2019 12:24:25 +0100 Subject: [PATCH 4/4] Build: Add a flag to disable PCH --- CMakeLists.txt | 13 ++++++++++--- src/libslic3r/CMakeLists.txt | 2 +- src/slic3r/CMakeLists.txt | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76c937cae..e2677824c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option(SLIC3R_GUI "Compile Slic3r with GUI components (OpenGL, wxWidgets)" option(SLIC3R_FHS "Assume Slic3r is to be installed in a FHS directory structure" 0) option(SLIC3R_WX_STABLE "Build against wxWidgets stable (3.0) as oppsed to dev (3.1) on Linux" 0) option(SLIC3R_PROFILE "Compile Slic3r with an invasive Shiny profiler" 0) +option(SLIC3R_PCH "Use precompiled headers" 1) option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1) option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1) option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0) @@ -37,6 +38,15 @@ option(SLIC3R_SYNTAXONLY "Only perform source code correctness checking, option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF) option(SLIC3R_BUILD_TESTS "Build unit tests" OFF) +# Print out the SLIC3R_* cache options +get_cmake_property(_cache_vars CACHE_VARIABLES) +list (SORT _cache_vars) +foreach (_cache_var ${_cache_vars}) + if("${_cache_var}" MATCHES "^SLIC3R_") + message(STATUS "${_cache_var}: ${${_cache_var}}") + endif () +endforeach() + if (MSVC) if (SLIC3R_MSVC_COMPILE_PARALLEL) add_compile_options(/MP) @@ -46,7 +56,6 @@ if (MSVC) add_compile_options(-bigobj -Zm316) endif () - # Display and check CMAKE_PREFIX_PATH message(STATUS "SLIC3R_STATIC: ${SLIC3R_STATIC}") if (NOT "${CMAKE_PREFIX_PATH}" STREQUAL "") @@ -65,8 +74,6 @@ foreach (DIR ${PREFIX_PATH_CHECK}) endif () endforeach () -message(STATUS "SLIC3R_FHS: ${SLIC3R_FHS}") - # Add our own cmake module path. list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/) diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 7870bd1fb..c97d3d972 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -171,7 +171,7 @@ add_library(libslic3r STATIC SLA/SLASpatIndex.hpp ) -if (NOT SLIC3R_SYNTAXONLY) +if (SLIC3R_PCH AND NOT SLIC3R_SYNTAXONLY) add_precompiled_header(libslic3r pchheader.hpp FORCEINCLUDE) endif () diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index d79421439..783c65293 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -128,6 +128,6 @@ add_library(libslic3r_gui STATIC ) target_link_libraries(libslic3r_gui libslic3r avrdude imgui) -if (NOT SLIC3R_SYNTAXONLY) +if (SLIC3R_PCH AND NOT SLIC3R_SYNTAXONLY) add_precompiled_header(libslic3r_gui pchheader.hpp FORCEINCLUDE) endif ()