This commit is contained in:
YuSanka 2019-01-10 11:10:01 +01:00
commit 107152b25e
30 changed files with 327 additions and 68 deletions

View File

@ -25,6 +25,7 @@ endif()
option(SLIC3R_STATIC "Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL}) option(SLIC3R_STATIC "Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
option(SLIC3R_GUI "Compile Slic3r with GUI components (OpenGL, wxWidgets)" 1) option(SLIC3R_GUI "Compile Slic3r with GUI components (OpenGL, wxWidgets)" 1)
option(SLIC3R_FHS "Assume Slic3r is to be installed in a FHS directory structure" 0) 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_PROFILE "Compile Slic3r with an invasive Shiny profiler" 0)
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 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_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
@ -112,14 +113,17 @@ if (APPLE)
endif () endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux") if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD.
add_compile_options(-std=c++11 -Wall -Wno-reorder)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
if (CMAKE_VERSION VERSION_LESS "3.1")
# Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif() endif()
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX) if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
# Adding -fext-numeric-literals to enable GCC extensions on definitions of quad float literals, which are required by Boost. # Adding -fext-numeric-literals to enable GCC extensions on definitions of quad float literals, which are required by Boost.
add_compile_options(-fext-numeric-literals) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" )
if (SLIC3R_SYNTAXONLY) if (SLIC3R_SYNTAXONLY)
set(CMAKE_CXX_ARCHIVE_CREATE "true") set(CMAKE_CXX_ARCHIVE_CREATE "true")
@ -136,9 +140,15 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-Wall)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder" )
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error. # On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
add_compile_options(-Werror=return-type) add_compile_options(-Werror=return-type)
#removes LOTS of extraneous Eigen warnings
add_compile_options(-Wno-ignored-attributes)
if (SLIC3R_ASAN) if (SLIC3R_ASAN)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer) add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
@ -245,7 +255,7 @@ endif()
# Find eigen3 or use bundled version # Find eigen3 or use bundled version
if (NOT SLIC3R_STATIC) if (NOT SLIC3R_STATIC)
find_package(Eigen3) find_package(Eigen3 3)
endif () endif ()
if (NOT Eigen3_FOUND) if (NOT Eigen3_FOUND)
set(Eigen3_FOUND 1) set(Eigen3_FOUND 1)

View File

@ -68,11 +68,37 @@ function(export_all_flags _filename)
set(_compile_definitions "$<TARGET_PROPERTY:${_target},COMPILE_DEFINITIONS>") set(_compile_definitions "$<TARGET_PROPERTY:${_target},COMPILE_DEFINITIONS>")
set(_compile_flags "$<TARGET_PROPERTY:${_target},COMPILE_FLAGS>") set(_compile_flags "$<TARGET_PROPERTY:${_target},COMPILE_FLAGS>")
set(_compile_options "$<TARGET_PROPERTY:${_target},COMPILE_OPTIONS>") set(_compile_options "$<TARGET_PROPERTY:${_target},COMPILE_OPTIONS>")
#handle config-specific cxx flags
string(TOUPPER ${CMAKE_BUILD_TYPE} _config)
set(_build_cxx_flags ${CMAKE_CXX_FLAGS_${_config}})
#handle fpie option
get_target_property(_fpie ${_target} POSITION_INDEPENDENT_CODE)
if (_fpie AND CMAKE_POSITION_INDEPENDENT_CODE)
list(APPEND _compile_options ${CMAKE_CXX_COMPILE_OPTIONS_PIC})
endif()
#handle compiler standard (GCC only)
if(CMAKE_COMPILER_IS_GNUCXX)
get_target_property(_cxx_standard ${_target} CXX_STANDARD)
if ((NOT "${_cxx_standard}" STREQUAL NOTFOUND) AND (NOT "${_cxx_standard}" STREQUAL ""))
get_target_property(_cxx_extensions ${_target} CXX_EXTENSIONS)
get_property(_exists TARGET ${_target} PROPERTY CXX_EXTENSIONS SET)
if (NOT _exists OR ${_cxx_extensions})
list(APPEND _compile_options "-std=gnu++${_cxx_standard}")
else()
list(APPEND _compile_options "-std=c++${_cxx_standard}")
endif()
endif()
endif()
set(_include_directories "$<$<BOOL:${_include_directories}>:-I$<JOIN:${_include_directories},\n-I>\n>") set(_include_directories "$<$<BOOL:${_include_directories}>:-I$<JOIN:${_include_directories},\n-I>\n>")
set(_compile_definitions "$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions},\n-D>\n>") set(_compile_definitions "$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions},\n-D>\n>")
set(_compile_flags "$<$<BOOL:${_compile_flags}>:$<JOIN:${_compile_flags},\n>\n>") set(_compile_flags "$<$<BOOL:${_compile_flags}>:$<JOIN:${_compile_flags},\n>\n>")
set(_compile_options "$<$<BOOL:${_compile_options}>:$<JOIN:${_compile_options},\n>\n>") set(_compile_options "$<$<BOOL:${_compile_options}>:$<JOIN:${_compile_options},\n>\n>")
file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}\n") set(_cxx_flags "$<$<BOOL:${CMAKE_CXX_FLAGS}>:${CMAKE_CXX_FLAGS}\n>$<$<BOOL:${_build_cxx_flags}>:${_build_cxx_flags}\n>")
file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}${_cxx_flags}\n")
endfunction() endfunction()
function(add_precompiled_header _target _input) function(add_precompiled_header _target _input)

