Is there any dynamo script or python code which can filter the loaded & orphaned & not found xrefs by their status from all file references through dynamo and make a separate list.
While I couldn’t find a node in Dynamo (haven’t looked in 2025 yet) you may look at the GetHostDwgXrefGraph method in a Python node. I managed to get all loaded xrefs including attached xrefs where the results are listed as lists, if a list is longer than 1 the next xrefs are attached xrefs. unloaded xrefs are ignored. It is a fairly untested script so no idea how well it works.
# Load the Python Standard and DesignScript Libraries
import sys
import clr
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
import traceback
res = []
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
try:
xg = db.GetHostDwgXrefGraph(False)
for n in range(xg.NumNodes):
tmplist = []
db2 = xg.GetXrefNode(n).Database
if not db2 == None:
try:
xg2 = db2.GetHostDwgXrefGraph(True)
for n2 in range(xg2.NumNodes):
if not xg.GetXrefNode(n).IsNested or xg == None:
if n2 > 0:
tmplist.append(xg2.GetXrefNode(n2).Name)
else:
tmplist.append(xg.GetXrefNode(n).Name)
except:
err = traceback.format_exc()
tmplist.append(err)
res.append(tmplist)
#t.Commit()
except:
err = traceback.format_exc()
res.append(err)
pass
# Assign your output to the OUT variable.
OUT = res
1 Like