How to open different version Revit files

How to open different version Revit files

Anonymous
Not applicable
1,527 Views
8 Replies
Message 1 of 9

How to open different version Revit files

Anonymous
Not applicable

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

0 Likes
1,528 Views
8 Replies
Replies (8)
Message 2 of 9

joshua.lumley
Advocate
Advocate

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.

0 Likes
Message 3 of 9

Anonymous
Not applicable

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

0 Likes
Message 4 of 9

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 5 of 9

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 6 of 9

Anonymous
Not applicable

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.

0 Likes
Message 7 of 9

jeremytammik
Autodesk
Autodesk
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

0 Likes
Message 8 of 9

Anonymous
Not applicable

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.

0 Likes
Message 9 of 9

jeremytammik
Autodesk
Autodesk

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

0 Likes