Draft: intermediate fix for get_normal: check if 3D view exists

This avoids issues with TechDraw views of Arch models if there is no active 3D view.
This commit is contained in:
Roy-043
2023-12-16 20:27:55 +01:00
parent ed10fe216d
commit 5f07c7aacd

View File

@@ -253,9 +253,11 @@ def get_normal(shape, tol=-1):
# Check the 3D view to flip the normal if the GUI is available
if App.GuiUp:
v_dir = gui_utils.get_3d_view().getViewDirection()
if normal.getAngle(v_dir) < 0.78:
normal = normal.negative()
view = gui_utils.get_3d_view()
if view is not None:
v_dir = view.getViewDirection()
if normal.getAngle(v_dir) < 0.78:
normal = normal.negative()
return normal