mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 12:11:15 -06:00 
			
		
		
		
	Base plate creation improvements. Added sla parameter for support elevation.
This commit is contained in:
		
							parent
							
								
									a94c604423
								
							
						
					
					
						commit
						1e0d8b245c
					
				
					 5 changed files with 35 additions and 12 deletions
				
			
		|  | @ -935,6 +935,10 @@ public: | |||
|     // The max length of a bridge in mm
 | ||||
|     ConfigOptionFloat support_max_bridge_length /*= 15.0*/; | ||||
| 
 | ||||
|     // The elevation in Z direction upwards. This is the space between the pad
 | ||||
|     // and the model object's bounding box bottom.
 | ||||
|     ConfigOptionFloat support_object_elevation; | ||||
| 
 | ||||
|     // Now for the base pool (plate) ///////////////////////////////////////////
 | ||||
| 
 | ||||
|     ConfigOptionFloat pad_wall_thickness /*= 2*/; | ||||
|  |  | |||
|  | @ -418,17 +418,32 @@ ExPolygons concave_hull(const ExPolygons& polys, double max_dist_mm = 50) | |||
|     return punion; | ||||
| } | ||||
| 
 | ||||
| void base_plate(const TriangleMesh &mesh, ExPolygons &output, float h) | ||||
| void base_plate(const TriangleMesh &mesh, ExPolygons &output, float h, | ||||
|                 float layerh) | ||||
| { | ||||
|     TriangleMesh m = mesh; | ||||
|     TriangleMeshSlicer slicer(&m); | ||||
| 
 | ||||
|     TriangleMesh upper, lower; | ||||
|     slicer.cut(h, &upper, &lower); | ||||
| //    TriangleMesh upper, lower;
 | ||||
| //    slicer.cut(h, &upper, &lower);
 | ||||
| 
 | ||||
|     // TODO: this might be slow
 | ||||
|     output = lower.horizontal_projection(); | ||||
|     // TODO: this might be slow (in fact it was)
 | ||||
| //    output = lower.horizontal_projection();
 | ||||
| 
 | ||||
|     auto bb = mesh.bounding_box(); | ||||
|     float gnd = float(bb.min(Z)); | ||||
|     std::vector<float> heights = {float(bb.min(Z))}; | ||||
|     for(float hi = gnd + layerh; hi <= gnd + h; hi += layerh) | ||||
|         heights.emplace_back(hi); | ||||
| 
 | ||||
|     std::vector<ExPolygons> out; out.reserve(size_t(std::ceil(h/layerh))); | ||||
|     slicer.slice(heights, &out, [](){}); | ||||
| 
 | ||||
|     size_t count = 0; for(auto& o : out) count += o.size(); | ||||
|     ExPolygons tmp; tmp.reserve(count); | ||||
|     for(auto& o : out) for(auto& e : o) tmp.emplace_back(std::move(e)); | ||||
| 
 | ||||
|     output = unify(tmp); | ||||
|     for(auto& o : output) o = o.simplify(0.1/SCALING_FACTOR).front(); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,8 @@ using ExPolygons = std::vector<ExPolygon>; | |||
| /// Calculate the polygon representing the silhouette from the specified height
 | ||||
| void base_plate(const TriangleMesh& mesh, | ||||
|                 ExPolygons& output, | ||||
|                 float height = 0.1f); | ||||
|                 float zlevel = 0.1f, | ||||
|                 float layerheight = 0.05f); | ||||
| 
 | ||||
| struct PoolConfig { | ||||
|     double min_wall_thickness_mm = 2; | ||||
|  |  | |||
|  | @ -510,9 +510,9 @@ struct Pad { | |||
|         const PoolConfig& cfg) : zlevel(ground_level + cfg.min_wall_height_mm/2) | ||||
|     { | ||||
|         ExPolygons basep; | ||||
|         base_plate(object_support_mesh, basep); | ||||
|         base_plate(object_support_mesh, basep, cfg.min_wall_height_mm/*,layer_height*/); | ||||
|         for(auto& bp : baseplate) basep.emplace_back(bp); | ||||
|         union_ex(basep); | ||||
| 
 | ||||
|         create_base_pool(basep, tmesh, cfg); | ||||
|         tmesh.translate(0, 0, float(zlevel)); | ||||
|     } | ||||
|  | @ -1275,8 +1275,6 @@ bool SLASupportTree::generate(const PointSet &points, | |||
|         ClusterEl cl_centroids; | ||||
|         cl_centroids.reserve(gnd_clusters.size()); | ||||
| 
 | ||||
|         std::cout << "gnd_clusters size: " << gnd_clusters.size() << std::endl; | ||||
| 
 | ||||
|         SpatIndex pheadindex; // spatial index for the junctions
 | ||||
|         for(auto cl : gnd_clusters) { | ||||
|             // place all the centroid head positions into the index. We will
 | ||||
|  |  | |||
|  | @ -200,9 +200,14 @@ void SLAPrint::process() | |||
|             double h =  po.m_config.pad_wall_height.getFloat(); | ||||
|             double md = po.m_config.pad_max_merge_distance.getFloat(); | ||||
|             double er = po.m_config.pad_edge_radius.getFloat(); | ||||
|             double lh = po.m_config.layer_height.getFloat(); | ||||
|             double elevation = po.m_config.support_object_elevation.getFloat(); | ||||
| 
 | ||||
|             sla::ExPolygons bp; | ||||
|             sla::base_plate(po.transformed_mesh(), bp); | ||||
|             if(elevation < h/2) | ||||
|                 sla::base_plate(po.transformed_mesh(), bp, | ||||
|                                 float(h/2), float(lh)); | ||||
| 
 | ||||
|             po.m_supportdata->support_tree_ptr->add_pad(bp, wt, h, md, er); | ||||
|         } | ||||
|     }; | ||||
|  | @ -387,7 +392,7 @@ void SLAPrint::process() | |||
|     }; | ||||
| 
 | ||||
|     // this would disable the rasterization step
 | ||||
|     // m_stepmask[slapsRasterize] = false;
 | ||||
|      m_stepmask[slapsRasterize] = false; | ||||
| 
 | ||||
|     for(size_t s = 0; s < print_program.size(); ++s) { | ||||
|         auto currentstep = printsteps[s]; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tamasmeszaros
						tamasmeszaros