Fix overhang preview ignoring support threshold fallbacks when angle set to 0 (#12650)

* Fix overhang preview not using fallbacks when angle is 0

The overhang visualization in Preview ("show overhangs based on support settings")
used the raw `support_threshold_angle` value from the configuration.

When `support_threshold_angle` was set to 0, Orca internally falls back to:
- 30° for tree supports
- an angle derived from `support_threshold_overlap` for normal supports

However, the preview logic ignored these fallbacks and used the raw value (0°),
leading to incorrect overhang highlighting that did not match the actual
support generation behavior.

This patch computes the effective overhang threshold used for preview:

• If `support_threshold_angle > 0`, use it directly
• If `support_threshold_angle == 0` and tree supports are used, fall back to 30°
• If `support_threshold_angle == 0` and normal supports are used, derive the
  equivalent angle from `support_threshold_overlap`, `layer_height`, and the
  external perimeter width.

The function now returns `normal_z` directly so the preview uses the same
effective slope threshold as the support generator.

As a result, the overhang highlight in Preview now correctly matches the
supports that will actually be generated.

* Apply Copilot suggestions
This commit is contained in:
Kiss Lorand
2026-05-26 12:17:19 +03:00
committed by GitHub
parent a57e0f500f
commit b0334325f8
2 changed files with 48 additions and 12 deletions

View File

@@ -488,7 +488,7 @@ public:
GLVolume* new_toolpath_volume(const ColorRGBA& rgba);
GLVolume* new_nontoolpath_volume(const ColorRGBA& rgba);
int get_selection_support_threshold_angle(bool&) const;
float get_selection_support_normal_z() const;
// Render the volumes by OpenGL.
//BBS: add outline drawing logic
void render(ERenderType type,