Skip to content

Commit

Permalink
Arch: import IFC, fix crash if IfcProject is not found in ifc file
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Nov 4, 2019
1 parent 28daf35 commit 64cf85c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Mod/Arch/importIFC.py
Expand Up @@ -300,8 +300,13 @@ def insert(filename,docname,skip=[],only=[],root=None,preferences=None):
FreeCADGui.ActiveDocument.activeView().viewAxonometric()

# Create the base project object
projectImporter = importIFCHelper.ProjectImporter(ifcfile, objects)
projectImporter.execute()
if len(ifcfile.by_type("IfcProject")) > 0:
projectImporter = importIFCHelper.ProjectImporter(ifcfile, objects)
projectImporter.execute()
else:
# https://forum.freecadweb.org/viewtopic.php?f=39&t=40624
print("No IfcProject found in the ifc file. Nothing imported")
return doc

# handle IFC products

Expand Down

0 comments on commit 64cf85c

Please sign in to comment.