Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2018-02-22 10:59:47 +0300
committerEnrico Turri <enricoturri@seznam.cz>2018-02-22 10:59:47 +0300
commit81eff20ad193be012450f8f8d08f0e90fd5a62e8 (patch)
tree0f07cf0c87f77020b6bb42f0d88ffe51898fe8c9 /xs/src/libslic3r
parent36601723a208a34fd55ea34c67bd8548246d708d (diff)
GCode Preview - Added Custom extrusion role + extended layers range for GCode preview
Diffstat (limited to 'xs/src/libslic3r')
-rw-r--r--xs/src/libslic3r/ExtrusionEntity.hpp1
-rw-r--r--xs/src/libslic3r/GCode.cpp18
-rw-r--r--xs/src/libslic3r/GCode/Analyzer.cpp6
-rw-r--r--xs/src/libslic3r/GCode/PreviewData.cpp9
4 files changed, 32 insertions, 2 deletions
diff --git a/xs/src/libslic3r/ExtrusionEntity.hpp b/xs/src/libslic3r/ExtrusionEntity.hpp
index f5e243419..16ef51c1f 100644
--- a/xs/src/libslic3r/ExtrusionEntity.hpp
+++ b/xs/src/libslic3r/ExtrusionEntity.hpp
@@ -26,6 +26,7 @@ enum ExtrusionRole {
erSupportMaterial,
erSupportMaterialInterface,
erWipeTower,
+ erCustom,
// Extrusion role for a collection with multiple extrusion roles.
erMixed,
};
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp
index 2c2df6ec3..28c03ba2c 100644
--- a/xs/src/libslic3r/GCode.cpp
+++ b/xs/src/libslic3r/GCode.cpp
@@ -587,6 +587,15 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, true);
// Set extruder(s) temperature before and after start G-code.
this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, false);
+
+ if (m_enable_analyzer)
+ {
+ // adds tag for analyzer
+ char buf[32];
+ sprintf(buf, ";%s%d\n", GCodeAnalyzer::Extrusion_Role_Tag.c_str(), erCustom);
+ _writeln(file, buf);
+ }
+
// Write the custom start G-code
_writeln(file, start_gcode);
// Process filament-specific gcode in extruder order.
@@ -770,6 +779,15 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
// Write end commands to file.
_write(file, this->retract());
_write(file, m_writer.set_fan(false));
+
+ if (m_enable_analyzer)
+ {
+ // adds tag for analyzer
+ char buf[32];
+ sprintf(buf, ";%s%d\n", GCodeAnalyzer::Extrusion_Role_Tag.c_str(), erCustom);
+ _writeln(file, buf);
+ }
+
// Process filament-specific gcode in extruder order.
if (print.config.single_extruder_multi_material) {
// Process the end_filament_gcode for the active filament only.
diff --git a/xs/src/libslic3r/GCode/Analyzer.cpp b/xs/src/libslic3r/GCode/Analyzer.cpp
index f8d196f23..6530806c4 100644
--- a/xs/src/libslic3r/GCode/Analyzer.cpp
+++ b/xs/src/libslic3r/GCode/Analyzer.cpp
@@ -150,7 +150,13 @@ void GCodeAnalyzer::_process_gcode_line(GCodeReader&, const GCodeReader::GCodeLi
{
// processes 'special' comments contained in line
if (_process_tags(line))
+ {
+#if 0
+ // DEBUG ONLY: puts the line back into the gcode
+ m_process_output += line.raw() + "\n";
+#endif
return;
+ }
// sets new start position/extrusion
_set_start_position(_get_end_position());
diff --git a/xs/src/libslic3r/GCode/PreviewData.cpp b/xs/src/libslic3r/GCode/PreviewData.cpp
index 5a23d332d..183e10b2a 100644
--- a/xs/src/libslic3r/GCode/PreviewData.cpp
+++ b/xs/src/libslic3r/GCode/PreviewData.cpp
@@ -125,6 +125,7 @@ const GCodePreviewData::Color GCodePreviewData::Extrusion::Default_Extrusion_Rol
Color(0.0f, 0.5f, 0.0f, 1.0f), // erSupportMaterial
Color(0.0f, 0.0f, 0.5f, 1.0f), // erSupportMaterialInterface
Color(0.7f, 0.89f, 0.67f, 1.0f), // erWipeTower
+ Color(1.0f, 1.0f, 0.0f, 1.0f), // erCustom
Color(0.0f, 0.0f, 0.0f, 1.0f) // erMixed
};
@@ -144,6 +145,7 @@ const std::string GCodePreviewData::Extrusion::Default_Extrusion_Role_Names[Num_
"Support material",
"Support material interface",
"Wipe tower",
+ "Custom",
"Mixed"
};
@@ -360,8 +362,11 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
{
case Extrusion::FeatureType:
{
- items.reserve(erMixed - erPerimeter + 1);
- for (unsigned int i = (unsigned int)erPerimeter; i < (unsigned int)erMixed; ++i)
+ ExtrusionRole first_valid = erPerimeter;
+ ExtrusionRole last_valid = erCustom;
+
+ items.reserve(last_valid - first_valid + 1);
+ for (unsigned int i = (unsigned int)first_valid; i <= (unsigned int)last_valid; ++i)
{
items.emplace_back(extrusion.role_names[i], extrusion.role_colors[i]);
}