mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
SS port - Change extrusion role gcode (#2459)
implement custom gcode for when the extrusion role is changed Co-authored-by: supermerill <merill@free.fr>
This commit is contained in:
parent
1b53d1b72d
commit
120a3576a0
6 changed files with 66 additions and 1 deletions
|
@ -1402,6 +1402,8 @@ namespace DoExport {
|
|||
//BBS
|
||||
//if (ret.size() < MAX_TAGS_COUNT) check(_(L("Printing by object G-code")), config.printing_by_object_gcode.value);
|
||||
//if (ret.size() < MAX_TAGS_COUNT) check(_(L("Color Change G-code")), config.color_change_gcode.value);
|
||||
//Orca
|
||||
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Change extrusion role G-code")), config.change_extrusion_role_gcode.value);
|
||||
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Pause G-code")), config.machine_pause_gcode.value);
|
||||
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Template Custom G-code")), config.template_custom_gcode.value);
|
||||
if (ret.size() < MAX_TAGS_COUNT) {
|
||||
|
@ -4755,6 +4757,18 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||
|
||||
double F = speed * 60; // convert mm/sec to mm/min
|
||||
|
||||
//Orca: process custom gcode for extrusion role change
|
||||
if (path.role() != m_last_extrusion_role && !m_config.change_extrusion_role_gcode.value.empty()) {
|
||||
DynamicConfig config;
|
||||
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_layer == nullptr ? m_last_height : m_layer->print_z));
|
||||
gcode += this->placeholder_parser_process("change_extrusion_role_gcode",
|
||||
m_config.change_extrusion_role_gcode.value, m_writer.extruder()->id(), &config)
|
||||
+ "\n";
|
||||
}
|
||||
|
||||
// extrude arc or line
|
||||
if (m_enable_extrusion_role_markers) {
|
||||
if (path.role() != m_last_extrusion_role) {
|
||||
|
@ -5002,6 +5016,35 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
|||
return gcode;
|
||||
}
|
||||
|
||||
//Orca: get string name of extrusion role. used for change_extruder_role_gcode
|
||||
std::string GCode::extrusion_role_to_string_for_parser(const ExtrusionRole & role)
|
||||
{
|
||||
switch (role) {
|
||||
case erPerimeter: return "Perimeter";
|
||||
case erExternalPerimeter: return "ExternalPerimeter";
|
||||
case erOverhangPerimeter: return "OverhangPerimeter";
|
||||
case erInternalInfill: return "InternalInfill";
|
||||
case erSolidInfill: return "SolidInfill";
|
||||
case erTopSolidInfill: return "TopSolidInfill";
|
||||
case erBottomSurface: return "BottomSurface";
|
||||
case erBridgeInfill:
|
||||
case erInternalBridgeInfill: return "BridgeInfill";
|
||||
case erGapFill: return "GapFill";
|
||||
case erIroning: return "Ironing";
|
||||
case erSkirt: return "Skirt";
|
||||
case erBrim: return "Brim";
|
||||
case erSupportMaterial: return "SupportMaterial";
|
||||
case erSupportMaterialInterface: return "SupportMaterialInterface";
|
||||
case erSupportTransition: return "SupportTransition";
|
||||
case erWipeTower: return "WipeTower";
|
||||
case erCustom:
|
||||
case erMixed:
|
||||
case erCount:
|
||||
case erNone:
|
||||
default: return "Mixed";
|
||||
}
|
||||
}
|
||||
|
||||
std::string encodeBase64(uint64_t value)
|
||||
{
|
||||
//Always use big endian mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue