mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 17:21:05 +00:00
Import externally defined materials
This commit is contained in:
@@ -71,6 +71,7 @@ class MaterialCreator():
|
|||||||
style = style.Styles[0]
|
style = style.Styles[0]
|
||||||
if not style.is_a('IfcSurfaceStyle'):
|
if not style.is_a('IfcSurfaceStyle'):
|
||||||
continue
|
continue
|
||||||
|
external_style = None
|
||||||
for surface_style in style.Styles:
|
for surface_style in style.Styles:
|
||||||
if surface_style.is_a('IfcSurfaceStyleShading'):
|
if surface_style.is_a('IfcSurfaceStyleShading'):
|
||||||
alpha = 1.
|
alpha = 1.
|
||||||
@@ -81,6 +82,13 @@ class MaterialCreator():
|
|||||||
surface_style.SurfaceColour.Green,
|
surface_style.SurfaceColour.Green,
|
||||||
surface_style.SurfaceColour.Blue,
|
surface_style.SurfaceColour.Blue,
|
||||||
alpha)
|
alpha)
|
||||||
|
elif surface_style.is_a('IfcExternallyDefinedSurfaceStyle'):
|
||||||
|
external_style = surface_style
|
||||||
|
if external_style:
|
||||||
|
material.BIMMaterialProperties.is_external = True
|
||||||
|
material.BIMMaterialProperties.location = external_style.Location
|
||||||
|
material.BIMMaterialProperties.identification = external_style.Identification
|
||||||
|
material.BIMMaterialProperties.name = external_style.Name
|
||||||
|
|
||||||
def assign_material_to_mesh(self, material, is_styled_item=False):
|
def assign_material_to_mesh(self, material, is_styled_item=False):
|
||||||
self.mesh.materials.append(material)
|
self.mesh.materials.append(material)
|
||||||
|
|||||||
Reference in New Issue
Block a user