IFC import

This forum section is only for IFC-related issues
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: IFC import

Post by saso »

bernd wrote:It really makes fun changing colors of the whole model according Properties with just a few lines of python. Something Allplan is not capable of :D. Since Allplan exports the netvolume to the ifc it is easy to compare the exported volume and the FreeCAD volume. When I'll have a minute I'll post it to my github.
Is this functionality sort of similar to what is seen in this video https://www.youtube.com/watch?v=I0V_8EGYHgU ?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: IFC import

Post by bernd »

saso wrote:
bernd wrote:It really makes fun changing colors of the whole model according Properties with just a few lines of python. Something Allplan is not capable of :D. Since Allplan exports the netvolume to the ifc it is easy to compare the exported volume and the FreeCAD volume. When I'll have a minute I'll post it to my github.
Is this functionality sort of similar to what is seen in this video https://www.youtube.com/watch?v=I0V_8EGYHgU ?
That's exactly we what I would like to reach ... It only works with python, no GUI at all, but yes you could do what has been shown in the video. Currently I'm adapting the new ifc-importer and try to make some cleaning to get some code which could be used from others as well.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: IFC import

Post by bernd »

Tried to import the shape of a IfcStructuralSurfaceMember which is a IfcFaceSurface from tons of IfcFaceOuterBound. It is a IfcTopologicalrepresentation not IfcShapeRepresentation. It seams create_shape of IfcOpenShell does not support such entries. I have been playing a bit. If I change some entries and add it to the IfcSite the shape could be imported. I'm gone make a issue at github.

bernd

Code: Select all

>>> import ifc_wrapper
>>> i=ifc_wrapper.open("/home/hugo/Desktop/1549-IfcStructuralSurfaceMember.ifc")
>>> ss=ifc_wrapper.create_shape(i.by_id(1549))
>>> ss
''
EDIT:
added the IfcSite importtest as well
Attachments
1549-IfcStructuralSurfaceMember-test.ifc
(97.35 KiB) Downloaded 117 times
1549-IfcStructuralSurfaceMember.ifc
(96.65 KiB) Downloaded 147 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: IFC import

Post by bernd »

Found another strange beavior ...

Code: Select all

>>> i=ifc_wrapper.open("/home/hugo/Desktop/IfcOpenHouseV4-big.ifc")
>>> ss=ifc_wrapper.create_shape(i.by_id(18))
>>> ss
'\nCASCADE Topology V1, (c) Matra-Datavision\nLocations 2\n1\n           1000               0               0               0 \n              0            1000               0               0 \n              0               0            1000               0 \n1\n              1               0               0               0 \n              0               1               0               0 \n              0               0               1               0 \nCurve2ds 0\nCurves 1710\n1 4.4036934504663732 1.7552411608579259 -0.16089969983113592 -0.99937100020605163 0.020571428569779678 -0.028886333684885353 \n1 1.4177861950069222 1.816704198917872 -0.24720589974642102 0.95680473110017705 -0.28973951011606752 0.023994224763866499 \n
looks very good

but if #2320 is written IfcOpenShell istead IFCOPENSHELL the shape is nearly empty and no shape is imported ...

Code: Select all

>>> i=ifc_wrapper.open("/home/hugo/Desktop/IfcOpenHouseV4-small.ifc")
>>> ss=ifc_wrapper.create_shape(i.by_id(18))
>>> ss
'\nCASCADE Topology V1, (c) Matra-Datavision\nLocations 1\n1\n           1000               0               0               0 \n              0            1000               0               0 \n              0               0            1000               0 \nCurve2ds 0\nCurves 0\nPolygon3D 0\nPolygonOnTriangulations 0\nSurfaces 0\nTriangulations 0\n\nTShapes 1\nCo\n\n1100000\n*\n\n+1 1 '
>>>
Attachments
IfcOpenHouseV4-small.ifc
(117.94 KiB) Downloaded 117 times
IfcOpenHouseV4-big.ifc
(117.94 KiB) Downloaded 136 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: IFC import

