Extensible Storage in the Revit 2012 API
2
Contents
What is Extensible Storage? ..................................................................................... 2
Evolution of Storage Options .................................................................................... 2
Shared Parameters versus Estorage ........................................................................ 3
Estorage Basics ........................................................................................................ 3
Units ..................................................................................................................... 4
Examples ................................................................................................................... 4
Estorage of a Simple XYZ Point .......................................................................... 4
List Loaded Schemata ......................................................................................... 6
Determine Estorage Use in Document ................................................................ 6
Estorage of Complex Data ................................................................................... 7
Estorage Deletion ................................................................................................. 8
Storing a File on a Revit Element ........................................................................ 8
Additional Observations ............................................................................................ 9
Sample Applications ................................................................................................ 11
FamilyStorage .................................................................................................... 11
UpgradeSchema ................................................................................................ 11
Dynamic Section View ....................................................................................... 12
Schema Wrapper Tools ..................................................................................... 13
Extensible Storage Manager .............................................................................. 13
Related Blog Posts .................................................................................................. 13
Acknowledgements ................................................................................................. 13
Appendix: Hands-on Lab Instructions ..................................................................... 14
Revit SDK ........................................................................................................... 14
Visual Studio Add-in Wizards ............................................................................. 14
Hands-on Exercises ........................................................................................... 14
What is Extensible Storage?
Extensible Storage or estorage is a way of programmatically storing arbitrary, auxiliary data in a document.
It supports simple data types such as integer, double, string, element id, etc., and complex structures such
as lists and dictionaries.
It can be used to replace the old technique of storing data in shared parameters.
Access can be restricted to read-only or invisible to other applications.
Evolution of Storage Options
Internally, Revit makes use of OLE Structured Storage, introduced in 1995. It requires system-level C++,
COM and MFC knowledge, and data conversion to byte streams or CObject derived objects.
Ever since the introduction of Revit add-ins, add-in developers have been using shared parameters to store
additional custom data. Thus data is stored as a loose collection of data fragments with no protection or
permission options. It is not very direct. Still, it was possible to use for storing arbitrary, complex and
voluminous structured data, as demonstrated by Miroslav Schonauer’s Autodesk University presentations
in previous years.
Revit 2012 introduces the new estorage mechanism with the following features:
• Easy to use
• Class-like structure
• Metadata enhanced
• Read and write permissions integrated into Vendor and App ID
• Natively supports element id, UV, and XYZ points and vectors
• Revit-API-centric
Estorage can be used to store data on any Revit Element.