Batch CAD files into Revit sheets

I have this list of dwg files and then i want to put this CAD files in sheets (Revit)

If i do this one by one, like by using File Path node, then it will work. (Paper space gets attached in sheet)
Each dwg file have 1 paperspace layout
But I have big list of CAD files.

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

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

# Import RevitAPI
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 = IN

filePath = IN[0]
view = UnwrapElement(IN[1])

options = DWGImportOptions()
options.AutoCorrectAlmostVHLines = True
options.ColorMode = ImportColorMode.BlackAndWhite
options.OrientToView = True
options.ThisViewOnly = True
options.VisibleLayersOnly = True

linkedElem = clr.Reference[ElementId]()

TransactionManager.Instance.EnsureInTransaction(doc)
doc.Link(filePath, options, view, linkedElem)
TransactionManager.Instance.TransactionTaskDone()

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

Line 36 is this: doc.Link(filePath, options, view, linkedElem)

I have uploaded dyn file. Dynamo 2.0.2 and Orchid Package
sheet 3 - multiple files.dyn (18.8 KB)

Hopefully the error is because you are passing a list of file path but it expects only one
try, filepath[0] also convert it to string.

I have took it from this post and modified for mutliple dwg.

Not good in python. Any suggestion please :slightly_smiling_face: