I'm accessing a central file and I need to create/open a local copy. But I cant file anything in the API to accomplish this. Or I need to be able to relinquish from the central. How is this done, thanks.
Dear bthatcher,
Look at the What's New section of the Revit API help file RevitAPI.chm:
New overloads for Application.OpenDocumentFile() and UIApplication.OpenAndActivateDocument()
The new overloads support parameters OpenOptions and OpenOptionsForUI, respectively, to specify how a Revit document should be opened. Both options classes currently offer the ability to detach the opened document from central if applicable.
The property:
The property:
Jeremy
--
Jeremy Tammik
Autodesk Developer Network -- http://www.autodesk.com/joinadn
The Building Coder -- http://thebuildingcoder.typepad.com
I believe I have gone through all of those options. To be sure, I set up a dialog to test them. Using 'OpenDocumentFile' it's not clear what the name of the document is, so I've collected them and listed them in a listbox. Even doing it manually, the only way is to detach and preserve worksets, save as, then reopen with the 'Create New Local' checked. Every option returns the central file name. What am I missing. As always, thanks for your help!
Here is the code I would expect to work
OpenOptions openOption = new OpenOptions(); openOption.DetachFromCentralOption = DetachFromCentralOption.DoNotDetach; ModelPath modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(targetFile); Document openFile = uiApp.Application.OpenDocumentFile(modelPath, openOption);
Hi, you have to create the local copy with the CreateNewLocal method. See this link for more information:https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/Revit-API/files/GUID-...
And you open the local copy created (localPath instead of ModelPath in your code sample.
Hope this help, even if this post is very old I think it can help other user.
Regards,
André
Exactly what i was looking for!
The link you posted seems to be dead, here's a live one of the CreateNewLocal method:
https://www.revitapidocs.com/2020/90102c11-d982-77f5-d08c-e68b1a882281.htm
Thank you!