Message 1 of 4
How to create the detached from central while keeping the central document open

Not applicable
11-06-2017
03:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello there, I've created an app, that creates and save a detached from central document. But it do not allow me to keep the central document open while creating the detached document. Here's my sample code:
public void CreateSaveDetachedFile(Application application, string revitFilePath) { string detachedfolderpath = @"C:\Users\Ali asad\Desktop\Local Alexa Copy"; string detachedfilename = ""; //Get information of current opened revit file FileInfo filePath = new FileInfo(revitFilePath); ModelPath revitCentralFile = ModelPathUtils.ConvertUserVisiblePathToModelPath(filePath.FullName); OpenOptions openOptions = new OpenOptions(); openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndDiscardWorksets; detachedfilename = filePath.Name; Document openedDoc = application.OpenDocumentFile(revitCentralFile , openOptions); SaveAsOptions options = new SaveAsOptions(); options.OverwriteExistingFile = true; ModelPath modelPathout = ModelPathUtils.ConvertUserVisiblePathToModelPath(detachedfolderpath + "\\" + detachedfilename); //Save detached document openedDoc.SaveAs(modelPathout, options); openedDoc.Close(false); }
I would appreciate if someone explain, how do I keep the central document open while I create the detached from central document. Thank you.