Revit 2010 supports OmniClass codes. The Revit Architecture help provides the following background information on these codes in the section on Preparing Content for Sharing with Autodesk Seek, which is currently only available in the English edition:
OmniClass is a new classification system for the construction industry. The Autodesk Seek website uses codes from OmniClass Table 23 to filter and identify shared content. A code consists of an OmniClass number and title.
If an OmniClass code is not already assigned to a family, you are prompted to assign one during the sharing process. However, you can continue to share with Autodesk Seek without defining one. All Revit families have parameters for assigning an OmniClass code, except for the System and Annotation families.
You can access the OmniClass Number and OmniClass Title parameters in the Family Category and Parameters dialog under Family Parameters. See Family Category and Parameters.
Question: How can I retrieve all available OmniClass numbers and their descriptions from a model? I also need to retrieve the OmniClass numbers from the elements in the model.
I am using the export to ODBC functionality in Revit Architecture to find relevant data. The export process produces an OmniClassNumbers table. You can see the OmniClass numbers in the Revit user interface by opening a family drawing and clicking on the Category and Parameters tool. The OmniClass Number field is displayed in Family Parameters in the bottom section of that window. The resulting dialog displays the same data as that exported to the OmniClassNumbers table by the built in tool.
I need to
- Acquire the data already exported to the OmniClassNumbers table by the built in tool.
- Determine what OmniClass an element or type belongs to
Answer: The Revit API defines two built-in parameters for accessing the OmniClass data:
- OMNICLASS_CODE
- OMNICLASS_DESCRIPTION
We can extract these parameter values for the elements which are contained in the model. Some of these elements may already be present as instances in the model, some may be part of the template that was used to create it, and some may have been loaded into it as families.
Below is a piece of code to filter out all the elements in the model which have OmniClass data available. First, we define two class variables for the built-in parameters of interest:
BuiltInParameter _bipCode = BuiltInParameter.OMNICLASS_CODE; BuiltInParameter _bipDesc = BuiltInParameter.OMNICLASS_DESCRIPTION;
Then we can implement an external command class with the following code in its Execute method, which produces the same data as the Revit exported ODBC data from the user interface:
Application app = commandData.Application; Document doc = app.ActiveDocument; List<Element> set = new List<Element>(); ParameterFilter f = app.Create.Filter.NewParameterFilter( _bipCode, CriteriaFilterType.NotEqual, string.Empty ); ElementIterator it = doc.get_Elements( f ); using( StreamWriter sw = File.CreateText( "C:/omni.txt" ) ) { while( it.MoveNext() ) { Element e = it.Current as Element; sw.WriteLine( string.Format( "{0} code {1} desc {2}", Util.ElementDescription( e ), e.get_Parameter( bipCode ).AsString(), e.get_Parameter( bipDesc ).AsString() ) ); } sw.Close(); } return IExternalCommand.Result.Failed;
We use a highly efficient Revit API filter to select only those elements which have a non-empty OmniClass code. For those elements, the code and description is extracted from the element parameters and logged to a text file.
This code also demonstrates how to extract the built-in OmniClass parameters from any given individual element.
Many thanks to Saikat Bhattacharya for handling this case!
Revit 2010 Product Feature Recordings
There are a number of YouTube recordings available discussing and demonstrating new Revit 2010 product features. Here is a list of some of them:
- Revit Architecture 2010
- Revit Arch 2010 What’s New - Part 1 of 3
- Revit Arch 2010 What’s New - Part 2 of 3
- Revit Arch 2010 What’s New - Part 3 of 3
- Autodesk Revit Architecture 2010 User Interface Tour
- Revit 2010 UI Preview
- The Revit 2010 Ribbon - Designing the User Experience
- Autodesk Revit Architecture 2010 Demo
- Autodesk Revit Architecture 2010 and 3ds Max Design Demo
- Revit MEP 2010
While the above example extracts the "used" Omni Class numbers from the elements, it does not produce the same result as the built in tool. For example, if this process is used on a 2009 revit drawing that has been converted to 2010 it will find nothing, while for the same drawing, the export utility fills the OmniClassNumbers table with all available codes.
I have asked how the built in tool does that, but have as yet not gotten a response.
Posted by: Steve Kimling | April 22, 2009 at 14:00
Dear Steve,
Thank you for the update, and yes, I saw your query. Saikat is exploring this issue further.
Cheers, Jeremy.
Posted by: Jeremy Tammik | April 23, 2009 at 02:53
Hi Jeremy,
I see how your code queries the information, but is it possible to write/overwrite the Omniclass code and description to a family?
Posted by: Steve Germano | January 13, 2010 at 14:19
Dear Steve,
As far as I know you can specify any OmniClass code you like when you define your own family, so you should have complete control over it at that point.
Have you looked at the file OmniClassTaxonomy.txt in the Program subdirectory of the Revit installation folder?
Cheers, Jeremy.
Posted by: Jeremy Tammik | January 14, 2010 at 03:18
Dear Jeremy,
I've looked the OmniClassTaxonomy.txt file in the subdirectory of Revit and I have two questions:
The first, the numerical codes contained in this text file (in the Revit 2011) and the official ones (www.omniclass.org) do not match. Do you know why?
The second one, if you change the values of the codes in this file then the relationship will turn into a non standarized one. Am I right?
Regards, Gons.
Posted by: Gonçal Costa | February 10, 2011 at 10:12
Dear Gons,
Nope, I do not know why the codes used by Revit do not match the ones defined by www.omniclass.org.
And yes, I assume you are right, but I am not a product usage expert, so you would be better advised to ask someone more knowledgeable than me.
Cheers, Jeremy.
Posted by: Jeremy Tammik | February 13, 2011 at 14:47
Hi Gons, Jeremy,
Revit 2011 seems to use the older OmniClass Table 23 from 28/3/2006, not the updated version from 24/6/2010 published on www.omniclass.org.
http://www.omniclass.org/tables/OmniClass_23_2006-03-28.pdf
Best Wishes
Peter Walsham
Posted by: Peter Walsham | February 14, 2011 at 08:01
http://forums.augi.com/showthread.php?t=134352
Posted by: [email protected] | November 03, 2011 at 19:43
Dear Ericakoe,
Thank you for the pointer to the Revit Genome Project. I cannot say much about it, being purely API focused. Looks commendable :-)
Cheers, Jeremy.
Posted by: Jeremy Tammik | November 04, 2011 at 03:09
Hi Jeremy;
i m trying to find omniclass number product table 23 List.
because if i can find this *.txt file i will exchange with budget codes product of our company.. are there any path on the revit program files???
Posted by: Nurullah ISIK | September 27, 2014 at 05:32