Get Assembly Sheets

How can I get the sheets that are actually assembly sheets in the project?
image
I was using the below python code, however it gives me a warning.

import clr

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
from Revit.Elements import *

clr.AddReference("RevitNodes")
import Revit

clr.AddReference("RevitServices") 
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.ImportExtensions(Revit.GeometryConversion)
#Import Element wrapper extension methods
clr.ImportExtensions(Revit.Elements)
#Start Transaction
doc = DocumentManager.Instance.CurrentDBDocument

sheets = UnwrapElement(IN[0])
assem = []

for s in sheets:

	id = s.AssociatedAssemblyInstanceId
	element = doc.GetElement(id)
	assem.append(element)
	
OUT = assem

The warning I am getting in this python script node looks like this.

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. 
Traceback (most recent call last):
  File "<string>", line 6, in <module>
IOError: System.IO.IOException: Could not add reference to assembly RevitNodes
   at IronPython.Runtime.ClrModule.AddReference(CodeContext context, String name)
   at IronPython.Runtime.ClrModule.AddReference(CodeContext context, Object[] references)
   at Microsoft.Scripting.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
   at DSIronPython.IronPythonEvaluator.EvaluateIronPythonScript(String code, IList bindingNames, IList bindingValues)

PS I’m using Dynamo for Revit 2.0.3 for Revit 2019.2

Please suggest if there is any other way.

One thing that I used to grab assembly sheets, is that they have information in the parameter “Assembly: Name” which is determined by the assembly name that it was created for. So, using that logic, you can look up that parameter, and look to see, does it equal a blank value and then filtering that list of sheets to get just those sheets that belong to assemblies (the false values).

Hope this helps!

This is very simple and quick. Great help, thank you.

You are most welcome!