Reload Upgraded Revit Links

Based on this question :

We recently upgraded our Revit Version from 2017 to 2019.

We commonly put the version of the revit in the filename itself, so Filename-R17 now become Filename-R19.

I need to reload all my revitlink instances to the new filename.

Both the old and the new filenames are in the same directory,
any idea how to do that?

Hi @Revit_Noob,

If I understand correctly, you need to modify the strings (filepath) to match the 2 lists (R17 and R19).

Repath RevitLinkInstances R17 to R19.dyn (28.2 KB)

1 Like

what if i have varying string length of filename?

If your Revit files doesn’t finish with “R17.rvt” or “R19.rvt”, it will not work.
To automate, you need common characters in the filenames.

3 Likes

regardless of how long the filename?

Please show a picture with your issue.
The String.Remove node start at the end of the filename so the number of characters doesn’t matter.

1 Like

i see…i am already home. I don’t have revit / dynamo now.
Will check again tomorrow. Thanks @Alban_de_Chasteigner

String.Replace(filename, ”-R19”, ”-R17”);

This will have the added benefit of not changing file names which didn’t have the “-R17” indicator (and therefore have no “-R19” indicator).

2 Likes

@jacob.small’s proposal is smarter.

1 Like

Even a blind squirrel and a broken watch. Seriously though without the rest of the code a String.Replace node doesn’t get us very far.

2 Likes

Question, what lacing option is needed for the List.AllIndicesOf and other nodes?

I am using 1.3 version.

I’m getting wrong index in the List.AllIndices Of node.

Can you show a picture with previews under the nodes ?

and here’s the result :

You have a unnecessary longest lacing on GetItemAtIndex node. Use Shortest lacing instead.
Note that in your test file the AllIndicesOf and GetItemAtIndex nodes are useless because the filepaths are already in the right order.

if i remove the List.AllIndicesOf node since the list is already in the right order, how will i connect to the Repath node?


blue is delete, red is connect

1 Like

but still, i would always have some sort of sorting mechanism before using any repathing of link files :slight_smile:

1 Like

It will probably not work in a real project with a lot of links but it will do the job for your test file.
As @stillgotme wrote and as I did in the second post, it’s really better to sort the lists of filepaths in the same order.

1 Like

Okay…i will try to detach multiple central files and save it to R19 so i can test the code on the actual project.

Thanks! will feedback later.