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))
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
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)
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.))
>>>