ifcconvert from ifcopenshell from python

Is it possible to convert ifc goemetry to mesh format from ifcopenshells python interface directly? Means without the use of subprocess and run the ifcconvert binary.

Comments

  • @bernd it is certainly possible. A very quick and dirty script, although not very robust but for simple geometries seems to work ok, could be something like this:

    import ifcopenshell
    import ifcopenshell.geom as geom
    
    settings = geom.settings()
    settings.set(settings.USE_WORLD_COORDS, True)
    
    f = ifcopenshell.open('/path/to/ifc/file')
    for obj in f.by_type('IfcProduct'):
        shape = ifcopenshell.geom.create_shape(settings, obj)
        geo = shape.geometry
    
        print(geo.verts)
        print(geo.edges)
        print(geo.faces)
    

    The geo object has a list of vertices and lists of indices for edges and faces.

  • @bernd if you mean converting IFC to the formats serialised by IfcConvert (e.g. OBJ, DAE, etc), I do not think it is possible yet. However, if the Epic Games application is approved, @aothms would be providing Python access to the SVG serialiser, and maybe that may be the key to the rest.

  • thanks guys for your suggestions an information.

Sign In or Register to comment.