Structural Opening Cut from Host

Is it possible to get hosted structural opening cuts from host family instance through dynamo.

1 Like

You can try it with generic models…

KR

Andreas

@Draxl_Andreas thanks for your reply. Actually what I am looking for is to get hosted structural opening cut elements from the host Structural Column Family. The link you shared is suggesting a way to get host element from hosted elements. Things are even challenging because the elements I am looking for are Structural Opening Cuts.

Hello @diptajit, if I understood correctly you want to check if your structural elements have opening cuts. What you need then is to get dependent elements from your structural elements and that can be done by tapping Revit’s API

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import * 
clr.AddReference('RevitAPI')
import Autodesk 
from Autodesk.Revit.DB import *
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = UnwrapElement(IN[0])

classFilter = ElementClassFilter(Opening)
# Place your code below this line

openings=dataEnteringNode.GetDependentElements(classFilter)
	

# Assign your output to the OUT variable.
OUT = openings

The script in the current form will work only on a single element. So you might want to run it in a loop. Hope that sets you in the right direction!
HostedElements.dyn (6.6 KB)

2 Likes

Hi @kristaps.rusis, this script works perfectly. Just that I am getting element Ids in string format instead of the actual elements. Can you please explain me why. Though it’s just an extra step, still for the sake of knowledge.

1 Like

@diptajit tbh I am not to sure why could be because that is how Revit’s database collects elements (that’s my best guess). The Revit’s API is very extensive so same as you, I am still learning new things every day!

Hi @kristaps.rusis I am really struggling to loop the script in a way that it can process multiple elements can you please provide a script that can handle a list of elements at once.


Well I did resolved the issue by putting it into a custom node and it works fine with a list of elements. But still definitely will like to know the way how it could be done only through script only. If someone shares the same here it would be great help.

Thank you.

@diptajit from Revits Api you can find methods that do that

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import * 
clr.AddReference('RevitAPI')
import Autodesk 
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = UnwrapElement(IN[0])
doc = DocumentManager.Instance.CurrentDBDocument
classFilter = ElementClassFilter(Opening)
# Place your code below this line

openings = dataEnteringNode.GetDependentElements(classFilter)

openingsById = doc.GetElement(openings[0])
# Assign your output to the OUT variable.
OUT = openingsById
2 Likes