Expose lightning infill angles (#13848)

* expose lightning infill angles

Update PrintObject.cpp

* Update src/libslic3r/PrintConfig.cpp

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Update GUI_Factories.cpp

* Fix lightning infill angles to 45 degrees for supports

Updated lightning infill angles to fixed values for consistency.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Rodrigo Faselli
2026-05-31 13:12:49 -03:00
committed by GitHub
parent 4d05ba0d02
commit 8548e5ca96
8 changed files with 53 additions and 4 deletions

View File

@@ -89,9 +89,9 @@ Generator::Generator(const PrintObject &print_object, const std::function<void()
m_supporting_radius = coord_t(m_infill_extrusion_width) * 100 * n_multiline / region_config.sparse_infill_density;
const double lightning_infill_overhang_angle = M_PI / 4; // 45 degrees
const double lightning_infill_prune_angle = M_PI / 4; // 45 degrees
const double lightning_infill_straightening_angle = M_PI / 4; // 45 degrees
const double lightning_infill_overhang_angle = region_config.lightning_overhang_angle.value * M_PI / 180.0;
const double lightning_infill_prune_angle = region_config.lightning_prune_angle.value * M_PI / 180.0;
const double lightning_infill_straightening_angle = region_config.lightning_straightening_angle.value * M_PI / 180.0;
m_wall_supporting_radius = coord_t(layer_thickness * std::tan(lightning_infill_overhang_angle));
m_prune_length = coord_t(layer_thickness * std::tan(lightning_infill_prune_angle));
m_straightening_max_distance = coord_t(layer_thickness * std::tan(lightning_infill_straightening_angle));
@@ -128,7 +128,7 @@ Generator::Generator(PrintObject* m_object, std::vector<Polygons>& contours, std
//TODO: decide whether enable density controller in advanced options or not
density = std::max(0.15f, density);
m_supporting_radius = coord_t(m_infill_extrusion_width) / density;
// Keep support-lightning behavior fixed and independent of user print-region angles.
const double lightning_infill_overhang_angle = M_PI / 4; // 45 degrees
const double lightning_infill_prune_angle = M_PI / 4; // 45 degrees
const double lightning_infill_straightening_angle = M_PI / 4; // 45 degrees

View File

@@ -1005,6 +1005,9 @@ static std::vector<std::string> s_Preset_print_options{
"lateral_lattice_angle_1",
"lateral_lattice_angle_2",
"infill_overhang_angle",
"lightning_overhang_angle",
"lightning_prune_angle",
"lightning_straightening_angle",
"top_surface_pattern",
"bottom_surface_pattern",
"infill_direction",

View File

@@ -3047,6 +3047,36 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(60));
def = this->add("lightning_overhang_angle", coFloat);
def->label = L("Lightning overhang angle");
def->category = L("Strength");
def->tooltip = L("Maximum overhang angle for Lightning infill support propagation.");
def->sidetext = u8"°";
def->min = 5;
def->max = 85;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(45));
def = this->add("lightning_prune_angle", coFloat);
def->label = L("Prune angle");
def->category = L("Strength");
def->tooltip = L("Controls how aggressively short or unsupported Lightning branches are pruned. This angle is converted internally to a per-layer distance.");
def->sidetext = u8"°";
def->min = 5;
def->max = 85;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(45));
def = this->add("lightning_straightening_angle", coFloat);
def->label = L("Straightening angle");
def->category = L("Strength");
def->tooltip = L("Maximum straightening angle used to simplify Lightning branches.");
def->sidetext = u8"°";
def->min = 5;
def->max = 85;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(45));
auto def_infill_anchor_min = def = this->add("infill_anchor", coFloatOrPercent);
def->label = L("Sparse infill anchor length");
def->category = L("Strength");

View File

@@ -1103,6 +1103,9 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, lateral_lattice_angle_1))
((ConfigOptionFloat, lateral_lattice_angle_2))
((ConfigOptionFloat, infill_overhang_angle))
((ConfigOptionFloat, lightning_overhang_angle))
((ConfigOptionFloat, lightning_prune_angle))
((ConfigOptionFloat, lightning_straightening_angle))
((ConfigOptionBool, align_infill_direction_to_model))
((ConfigOptionString, extra_solid_infills))
((ConfigOptionEnum<FuzzySkinType>, fuzzy_skin))

View File

@@ -1300,6 +1300,9 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "infill_shift_step"
|| opt_key == "sparse_infill_rotate_template"
|| opt_key == "solid_infill_rotate_template"
|| opt_key == "lightning_overhang_angle"
|| opt_key == "lightning_prune_angle"
|| opt_key == "lightning_straightening_angle"
|| opt_key == "skeleton_infill_density"
|| opt_key == "skin_infill_density"
|| opt_key == "infill_lock_depth"