Arch: fixed import of IFC object without representation

This commit is contained in:
Yorik van Havre 2016-08-01 10:54:09 -03:00
parent 3785cf7631
commit a79d2c6c9b

View File

@ -405,14 +405,15 @@ def insert(filename,docname,skip=[],only=[],root=None):
c = r.Styles[0].Styles[0].Styles[0].SurfaceColour c = r.Styles[0].Styles[0].Styles[0].SurfaceColour
if r.Item: if r.Item:
for p in ifcfile.by_type("IfcProduct"): for p in ifcfile.by_type("IfcProduct"):
if p.Representation: if hasattr(p,"Representation"):
for it in p.Representation.Representations: if p.Representation:
if it.Items: for it in p.Representation.Representations:
if it.Items[0].id() == r.Item.id(): if it.Items:
colors[p.id()] = (c.Red,c.Green,c.Blue) if it.Items[0].id() == r.Item.id():
elif it.Items[0].is_a("IfcBooleanResult"):
if (it.Items[0].FirstOperand.id() == r.Item.id()):
colors[p.id()] = (c.Red,c.Green,c.Blue) colors[p.id()] = (c.Red,c.Green,c.Blue)
elif it.Items[0].is_a("IfcBooleanResult"):
if (it.Items[0].FirstOperand.id() == r.Item.id()):
colors[p.id()] = (c.Red,c.Green,c.Blue)
else: else:
for m in ifcfile.by_type("IfcMaterialDefinitionRepresentation"): for m in ifcfile.by_type("IfcMaterialDefinitionRepresentation"):
for it in m.Representations: for it in m.Representations: