# Moving a linked RVT file along the vector X and Y with Dynamo

**URL:** <https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [February 27, 2019, 8:38am UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704 "2019-02-27T08:38:25Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafal.lewandowski](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rafal.lewandowski/32/68148_2.png) [@rafal.lewandowski](https://forum.dynamobim.com/u/rafal.lewandowski)\
**Post date:** [February 27, 2019, 8:38am UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/1 "2019-02-27T08:38:25Z")

</div>

Hi Everybody! I would like to move linked RVT file by set values along the vector X and Y. I installed an additional library but still I couldn’t find right node. At the moment I was able to move selected objects and whole levels but only those that were created directly in a the project. I want to get into the linked files. Any ideas? Thanks for help in advance!

---

<div class="post-metadata">

**Author:** ![Tomasz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tomasz/32/66785_2.png) [@Tomasz](https://forum.dynamobim.com/u/Tomasz)\
**Post date:** [February 27, 2019, 9:13am UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/2 "2019-02-27T09:13:37Z")

</div>

Do you want to move a Link Instance or to move particular items in the linked model?

---

<div class="post-metadata">

**Author:** ![rafal.lewandowski](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rafal.lewandowski/32/68148_2.png) [@rafal.lewandowski](https://forum.dynamobim.com/u/rafal.lewandowski)\
**Post date:** [February 27, 2019, 10:10am UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/3 "2019-02-27T10:10:16Z")

</div>

Hi @Tomasz I want to move for example 30 RVT links in the same time by set values on the X and Y axes.

---

<div class="post-metadata">

**Author:** ![Tomasz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tomasz/32/66785_2.png) [@Tomasz](https://forum.dynamobim.com/u/Tomasz)\
**Post date:** [February 27, 2019, 10:59am UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/4 "2019-02-27T10:59:04Z")

</div>

```
import clr

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

l = UnwrapElement(IN[0])
v = UnwrapElement(IN[1]).ToXyz()

doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
OUT = l.Location.Move(v)
TransactionManager.Instance.TransactionTaskDone()

```

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/e/0eb3c6654324f9dc3a8a9742c628e3849ef663f2.png)

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/6/36ad6d05a5b801f1c159b41c51dc60fcc8541e9b.png)

---

<div class="post-metadata">

**Author:** ![rafal.lewandowski](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rafal.lewandowski/32/68148_2.png) [@rafal.lewandowski](https://forum.dynamobim.com/u/rafal.lewandowski)\
**Post date:** [February 27, 2019, 12:46pm UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/5 "2019-02-27T12:46:42Z")

</div>

Great! Thanks @Tomasz for nice script 👌🏻 Will be possible to make a move for all the linked files? This script is working perfectly with one selected element. Will be possible to make an action choosing RVT Links category?

---

<div class="post-metadata">

**Author:** ![Tomasz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tomasz/32/66785_2.png) [@Tomasz](https://forum.dynamobim.com/u/Tomasz)\
**Post date:** [February 27, 2019, 12:58pm UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/6 "2019-02-27T12:58:35Z")

</div>

The second image shows how to select all link instances. If you need help with sorting logic - post your graph.

Try this:

```
import clr

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

links = UnwrapElement(IN[0])
vector = UnwrapElement(IN[1]).ToXyz()

doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
for l in links:
    l.Location.Move(vector )
TransactionManager.Instance.TransactionTaskDone()
```

---

<div class="post-metadata">

**Author:** ![rafal.lewandowski](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rafal.lewandowski/32/68148_2.png) [@rafal.lewandowski](https://forum.dynamobim.com/u/rafal.lewandowski)\
**Post date:** [February 27, 2019, 1:17pm UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/7 "2019-02-27T13:17:18Z")

</div>

Unfortunately when I selected two Revit Links or I use a second method with Element Types at the end I have seen warning. Please have a look.

 ![Dynamo%20Warning](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/7/37eacf297fdadea6db9c7a3c1ee2c4884356d632.jpeg)

---

<div class="post-metadata">

**Author:** ![Tomasz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tomasz/32/66785_2.png) [@Tomasz](https://forum.dynamobim.com/u/Tomasz)\
**Post date:** [February 27, 2019, 1:19pm UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/8 "2019-02-27T13:19:21Z")

</div>

Please see post above.

PS. Pozdrowienia z Wrocławia!

---

<div class="post-metadata">

**Author:** ![rafal.lewandowski](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rafal.lewandowski/32/68148_2.png) [@rafal.lewandowski](https://forum.dynamobim.com/u/rafal.lewandowski)\
**Post date:** [February 27, 2019, 1:32pm UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/9 "2019-02-27T13:32:58Z")

</div>

Awesome! Thanks a lot!  
P.S. Będąc we Wrocławiu stawiam piwo! Chyba, że u mnie w Krakowie? 🍻

---

<div class="post-metadata">

**Author:** ![Yiping\_yang](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@Yiping\_yang](https://forum.dynamobim.com/u/Yiping_yang)\
**Post date:** [May 3, 2019, 3:16pm UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/10 "2019-05-03T15:16:23Z")

</div>

Hi， Tomasz. I used your script to move a revit link and the result is that the linked file had been move with a wrong distance. For example, a vector X=1000,Y=0,Z=0 in dynamo while the vector in revit is X=320040 ,Y=0,Z=0. Do you know what was wrong?  
what is more ,Will be possible to rotation the linked file at the same time ?  
thank you very much.

 ![Snipaste_2019-05-03_23-17-13](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/7/67ae3e930ec405ef65f50303abc2876e38309e6a.png)  
 ![Snipaste_2019-05-03_23-15-31](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/f/6fb7867a24fd62f5a1c1cd6a3c968e8d0104d7d7.png)

---

<div class="post-metadata">

**Author:** ![Tomasz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tomasz/32/66785_2.png) [@Tomasz](https://forum.dynamobim.com/u/Tomasz)\
**Post date:** [May 4, 2019, 9:53am UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/11 "2019-05-04T09:53:24Z")

</div>

Yes, it is possible to rotate the link using Location.Rotate method.

> **[Rotate Method](https://www.revitapidocs.com/2019/ed4de043-9a60-f6cd-c09b-b13c4612b343.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

You also need to convert units. Revit API uses feet and Dynamo is unit less. Here is an example of one approach to convert between units.

> [@Moving a linked RVT file along the vector X and Y with Dynamo](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/7):
>
> Unfortunately when I selected two Revit Links or I use a second method with Element Types at the end I have seen warning. Please have a look.

---

<div class="post-metadata">

**Author:** ![Danifly](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/danifly/32/84498_2.png) [@Danifly](https://forum.dynamobim.com/u/Danifly)\
**Post date:** [March 5, 2020, 8:46am UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/12 "2020-03-05T08:46:12Z")

</div>

Hi @Tomasz,

I’ve moved without problem the model using the previous code.

Now I’m tring to rotate the link on plan xy using internal point as pivot point, but my understanding of python it to understand where is the problem with the code.

If you can please help me 🙂

 ![rotate](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/9/d9551f4d8413eb07fcf01f33fad59f17b7e7cd93.jpeg)

> "  
> import clr
> 
> clr.AddReference(‘RevitServices’)  
> import RevitServices  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager
> 
> clr.AddReference(‘RevitNodes’)  
> import Revit  
> clr.ImportExtensions(Revit.GeometryConversion)
> 
> l = UnwrapElement(IN[0])  
> v = UnwrapElement(IN[1]).ToXyz()  
> a = UnwrapElement(IN[2])
> 
> doc = DocumentManager.Instance.CurrentDBDocument  
> TransactionManager.Instance.EnsureInTransaction(doc)  
> OUT = l.Rotate(v,a)  
> TransactionManager.Instance.TransactionTaskDone()  
> ";

---

<div class="post-metadata">

**Author:** ![Tomasz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tomasz/32/66785_2.png) [@Tomasz](https://forum.dynamobim.com/u/Tomasz)\
**Post date:** [June 24, 2020, 3:09pm UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/13 "2020-06-24T15:09:14Z")

</div>

try  
`l.Location.Rotate(v, a)`

---

<div class="post-metadata">

**Author:** ![hossam.amer666](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@hossam.amer666](https://forum.dynamobim.com/u/hossam.amer666)\
**Post date:** [July 11, 2020, 11:06pm UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/14 "2020-07-11T23:06:54Z")

</div>

> [@Tomasz](#):
>
> ```auto
> import clr
> 
> clr.AddReference('RevitServices')
> import RevitServices
> from RevitServices.Persistence import DocumentManager
> from RevitServices.Transactions import TransactionManager
> 
> clr.AddReference('RevitNodes')
> import Revit
> clr.ImportExtensions(Revit.GeometryConversion)
> 
> l = UnwrapElement(IN[0])
> v = UnwrapElement(IN[1]).ToXyz()
> 
> doc = DocumentManager.Instance.CurrentDBDocument
> TransactionManager.Instance.EnsureInTransaction(doc)
> OUT = l.Location.Move(v)
> TransactionManager.Instance.TransactionTaskDone()
> 
> ```

Could this could be modified so the linked file moves more than one time ? I mean it moves like some steps and we watch it moves step by step

---

<div class="post-metadata">

**Author:** ![Tomasz](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tomasz/32/66785_2.png) [@Tomasz](https://forum.dynamobim.com/u/Tomasz)\
**Post date:** [July 13, 2020, 7:04am UTC](https://forum.dynamobim.com/t/moving-a-linked-rvt-file-along-the-vector-x-and-y-with-dynamo/32704/15 "2020-07-13T07:04:21Z")

</div>

Please create a new topic if original question was answered.
