mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-15 05:41:48 +08:00
Add a "between extrusion role" gcode input window, to let insert gcode inside a layer and not only at the begin and the end.
#108
This commit is contained in:
parent
51bcae96ea
commit
1bf0b1c1d7
@ -2909,6 +2909,15 @@ std::string GCode::_before_extrude(const ExtrusionPath &path, const std::string
|
|||||||
double F = speed * 60; // convert mm/sec to mm/min
|
double F = speed * 60; // convert mm/sec to mm/min
|
||||||
|
|
||||||
// extrude arc or line
|
// extrude arc or line
|
||||||
|
if (path.role() != m_last_extrusion_role) {
|
||||||
|
DynamicConfig config;
|
||||||
|
config.set_key_value("extrusion_role", new ConfigOptionString(extrusion_role_to_string_for_parser(path.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));
|
||||||
|
gcode += this->placeholder_parser_process("feature_gcode",
|
||||||
|
m_config.feature_gcode.value, m_writer.extruder()->id(), &config)
|
||||||
|
+ "\n";
|
||||||
|
}
|
||||||
if (m_enable_extrusion_role_markers) {
|
if (m_enable_extrusion_role_markers) {
|
||||||
if (path.role() != m_last_extrusion_role) {
|
if (path.role() != m_last_extrusion_role) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
@ -3266,4 +3275,40 @@ void GCode::ObjectByExtruder::Island::Region::append(const std::string& type, co
|
|||||||
perimeters_or_infills_overrides->push_back(copies_extruder);
|
perimeters_or_infills_overrides->push_back(copies_extruder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 erBridgeInfill:
|
||||||
|
return "BridgeInfill";
|
||||||
|
case erGapFill:
|
||||||
|
return "GapFill";
|
||||||
|
case erSkirt:
|
||||||
|
return "Skirt";
|
||||||
|
case erSupportMaterial:
|
||||||
|
return "SupportMaterial";
|
||||||
|
case erSupportMaterialInterface:
|
||||||
|
return "SupportMaterialInterface";
|
||||||
|
case erWipeTower:
|
||||||
|
return "WipeTower";
|
||||||
|
case erCustom:
|
||||||
|
case erMixed:
|
||||||
|
case erCount:
|
||||||
|
case erNone:
|
||||||
|
default:
|
||||||
|
return "Mixed";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
@ -182,6 +182,7 @@ public:
|
|||||||
// inside the generated string and after the G-code export finishes.
|
// inside the generated string and after the G-code export finishes.
|
||||||
std::string placeholder_parser_process(const std::string &name, const std::string &templ, unsigned int current_extruder_id, const DynamicConfig *config_override = nullptr);
|
std::string placeholder_parser_process(const std::string &name, const std::string &templ, unsigned int current_extruder_id, const DynamicConfig *config_override = nullptr);
|
||||||
bool enable_cooling_markers() const { return m_enable_cooling_markers; }
|
bool enable_cooling_markers() const { return m_enable_cooling_markers; }
|
||||||
|
std::string extrusion_role_to_string_for_parser(const ExtrusionRole &);
|
||||||
|
|
||||||
// For Perl bindings, to be used exclusively by unit tests.
|
// For Perl bindings, to be used exclusively by unit tests.
|
||||||
unsigned int layer_count() const { return m_layer_count; }
|
unsigned int layer_count() const { return m_layer_count; }
|
||||||
|
@ -1477,8 +1477,8 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def = this->add("layer_gcode", coString);
|
def = this->add("layer_gcode", coString);
|
||||||
def->label = L("After layer change G-code");
|
def->label = L("After layer change G-code");
|
||||||
def->tooltip = L("This custom code is inserted at every layer change, right after the Z move "
|
def->tooltip = L("This custom code is inserted at every layer change, right after the Z move "
|
||||||
"and before the extruder moves to the first layer point. Note that you can use "
|
"and before the extruder moves to the first layer point. Note that you can use "
|
||||||
"placeholder variables for all Slic3r settings as well as [layer_num] and [layer_z].");
|
"placeholder variables for all Slic3r settings as well as [layer_num] and [layer_z].");
|
||||||
def->cli = "after-layer-gcode|layer-gcode";
|
def->cli = "after-layer-gcode|layer-gcode";
|
||||||
def->multiline = true;
|
def->multiline = true;
|
||||||
def->full_width = true;
|
def->full_width = true;
|
||||||
@ -1486,6 +1486,19 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->mode = comExpert;
|
def->mode = comExpert;
|
||||||
def->set_default_value(new ConfigOptionString(""));
|
def->set_default_value(new ConfigOptionString(""));
|
||||||
|
|
||||||
|
def = this->add("feature_gcode", coString);
|
||||||
|
def->label = L("After layer change G-code");
|
||||||
|
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:"
|
||||||
|
" { 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 an other category or not known.");
|
||||||
|
def->cli = "feature-gcode";
|
||||||
|
def->multiline = true;
|
||||||
|
def->full_width = true;
|
||||||
|
def->height = 5;
|
||||||
|
def->mode = comExpert;
|
||||||
|
def->set_default_value(new ConfigOptionString(""));
|
||||||
|
|
||||||
def = this->add("exact_last_layer_height", coBool);
|
def = this->add("exact_last_layer_height", coBool);
|
||||||
def->label = L("Exact last layer height");
|
def->label = L("Exact last layer height");
|
||||||
def->category = L("Layers and Perimeters");
|
def->category = L("Layers and Perimeters");
|
||||||
|
@ -799,6 +799,7 @@ public:
|
|||||||
ConfigOptionEnum<GCodeFlavor> gcode_flavor;
|
ConfigOptionEnum<GCodeFlavor> gcode_flavor;
|
||||||
ConfigOptionBool gcode_label_objects;
|
ConfigOptionBool gcode_label_objects;
|
||||||
ConfigOptionString layer_gcode;
|
ConfigOptionString layer_gcode;
|
||||||
|
ConfigOptionString feature_gcode;
|
||||||
ConfigOptionFloat max_print_speed;
|
ConfigOptionFloat max_print_speed;
|
||||||
ConfigOptionFloat max_volumetric_speed;
|
ConfigOptionFloat max_volumetric_speed;
|
||||||
#ifdef HAS_PRESSURE_EQUALIZER
|
#ifdef HAS_PRESSURE_EQUALIZER
|
||||||
@ -890,6 +891,7 @@ protected:
|
|||||||
OPT_PTR(gcode_flavor);
|
OPT_PTR(gcode_flavor);
|
||||||
OPT_PTR(gcode_label_objects);
|
OPT_PTR(gcode_label_objects);
|
||||||
OPT_PTR(layer_gcode);
|
OPT_PTR(layer_gcode);
|
||||||
|
OPT_PTR(feature_gcode);
|
||||||
OPT_PTR(max_print_speed);
|
OPT_PTR(max_print_speed);
|
||||||
OPT_PTR(max_volumetric_speed);
|
OPT_PTR(max_volumetric_speed);
|
||||||
#ifdef HAS_PRESSURE_EQUALIZER
|
#ifdef HAS_PRESSURE_EQUALIZER
|
||||||
|
@ -494,6 +494,7 @@ const std::vector<std::string>& Preset::printer_options()
|
|||||||
"use_firmware_retraction", "use_volumetric_e", "variable_layer_height",
|
"use_firmware_retraction", "use_volumetric_e", "variable_layer_height",
|
||||||
"host_type", "print_host", "printhost_apikey", "printhost_cafile",
|
"host_type", "print_host", "printhost_apikey", "printhost_cafile",
|
||||||
"single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode",
|
"single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode",
|
||||||
|
"feature_gcode",
|
||||||
"between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction",
|
"between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction",
|
||||||
"cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "max_print_height",
|
"cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "max_print_height",
|
||||||
"default_print_profile", "inherits",
|
"default_print_profile", "inherits",
|
||||||
|
@ -2074,6 +2074,12 @@ void TabPrinter::build_fff()
|
|||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
option.opt.height = gcode_field_height;//150;
|
option.opt.height = gcode_field_height;//150;
|
||||||
optgroup->append_single_option_line(option);
|
optgroup->append_single_option_line(option);
|
||||||
|
|
||||||
|
optgroup = page->new_optgroup(_(L("Between extrusion role change G-code")), 0);
|
||||||
|
option = optgroup->get_option("feature_gcode");
|
||||||
|
option.opt.full_width = true;
|
||||||
|
option.opt.height = gcode_field_height;//150;
|
||||||
|
optgroup->append_single_option_line(option);
|
||||||
|
|
||||||
page = add_options_page(_(L("Notes")), "note.png");
|
page = add_options_page(_(L("Notes")), "note.png");
|
||||||
optgroup = page->new_optgroup(_(L("Notes")), 0);
|
optgroup = page->new_optgroup(_(L("Notes")), 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user