Performance improvement in G-code export for support material
in suppression of retracts when traveling over support regions.
This commit is contained in:
parent
01031779b7
commit
c03085a1f6
3 changed files with 29 additions and 11 deletions
src/libslic3r
|
@ -3134,15 +3134,26 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (role == erSupportMaterial) {
|
||||
const SupportLayer* support_layer = dynamic_cast<const SupportLayer*>(m_layer);
|
||||
//FIXME support_layer->support_islands.contains should use some search structure!
|
||||
if (support_layer != NULL && ! intersection_pl(travel, support_layer->support_islands).empty())
|
||||
// skip retraction if this is a travel move inside a support material island
|
||||
//FIXME not retracting over a long path may cause oozing, which in turn may result in missing material
|
||||
// at the end of the extrusion path!
|
||||
return false;
|
||||
}
|
||||
if (role == erSupportMaterial)
|
||||
if (const SupportLayer *support_layer = dynamic_cast<const SupportLayer*>(m_layer);
|
||||
support_layer != nullptr && ! support_layer->support_islands_bboxes.empty()) {
|
||||
BoundingBox bbox_travel = get_extents(travel);
|
||||
Polylines trimmed;
|
||||
bool trimmed_initialized = false;
|
||||
for (const BoundingBox &bbox : support_layer->support_islands_bboxes)
|
||||
if (bbox.overlap(bbox_travel)) {
|
||||
const auto &island = support_layer->support_islands[&bbox - support_layer->support_islands_bboxes.data()];
|
||||
trimmed = trimmed_initialized ? diff_pl(trimmed, island) : diff_pl(travel, island);
|
||||
trimmed_initialized = true;
|
||||
if (trimmed.empty())
|
||||
// skip retraction if this is a travel move inside a support material island
|
||||
//FIXME not retracting over a long path may cause oozing, which in turn may result in missing material
|
||||
// at the end of the extrusion path!
|
||||
return false;
|
||||
// Not sure whether updating the boudning box isn't too expensive.
|
||||
//bbox_travel = get_extents(trimmed);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_config.only_retract_when_crossing_perimeters && m_layer != nullptr &&
|
||||
m_config.fill_density.value > 0 && m_layer->any_internal_region_slice_contains(travel))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue