From 9346dfa4f2909a6b70ddbb7ee4cc60a2ddb8e6b7 Mon Sep 17 00:00:00 2001 From: Harald Geyer Date: Mon, 25 May 2020 22:59:19 +0200 Subject: [PATCH] Arch: importIFCHelper: Fix crash on unsupported entity 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. --- src/Mod/Arch/importIFCHelper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mod/Arch/importIFCHelper.py b/src/Mod/Arch/importIFCHelper.py index fea9ef87a2e5..de26985582ed 100644 --- a/src/Mod/Arch/importIFCHelper.py +++ b/src/Mod/Arch/importIFCHelper.py @@ -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))