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
path: root/src
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2021-11-16 21:37:34 +0300
committersupermerill <merill@free.fr>2021-11-16 21:37:34 +0300
commit00ac854325f97bd9719a64d8da1f77bea4b3c12f (patch)
tree68e6cc0ce5c611060d88d02832637945cab058cc /src
parent8226e4608b2f0af55c62f45fe8c95523baf395dd (diff)
add current_position variable for gcode macro
current_position[0] is x and current_position[1] is y supermerill/SuperSlicer#1898
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/GCode.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
index e1fd3d58a..71af0bf19 100644
--- a/src/libslic3r/GCode.cpp
+++ b/src/libslic3r/GCode.cpp
@@ -1399,6 +1399,10 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
m_placeholder_parser.set("first_layer_print_max", new ConfigOptionFloats({ bbox.max.x(), bbox.max.y() }));
m_placeholder_parser.set("first_layer_print_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() }));
}
+ //misc
+ if (config().thumbnails_color.value.length() == 7) {
+ m_placeholder_parser.set("thumbnails_color_int", new ConfigOptionInt((int)strtol(config().thumbnails_color.value.substr(1, 6).c_str(), NULL, 16)));
+ }
std::string start_gcode = this->placeholder_parser_process("start_gcode", print.config().start_gcode.value, initial_extruder_id);
// Set bed temperature if the start G-code does not contain any bed temp control G-codes.
@@ -1743,7 +1747,7 @@ std::string GCode::placeholder_parser_process(const std::string &name, const std
func_add_colour("filament_colour_int", config().filament_colour.values[current_extruder_id]);
func_add_colour("extruder_colour_int", config().extruder_colour.values[current_extruder_id]);
}
- func_add_colour("thumbnails_color_int", config().thumbnails_color);
+ config_override->set_key_value("current_position", new ConfigOptionFloats({ unscaled(m_last_pos.x()), unscaled(m_last_pos.y()) }));
std::string gcode = m_placeholder_parser.process(templ, current_extruder_id, config_override, &m_placeholder_parser_context);
if (!gcode.empty() && (m_config.gcode_comments || m_config.fan_speedup_time.value != 0 || m_config.fan_kickstart.value != 0 )) {