mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-24 01:01:15 -06:00
GCodeViewer -> Refactoring and code cleanup
This commit is contained in:
parent
6e2307f56d
commit
66964c44c1
8 changed files with 26 additions and 77 deletions
|
|
@ -2328,16 +2328,6 @@ void GCode::process_layer(
|
|||
else if (gcode.find(GCodeAnalyzer::Custom_Code_Tag) != gcode.npos)
|
||||
gcode += "\n; " + GCodeAnalyzer::End_Pause_Print_Or_Custom_Code_Tag + "\n";
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
// add tag for processor
|
||||
if (gcode.find(GCodeProcessor::Pause_Print_Tag) != gcode.npos)
|
||||
gcode += "\n; " + GCodeProcessor::End_Pause_Print_Or_Custom_Code_Tag + "\n";
|
||||
else if (gcode.find(GCodeProcessor::Custom_Code_Tag) != gcode.npos)
|
||||
gcode += "\n; " + GCodeProcessor::End_Pause_Print_Or_Custom_Code_Tag + "\n";
|
||||
#endif // !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
#ifdef HAS_PRESSURE_EQUALIZER
|
||||
// Apply pressure equalization if enabled;
|
||||
// printf("G-code before filter:\n%s\n", gcode.c_str());
|
||||
|
|
|
|||
|
|
@ -24,9 +24,6 @@ const std::string GCodeProcessor::Mm3_Per_Mm_Tag = "_PROCESSOR_MM3_PER_MM:";
|
|||
const std::string GCodeProcessor::Color_Change_Tag = "_PROCESSOR_COLOR_CHANGE";
|
||||
const std::string GCodeProcessor::Pause_Print_Tag = "_PROCESSOR_PAUSE_PRINT";
|
||||
const std::string GCodeProcessor::Custom_Code_Tag = "_PROCESSOR_CUSTOM_CODE";
|
||||
#if !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
const std::string GCodeProcessor::End_Pause_Print_Or_Custom_Code_Tag = "_PROCESSOR_END_PAUSE_PRINT_OR_CUSTOM_CODE";
|
||||
#endif // !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
|
||||
void GCodeProcessor::CachedPosition::reset()
|
||||
{
|
||||
|
|
@ -248,9 +245,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
|||
if (m_extruder_id == extruder_id)
|
||||
{
|
||||
m_cp_color.current = m_extruders_color[extruder_id];
|
||||
#if ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
store_move_vertex(EMoveType::Color_change);
|
||||
#endif // ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
|
|
@ -265,11 +260,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
|||
pos = comment.find(Pause_Print_Tag);
|
||||
if (pos != comment.npos)
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
store_move_vertex(EMoveType::Pause_Print);
|
||||
#else
|
||||
m_cp_color.current = UCHAR_MAX;
|
||||
#endif // ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -277,25 +268,9 @@ void GCodeProcessor::process_tags(const std::string& comment)
|
|||
pos = comment.find(Custom_Code_Tag);
|
||||
if (pos != comment.npos)
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
store_move_vertex(EMoveType::Custom_GCode);
|
||||
#else
|
||||
m_cp_color.current = UCHAR_MAX;
|
||||
#endif // ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
return;
|
||||
}
|
||||
|
||||
#if !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
// end pause print or custom code tag
|
||||
pos = comment.find(End_Pause_Print_Or_Custom_Code_Tag);
|
||||
if (pos != comment.npos)
|
||||
{
|
||||
if (m_cp_color.current == UCHAR_MAX)
|
||||
m_cp_color.current = m_extruders_color[m_extruder_id];
|
||||
|
||||
return;
|
||||
}
|
||||
#endif // !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
}
|
||||
|
||||
void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
||||
|
|
@ -588,10 +563,7 @@ void GCodeProcessor::process_T(const std::string& command)
|
|||
else
|
||||
{
|
||||
m_extruder_id = id;
|
||||
#if !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
if (m_cp_color.current != UCHAR_MAX)
|
||||
#endif // !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
m_cp_color.current = m_extruders_color[id];
|
||||
m_cp_color.current = m_extruders_color[id];
|
||||
}
|
||||
|
||||
// store tool change move
|
||||
|
|
|
|||
|
|
@ -21,9 +21,6 @@ namespace Slic3r {
|
|||
static const std::string Color_Change_Tag;
|
||||
static const std::string Pause_Print_Tag;
|
||||
static const std::string Custom_Code_Tag;
|
||||
#if !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
static const std::string End_Pause_Print_Or_Custom_Code_Tag;
|
||||
#endif // !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
|
||||
private:
|
||||
using AxisCoords = std::array<float, 4>;
|
||||
|
|
@ -64,11 +61,9 @@ namespace Slic3r {
|
|||
Retract,
|
||||
Unretract,
|
||||
Tool_change,
|
||||
#if ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
Color_change,
|
||||
Pause_Print,
|
||||
Custom_GCode,
|
||||
#endif // ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
|
||||
Travel,
|
||||
Extrude,
|
||||
Count
|
||||
|
|
|
|||
|
|
@ -400,7 +400,9 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
|
|||
// and maybe other problems. We will therefore go through layer_tools and detect and fix this.
|
||||
// So, if there is a non-object layer starting with different extruder than the last one ended with (or containing more than one extruder),
|
||||
// we'll mark it with has_wipe tower.
|
||||
assert(! m_layer_tools.empty() && m_layer_tools.front().has_wipe_tower);
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
// assert(! m_layer_tools.empty() && m_layer_tools.front().has_wipe_tower);
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
if (! m_layer_tools.empty() && m_layer_tools.front().has_wipe_tower) {
|
||||
for (size_t i = 0; i + 1 < m_layer_tools.size();) {
|
||||
const LayerTools < = m_layer_tools[i];
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@
|
|||
// Enable G-Code viewer
|
||||
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
|
||||
#define ENABLE_GCODE_VIEWER_DEBUG_OUTPUT (0 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT (1 && ENABLE_GCODE_VIEWER)
|
||||
|
||||
|
||||
#endif // _prusaslicer_technologies_h_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue