mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-11 02:57:39 +00:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
42
src/libslic3r/Format/STEP.hpp
Normal file
42
src/libslic3r/Format/STEP.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef slic3r_Format_STEP_hpp_
|
||||
#define slic3r_Format_STEP_hpp_
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class TriangleMesh;
|
||||
class ModelObject;
|
||||
|
||||
typedef std::function<void(int load_stage, int current, int total, bool& cancel)> ImportStepProgressFn;
|
||||
typedef std::function<void(bool isUtf8)> StepIsUtf8Fn;
|
||||
|
||||
//BBS: Load an step file into a provided model.
|
||||
extern bool load_step(const char *path, Model *model, ImportStepProgressFn proFn = nullptr, StepIsUtf8Fn isUtf8Fn = nullptr);
|
||||
|
||||
//BBS: Used to detect what kind of encoded type is used in name field of step
|
||||
// If is encoded in UTF8, the file don't need to be handled, then return the original path directly.
|
||||
// If is encoded in GBK, then translate to UTF8 and generate a new temporary step file.
|
||||
// If is encoded in Other type, we can't handled, then treat as UTF8. In this case, the name is garbage
|
||||
// characters.
|
||||
// By preprocessing, at least we can avoid garbage characters if the name field is encoded by GBK.
|
||||
class StepPreProcessor {
|
||||
enum class EncodedType : unsigned char
|
||||
{
|
||||
UTF8,
|
||||
GBK,
|
||||
OTHER
|
||||
};
|
||||
|
||||
public:
|
||||
bool preprocess(const char* path, std::string &output_path);
|
||||
static bool isUtf8File(const char* path);
|
||||
private:
|
||||
static bool isUtf8(const std::string str);
|
||||
static bool isGBK(const std::string str);
|
||||
static int preNum(const unsigned char byte);
|
||||
//BBS: default is UTF8 for most step file.
|
||||
EncodedType m_encode_type = EncodedType::UTF8;
|
||||
};
|
||||
|
||||
}; // namespace Slic3r
|
||||
|
||||
#endif /* slic3r_Format_STEP_hpp_ */
|
||||
Reference in New Issue
Block a user