List revit links on Dynamo and not nesting revit links

Hi guys,
I created a dynamo that imports data from an excel to my revit links such “date of reception” etc…

My problem is that when i try listing my revit links on dymano, dynamo list also my nesting revit links (from my revit links).
i’am trying to figure an automated way to make a diffrence between nesting links and actual revit links.
Did any one had such problems knowing that i work with hundreds of links…
Thank you :smile:

I believe this is what you want.

If you use this on all of the RevitLinkTypes in the project, the ones that returns itself are the non-nested links. If they return a different Revit link, that is their root.

Example:

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

fecLinks = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks).OfClass(RevitLinkType).ToElements()

#linkNames = [l.Name for l in fecLinks]

linkRootsId = [i.GetRootId() for i in fecLinks]
linkRoots = [doc.GetElement(i) for i in linkRootsId]

OUT = zip(fecLinks,linkRoots)

image

3 Likes

Hi Kenny,
Iam kinda new on Dynamo, i have no idea what to do with what you gave me.
Should i go to web site and download something ?
I also dont know python.
Can you please direct me to a tutorial on how to integrate your codes in my dynamo
Thank you.

Hi @m.tradDBEVE ,

There is an OOTB (Out Of The Box) node in your Dynamo library called a “Python Script”. If you double click on the python script a python interface opens, in here you can copy paste the code @kennyb6 supplied to you.

With the + and - button on the Python script you can add more or less inputs as needed, in this case the script doesn’t need any.