Open Revit OLE Storage

One of the valuable spoils of the AEC DevCamp last week in Waltham is the following stand-alone utility created by David S. Echols of H&A Architects & Engineers for opening and analysing the contents of the Revit structured OLE storage file streams.

We initially discussed this internal RVT and RFA file structure when presenting the Python utility to read the RVT or RFA file version without starting up and loading the file into Revit. It is also of interest to read the RVT and RFA thumbnail image stored in the file.

Now Dave has submitted this great little utility that goes much further in reading and parsing the information available in the structured file data, providing access to the thumbnail image and items such as the following from the sample file rac_advanced_sample_project.rvt provided with Revit Architecture 2011:

Here is an example of the result of parsing the RAC sample file rac_basic_sample_project.rvt:

OpenRevitOleStorage utility showing structured file storage data from rac_basic_sample_project.rvt

Here is Dave's description of this utility and the associated source code:

Attached is a zip file of my OLE Storage test project. It does not have any references to the Revit API assemblies, so you should be able to extract the files, open the project and run it. Select the file you want to open and the BasicFileInfo will be displayed in the Text area. If there is a preview image, it will be displayed to the right of the text area. This is course provided as-is.

Here is OpenRevitOleStorage.zip containing the complete source code and Visual Studio solution for this stand-alone utility.

Obviously, as Dave points out, you make use of this utility or the provided code at your own risk. Its use is completely unsupported, has nothing to do with the Revit API, and can change at any time.

Addendum

Here is a question that came up just a couple of days later, so I thought I would add it to this post, for completeness' sake:

Question: Here is a longstanding issue I have had with Revit – how to test externally for file version?

We automate some processes and start Revit to do it, therefore it would be very helpful to understand what version the file is that we are attempting to open!

One problem with Revit is that there is no way to determine the version of a Revit project file outside (or inside) of Revit. On opening the file, Revit immediately upgrades an older file with no way to stop the process from happening. We even thought of storing information in an external SQL database about what version of Revit each file is utilizing. We moved away from a similar method with AutoCAD projects, though, because of the issues it presented.

Answer: A Revit project is stored as a compound storage file, which consists of streams and storages. Storages are like folders, and can contain their own substreams and substorages.

At the top level, as of a few releases ago, one stream is BasicFileInfo. If interpreted as Unicode, it is roughly human-readable and lists some information about the model. This includes the build of Revit used to save the model.

This information was added so that out own support and development teams could quickly take a peek at a model and see what build it was saved in, and also whether it has worksharing enabled, since that information is also stored.