IFC: import helper, add method to convert IFC color to RGB col

This commit is contained in:
Bernd Hahnebach
2023-02-23 11:17:37 +01:00
committed by Uwe
parent 4f324add9f
commit 0cea42dfd8

View File

@@ -449,6 +449,20 @@ def getColorFromMaterial(material):
return None
def color2colorRGB(color_data):
if color_data is None:
return None
color_rgb = [
int(round(color_data[0]*255, 0)),
int(round(color_data[1]*255, 0)),
int(round(color_data[2]*255, 0))
] # int(159.99) would return 159 not 160, thus round
return color_rgb
def getColorFromStyledItem(styled_item):
"""Get color from the IfcStyledItem.