Reputation: 11
I have multiple standard formed bricks in an IFC file of the type IfcBuildingElementProxy. While I already managed to extract their positions from the IFC file, I now struggle to get the geometry (lenght, height, widht) from the file. I know that there are 2 ways to get the geometry:
parse trough the representation attributes of the bricks and try to write a code, that calculates the geometry. This method is really exhausting, as IFC files tend to work with a lot of references. I won't go this path.
get the geometry using a engine like ifcopenshell and opencascade. I know how to cast the bricks into a TopoDS object, but struggle to find the right methods to get the geometry.
import ifcopenshell
bricklist = ifc_file.by_type('IfcBuildingElementProxy')
for brick in bricklist:
shape = ifcopenshell.geom.create_shape(settings, brick).geometry
shape.methodtogetXYZgemeometrics???
Upvotes: 1
Views: 2774
Reputation: 302
Use
settings = geom.settings()
settings.set(settings.USE_WORLD_COORDS, True) #Translates and rotates the points to their world coordinates
...
shape = geom.create_shape(settings , brick )
points=shape.geometry.verts #The xyz points
triangles=shape.geometry.faces #Indexes to the points, 3 indexes form one triangle
Note that you can also use the element's 4x3 rotation/translation matrix and do the points translation yourself if you do not use the USE_WORLD_COORDS setting. This matrix is given by
shape.transformation.matrix.data
Upvotes: 2