From Directory Open / Remove all DWG links / Reload all RVT links / Save as Central

Hi !

I am trying to open a series of files which have been copied into a new folder. I need to remove all linked DWGs (or remove everything which is not a RVT), reload all RVTs links (all files will be located in the new directory), and then save each file as a Central.

I saw Links - "Reload From..." and tried to pick up the script but I am having trouble connecting the additional steps.

(and thanks :slight_smile: )

** for record the python script is as below (& from @Nick_Boyts);

#python nodes in dynamo 1.0.0
#originally by Nicklas Østertgaard /
import clr
from Autodesk.DesignScript.Geometry import *

Import ToDSType(bool) extension method

import Revit

Import geometry conversion extension methods


Import DocumentManager and TransactionManager

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

Import RevitAPI

import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
collector = Autodesk.Revit.DB.FilteredElementCollector(doc)
linkInstances = collector.OfClass(Autodesk.Revit.DB.RevitLinkInstance)
folderpath = IN[0]
reloadedlinks = []
for i in linkInstances:
name = i.Name
path = folderpath + “\” + name
path = path.rsplit(’ : ',2)[0]
filepath = FilePath(path)
RevitLinkType = doc.GetElement(i.GetTypeId())
OUT= reloadedlinks


I made a package to interact with Revit documents in directory.
His name is Genius Loci and some nodes can help you reach your goal :

@Alban_de_Chasteigner remember to give credit where credit is due…

The nodes are actually made by a bunch of other Authors…

@Dimitar_Venkov, @Nick_Boyts, @Einar_Raknes, @Ben_Osborne

1 Like

Hi Jonathan,

Thank you for the credits, I actually responded too quickly.

I actually modified some nodes to work without the current document and used forum scripts to make them into custom nodes.
As you know, customs nodes have some advantages like lacing or levels.

I hope that the way the original code is attributed to the authors is quite clear.

If this displeases them, I will find another way to distribute the custom nodes within my company than the package.
I am not trying to assign myself the code of other people, on the contrary I learned everything by looking at how they coded and I think I have given my time back to help members of the community.



Hi @Alban_de_Chasteigner - thanks for your help!!

Any notion why the Delete Elements from document might not be accepting element IDs (DWGs) in this case?
I seem to only get nulls…

Does it make a difference if the DWGs are loaded / unloaded?



It’s working for me with ImportInstances and there is no difference if the tDWGs ar loaded or unloaded.



I realized my mistake - I was trying to process the filepath rather than the document :stuck_out_tongue:

Does the ‘Elements Delete from document’ node not accept lists?
Capture Unload.DWGs.Multi.dyn (28.4 KB)


Don’t forget to set lacing on Longest on the node Delete Elements :

@Alban_de_Chasteigner thank you!!!