Reworked the "new" bridging to respect the bridge_flow_ratio

by maintaining extrusion spacing, but modifying the extrusion width
and / or height.
This commit is contained in:
Vojtech Bubnik 2021-03-09 12:30:31 +01:00
parent 8e27e355c2
commit f01f02154c
12 changed files with 173 additions and 134 deletions

View file

@ -17,12 +17,29 @@ namespace Slic3r {
Flow LayerRegion::flow(FlowRole role) const
{
return m_region->flow(*m_layer->object(), role, m_layer->height, m_layer->id() == 0);
return this->flow(role, m_layer->height);
}
Flow LayerRegion::flow(FlowRole role, double layer_height) const
{
return m_region->flow(*m_layer->object(), role, layer_height, m_layer->id() == 0);
}
Flow LayerRegion::bridging_flow(FlowRole role) const
{
return this->layer()->object()->config().thick_bridges ? m_region->bridging_flow(role) : this->flow(role);
{
const PrintRegion &region = *this->region();
const PrintRegionConfig &region_config = region.config();
if (this->layer()->object()->config().thick_bridges) {
// The old Slic3r way (different from all other slicers): Use rounded extrusions.
// Get the configured nozzle_diameter for the extruder associated to the flow role requested.
// Here this->extruder(role) - 1 may underflow to MAX_INT, but then the get_at() will follback to zero'th element, so everything is all right.
auto nozzle_diameter = float(region.print()->config().nozzle_diameter.get_at(region.extruder(role) - 1));
// Applies default bridge spacing.
return Flow::bridging_flow(float(sqrt(region_config.bridge_flow_ratio)) * nozzle_diameter, nozzle_diameter);
} else {
// The same way as other slicers: Use normal extrusions. Apply bridge_flow_ratio while maintaining the original spacing.
return this->flow(role).with_flow_ratio(region_config.bridge_flow_ratio);
}
}
// Fill in layerm->fill_surfaces by trimming the layerm->slices by the cummulative layerm->fill_surfaces.