mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-13 21:15:51 +08:00
#395 Z-Lift only on Top & zlift on First layers
#642 Z-Lift dist as a range height modifier
This commit is contained in:
parent
03821319ab
commit
5633824f87
@ -16,7 +16,10 @@ group:Retraction
|
||||
line:Only lift Z
|
||||
setting:idx:retract_lift_above
|
||||
setting:idx:retract_lift_below
|
||||
setting:idx:retract_lift_not_last_layer
|
||||
end_line
|
||||
line:Lift z enforcement
|
||||
setting:idx:retract_lift_first_layer
|
||||
setting:idx:retract_lift_top
|
||||
end_line
|
||||
line:Retraction Speed
|
||||
setting:idx:retract_speed
|
||||
|
@ -4196,10 +4196,16 @@ std::string GCode::retract(bool toolchange)
|
||||
methods even if we performed wipe, since this will ensure the entire retraction
|
||||
length is honored in case wipe path was too short. */
|
||||
gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract();
|
||||
if (toolchange
|
||||
|| !(BOOL_EXTRUDER_CONFIG(retract_lift_not_last_layer) && (this->m_last_extrusion_role == ExtrusionRole::erTopSolidInfill ))
|
||||
|| !m_writer.tool_is_extruder()
|
||||
)
|
||||
bool need_lift = !m_writer.tool_is_extruder() || toolchange || (BOOL_EXTRUDER_CONFIG(retract_lift_first_layer) && m_config.print_retract_lift.value != 0 && this->m_layer_index == 0);
|
||||
if (!need_lift && m_config.print_retract_lift.value != 0) {
|
||||
if (EXTRUDER_CONFIG_WITH_DEFAULT(retract_lift_top, "") == "Not on top")
|
||||
need_lift = (this->m_last_extrusion_role != ExtrusionRole::erTopSolidInfill);
|
||||
else if (EXTRUDER_CONFIG_WITH_DEFAULT(retract_lift_top, "") == "Only on top")
|
||||
need_lift = (this->m_last_extrusion_role == ExtrusionRole::erTopSolidInfill);
|
||||
else
|
||||
need_lift = true;
|
||||
}
|
||||
if (need_lift)
|
||||
if (m_writer.tool()->retract_length() > 0
|
||||
|| m_config.use_firmware_retraction
|
||||
|| (!m_writer.tool_is_extruder() && m_writer.tool()->retract_lift() != 0)
|
||||
|
@ -660,6 +660,11 @@ std::string GCodeWriter::lift()
|
||||
target_lift = m_tool->retract_lift();
|
||||
}
|
||||
|
||||
// use the override if set
|
||||
if (target_lift > 0 && config_region && config_region->print_retract_lift.value >= 0) {
|
||||
target_lift = config_region->print_retract_lift.value;
|
||||
}
|
||||
|
||||
if (this->extra_lift > 0) {
|
||||
target_lift += this->extra_lift;
|
||||
this->extra_lift = 0;
|
||||
|
@ -559,6 +559,7 @@ const std::vector<std::string>& Preset::print_options()
|
||||
"print_extrusion_multiplier",
|
||||
"print_retract_length",
|
||||
"print_temperature",
|
||||
"print_retract_lift",
|
||||
"external_perimeter_cut_corners",
|
||||
"external_perimeter_overlap",
|
||||
"perimeter_bonding",
|
||||
|
@ -148,7 +148,8 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|
||||
"retract_lift",
|
||||
"retract_lift_above",
|
||||
"retract_lift_below",
|
||||
"retract_lift_not_last_layer",
|
||||
"retract_lift_first_layer",
|
||||
"retract_lift_top",
|
||||
"retract_restart_extra",
|
||||
"retract_restart_extra_toolchange",
|
||||
"retract_speed",
|
||||
|
@ -2806,13 +2806,27 @@ void PrintConfigDef::init_fff_params()
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloats { 0. });
|
||||
|
||||
def = this->add("retract_lift_not_last_layer", coBools);
|
||||
def->label = L("Not on top");
|
||||
def->full_label = L("Don't retract on top surfaces");
|
||||
def->category = OptionCategory::support;
|
||||
def->tooltip = L("Select this option to not use the z-lift on a top surface.");
|
||||
def = this->add("retract_lift_first_layer", coBools);
|
||||
def->label = L("Enforce on first layer");
|
||||
def->full_label = L("Enforce lift on first layer");
|
||||
def->category = OptionCategory::extruders;
|
||||
def->tooltip = L("Select this option to enforce z-lift on the first layer.");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBools { false });
|
||||
def->set_default_value(new ConfigOptionBools{ false });
|
||||
|
||||
def = this->add("retract_lift_top", coStrings);
|
||||
def->label = L("On surfaces");
|
||||
def->full_label = L("Lift only on");
|
||||
def->category = OptionCategory::extruders;
|
||||
def->tooltip = L("Select this option to not use/enforce the z-lift on a top surface.");
|
||||
def->gui_type = "f_enum_open";
|
||||
def->gui_flags = "show_value";
|
||||
def->enum_values.push_back(("All surfaces"));
|
||||
def->enum_values.push_back(("Not on top"));
|
||||
def->enum_values.push_back(("Only on top"));
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionStrings{ "All surfaces" });
|
||||
|
||||
|
||||
def = this->add("retract_restart_extra", coFloats);
|
||||
def->label = L("Extra length on restart");
|
||||
@ -3522,10 +3536,18 @@ void PrintConfigDef::init_fff_params()
|
||||
def = this->add("print_temperature", coInt);
|
||||
def->label = L("Temperature");
|
||||
def->category = OptionCategory::filament;
|
||||
def->tooltip = L("Override the temperature of the extruder. Avoid doing too many changes, it won't stop for cooling/heating. 0 to disable.");
|
||||
def->tooltip = L("Override the temperature of the extruder. Avoid doing too many changes, it won't stop for cooling/heating. 0 to disable. May only works on Height range modifiers.");
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionInt(0));
|
||||
|
||||
def = this->add("print_retract_lift", coFloat);
|
||||
def->label = L("Z-lift override");
|
||||
def->category = OptionCategory::filament;
|
||||
def->tooltip = L("Set the new lift-z value for this override. 0 will disable the z-lift. -& to disable. May only works on Height range modifiers.");
|
||||
def->sidetext = L("mm");
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionFloat(-1));
|
||||
|
||||
def = this->add("thin_perimeters", coBool);
|
||||
def->label = L("Overlapping external perimeter");
|
||||
def->full_label = L("Overlapping external perimeter");
|
||||
@ -3996,7 +4018,8 @@ void PrintConfigDef::init_extruder_option_keys()
|
||||
"retract_lift",
|
||||
"retract_lift_above",
|
||||
"retract_lift_below",
|
||||
"retract_lift_not_last_layer",
|
||||
"retract_lift_first_layer",
|
||||
"retract_lift_top",
|
||||
"retract_speed",
|
||||
"deretract_speed",
|
||||
"retract_before_wipe",
|
||||
@ -4875,6 +4898,12 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
|
||||
value = "emit_to_gcode";
|
||||
else
|
||||
value = "time_estimate_only";
|
||||
} else if (opt_key == "retract_lift_not_last_layer") {
|
||||
opt_key = "retract_lift_top";
|
||||
if (value == "1")
|
||||
value = "Not on top";
|
||||
else
|
||||
value = "All surfaces";
|
||||
}
|
||||
|
||||
// Ignore the following obsolete configuration keys:
|
||||
|
@ -135,7 +135,13 @@ enum SLAPillarConnectionMode {
|
||||
slapcmZigZag,
|
||||
slapcmCross,
|
||||
slapcmDynamic
|
||||
};
|
||||
};
|
||||
|
||||
enum ZLiftTop {
|
||||
zltAll,
|
||||
zltTop,
|
||||
zltNotTop
|
||||
};
|
||||
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<CompleteObjectSort>::get_enum_values() {
|
||||
static t_config_enum_values keys_map;
|
||||
@ -342,6 +348,15 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<SLAPillarConnecti
|
||||
return keys_map;
|
||||
}
|
||||
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<ZLiftTop>::get_enum_values() {
|
||||
static const t_config_enum_values keys_map = {
|
||||
{"everywhere", zltAll},
|
||||
{"onlytop", zltTop},
|
||||
{"nottop", zltNotTop}
|
||||
};
|
||||
return keys_map;
|
||||
}
|
||||
|
||||
// Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs.
|
||||
// Does not store the actual values, but defines default values.
|
||||
class PrintConfigDef : public ConfigDef
|
||||
@ -774,6 +789,7 @@ public:
|
||||
ConfigOptionInt perimeters;
|
||||
ConfigOptionPercent print_extrusion_multiplier;
|
||||
ConfigOptionFloat print_retract_length;
|
||||
ConfigOptionFloat print_retract_lift;
|
||||
ConfigOptionFloatOrPercent small_perimeter_speed;
|
||||
ConfigOptionFloatOrPercent small_perimeter_min_length;
|
||||
ConfigOptionFloatOrPercent small_perimeter_max_length;
|
||||
@ -874,6 +890,7 @@ protected:
|
||||
OPT_PTR(perimeters);
|
||||
OPT_PTR(print_extrusion_multiplier);
|
||||
OPT_PTR(print_retract_length);
|
||||
OPT_PTR(print_retract_lift);
|
||||
OPT_PTR(small_perimeter_speed);
|
||||
OPT_PTR(small_perimeter_min_length);
|
||||
OPT_PTR(small_perimeter_max_length);
|
||||
@ -1023,7 +1040,8 @@ public:
|
||||
ConfigOptionFloats retract_lift;
|
||||
ConfigOptionFloats retract_lift_above;
|
||||
ConfigOptionFloats retract_lift_below;
|
||||
ConfigOptionBools retract_lift_not_last_layer;
|
||||
ConfigOptionBools retract_lift_first_layer;
|
||||
ConfigOptionStrings retract_lift_top;
|
||||
ConfigOptionFloats retract_restart_extra;
|
||||
ConfigOptionFloats retract_restart_extra_toolchange;
|
||||
ConfigOptionFloats retract_speed;
|
||||
@ -1128,7 +1146,8 @@ protected:
|
||||
OPT_PTR(retract_lift);
|
||||
OPT_PTR(retract_lift_above);
|
||||
OPT_PTR(retract_lift_below);
|
||||
OPT_PTR(retract_lift_not_last_layer);
|
||||
OPT_PTR(retract_lift_first_layer);
|
||||
OPT_PTR(retract_lift_top);
|
||||
OPT_PTR(retract_restart_extra);
|
||||
OPT_PTR(retract_restart_extra_toolchange);
|
||||
OPT_PTR(retract_speed);
|
||||
|
@ -2750,7 +2750,7 @@ void TabPrinter::toggle_options()
|
||||
|
||||
// retract lift above / below only applies if using retract lift
|
||||
vec.resize(0);
|
||||
vec = { "retract_lift_above", "retract_lift_below", "retract_lift_not_last_layer" };
|
||||
vec = { "retract_lift_above", "retract_lift_below", "retract_lift_first_layer", "retract_lift_top" };
|
||||
for (auto el : vec) {
|
||||
field = get_field(el, i);
|
||||
if (field)
|
||||
|
Loading…
x
Reference in New Issue
Block a user