How exactly is ifcopenshell.geom.create_shape parsing the geometry?
Hello, I want to have the global coordinates of the verts of the IfcBeam object (simple rectangle). The first option was to use:
settings = ifcopenshell.geom.settings()
settings.set(settings.USE_WORLD_COORDS, True)
shape = ifcopenshell.geom.create_shape(settings, element). It works ok, but the geometry is triangulated and I want to have quads (like in my ifc file).
That's why I tried to read the geometry manually from the ifc file using IfcShapeRepresentation Tessellation. To transform the local coordinates to global I used shape.transformation.matrix.data. The thing is the coordinates are not the same and I do not really understand why . (Screenshot #3)
So my questions are: how exactly is ifcopenshell.geom.create_shape parsing the geometry and what am I doing wrong? Thank you very much for your help.
Here are some screenshots to make it clearer:
1). The geometry defined in the ifc file
2). The transformation matrix and the verts from ifcopenshell.geom.create_shape(settings, element)
3). Global coordinates from the ifc file (IfcShapeRepresentation Tessellation)
Comments
https://blenderbim.org/docs-python/ifcopenshell-python/geometry_processing.html might help.
https://blenderbim.org/docs-python/ifcopenshell/geometry_settings.html#use-world-coords explains world coordinates. The object placement matrix is multiplied to each coordinate to give global coordinates. In general, I do not recommend you enable this setting unless you absolutely have to.
The faces returned by the shape creation are triangulated, however the edges resemble the original edges (which as you say may be quads, or could be ngons). You'll need to use the edge data if you want to get back your original quads.
@Moult thank you for your answer. I don't understand why the coordinates in the ifc file (Screenshot 1 and 3) are different from the coordinates calculated using ifcopenshell.geom.create_shape (Screenshot 2)? The global and local coordinate systems are the same, so the transformation matrix is an identity matrix. Do you have any idea ? Thank you very much.