ifc import, string brakes FreeCAD

This forum section is only for IFC-related issues
Post Reply
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

ifc import, string brakes FreeCAD

Post by bernd »

attached an ifc which makes FreeCAD crashing. The issue is IfcOpenShell related. I'm gone post to the IfcOpenShell forums later afterwards and will post the link. The reason I'm gone post it here anyway because FreeCAD crashes. This should not happen IMHO. What do you guys think?

The file was originally downloaded from http://hilti.cadclick.com/ The funny thing is the file was produced by Yeah IfcOpenShell :shock:

Code: Select all

Opening /home/hugo/Desktop/hilti-anchor.ifc...done.
Building relationships table...done.
Processing objects...
1/4 creating object #18 : IfcSite (arch) no brep 2/4 creating object #25 : IfcBuilding (arch) no brep 3/4 creating object #32 : IfcBuildingStorey (arch) no brep 4/4 creating object #34 : IfcDiscreteAccessory (arch)Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Arch/importIFC.py", line 278, in open
    doc = insert(filename,doc.Name,skip,only,root)
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Arch/importIFC.py", line 447, in insert
    if product.Representation and MERGE_MODE_ARCH == 0 and archobj:
  File "/usr/lib/python2.7/dist-packages/ifcopenshell/__init__.py", line 50, in __getattr__
    return entity_instance.wrap_value(self.wrapped_data.get_argument(self.wrapped_data.get_argument_index(name)))
  File "/usr/lib/python2.7/dist-packages/ifcopenshell/ifcopenshell_wrapper.py", line 853, in get_argument
    def get_argument(self, *args): return _ifcopenshell_wrapper.entity_instance_get_argument(self, *args)
<type 'exceptions.RuntimeError'>: Entity not found
Beendet
hugo@weide:~/Documents/dev/freecad/freecadbhb_dev/build$ 
The culprit is a string in entity #53 There for none of the entities behind #53 could be found by IfcOpenShell.

Code: Select all

hugo@weide:~$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import ifcopenshell
>>> f = ifcopenshell.open("/home/hugo/Desktop/hilti-anchor.ifc")
>>> f.by_type('ifcperson')
[#1=IfcPerson('Hilti','Hilti','Hilti',$,$,$,$,$)]
>>> f.by_id(54)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/ifcopenshell/__init__.py", line 121, in by_id
    def by_id(self, id): return self[id]
  File "/usr/lib/python2.7/dist-packages/ifcopenshell/__init__.py", line 118, in __getitem__
    return entity_instance(self.wrapped_data.by_id(key))
  File "/usr/lib/python2.7/dist-packages/ifcopenshell/ifcopenshell_wrapper.py", line 801, in by_id
    def by_id(self, *args): return _ifcopenshell_wrapper.file_by_id(self, *args)
RuntimeError: Entity not found
>>> 
and using the fixed file

Code: Select all

hugo@weide:~$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> 
>>> import ifcopenshell
>>> f = ifcopenshell.open("/home/hugo/Desktop/hilti-anchor_fixed.ifc")
>>> f.by_type('ifcperson')
[#1=IfcPerson('Hilti','Hilti','Hilti',$,$,$,$,$)]
>>> f.by_id(54)
#54=IfcPropertySingleValue('Untergrundmaterial',$,IfcText('Beton (gerissen); Beton (ungerissen)'),$)
>>> 
>>> f.by_id(53)
#53=IfcPropertySingleValue('Umweltbedingungen',$,IfcText('string was deleted becaus it causes problems'),$)
>>> 
>>> 

OS: Debian GNU/Linux 8.2 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6185 (Git)
Build type: Debug
Branch: master
Hash: 0b3f60a68c65332d72cf5ac3331bbcde24405b03
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
Attachments
hilti-anchor_fixed.ifc
(158.64 KiB) Downloaded 125 times
hilti-anchor.ifc
(158.8 KiB) Downloaded 169 times
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: ifc import, string brakes FreeCAD

Post by yorik »

hm yes that error should be handled in FreeCAD. I'll do that ASAP.

*EDIT* git commit 7691e22
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: ifc import, string brakes FreeCAD

Post by bernd »

yorik wrote:hm yes that error should be handled in FreeCAD. I'll do that ASAP.
Cool

Your post reminds me to post the link to IfcOpenShel forum thread: http://sourceforge.net/p/ifcopenshell/d ... it=25#51c7
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: ifc import, string brakes FreeCAD

Post by bernd »

yorik wrote:hm yes that error should be handled in FreeCAD. I'll do that ASAP.

*EDIT* git commit 7691e22
wow, fast :-) thanks

Thomas has fixed IfcOpenShell too https://github.com/IfcOpenShell/IfcOpen ... 12d3379c37 Just tested, works for me :-) on Debian Jessie.

EDIT: win64 builds viewtopic.php?f=23&t=12563&p=110042#p110042
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: ifc import, string brakes FreeCAD

Post by bernd »

Some faces are missing after Import. I tested to convert to step by the use of ifcopenshell directly, same problem. It seams IfcOpenShell related. I'll post in the IfcOpenShell forum but post it here anyway because I can attach some screens here.

FreeCAD, IfcOpenShell
screen-fc.png
screen-fc.png (112.7 KiB) Viewed 2192 times

IfcPP and other
screen-ifcpp.png
screen-ifcpp.png (68.21 KiB) Viewed 2192 times
Post Reply