mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Tech ENABLE_ALLOW_NEGATIVE_Z -> ModelObject::convex_hull_2d() and sequential_print_horizontal_clearance_valid() modified to take in account for sinking instances
This commit is contained in:
		
							parent
							
								
									221af991c2
								
							
						
					
					
						commit
						ca14ea4c33
					
				
					 2 changed files with 19 additions and 3 deletions
				
			
		|  | @ -901,13 +901,19 @@ Polygon ModelObject::convex_hull_2d(const Transform3d &trafo_instance) const | |||
| 				for (const stl_facet &facet : stl.facet_start) | ||||
|                     for (size_t j = 0; j < 3; ++ j) { | ||||
|                         Vec3d p = trafo * facet.vertex[j].cast<double>(); | ||||
|                         pts.emplace_back(coord_t(scale_(p.x())), coord_t(scale_(p.y()))); | ||||
| #if ENABLE_ALLOW_NEGATIVE_Z | ||||
|                         if (p.z() >= 0.0) | ||||
| #endif // ENABLE_ALLOW_NEGATIVE_Z
 | ||||
|                             pts.emplace_back(coord_t(scale_(p.x())), coord_t(scale_(p.y()))); | ||||
|                     } | ||||
|             } else { | ||||
|                 // Using the shared vertices should be a bit quicker than using the STL faces.
 | ||||
|                 for (size_t i = 0; i < its.vertices.size(); ++ i) { | ||||
|                     Vec3d p = trafo * its.vertices[i].cast<double>(); | ||||
|                     pts.emplace_back(coord_t(scale_(p.x())), coord_t(scale_(p.y()))); | ||||
| #if ENABLE_ALLOW_NEGATIVE_Z | ||||
|                     if (p.z() >= 0.0) | ||||
| #endif // ENABLE_ALLOW_NEGATIVE_Z
 | ||||
|                         pts.emplace_back(coord_t(scale_(p.x())), coord_t(scale_(p.y()))); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -371,6 +371,15 @@ static inline bool sequential_print_horizontal_clearance_valid(const Print &prin | |||
| 	        // FIXME: Arrangement has different parameters for offsetting (jtMiter, limit 2)
 | ||||
| 	        // which causes that the warning will be showed after arrangement with the
 | ||||
| 	        // appropriate object distance. Even if I set this to jtMiter the warning still shows up.
 | ||||
| #if ENABLE_ALLOW_NEGATIVE_Z | ||||
|             it_convex_hull = map_model_object_to_convex_hull.emplace_hint(it_convex_hull, model_object_id, | ||||
|                 offset(print_object->model_object()->convex_hull_2d( | ||||
|                     Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(), model_instance0->get_scaling_factor(), model_instance0->get_mirror())), | ||||
|                     // Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
 | ||||
|                     // exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
 | ||||
|                     float(scale_(0.5 * print.config().extruder_clearance_radius.value - EPSILON)), | ||||
|                     jtRound, float(scale_(0.1))).front()); | ||||
| #else | ||||
| 	        it_convex_hull = map_model_object_to_convex_hull.emplace_hint(it_convex_hull, model_object_id,  | ||||
|                 offset(print_object->model_object()->convex_hull_2d( | ||||
| 	                        Geometry::assemble_transform(Vec3d::Zero(), model_instance0->get_rotation(), model_instance0->get_scaling_factor(), model_instance0->get_mirror())), | ||||
|  | @ -378,7 +387,8 @@ static inline bool sequential_print_horizontal_clearance_valid(const Print &prin | |||
| 	                // exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
 | ||||
| 	                float(scale_(0.5 * print.config().extruder_clearance_radius.value - EPSILON)), | ||||
| 	                jtRound, float(scale_(0.1))).front()); | ||||
| 	    } | ||||
| #endif // ENABLE_ALLOW_NEGATIVE_Z
 | ||||
|         } | ||||
| 	    // Make a copy, so it may be rotated for instances.
 | ||||
| 	    Polygon convex_hull0 = it_convex_hull->second; | ||||
| 		double z_diff = Geometry::rotation_diff_z(model_instance0->get_rotation(), print_object->instances().front().model_instance->get_rotation()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 enricoturri1966
						enricoturri1966