@@ -196,10 +196,10 @@ Shape LayerPlan::computeCombBoundary(const CombBoundary boundary_type)
196196 switch (boundary_type)
197197 {
198198 case CombBoundary::MINIMUM:
199- offset = -mesh.settings .get <coord_t >(" machine_nozzle_size" ) / 2 - mesh.settings .get <coord_t >(" wall_line_width_0" ) / 2 - extra_offset;
199+ offset = -( mesh.settings .get <coord_t >(" machine_nozzle_size" ) / 2 + mesh.settings .get <coord_t >(" wall_line_width_0" ) / 2 + extra_offset) ;
200200 break ;
201201 case CombBoundary::PREFERRED:
202- offset = -mesh.settings .get <coord_t >(" machine_nozzle_size " ) * 3 / 2 - mesh.settings .get <coord_t >(" wall_line_width_0" ) / 2 - extra_offset;
202+ offset = -( mesh.settings .get <coord_t >(" retraction_combing_avoid_distance " ) + mesh.settings .get <coord_t >(" wall_line_width_0" ) / 2 + extra_offset) ;
203203 break ;
204204 default :
205205 offset = 0 ;
@@ -2676,8 +2676,24 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
26762676 {
26772677 ExtruderPlan& extruder_plan = extruder_plans_[extruder_plan_idx];
26782678
2679- const RetractionAndWipeConfig* retraction_config
2680- = current_mesh ? ¤t_mesh->retraction_wipe_config : &storage_.retraction_wipe_config_per_extruder [extruder_plan.extruder_nr_ ];
2679+ auto get_retraction_config = [&extruder_nr, this ](std::shared_ptr<const SliceMeshStorage>& mesh) -> std::optional<const RetractionAndWipeConfig*>
2680+ {
2681+ if (mesh)
2682+ {
2683+ if (extruder_nr == mesh->settings .get <size_t >(" extruder_nr" )) [[likely]]
2684+ {
2685+ return &mesh->retraction_wipe_config ;
2686+ }
2687+
2688+ // We are printing a part of a mesh with a different extruder, use this extruder settings instead (mesh-specific settings will be ignored)
2689+ return &storage_.retraction_wipe_config_per_extruder [extruder_nr];
2690+ }
2691+
2692+ // We have no mesh yet, a more global config should be used
2693+ return std::nullopt ;
2694+ };
2695+
2696+ const RetractionAndWipeConfig* retraction_config = get_retraction_config (current_mesh).value_or (&storage_.retraction_wipe_config_per_extruder [extruder_plan.extruder_nr_ ]);
26812697 coord_t z_hop_height = retraction_config->retraction_config .zHop ;
26822698
26832699 if (extruder_nr != extruder_plan.extruder_nr_ )
@@ -2861,7 +2877,7 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
28612877
28622878 if (path.retract )
28632879 {
2864- retraction_config = path.mesh ? &path. mesh -> retraction_wipe_config : retraction_config;
2880+ retraction_config = get_retraction_config ( path.mesh ). value_or ( retraction_config) ;
28652881 gcode.writeRetraction (retraction_config->retraction_config );
28662882 if (path.retract_for_nozzle_switch )
28672883 {
0 commit comments