mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
fix: fix cooling overhang threshold (#2508)
This commit is contained in:
parent
eed0c28bd8
commit
d6c9463a31
2 changed files with 13 additions and 12 deletions
|
@ -4794,15 +4794,18 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
|
|
||||||
|
|
||||||
// { "0%", Overhang_threshold_none },
|
// { "0%", Overhang_threshold_none },
|
||||||
// { "5%", Overhang_threshold_1_4 },
|
// { "10%", Overhang_threshold_1_4 },
|
||||||
// { "25%", Overhang_threshold_2_4 },
|
// { "25%", Overhang_threshold_2_4 },
|
||||||
// { "50%", Overhang_threshold_3_4 },
|
// { "50%", Overhang_threshold_3_4 },
|
||||||
// { "75%", Overhang_threshold_4_4 },
|
// { "75%", Overhang_threshold_4_4 },
|
||||||
// { "95%", Overhang_threshold_bridge }
|
// { "95%", Overhang_threshold_bridge }
|
||||||
auto check_overhang_fan = [&overhang_fan_threshold](float overlap) {
|
auto check_overhang_fan = [&overhang_fan_threshold](float overlap, ExtrusionRole role) {
|
||||||
|
if (is_bridge(role)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
switch (overhang_fan_threshold) {
|
switch (overhang_fan_threshold) {
|
||||||
case (int)Overhang_threshold_1_4:
|
case (int)Overhang_threshold_1_4:
|
||||||
return overlap <= 0.95f;
|
return overlap <= 0.9f;
|
||||||
break;
|
break;
|
||||||
case (int)Overhang_threshold_2_4:
|
case (int)Overhang_threshold_2_4:
|
||||||
return overlap <= 0.75f;
|
return overlap <= 0.75f;
|
||||||
|
@ -4814,10 +4817,10 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
return overlap <= 0.25f;
|
return overlap <= 0.25f;
|
||||||
break;
|
break;
|
||||||
case (int)Overhang_threshold_bridge:
|
case (int)Overhang_threshold_bridge:
|
||||||
return overlap <= 0.1f;
|
return overlap <= 0.05f;
|
||||||
break;
|
break;
|
||||||
case (int)Overhang_threshold_none:
|
case (int)Overhang_threshold_none:
|
||||||
return true;
|
return is_external_perimeter(role);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -4842,7 +4845,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
// perimeter
|
// perimeter
|
||||||
int overhang_threshold = overhang_fan_threshold == Overhang_threshold_none ? Overhang_threshold_none
|
int overhang_threshold = overhang_fan_threshold == Overhang_threshold_none ? Overhang_threshold_none
|
||||||
: overhang_fan_threshold - 1;
|
: overhang_fan_threshold - 1;
|
||||||
if ((overhang_fan_threshold == Overhang_threshold_none && is_perimeter(path.role())) ||
|
if ((overhang_fan_threshold == Overhang_threshold_none && is_external_perimeter(path.role())) ||
|
||||||
(path.get_overhang_degree() > overhang_threshold || is_bridge(path.role()))) {
|
(path.get_overhang_degree() > overhang_threshold || is_bridge(path.role()))) {
|
||||||
if (!m_is_overhang_fan_on) {
|
if (!m_is_overhang_fan_on) {
|
||||||
gcode += ";_OVERHANG_FAN_START\n";
|
gcode += ";_OVERHANG_FAN_START\n";
|
||||||
|
@ -4927,7 +4930,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
bool pre_fan_enabled = false;
|
bool pre_fan_enabled = false;
|
||||||
bool cur_fan_enabled = false;
|
bool cur_fan_enabled = false;
|
||||||
if( m_enable_cooling_markers && enable_overhang_bridge_fan)
|
if( m_enable_cooling_markers && enable_overhang_bridge_fan)
|
||||||
pre_fan_enabled = check_overhang_fan(new_points[0].overlap);
|
pre_fan_enabled = check_overhang_fan(new_points[0].overlap, path.role());
|
||||||
|
|
||||||
for (size_t i = 1; i < new_points.size(); i++) {
|
for (size_t i = 1; i < new_points.size(); i++) {
|
||||||
const ProcessedPoint &processed_point = new_points[i];
|
const ProcessedPoint &processed_point = new_points[i];
|
||||||
|
@ -4935,10 +4938,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
Vec2d p = this->point_to_gcode_quantized(processed_point.p);
|
Vec2d p = this->point_to_gcode_quantized(processed_point.p);
|
||||||
if (m_enable_cooling_markers) {
|
if (m_enable_cooling_markers) {
|
||||||
if (enable_overhang_bridge_fan) {
|
if (enable_overhang_bridge_fan) {
|
||||||
cur_fan_enabled = check_overhang_fan(processed_point.overlap);
|
cur_fan_enabled = check_overhang_fan(processed_point.overlap, path.role());
|
||||||
if (is_bridge(path.role()) ||
|
if (pre_fan_enabled && cur_fan_enabled) {
|
||||||
(is_perimeter(path.role()) &&
|
|
||||||
pre_fan_enabled && pre_fan_enabled)) {
|
|
||||||
if (!m_is_overhang_fan_on) {
|
if (!m_is_overhang_fan_on) {
|
||||||
gcode += ";_OVERHANG_FAN_START\n";
|
gcode += ";_OVERHANG_FAN_START\n";
|
||||||
m_is_overhang_fan_on = true;
|
m_is_overhang_fan_on = true;
|
||||||
|
|
|
@ -291,7 +291,7 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ForwardCompatibilitySubstitutionRule)
|
||||||
|
|
||||||
static const t_config_enum_values s_keys_map_OverhangFanThreshold = {
|
static const t_config_enum_values s_keys_map_OverhangFanThreshold = {
|
||||||
{ "0%", Overhang_threshold_none },
|
{ "0%", Overhang_threshold_none },
|
||||||
{ "10%", Overhang_threshold_1_4 },
|
{ "10%", Overhang_threshold_1_4 },
|
||||||
{ "25%", Overhang_threshold_2_4 },
|
{ "25%", Overhang_threshold_2_4 },
|
||||||
{ "50%", Overhang_threshold_3_4 },
|
{ "50%", Overhang_threshold_3_4 },
|
||||||
{ "75%", Overhang_threshold_4_4 },
|
{ "75%", Overhang_threshold_4_4 },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue