Import IFC

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
erwinm
Posts: 2
Joined: Tue Nov 12, 2013 7:44 am

Import IFC

Post by erwinm »

I wan’t to import a IFC file into FreeCAD, I drop the EXP file in %userprofile%\AppData\Roaming\FreeCAD but I get this message, can you help me
import.png
import.png (3.87 KiB) Viewed 5018 times
Sample.zip
(117.48 KiB) Downloaded 140 times
erwinm
Posts: 2
Joined: Tue Nov 12, 2013 7:44 am

Re: Import IFC

Post by erwinm »

Werner wrote:Hello Erwin,

I tested your file and I can confirm the error message. Since the ifc parser is written in Python this shows you the complete stack trace:

Couldn't locate IfcOpenShell
IfcOpenShell not found, falling back on internal parser.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Projects\FreeCAD-git\x64\Mod\Arch\importIFC.py", line 57, in insert
read(filename)
File "C:\Projects\FreeCAD-git\x64\Mod\Arch\importIFC.py", line 260, in read
ifc = ifcReader.IfcDocument(filename,schema=schema,debug=DEBUG)
File "C:\Projects\FreeCAD-git\x64\Mod\Arch\ifcReader.py", line 327, in __init__
f = IfcFile(filename,schema)
File "C:\Projects\FreeCAD-git\x64\Mod\Arch\ifcReader.py", line 161, in __init__
self.entById, self.entsByName, self.header = self.read()
File "C:\Projects\FreeCAD-git\x64\Mod\Arch\ifcReader.py", line 180, in read
e = self.parseLine(line)
File "C:\Projects\FreeCAD-git\x64\Mod\Arch\ifcReader.py", line 209, in parseLine
return {"id": id, "name": name, "attributes": self.parseAttributes(name, attrs)}
File "C:\Projects\FreeCAD-git\x64\Mod\Arch\ifcReader.py", line 227, in parseAttributes
(len(schema_attributes), len(parts), ent_name)
<type 'exceptions.AssertionError'>: Expected 6 attributes, got 4 (entity: IFCAPPLICATION

Unfortunately, I was never working on the ifc importer and doesn't know anything about the ifc format. So, I think it's best to ask Yorik because he has written the major part of it.

Regards,
Werner
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Import IFC

Post by bernd »

You should not use the internal parser. Use ifcopenshell instead. http://www.freecadweb.org/wiki/index.ph ... cOpenShell Normaly I do not have any problems even with huge an really complex ifc-bim-models to import to FreeCAD. Just some elements are missing sometimes.

I just tried to open your file using freecad 0.14 from github and ifcopenshell and got the following error:

Code: Select all

Cannot compute Inventor representation for the shape of SEEH_Intl_School_of_Creete.
I don't know If it is a FreeCAD or ifcopenshell issue. I would recommend the same as werner ask yorik.

Bernd
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Import IFC

Post by wmayer »

Cannot compute Inventor representation for the shape of SEEH_Intl_School_of_Creete.
OK, this means that the shape is null and thus the tessellation/polygonization algorithm fails.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Import IFC

Post by bernd »

Just opened your ifc in an editor and saw your file uses the new ifc standard IFC4, even an RC-Version.

Code: Select all

FILE_SCHEMA (('IFC4RC4'));
I don't know if neither freecad or ifcopenshell supports the new ifc-release allready. I would recommend to try the ifc-version IFC2X3

Bernd
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Import IFC

Post by yorik »

I had a look at your file too, indeed it's an ifc4, and it is not supported by ifcopenshell yet. In theory since ifc4 is an extension of ifc3, ifcopenshell should be able to parse it, and indeed it does... The problem is that the file uses some entities not defined in ifc3, such as IfcCompositeCurve. Therefore it creates an invalid shape. If this is an important matter to you, I suggest you contact Thomas Krijnen, the author of IfcOpenShell, to see what can be done.

And the internal parser will be too weak to support this I'm afraid... But I'll do a test with the IFC4 schema you provided...

Also it's interesting that this IFC files defines a building which has a shape representation directly attached to it... Never seen that before.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Import IFC

Post by bernd »

It seams the file consists only one element ?!? Attached a viewer screen. The red, blue and green cylinders are the koordinate axis.
Bernd
Attachments
screen.jpg
screen.jpg (211.09 KiB) Viewed 4940 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Import IFC

Post by yorik »

It is a weird file indeed... It contains both elements that are only in IFC4, such as IfcCompositeCurve, and elements that have apparently been removed from IFC4, such as IfcGeneralProfileProperties... I'm surprised you found an app able to open it Bernd. I didn't know about that ifcplusplus, I'll try at once...
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Import IFC

Post by bernd »

yorik wrote:... I'm surprised you found an app able to open it Bernd. I didn't know about that ifcplusplus, I'll try at once...
I have been trying to get in contact with the developer because ifcplusplus is open source. A while ago it even was available on linux (former name was ifcgears) but the developer is no longer providing linux binary. He said it is to much afford to maintain the cmake files. I wrote him that I am really interested in a linux version because there is no ifc viewer on linux out there. By the way ifcplusplus is fast, reeeeeeeeaaaaaaaally fast. I post here if I get more infos. Bernd

EDIT: the links may help to find it faster.
https://code.google.com/p/ifcplusplus/
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Import IFC

Post by yorik »

Yes there is no way to build it on linux unfortunately, only with visual studio on windows. Too bad!
As an ifc viewer on linux I currently use this: http://www.ifctoolsproject.com/ but it's not very convenient...
Post Reply