mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 04:08:02 -06:00
Merge remote-tracking branch 'remote/master' into feature/merge_upstream
# Conflicts: # bbl/i18n/OrcaSlicer.pot # bbl/i18n/de/OrcaSlicer_de.po # bbl/i18n/en/OrcaSlicer_en.po # bbl/i18n/es/OrcaSlicer_es.po # bbl/i18n/fr/OrcaSlicer_fr.po # bbl/i18n/hu/OrcaSlicer_hu.po # bbl/i18n/it/OrcaSlicer_it.po # bbl/i18n/ja/OrcaSlicer_ja.po # bbl/i18n/nl/OrcaSlicer_nl.po # bbl/i18n/sv/OrcaSlicer_sv.po # bbl/i18n/zh_cn/OrcaSlicer_zh_CN.po # resources/config.json # resources/i18n/de/BambuStudio.mo # resources/i18n/en/BambuStudio.mo # resources/i18n/es/BambuStudio.mo # resources/i18n/fr/BambuStudio.mo # resources/i18n/hu/BambuStudio.mo # resources/i18n/it/BambuStudio.mo # resources/i18n/ja/OrcaSlicer.mo # resources/i18n/nl/BambuStudio.mo # resources/i18n/sv/BambuStudio.mo # resources/i18n/zh_cn/BambuStudio.mo # resources/images/ams_humidity_2.svg # resources/images/ams_humidity_3.svg # resources/images/ams_humidity_4.svg # resources/images/ams_humidity_tips.svg # resources/images/monitor_state_on.svg # resources/images/sdcard_state_normal.svg # resources/profiles/BBL.json # resources/profiles/BBL/filament/Bambu PETG-CF @base.json # resources/profiles/BBL/filament/Generic PETG-CF @base.json # resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json # resources/web/data/text.js # resources/web/guide/3/index.html # resources/web/guide/31/index.html # src/BambuStudio.cpp # src/libslic3r/AABBTreeLines.hpp # src/libslic3r/Brim.cpp # src/libslic3r/CMakeLists.txt # src/libslic3r/ExPolygon.hpp # src/libslic3r/Fill/FillBase.hpp # src/libslic3r/Format/bbs_3mf.cpp # src/libslic3r/GCodeWriter.cpp # src/libslic3r/Line.hpp # src/libslic3r/PerimeterGenerator.cpp # src/libslic3r/Preset.cpp # src/libslic3r/Print.cpp # src/libslic3r/Print.hpp # src/libslic3r/PrintConfig.cpp # src/libslic3r/PrintConfig.hpp # src/libslic3r/TreeSupport.cpp # src/slic3r/GUI/AmsMappingPopup.cpp # src/slic3r/GUI/BackgroundSlicingProcess.cpp # src/slic3r/GUI/ConfigManipulation.cpp # src/slic3r/GUI/GCodeViewer.cpp # src/slic3r/GUI/GCodeViewer.hpp # src/slic3r/GUI/GLCanvas3D.cpp # src/slic3r/GUI/GUI_App.cpp # src/slic3r/GUI/MainFrame.cpp # src/slic3r/GUI/PartPlate.cpp # src/slic3r/GUI/Plater.cpp # src/slic3r/GUI/Preferences.cpp # src/slic3r/GUI/SelectMachine.cpp # src/slic3r/GUI/Widgets/AMSControl.cpp # src/slic3r/GUI/wxMediaCtrl2.cpp # src/slic3r/Utils/Process.cpp # version.inc
This commit is contained in:
commit
9f598046d1
658 changed files with 70312 additions and 4877 deletions
|
@ -12,6 +12,8 @@
|
|||
#include <boost/nowide/cstdio.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <fast_float/fast_float.h>
|
||||
|
||||
#include <float.h>
|
||||
#include <assert.h>
|
||||
#include <regex>
|
||||
|
@ -1929,6 +1931,95 @@ template<typename T>
|
|||
}
|
||||
}
|
||||
|
||||
int GCodeProcessor::get_gcode_last_filament(const std::string& gcode_str)
|
||||
{
|
||||
int str_size = gcode_str.size();
|
||||
int start_index = 0;
|
||||
int end_index = 0;
|
||||
int out_filament = -1;
|
||||
while (end_index < str_size) {
|
||||
if (gcode_str[end_index] != '\n') {
|
||||
end_index++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (end_index > start_index) {
|
||||
std::string line_str = gcode_str.substr(start_index, end_index - start_index);
|
||||
line_str.erase(0, line_str.find_first_not_of(" "));
|
||||
line_str.erase(line_str.find_last_not_of(" ") + 1);
|
||||
if (line_str.empty() || line_str[0] != 'T') {
|
||||
start_index = end_index + 1;
|
||||
end_index = start_index;
|
||||
continue;
|
||||
}
|
||||
|
||||
int out = -1;
|
||||
if (parse_number(line_str.substr(1), out) && out >= 0 && out < 255)
|
||||
out_filament = out;
|
||||
}
|
||||
|
||||
start_index = end_index + 1;
|
||||
end_index = start_index;
|
||||
}
|
||||
|
||||
return out_filament;
|
||||
}
|
||||
|
||||
//BBS: get last z position from gcode
|
||||
bool GCodeProcessor::get_last_z_from_gcode(const std::string& gcode_str, double& z)
|
||||
{
|
||||
int str_size = gcode_str.size();
|
||||
int start_index = 0;
|
||||
int end_index = 0;
|
||||
bool is_z_changed = false;
|
||||
while (end_index < str_size) {
|
||||
//find a full line
|
||||
if (gcode_str[end_index] != '\n') {
|
||||
end_index++;
|
||||
continue;
|
||||
}
|
||||
//parse the line
|
||||
if (end_index > start_index) {
|
||||
std::string line_str = gcode_str.substr(start_index, end_index - start_index);
|
||||
line_str.erase(0, line_str.find_first_not_of(" "));
|
||||
line_str.erase(line_str.find_last_not_of(";") + 1);
|
||||
line_str.erase(line_str.find_last_not_of(" ") + 1);
|
||||
|
||||
//command which may have z movement
|
||||
if (line_str.size() > 5 && (line_str.find("G0 ") == 0
|
||||
|| line_str.find("G1 ") == 0
|
||||
|| line_str.find("G2 ") == 0
|
||||
|| line_str.find("G3 ") == 0))
|
||||
{
|
||||
auto z_pos = line_str.find(" Z");
|
||||
double temp_z = 0;
|
||||
if (z_pos != line_str.npos
|
||||
&& z_pos + 2 < line_str.size()) {
|
||||
// Try to parse the numeric value.
|
||||
std::string z_sub = line_str.substr(z_pos + 2);
|
||||
char* c = &z_sub[0];
|
||||
char* end = c + sizeof(z_sub.c_str());
|
||||
|
||||
auto is_end_of_word = [](char c) {
|
||||
return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0 || c == ';';
|
||||
};
|
||||
|
||||
auto [pend, ec] = fast_float::from_chars(c, end, temp_z);
|
||||
if (pend != c && is_end_of_word(*pend)) {
|
||||
// The axis value has been parsed correctly.
|
||||
z = temp_z;
|
||||
is_z_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//loop to handle next line
|
||||
start_index = end_index + 1;
|
||||
end_index = start_index;
|
||||
}
|
||||
return is_z_changed;
|
||||
}
|
||||
|
||||
void GCodeProcessor::process_tags(const std::string_view comment, bool producers_enabled)
|
||||
{
|
||||
// producers tags
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue