mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-02 11:33:59 -06:00
Disable SAFC and retract for Hilbert curve (#9592)
* SAFC flow for rectilinear/monotonic only and Hilbet curve retract * Refactor --------- Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
parent
52e4d2af82
commit
b259ee22b3
6 changed files with 30 additions and 24 deletions
|
@ -5177,6 +5177,25 @@ double GCode::get_overhang_degree_corr_speed(float normal_speed, double path_deg
|
||||||
return speed_out;
|
return speed_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GCode::_needSAFC(const ExtrusionPath &path)
|
||||||
|
{
|
||||||
|
if (!m_small_area_infill_flow_compensator || !m_config.small_area_infill_flow_compensation.value)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
static const InfillPattern supported_patterns[] = {
|
||||||
|
InfillPattern::ipRectilinear,
|
||||||
|
InfillPattern::ipAlignedRectilinear,
|
||||||
|
InfillPattern::ipMonotonic,
|
||||||
|
InfillPattern::ipMonotonicLine,
|
||||||
|
};
|
||||||
|
|
||||||
|
return std::any_of(std::begin(supported_patterns), std::end(supported_patterns), [&](const InfillPattern pattern) {
|
||||||
|
return this->on_first_layer() && this->config().bottom_surface_pattern == pattern ||
|
||||||
|
path.role() == erSolidInfill && this->config().internal_solid_infill_pattern == pattern ||
|
||||||
|
path.role() == erTopSolidInfill && this->config().top_surface_pattern == pattern;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
std::string GCode::_extrude(const ExtrusionPath &path, std::string description, double speed)
|
std::string GCode::_extrude(const ExtrusionPath &path, std::string description, double speed)
|
||||||
{
|
{
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
|
@ -5731,8 +5750,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
continue;
|
continue;
|
||||||
path_length += line_length;
|
path_length += line_length;
|
||||||
auto dE = e_per_mm * line_length;
|
auto dE = e_per_mm * line_length;
|
||||||
if (!this->on_first_layer() && m_small_area_infill_flow_compensator
|
if (_needSAFC(path)) {
|
||||||
&& m_config.small_area_infill_flow_compensation.value) {
|
|
||||||
auto oldE = dE;
|
auto oldE = dE;
|
||||||
dE = m_small_area_infill_flow_compensator->modify_flow(line_length, dE, path.role());
|
dE = m_small_area_infill_flow_compensator->modify_flow(line_length, dE, path.role());
|
||||||
|
|
||||||
|
@ -5773,8 +5791,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
if (line_length < EPSILON)
|
if (line_length < EPSILON)
|
||||||
continue;
|
continue;
|
||||||
auto dE = e_per_mm * line_length;
|
auto dE = e_per_mm * line_length;
|
||||||
if (!this->on_first_layer() && m_small_area_infill_flow_compensator
|
if (_needSAFC(path)) {
|
||||||
&& m_config.small_area_infill_flow_compensation.value) {
|
|
||||||
auto oldE = dE;
|
auto oldE = dE;
|
||||||
dE = m_small_area_infill_flow_compensator->modify_flow(line_length, dE, path.role());
|
dE = m_small_area_infill_flow_compensator->modify_flow(line_length, dE, path.role());
|
||||||
|
|
||||||
|
@ -5797,8 +5814,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
continue;
|
continue;
|
||||||
const Vec2d center_offset = this->point_to_gcode(arc.center) - this->point_to_gcode(arc.start_point);
|
const Vec2d center_offset = this->point_to_gcode(arc.center) - this->point_to_gcode(arc.start_point);
|
||||||
auto dE = e_per_mm * arc_length;
|
auto dE = e_per_mm * arc_length;
|
||||||
if (!this->on_first_layer() && m_small_area_infill_flow_compensator
|
if (_needSAFC(path)) {
|
||||||
&& m_config.small_area_infill_flow_compensation.value) {
|
|
||||||
auto oldE = dE;
|
auto oldE = dE;
|
||||||
dE = m_small_area_infill_flow_compensator->modify_flow(arc_length, dE, path.role());
|
dE = m_small_area_infill_flow_compensator->modify_flow(arc_length, dE, path.role());
|
||||||
|
|
||||||
|
@ -5952,8 +5968,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
last_set_speed = F;
|
last_set_speed = F;
|
||||||
}
|
}
|
||||||
auto dE = e_per_mm * line_length;
|
auto dE = e_per_mm * line_length;
|
||||||
if (!this->on_first_layer() && m_small_area_infill_flow_compensator
|
if (_needSAFC(path)) {
|
||||||
&& m_config.small_area_infill_flow_compensation.value) {
|
|
||||||
auto oldE = dE;
|
auto oldE = dE;
|
||||||
dE = m_small_area_infill_flow_compensator->modify_flow(line_length, dE, path.role());
|
dE = m_small_area_infill_flow_compensator->modify_flow(line_length, dE, path.role());
|
||||||
|
|
||||||
|
@ -6334,7 +6349,8 @@ std::string GCode::retract(bool toolchange, bool is_last_retraction, LiftType li
|
||||||
(the extruder might be already retracted fully or partially). We call these
|
(the extruder might be already retracted fully or partially). We call these
|
||||||
methods even if we performed wipe, since this will ensure the entire retraction
|
methods even if we performed wipe, since this will ensure the entire retraction
|
||||||
length is honored in case wipe path was too short. */
|
length is honored in case wipe path was too short. */
|
||||||
if (role != erTopSolidInfill || EXTRUDER_CONFIG(retract_on_top_layer))
|
if ((!this->on_first_layer() || this->config().bottom_surface_pattern != InfillPattern::ipHilbertCurve) &&
|
||||||
|
(role != erTopSolidInfill || this->config().top_surface_pattern != InfillPattern::ipHilbertCurve))
|
||||||
gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract();
|
gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract();
|
||||||
|
|
||||||
gcode += m_writer.reset_e();
|
gcode += m_writer.reset_e();
|
||||||
|
|
|
@ -602,6 +602,7 @@ private:
|
||||||
int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const;
|
int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const;
|
||||||
|
|
||||||
std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
||||||
|
bool _needSAFC(const ExtrusionPath &path);
|
||||||
double get_overhang_degree_corr_speed(float speed, double path_degree);
|
double get_overhang_degree_corr_speed(float speed, double path_degree);
|
||||||
void print_machine_envelope(GCodeOutputStream &file, Print &print);
|
void print_machine_envelope(GCodeOutputStream &file, Print &print);
|
||||||
void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||||
|
|
|
@ -150,7 +150,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
||||||
"retraction_minimum_travel",
|
"retraction_minimum_travel",
|
||||||
"retract_before_wipe",
|
"retract_before_wipe",
|
||||||
"retract_when_changing_layer",
|
"retract_when_changing_layer",
|
||||||
"retract_on_top_layer",
|
|
||||||
"retraction_length",
|
"retraction_length",
|
||||||
"retract_length_toolchange",
|
"retract_length_toolchange",
|
||||||
"z_hop",
|
"z_hop",
|
||||||
|
|
|
@ -3993,12 +3993,6 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionBools { false });
|
def->set_default_value(new ConfigOptionBools { false });
|
||||||
|
|
||||||
def = this->add("retract_on_top_layer", coBools);
|
|
||||||
def->label = L("Retract on top layer");
|
|
||||||
def->tooltip = L("Force a retraction on top layer. Disabling could prevent clog on very slow patterns with small movements, like Hilbert curve.");
|
|
||||||
def->mode = comAdvanced;
|
|
||||||
def->set_default_value(new ConfigOptionBools { true });
|
|
||||||
|
|
||||||
def = this->add("retraction_length", coFloats);
|
def = this->add("retraction_length", coFloats);
|
||||||
def->label = L("Length");
|
def->label = L("Length");
|
||||||
def->full_label = L("Retraction Length");
|
def->full_label = L("Retraction Length");
|
||||||
|
@ -5745,7 +5739,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
// BBS: floats
|
// BBS: floats
|
||||||
"wipe_distance",
|
"wipe_distance",
|
||||||
// bools
|
// bools
|
||||||
"retract_when_changing_layer", "retract_on_top_layer", "wipe",
|
"retract_when_changing_layer", "wipe",
|
||||||
// percents
|
// percents
|
||||||
"retract_before_wipe",
|
"retract_before_wipe",
|
||||||
"long_retractions_when_cut",
|
"long_retractions_when_cut",
|
||||||
|
@ -5797,7 +5791,7 @@ void PrintConfigDef::init_extruder_option_keys()
|
||||||
"nozzle_diameter", "min_layer_height", "max_layer_height", "extruder_offset",
|
"nozzle_diameter", "min_layer_height", "max_layer_height", "extruder_offset",
|
||||||
"retraction_length", "z_hop", "z_hop_types", "travel_slope", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed",
|
"retraction_length", "z_hop", "z_hop_types", "travel_slope", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed",
|
||||||
"retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance",
|
"retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance",
|
||||||
"retract_when_changing_layer", "retract_on_top_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour",
|
"retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour",
|
||||||
"default_filament_profile","retraction_distances_when_cut","long_retractions_when_cut"
|
"default_filament_profile","retraction_distances_when_cut","long_retractions_when_cut"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5808,7 +5802,6 @@ void PrintConfigDef::init_extruder_option_keys()
|
||||||
"retract_lift_above",
|
"retract_lift_above",
|
||||||
"retract_lift_below",
|
"retract_lift_below",
|
||||||
"retract_lift_enforce",
|
"retract_lift_enforce",
|
||||||
"retract_on_top_layer",
|
|
||||||
"retract_restart_extra",
|
"retract_restart_extra",
|
||||||
"retract_when_changing_layer",
|
"retract_when_changing_layer",
|
||||||
"retraction_distances_when_cut",
|
"retraction_distances_when_cut",
|
||||||
|
@ -5830,7 +5823,7 @@ void PrintConfigDef::init_filament_option_keys()
|
||||||
"filament_diameter", "min_layer_height", "max_layer_height",
|
"filament_diameter", "min_layer_height", "max_layer_height",
|
||||||
"retraction_length", "z_hop", "z_hop_types", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed",
|
"retraction_length", "z_hop", "z_hop_types", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed",
|
||||||
"retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance",
|
"retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance",
|
||||||
"retract_when_changing_layer", "retract_on_top_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "filament_colour",
|
"retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "filament_colour",
|
||||||
"default_filament_profile","retraction_distances_when_cut","long_retractions_when_cut"/*,"filament_seam_gap"*/
|
"default_filament_profile","retraction_distances_when_cut","long_retractions_when_cut"/*,"filament_seam_gap"*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5843,7 +5836,6 @@ void PrintConfigDef::init_filament_option_keys()
|
||||||
"retract_lift_enforce",
|
"retract_lift_enforce",
|
||||||
"retract_restart_extra",
|
"retract_restart_extra",
|
||||||
"retract_when_changing_layer",
|
"retract_when_changing_layer",
|
||||||
"retract_on_top_layer",
|
|
||||||
"retraction_distances_when_cut",
|
"retraction_distances_when_cut",
|
||||||
"retraction_length",
|
"retraction_length",
|
||||||
"retraction_minimum_travel",
|
"retraction_minimum_travel",
|
||||||
|
|
|
@ -1295,7 +1295,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||||
((ConfigOptionFloat, resolution))
|
((ConfigOptionFloat, resolution))
|
||||||
((ConfigOptionFloats, retraction_minimum_travel))
|
((ConfigOptionFloats, retraction_minimum_travel))
|
||||||
((ConfigOptionBools, retract_when_changing_layer))
|
((ConfigOptionBools, retract_when_changing_layer))
|
||||||
((ConfigOptionBools, retract_on_top_layer))
|
|
||||||
((ConfigOptionFloat, skirt_distance))
|
((ConfigOptionFloat, skirt_distance))
|
||||||
((ConfigOptionInt, skirt_height))
|
((ConfigOptionInt, skirt_height))
|
||||||
((ConfigOptionInt, skirt_loops))
|
((ConfigOptionInt, skirt_loops))
|
||||||
|
|
|
@ -4424,7 +4424,6 @@ if (is_marlin_flavor)
|
||||||
optgroup->append_single_option_line("deretraction_speed", "", extruder_idx);
|
optgroup->append_single_option_line("deretraction_speed", "", extruder_idx);
|
||||||
optgroup->append_single_option_line("retraction_minimum_travel", "", extruder_idx);
|
optgroup->append_single_option_line("retraction_minimum_travel", "", extruder_idx);
|
||||||
optgroup->append_single_option_line("retract_when_changing_layer", "", extruder_idx);
|
optgroup->append_single_option_line("retract_when_changing_layer", "", extruder_idx);
|
||||||
optgroup->append_single_option_line("retract_on_top_layer", "", extruder_idx);
|
|
||||||
optgroup->append_single_option_line("wipe", "", extruder_idx);
|
optgroup->append_single_option_line("wipe", "", extruder_idx);
|
||||||
optgroup->append_single_option_line("wipe_distance", "", extruder_idx);
|
optgroup->append_single_option_line("wipe_distance", "", extruder_idx);
|
||||||
optgroup->append_single_option_line("retract_before_wipe", "", extruder_idx);
|
optgroup->append_single_option_line("retract_before_wipe", "", extruder_idx);
|
||||||
|
@ -4644,7 +4643,7 @@ void TabPrinter::toggle_options()
|
||||||
// user can customize other retraction options if retraction is enabled
|
// user can customize other retraction options if retraction is enabled
|
||||||
//BBS
|
//BBS
|
||||||
bool retraction = have_retract_length || use_firmware_retraction;
|
bool retraction = have_retract_length || use_firmware_retraction;
|
||||||
std::vector<std::string> vec = {"z_hop", "retract_when_changing_layer", "retract_on_top_layer"};
|
std::vector<std::string> vec = {"z_hop", "retract_when_changing_layer"};
|
||||||
for (auto el : vec)
|
for (auto el : vec)
|
||||||
toggle_option(el, retraction, i);
|
toggle_option(el, retraction, i);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue