# Link multiple DWG files, DWGImportOptions

**URL:** https://forum.dynamobim.com/t/link-multiple-dwg-files-dwgimportoptions/52198
**Category:** Revit
**Tags:** dwg
**Created:** [June 23, 2020, 10:33am UTC](https://forum.dynamobim.com/t/link-multiple-dwg-files-dwgimportoptions/52198 "2020-06-23T10:33:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![magpies](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@magpies](https://forum.dynamobim.com/u/magpies)
#### Post date: [June 23, 2020, 10:33am UTC](https://forum.dynamobim.com/t/link-multiple-dwg-files-dwgimportoptions/52198/1 "2020-06-23T10:33:51Z")

</div>

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

 ![dynamo_screenshot_error](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/2/52ee0a68d2abc3b32cfda1c40f0ffd55820c587e.png)

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

---

<div class="post-metadata">

### Author: ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)
#### Post date: [June 23, 2020, 12:00pm UTC](https://forum.dynamobim.com/t/link-multiple-dwg-files-dwgimportoptions/52198/2 "2020-06-23T12:00:23Z")

</div>

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.

 ![Link DWG](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/2/e25de8629cdb61b03c51dcee8b95b53215482bd6.png)

---

<div class="post-metadata">

### Author: ![magpies](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@magpies](https://forum.dynamobim.com/u/magpies)
#### Post date: [June 23, 2020, 12:23pm UTC](https://forum.dynamobim.com/t/link-multiple-dwg-files-dwgimportoptions/52198/3 "2020-06-23T12:23:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ariviti6](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@ariviti6](https://forum.dynamobim.com/u/ariviti6)
#### Post date: [March 25, 2023, 8:37pm UTC](https://forum.dynamobim.com/t/link-multiple-dwg-files-dwgimportoptions/52198/4 "2023-03-25T20:37:56Z")

</div>

Hi!  
I’m trying to use the node “LinkDwg.AtOrigin” of Morpheus package for a link multiple DWG in diferent views. I’m a beginner user of dynamo.

I’ve prepared an excel with all views on first column and all file paths in the second one.  
So, I’ve imported data to dynamo, I’ve create two lists, file paths and vides, but when I run the rutine I get an error, and I don’t know why.

If I punt only one file path anda one view, rutine works perfectly. But I need to link several DWG…

 ![dynamo rutine](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/e/ee1acae68b25b3f3f6352bb53241efbb62947c6b.jpeg)

Could you help me?  
Thanks
