mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Reduction is now correctly calculated for each region, soluble filament excluded from infill wiping
This commit is contained in:
parent
bfe4350a89
commit
c72ecb382d
2 changed files with 37 additions and 27 deletions
|
@ -1338,31 +1338,37 @@ void GCode::process_layer(
|
||||||
m_avoid_crossing_perimeters.disable_once = true;
|
m_avoid_crossing_perimeters.disable_once = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
gcode += "; INFILL WIPING STARTS\n";
|
if (print.config.wipe_into_infill.value) {
|
||||||
|
gcode += "; INFILL WIPING STARTS\n";
|
||||||
if (extruder_id != layer_tools.extruders.front()) { // if this is the first extruder on this layer, there was no toolchange
|
if (extruder_id != layer_tools.extruders.front()) { // if this is the first extruder on this layer, there was no toolchange
|
||||||
for (const auto& layer_to_print : layers) { // iterate through all objects
|
for (const auto& layer_to_print : layers) { // iterate through all objects
|
||||||
if (layer_to_print.object_layer == nullptr)
|
gcode+="objekt\n";
|
||||||
continue;
|
if (layer_to_print.object_layer == nullptr)
|
||||||
std::vector<ObjectByExtruder::Island::Region> overridden;
|
continue;
|
||||||
for (size_t region_id = 0; region_id < print.regions.size(); ++ region_id) {
|
std::vector<ObjectByExtruder::Island::Region> overridden;
|
||||||
ObjectByExtruder::Island::Region new_region;
|
for (size_t region_id = 0; region_id < print.regions.size(); ++ region_id) {
|
||||||
overridden.push_back(new_region);
|
gcode+="region\n";
|
||||||
for (ExtrusionEntity *ee : (*layer_to_print.object_layer).regions[region_id]->fills.entities) {
|
ObjectByExtruder::Island::Region new_region;
|
||||||
auto *fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
|
overridden.push_back(new_region);
|
||||||
if (fill->get_extruder_override() == extruder_id) {
|
for (ExtrusionEntity *ee : (*layer_to_print.object_layer).regions[region_id]->fills.entities) {
|
||||||
overridden.back().infills.append(*fill);
|
gcode+="entity\n";
|
||||||
fill->set_extruder_override(-1);
|
auto *fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
|
||||||
}
|
if (fill->get_extruder_override() == extruder_id) {
|
||||||
}
|
gcode+="*\n";
|
||||||
|
overridden.back().infills.append(*fill);
|
||||||
|
fill->set_extruder_override(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
m_config.apply((layer_to_print.object_layer)->object()->config, true);
|
m_config.apply((layer_to_print.object_layer)->object()->config, true);
|
||||||
Point copy = (layer_to_print.object_layer)->object()->_shifted_copies.front();
|
Point copy = (layer_to_print.object_layer)->object()->_shifted_copies.front();
|
||||||
this->set_origin(unscale(copy.x), unscale(copy.y));
|
this->set_origin(unscale(copy.x), unscale(copy.y));
|
||||||
gcode += this->extrude_infill(print, overridden);
|
gcode += this->extrude_infill(print, overridden);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gcode += "; WIPING FINISHED\n";
|
||||||
}
|
}
|
||||||
gcode += "; WIPING FINISHED\n";
|
|
||||||
|
|
||||||
|
|
||||||
auto objects_by_extruder_it = by_extruder.find(extruder_id);
|
auto objects_by_extruder_it = by_extruder.find(extruder_id);
|
||||||
|
|
|
@ -1145,16 +1145,20 @@ void Print::_make_wipe_tower()
|
||||||
float volume_to_wipe = wipe_volumes[current_extruder_id][extruder_id];
|
float volume_to_wipe = wipe_volumes[current_extruder_id][extruder_id];
|
||||||
float saved_material = 0.f;
|
float saved_material = 0.f;
|
||||||
|
|
||||||
// soluble filament cannot be wiped in a random infill, first layer is potentionally visible too
|
|
||||||
if (!first_layer && !config.filament_soluble.get_at(extruder_id)) {
|
if (!first_layer && !config.filament_soluble.get_at(extruder_id)) { // soluble filament cannot be wiped in a random infill, first layer is potentionally visible too
|
||||||
for (size_t i = 0; i < objects.size(); ++ i) { // Let's iterate through all objects...
|
for (size_t i = 0; i < objects.size(); ++ i) { // Let's iterate through all objects...
|
||||||
for (Layer* lay : objects[i]->layers) {
|
for (Layer* lay : objects[i]->layers) { // Find this layer
|
||||||
if (std::abs(layer_tools.print_z - lay->print_z) > EPSILON) continue;
|
if (std::abs(layer_tools.print_z - lay->print_z) > EPSILON)
|
||||||
for (LayerRegion* reg : lay->regions) { // and all regions
|
continue;
|
||||||
ExtrusionEntityCollection& eec = reg->fills;
|
for (size_t region_id = 0; region_id < objects[i]->print()->regions.size(); ++ region_id) {
|
||||||
for (ExtrusionEntity* ee : eec.entities) { // and all infill Collections
|
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;
|
||||||
|
ExtrusionEntityCollection& eec = lay->regions[region_id]->fills;
|
||||||
|
for (ExtrusionEntity* ee : eec.entities) { // and all infill Collections
|
||||||
auto* fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
|
auto* fill = dynamic_cast<ExtrusionEntityCollection*>(ee);
|
||||||
if (fill->role() == erTopSolidInfill) continue;
|
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
|
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(extruder_id);
|
fill->set_extruder_override(extruder_id);
|
||||||
volume_to_wipe -= fill->total_volume();
|
volume_to_wipe -= fill->total_volume();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue