mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-17 11:47:54 -06:00
Wipe into infill - copies of one object are properly processed
This commit is contained in:
parent
8bdbe41505
commit
2d24bf5f73
7 changed files with 92 additions and 63 deletions
|
@ -1183,34 +1183,40 @@ float Print::mark_wiping_infill(const ToolOrdering::LayerTools& layer_tools, uns
|
|||
if (!config.filament_soluble.get_at(new_extruder)) { // Soluble filament cannot be wiped in a random infill
|
||||
for (size_t i = 0; i < objects.size(); ++ i) { // Let's iterate through all objects...
|
||||
Layer* this_layer = nullptr;
|
||||
for (unsigned int a = 0; a < objects[i]->layers.size(); this_layer = objects[i]->layers[++a]) // Finds this layer
|
||||
if (std::abs(layer_tools.print_z - objects[i]->layers[a]->print_z) < EPSILON)
|
||||
for (unsigned int a = 0; a < objects[i]->layers.size(); ++a) // Finds this layer
|
||||
if (std::abs(layer_tools.print_z - objects[i]->layers[a]->print_z) < EPSILON) {
|
||||
this_layer = objects[i]->layers[a];
|
||||
break;
|
||||
|
||||
for (size_t region_id = 0; region_id < objects[i]->print()->regions.size(); ++ region_id) {
|
||||
unsigned int region_extruder = objects[i]->print()->regions[region_id]->config.infill_extruder - 1; // config value is 1-based
|
||||
if (config.filament_soluble.get_at(region_extruder)) // if this infill is meant to be soluble, keep it that way
|
||||
continue;
|
||||
|
||||
if (!config.infill_first) { // in this case we must verify that region_extruder was already used at this layer (and perimeters of the infill are therefore extruded)
|
||||
bool unused_yet = false;
|
||||
for (unsigned i = 0; i < layer_tools.extruders.size(); ++i) {
|
||||
if (layer_tools.extruders[i] == new_extruder)
|
||||
unused_yet = true;
|
||||
if (layer_tools.extruders[i] == region_extruder)
|
||||
break;
|
||||
}
|
||||
if (unused_yet)
|
||||
continue;
|
||||
}
|
||||
if (this_layer == nullptr)
|
||||
continue;
|
||||
|
||||
ExtrusionEntityCollection& eec = this_layer->regions[region_id]->fills;
|
||||
for (ExtrusionEntity* ee : eec.entities) { // iterate through all infill Collections
|
||||
auto* fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
|
||||
if (fill->role() == erTopSolidInfill) continue; // color of TopSolidInfill cannot be changed - it is visible
|
||||
if (volume_to_wipe > 0.f && !fill->is_extruder_overridden() && fill->total_volume() > min_infill_volume) { // this infill will be used to wipe this extruder
|
||||
fill->set_extruder_override(new_extruder);
|
||||
volume_to_wipe -= fill->total_volume();
|
||||
for (unsigned int copy = 0; copy < objects[i]->copies().size(); ++copy) { // iterate through copies first, so that we mark neighbouring infills
|
||||
for (size_t region_id = 0; region_id < objects[i]->print()->regions.size(); ++ region_id) {
|
||||
|
||||
unsigned int region_extruder = objects[i]->print()->regions[region_id]->config.infill_extruder - 1; // config value is 1-based
|
||||
if (config.filament_soluble.get_at(region_extruder)) // if this infill is meant to be soluble, keep it that way
|
||||
continue;
|
||||
|
||||
if (!config.infill_first) { // in this case we must verify that region_extruder was already used at this layer (and perimeters of the infill are therefore extruded)
|
||||
bool unused_yet = false;
|
||||
for (unsigned i = 0; i < layer_tools.extruders.size(); ++i) {
|
||||
if (layer_tools.extruders[i] == new_extruder)
|
||||
unused_yet = true;
|
||||
if (layer_tools.extruders[i] == region_extruder)
|
||||
break;
|
||||
}
|
||||
if (unused_yet)
|
||||
continue;
|
||||
}
|
||||
ExtrusionEntityCollection& eec = this_layer->regions[region_id]->fills;
|
||||
for (ExtrusionEntity* ee : eec.entities) { // iterate through all infill Collections
|
||||
auto* fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
|
||||
if (fill->role() == erTopSolidInfill || fill->role() == erGapFill) continue; // these cannot be changed - it is / may be visible
|
||||
if (volume_to_wipe > 0.f && !fill->is_extruder_overridden(copy) && fill->total_volume() > min_infill_volume) { // this infill will be used to wipe this extruder
|
||||
fill->set_extruder_override(copy, new_extruder);
|
||||
volume_to_wipe -= fill->total_volume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue