void f( UIDocument uidoc )
{
Options options = new Options();
options.ComputeReferences = true;
GeometryElement geomElement = uidoc.Selection
.PickObject( ObjectType.Element )
.Element.get_Geometry( options );
int ctr = 0;
foreach( GeometryObject geomObj
in geomElement.Objects )
{
if( geomObj is Solid )
{
FaceArray faces = ( ( Solid ) geomObj ).Faces;
ctr += faces.Size;
}
if( geomObj is GeometryInstance )
{
GeometryInstance inst = geomObj
as GeometryInstance;
if( inst != null )
{
GeometryElement geomElem
= inst.GetSymbolGeometry();
foreach( Object o in geomElem.Objects )
{
Solid solid = o as Solid;
if( solid != null )
{
ctr += solid.Faces.Size;
}
}
}
}
}
TaskDialog.Show( "Revit", "Faces: " + ctr );
}