diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index ffe03410b..492bbe558 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3944,7 +3944,7 @@ std::string GCode::_before_extrude(const ExtrusionPath &path, const std::string config.set_key_value("extrusion_role", new ConfigOptionString(extrusion_role_to_string_for_parser(path.role()))); config.set_key_value("last_extrusion_role", new ConfigOptionString(extrusion_role_to_string_for_parser(m_last_extrusion_role))); config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index + 1)); - config.set_key_value("layer_z", new ConfigOptionFloat(m_config.z_offset.value)); + config.set_key_value("layer_z", new ConfigOptionFloat(m_layer == nullptr ? m_last_height : m_layer->print_z)); gcode += this->placeholder_parser_process("feature_gcode", m_config.feature_gcode.value, m_writer.tool()->id(), &config) + "\n"; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 223f409eb..bd0fc0fc8 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2491,7 +2491,8 @@ void PrintConfigDef::init_fff_params() def->label = L("After layer change G-code"); def->category = OptionCategory::customgcode; def->tooltip = L("This custom code is inserted at every extrusion type change." - "Note that you can use placeholder variables for all Slic3r settings as well as [extrusion_role], [layer_num] and [layer_z] that can take these string values:" + "Note that you can use placeholder variables for all Slic3r settings as well as [last_extrusion_role], [extrusion_role], [layer_num] and [layer_z]." + " The 'extrusion_role' strings can take these string values:" " { Perimeter, ExternalPerimeter, OverhangPerimeter, InternalInfill, SolidInfill, TopSolidInfill, BridgeInfill, GapFill, Skirt, SupportMaterial, SupportMaterialInterface, WipeTower, Mixed }." " Mixed is only used when the role of the extrusion is not unique, not exactly inside another category or not known."); def->cli = "feature-gcode";