Link multiple DWG files, DWGImportOptions

I am trying to link multiple DWG files into Revit using the Link Method. I get the error:

TypeError: expected DGNImportOptions, got DWGImportOptions
As I understand it from the Revit API docs, the Link Method can take both of these import options.
How do i make it expect DWGImportOptions?

Here is my code:

doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

filepaths = IN[0]
view = IN[1]

DWGoptions = DWGImportOptions()
DWGoptions.Placement = ImportPlacement.Origin
DWGoptions.OrientToView = True

for filepath in filepaths:
	loadResult = doc.Link(filepath, DWGoptions, view)
       

TransactionManager.Instance.TransactionTaskDone()

This is how it looks in Dynamo

And here is the RevitAPI link:
https://www.revitapidocs.com/2020/0e45b625-904e-06be-fabc-8591fed616f8.htm

Hi @magpies,

You didn’t unwrap the view.
view = UnwrapElement(IN[1])

You can also use the Genius Loci or Morpheus packages for this task.

1 Like

Thank you! I’ll check out those packages as well