From 10059a722b53f5cda39ed308f047974b6b9459f3 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 3 Jul 2024 20:02:13 +0200 Subject: [PATCH] Handling of None in draw.py #4924 - mostly untested --- src/ifcopenshell-python/ifcopenshell/draw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/draw.py b/src/ifcopenshell-python/ifcopenshell/draw.py index 4febc110bc..829814ff81 100644 --- a/src/ifcopenshell-python/ifcopenshell/draw.py +++ b/src/ifcopenshell-python/ifcopenshell/draw.py @@ -324,9 +324,9 @@ def main( # - style transparency # the factor determines how much white will be interpolated # into the style diffuse color. - clr = numpy.array(style.diffuse) + clr = numpy.array(style.diffuse if style else (0.6, 0.6, 0.6)) factor = (math.log(elements[0].distance + 2.0) / 7.0) * (1.0 - 0.5 * abs(elements[0].dot_product)) - if style.has_transparency: + if style and style.has_transparency: factor *= 1.0 - style.transparency clr = WHITE * (1.0 - factor) + clr * factor