I try to find a intersecting object via Dynamo. f.e. I want to find all openings which are in walls. I want to select them.
I got this information: InstanceVoidCutUtils Method GetElementsBeingCut
Can I do it via a for loop, like this:
import clr
clr. AddReference (‘ProtoGeometry’) from Autodesk.DesignScript.Geometry import * #Die Eingaben für diesen Block werden in Form einer Liste in den IN-Variablen gespeichert.
items = IN[0]
mirs =
for i in items:
unwrapped = UnwrapElement (i) if unwrapped.Mirrored == True:
mirs. append (unwrapped)
#Weisen Sie Ihre Ausgabe der OUT-Variablen zu.
OUT = mirs
I don ´t know how to rebuild this code!
I am glad about any information or code!
just set True/False parameters accordingly to your needs (see the RevitApi docs description)
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
walls = UnwrapElement(IN[0])
output = []
for w in walls:
insertIds = w.FindInserts(True,False,False,False)
inserts = []
for id in insertIds:
e = doc.GetElement(id)
inserts.append(e)
output.append(inserts)
#Assign your output to the OUT variable.
OUT = output
Ok…I have checked with the ModelInPlace thing…If I create a model in place with a category “Wall” it gives me the exact same error.
Therefore you have to filter out elements that are not ‘proper’ walls.
You can do it either before passing to the python node or use the modified code :
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
#from Autodesk.Revit.DB import *
import Autodesk
doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
walls = UnwrapElement(IN[0])
output = []
for w in walls:
if isinstance(w,Autodesk.Revit.DB.Wall):
insertIds = w.FindInserts(True,False,False,False)
inserts = []
for id in insertIds:
e = doc.GetElement(id)
inserts.append(e)
output.append(inserts)
#Assign your output to the OUT variable.
OUT = output