mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
Fix of Custom G-code for color change does not process macro #5782
Added macro processing of color_change_gcode, pause_print_gcode and template_custom_gcode custom G-codes when emitting them into the output G-code.
This commit is contained in:
parent
d7a786e8c8
commit
224f3e506c
1 changed files with 10 additions and 6 deletions
|
@ -1705,7 +1705,9 @@ namespace ProcessLayer
|
||||||
{
|
{
|
||||||
|
|
||||||
static std::string emit_custom_gcode_per_print_z(
|
static std::string emit_custom_gcode_per_print_z(
|
||||||
|
GCode &gcodegen,
|
||||||
const CustomGCode::Item *custom_gcode,
|
const CustomGCode::Item *custom_gcode,
|
||||||
|
unsigned int current_extruder_id,
|
||||||
// ID of the first extruder printing this layer.
|
// ID of the first extruder printing this layer.
|
||||||
unsigned int first_extruder_id,
|
unsigned int first_extruder_id,
|
||||||
const PrintConfig &config)
|
const PrintConfig &config)
|
||||||
|
@ -1746,12 +1748,14 @@ namespace ProcessLayer
|
||||||
// && !MMU1
|
// && !MMU1
|
||||||
) {
|
) {
|
||||||
//! FIXME_in_fw show message during print pause
|
//! FIXME_in_fw show message during print pause
|
||||||
gcode += config.pause_print_gcode;// pause print
|
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);
|
||||||
gcode += "\n";
|
gcode += "\n";
|
||||||
gcode += "M117 Change filament for Extruder " + std::to_string(m600_extruder_before_layer) + "\n";
|
gcode += "M117 Change filament for Extruder " + std::to_string(m600_extruder_before_layer) + "\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gcode += config.color_change_gcode;//ColorChangeCode;
|
gcode += gcodegen.placeholder_parser_process("color_change_gcode", config.color_change_gcode, current_extruder_id);
|
||||||
gcode += "\n";
|
gcode += "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1767,7 +1771,7 @@ namespace ProcessLayer
|
||||||
//! FIXME_in_fw show message during print pause
|
//! FIXME_in_fw show message during print pause
|
||||||
if (!pause_print_msg.empty())
|
if (!pause_print_msg.empty())
|
||||||
gcode += "M117 " + pause_print_msg + "\n";
|
gcode += "M117 " + pause_print_msg + "\n";
|
||||||
gcode += config.pause_print_gcode;
|
gcode += gcodegen.placeholder_parser_process("pause_print_gcode", config.pause_print_gcode, current_extruder_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// add tag for processor
|
// add tag for processor
|
||||||
|
@ -1776,8 +1780,8 @@ namespace ProcessLayer
|
||||||
#else
|
#else
|
||||||
gcode += ";" + GCodeProcessor::Custom_Code_Tag + "\n";
|
gcode += ";" + GCodeProcessor::Custom_Code_Tag + "\n";
|
||||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||||
if (gcode_type == CustomGCode::Template) // Template Cistom Gcode
|
if (gcode_type == CustomGCode::Template) // Template Custom Gcode
|
||||||
gcode += config.template_custom_gcode;
|
gcode += gcodegen.placeholder_parser_process("template_custom_gcode", config.template_custom_gcode, current_extruder_id);
|
||||||
else // custom Gcode
|
else // custom Gcode
|
||||||
gcode += custom_gcode->extra;
|
gcode += custom_gcode->extra;
|
||||||
|
|
||||||
|
@ -1985,7 +1989,7 @@ void GCode::process_layer(
|
||||||
|
|
||||||
if (single_object_instance_idx == size_t(-1)) {
|
if (single_object_instance_idx == size_t(-1)) {
|
||||||
// Normal (non-sequential) print.
|
// Normal (non-sequential) print.
|
||||||
gcode += ProcessLayer::emit_custom_gcode_per_print_z(layer_tools.custom_gcode, first_extruder_id, print.config());
|
gcode += ProcessLayer::emit_custom_gcode_per_print_z(*this, layer_tools.custom_gcode, m_writer.extruder()->id(), first_extruder_id, print.config());
|
||||||
}
|
}
|
||||||
// Extrude skirt at the print_z of the raft layers and normal object layers
|
// Extrude skirt at the print_z of the raft layers and normal object layers
|
||||||
// not at the print_z of the interlaced support material layers.
|
// not at the print_z of the interlaced support material layers.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue