Problem with huge ifc file

This forum section is only for IFC-related issues
jureko
Posts: 14
Joined: Thu Oct 31, 2019 10:01 am

Re: Problem with huge ifc file

Postby jureko » Fri Dec 13, 2019 8:14 am

bernd wrote:
Wed Dec 11, 2019 8:05 pm
@jureko

debugging a 100 MB file does not make fun at all. Would it be possible to just save the objects from the screens in two ifc files, each for each screen ... all these objects make ifcopenshell crash.
#10227, #17862, #20598, #21505, #22339
#2545 (only the green box)
I have one more question, how do I find these flawed items in the ifc file?
Can you recommend any software? I tried IFCExplorer from Freecad, but it is not usable with such a large file.
User avatar
bernd
Posts: 8978
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problem with huge ifc file

Postby bernd » Tue Dec 17, 2019 8:06 am

with this code it is possible to extract just one entity and its geometry. Thanks to awesome Thomas from ifcopenshell ... (https://github.com/IfcOpenShell/IfcOpenShell/issues/564)

Code: Select all

import ifcopenshell
filepath = '/home/hugo/Desktop/'
f = ifcopenshell.open(filepath + 'EQUIPMENT12-CR-20191129.ifc')

g = ifcopenshell.file(schema=f.schema)
g.add(f.by_type("IfcProject")[0])
g.add(f[2545])
g.write(filepath + "entity_2545_error.ifc")

entity_2545_error.ifc
(72.7 KiB) Downloaded 9 times
User avatar
bernd
Posts: 8978
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problem with huge ifc file

Postby bernd » Tue Dec 17, 2019 8:08 am

another step forward ...

if opened in IFC++ there is a warning message ...

Code: Select all

Warning: triangulateLoops, face_loops.size() == 0, IFC entity: #1941=IfcExtrudedAreaSolid
It's worth to have a look at this, if it is the source of the crash.


Screenshot_20191217_090640.png
Screenshot_20191217_090640.png (58.24 KiB) Viewed 299 times
User avatar
bernd
Posts: 8978
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problem with huge ifc file

Postby bernd » Tue Dec 17, 2019 8:11 am

jureko wrote:
Fri Dec 13, 2019 8:14 am
bernd wrote:
Wed Dec 11, 2019 8:05 pm
@jureko

debugging a 100 MB file does not make fun at all. Would it be possible to just save the objects from the screens in two ifc files, each for each screen ... all these objects make ifcopenshell crash.
#10227, #17862, #20598, #21505, #22339
#2545 (only the green box)
I have one more question, how do I find these flawed items in the ifc file?
Can you recommend any software? I tried IFCExplorer from Freecad, but it is not usable with such a large file.
Start FreeCAD from a Linux bash or Windows console, import the file, FreeCAD will crash but if debugg is enabled in ifc prefs some value information is printed in the bash or console ...

Code: Select all

hugo@Ahorn:~/Desktop$ FreeCAD
FreeCAD 0.19, Libs: 0.19R18954 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

connect failed: Datei oder Verzeichnis nicht gefunden
Opening  /home/hugo/Desktop/EQUIPMENT12-CR-20191129.ifc ...done.
Building types and relationships table...done.
Parsing 1182 BIM objects...
1 / 1182 object #22 : IfcSite (arch) no brep : Site 
2 / 1182 object #26 : IfcBuilding (arch) no brep : Site 
3 / 1182 object #459 : IfcFlowController no layer found IfcFlowController (arch) 74k 15 solids : FlowController 
4 / 1182 object #601 : IfcFlowController no layer found IfcFlowController (arch) 74k 15 solids : FlowController 
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = FreeCAD path = /usr/local/bin pid = 25663
KCrash: Arguments: /usr/local/bin/FreeCAD 
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi from kdeinit
5 / 1182 object #2545 : IfcFlowController no layer found IfcFlowController (arch)sock_file=/run/user/1000/kdeinit5__0
[1]   Exit 253                FreeCAD

[2]+  Angehalten              FreeCAD
hugo@Ahorn:~/Desktop$ 
User avatar
bernd
Posts: 8978
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problem with huge ifc file

Postby bernd » Tue Dec 17, 2019 11:08 am

User avatar
bernd
Posts: 8978
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problem with huge ifc file

Postby bernd » Tue Dec 17, 2019 12:52 pm

jureko
Posts: 14
Joined: Thu Oct 31, 2019 10:01 am

Re: Problem with huge ifc file

Postby jureko » Wed Dec 18, 2019 12:11 pm

bernd wrote:
Tue Dec 17, 2019 8:06 am
with this code it is possible to extract just one entity and its geometry. Thanks to awesome Thomas from ifcopenshell ... (https://github.com/IfcOpenShell/IfcOpenShell/issues/564)

Code: Select all

import ifcopenshell
filepath = '/home/hugo/Desktop/'
f = ifcopenshell.open(filepath + 'EQUIPMENT12-CR-20191129.ifc')

g = ifcopenshell.file(schema=f.schema)
g.add(f.by_type("IfcProject")[0])
g.add(f[2545])
g.write(filepath + "entity_2545_error.ifc")
entity_2545_error.ifc
Thank you.
I tried to use this code hoping to make a python script that will break ifc into single geometry files.
Unfortunately I'm too weak for that, I get errors from the beginning:

Code: Select all

>>> g=ifcopenshell.file(schema=f.schema)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\freecad19\bin\lib\site-packages\ifcopenshell\file.py", line 75, in __getattr__
    return getattr(self.wrapped_data, attr)
  File "C:\freecad19\bin\lib\site-packages\ifcopenshell\ifcopenshell_wrapper.py", line 1714, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, file, name)
  File "C:\freecad19\bin\lib\site-packages\ifcopenshell\ifcopenshell_wrapper.py", line 80, in _swig_getattr
    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
AttributeError: 'file' object has no attribute 'schema'
Maybe there is some kind of IFC split, what can I use to split a big file into smaller ones? I found some trace that I can try using BIMserver, but I'm stuck for now with installation.
Using IfcOpenshell it should work, shouldn't it?
--
jureko
hlg
Posts: 23
Joined: Fri Jul 12, 2019 10:11 am

Re: Problem with huge ifc file

Postby hlg » Wed Dec 18, 2019 5:52 pm

I wrote and use a Groovy script to extract particular entities. It only works with regex matching, no proper parsing. Should be quite fast, but could be improved in terms of memory. It will fail if records are not separated with linebreaks (which is technically not required but mostly the case). By default it will not include the project, but you can pass a comma-separated list of IFC entity numbers for extraction and thus include the project if needed.
User avatar
bernd
Posts: 8978
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problem with huge ifc file

Postby bernd » Wed Dec 18, 2019 6:23 pm

Code: Select all

AttributeError: 'file' object has no attribute 'schema'
this looks like you have ifcopenshell version 0.5. There you can not choose a schema. I use ifcopenshell version 0.6.

Code: Select all

$ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ifcopenshell
>>> ifcopenshell.version
'0.6.0b0'
>>> 
>>> 
jureko
Posts: 14
Joined: Thu Oct 31, 2019 10:01 am

Re: Problem with huge ifc file

Postby jureko » Thu Dec 19, 2019 2:48 pm

bernd wrote:
Wed Dec 18, 2019 6:23 pm

Code: Select all

AttributeError: 'file' object has no attribute 'schema'
this looks like you have ifcopenshell version 0.5. There you can not choose a schema. I use ifcopenshell version 0.6.

Code: Select all

$ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ifcopenshell
>>> ifcopenshell.version
'0.6.0b0'
>>> 
>>> 
That's right, you're right.
Ifcopenshell '06b' works fine.
I have a question. What's the name of the property with the number of a singular entity ifc file?
I've printed out a list from the file, and I'd like to save those entitions as individual files. I just don't know how to get the number of a particular part.

Code: Select all

This:
		f = ifcopenshell.open(plik)
		g = ifcopenshell.file(schema=f.schema)
		g.add(f.by_type("IfcProject")[0])

		products = f.by_type('IfcProduct')
		for product in products:
			print(product)
results:
#15=IfcBuildingStorey('0BaS7LhDjFtxGSqtqP2SOS',#8,'+18,05',$,'',#76,$,'+18,05',.ELEMENT.,18050.)
#28=IfcSite('0BaS7LhDjFtxGSqttcyV2T',#8,'Default',$,'',#69,$,$,.ELEMENT.,(52,14,59,999999),(20,59,59,999999),0.,$,$)
#29=IfcWallStandardCase('1UFEKweez2jff53MBBtjeG',#8,'Ściana podstawowa:Fassadenpaneele RAL 9010:627381',$,'Ściana podstawowa:Fassadenpaneele RAL	
	
How to get #15, #28, etc to save it with 15.ifc, 28.ifc etc