diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index c9136af7a4..91771220ba 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -984,7 +984,7 @@ namespace DoExport { unsigned int initial_extruder_id, PrintStatistics &print_statistics, bool export_binary_data, - BinaryGCode::BinaryData &binary_data) + bgcode::BinaryData &binary_data) #else static std::string update_print_stats_and_format_filament_stats( const bool has_wipe_tower, @@ -1132,7 +1132,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato // 1) generate the thumbnails // 2) collect the config data if (export_to_binary_gcode) { - BinaryGCode::BinaryData& binary_data = m_processor.get_binary_data(); + bgcode::BinaryData& binary_data = m_processor.get_binary_data(); // Unit tests or command line slicing may not define "thumbnails" or "thumbnails_format". // If "thumbnails_format" is not defined, export to PNG. @@ -1146,11 +1146,11 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato } // file data - binary_data.file_metadata.encoding_type = (uint16_t)BinaryGCode::EMetadataEncodingType::INI; + binary_data.file_metadata.encoding_type = (uint16_t)bgcode::EMetadataEncodingType::INI; binary_data.file_metadata.raw_data.emplace_back("Producer", std::string(SLIC3R_APP_NAME) + " " + std::string(SLIC3R_VERSION)); // config data - binary_data.slicer_metadata.encoding_type = (uint16_t)BinaryGCode::EMetadataEncodingType::INI; + binary_data.slicer_metadata.encoding_type = (uint16_t)bgcode::EMetadataEncodingType::INI; encode_full_config(print, binary_data.slicer_metadata.raw_data); // printer data @@ -1613,7 +1613,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato file.write(filament_stats_string_out); if (export_to_binary_gcode) { - BinaryGCode::BinaryData& binary_data = m_processor.get_binary_data(); + bgcode::BinaryData& binary_data = m_processor.get_binary_data(); if (print.m_print_statistics.total_toolchanges > 0) binary_data.print_metadata.raw_data.push_back({ "total toolchanges", std::to_string(print.m_print_statistics.total_toolchanges) }); } diff --git a/src/libslic3r/GCode/GCodeBinarizer.cpp b/src/libslic3r/GCode/GCodeBinarizer.cpp index e8bd9bffed..1a4748bad9 100644 --- a/src/libslic3r/GCode/GCodeBinarizer.cpp +++ b/src/libslic3r/GCode/GCodeBinarizer.cpp @@ -19,7 +19,7 @@ extern "C" { #include #include -namespace BinaryGCode { +namespace bgcode { static size_t g_checksum_max_cache_size = 65536; static constexpr const size_t MAX_GCODE_CACHE_SIZE = 65536; @@ -1959,5 +1959,5 @@ EResult from_binary_to_ascii(FILE& src_file, FILE& dst_file, bool verify_checksu } #endif // ENABLE_FILE_CONVERSION_INTERFACE -} // namespace BinaryGCode +} // namespace bgcode diff --git a/src/libslic3r/GCode/GCodeBinarizer.hpp b/src/libslic3r/GCode/GCodeBinarizer.hpp index 05733cd51a..2961fe548f 100644 --- a/src/libslic3r/GCode/GCodeBinarizer.hpp +++ b/src/libslic3r/GCode/GCodeBinarizer.hpp @@ -14,7 +14,7 @@ #include #include -namespace BinaryGCode { +namespace bgcode { static const std::array MAGIC{ 'G', 'C', 'D', 'E' }; static const uint32_t VERSION = 1; @@ -48,7 +48,7 @@ enum class EResult : uint16_t }; // Returns a string description of the given result -extern std::string translate_result(BinaryGCode::EResult result); +extern std::string translate_result(EResult result); enum class EChecksumType : uint16_t { @@ -377,6 +377,6 @@ extern EResult from_ascii_to_binary(FILE& src_file, FILE& dst_file); extern EResult from_binary_to_ascii(FILE& src_file, FILE& dst_file, bool verify_checksum); #endif // ENABLE_FILE_CONVERSION_INTERFACE -} // namespace BinaryGCode +} // namespace bgcode #endif // slic3r_GCode_GCodeBinarizer_hpp_ diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index e72745fac1..6c0fb8c2cf 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -70,7 +70,7 @@ const float GCodeProcessor::Wipe_Width = 0.05f; const float GCodeProcessor::Wipe_Height = 0.05f; #if ENABLE_BINARIZED_GCODE -BinaryGCode::BinarizerConfig GCodeProcessor::s_binarizer_config{}; +bgcode::BinarizerConfig GCodeProcessor::s_binarizer_config{}; #endif // ENABLE_BINARIZED #if ENABLE_GCODE_VIEWER_DATA_CHECKING @@ -1041,7 +1041,7 @@ void GCodeProcessor::process_file(const std::string& filename, std::function& item) { return item.first == "Producer"; }); if (producer_it != file_metadata_block.raw_data.end() && boost::starts_with(producer_it->second, std::string(SLIC3R_APP_NAME))) @@ -1174,15 +1174,15 @@ void GCodeProcessor::process_binary_file(const std::string& filename, std::funct m_producer = EProducer::Unknown; // read printer metadata block - res = BinaryGCode::read_next_block_header(*file, file_header, block_header, verify_checksum); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); - if ((BinaryGCode::EBlockType)block_header.type != BinaryGCode::EBlockType::PrinterMetadata) + res = bgcode::read_next_block_header(*file, file_header, block_header, verify_checksum); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); + if ((bgcode::EBlockType)block_header.type != bgcode::EBlockType::PrinterMetadata) throw Slic3r::RuntimeError("Unable to find printer metadata block in file: " + filename + "\n"); - BinaryGCode::PrinterMetadataBlock printer_metadata_block; + bgcode::PrinterMetadataBlock printer_metadata_block; res = printer_metadata_block.read_data(*file, file_header, block_header); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); #if ENABLE_BINARIZED_GCODE_DEBUG OutputDebugStringA("Printer metadata:\n"); for (const auto& [key, value] : printer_metadata_block.raw_data) { @@ -1194,25 +1194,25 @@ void GCodeProcessor::process_binary_file(const std::string& filename, std::funct #endif // ENABLE_BINARIZED_GCODE_DEBUG // read thumbnail blocks - res = BinaryGCode::read_next_block_header(*file, file_header, block_header, verify_checksum); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); + res = bgcode::read_next_block_header(*file, file_header, block_header, verify_checksum); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); - while ((BinaryGCode::EBlockType)block_header.type == BinaryGCode::EBlockType::Thumbnail) { - BinaryGCode::ThumbnailBlock thumbnail_block; + while ((bgcode::EBlockType)block_header.type == bgcode::EBlockType::Thumbnail) { + bgcode::ThumbnailBlock thumbnail_block; res = thumbnail_block.read_data(*file, file_header, block_header); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); #if ENABLE_BINARIZED_GCODE_DEBUG if (thumbnail_block.data.size() > 0) { - auto format_filename = [](const std::string& stem, const BinaryGCode::ThumbnailBlock& block) { + auto format_filename = [](const std::string& stem, const bgcode::ThumbnailBlock& block) { std::string ret = stem + "_" + std::to_string(block.width) + "x" + std::to_string(block.height); - switch ((BinaryGCode::EThumbnailFormat)block.format) + switch ((bgcode::EThumbnailFormat)block.format) { - case BinaryGCode::EThumbnailFormat::PNG: { ret += ".png"; break; } - case BinaryGCode::EThumbnailFormat::JPG: { ret += ".jpg"; break; } - case BinaryGCode::EThumbnailFormat::QOI: { ret += ".qoi"; break; } + case bgcode::EThumbnailFormat::PNG: { ret += ".png"; break; } + case bgcode::EThumbnailFormat::JPG: { ret += ".jpg"; break; } + case bgcode::EThumbnailFormat::QOI: { ret += ".qoi"; break; } } return ret; }; @@ -1228,18 +1228,18 @@ void GCodeProcessor::process_binary_file(const std::string& filename, std::funct } #endif // ENABLE_BINARIZED_GCODE_DEBUG - res = BinaryGCode::read_next_block_header(*file, file_header, block_header, verify_checksum); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); + res = bgcode::read_next_block_header(*file, file_header, block_header, verify_checksum); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); } // read print metadata block - if ((BinaryGCode::EBlockType)block_header.type != BinaryGCode::EBlockType::PrintMetadata) + if ((bgcode::EBlockType)block_header.type != bgcode::EBlockType::PrintMetadata) throw Slic3r::RuntimeError("Unable to find print metadata block in file: " + filename + "\n"); - BinaryGCode::PrintMetadataBlock print_metadata_block; + bgcode::PrintMetadataBlock print_metadata_block; res = print_metadata_block.read_data(*file, file_header, block_header); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); #if ENABLE_BINARIZED_GCODE_DEBUG OutputDebugStringA("Print metadata:\n"); for (const auto& [key, value] : print_metadata_block.raw_data) { @@ -1251,15 +1251,15 @@ void GCodeProcessor::process_binary_file(const std::string& filename, std::funct #endif // ENABLE_BINARIZED_GCODE_DEBUG // read slicer metadata block - res = BinaryGCode::read_next_block_header(*file, file_header, block_header, verify_checksum); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); - if ((BinaryGCode::EBlockType)block_header.type != BinaryGCode::EBlockType::SlicerMetadata) + res = bgcode::read_next_block_header(*file, file_header, block_header, verify_checksum); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); + if ((bgcode::EBlockType)block_header.type != bgcode::EBlockType::SlicerMetadata) throw Slic3r::RuntimeError("Unable to find slicer metadata block in file: " + filename + "\n"); - BinaryGCode::SlicerMetadataBlock slicer_metadata_block; + bgcode::SlicerMetadataBlock slicer_metadata_block; res = slicer_metadata_block.read_data(*file, file_header, block_header); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); #if ENABLE_BINARIZED_GCODE_DEBUG OutputDebugStringA("Slicer metadata:\n"); for (const auto& [key, value] : slicer_metadata_block.raw_data) { @@ -1286,16 +1286,16 @@ void GCodeProcessor::process_binary_file(const std::string& filename, std::funct initialize_result_moves(); // read gcodes block - res = BinaryGCode::read_next_block_header(*file, file_header, block_header, verify_checksum); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); - if ((BinaryGCode::EBlockType)block_header.type != BinaryGCode::EBlockType::GCode) + res = bgcode::read_next_block_header(*file, file_header, block_header, verify_checksum); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); + if ((bgcode::EBlockType)block_header.type != bgcode::EBlockType::GCode) throw Slic3r::RuntimeError("Unable to find gcode block in file: " + filename + "\n"); - while ((BinaryGCode::EBlockType)block_header.type == BinaryGCode::EBlockType::GCode) { - BinaryGCode::GCodeBlock block; + while ((bgcode::EBlockType)block_header.type == bgcode::EBlockType::GCode) { + bgcode::GCodeBlock block; res = block.read_data(*file, file_header, block_header); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); // TODO: Update m_result.lines_ends @@ -1306,9 +1306,9 @@ void GCodeProcessor::process_binary_file(const std::string& filename, std::funct if (ftell(file) == file_size) break; - res = BinaryGCode::read_next_block_header(*file, file_header, block_header, verify_checksum); - if (res != BinaryGCode::EResult::Success) - throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + BinaryGCode::translate_result(res) + "\n"); + res = bgcode::read_next_block_header(*file, file_header, block_header, verify_checksum); + if (res != bgcode::EResult::Success) + throw Slic3r::RuntimeError("Error while reading file: " + filename + ": " + bgcode::translate_result(res) + "\n"); } // Don't post-process the G-code to update time stamps. @@ -3696,7 +3696,7 @@ void GCodeProcessor::post_process() }; // update binary data - BinaryGCode::BinaryData& binary_data = m_binarizer.get_binary_data(); + bgcode::BinaryData& binary_data = m_binarizer.get_binary_data(); binary_data.print_metadata.raw_data.push_back({ PrintStatistics::FilamentUsedMm, stringify(filament_mm) }); binary_data.print_metadata.raw_data.push_back({ PrintStatistics::FilamentUsedCm3, stringify(filament_cm3) }); binary_data.print_metadata.raw_data.push_back({ PrintStatistics::FilamentUsedG, stringify(filament_g) }); @@ -3720,8 +3720,8 @@ void GCodeProcessor::post_process() } } - const BinaryGCode::EResult res = m_binarizer.initialize(*out.f, s_binarizer_config); - if (res != BinaryGCode::EResult::Success) + const bgcode::EResult res = m_binarizer.initialize(*out.f, s_binarizer_config); + if (res != bgcode::EResult::Success) throw Slic3r::RuntimeError(std::string("Unable to initialize the gcode binarizer.\n")); } #endif // ENABLE_BINARIZED_GCODE @@ -3843,12 +3843,12 @@ void GCodeProcessor::post_process() size_t m_out_file_pos{ 0 }; #if ENABLE_BINARIZED_GCODE - BinaryGCode::Binarizer& m_binarizer; + bgcode::Binarizer& m_binarizer; #endif // ENABLE_BINARIZED_GCODE public: #if ENABLE_BINARIZED_GCODE - ExportLines(BinaryGCode::Binarizer& binarizer, EWriteType type, TimeMachine& machine) + ExportLines(bgcode::Binarizer& binarizer, EWriteType type, TimeMachine& machine) #ifndef NDEBUG : m_statistics(*this), m_binarizer(binarizer), m_write_type(type), m_machine(machine) {} #else @@ -3974,8 +3974,8 @@ void GCodeProcessor::post_process() #if ENABLE_BINARIZED_GCODE if (m_binarizer.is_enabled()) { - BinaryGCode::EResult res = m_binarizer.append_gcode(out_string); - if (res != BinaryGCode::EResult::Success) + bgcode::EResult res = m_binarizer.append_gcode(out_string); + if (res != bgcode::EResult::Success) throw Slic3r::RuntimeError(std::string("Error while sending gcode to the binarizer.\n")); } else @@ -4011,8 +4011,8 @@ void GCodeProcessor::post_process() #if ENABLE_BINARIZED_GCODE if (m_binarizer.is_enabled()) { - BinaryGCode::EResult res = m_binarizer.append_gcode(out_string); - if (res != BinaryGCode::EResult::Success) + bgcode::EResult res = m_binarizer.append_gcode(out_string); + if (res != bgcode::EResult::Success) throw Slic3r::RuntimeError(std::string("Error while sending gcode to the binarizer.\n")); } else @@ -4391,8 +4391,8 @@ void GCodeProcessor::post_process() #if ENABLE_BINARIZED_GCODE if (m_binarizer.is_enabled()) { - const BinaryGCode::EResult res = m_binarizer.finalize(); - if (res != BinaryGCode::EResult::Success) + const bgcode::EResult res = m_binarizer.finalize(); + if (res != bgcode::EResult::Success) throw Slic3r::RuntimeError(std::string("Error while finalizing the gcode binarizer.\n")); } #endif // ENABLE_BINARIZED_GCODE diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 333f3295e6..b3390ed1c6 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -528,14 +528,14 @@ namespace Slic3r { #endif // ENABLE_GCODE_VIEWER_DATA_CHECKING #if ENABLE_BINARIZED_GCODE_DEBUG_WINDOW - static BinaryGCode::BinarizerConfig& get_binarizer_config() { return s_binarizer_config; } + static bgcode::BinarizerConfig& get_binarizer_config() { return s_binarizer_config; } #endif // ENABLE_BINARIZED_GCODE_DEBUG_WINDOW private: GCodeReader m_parser; #if ENABLE_BINARIZED_GCODE - BinaryGCode::Binarizer m_binarizer; - static BinaryGCode::BinarizerConfig s_binarizer_config; + bgcode::Binarizer m_binarizer; + static bgcode::BinarizerConfig s_binarizer_config; #endif // ENABLE_BINARIZED_GCODE EUnits m_units; @@ -635,8 +635,8 @@ namespace Slic3r { void apply_config(const PrintConfig& config); void set_print(Print* print) { m_print = print; } #if ENABLE_BINARIZED_GCODE - BinaryGCode::BinaryData& get_binary_data() { return m_binarizer.get_binary_data(); } - const BinaryGCode::BinaryData& get_binary_data() const { return m_binarizer.get_binary_data(); } + bgcode::BinaryData& get_binary_data() { return m_binarizer.get_binary_data(); } + const bgcode::BinaryData& get_binary_data() const { return m_binarizer.get_binary_data(); } #endif // ENABLE_BINARIZED_GCODE void enable_stealth_time_estimator(bool enabled); diff --git a/src/libslic3r/GCode/Thumbnails.hpp b/src/libslic3r/GCode/Thumbnails.hpp index b2b5d60cb1..6fd28af333 100644 --- a/src/libslic3r/GCode/Thumbnails.hpp +++ b/src/libslic3r/GCode/Thumbnails.hpp @@ -60,7 +60,7 @@ inline void export_thumbnails_to_file(ThumbnailsGeneratorCallback &thumbnail_cb, #if ENABLE_BINARIZED_GCODE template -inline void generate_binary_thumbnails(ThumbnailsGeneratorCallback& thumbnail_cb, std::vector& out_thumbnails, +inline void generate_binary_thumbnails(ThumbnailsGeneratorCallback& thumbnail_cb, std::vector& out_thumbnails, const std::vector& sizes, GCodeThumbnailsFormat format, ThrowIfCanceledCallback throw_if_canceled) { out_thumbnails.clear(); @@ -70,13 +70,13 @@ inline void generate_binary_thumbnails(ThumbnailsGeneratorCallback& thumbnail_cb if (data.is_valid()) { auto compressed = compress_thumbnail(data, format); if (compressed->data != nullptr && compressed->size > 0) { - BinaryGCode::ThumbnailBlock& block = out_thumbnails.emplace_back(BinaryGCode::ThumbnailBlock()); + bgcode::ThumbnailBlock& block = out_thumbnails.emplace_back(bgcode::ThumbnailBlock()); block.width = (uint16_t)data.width; block.height = (uint16_t)data.height; switch (format) { - case GCodeThumbnailsFormat::PNG: { block.format = (uint16_t)BinaryGCode::EThumbnailFormat::PNG; break; } - case GCodeThumbnailsFormat::JPG: { block.format = (uint16_t)BinaryGCode::EThumbnailFormat::JPG; break; } - case GCodeThumbnailsFormat::QOI: { block.format = (uint16_t)BinaryGCode::EThumbnailFormat::QOI; break; } + case GCodeThumbnailsFormat::PNG: { block.format = (uint16_t)bgcode::EThumbnailFormat::PNG; break; } + case GCodeThumbnailsFormat::JPG: { block.format = (uint16_t)bgcode::EThumbnailFormat::JPG; break; } + case GCodeThumbnailsFormat::QOI: { block.format = (uint16_t)bgcode::EThumbnailFormat::QOI; break; } } block.data.resize(compressed->size); memcpy(block.data.data(), compressed->data, compressed->size); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index fccacd2c09..be81ea7f1f 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -7874,7 +7874,7 @@ void GLCanvas3D::GizmoHighlighter::blink() #if ENABLE_BINARIZED_GCODE_DEBUG_WINDOW void GLCanvas3D::show_binary_gcode_debug_window() { - BinaryGCode::BinarizerConfig& binarizer_config = GCodeProcessor::get_binarizer_config(); + bgcode::BinarizerConfig& binarizer_config = GCodeProcessor::get_binarizer_config(); ImGuiWrapper& imgui = *wxGetApp().imgui(); imgui.begin(std::string("Binary GCode"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); @@ -7888,7 +7888,7 @@ void GLCanvas3D::show_binary_gcode_debug_window() std::vector options = { "None", "Deflate", "heatshrink 11,4", "heatshrink 12,4" }; int option_id = (int)binarizer_config.compression.file_metadata; if (imgui.combo(std::string("##file_metadata_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f)) - binarizer_config.compression.file_metadata = (BinaryGCode::ECompressionType)option_id; + binarizer_config.compression.file_metadata = (bgcode::ECompressionType)option_id; ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -7896,7 +7896,7 @@ void GLCanvas3D::show_binary_gcode_debug_window() ImGui::TableSetColumnIndex(1); option_id = (int)binarizer_config.compression.printer_metadata; if (imgui.combo(std::string("##printer_metadata_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f)) - binarizer_config.compression.printer_metadata = (BinaryGCode::ECompressionType)option_id; + binarizer_config.compression.printer_metadata = (bgcode::ECompressionType)option_id; ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -7904,7 +7904,7 @@ void GLCanvas3D::show_binary_gcode_debug_window() ImGui::TableSetColumnIndex(1); option_id = (int)binarizer_config.compression.print_metadata; if (imgui.combo(std::string("##print_metadata_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f)) - binarizer_config.compression.print_metadata = (BinaryGCode::ECompressionType)option_id; + binarizer_config.compression.print_metadata = (bgcode::ECompressionType)option_id; ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -7912,7 +7912,7 @@ void GLCanvas3D::show_binary_gcode_debug_window() ImGui::TableSetColumnIndex(1); option_id = (int)binarizer_config.compression.slicer_metadata; if (imgui.combo(std::string("##slicer_metadata_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f)) - binarizer_config.compression.slicer_metadata = (BinaryGCode::ECompressionType)option_id; + binarizer_config.compression.slicer_metadata = (bgcode::ECompressionType)option_id; ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -7920,7 +7920,7 @@ void GLCanvas3D::show_binary_gcode_debug_window() ImGui::TableSetColumnIndex(1); option_id = (int)binarizer_config.compression.gcode; if (imgui.combo(std::string("##gcode_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f)) - binarizer_config.compression.gcode = (BinaryGCode::ECompressionType)option_id; + binarizer_config.compression.gcode = (bgcode::ECompressionType)option_id; ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -7929,7 +7929,7 @@ void GLCanvas3D::show_binary_gcode_debug_window() options = { "None", "MeatPack", "MeatPack Comments" }; option_id = (int)binarizer_config.gcode_encoding; if (imgui.combo(std::string("##gcode_encoding"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f)) - binarizer_config.gcode_encoding = (BinaryGCode::EGCodeEncodingType)option_id; + binarizer_config.gcode_encoding = (bgcode::EGCodeEncodingType)option_id; ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -7938,7 +7938,7 @@ void GLCanvas3D::show_binary_gcode_debug_window() options = { "INI" }; option_id = (int)binarizer_config.metadata_encoding; if (imgui.combo(std::string("##metadata_encoding"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f)) - binarizer_config.metadata_encoding = (BinaryGCode::EMetadataEncodingType)option_id; + binarizer_config.metadata_encoding = (bgcode::EMetadataEncodingType)option_id; ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -7947,7 +7947,7 @@ void GLCanvas3D::show_binary_gcode_debug_window() options = { "None", "CRC32" }; option_id = (int)binarizer_config.checksum; if (imgui.combo(std::string("##4"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f)) - binarizer_config.checksum = (BinaryGCode::EChecksumType)option_id; + binarizer_config.checksum = (bgcode::EChecksumType)option_id; ImGui::EndTable(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 355ff79f6a..22076aadff 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5442,6 +5442,9 @@ void Plater::convert_gcode_to_ascii() public: explicit ScopedFile(FILE* file) : m_file(file) {} ~ScopedFile() { if (m_file != nullptr) fclose(m_file); } +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + void unscope() { m_file = nullptr; } +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ private: FILE* m_file{ nullptr }; }; @@ -5471,10 +5474,15 @@ void Plater::convert_gcode_to_ascii() // Perform conversion { wxBusyCursor busy; - BinaryGCode::EResult res = BinaryGCode::from_binary_to_ascii(*in_file, *out_file, true); - if (res != BinaryGCode::EResult::Success) { - MessageDialog msg_dlg(this, _L(BinaryGCode::translate_result(res)), _L("Error converting gcode file"), wxICON_INFORMATION | wxOK); + bgcode::EResult res = bgcode::from_binary_to_ascii(*in_file, *out_file, true); + if (res != bgcode::EResult::Success) { + MessageDialog msg_dlg(this, _L(bgcode::translate_result(res)), _L("Error converting gcode file"), wxICON_INFORMATION | wxOK); msg_dlg.ShowModal(); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + scoped_out_file.unscope(); + fclose(out_file); + boost::nowide::remove(output_file.c_str()); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ return; } }