I want to sort objects by intersected Element, how?

Hello Dynos,

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!

KR

Andreas spiegel_check.dyn (3.7 KB)

Hi,

so you already have those elements and just want to check if they are mirrored?

no the mirror one is just a example!

I want to collect openings which are just in walls
the problem is these openings are everywhere in beams, floors and walls.

KR

Andreas

ok…so I would do it another way around…
first select all the walls in the project (or just some of them):

obraz

and then you can get all the openings using a function from the Wall class:
https://www.revitapidocs.com/2015/58990230-38cb-3af7-fd25-96ed3215a43d.htm

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
1 Like

i will check

Projekt3.rvt (2.2 MB)

you can test it with the object !

These are generic models!

You should input walls to the script - see my screenshot.

I cannot open your files at the moment. If no one answers sooner I can take a look in the evening.

so it worked, i have to access the script in english!

Thank You

1 Like

… i have to open it again! i works in the demo! with one wall.

But in the big project with 3000 walls is the same error!

Is it possible that some walls in that project are not modelled using wall tool? eg. they are generic models?

So it works just when i select it manualy the wall with Select.Elements.
When I do it by category all elements it doesn`work!
Why?

What does the error says?

Try using:

ElementQueries.OfCategory(Revit.Elements.Category.ByName("Walls"))

Like in the warning pic line <14>

Could you drop dummy rvt file here with few walls?

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
1 Like