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

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2022-02-03 23:58:52 +0300
committerLukas Matena <lukasmatena@seznam.cz>2022-02-23 15:44:26 +0300
commit0a280be8d09b77b3e49cdde0a8298b8d30f6ebc9 (patch)
treeb8d4e86952a5409a83edc1063a72b412775609ef /src/libslic3r
parent3bdc6e49c1249bf8a88acfb7a93a8fe19dcfc67a (diff)
Placeholder parser fixes
Diffstat (limited to 'src/libslic3r')
-rw-r--r--src/libslic3r/GCode.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
index fb6dee37b..9ce55d0bb 100644
--- a/src/libslic3r/GCode.cpp
+++ b/src/libslic3r/GCode.cpp
@@ -274,7 +274,6 @@ namespace Slic3r {
// Otherwise, leave control to the user completely.
std::string toolchange_gcode_str;
const std::string& toolchange_gcode = gcodegen.config().toolchange_gcode.value;
-// m_max_layer_z = std::max(m_max_layer_z, tcr.print_z);
if (! toolchange_gcode.empty()) {
DynamicConfig config;
int previous_extruder_id = gcodegen.writer().extruder() ? (int)gcodegen.writer().extruder()->id() : -1;
@@ -283,7 +282,7 @@ namespace Slic3r {
config.set_key_value("layer_num", new ConfigOptionInt(gcodegen.m_layer_index));
config.set_key_value("layer_z", new ConfigOptionFloat(tcr.print_z));
config.set_key_value("toolchange_z", new ConfigOptionFloat(z));
-// config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
+ config.set_key_value("max_layer_z", new ConfigOptionFloat(gcodegen.m_max_layer_z));
toolchange_gcode_str = gcodegen.placeholder_parser_process("toolchange_gcode", toolchange_gcode, new_extruder_id, &config);
check_add_eol(toolchange_gcode_str);
}
@@ -305,6 +304,9 @@ namespace Slic3r {
if (!start_filament_gcode.empty()) {
// Process the start_filament_gcode for the active filament only.
DynamicConfig config;
+ config.set_key_value("layer_num", new ConfigOptionInt(gcodegen.m_layer_index));
+ config.set_key_value("layer_z", new ConfigOptionFloat(gcodegen.writer().get_position()(2) - gcodegen.m_config.z_offset.value));
+ config.set_key_value("max_layer_z", new ConfigOptionFloat(gcodegen.m_max_layer_z));
config.set_key_value("filament_extruder_id", new ConfigOptionInt(new_extruder_id));
start_filament_gcode_str = gcodegen.placeholder_parser_process("start_filament_gcode", start_filament_gcode, new_extruder_id, &config);
check_add_eol(start_filament_gcode_str);
@@ -1274,15 +1276,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
// Write the custom start G-code
file.writeln(start_gcode);
- // Process filament-specific gcode.
- /* if (has_wipe_tower) {
- // Wipe tower will control the extruder switching, it will call the start_filament_gcode.
- } else {
- DynamicConfig config;
- config.set_key_value("filament_extruder_id", new ConfigOptionInt(int(initial_extruder_id)));
- file.writeln(this->placeholder_parser_process("start_filament_gcode", print.config().start_filament_gcode.values[initial_extruder_id], initial_extruder_id, &config));
- }
-*/
this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, true);
print.throw_if_canceled();
@@ -1899,6 +1892,8 @@ namespace ProcessLayer
// && !MMU1
) {
//! FIXME_in_fw show message during print pause
+ // FIXME: Why is pause_print_gcode here? Why is it supplied "color_change_extruder"? Why is that not
+ // passed to color_change_gcode below?
DynamicConfig cfg;
cfg.set_key_value("color_change_extruder", new ConfigOptionInt(m600_extruder_before_layer));
gcode += gcodegen.placeholder_parser_process("pause_print_gcode", config.pause_print_gcode, current_extruder_id, &cfg);
@@ -2109,10 +2104,10 @@ GCode::LayerResult GCode::process_layer(
DynamicConfig config;
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
+ config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
gcode += this->placeholder_parser_process("layer_gcode",
print.config().layer_gcode.value, m_writer.extruder()->id(), &config)
+ "\n";
- config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
}
if (! first_layer && ! m_second_layer_things_done) {
@@ -3146,7 +3141,9 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
const std::string &start_filament_gcode = m_config.start_filament_gcode.get_at(extruder_id);
if (! start_filament_gcode.empty()) {
// Process the start_filament_gcode for the filament.
- gcode += this->placeholder_parser_process("start_filament_gcode", start_filament_gcode, extruder_id);
+ DynamicConfig config;
+ config.set_key_value("filament_extruder_id", new ConfigOptionInt(int(extruder_id)));
+ gcode += this->placeholder_parser_process("start_filament_gcode", start_filament_gcode, extruder_id, &config);
check_add_eol(gcode);
}
gcode += m_writer.toolchange(extruder_id);
@@ -3215,7 +3212,9 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
const std::string &start_filament_gcode = m_config.start_filament_gcode.get_at(extruder_id);
if (! start_filament_gcode.empty()) {
// Process the start_filament_gcode for the new filament.
- gcode += this->placeholder_parser_process("start_filament_gcode", start_filament_gcode, extruder_id);
+ DynamicConfig config;
+ config.set_key_value("filament_extruder_id", new ConfigOptionInt(int(extruder_id)));
+ gcode += this->placeholder_parser_process("start_filament_gcode", start_filament_gcode, extruder_id, &config);
check_add_eol(gcode);
}
// Set the new extruder to the operating temperature.