How to use API to open Revit Server file and reload working set button available?

How to use API to open Revit Server file and reload working set button available?

464905795
Advocate Advocate
964 Views
9 Replies
Message 1 of 10

How to use API to open Revit Server file and reload working set button available?

464905795
Advocate
Advocate

As the title says,I open Revit Server File by api,however the reload workset button isn't available.

 private void OpenDetached(UIApplication app, ModelPath modelPath)
        {
            OpenOptions opt = new OpenOptions();
            opt.DetachFromCentralOption = DetachFromCentralOption.DoNotDetach;
            app.OpenAndActivateDocument(modelPath, opt, false);
        }

464905795_0-1639359093434.png

 

0 Likes
965 Views
9 Replies
Replies (9)
Message 2 of 10

jeremy_tammik
Alumni
Alumni

Thank you for your query and sorry we were unable to resolve it in the previous thread on this. I asked the development team for you.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 10

464905795
Advocate
Advocate

Hello Jeremy,Thank you for your reply,this problem is very important for my product,I look forward to receiving your solution as soon as possible。

0 Likes
Message 4 of 10

251912960
Enthusiast
Enthusiast
Has the problem been solved? I also want to know the answer, hope help, thank you!
0 Likes
Message 5 of 10

jeremy_tammik
Alumni
Alumni

Yes, sorry, no reply received yet. I re-prompted the development team for advice.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 6 of 10

jeremy_tammik
Alumni
Alumni

The development team suggest:

  

Something to test:

  
1) Open it
2) Get the local and central path
  
Assuming the central still points at the server and not another location, proceed to 3 and 4:

 

3) Close it
4) Open the local path

 
That may push things in the right direction, though the added time isn’t ideal. If it doesn’t point at the server, they may need to make another call to open the document.
 

I hope this helps.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 7 of 10

251912960
Enthusiast
Enthusiast
The problem has been solved,Thank you very much.
0 Likes
Message 8 of 10

jeremy_tammik
Alumni
Alumni

Glads to hear that. Thank you for your appreciation.

   

Can you share with us exactly how you solved it, please, for others who may encounter the same issue?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 9 of 10

251912960
Enthusiast
Enthusiast
Reference code:
ModelPath toOpenPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(localPath);
WorksharingUtils.CreateNewLocal(modelPath, toOpenPath );
app.OpenAndActivateDocument(toOpenPath , opt, false);
0 Likes
Message 10 of 10

jeremy_tammik
Alumni
Alumni

The development team explain: This is by design. The central model was opened directly when using the  OpenDetached() method because it uses the  central model's ModelPath. So, ReloadLatest cannot be used in this case; there is no related stuff to reload, because central is always latest when you're on it, and all other clients cannot work with central when the central is opened directly. This is not a recommended way to use the worksharing feature. The correct way would be to create a new local file based on central. Then, it should work correctly. File-based worksharing should have the same behaviour.

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes