From 6346c5ba471b3e385858411fe9ee52ae4d21bafe Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 22 Oct 2022 20:30:13 +0200 Subject: [PATCH] #1444 V3d_DirectionalLight compatibility fix --- src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py b/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py index 7590fa6826..2d5be63210 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py @@ -32,6 +32,8 @@ try: # python 3.3+ except ImportError: # python 2 from collections import Iterable +import OCC + try: from OCC.Core import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d @@ -90,8 +92,11 @@ def initialize_display(): dirs = [(3, 2, 1), (-1, -2, -3)] for dir in dirs: - light = V3d.V3d_DirectionalLight(viewer_handle) - light.SetDirection(*dir) + if OCC.VERSION < "7.5": + light = V3d.V3d_DirectionalLight(viewer_handle) + light.SetDirection(*dir) + else: + light = V3d.V3d_DirectionalLight(*dir) viewer.SetLightOn(light.GetHandle() if USE_OCCT_HANDLE else light) setup()