ifcopenshell (Python): change wall and window geometries

I have to do several geometry manipulations on my IFC files. These include:

  • move windows / doors along the wall axis
  • change the size of windows
  • change wall geometries (shorten or lengthen the wall along the length axis)
    So far I have successfully moved a window with ifcopenshell.api.run("geometry.edit_object_placement" ...) but the geometry of the wall won't change along with it meaning the window is now stuck inside of the wall (see image below). So I'm guessing I'll have to perform some sort of geometry manipulation here as well.

From my limited knowledge there would be basically two ways to achieve what I want. Looking at the example of the wall - in order to change its geometry I could:
1. somehow delete the old IfcWall instance, build it up with the changed geometries and then add it the updated wall to the model
2. iterate down to the IfcCartesianPoint instances of the wall face I want to change, move them and store them in the model. However I don't know how to commit changes to IfcCartesianPoints to the existing model.

Any hints, which could be the most promising approach and which api calls I could use to manipulate the geometries / vertices? I would prefer the second approach to achieve this, because it sounds a little less effort to me and I could keep all my GlobalIds.

Comments

  • Hello ! You shouldn't have to mess with vertices and faces in this case I think. The window entity and the opening that is made in the wall are two seperate entites, you also need to move the opening element.

  • @Gorgious said:
    Hello ! You shouldn't have to mess with vertices and faces in this case I think. The window entity and the opening that is made in the wall are two seperate entites, you also need to move the opening element.

    Thanks for the hint, but I checked and in my IFC file I can find no IfcOpeningElements. Neither in the .IsDecomposedBy property nor when filtering the model by_type("IfcOpeningElement"). It seems like the wall geometry is modeled in a way that it contains all the faces of the opening etc.

  • you can get the openings associated with wall with wall.HasOpenings and then go down that by selecting like wall.HasOpenings[0].RelatedOpeningElement

  • @Arv said:
    you can get the openings associated with wall with wall.HasOpenings and then go down that by selecting like wall.HasOpenings[0].RelatedOpeningElement

    Thanks, but this property is missing in my IFC files.

    For other operations I mentioned in the initial post, I definitely need to manipulate the geometries or vertices.
    I was able to change values of IfcCartesianPoints by traversing all the way down to the shape if my Element and then changing the cartesian point by calling util.element.replace_attribute(sub_part, old_point, new_point) on an instance of IfcPolyLoop.
    However currently my problem is that I'm working on the list of edges and vertices I extract via ifcopenshell.util.shape.get_vertices. Is there any way to map the vertices I extract from the model to the instances of IfcCartesianPoints, which I have to manipulate or do I have to take the long march through the IFC tree?

  • okay, maybe the walls are modeled separately with gaps between them. I guess the correct way to have a window or door is to first void the walls and then fill it with window that way you get all the relationships between the wall and the window. Not sure how else I can help you on this now.

  • I was able to change values of IfcCartesianPoints by traversing all the way down to the shape if my Element and then changing the cartesian point by calling util.element.replace_attribute(sub_part, old_point, new_point) on an instance of IfcPolyLoop.

    This is an interesting way to change the geometry :)

Sign In or Register to comment.