mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 12:11:15 -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; | ||||
|         } | ||||
| 
 | ||||
|         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
 | ||||
|             for (const auto& layer_to_print : layers) {     // iterate through all objects
 | ||||
|                 if (layer_to_print.object_layer == nullptr) | ||||
|                     continue; | ||||
|                 std::vector<ObjectByExtruder::Island::Region> overridden; | ||||
|                 for (size_t region_id = 0; region_id < print.regions.size(); ++ region_id) { | ||||
|                     ObjectByExtruder::Island::Region new_region; | ||||
|                     overridden.push_back(new_region); | ||||
|                     for (ExtrusionEntity *ee : (*layer_to_print.object_layer).regions[region_id]->fills.entities) { | ||||
|                         auto *fill = dynamic_cast<ExtrusionEntityCollection*>(ee); | ||||
|                         if (fill->get_extruder_override() == extruder_id) { | ||||
|                             overridden.back().infills.append(*fill); | ||||
|                             fill->set_extruder_override(-1); | ||||
|                         } | ||||
|                    } | ||||
|         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
 | ||||
|                 for (const auto& layer_to_print : layers) {     // iterate through all objects
 | ||||
|                 gcode+="objekt\n"; | ||||
|                     if (layer_to_print.object_layer == nullptr) | ||||
|                         continue; | ||||
|                     std::vector<ObjectByExtruder::Island::Region> overridden; | ||||
|                     for (size_t region_id = 0; region_id < print.regions.size(); ++ region_id) { | ||||
|                         gcode+="region\n"; | ||||
|                         ObjectByExtruder::Island::Region new_region; | ||||
|                         overridden.push_back(new_region); | ||||
|                         for (ExtrusionEntity *ee : (*layer_to_print.object_layer).regions[region_id]->fills.entities) { | ||||
|                             gcode+="entity\n"; | ||||
|                             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); | ||||
|                     Point copy = (layer_to_print.object_layer)->object()->_shifted_copies.front(); | ||||
|                     this->set_origin(unscale(copy.x), unscale(copy.y)); | ||||
|                     gcode += this->extrude_infill(print, overridden); | ||||
|                 } | ||||
|             } | ||||
|             gcode += "; WIPING FINISHED\n"; | ||||
|         } | ||||
|         gcode += "; WIPING FINISHED\n"; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         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 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)) { | ||||
|                         for (size_t i = 0; i < objects.size(); ++ i) {                    // Let's iterate through all objects...
 | ||||
|                             for (Layer* lay : objects[i]->layers) { | ||||
|                                 if (std::abs(layer_tools.print_z - lay->print_z) > EPSILON) continue; | ||||
|                                 for (LayerRegion* reg : lay->regions) {                         // and all regions
 | ||||
|                                     ExtrusionEntityCollection& eec = reg->fills; | ||||
|                                     for (ExtrusionEntity* ee : eec.entities) {                  // and all infill Collections
 | ||||
| 
 | ||||
|                     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 (Layer* lay : objects[i]->layers) {                                 // Find this layer
 | ||||
|                                 if (std::abs(layer_tools.print_z - lay->print_z) > EPSILON) | ||||
|                                     continue; | ||||
|                                 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; | ||||
|                                     ExtrusionEntityCollection& eec = lay->regions[region_id]->fills; | ||||
|                                     for (ExtrusionEntity* ee : eec.entities) {                      // and all infill Collections
 | ||||
|                                             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
 | ||||
|                                                 fill->set_extruder_override(extruder_id); | ||||
|                                                 volume_to_wipe -= fill->total_volume(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Matena
						Lukas Matena