IFC import

A forum dedicated to the Arch module development
User avatar
yorik
Site Admin
Posts: 8545
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: IFC import

Postby yorik » Thu Dec 12, 2013 8:30 pm

hehe wow... impressive!
We should really think a bit about how to manage all the complexity of those rich IFC models... I'm usually not very satisfied with the dumb and too rigid Building->Floor->Objects hierarchy of ifc...
User avatar
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Thu Dec 12, 2013 10:01 pm

yorik wrote:... I'm usually not very satisfied with the dumb and too rigid Building->Floor->Objects hierarchy of ifc...
+1 All the elemets in ifc-files have lots of attributes which could be used to filter. At least the ifcbuildingelement itself.

To be honest, currently I'm happy if ALL elemtes are imported without errors. By the way since the model is downloaded from the internet the screenshots may be used somewhere.
Last edited by bernd on Thu Dec 12, 2013 10:37 pm, edited 1 time in total.
User avatar
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Thu Dec 12, 2013 10:11 pm

yorik wrote:the first hing it already does. You must enable debug messages in Arch IFC preferences options
I allready tried that option but for me it doesn't make any difference at all.
User avatar
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Sat Dec 14, 2013 10:55 pm

berndhahnebach wrote:
yorik wrote:the first hing it already does. You must enable debug messages in Arch IFC preferences options
I allready tried that option but for me it doesn't make any difference at all.

On my FreeCAD latest from source the debugmessages are shown only if a ifc is opend from pythonkonsole using

Code: Select all

importIFC.open(file)
. If the gui (mouse) is used to open a ifc, the debugmessages are not shown.
User avatar
yorik
Site Admin
Posts: 8545
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: IFC import

Postby yorik » Sat Dec 14, 2013 11:22 pm

Ah, maybe you must activate the "redirect python output" by right-clicking on the output window...
User avatar
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Sun Dec 15, 2013 1:50 am

yorik wrote:Ah, maybe you must activate the "redirect python output" by right-clicking on the output window...
:)

How about some little update in importIFC.py?

Code: Select all

hugo@weide:~/Documents/projekte--ifc/freecad/development/snapshot/free-cad-code/build$ diff Mod/Arch/importIFC.py ../src/Mod/Arch/importIFC.py
151c151
<                         nobj = makeStructure(obj.id,obj.type,shape,n)
---
>                         nobj = makeStructure(obj.id,shape,n)
396c396
< def makeStructure(entity,ifctype,shape=None,name="Structure"):
---
> def makeStructure(entity,shape=None,name="Structure"):
409,417c409
<             if ifctype == "IfcBeam":
<               structure.Role = "Beam"
<             elif ifctype == "IfcColumn":
<               structure.Role = "Column"
<             elif ifctype == "IfcSlab":
<               structure.Role = "Slab"
<             elif ifctype == "IfcFooting":
<               structure.Role = "Foundation"
<             if DEBUG: print "made structure object  ",entity,":",structure,"  IfcBuildingElement  ",ifctype
---
>             if DEBUG: print "made structure object  ",entity,":",structure
419d410
<
User avatar
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Sun Dec 15, 2013 1:59 am

and this one:

Code: Select all

diff Mod/Arch/ArchWall.py   ../src/Mod/Arch/ArchWall.py
33,36d32
< # Possible roles
< Roles = ["Wall"]
<
<
64d59
<     obj.Role = "Wall"
395,396d389
<         obj.addProperty("App::PropertyEnumeration","Role","Arch",
<                         str(translate("Arch","The role of this structural element")))
403d395
<         obj.Role = Roles
User avatar
yorik
Site Admin
Posts: 8545
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: IFC import

Postby yorik » Sun Dec 15, 2013 1:33 pm

Thanks! I added you first changes. The wall roles I didn't, because I prefer not to add things that have no real reason to exist yet... At the moment it's very easy to convert a wall to struct or vice-versa, so I think the current needs (for example structural walls) are fulfilled. If we find a reason to have roles for walls, I add it.

Next time, if you want to see your name in the official freecad commits (and therefore become an official freecad developer), think about making a git branch :mrgreen:
User avatar
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Sun Dec 15, 2013 3:59 pm

yorik wrote:Next time, if you want to see your name in the official freecad commits (and therefore become an official freecad developer), think about making a git branch :mrgreen:
One more reason to use git. :)

yorik wrote:...The wall roles I didn't, ... If we find a reason to have roles for walls, I add it.


I would like to do mass calculation of different elements. Really simple example.

Code: Select all

beam = 0
column = 0
foundation = 0
slab = 0
wall = 0
for o in objectlist:
  if hasattr(o,'Role'):         
    if o.Role == 'Beam':
      beam += 1
    elif o.Role == 'Column':
      column += 1
    elif o.Role == 'Foundation':
      foundation += 1
    elif o.Role == 'Slab':
      slab += 1
    elif o.Role == 'Wall':
      wall +=1
print('Folgende Elemente gefunden:')
print('Beam', beam)
print('Column', column)
print('Foundation', foundation)
print('Slab', slab)
print('Wall', wall)
print('Sum', beam+column+foundation+slab+wall)
print('')


But I'm fine anyway. We need to think about this attribute stuff either. I allready run into trouble again. Slab for ifcexport but special Element for structural calculation and mass calculation. !!! May be keep it in mind until the export works ...
Attachments
screen.jpg
screen.jpg (57.23 KiB) Viewed 1525 times
User avatar
bernd
Posts: 3863
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Mon Feb 13, 2017 6:23 am

gave this huge file (see first topic post) another try in FreeCAD but it failed to import the file :(

I played with python but I'm not able to find a shape I'm able to import. There must be something strange has happened ...


Code: Select all

ifcfile = '/home/hugo/Desktop/210_King_Merged.ifc'
import ifcopenshell, os
import Part

from ifcopenshell import geom
settings = ifcopenshell.geom.settings()
settings.set(settings.USE_BREP_DATA,True)
settings.set(settings.SEW_SHELLS,True)
settings.set(settings.USE_WORLD_COORDS,True)

f = ifcopenshell.open(ifcfile)
f.by_type('IfcPerson')
f.by_type('IfcBuildingElementProxy')

p = f.by_id(3213449)
r = p.Representation
print p, '\n', r

cr = ifcopenshell.geom.create_shape(settings, p)


I can try any IfcProduct. I get no brep ...