hi there,
Do we have any way to get the OmniClass Number in the Identity Data by using API?
For example : I have Engine Generators has OmniClass Number = "23.80.10.11.11.11". How can I get this value?
Thanks.
Solved! Go to Solution.
Solved by architect.bim. Go to Solution.
Hi! Omniclass Number is a System Type Parameter. To get it for each element first you need to get Element's Type and then try to get the OMNICLASS_CODE parameter. If this particulat ElementType has it, then you can get its value. Here is the sample code:
foreach (Element element in elements)
{
ElementType elementType = doc.GetElement(element.GetTypeId()) as ElementType;
Parameter omniClassNumber = elementType.get_Parameter(BuiltInParameter.OMNICLASS_CODE);
if (omniClassNumber != null)
{
string value = omniClassNumber.AsString();
if (!string.IsNullOrEmpty(value))
{
Console.WriteLine(value);
}
else
{
Console.WriteLine("No Value");
}
}
else
{
Console.WriteLine("Element does not have Omni Class Number Parameter");
}
}
Thanks for your answer. Base on your code it only gets OmniClass Number = "23.80.10.11" ( Electrical Generators)
It should be "23.80.10.11.11.11" of Engine Generators. Please review again and help. Thank you.
Hi! There is no problem to get Omni Class Number of any kind using the code I've provided you above. I've tested this code in Python and it works fine too.
Actually there is nothin to review, just simply use it 😃
If you don't see the last digits of the omniclass, they may simply not be printed. Or you may have made an inaccuracy somewhere. Either way, there is actually no other way to get this number. It is stored as a string parameter value. And to get it, you need the methods I mentioned above.
hi there,
I am using FilteredElementCollector to filter elements.
filter = new BuiltInCategory[] {
BuiltInCategory.OST_ElectricalEquipment,
BuiltInCategory.OST_ElectricalFixtures,
BuiltInCategory.OST_LightingDevices,
BuiltInCategory.OST_LightingFixtures,
BuiltInCategory.OST_Wire,
BuiltInCategory.OST_ElectricalCircuit,
BuiltInCategory.OST_WireMaterials,
BuiltInCategory.OST_WireInsulations,
BuiltInCategory.OST_WireTemperatureRatings,
BuiltInCategory.OST_ElecDistributionSys,
BuiltInCategory.OST_ElectricalVoltage,
BuiltInCategory.OST_MechanicalEquipment,
BuiltInCategory.OST_Levels,
};
Do you think the filter I miss anything?
I'm not sure how this question relates to the omniclass number. I would advise you to accept solution for this question and create a new query in the forum if you have any new questions.
Can't find what you're looking for? Ask the community or share your knowledge.