Save non-workshared Model

Howdy peeps!

I have scoured the forums and web for an answer to my question to no avail.

I am looking for a node or python script that Saves my Revit file. The Revit file is not work shared, so no need for Syncing.

The only nodes that I can find that are close to what I need are the Clockwork package nodes Document.SaveAs and Document.SynchronizeWithCentral.

My API Knowledge is not great so I am hoping someone can show me a workflow.

Cheers.

Hi @jonathan.ochse

You can use the ‘Document SaveAs’ node as shown in the workflow below. The node can be found in the Genius Loci package:

Thanks for the suggestion Deniz, but unfortunately a “Save as” is not an option, it must be a save.

I got around it by using some python code. It was much simpler than anticipated.

The following python code saves the file as long as the input is “True”:

import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

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

doc = DocumentManager.Instance.CurrentDBDocument
if (IN[0] == True):
doc.Save()
OUT = “File Saved”

1 Like

Good work @jonathan.ochse, didn’t realise you had to save instead of save as…
P.S. We miss you at CHT :slight_smile:

P.P.S. How’d you get into python scripting? I’ve just started teaching myself Dynamo and I really wanna start learn some basic python scripting…

Oh hey there Stranger!

I have completed a few courses to get up to speed with Python. The best Revit related Python tutorials I have found are a part of this online series:

Other than that. The free Data science course through DataCamp was great too.

Godspeed!