mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Enable imgui support point size. Fine tuning of support params.
This commit is contained in:
		
							parent
							
								
									7857206442
								
							
						
					
					
						commit
						140c717c04
					
				
					 4 changed files with 59 additions and 15 deletions
				
			
		|  | @ -2450,6 +2450,7 @@ void PrintConfigDef::init_sla_params() | |||
|     def->enum_values.push_back("portrait"); | ||||
|     def->enum_labels.push_back(L("Landscape")); | ||||
|     def->enum_labels.push_back(L("Portrait")); | ||||
|     def->mode = comExpert; | ||||
|     def->default_value = new ConfigOptionEnum<SLADisplayOrientation>(sladoPortrait); | ||||
| 
 | ||||
|     def = this->add("fast_tilt_time", coFloat); | ||||
|  | @ -2563,6 +2564,7 @@ void PrintConfigDef::init_sla_params() | |||
|     def->category = L("Supports"); | ||||
|     def->tooltip = L("Generate supports for the models"); | ||||
|     def->cli = ""; | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionBool(true); | ||||
| 
 | ||||
|     def = this->add("support_head_front_diameter", coFloat); | ||||
|  | @ -2580,6 +2582,7 @@ void PrintConfigDef::init_sla_params() | |||
|     def->tooltip = L("How much the pinhead has to penetrate the model surface"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->mode = comAdvanced; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(0.2); | ||||
| 
 | ||||
|  | @ -2590,6 +2593,8 @@ void PrintConfigDef::init_sla_params() | |||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->max = 20; | ||||
|     def->mode = comAdvanced; | ||||
|     def->default_value = new ConfigOptionFloat(1.0); | ||||
| 
 | ||||
|     def = this->add("support_pillar_diameter", coFloat); | ||||
|  | @ -2599,6 +2604,8 @@ void PrintConfigDef::init_sla_params() | |||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->max = 15; | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionFloat(1.0); | ||||
| 
 | ||||
|     def = this->add("support_pillar_connection_mode", coEnum); | ||||
|  | @ -2615,6 +2622,7 @@ void PrintConfigDef::init_sla_params() | |||
|     def->enum_labels.push_back(L("Zig-Zag")); | ||||
|     def->enum_labels.push_back(L("Cross")); | ||||
|     def->enum_labels.push_back(L("Dynamic")); | ||||
|     def->mode = comAdvanced; | ||||
|     def->default_value = new ConfigOptionEnum<SLAPillarConnectionMode>(slapcmDynamic); | ||||
| 
 | ||||
|     def = this->add("support_buildplate_only", coBool); | ||||
|  | @ -2634,6 +2642,7 @@ void PrintConfigDef::init_sla_params() | |||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->max = 1; | ||||
|     def->mode = comExpert; | ||||
|     def->default_value = new ConfigOptionFloat(0.0); | ||||
| 
 | ||||
|     def = this->add("support_base_diameter", coFloat); | ||||
|  | @ -2643,6 +2652,8 @@ void PrintConfigDef::init_sla_params() | |||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->max = 30; | ||||
|     def->mode = comAdvanced; | ||||
|     def->default_value = new ConfigOptionFloat(4.0); | ||||
| 
 | ||||
|     def = this->add("support_base_height", coFloat); | ||||
|  | @ -2652,6 +2663,7 @@ void PrintConfigDef::init_sla_params() | |||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->mode = comAdvanced; | ||||
|     def->default_value = new ConfigOptionFloat(1.0); | ||||
| 
 | ||||
|     def = this->add("support_critical_angle", coFloat); | ||||
|  | @ -2661,6 +2673,8 @@ void PrintConfigDef::init_sla_params() | |||
|     def->sidetext = L("°"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->max = 90; | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionFloat(45); | ||||
| 
 | ||||
|     def = this->add("support_max_bridge_length", coFloat); | ||||
|  | @ -2670,15 +2684,18 @@ void PrintConfigDef::init_sla_params() | |||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionFloat(15.0); | ||||
| 
 | ||||
|     def = this->add("support_max_pillar_link_distance", coFloat); | ||||
|     def->label = L("Max pillar linking distance"); | ||||
|     def->category = L("Supports"); | ||||
|     def->tooltip = L("The max distance of two pillars to get linked with each other."); | ||||
|     def->tooltip = L("The max distance of two pillars to get linked with each other." | ||||
|                      " A zero value will prohibit pillar cascading."); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0;   // 0 means no linking
 | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionFloat(10.0); | ||||
| 
 | ||||
|     def = this->add("support_object_elevation", coFloat); | ||||
|  | @ -2688,6 +2705,8 @@ void PrintConfigDef::init_sla_params() | |||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->max = 150; // This is the max height of print on SL1
 | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionFloat(5.0); | ||||
| 
 | ||||
|     def = this->add("support_points_density_relative", coInt); | ||||
|  | @ -2713,35 +2732,46 @@ void PrintConfigDef::init_sla_params() | |||
|     def->category = L("Pad"); | ||||
|     def->tooltip = L("Add a pad underneath the supported model"); | ||||
|     def->cli = ""; | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionBool(true); | ||||
| 
 | ||||
|     def = this->add("pad_wall_thickness", coFloat); | ||||
|     def->label = L("Pad wall thickness"); | ||||
|     def->category = L("Pad"); | ||||
| //     def->tooltip = L("");
 | ||||
|      def->tooltip = L("The thickness of the pad and its optional cavity walls."); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->max = 30; | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionFloat(2.0); | ||||
| 
 | ||||
|     def = this->add("pad_wall_height", coFloat); | ||||
|     def->label = L("Pad wall height"); | ||||
|     def->tooltip = L("Defines the cavity depth. Set to zero to disable the cavity."); | ||||
|     def->category = L("Pad"); | ||||
| //     def->tooltip = L("");
 | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->max = 30; | ||||
|     def->mode = comSimple; | ||||
|     def->default_value = new ConfigOptionFloat(5.0); | ||||
| 
 | ||||
|     def = this->add("pad_max_merge_distance", coFloat); | ||||
|     def->label = L("Max merge distance"); | ||||
|     def->category = L("Pad"); | ||||
| //     def->tooltip = L("");
 | ||||
|      def->tooltip = L("Some objects can get along with a few smaller pads " | ||||
|                       "instead of a single big one. This parameter defines " | ||||
|                       "how far the center of two smaller pads should be. If they" | ||||
|                       "are closer, they will get merged into one pad."); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->mode = comExpert; | ||||
|     def->default_value = new ConfigOptionFloat(50.0); | ||||
| 
 | ||||
|     // This is disabled on the UI. I hope it will never be enabled.
 | ||||
|     def = this->add("pad_edge_radius", coFloat); | ||||
|     def->label = L("Pad edge radius"); | ||||
|     def->category = L("Pad"); | ||||
|  | @ -2749,6 +2779,7 @@ void PrintConfigDef::init_sla_params() | |||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->mode = comAdvanced; | ||||
|     def->default_value = new ConfigOptionFloat(1.0); | ||||
| 
 | ||||
|     def = this->add("pad_wall_slope", coFloat); | ||||
|  | @ -2760,6 +2791,7 @@ void PrintConfigDef::init_sla_params() | |||
|     def->cli = ""; | ||||
|     def->min = 45; | ||||
|     def->max = 90; | ||||
|     def->mode = comAdvanced; | ||||
|     def->default_value = new ConfigOptionFloat(45.0); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -69,7 +69,7 @@ namespace sla { | |||
| const double SupportConfig::normal_cutoff_angle = 150.0 * M_PI / 180.0; | ||||
| 
 | ||||
| // The shortest distance of any support structure from the model surface
 | ||||
| const double SupportConfig::safety_distance_mm = 0.1; | ||||
| const double SupportConfig::safety_distance_mm = 0.5; | ||||
| 
 | ||||
| const double SupportConfig::max_solo_pillar_height_mm = 15.0; | ||||
| const double SupportConfig::max_dual_pillar_height_mm = 35.0; | ||||
|  | @ -438,8 +438,9 @@ struct Pillar { | |||
| 
 | ||||
|     inline const Vec3d& endpoint() const { return endpt; } | ||||
| 
 | ||||
|     Pillar& add_base(double height = 3, double radius = 2) { | ||||
|         if(height <= 0) return *this; | ||||
|     Pillar& add_base(double baseheight = 3, double radius = 2) { | ||||
|         if(baseheight <= 0) return *this; | ||||
|         if(baseheight > height) baseheight = height; | ||||
| 
 | ||||
|         assert(steps >= 0); | ||||
|         auto last = int(steps - 1); | ||||
|  | @ -447,7 +448,7 @@ struct Pillar { | |||
|         if(radius < r ) radius = r; | ||||
| 
 | ||||
|         double a = 2*PI/steps; | ||||
|         double z = endpt(Z) + height; | ||||
|         double z = endpt(Z) + baseheight; | ||||
| 
 | ||||
|         for(size_t i = 0; i < steps; ++i) { | ||||
|             double phi = i*a; | ||||
|  | @ -460,10 +461,10 @@ struct Pillar { | |||
|             double phi = i*a; | ||||
|             double x = endpt(X) + radius*std::cos(phi); | ||||
|             double y = endpt(Y) + radius*std::sin(phi); | ||||
|             base.points.emplace_back(x, y, z - height); | ||||
|             base.points.emplace_back(x, y, z - baseheight); | ||||
|         } | ||||
| 
 | ||||
|         auto ep = endpt; ep(Z) += height; | ||||
|         auto ep = endpt; ep(Z) += baseheight; | ||||
|         base.points.emplace_back(endpt); | ||||
|         base.points.emplace_back(ep); | ||||
| 
 | ||||
|  | @ -1004,9 +1005,12 @@ class SLASupportTree::Algorithm { | |||
|         // Together they define the plane where we have to iterate with the
 | ||||
|         // given angles in the 'phis' vector
 | ||||
| 
 | ||||
| //        std::cout << "Head check begin: " << std::endl;
 | ||||
| 
 | ||||
|         tbb::parallel_for(size_t(0), phis.size(), | ||||
|                           [&phis, &hits, &m, sd, r_pin, r_back, s, a, b, c] | ||||
|                           (size_t i) | ||||
| //        for(size_t i = 0; i < phis.size(); ++i)
 | ||||
|         { | ||||
|             double& phi = phis[i]; | ||||
|             double sinphi = std::sin(phi); | ||||
|  | @ -1037,7 +1041,10 @@ class SLASupportTree::Algorithm { | |||
|             auto q = m.query_ray_hit(ps + sd*n, n); | ||||
| 
 | ||||
|             if(q.is_inside()) { // the hit is inside the model
 | ||||
|                 if(q.distance() > 2*r_pin)  { | ||||
|                 if(q.distance() > r_pin + sd)  { | ||||
| 
 | ||||
| //                    std::cout << "Fatal inside hit. Phi: " << phi << " distance: " << q.distance() << std::endl;
 | ||||
| 
 | ||||
|                     // If we are inside the model and the hit distance is bigger
 | ||||
|                     // than our pin circle diameter, it probably indicates that
 | ||||
|                     // the support point was already inside the model, or there
 | ||||
|  | @ -1048,17 +1055,21 @@ class SLASupportTree::Algorithm { | |||
|                     hits[i] = HitResult(0.0); | ||||
|                 } | ||||
|                 else { | ||||
| //                    std::cout << "Recoverable inside hit. Phi: " << phi << " distance: " << q.distance() << " re-cast dist: " ;
 | ||||
|                     // re-cast the ray from the outside of the object.
 | ||||
|                     // The starting point has an offset of 2*safety_distance
 | ||||
|                     // because the original ray has also had an offset
 | ||||
|                     auto q2 = m.query_ray_hit(ps + (q.distance() + 2*sd)*n, n); | ||||
|                     hits[i] = q2; | ||||
| //                    std::cout << q2.distance() << std::endl;
 | ||||
|                 } | ||||
|             } else hits[i] = q; | ||||
|         }); | ||||
| 
 | ||||
|         auto mit = std::min_element(hits.begin(), hits.end()); | ||||
| 
 | ||||
| //        std::cout << "Head check end. Result: " << mit->distance() << std::endl;
 | ||||
| 
 | ||||
|         return *mit; | ||||
|     } | ||||
| 
 | ||||
|  | @ -1128,7 +1139,7 @@ class SLASupportTree::Algorithm { | |||
|             auto hr = m.query_ray_hit(p + sd*dir, dir); | ||||
| 
 | ||||
|             if(ins_check && hr.is_inside()) { | ||||
|                 if(hr.distance() > 2*r) hits[i] = HitResult(0.0); | ||||
|                 if(hr.distance() > r + sd) hits[i] = HitResult(0.0); | ||||
|                 else { | ||||
|                     // re-cast the ray from the outside of the object
 | ||||
|                     auto hr2 = | ||||
|  | @ -1457,7 +1468,7 @@ public: | |||
|                                   m_cfg.head_back_radius_mm, | ||||
|                                   w); | ||||
| 
 | ||||
|                 if(t <= w) { | ||||
|                 if(t <= w || (hp(Z) + nn(Z) * w) < m_result.ground_level) { | ||||
| 
 | ||||
|                     // Let's try to optimize this angle, there might be a
 | ||||
|                     // viable normal that doesn't collide with the model
 | ||||
|  | @ -1499,7 +1510,7 @@ public: | |||
|                 // save the verified and corrected normal
 | ||||
|                 m_support_nmls.row(fidx) = nn; | ||||
| 
 | ||||
|                 if(t > w) { | ||||
|                 if(t > w && (hp(Z) + nn(Z) * w) > m_result.ground_level) { | ||||
|                     // mark the point for needing a head.
 | ||||
|                     m_iheads.emplace_back(fidx); | ||||
|                 } else if( polar >= 3*PI/4 ) { | ||||
|  |  | |||
|  | @ -2296,7 +2296,7 @@ RENDER_AGAIN: | |||
| 
 | ||||
|         bool old_combo_state = m_combo_box_open; | ||||
|         // The combo is commented out for now, until the feature is supported by backend.
 | ||||
|         // m_combo_box_open = m_imgui->combo(_(L("Head diameter")), options_str, selection);
 | ||||
|         m_combo_box_open = m_imgui->combo(_(L("Head diameter")), options_str, selection); | ||||
|         force_refresh |= (old_combo_state != m_combo_box_open); | ||||
| 
 | ||||
|         // float current_number = atof(str);
 | ||||
|  |  | |||
|  | @ -3269,7 +3269,8 @@ void TabSLAPrint::build() | |||
|     optgroup->append_single_option_line("support_pillar_diameter"); | ||||
|     optgroup->append_single_option_line("support_pillar_connection_mode"); | ||||
|     optgroup->append_single_option_line("support_buildplate_only"); | ||||
|     optgroup->append_single_option_line("support_pillar_widening_factor"); | ||||
|     // TODO: This parameter is not used at the moment.
 | ||||
|     // optgroup->append_single_option_line("support_pillar_widening_factor");
 | ||||
|     optgroup->append_single_option_line("support_base_diameter"); | ||||
|     optgroup->append_single_option_line("support_base_height"); | ||||
|     optgroup->append_single_option_line("support_object_elevation"); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tamasmeszaros
						tamasmeszaros