mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 22:24:01 -06:00
Fix of Slicer image not good #4992
Tighter parsing of PrusaSlicer's own G-code annotations to avoid clashes with comments inside user G-codes. Also the GCodeReader was extended to return string_views instead of copying a substring, and the GCodeProcessor was partially adapted to string_views.
This commit is contained in:
parent
d053939994
commit
d2e5be89e3
6 changed files with 103 additions and 121 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include "PrintConfig.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -17,13 +18,13 @@ public:
|
|||
GCodeLine() { reset(); }
|
||||
void reset() { m_mask = 0; memset(m_axis, 0, sizeof(m_axis)); m_raw.clear(); }
|
||||
|
||||
const std::string& raw() const { return m_raw; }
|
||||
const std::string cmd() const {
|
||||
const std::string& raw() const { return m_raw; }
|
||||
const std::string_view cmd() const {
|
||||
const char *cmd = GCodeReader::skip_whitespaces(m_raw.c_str());
|
||||
return std::string(cmd, GCodeReader::skip_word(cmd));
|
||||
return std::string_view(cmd, GCodeReader::skip_word(cmd) - cmd);
|
||||
}
|
||||
const std::string comment() const
|
||||
{ size_t pos = m_raw.find(';'); return (pos == std::string::npos) ? "" : m_raw.substr(pos + 1); }
|
||||
const std::string_view comment() const
|
||||
{ size_t pos = m_raw.find(';'); return (pos == std::string::npos) ? std::string_view() : std::string_view(m_raw).substr(pos + 1); }
|
||||
|
||||
bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; }
|
||||
float value(Axis axis) const { return m_axis[axis]; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue