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.
http://adndevblog.typepad.com/aec/2012/05/accessing-system-families-in-a-revit-template.html
I know that I can filter by a specified Type:
FilteredElementCollector coll = new FilteredElementCollector(pDoc);
// get all the wall types as wall type objects:
coll.OfClass(typeof(WallType));
IEnumerable<WallType> types = coll.Cast<WallType>();
What I need is to to return all Types that are System Families. Any and all suggestions appreciated; I have Googled to a standstill.
Regards, Dale
Solved! Go to Solution.
Solved by rosalesduquej. Go to Solution.
Check this command
[Transaction(TransactionMode.Manual)]
publicclassCommand : IExternalCommand
{
publicResultExecute(
ExternalCommandDatacommandData,
refstringmessage,
ElementSetelements)
{
UIApplicationuiapp=commandData.Application;
UIDocumentuidoc=uiapp.ActiveUIDocument;
Applicationapp=uiapp.Application;
Documentdoc=uidoc.Document;
// WhereElementIsElementType is pretty self explanatory
// since it will give back only elements that are ElementType
FilteredElementCollectorcoll=newFilteredElementCollector(doc)
.WhereElementIsElementType();
// the true value after the typeof will give back the
// inverted of what it was asked
ElementClassFilterfilterInv=
newElementClassFilter(typeof(FamilySymbol), true);
// add a watch to coll.WherePasses(filterInv) when debugging,
//when the result is checked every inverted FamilySymbol will
//get displayed.
coll.WherePasses(filterInv);
returnResult.Succeeded;
}
}
I added comments but a quick explanation will be that when you add the True flag at the end of the newElementClassFilter will return you the inverted list which is what you are looking for. Try to Add to Watch the last line and open it and check the results list you will see all the inverted ones from FamilySymbol. Hope this helps.
Thank you Jaime, working well now. Others may be interested to reference your blog:
http://adndevblog.typepad.com/aec/2014/08/system-families-filter-and-beach-aerial-picture.html
Regards, Dale
Can't find what you're looking for? Ask the community or share your knowledge.