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

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)


This is how it looks in Dynamo

And here is the RevitAPI link:

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