OSArch Community

How to generate a 3D polygon in python using ifc vertices ?

  1. B

    Hi,

    I'm currently working with python (3.8) and ifcopenshell and I'd like to use ifcopenshell's geometry vertices to create a 3D polygon at runtime. The polygons I'd like to create are pretty simple, it is only walls composed of less than 80 vertices.

    I tried using pyny3d but it seems like it's not working properly, only drawing a face and not even properly in most cases. I can't use mpl_toolkits because it only works with planar 3D polygon.

    My idea was maybe to use pyny3d's polyhedron and to try to draw the walls faces in separated polygon but I'm not sure. What are my possible solutions in order to do it easily ?

  2. S

    Geometry does depends on vertices AND polygons definition (either triangle / n-gons) ifc[open|closed]shell for breps, the most difficult part is the way holes are handled in polygons.

    Ifc does handle holes in polygons, where 3d packages usually don't, keeping 2 opposite edges between boundary and hole.

  3. M

    My advice is to use IfcOpenShell's geometry iterator to process the geometry that you want displayed. See sample code here: https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples#Geometry_processing

    Once you get the shape variable, it holds all the verts, edges, and faces, and automatically resolves any required tessellations including polygons with holes. Then, you can use that to translate to your output engine.

  4. B

    Thanks for the answer but actually I don't know about which library I could use to display at runtime the shapes returned by ifcopenshell, any recommendations?

  5. M
  6. B

    Oh okay so this kind of complex geometry can only be processed by 3D softwares if I understand correctly ?

  7. M

    @baldash if you want to display geometry on a screen, most commonly you would rely on an existing geometry display library or application.

  8. S

Login or Register to reply.