Saying hello from my home country Guatemala, where I’m one week away from getting married, but that doesn’t stop me from continuing my passion for aerial photography. Here is a picture I took over the weekend with my drone “the toy” and my Hero 3+ GoPro at the Pacific Ocean beach in Guatemala.
Back to Revit API, this week one that caught my eye came from the Autodesk Community Forum, from one of our distinguished contributors.
Question:” Is it possible to filter just for System Families and ignore Component Families? I have used this example, however despite the heading, it actually returns all families.
I know that I can filter by a specified Type:
FilteredElementCollector coll = new FilteredElementCollector(pDoc);
// get all the wall types as wall type objects:
IEnumerable<WallType> types = coll.Cast<WallType>();
What I need is to return all Types that are System Families. Any and all suggestions appreciated; I have Googled to a standstill.”
The Answer came from our Revit API Engineering Team.
Answer: Sure – try .WhereElementIsElementType() plus new ElementClassFilter(typeof(FamilySymbol), true /* inverted */)
You can apply these two sequentially and that should get what they asked for.
Followed by that answer I tried a small piece of code to check how to get back what our customer was asking for.
public class Command : IExternalCommand
public Result Execute(
ref string message,
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
// WhereElementIsElementType is pretty self explanatory
// since it will give back only elements that are ElementType
FilteredElementCollector coll = new FilteredElementCollector(doc)
// the true value after the typeof will give back the
// inverted of what it was asked
ElementClassFilter filterInv =
new ElementClassFilter(typeof(FamilySymbol), true);
// add a watch to coll.WherePasses(filterInv) when debugging,
//when the result is checked every inverted FamilySymbol will
The Result of coll.WherePasses(filterInv); when is added to Watch in debug will give you back a list of all the Types that are ElementType and inverted from what the Component Families will return you.