Element.GetTypeId
Method
Description:
Returns the identifier of this element's type.
Returns the identifier of this element's type.
Remarks:
Some elements cannot have type assigned, in which case this method returns invalid element id.
Some elements cannot have type assigned, in which case this method returns invalid element id.
Examples
void GetStairType(Autodesk.Revit.DB.Document document)
{
FilteredElementCollector collector = new FilteredElementCollector(document);
ICollection<Element> stairs = collector.OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_Stairs).ToElements();
foreach (Element stair in stairs)
{
if (null == stair.GetTypeId())
{
TaskDialog.Show("Revit","No symbol found in stair element: " + stair.Name);
}
else
{
Element elemType = document.GetElement(stair.GetTypeId());
string info = "Stair type is: " + elemType.Name;
TaskDialog.Show("Revit",info);
}
}
}