How to filter some family instances which are displayed in my family document?

How to filter some family instances which are displayed in my family document?

AndrewButenko
Advocate Advocate
177 Views
1 Reply
Message 1 of 2

How to filter some family instances which are displayed in my family document?

AndrewButenko
Advocate
Advocate

Hello. Maybe someone knows how to solve this problem. I need to copy some FamilyInstance from a familу document to another family document.question.png Each family is associated with a Family Type. For example family type "245618 Top0" associated with family "Family8". Only geometry associated with the current family type  is displayed in the document. But if I programmatically filter FamilyInstances,

 

       ElementClassFilter classFilter = new ElementClassFilter(typeof(FamilyInstance));
   FilteredElementCollector collector = new FilteredElementCollector(fdoc);
       ICollection<FamilyInstance> familyInstanceElements = collector.WherePasses(classFilter).Cast<FamilyInstance>().ToList();

 

then they are all filtered and for all of them the same Family is set, the family which associated with the current Family Type. FamilyInstances are all visible programmatically. How to filter some family instances which are displayed in my family document?

0 Likes
178 Views
1 Reply
Reply (1)
Message 2 of 2

jeremy_tammik
Alumni
Alumni

You can instantiate the filtered element collector with an additional view element id to restrict it to elements visible in the given view. Maybe that will help. Otherwise, try to identify other additional filtering criteria to differentiate the instance that you want from the ones that you don't.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes