Query Regarding "Document Save As"

Hi,

I have a script which is cleaning up a file (deleting sheets/views/purge) and then saving the file as a new central file in a specified location. This all works fine, however I’ve noticed an irregularity when I open the new central file. After clicking Open I’m greeted with the following dialogue box:

Image2

I’d never seen this dialogue box when opening a central file. I realised this dialogue box is prompted because, when performing the Save As function, “Specify…” is selected from the “Open workset default” dropdown list, as shown below:

If I open the Central File as a Central and save as a new Central and select “All” from the “Open workset default” dropdown list, then the “Opening Worksets” dialogue box no longer appears.

I’ve never opened up the revit API docs before, but after hearing about them on this forum I decided to take a look and a quick search for “Open Workset” shows that the “Default is AskUserToSpecify.”, as below:

I opened the node performing the “Save As” function within my script and had a look at the python script within but I can’t find anything that even remotely references the contents of the Revit API Docs page.

I’m sorta new to all this and I guess my ultimate question is, is it possible to somehow modify the default “OpenWorksetsDefault” value from “AskUserToSpecify” to “All”?

Thanks in advance!

2 Likes

I would like to know this as well.

This is definitely possible. Assuming you provide a valid filepath in IN[0]:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

filepath = IN[0]
ws_ops = WorksharingSaveAsOptions()
# Set workset configuration to All Worksets
ws_ops.OpenWorksetsDefault = SimpleWorksetConfiguration.AllWorksets
saveas_ops = SaveAsOptions()
saveas_ops.SetWorksharingOptions(ws_ops)

doc.SaveAs(filepath, saveas_ops)

SaveAs.dyn (3.8 KB)

3 Likes

This worked! Thank you.

1 Like