Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I invoke the Revit Server base interface?

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
464905795
846 Views, 11 Replies

How do I invoke the Revit Server base interface?

Dear experts,The SDK provides limited information about Revit Server,i want to calling the base interface method like:download...,can you provide an example?

 

11 REPLIES 11
Message 3 of 12
464905795
in reply to: jeremy_tammik

Hi,Jeremy!

  thanks for your solution,Your answer helped me a lot,after reading these articles,I still have a question:after get the RevitServer filepath ,how do I open the file by RevitAPI?

Message 4 of 12
H.echeva
in reply to: 464905795

Hello,

 

I created several add-ins to manage Revit Server files. One of them is to batch export Navisworks files from the Revit Server and the other one for exporting Revit files.

I didn't use the Revit Server API. You can use normal Revit and Windows methods to manage the paths and open the files.

You can access the Revit Server project through Windows File Explorer. If you don't know the path ask your IT department. You will probably need permission to access these folders.

 

In the image below you can see how it looks like (blurred bits for confidentiality).

Note that each Revit file is represented by a folder, which ends in ".rvt"!! (not actual rvt files). However, if you get the path of these folders, you can use it to open the models.

 

I hope this helps.

 

2021-10-11_08h38_48.png

 

Message 5 of 12
464905795
in reply to: jeremy_tammik

Hello,Jeremy,    I read all the blog of revit server that you write,I have a general understanding of how Revit Server works,As  H.echeva said,I can get the revit server file(*.rvt) through Windows File Explorer.    For example,there have a revit server "172.18.1.32" and save a entral file at "testfolder\1.rvt",Now I can open the file by two ways,first:doc.OpenFile(@"RSN://172.18.1.32/testfolder/1.rvt"),the second ,use the method Application.CopyModel(),copy the file as a local file  ,then open the local file 。After modify the file , I want to   Synchronize with the central file,the two way about open file will be get different result?

Message 6 of 12
jeremy_tammik
in reply to: 464905795

Congratulations on successfully accessing the server files in the two ways you describe. 

 

Unfortunately, I cannot test the scenarios you describe.

 

Can you try it out and let us know how it works for you?

 

Thank you!

  

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 7 of 12
464905795
in reply to: jeremy_tammik

Hello,Jeremy! 

  Yesterday , input the file path in revit open file dialog like "RSN://172.18.1.32/8364dfab-968d-4a9c-8b6b-f75d0c1b5330/04_二次沉淀池_结构.rvt",the file was opened successfully, then I try to open the file by commandData.Application.Application.OpenDocumentFile(@"RSN://172.18.1.32/8364dfab-968d-4a9c-8b6b-f75d0c1b5330/04_二次沉淀池_结构.rvt"),however,it failed,revit return the error message "the filepath to be opened doesn't exist",the method  Application.CopyModel(),return the same message.

  Now ,I'm very confused,can you provide a example about open revit server file?

Message 8 of 12
464905795
in reply to: H.echeva

1634708731(1).pnghello,H.echeva:

 I copy the folder from revit server to local,but I don't know how to open the .rvt project though the folder and sub file.

Message 9 of 12
H.echeva
in reply to: 464905795

Hello,

In Revit you need to open the folder that I point in your image. You need to pass Revit the path to that folder, not to what is inside!

So fo example, if you have a path that is Autodesk/Revit Server 2021/Projects/FOLDER.rvt

Just pass that path to the Revit API. I know it is weird because it is a folder and not a Revit file!!

But this is how it works.

Hecheva_0-1634714115252.png

EDIT: Sorry I forgot to mention, that you will need to transform the path to a Revit Server Path!

So if my path is:

\\revit-london\Autodesk$\Revit Server 2021\Projects\2054 SingleHouseProject\Model1.rvt

I need to transform it to:

RSN://REVIT-LONDON.zzz.s/Autodesk$/Revit Server 2021/Projects/2054 SingleHouseProject/Model1.rvt

Note that I also changed this / to this \

Message 10 of 12
464905795
in reply to: jeremy_tammik

Dear Jeremy:

    I'm sorry to bother you,Now I can operate RS well through the Revit API and RS API,but I found a new problem after open centrial file ,when I open file by Revit ,there have two options that I can choose:DetachFromCentral or create local file , the file that I opened through create local file,the Revit button "Reload WorkSet" is enable,but when I open the file by Revit API"Autodesk.Revit.UI.UIApplication. OpenAndActivateDocument()" ,No matter how I set value of "OpenOptions.DetachFromCentralOption  ",after file open,the button "Reload WorkSet"  is not enable.Can you give me some advice?

Tags (1)
Message 11 of 12
jeremy_tammik
in reply to: 464905795

Sorry, I do not completely understand. Can you provide a minimal reproducible case?

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

  

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 12 of 12
464905795
in reply to: jeremy_tammik

Hello,jerymy!

I apologize for not being able to describe my problem clearly,I opened a central file on Revit Server through the Revit API,The code snippet is below:

464905795_0-1638446747742.png

However,this button is not available.

464905795_1-1638446862108.png

I tried to open this file by selecting this option,the button is available

464905795_3-1638447296723.png

 

464905795_2-1638447260395.png

I tried all four values of DetachFromCentralOption, and none of them worked。

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community