Save a copy of Revit file (while in it)

If I wanted to allow somebody to save a copy of a file to a predetermined folder while they were in the project, is there a node that allows this? I don’t want to ‘save as’, as that would change the file name/location of the active file. I just want to create a copy of it in a certain location.

I was thinking the best way forward would be to use python to utilize windows and copy the central to another location. Can somebody get me started on python commands to manipulate files in windows?

The end result of all of this would be that somebody can run this script to create a copy of their file in a networked folder. I then plan on using ‘Revit Batch Processor’ to open up all of the files in this certain folder and run a model health script overnight.

Thanks!

Aaron

What exactly are you trying to do with a “copy” that isn’t just a Save As to a new location? Is this a workshared model? Are you wanting the worksharing intact or do you want a detached copy of the file as-is? Remember you’re still bound by the rules of Revit.

If somebody is working a project and does a ‘Save As’, it would change the file name and the location of their file, correct? That would really screw things up. I don’t want this to affect the active session.

OK, that makes sense, but my other questions are still important. How do you want that file to act (relative to the central model if it’s workshared) once it’s created? A local copy of a model is just a copy of the file. All you need to do is copy the RVT to a new location. From there, you have to decide if you need to open it and detach the model or leave it as-is.

The batch processor should take care of that upon opening. I won’t be running these scripts to make any changes…just to export data, so I won’t be needing to save anything back to the central model.

In that case you can just do a file copy to a new location. You can get the central model location from the active document. That’s pretty much it.

Thanks, Nick. You pointed me in the correct dimension of searching for ‘copy’, not save as. I think I was just looking at it from the wrong angle.

As a side note, the link you gave me to the API documents—there is C# and Visual Basic…do they not have python examples? Trying to slowly learn python and I’ve been wondering that.

Correct. The Revit API does not actually utilize Python, but we can still use Python to write our code and have the Common Language Runtime (CLR) translate for us. This means learning to convert C# or VB to the equivalent Python syntax. It’s not as hard as it may seem but it does take some practice.

You can give this video a watch if you want some additional explanation. There are a couple sections covering this process.

There are some examples in the Revit API Docs website:

I want to do this, but I am in a cloud-workshared model. Is there a way to identify the file location of its central RVT?