Python intersect solid

hi i tried the following intersection of two solids:

wallsolid = walllist[i].get_Geometry(options) # this creates wall solid 1
iwallsolid = iwalllist[i].get_Geometry(options) # this creates wall solid 2

now i want to intersect:

intersect = BooleanOperationsUtils.ExecuteBooleanOperation(wallsolid, iwallsolid, BooleanOperationsType.Intersect)

the error message i receive =
TypeError: expected Solid, got GeometryElement

both of the above geometryelements are solids
any clue?

Silly question maybe, but why not using the nodes versions of these commands ?

1 Like

Are you sure you’re getting Solids, not just the Geometry? There is a Element.Geometry node and a Element.Solids node and I don’t know much about Python scripting but it sounds like it’s getting Geometry (in the sense of lines, surfaces, etc.) rather than Solids?

But as @mellouze says, wouldn’t it be simpler to graph this instead?

1 Like

@mellouze @Avz

i know that there are nodes for Element.Solid…
my task is, as being in a bigger context, to solve that in python

I think you need to cast the geometry object into a revit solid object off the top of my head I don’t know how to do that.

hi @Peter_Kompolschek , even though wallsolid and iwallsolid show “Autodesk.Revit.DB.Solid” when output, those are actually GeometryElements . You can convert them to lists and get the first items like this:

wallsolid = list(walllist[i].get_Geometry(options))[0] # this creates wall solid 1
iwallsolid = list(iwalllist[i].get_Geometry(options))[0] # this creates wall solid 2

This shoud do the trick!


Working, thank you!!!