mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 14:44:19 -06:00
[Bug fix] Fixes lightning infill with sparse infill width set to 0 causes "divide by zero" fatal error (#3592)
* Fix issue #3567 - Lightning infill with sparse infill width set to 0 causes "divide by zero" fatal error * Merge branch 'SoftFever:main' into Fix-#3567---Lightning-infill-with-sparse-infill-width-set-to-0-causes-divide-by-zero-fatal-error * Merge branch 'main' into Fix-#3567---Lightning-infill-with-sparse-infill-width-set-to-0-causes-divide-by-zero-fatal-error
This commit is contained in:
parent
c26a73a1ca
commit
a996188e38
1 changed files with 19 additions and 0 deletions
|
@ -76,6 +76,16 @@ Generator::Generator(const PrintObject &print_object, const std::function<void()
|
|||
const double layer_thickness = scaled<double>(object_config.layer_height.value);
|
||||
|
||||
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter));
|
||||
// Orca: fix lightning infill divide by zero when infill line width is set to 0.
|
||||
// firstly attempt to set it to the default line width. If that is not provided either, set it to a sane default
|
||||
// based on the nozzle diameter.
|
||||
if (m_infill_extrusion_width < EPSILON)
|
||||
m_infill_extrusion_width = scaled<float>(
|
||||
object_config.line_width.get_abs_value(max_nozzle_diameter) < EPSILON ?
|
||||
default_infill_extrusion_width :
|
||||
object_config.line_width.get_abs_value(max_nozzle_diameter)
|
||||
);
|
||||
|
||||
m_supporting_radius = coord_t(m_infill_extrusion_width) * 100 / region_config.sparse_infill_density;
|
||||
|
||||
const double lightning_infill_overhang_angle = M_PI / 4; // 45 degrees
|
||||
|
@ -102,6 +112,15 @@ Generator::Generator(PrintObject* m_object, std::vector<Polygons>& contours, std
|
|||
const double layer_thickness = scaled<double>(object_config.layer_height.value);
|
||||
|
||||
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter));
|
||||
// Orca: fix lightning infill divide by zero when infill line width is set to 0.
|
||||
// firstly attempt to set it to the default line width. If that is not provided either, set it to a sane default
|
||||
// based on the nozzle diameter.
|
||||
if (m_infill_extrusion_width < EPSILON)
|
||||
m_infill_extrusion_width = scaled<float>(
|
||||
object_config.line_width.get_abs_value(max_nozzle_diameter) < EPSILON ?
|
||||
default_infill_extrusion_width :
|
||||
object_config.line_width.get_abs_value(max_nozzle_diameter)
|
||||
);
|
||||
//m_supporting_radius: against to the density of lightning, failures may happen if set to high density
|
||||
//higher density lightning makes support harder, more time-consuming on computing and printing, but more reliable on supporting overhangs
|
||||
//lower density lightning performs opposite
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue