I am working with the Revit API that requires deleting some elements from the Revit Model and need some help in knowing couple of things before deleting them.
I want to delete the elements only if the model is detached from the central or is not a Working_local copy as I dont not want the model to be synchronized with central at any later point .
I'm sucessful in getting the required elements and also in deleting them.
Came across some of the API Methods like Save and SaveAs but they do not provide an option to make the Saved model as a central/ Detahc and save.Let me know if this is really possible to detect if model is still connected to Central or is Detached.
Does API has any such methods available?? or any possible workarounds
Any help is really appreaiated
Maybe some of the worksharing properties can help you?
Here is an excerpt from the Revit 2013 API What's New section:
The information required to identify a workshared file on the central or local locations have changed due to changes to RevitServer. As a result, the members
replace the properties
The new members:
provides read access to the worksharing central GUID of the given server-based model. This is applicable only to workshared models saved in Revit 2013 or later.
Autodesk Developer Network -- http://www.autodesk.com/joinadn
The Building Coder -- http://thebuildingcoder.typepad.com
Thanks for the reply, I am able to extract the details of WorksharecentralPath, PathName,.. etc of the model.
However, I tried looking into another way of trying to Detach the model and save as a new central file as below:
ModelPath mpath= ModelPathUtils.ConvertUserVisiblePathToModelPath(d
oc.PathName); OpenOptions open_Opts = new OpenOptions(); open_Opts.DetachFromCentralOption=DetachFromCentra lOption.DetachAndPreserveWorksets; Document new_Doc = app.OpenDocumentFile(mpath, open_Opts); doc_1.SaveAs("Newfile1.rvt");
but this still links to the central file.
Any ideas on detaching the file from central would be appreciated.
I'm looking for the new method of obtaining the full path of the central file name.
Since Document.WorksharingCentralFilename is now obsolete I tried to use GetWorksharingCentralModelPath but it is not giving me a value.
You can try this:
ModelPath mpath= Document.GetWorksharingCentralModelPath() works if the models is saved. ans returns a ModelPath
mpath.CentralServerPath should be the value you are after.
Hope this helps..
Since GetWorksharingCentralModelPath() only works on saved models, how do I get the central path for a just opened/unsaved model?
I have similar problem: I need check if opening file in Revit is detached from central, i.e. With API, in DocumentOpening event, how to check if user cheked or not "Detach from Central" option. I have tried to handle "DialogBoxShowing" event to catch TaskDialog_Detach_Model_From_Central dialog box, but it doesn't work always
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.