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 to open different version Revit files

8 REPLIES 8
Reply
Message 1 of 9
670292747
711 Views, 8 Replies

How to open different version Revit files

I am developing a console program.

If open a different version file, it will throw "Autodesk.Revit.Exceptions.InvalidOperationException:“The document can not be opened".

How to open different version Revit files

8 REPLIES 8
Message 2 of 9
joshua.lumley
in reply to: 670292747

You should be able to open an earlier version but you will not be able to open a later version. 

If your console app was based on Revit 2020, it should be able to open a Revit 2019, however it will not be able to open a Revit 2021.

Message 3 of 9
670292747
in reply to: joshua.lumley

My app is based on Revit 2018, but  it can't open a Revit 2015 file.

Message 4 of 9
jeremytammik
in reply to: 670292747

I am sure that Revit 2018 can open an RVT file stored by Revit 2015. The problem must lie elsewhere.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 9
jeremytammik
in reply to: 670292747

By the way, The Building Coder recently shared a solution to automatically open correct RVT file version:

 

https://thebuildingcoder.typepad.com/blog/2020/05/automatically-open-correct-rvt-file-version.html

 

It avoids updating the RVT file versions, assuming that you have all the required versions of Revit.exe installed.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 6 of 9
670292747
in reply to: jeremytammik

Sorry, there is something wrong with my description.

It's not open a file in Revit.

My console app want open the file to get "document".

image.png

 Using the "OpenDocumentFile" will be failed.

Message 7 of 9
jeremytammik
in reply to: 670292747

The Revit API requires a valid Revit API context. Such a context is only available within the event handler for a Revit API callback. You cannot make any use whatsoever of the Revit API from a pure console application: http://thebuildingcoder.typepad.com/blog/2015/12/external-event-and-10-year-forum-anniversary.html#2 http://thebuildingcoder.typepad.com/blog/2015/08/revit-api-context-and-form-creation-errors.html#2


Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 8 of 9
670292747
in reply to: jeremytammik

At present,  using "RevitAPI.dll"(2018) and "RevitNET.dll"(2018), "Application.OpenDocumentFile(rvtPath)" can open Revit 2018 file to get the "document". But can't open Revit 2015 file.

Message 9 of 9
jeremytammik
in reply to: 670292747

So you are loading those two DLLs from your own console application and not starting Revit.exe at all?

 

Well, that is very interesting information. Thank you for sharing it.

 

However, as said, that constellation is completely unsupported.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

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