Post by bernd »

OK found a better example. I thought it was related to the IfcSite but other entities written with small letters have problems too.

Code: Select all

>>> import ifc_wrapper
>>> i=ifc_wrapper.open("/home/hugo/Desktop/wall-small.ifc")
>>> ss=ifc_wrapper.create_shape(i.by_id(147))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/ifc_wrapper.py", line 148, in by_id
    def by_id(self, *args): return _ifc_wrapper.file_by_id(self, *args)
RuntimeError: Entity not found
>>> 
>>> i=ifc_wrapper.open("/home/hugo/Desktop/wall-big.ifc")
>>> ss=ifc_wrapper.create_shape(i.by_id(147))
>>> ss
'\nCASCADE Topology V1, (c) Matra-Datavision\nLocations 5\n1\n       .....
Attachments
wall-small.ifc
(3.12 KiB) Downloaded 156 times
wall-big.ifc
(3.12 KiB) Downloaded 137 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: IFC import

Post by yorik »

Hm indeed! Now I don't know if it's a bug in IfcOpenShell or a file that doesn't comply to the standard... I had never seen an ifc file with Ifc entities written with small letters before... Where did it come from?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: IFC import

Post by bernd »

yorik wrote:... I had never seen an ifc file with Ifc entities written with small letters before... Where did it come from?
Upps, that was me during testing to import the IfcStructuralSurfaceMember I used a IfcOpenShell (IFCOPENSHELL) in the ifcfile. I did not care about the upper case letter. I had done this with IfcPlusPlus before.

Good to know that ifcentities should be written with big letters. But some errormessage would be good. I may post this to IfcOpenShell too.
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: IFC import

Post by chakkree »

Thank you very much. :)
The attached ifc file is very useful for me to study ifc file structure.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: IFC import

Post by bernd »

chakkree wrote:Thank you very much. :)
The attached ifc file is very useful for me to study ifc file structure.
for more examples, check out threads:

viewtopic.php?f=23&t=15080
viewtopic.php?f=23&t=14059

Ahh and https://github.com/IfcOpenShell/IfcOpen ... test/input and http://academy.ifcopenshell.org/
tom
Posts: 165
Joined: Sun Mar 29, 2015 9:20 pm

Re: IFC import

Post by tom »

Hi all,

today I tried to use the ifcOpenShell in order to import a 3D model (not architectural related) from Sketchup into FC. Since the ifcOpenShell is not part of the OS X bundle I had to install it by myself. I downloaded the official 64bit Python 2.7 OS X package from http://www.ifcopenshell.org/python.html and copied it into the Contents/lib/python2.7/site-packages folder of the FC app bundle. Then the IFC import led to following exception:

Code: Select all

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/FreeCAD.app/Contents/Mod/Arch/importIFC.py", line 498, in insert
    settings.set(settings.INCLUDE_CURVES,False)
  File "/Applications/FreeCAD.app/Contents/lib/python2.7/site-packages/ifcopenshell/ifcopenshell_wrapper.py", line 103, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, settings, name)
  File "/Applications/FreeCAD.app/Contents/lib/python2.7/site-packages/ifcopenshell/ifcopenshell_wrapper.py", line 55, in _swig_getattr
    raise AttributeError(name)
<type 'exceptions.AttributeError'>: INCLUDE_CURVES
Then FC stuck forever. I had to kill FC. After wrapping the mentioned line importIFC.p:498 with a try/except in order to ignore the error I successfully could import the 3D model.
I don't know what the purpose of the attribute INCLUDE_CURVES is. Thus, my temporary patch may not be the proper solution for the problem. I wonder why nobody else was faced to the same issue, since the ifcOpenShell I used came from the official site. Or is this issue OS X related?

Regards,
Thomas


OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7797 (Git)
Build type: Release
Branch: (detached from 1408f0c)
Hash: 1408f0cd0a2912b72839c46877d58e0a24f0240b
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.8.0.oce-0.17
Post Reply