mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-12 11:37:42 +00:00
Merge remote-tracking branch 'upstream/main' into libvgcode
# Conflicts: # src/libslic3r/GCode/GCodeProcessor.cpp # src/libslic3r/GCode/GCodeProcessor.hpp # src/slic3r/CMakeLists.txt # src/slic3r/GUI/GCodeViewer.cpp # src/slic3r/GUI/GCodeViewer.hpp # src/slic3r/GUI/GLCanvas3D.cpp # src/slic3r/GUI/GLCanvas3D.hpp # src/slic3r/GUI/GUI_Preview.cpp
This commit is contained in:
@@ -65,9 +65,13 @@
|
||||
#define CLI_OBJECT_COLLISION_IN_SEQ_PRINT -63
|
||||
#define CLI_OBJECT_COLLISION_IN_LAYER_PRINT -64
|
||||
#define CLI_SPIRAL_MODE_INVALID_PARAMS -65
|
||||
#define CLI_FILAMENT_CAN_NOT_MAP -66
|
||||
#define CLI_ONLY_ONE_TPU_SUPPORTED -67
|
||||
#define CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER -68
|
||||
|
||||
#define CLI_SLICING_ERROR -100
|
||||
#define CLI_GCODE_PATH_CONFLICTS -101
|
||||
#define CLI_GCODE_PATH_IN_UNPRINTABLE_AREA -102
|
||||
|
||||
|
||||
namespace boost { namespace filesystem { class directory_entry; }}
|
||||
@@ -130,6 +134,29 @@ inline DataType round_divide(DataType dividend, DataType divisor) //!< Return di
|
||||
return (dividend + divisor / 2) / divisor;
|
||||
}
|
||||
|
||||
template <typename From, typename To>
|
||||
std::vector<To> convert_vector(const std::vector<From>& src) {
|
||||
std::vector<To> dst;
|
||||
dst.reserve(src.size());
|
||||
for (const auto& elem : src) {
|
||||
if constexpr (std::is_signed_v<To>) {
|
||||
if (elem > static_cast<From>(std::numeric_limits<To>::max())) {
|
||||
throw std::overflow_error("Source value exceeds destination maximum");
|
||||
}
|
||||
if (elem < static_cast<From>(std::numeric_limits<To>::min())) {
|
||||
throw std::underflow_error("Source value below destination minimum");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (elem < 0) {
|
||||
throw std::invalid_argument("Negative value in source for unsigned destination");
|
||||
}
|
||||
}
|
||||
dst.push_back(static_cast<To>(elem));
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
// Set a path with GUI localization files.
|
||||
void set_local_dir(const std::string &path);
|
||||
// Return a full path to the localization directory.
|
||||
@@ -179,6 +206,7 @@ extern size_t get_utf8_sequence_length(const char *seq, size_t size);
|
||||
extern local_encoded_string encode_path(const char *src);
|
||||
extern std::string decode_path(const char *src);
|
||||
extern std::string normalize_utf8_nfc(const char *src);
|
||||
extern std::vector<std::string> split_string(const std::string &str, char delimiter);
|
||||
|
||||
// Safely rename a file even if the target exists.
|
||||
// On Windows, the file explorer (or anti-virus or whatever else) often locks the file
|
||||
@@ -200,7 +228,7 @@ CopyFileResult copy_file_inner(const std::string &from, const std::string &to, s
|
||||
// of the source file before renaming.
|
||||
// Additional error info is passed in error message.
|
||||
extern CopyFileResult copy_file(const std::string &from, const std::string &to, std::string& error_message, const bool with_check = false);
|
||||
|
||||
extern bool copy_framework(const std::string &from, const std::string &to);
|
||||
// Compares two files if identical.
|
||||
extern CopyFileResult check_copy(const std::string& origin, const std::string& copy);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user