Cut wall with voids

Hi,

I have an issue. I am using the window Revit template which has a wall embedded. I have created some voids and I want to cut the wall with these voids. When using the user interface, I can use the Cut Geometry tool and it works perfectly. But I want to automate it using the Revit API and Python. The question is, is there a method to do this? I have already tried the following:

  • BooleanOperationsUtils.ExecuteBooleanOperation: This one works in the sense that it outputs a solid, but it is not actually making the hole in the wall.
  • InstanceVoidCutUtils.AddInstanceVoidCut: The output is an error that says: “The element cannot be cut with a void instance. Parameter name: element.”
  • CombineElements: The output is an error that says: “expected CombinableElement, got GeometryElement.”

Nothing is working, and it seems that if I was cutting a solid then it might be possible, but I want to cut a wall. Also, the Opening Cut doesn’t work because I need to use the voids I created to cut the wall.

Does anyone know how to accomplish this?

Thank you. :slight_smile:

Hi @ramirezjhosa,

In the past, I have used this for face based elements.

from pyrevit import revit, DB

doc  = revit.doc
# get revit selection
element_that_cuts = revit.get_selection().elements
with revit.Transaction('Cutting Elements'):
    for i in element_that_cuts:
        try:
            eleToBeCut = i.Host
            DB.SolidSolidCutUtils.AddCutBetweenSolids(doc, eleToBeCut, i)
        except Exception as e:
            print(e)
            continue

Thank you @Jean-Marc for your quick response.

Unfortunately, the method you mention doesnt work in this case, it outputs this error:
Message: The element must be in a project document or in a conceptual model, pattern based curtain panel, or adaptive component family. Parameter name: solidToBeCut
I am trying to cut the wall that comes inside the window family template. Therefore the error.

There must be a way to solve this. Any other ideas?

Thank you.