1
deps/CMakeLists.txt vendored
View File

@ -33,6 +33,7 @@ endif ()
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory") set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON) option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON)
option(DEP_WX_STABLE "Build against wxWidgets stable 3.0 as opposed to default 3.1 (Linux only)" OFF)
message(STATUS "Slic3r deps DESTDIR: ${DESTDIR}") message(STATUS "Slic3r deps DESTDIR: ${DESTDIR}")
message(STATUS "Slic3r deps debug build: ${DEP_DEBUG}") message(STATUS "Slic3r deps debug build: ${DEP_DEBUG}")

14
deps/deps-linux.cmake vendored
View File

@ -88,16 +88,24 @@ ExternalProject_Add(dep_libcurl
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}" INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
) )
if (DEP_WX_STABLE)
set(DEP_WX_URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.4/wxWidgets-3.0.4.tar.bz2")
set(DEP_WX_HASH "SHA256=96157f988d261b7368e5340afa1a0cad943768f35929c22841f62c25b17bf7f0")
else ()
set(DEP_WX_URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2")
set(DEP_WX_HASH "SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e")
endif()
ExternalProject_Add(dep_wxwidgets ExternalProject_Add(dep_wxwidgets
EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_ALL 1
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2" URL "${DEP_WX_URL}"
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e URL_HASH "${DEP_WX_HASH}"
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/wxwidgets-pngprefix.h" src/png/pngprefix.h PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/wxwidgets-pngprefix.h" src/png/pngprefix.h
CONFIGURE_COMMAND ./configure CONFIGURE_COMMAND ./configure
"--prefix=${DESTDIR}/usr/local" "--prefix=${DESTDIR}/usr/local"
--disable-shared --disable-shared
--with-gtk=2 --with-gtk=2
--with-opengl --with-opengl
--enable-unicode --enable-unicode
--enable-graphics_ctx --enable-graphics_ctx

View File

@ -7,7 +7,7 @@ CMake installer can be downloaded from [the official website](https://cmake.org/
Building with newer versions of MSVS (2015, 2017) may work too as reported by some of our users. Building with newer versions of MSVS (2015, 2017) may work too as reported by some of our users.
_Note:_ Thanks to **@supermerill** for testing and inspiration on this guide. _Note:_ Thanks to [**@supermerill**](https://github.com/supermerill) for testing and inspiration on this guide.
### Dependencies ### Dependencies

BIN
resources/icons/gcode.icns Normal file

Binary file not shown.

BIN
resources/icons/stl.icns Normal file

Binary file not shown.

Binary file not shown.

View File

@ -59,7 +59,19 @@ if (SLIC3R_GUI)
endif() endif()
endif() endif()
find_package(wxWidgets REQUIRED COMPONENTS base core adv html gl) if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
if (SLIC3R_WX_STABLE)
find_package(wxWidgets 3.0 REQUIRED COMPONENTS base core adv html gl)
else ()
find_package(wxWidgets 3.1 QUIET COMPONENTS base core adv html gl)
if (NOT wxWidgets_FOUND)
message(FATAL_ERROR "\nCould not find wxWidgets 3.1.\nHint: On Linux you can set -DSLIC3R_WX_STABLE=1 to use wxWidgets 3.0")
endif ()
endif ()
else ()
find_package(wxWidgets 3.1 REQUIRED COMPONENTS base core adv html gl)
endif ()
include(${wxWidgets_USE_FILE}) include(${wxWidgets_USE_FILE})
endif() endif()

View File

@ -561,6 +561,12 @@ bool DynamicConfig::read_cli(int argc, char** argv, t_config_option_keys* extra)
extra->push_back(token); extra->push_back(token);
continue; continue;
} }
#ifdef __APPLE__
if (boost::starts_with(token, "-psn_"))
// OSX launcher may add a "process serial number", for example "-psn_0_989382" to the command line.
// While it is supposed to be dropped since OSX 10.9, we will rather ignore it.
continue;
#endif /* __APPLE__ */
// Stop parsing tokens as options when -- is supplied. // Stop parsing tokens as options when -- is supplied.
if (token == "--") { if (token == "--") {
parse_options = false; parse_options = false;

View File

@ -1181,22 +1181,34 @@ Transform3d assemble_transform(const Vec3d& translation, const Vec3d& rotation,
Vec3d extract_euler_angles(const Eigen::Matrix<double, 3, 3, Eigen::DontAlign>& rotation_matrix) Vec3d extract_euler_angles(const Eigen::Matrix<double, 3, 3, Eigen::DontAlign>& rotation_matrix)
{ {
auto y_only = [](const Eigen::Matrix<double, 3, 3, Eigen::DontAlign>& matrix) -> bool {
return (matrix(0, 1) == 0.0) && (matrix(1, 0) == 0.0) && (matrix(1, 1) == 1.0) && (matrix(1, 2) == 0.0) && (matrix(2, 1) == 0.0);
};
// see: https://www.learnopencv.com/rotation-matrix-to-euler-angles/ // see: https://www.learnopencv.com/rotation-matrix-to-euler-angles/
double sy = ::sqrt(sqr(rotation_matrix(0, 0)) + sqr(rotation_matrix(1, 0))); double cy_abs = ::sqrt(sqr(rotation_matrix(0, 0)) + sqr(rotation_matrix(1, 0)));
Vec3d angles = Vec3d::Zero(); Vec3d angles = Vec3d::Zero();
if (sy >= 1e-6) if (cy_abs >= 1e-6)
{ {
angles(0) = ::atan2(rotation_matrix(2, 1), rotation_matrix(2, 2)); angles(0) = ::atan2(rotation_matrix(2, 1), rotation_matrix(2, 2));
angles(1) = ::atan2(-rotation_matrix(2, 0), sy); angles(1) = ::atan2(-rotation_matrix(2, 0), cy_abs);
angles(2) = ::atan2(rotation_matrix(1, 0), rotation_matrix(0, 0)); angles(2) = ::atan2(rotation_matrix(1, 0), rotation_matrix(0, 0));
// this is an hack to try to avoid this function to return "strange" values due to gimbal lock
if (y_only(rotation_matrix) && (angles(0) == (double)PI) && (angles(2) == (double)PI))
{
angles(0) = 0.0;
angles(1) = ::atan2(rotation_matrix(2, 0), cy_abs) - (double)PI;
angles(2) = 0.0;
}
} }
else else
{ {
angles(0) = 0.0; angles(0) = 0.0;
angles(1) = ::atan2(-rotation_matrix(2, 0), sy); angles(1) = ::atan2(-rotation_matrix(2, 0), cy_abs);
angles(2) = (angles(1) >-0.0) ? ::atan2(rotation_matrix(1, 2), rotation_matrix(1, 1)) : ::atan2(-rotation_matrix(1, 2), rotation_matrix(1, 1)); angles(2) = (angles(1) >= 0.0) ? ::atan2(rotation_matrix(1, 2), rotation_matrix(1, 1)) : ::atan2(-rotation_matrix(1, 2), rotation_matrix(1, 1));
} }
return angles; return angles;

View File

@ -2527,6 +2527,22 @@ void PrintConfigDef::init_sla_params()
def->min = 0; def->min = 0;
def->default_value = new ConfigOptionFloat(1.0); def->default_value = new ConfigOptionFloat(1.0);
def = this->add("support_pillar_connection_mode", coEnum);
def->label = L("Support pillar connection mode");
def->tooltip = L("Controls the bridge type between two neigboring pillars."
" Can be zig-zag, cross (double zig-zag) or dynamic which"
" will automatically switch between the first two depending"
" on the distance of the two pillars.");
def->cli = "";
def->enum_keys_map = &ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_values();
def->enum_values.push_back("zigzag");
def->enum_values.push_back("cross");
def->enum_values.push_back("dynamic");
def->enum_labels.push_back(L("Zig-Zag"));
def->enum_labels.push_back(L("Cross"));
def->enum_labels.push_back(L("Dynamic"));
def->default_value = new ConfigOptionEnum<SLAPillarConnectionMode>(slapcmDynamic);
def = this->add("support_pillar_widening_factor", coFloat); def = this->add("support_pillar_widening_factor", coFloat);
def->label = L("Pillar widening factor"); def->label = L("Pillar widening factor");
def->category = L("Supports"); def->category = L("Supports");
@ -3044,7 +3060,7 @@ CLIConfigDef::CLIConfigDef()
def->tooltip = L("Forces the GUI launch instead of command line slicing " def->tooltip = L("Forces the GUI launch instead of command line slicing "
"(if you supply a model file, it will be loaded into the plater)"); "(if you supply a model file, it will be loaded into the plater)");
def->cli = "gui"; def->cli = "gui";
def->default_value = new ConfigOptionBool(true); def->default_value = new ConfigOptionBool(false);
def = this->add("info", coBool); def = this->add("info", coBool);
def->label = L("Output Model Info"); def->label = L("Output Model Info");

View File

@ -61,6 +61,12 @@ enum SLADisplayOrientation {
sladoPortrait sladoPortrait
}; };
enum SLAPillarConnectionMode {
slapcmZigZag,
slapcmCross,
slapcmDynamic
};
template<> inline const t_config_enum_values& ConfigOptionEnum<PrinterTechnology>::get_enum_values() { template<> inline const t_config_enum_values& ConfigOptionEnum<PrinterTechnology>::get_enum_values() {
static t_config_enum_values keys_map; static t_config_enum_values keys_map;
if (keys_map.empty()) { if (keys_map.empty()) {
@ -162,6 +168,16 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<SLADisplayOrienta
return keys_map; return keys_map;
} }
template<> inline const t_config_enum_values& ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_values() {
static const t_config_enum_values keys_map = {
{"zigzag", slapcmZigZag},
{"cross", slapcmCross},
{"dynamic", slapcmDynamic}
};
return keys_map;
}
// Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs. // Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs.
// Does not store the actual values, but defines default values. // Does not store the actual values, but defines default values.
class PrintConfigDef : public ConfigDef class PrintConfigDef : public ConfigDef
@ -949,6 +965,9 @@ public:
// Radius in mm of the support pillars. // Radius in mm of the support pillars.
ConfigOptionFloat support_pillar_diameter /*= 0.8*/; ConfigOptionFloat support_pillar_diameter /*= 0.8*/;
// How the pillars are bridged together
ConfigOptionEnum<SLAPillarConnectionMode> support_pillar_connection_mode;
// TODO: unimplemented at the moment. This coefficient will have an impact // TODO: unimplemented at the moment. This coefficient will have an impact
// when bridges and pillars are merged. The resulting pillar should be a bit // when bridges and pillars are merged. The resulting pillar should be a bit
// thicker than the ones merging into it. How much thicker? I don't know // thicker than the ones merging into it. How much thicker? I don't know
@ -1003,6 +1022,7 @@ protected:
OPT_PTR(support_head_penetration); OPT_PTR(support_head_penetration);
OPT_PTR(support_head_width); OPT_PTR(support_head_width);
OPT_PTR(support_pillar_diameter); OPT_PTR(support_pillar_diameter);
OPT_PTR(support_pillar_connection_mode);
OPT_PTR(support_pillar_widening_factor); OPT_PTR(support_pillar_widening_factor);
OPT_PTR(support_base_diameter); OPT_PTR(support_base_diameter);
OPT_PTR(support_base_height); OPT_PTR(support_base_height);

View File

@ -1249,8 +1249,13 @@ bool SLASupportTree::generate(const PointSet &points,
if(chkd >= bridge_distance) { if(chkd >= bridge_distance) {
result.add_bridge(sj, ej, pillar.r); result.add_bridge(sj, ej, pillar.r);
auto pcm = cfg.pillar_connection_mode;
// double bridging: (crosses) // double bridging: (crosses)
if(pillar_dist > 2*cfg.base_radius_mm) { if( pcm == PillarConnectionMode::cross ||
(pcm == PillarConnectionMode::dynamic &&
pillar_dist > 2*cfg.base_radius_mm))
{
// If the columns are close together, no need to // If the columns are close together, no need to
// double bridge them // double bridge them
Vec3d bsj(ej(X), ej(Y), sj(Z)); Vec3d bsj(ej(X), ej(Y), sj(Z));

View File

@ -28,6 +28,12 @@ using SlicedSupports = std::vector<SliceLayer>;
namespace sla { namespace sla {
enum class PillarConnectionMode {
zigzag,
cross,
dynamic
};
struct SupportConfig { struct SupportConfig {
// Radius in mm of the pointing side of the head. // Radius in mm of the pointing side of the head.
double head_front_radius_mm = 0.2; double head_front_radius_mm = 0.2;
@ -46,6 +52,9 @@ struct SupportConfig {
// headless pillars will have half of this value. // headless pillars will have half of this value.
double headless_pillar_radius_mm = 0.4; double headless_pillar_radius_mm = 0.4;
// How to connect pillars
PillarConnectionMode pillar_connection_mode = PillarConnectionMode::dynamic;
// TODO: unimplemented at the moment. This coefficient will have an impact // TODO: unimplemented at the moment. This coefficient will have an impact
// when bridges and pillars are merged. The resulting pillar should be a bit // when bridges and pillars are merged. The resulting pillar should be a bit
// thicker than the ones merging into it. How much thicker? I don't know // thicker than the ones merging into it. How much thicker? I don't know

View File

@ -407,6 +407,14 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) {
scfg.tilt = c.support_critical_angle.getFloat() * PI / 180.0 ; scfg.tilt = c.support_critical_angle.getFloat() * PI / 180.0 ;
scfg.max_bridge_length_mm = c.support_max_bridge_length.getFloat(); scfg.max_bridge_length_mm = c.support_max_bridge_length.getFloat();
scfg.headless_pillar_radius_mm = 0.375*c.support_pillar_diameter.getFloat(); scfg.headless_pillar_radius_mm = 0.375*c.support_pillar_diameter.getFloat();
switch(c.support_pillar_connection_mode.getInt()) {
case slapcmZigZag:
scfg.pillar_connection_mode = sla::PillarConnectionMode::zigzag; break;
case slapcmCross:
scfg.pillar_connection_mode = sla::PillarConnectionMode::cross; break;
case slapcmDynamic:
scfg.pillar_connection_mode = sla::PillarConnectionMode::dynamic; break;
}
scfg.pillar_widening_factor = c.support_pillar_widening_factor.getFloat(); scfg.pillar_widening_factor = c.support_pillar_widening_factor.getFloat();
scfg.base_radius_mm = 0.5*c.support_base_diameter.getFloat(); scfg.base_radius_mm = 0.5*c.support_base_diameter.getFloat();
scfg.base_height_mm = c.support_base_height.getFloat(); scfg.base_height_mm = c.support_base_height.getFloat();
@ -1058,6 +1066,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|| opt_key == "support_head_penetration" || opt_key == "support_head_penetration"
|| opt_key == "support_head_width" || opt_key == "support_head_width"
|| opt_key == "support_pillar_diameter" || opt_key == "support_pillar_diameter"
|| opt_key == "support_pillar_connection_mode"
|| opt_key == "support_base_diameter" || opt_key == "support_base_diameter"
|| opt_key == "support_base_height" || opt_key == "support_base_height"
|| opt_key == "support_critical_angle" || opt_key == "support_critical_angle"

View File

@ -22,11 +22,99 @@
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>@SLIC3R_BUILD_ID@</string> <string>@SLIC3R_BUILD_ID@</string>
<key>CGDisableCoalescedUpdates</key> <key>CFBundleDocumentTypes</key>
<false/> <array>
<key>NSPrincipalClass</key> <dict>
<string>NSApplication</string> <key>CFBundleTypeExtensions</key>
<key>NSHighResolutionCapable</key> <array>
<true/> <string>stl</string>
</dict> <string>STL</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>stl.icns</string>
<key>CFBundleTypeName</key>
<string>STL</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LISsAppleDefaultForType</key>
<true/>
<key>LSHandlerRank</key>
<string>Alternate</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>obj</string>
<string>OBJ</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Slic3r.icns</string>
<key>CFBundleTypeName</key>
<string>STL</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LISsAppleDefaultForType</key>
<true/>
<key>LSHandlerRank</key>
<string>Alternate</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>amf</string>
<string>AMF</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Slic3r.icns</string>
<key>CFBundleTypeName</key>
<string>AMF</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LISsAppleDefaultForType</key>
<true/>
<key>LSHandlerRank</key>
<string>Alternate</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>3mf</string>
<string>3MF</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Slic3r.icns</string>
<key>CFBundleTypeName</key>
<string>3MF</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LISsAppleDefaultForType</key>
<true/>
<key>LSHandlerRank</key>
<string>Alternate</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>gcode</string>
<string>GCODE</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>gcode.icns</string>
<key>CFBundleTypeName</key>
<string>GCODE</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LISsAppleDefaultForType</key>
<true/>
<key>LSHandlerRank</key>
<string>Alternate</string>
</dict>
</array>
<key>LSMinimumSystemVersion</key>
<string>10.9</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist> </plist>

View File

@ -96,6 +96,11 @@ int main(int argc, char **argv)
// apply command line options to a more handy CLIConfig // apply command line options to a more handy CLIConfig
CLIConfig cli_config; CLIConfig cli_config;
#ifdef __APPLE__
// Enable the GUI mode by default, to support drag & drop.
cli_config.gui.value = true;
#endif /* __APPLE__ */
cli_config.apply(all_config, true); cli_config.apply(all_config, true);
set_data_dir(cli_config.datadir.value); set_data_dir(cli_config.datadir.value);

View File

@ -718,6 +718,8 @@ boost::any& Choice::get_value()
m_value = static_cast<PrintHostType>(ret_enum); m_value = static_cast<PrintHostType>(ret_enum);
else if (m_opt_id.compare("display_orientation") == 0) else if (m_opt_id.compare("display_orientation") == 0)
m_value = static_cast<SLADisplayOrientation>(ret_enum); m_value = static_cast<SLADisplayOrientation>(ret_enum);
else if (m_opt_id.compare("support_pillar_connection_mode") == 0)
m_value = static_cast<SLAPillarConnectionMode>(ret_enum);
} }
else if (m_opt.gui_type == "f_enum_open") { else if (m_opt.gui_type == "f_enum_open") {
const int ret_enum = static_cast<wxComboBox*>(window)->GetSelection(); const int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();

View File

@ -2041,7 +2041,7 @@ void GLCanvas3D::Selection::render_sidebar_hints(const std::string& sidebar_fiel
if (is_single_full_instance()) if (is_single_full_instance())
{ {
::glTranslated(center(0), center(1), center(2)); ::glTranslated(center(0), center(1), center(2));
if (boost::starts_with(sidebar_field, "scale")) if (boost::starts_with(sidebar_field, "scale") || boost::starts_with(sidebar_field, "size"))
{ {
Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true); Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
::glMultMatrixd(orient_matrix.data()); ::glMultMatrixd(orient_matrix.data());
@ -2983,7 +2983,7 @@ bool GLCanvas3D::Gizmos::is_running() const
bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection) bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection)
{ {
if (!m_enabled) if (!m_enabled || selection.is_empty())
return false; return false;
bool handled = false; bool handled = false;
@ -6915,22 +6915,31 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
} }
} ctxt; } ctxt;
ctxt.shifted_copies = &print_object.copies();
// order layers by print_z
ctxt.layers.reserve(print_object.layers().size() + print_object.support_layers().size());
for (const Layer *layer : print_object.layers())
ctxt.layers.push_back(layer);
for (const Layer *layer : print_object.support_layers())
ctxt.layers.push_back(layer);
std::sort(ctxt.layers.begin(), ctxt.layers.end(), [](const Layer *l1, const Layer *l2) { return l1->print_z < l2->print_z; });
// Maximum size of an allocation block: 32MB / sizeof(float)
ctxt.has_perimeters = print_object.is_step_done(posPerimeters); ctxt.has_perimeters = print_object.is_step_done(posPerimeters);
ctxt.has_infill = print_object.is_step_done(posInfill); ctxt.has_infill = print_object.is_step_done(posInfill);
ctxt.has_support = print_object.is_step_done(posSupportMaterial); ctxt.has_support = print_object.is_step_done(posSupportMaterial);
ctxt.tool_colors = tool_colors.empty() ? nullptr : &tool_colors; ctxt.tool_colors = tool_colors.empty() ? nullptr : &tool_colors;
ctxt.shifted_copies = &print_object.copies();
// order layers by print_z
{
size_t nlayers = 0;
if (ctxt.has_perimeters || ctxt.has_infill)
nlayers = print_object.layers().size();
if (ctxt.has_support)
nlayers += print_object.support_layers().size();
ctxt.layers.reserve(nlayers);
}
if (ctxt.has_perimeters || ctxt.has_infill)
for (const Layer *layer : print_object.layers())
ctxt.layers.push_back(layer);
if (ctxt.has_support)
for (const Layer *layer : print_object.support_layers())
ctxt.layers.push_back(layer);
std::sort(ctxt.layers.begin(), ctxt.layers.end(), [](const Layer *l1, const Layer *l2) { return l1->print_z < l2->print_z; });
// Maximum size of an allocation block: 32MB / sizeof(float)
BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - start"; BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - start";
//FIXME Improve the heuristics for a grain size. //FIXME Improve the heuristics for a grain size.

View File

@ -36,7 +36,7 @@ bool GLTexture::load_from_file(const std::string& filename, bool generate_mipmap
// Load a PNG with an alpha channel. // Load a PNG with an alpha channel.
wxImage image; wxImage image;
if (!image.LoadFile(wxString::FromUTF8(filename), wxBITMAP_TYPE_PNG)) if (!image.LoadFile(wxString::FromUTF8(filename.c_str()), wxBITMAP_TYPE_PNG))
{ {
reset(); reset();
return false; return false;

View File

@ -200,6 +200,8 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value)));
else if (opt_key.compare("display_orientation") == 0) else if (opt_key.compare("display_orientation") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SLADisplayOrientation>(boost::any_cast<SLADisplayOrientation>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<SLADisplayOrientation>(boost::any_cast<SLADisplayOrientation>(value)));
else if(opt_key.compare("support_pillar_connection_mode") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SLAPillarConnectionMode>(boost::any_cast<SLAPillarConnectionMode>(value)));
} }
break; break;
case coPoints:{ case coPoints:{
@ -232,7 +234,7 @@ void show_error(wxWindow* parent, const wxString& message)
void show_error_id(int id, const std::string& message) void show_error_id(int id, const std::string& message)
{ {
auto *parent = id != 0 ? wxWindow::FindWindowById(id) : nullptr; auto *parent = id != 0 ? wxWindow::FindWindowById(id) : nullptr;
show_error(parent, wxString::FromUTF8(message.data())); show_error(parent, from_u8(message));
} }
void show_info(wxWindow* parent, const wxString& message, const wxString& title) void show_info(wxWindow* parent, const wxString& message, const wxString& title)
@ -322,7 +324,7 @@ wxString from_path(const boost::filesystem::path &path)
#ifdef _WIN32 #ifdef _WIN32
return wxString(path.string<std::wstring>()); return wxString(path.string<std::wstring>());
#else #else
return wxString::FromUTF8(path.string<std::string>()); return from_u8(path.string<std::string>());
#endif #endif
} }
@ -403,7 +405,7 @@ void desktop_open_datadir_folder()
const auto path = data_dir(); const auto path = data_dir();
#ifdef _WIN32 #ifdef _WIN32
const auto widepath = wxString::FromUTF8(path.data()); const wxString widepath = from_u8(path);
const wchar_t *argv[] = { L"explorer", widepath.GetData(), nullptr }; const wchar_t *argv[] = { L"explorer", widepath.GetData(), nullptr };
::wxExecute(const_cast<wchar_t**>(argv), wxEXEC_ASYNC, nullptr); ::wxExecute(const_cast<wchar_t**>(argv), wxEXEC_ASYNC, nullptr);
#elif __APPLE__ #elif __APPLE__

View File

@ -67,7 +67,7 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension)
out += std::string(";*") + custom_extension; out += std::string(";*") + custom_extension;
} }
} }
return wxString::FromUTF8(out.c_str()); return from_u8(out);
} }
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); } static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }
@ -464,7 +464,7 @@ bool GUI_App::select_language( wxArrayString & names,
{ {
m_wxLocale = new wxLocale; m_wxLocale = new wxLocale;
m_wxLocale->Init(identifiers[index]); m_wxLocale->Init(identifiers[index]);
m_wxLocale->AddCatalogLookupPathPrefix(wxString::FromUTF8(localization_dir())); m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE"); m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE");
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only. //FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
wxSetlocale(LC_NUMERIC, "C"); wxSetlocale(LC_NUMERIC, "C");
@ -492,7 +492,7 @@ bool GUI_App::load_language()
{ {
m_wxLocale = new wxLocale; m_wxLocale = new wxLocale;
m_wxLocale->Init(identifiers[i]); m_wxLocale->Init(identifiers[i]);
m_wxLocale->AddCatalogLookupPathPrefix(wxString::FromUTF8(localization_dir())); m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE"); m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE");
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only. //FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
wxSetlocale(LC_NUMERIC, "C"); wxSetlocale(LC_NUMERIC, "C");
@ -520,7 +520,7 @@ void GUI_App::get_installed_languages(wxArrayString & names, wxArrayLong & ident
names.Clear(); names.Clear();
identifiers.Clear(); identifiers.Clear();
wxDir dir(wxString::FromUTF8(localization_dir())); wxDir dir(from_u8(localization_dir()));
wxString filename; wxString filename;
const wxLanguageInfo * langinfo; const wxLanguageInfo * langinfo;
wxString name = wxLocale::GetLanguageName(wxLANGUAGE_DEFAULT); wxString name = wxLocale::GetLanguageName(wxLANGUAGE_DEFAULT);
@ -742,6 +742,17 @@ void GUI_App::load_current_presets()
} }
} }
#ifdef __APPLE__
// wxWidgets override to get an event on open files.
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
{
std::vector<std::string> files;
for (size_t i = 0; i < fileNames.GetCount(); ++ i)
files.emplace_back(fileNames[i].ToUTF8().data());
this->plater()->load_files(files, true, true);
}
#endif /* __APPLE */
Sidebar& GUI_App::sidebar() Sidebar& GUI_App::sidebar()
{ {
return plater_->sidebar(); return plater_->sidebar();

View File

@ -144,6 +144,11 @@ public:
void delete_tab_from_list(Tab* tab); void delete_tab_from_list(Tab* tab);
void load_current_presets(); void load_current_presets();
#ifdef __APPLE__
// wxWidgets override to get an event on open files.
void MacOpenFiles(const wxArrayString &fileNames) override;
#endif /* __APPLE */
Sidebar& sidebar(); Sidebar& sidebar();
ObjectManipulation* obj_manipul(); ObjectManipulation* obj_manipul();
ObjectSettings* obj_settings(); ObjectSettings* obj_settings();

View File

@ -685,29 +685,24 @@ void Preview::load_print_as_fff()
// we require that there's at least one object and the posSlice step // we require that there's at least one object and the posSlice step
// is performed on all of them(this ensures that _shifted_copies was // is performed on all of them(this ensures that _shifted_copies was
// populated and we know the number of layers) // populated and we know the number of layers)
unsigned int n_layers = 0; bool has_layers = false;
const Print *print = m_process->fff_print(); const Print *print = m_process->fff_print();
if (print->is_step_done(posSlice)) if (print->is_step_done(posSlice)) {
{
std::set<float> zs;
for (const PrintObject* print_object : print->objects()) for (const PrintObject* print_object : print->objects())
{ if (! print_object->layers().empty()) {
const LayerPtrs& layers = print_object->layers(); has_layers = true;
const SupportLayerPtrs& support_layers = print_object->support_layers(); break;
for (const Layer* layer : layers)
{
zs.insert(layer->print_z);
} }
for (const SupportLayer* layer : support_layers) }
{ if (print->is_step_done(posSupportMaterial)) {
zs.insert(layer->print_z); for (const PrintObject* print_object : print->objects())
if (! print_object->support_layers().empty()) {
has_layers = true;
break;
} }
}
n_layers = (unsigned int)zs.size();
} }
if (n_layers == 0) if (! has_layers)
{ {
reset_sliders(); reset_sliders();
m_canvas->reset_legend_texture(); m_canvas->reset_legend_texture();
@ -761,8 +756,8 @@ void Preview::load_print_as_fff()
show_hide_ui_elements("full"); show_hide_ui_elements("full");
// recalculates zs and update sliders accordingly // recalculates zs and update sliders accordingly
n_layers = (unsigned int)m_canvas->get_current_print_zs(true).size(); has_layers = ! m_canvas->get_current_print_zs(true).empty();
if (n_layers == 0) if (! has_layers)
{ {
// all layers filtered out // all layers filtered out
reset_sliders(); reset_sliders();
@ -777,7 +772,7 @@ void Preview::load_print_as_fff()
} }
if (n_layers > 0) if (has_layers)
update_sliders(m_canvas->get_current_print_zs(true)); update_sliders(m_canvas->get_current_print_zs(true));
m_loaded = true; m_loaded = true;

View File

@ -557,6 +557,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
else if (opt_key.compare("display_orientation") == 0) { else if (opt_key.compare("display_orientation") == 0) {
ret = static_cast<int>(config.option<ConfigOptionEnum<SLADisplayOrientation>>(opt_key)->value); ret = static_cast<int>(config.option<ConfigOptionEnum<SLADisplayOrientation>>(opt_key)->value);
} }
else if (opt_key.compare("support_pillar_connection_mode") == 0) {
ret = static_cast<int>(config.option<ConfigOptionEnum<SLAPillarConnectionMode>>(opt_key)->value);
}
} }
break; break;
case coPoints: case coPoints:

View File

@ -410,6 +410,7 @@ const std::vector<std::string>& Preset::sla_print_options()
"support_head_penetration", "support_head_penetration",
"support_head_width", "support_head_width",
"support_pillar_diameter", "support_pillar_diameter",
"support_pillar_connection_mode",
"support_pillar_widening_factor", "support_pillar_widening_factor",
"support_base_diameter", "support_base_diameter",
"support_base_height", "support_base_height",

View File

@ -3161,6 +3161,7 @@ void TabSLAPrint::build()
optgroup = page->new_optgroup(_(L("Support pillar"))); optgroup = page->new_optgroup(_(L("Support pillar")));
optgroup->append_single_option_line("support_pillar_diameter"); optgroup->append_single_option_line("support_pillar_diameter");
optgroup->append_single_option_line("support_pillar_connection_mode");
optgroup->append_single_option_line("support_pillar_widening_factor"); optgroup->append_single_option_line("support_pillar_widening_factor");
optgroup->append_single_option_line("support_base_diameter"); optgroup->append_single_option_line("support_base_diameter");
optgroup->append_single_option_line("support_base_height"); optgroup->append_single_option_line("support_base_height");

View File

@ -9,9 +9,12 @@
#include <wx/numformatter.h> #include <wx/numformatter.h>
#include "BitmapCache.hpp" #include "BitmapCache.hpp"
#include "GUI.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "GUI_ObjectList.hpp" #include "GUI_ObjectList.hpp"
using Slic3r::GUI::from_u8;
wxDEFINE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent); wxDEFINE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);
wxDEFINE_EVENT(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, wxCommandEvent); wxDEFINE_EVENT(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, wxCommandEvent);
@ -37,7 +40,7 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
std::function<void(wxCommandEvent& event)> cb, const std::string& icon, wxEvtHandler* event_handler) std::function<void(wxCommandEvent& event)> cb, const std::string& icon, wxEvtHandler* event_handler)
{ {
const wxBitmap& bmp = !icon.empty() ? wxBitmap(wxString::FromUTF8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG) : wxNullBitmap; const wxBitmap& bmp = !icon.empty() ? wxBitmap(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG) : wxNullBitmap;
return append_menu_item(menu, id, string, description, cb, bmp, event_handler); return append_menu_item(menu, id, string, description, cb, bmp, event_handler);
} }
@ -48,7 +51,7 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin
wxMenuItem* item = new wxMenuItem(menu, id, string, description); wxMenuItem* item = new wxMenuItem(menu, id, string, description);
if (!icon.empty()) if (!icon.empty())
item->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG)); item->SetBitmap(wxBitmap(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG));
item->SetSubMenu(sub_menu); item->SetSubMenu(sub_menu);
menu->Append(item); menu->Append(item);

View File

@ -330,7 +330,7 @@ public:
{ {
if (GetChildCount() == 0) if (GetChildCount() == 0)
return; return;
for (size_t id = GetChildCount() - 1; id >= 0; --id) for (int id = int(GetChildCount()) - 1; id >= 0; --id)
{ {
if (m_children.Item(id)->GetChildCount() > 0) if (m_children.Item(id)->GetChildCount() > 0)
m_children[id]->RemoveAllChildren(); m_children[id]->RemoveAllChildren();