lrsmns
March 4, 2024, 10:13am
1
Hi I am trying to compute the intersection of two solids in my python…
I’m not sure where I’m doing wrong in my code, but it’s returning this error
This is my code below:
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
workspace = IN[0]
wall = IN[1]
solid_workspace = workspace.Solids
solid_wall = wall.Solids
intersection = solid_workspace[0].IntersectAll(solid_wall[0])
OUT = intersection
I’m guessing the problem lies in the argument?
What is the input geometry for “workspace”?
lrsmns
March 4, 2024, 12:43pm
3
It’s a general family with only geometrical representation, taken from the node Select Model Element
And therefore it isn’t geometry, but a family instance.
Family instances don’t have an IntersectAll method, geometry does. Unwrap your family, union it into a single geometry, and then use the IntersectAll method and you should be fine.
lrsmns
March 4, 2024, 1:28pm
5
I found the mistake, it should be intersection = solid_workspace[0].IntersectAll(solid_wall)
The argument should have been kept as a list instead of an item… Thanks to your tip from AttributeError: object has no attribute - Revit - Dynamo (dynamobim.com) , I was able to read the documentation
1 Like