Skip to content

Commit

Permalink
Arch: importIFCHelper: Fix crash on unsupported entity
Browse files Browse the repository at this point in the history
When getCurveSet() is called on an unsupported entity, it runs into a
NameError exception because elts is not defined. Instead print a message
and return gracefully.

This is in line with overall behaviour of the importer: Ignore
unsupported elements instead of thowing errors.
  • Loading branch information
haraldg authored and yorikvanhavre committed May 29, 2020
1 parent ce0a4db commit 9346dfa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Mod/Arch/importIFCHelper.py
Expand Up @@ -634,6 +634,10 @@ def getCurveSet(ent):
elts = ent.Elements
elif ent.is_a() in ["IfcLine","IfcPolyline","IfcCircle","IfcTrimmedCurve","IfcRectangleProfileDef"]:
elts = [ent]
else:
print("getCurveSet: unhandled entity: ", ent)
return []

for el in elts:
if el.is_a("IfcPolyline"):
result.append(getPolyline(el))
Expand Down

0 comments on commit 9346dfa

Please sign in to comment.