import structural ifc, topological representation, bound of edges

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:

import structural ifc, topological representation, bound of edges

Post by bernd »

Allplan 2016.1 startet to support export of structural ifc. It seams for IfcStructuralSurfaceMember they use a topological representation which is not yet implemented in neither IfcOpenShell nor IfcPlusPlus. It is a Bound of given Edges. Because of better formating, the possibility to upload files and for further reference to keep all data (FreeCAD forum is ours!) I post it here and on IfcOpenShell forum on sourceforge. Link to IfcOpenShell forum: https://sourceforge.net/p/ifcopenshell/ ... /ea5f7217/

Code: Select all

import ifcopenshell
# from importIFC
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)
settings.set(settings.INCLUDE_CURVES,True)     # for stuct

def get_shape(entity):
    import Part
    cr = ifcopenshell.geom.create_shape(settings, entity)
    brep = cr.geometry.brep_data
    shape = Part.Shape()
    shape.importBrepFromString(brep)
    Part.show(shape)

# open file
file_path = '/home/hugo/Documents/projekte--BIM--opendev/freecad--ifc/files_fuer_ifc-debugging3/'

f1 = ifcopenshell.open(file_path + 'export-struct.ifc')
# check if the file was load, IFCPERSON  should be in any ifc
f1.by_type('ifcperson')

f1.by_id(607)
get_shape(f1.by_id(607))
output

Code: Select all

>>> import ifcopenshell
>>> # from importIFC
>>> 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)
>>> settings.set(settings.INCLUDE_CURVES,True)     # for stuct
>>> 
>>> def get_shape(entity):
...     import Part
...     cr = ifcopenshell.geom.create_shape(settings, entity)
...     brep = cr.geometry.brep_data
...     shape = Part.Shape()
...     shape.importBrepFromString(brep)
...     Part.show(shape)
... 
>>> # open file
>>> file_path = '/home/hugo/Documents/projekte--BIM--opendev/freecad--ifc/files_fuer_ifc-debugging3/'
>>> 
>>> f1 = ifcopenshell.open(file_path + 'export-struct.ifc')
>>> # check if the file was load, IFCPERSON  should be in any ifc
>>> f1.by_type('ifcperson')
[#14=IfcPerson($,'Bernd','Hahnebach',$,$,$,$,$)]
>>> 
>>> f1.by_id(607)
#607=IfcStructuralSurfaceMember('2M8_Etipn4MwtLx$9uhpUH',#4,'Surface 1',$,$,#595,#604,.SHELL.,250.0000000000001)
>>> get_shape(f1.by_id(607))
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<input>", line 3, in get_shape
  File "/usr/lib/python2.7/dist-packages/ifcopenshell/geom/__init__.py", line 77, in create_shape
    repr.wrapped_data if repr is not None else None
RuntimeError: Failed to process shape
I tried some debugging:

Code: Select all

# Allplan2016.1 --> export-struct.ifc
f1.by_id(607)
f1.by_id(607).Representation
f1.by_id(604).Representations
f1.by_id(602).Items
f1.by_id(600).Bounds
f1.by_id(587).Bound
f1.by_id(581).EdgeList
f1.by_id(583).EdgeElement
f1.by_id(356).EdgeStart
f1.by_id(356).EdgeEnd
f1.by_id(356).EdgeGeometry
f1.by_id(151)
f1.by_id(170)
f1.by_id(151)
f1.by_id(360)
f1.by_id(358)
output

Code: Select all

>>> # Allplan2016.1 --> export-struct.ifc
>>> f1.by_id(607)
#607=IfcStructuralSurfaceMember('2M8_Etipn4MwtLx$9uhpUH',#4,'Surface 1',$,$,#595,#604,.SHELL.,250.0000000000001)
>>> f1.by_id(607).Representation
#604=IfcProductDefinitionShape($,$,(#602))
>>> f1.by_id(604).Representations
(#602=IfcTopologyRepresentation(#11,$,'Face',(#600)),)
>>> f1.by_id(602).Items
(#600=IfcFaceSurface((#587),#596,.T.),)
>>> f1.by_id(600).Bounds
(#587=IfcFaceOuterBound(#581,.T.),)
>>> f1.by_id(587).Bound
#581=IfcEdgeLoop((#583,#584,#585,#586))
>>> f1.by_id(581).EdgeList
(#583=IfcOrientedEdge(*,*,#356,.T.), #584=IfcOrientedEdge(*,*,#377,.T.), #585=IfcOrientedEdge(*,*,#398,.T.), #586=IfcOrientedEdge(*,*,#419,.T.))
>>> f1.by_id(583).EdgeElement
#356=IfcEdgeCurve(#162,#181,#357,.T.)
>>> f1.by_id(356).EdgeStart
#162=IfcVertexPoint(#151)
>>> f1.by_id(356).EdgeEnd
#181=IfcVertexPoint(#170)
>>> f1.by_id(356).EdgeGeometry
#357=IfcLine(#151,#360)
>>> f1.by_id(151)
#151=IfcCartesianPoint((5.,5.000000000000002,3.125))
>>> f1.by_id(170)
#170=IfcCartesianPoint((-5.,5.000000000000002,3.125))
>>> f1.by_id(151)
#151=IfcCartesianPoint((5.,5.000000000000002,3.125))
>>> f1.by_id(360)
#360=IfcVector(#358,10.)
>>> f1.by_id(358)
#358=IfcDirection((-1.,0.,0.))
>>> 
Attachments
export-struct.ifc
(18.58 KiB) Downloaded 150 times
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: import structural ifc, topological representation, bound of edges

Post by bernd »

Just would like to give some feedback. Thomas fixed an error in IfcOpenShell which resulted in not returning any brep. See https://github.com/IfcOpenShell/IfcOpen ... e46cf38e4b

But the IfcStructuralSurfaceMamber seam to have wrong placements. That is why they return an invalid shape on FreeCAD import. See IfcOpenShell thread (first post) and post on Allplan support forum in german. https://connect.allplan.com/ch_de/forum ... e_ifc.html

As soon as I get replly from them I will report back.
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: import structural ifc, topological representation, bound of edges

Post by yorik »

FreeCAD will become one of the very rare apps to work with both arch and structural IFC elements!
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: import structural ifc, topological representation, bound of edges

Post by bernd »

yorik wrote:FreeCAD will become one of the very rare apps to work with both arch and structural IFC elements!
AFAIK FreCAD has been the fist CAD supporting structural ifc import and iss still the only one.


Apps supporting structural ifc
---------------------------------------------

- lot structural engineering software on european market does support import and export
-- AxisVM
-- RStab
-- SCIA
-- InfoGRAPH
-- may be more

- CAD
--FreeCAD import geometry
-- Allplan export geometry ( up to date buggy )

- Viewer
-- IfcPlusPlus viewer
-- none off the viewer on the market does support them
Post Reply