NewProjectDocument save as central file


#1

Hi :slight_smile:

How can I save a document as a central file from dynamo using the NewProjectDocument method?

Capture


#2

Found it :smile:

http://www.revitapidocs.com/2018.1/f0b5d969-3e86-b433-e2f8-a01292738c85.htm

    wopt = WorksharingSaveAsOptions() #<--- here ;P
	wopt.SaveAsCentral = True # <--- here ;P

	sopt = SaveAsOptions()
	sopt.OverwriteExistingFile = True
	sopt.Compact = True
	sopt.SetWorksharingOptions(wopt) #<--- here ;P
	
	newdoc.SaveAs(path, sopt)

#3

nice solution :wink:


#4

If you’re working with a new project, I discovered that you have to first enable worksharing before you can use the WorksharingSaveAsOptions class.
In my script, the following lines are how got it done:

for rvt in ModProjects:
    open_file = app.OpenDocumentFile(rvt)
    open_file.EnableWorksharing("Shared Levels and Grids","Workset1")

http://www.revitapidocs.com/2018.1/7c29717e-1d8c-4e02-20ad-65c53ea8eaaa.htm