mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	ENH: extrude all loops ccw
Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: I548bff50567c4cb6770585aafc7efb20889084d6
This commit is contained in:
		
							parent
							
								
									04f66e974f
								
							
						
					
					
						commit
						614882d28b
					
				
					 1 changed files with 4 additions and 7 deletions
				
			
		|  | @ -3177,11 +3177,8 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou | ||||||
|     // get a copy; don't modify the orientation of the original loop object otherwise
 |     // get a copy; don't modify the orientation of the original loop object otherwise
 | ||||||
|     // next copies (if any) would not detect the correct orientation
 |     // next copies (if any) would not detect the correct orientation
 | ||||||
| 
 | 
 | ||||||
|     //BBS: extrude contour of wall ccw, hole of wall cw, except spiral mode
 |     // extrude all loops ccw
 | ||||||
|     bool was_clockwise = loop.is_clockwise(); |     bool was_clockwise = loop.make_counter_clockwise(); | ||||||
|     if (m_config.spiral_mode || !is_perimeter(loop.role())) |  | ||||||
|         loop.make_counter_clockwise(); |  | ||||||
|     bool current_clockwise = loop.is_clockwise(); |  | ||||||
| 
 | 
 | ||||||
|     // find the point of the loop that is closest to the current extruder position
 |     // find the point of the loop that is closest to the current extruder position
 | ||||||
|     // or randomize if requested
 |     // or randomize if requested
 | ||||||
|  | @ -3246,7 +3243,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou | ||||||
|         //FIXME improve the algorithm in case the loop is split into segments with a low number of points (see the Point b query).
 |         //FIXME improve the algorithm in case the loop is split into segments with a low number of points (see the Point b query).
 | ||||||
|         Point a = paths.front().polyline.points[1];  // second point
 |         Point a = paths.front().polyline.points[1];  // second point
 | ||||||
|         Point b = *(paths.back().polyline.points.end()-3);       // second to last point
 |         Point b = *(paths.back().polyline.points.end()-3);       // second to last point
 | ||||||
|         if (was_clockwise != current_clockwise) { |         if (was_clockwise) { | ||||||
|             // swap points
 |             // swap points
 | ||||||
|             Point c = a; a = b; b = c; |             Point c = a; a = b; b = c; | ||||||
|         } |         } | ||||||
|  | @ -3254,7 +3251,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou | ||||||
|         double angle = paths.front().first_point().ccw_angle(a, b) / 3; |         double angle = paths.front().first_point().ccw_angle(a, b) / 3; | ||||||
| 
 | 
 | ||||||
|         // turn left if contour, turn right if hole
 |         // turn left if contour, turn right if hole
 | ||||||
|         if (was_clockwise != current_clockwise) angle *= -1; |         if (was_clockwise) angle *= -1; | ||||||
| 
 | 
 | ||||||
|         // create the destination point along the first segment and rotate it
 |         // create the destination point along the first segment and rotate it
 | ||||||
|         // we make sure we don't exceed the segment length because we don't know
 |         // we make sure we don't exceed the segment length because we don't know
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 salt.wei
						salt.wei