Fixed an issue that internal_bridge_speed is applied to external bridge infills

A new extrusion role - erInternalBridgeInfill is introduced.
SuperSlicer's implementation is referenced.

Signed-off-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
This commit is contained in:
SoftFever 2023-08-12 15:38:22 +08:00
parent 8dd9561574
commit 5807135a1f
8 changed files with 40 additions and 12 deletions

View file

@ -354,6 +354,7 @@ std::string ExtrusionEntity::role_to_string(ExtrusionRole role)
case erBottomSurface : return L("Bottom surface");
case erIroning : return L("Ironing");
case erBridgeInfill : return L("Bridge");
case erInternalBridgeInfill : return L("Internal Bridge");
case erGapFill : return L("Gap infill");
case erSkirt : return ("Skirt");
case erBrim : return ("Brim");
@ -388,6 +389,8 @@ ExtrusionRole ExtrusionEntity::string_to_role(const std::string_view role)
return erIroning;
else if (role == L("Bridge"))
return erBridgeInfill;
else if (role == L("Internal Bridge"))
return erInternalBridgeInfill;
else if (role == L("Gap infill"))
return erGapFill;
else if (role == ("Skirt"))

View file

@ -28,6 +28,7 @@ enum ExtrusionRole : uint8_t {
erBottomSurface,
erIroning,
erBridgeInfill,
erInternalBridgeInfill,
erGapFill,
erSkirt,
erBrim,
@ -69,6 +70,7 @@ inline bool is_external_perimeter(ExtrusionRole role)
inline bool is_infill(ExtrusionRole role)
{
return role == erBridgeInfill
|| role == erInternalBridgeInfill
|| role == erInternalInfill
|| role == erSolidInfill
|| role == erTopSolidInfill
@ -84,6 +86,7 @@ inline bool is_top_surface(ExtrusionRole role)
inline bool is_solid_infill(ExtrusionRole role)
{
return role == erBridgeInfill
|| role == erInternalBridgeInfill
|| role == erSolidInfill
|| role == erTopSolidInfill
|| role == erBottomSurface
@ -92,6 +95,7 @@ inline bool is_solid_infill(ExtrusionRole role)
inline bool is_bridge(ExtrusionRole role) {
return role == erBridgeInfill
|| role == erInternalBridgeInfill
|| role == erOverhangPerimeter;
}

View file

@ -174,12 +174,19 @@ std::vector<SurfaceFill> group_fills(const Layer &layer)
} else if (params.density <= 0)
continue;
params.extrusion_role =
is_bridge ?
erBridgeInfill :
(surface.is_solid() ?
(surface.is_top() ? erTopSolidInfill : (surface.is_bottom()? erBottomSurface : erSolidInfill)) :
erInternalInfill);
params.extrusion_role = erInternalInfill;
if (is_bridge) {
if(surface.is_internal_bridge())
params.extrusion_role = erInternalBridgeInfill;
else
params.extrusion_role = erBridgeInfill;
} else if (surface.is_solid()) {
if (surface.is_top()) {
params.extrusion_role = erTopSolidInfill;
} else {
params.extrusion_role = erSolidInfill;
}
}
params.bridge_angle = float(surface.bridge_angle);
params.angle = float(Geometry::deg2rad(region_config.infill_direction.value));

View file

@ -1,3 +1,4 @@
#include "PrintConfig.hpp"
#include "libslic3r.h"
#include "I18N.hpp"
#include "GCode.hpp"
@ -4045,9 +4046,9 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
speed = new_speed == 0.0 ? speed : new_speed;
}
}
else if(path.role() == erBridgeInfill) {
else if(path.role() == erInternalBridgeInfill) {
speed = m_config.get_abs_value("internal_bridge_speed");
} else if (path.role() == erOverhangPerimeter || path.role() == erSupportTransition) {
} else if (path.role() == erOverhangPerimeter || path.role() == erSupportTransition || path.role() == erBridgeInfill) {
speed = m_config.get_abs_value("bridge_speed");
} else if (path.role() == erInternalInfill) {
speed = m_config.get_abs_value("sparse_infill_speed");

View file

@ -1,3 +1,4 @@
#include "ExtrusionEntity.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Print.hpp"
@ -2369,6 +2370,13 @@ bool GCodeProcessor::process_simplify3d_tags(const std::string_view comment)
return true;
}
// ; internal bridge
pos = cmt.find(" internal bridge");
if (pos == 0) {
set_extrusion_role(erInternalBridgeInfill);
return true;
}
// ; support
pos = cmt.find(" support");
if (pos == 0) {
@ -2520,6 +2528,8 @@ bool GCodeProcessor::process_ideamaker_tags(const std::string_view comment)
set_extrusion_role(erInternalInfill);
else if (type == "BRIDGE")
set_extrusion_role(erBridgeInfill);
else if (type == "INTERNAL BRIDGE")
set_extrusion_role(erInternalBridgeInfill);
else if (type == "SUPPORT")
set_extrusion_role(erSupportMaterial);
else {
@ -2792,7 +2802,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
else if (m_extrusion_role == erExternalPerimeter)
// cross section: rectangle
m_width = delta_pos[E] * static_cast<float>(M_PI * sqr(1.05f * filament_radius)) / (delta_xyz * m_height);
else if (m_extrusion_role == erBridgeInfill || m_extrusion_role == erNone)
else if (m_extrusion_role == erBridgeInfill || m_extrusion_role == erInternalBridgeInfill || m_extrusion_role == erNone)
// cross section: circle
m_width = static_cast<float>(m_result.filament_diameters[m_extruder_id]) * std::sqrt(delta_pos[E] / delta_xyz);
else
@ -3249,7 +3259,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line)
else if (m_extrusion_role == erExternalPerimeter)
//BBS: cross section: rectangle
m_width = delta_pos[E] * static_cast<float>(M_PI * sqr(1.05f * filament_radius)) / (delta_xyz * m_height);
else if (m_extrusion_role == erBridgeInfill || m_extrusion_role == erNone)
else if (m_extrusion_role == erBridgeInfill || m_extrusion_role == erInternalBridgeInfill || m_extrusion_role == erNone)
//BBS: cross section: circle
m_width = static_cast<float>(m_result.filament_diameters[m_extruder_id]) * std::sqrt(delta_pos[E] / delta_xyz);
else

View file

@ -1,4 +1,5 @@
#include "ClipperUtils.hpp"
#include "ExtrusionEntity.hpp"
#include "ExtrusionEntityCollection.hpp"
#include "Layer.hpp"
#include "Print.hpp"
@ -1325,7 +1326,7 @@ namespace SupportMaterialInternal {
for (const ExtrusionEntity *ee2 : static_cast<const ExtrusionEntityCollection*>(ee)->entities) {
assert(! ee2->is_collection());
assert(! ee2->is_loop());
if (ee2->role() == erBridgeInfill)
if (ee2->role() == erBridgeInfill || ee2->role() == erInternalBridgeInfill)
return true;
}
}

View file

@ -104,6 +104,7 @@ public:
bool is_top() const { return this->surface_type == stTop; }
bool is_bottom() const { return this->surface_type == stBottom || this->surface_type == stBottomBridge; }
bool is_bridge() const { return this->surface_type == stBottomBridge || this->surface_type == stInternalBridge; }
bool is_internal_bridge() const { return this->surface_type == stInternalBridge; }
bool is_external() const { return this->is_top() || this->is_bottom(); }
bool is_internal() const { return ! this->is_external(); }
bool is_solid() const { return this->is_external() || this->surface_type == stInternalSolid || this->surface_type == stInternalBridge; }

View file

@ -733,7 +733,8 @@ const std::vector<GCodeViewer::Color> GCodeViewer::Extrusion_Role_Colors {{
{ 0.94f, 0.25f, 0.25f, 1.0f }, // erTopSolidInfill
{ 0.40f, 0.36f, 0.78f, 1.0f }, // erBottomSurface
{ 1.00f, 0.55f, 0.41f, 1.0f }, // erIroning
{ 0.30f, 0.50f, 0.73f, 1.0f }, // erBridgeInfill
{ 0.30f, 0.40f, 0.63f, 1.0f }, // erBridgeInfill
{ 0.30f, 0.50f, 0.73f, 1.0f }, // erInternalBridgeInfill
{ 1.00f, 1.00f, 1.00f, 1.0f }, // erGapFill
{ 0.00f, 0.53f, 0.43f, 1.0f }, // erSkirt
{ 0.00f, 0.23f, 0.43f, 1.0f }, // erBrim