Beams and columns are represented in the Revit API by the FamilyInstance class. You can use the StructuralType property of the FamilyInstance class to determine whether the FamilyInstance is a beam, column, or something else. Below is one way you could modify your method to find the number of selected beams, columns and braces.
Code:
public void alex01()
{
UIDocument uidoc = ActiveUIDocument;
Autodesk.Revit.UI.Selection.SelElementSet collection = uidoc.Selection.Elements;
TaskDialog.Show("Revit", "Number of selected elements : " + collection.Size.ToString());
SelElementSet abcd = SelElementSet.Create();
SelElementSet none = SelElementSet.Create();
int numBeams = 0, numCols = 0, numBraces = 0;
foreach (Autodesk.Revit.DB.Element elements in collection)
{
if (elements is Wall)
{
abcd.Add(elements);
}
if (elements is FamilyInstance)
{
FamilyInstance instance = elements as FamilyInstance;
switch (instance.StructuralType)
{
case Autodesk.Revit.DB.Structure.StructuralType.Beam:
numBeams++;
break;
case Autodesk.Revit.DB.Structure.StructuralType.Brace:
numBraces++;
break;
case Autodesk.Revit.DB.Structure.StructuralType.Column:
numCols++;
break;
case Autodesk.Revit.DB.Structure.StructuralType.Footing:
break;
case Autodesk.Revit.DB.Structure.StructuralType.NonStructural:
break;
case Autodesk.Revit.DB.Structure.StructuralType.UnknownFraming:
break;
default:
break;
}
}
}
TaskDialog.Show("Revit", String.Format("{0} beams selected, {1} columns selected, and {2} braces selected.", numBeams, numCols, numBraces));
uidoc.Selection.Elements = abcd;
if (0 != abcd.Size)
{
TaskDialog.Show("revit", uidoc.Selection.Elements.Size.ToString() + " walls are selected");
}
else
{
TaskDialog.Show("revit", "no walls have been selected!!");
}
uidoc.Selection.Elements = none;
}
By the way, the Selection.Elements property has been deprecated in Revit 2015 and you should use Selection.GetElementIds() to get the ids of the selected elements and Selection.SetElementIds() to change the selected elements.