Batch Upgrader (Detach From Central)

Hey All,

I am wondering if its possible to add a python node that can select the "detach from central" and then "detach and preserve worksets." I don't know anything about python and i wanted to know if this is possible. 

If possible i would like to run a Save As Node by taking the existing file name and then adding “v2017” or “v2018” so when i get a revit 2015 file in and i upgrade it, it will save it as something else.

Here is the Python Code:

import clr
from Autodesk.Revit.DB import *
import Autodesk

doc = IN0
path = IN1

if doc.IsFamilyDocument:
path += ‘.rfa’
path += ‘.rvt’
OUT = doc.SaveAs(path)


Yap its possible…

Would you be able to help me with the python Nodes?:sweat_smile:

There is already a topic like this search BULK UPGRADE…what you can you is before you upgrade you can make a copy of the files to a different folder and rename the files you want then run the BULK UPGRADE…

See this post…

@4bimfercesp his script saves as central.(I dont want it to save as a central file) and it doesnt detach the file before opening it.

@4bimfercesp this is his code. could i just set the 3rd input to false to not save as a central file?

import clr
from Autodesk.DesignScript.Geometry import *

Import Element wrapper extension methods

import Revit

Import geometry conversion extension methods


Import DocumentManager and TransactionManager

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

Import RevitAPI

import Autodesk
from Autodesk.Revit.DB import *

items = IN[0]
overwrite = IN[1]
savecentral = IN[2]
pathin = IN[3]

soptions = SaveAsOptions()
woptions = WorksharingSaveAsOptions()
soptions.OverwriteExistingFile = overwrite
woptions.SaveAsCentral = savecentral

typelist = list()

for i, (one, two) in enumerate(zip(items, pathin)):

OUT = items

Maybe you could try it and let us know?

Yes i think so. I am not on a pc to open the graph to see thw inputs but yes you can set it to false.

@Einar_Raknes @4bimfercesp I tried both of these. i need it to save with v2017 before the .rvt.

I’m also trying to do it within the code but i dont really know what im doing.


First of all is the graph above works at all using its original filename? Renaming or adding v2017 is easy.

The results of this String.Replace should be the full file path and not just the file name

@upwallJosh the graph works when i set it up like this but I would like to be able to get he revit year and add it to the back. which is shown by the red arrow.

1 Like

Ok no probs post the dyn here and i will adjust it to get what you want. Tnx

Save as Upgrader.dyn (19.3 KB)

@4bimfercesp is their a website i can go to start learning how to write the python code for this stuff? Id like to be able to learn how to do all this stuff by myself.

I do not have any particular website. I normally learn python from scripts that works for particular purpose and look online for what they meant and start breaking it down and check what each line means. To be honest i already know coding before i start dynamo so for me its easy. I suggest look around the community and learn from them. Konrad kosobon’s python skills are very good look how he did some of his solution and learn from it. There are few gurus in the community inspired me to learn. What i suggest have a task and try to solve it with OOTB and try a python version to see the diference. Tnx

Hi just tried the graph. It does not work currently way it is setup. It can be done though i will leave it to someone else to figure out. I will be busy in the coming weeks to help. Sorry.

The way you have your graph set up now it will probably never work since you are first collecting all the documents (Revit files) you want to upgrade and then upgrade them one by one with another node. This means opening a lot of Revit Central files which will surely consume a lot of RAM very quickly and thus most likely crash Dynamo.
I think the only way to achieve this is by doing everything inside a single python node where you perfom these steps in a loop:
for every central file from list:

  • open and detach from central file
  • save as central file in new location
  • close the newly saved file

But even then I can’t guarantee it will work

1 Like