<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Family Instance Filter in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7291167#M56720</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Dear Dale,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your update.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, of course you could filter for families first, then determine their types, and then the instances referring to those.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In fact, the&amp;nbsp;CmdCollectorPerformance.cs module includes code demonstrating that approach.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, since the elements you are after in the end are the instances, it makes sense to filter for those right away, and then eliminate the ones that don't match the expected family.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please take a look at the code region to retrieve named family symbols using either LINQ or a the more efficient parameter filter in CmdCollectorPerformance.cs:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs#L1039-L1101" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs#L1039-L1101&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It demonstrates several different approaches.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can implement similar code to retrieve family instances instead of symbols.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is updated sample snippet using the simple but inefficient LINQ post-processing to achieve that:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;  string targetFamilyName = "Family Xyz";
  string targetInstanceName = "60\" x 30\" Student";
  
  FilteredElementCollector instances
    = new FilteredElementCollector( document )
      .OfClass( typeof( FamilyInstance ) )
      .Where( x =&amp;gt; x.Name.Equals( targetInstanceName )
      .Where( x =&amp;gt; x.Symbol.Family.Name.Equals( targetFamilyName )&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You could speed this up both by switching from LINQ to parameter filters for the name matching and by adding more quick filters, e.g., for the category and lots of other properties.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2017 16:09:36 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2017-08-10T16:09:36Z</dc:date>
    <item>
      <title>Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7287113#M56717</link>
      <description>&lt;P&gt;Honestly, sometimes I feel so daft; is it me or the API? I want to return a list of all Family Instances by name. All samples, including the Revit API docs, pass a name, but this is in fact the Type name. As the Type name is not unique (i.e. "Type 1") and can be used by different Families, this seems to be incorrect. The following is the example from the Revit API Docs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// Use ElementClassFilter to find family instances whose name is 60" x 30" Student 
ElementClassFilter filter = new ElementClassFilter(typeof(FamilyInstance));
// Apply the filter to the elements in the active document
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.WherePasses(filter);
// Use Linq query to find family instances whose name is 60" x 30" Student
var query = from element in collector
where element.Name == "60\" x 30\" Student"
select element;
// Cast found elements to family instances, 
// this cast to FamilyInstance is safe because ElementClassFilter for FamilyInstance was used
List&amp;lt;FamilyInstance&amp;gt; familyInstances = query.Cast&amp;lt;FamilyInstance&amp;gt;().ToList&amp;lt;FamilyInstance&amp;gt;();&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To correctly return a list of FamilyInstances, surely the collector needs to be passed the following, in order:&lt;BR /&gt;1. Category&lt;BR /&gt;2. Family Name&lt;BR /&gt;3. Family Type Name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been unable to find an example, and I have been unable to assemble a filter statement to correctly limit the returned instances. Am I missing/overlooking something? Can anyone point me in the right direction? Thanks, Dale&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:35:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7287113#M56717</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2017-08-09T12:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7287321#M56718</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Dale,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your query.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Definitely not daft; however, this information is out there in numerous previous threads and dozens if not hundreds of blog posts.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You do not need to apply specific filters, ever, or apply them in any specific order.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can apply any filters you like in any order you like.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Revit may perform some optimisation by reordering them.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It is probably useful to apply all quick filters first:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2015/12/quick-slow-and-linq-element-filtering.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2015/12/quick-slow-and-linq-element-filtering.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have repeated more than a hundred times now:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Using ToList is normally not necessary and may cause a significant inefficiency.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2012/09/findelement-and-collector-optimisation.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2012/09/findelement-and-collector-optimisation.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I your case, I would simply use:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;  string targetName = "60\" x 30\" Student";
  
  FilteredElementCollector instances
    = new FilteredElementCollector( document )
      .OfClass( typeof( FamilyInstance ) )
      .Where( x =&amp;gt; x.Name == familySymbolName );&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As also mentioned numerous times in the past, you can make it more efficient by using a parameter filter to check the name instead of LINQ:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2010/06/element-name-parameter-filter-correction.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2010/06/element-name-parameter-filter-correction.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Check out all the examples provided by The Building Coder samples in the module&amp;nbsp;CmdCollectorPerformance.cs:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 13:25:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7287321#M56718</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-08-09T13:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7287875#M56719</link>
      <description>&lt;P&gt;Hi Jeremy, Certainly there are many, many examples as you say, and I think I have read most of them. Regarding your suggested code:&lt;/P&gt;
&lt;P&gt;Assume there are two title block families: TB1 and TB2, both of which has a type named&amp;nbsp;60" x 30" Student, then your&amp;nbsp;collector will return instances of both TB1 and TB2 families. I thought it must be possible to write a single filter statement that would collect only TB2:&lt;SPAN&gt;60" x 30" Student instances. It seems counter intuitive to run a foreach over your results to&amp;nbsp;check the family type. Again, am I missing something? Dale.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 15:54:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7287875#M56719</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2017-08-09T15:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7291167#M56720</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Dale,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your update.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, of course you could filter for families first, then determine their types, and then the instances referring to those.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In fact, the&amp;nbsp;CmdCollectorPerformance.cs module includes code demonstrating that approach.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, since the elements you are after in the end are the instances, it makes sense to filter for those right away, and then eliminate the ones that don't match the expected family.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please take a look at the code region to retrieve named family symbols using either LINQ or a the more efficient parameter filter in CmdCollectorPerformance.cs:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs#L1039-L1101" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs#L1039-L1101&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It demonstrates several different approaches.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can implement similar code to retrieve family instances instead of symbols.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is updated sample snippet using the simple but inefficient LINQ post-processing to achieve that:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;  string targetFamilyName = "Family Xyz";
  string targetInstanceName = "60\" x 30\" Student";
  
  FilteredElementCollector instances
    = new FilteredElementCollector( document )
      .OfClass( typeof( FamilyInstance ) )
      .Where( x =&amp;gt; x.Name.Equals( targetInstanceName )
      .Where( x =&amp;gt; x.Symbol.Family.Name.Equals( targetFamilyName )&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You could speed this up both by switching from LINQ to parameter filters for the name matching and by adding more quick filters, e.g., for the category and lots of other properties.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 16:09:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7291167#M56720</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-08-10T16:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7300504#M56721</link>
      <description>&lt;P&gt;Hi Jeremy, The logic of your code is what I would expect, and had tested. This is the result of using your exact example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jeremy.png" style="width: 481px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/389931iAD6B9286C469C7C5/image-dimensions/481x200?v=v2" width="481" height="200" role="button" title="Jeremy.png" alt="Jeremy.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 04:51:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7300504#M56721</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2017-08-15T04:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7300533#M56722</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Dale,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your update.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Sorry for confusing you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The code I posted is untested, and I should have said so.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Symbol is a property of FamilyInstance, and `x` is an Element, so you have to cast it:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  string targetFamilyName = "Family Xyz";
  string targetInstanceName = "60\" x 30\" Student";
  
  FilteredElementCollector instances
    = new FilteredElementCollector( document )
      .OfClass( typeof( FamilyInstance ) )
      .Where( x =&amp;gt; x.Name.Equals( targetInstanceName )
      .Where( x =&amp;gt; ((FamilyInstance)x).Symbol
        .Family.Name.Equals( targetFamilyName )&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I assumed you knew.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 05:21:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7300533#M56722</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-08-15T05:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7300820#M56723</link>
      <description>&lt;P&gt;Thank you again Jeremy. There were a couple of parentheses and cast adjustments, I have included the working code for completeness, As far as assuming knowledge, remember:&amp;nbsp;"Never attribute to malice that which is adequately explained by stupidity"...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// get all instances by family name then type name
            List&amp;lt;FamilyInstance&amp;gt; familyInstances
              = new FilteredElementCollector(pdoc)
              .OfClass(typeof(FamilyInstance))
              .Where(x =&amp;gt; ((FamilyInstance)x).Symbol.Family.Name.Equals(pstrFamilyNameOld)) // family
              .Where(x =&amp;gt; x.Name.Equals(pstrFamilyTypeNameOld)) // family type               
              .Cast&amp;lt;FamilyInstance&amp;gt;()
              .ToList&amp;lt;FamilyInstance&amp;gt;();

            // get titleblock family symbol (= definition) by family name then type name
            FamilySymbol fs = new FilteredElementCollector(pdoc)
                .OfClass(typeof(FamilySymbol))
                .OfCategory(BuiltInCategory.OST_TitleBlocks)
                .Where(x =&amp;gt; ((FamilySymbol)x).FamilyName.Equals(pstrFamilyNameNew)) // family
                .FirstOrDefault(x =&amp;gt; x.Name == pstrFamilyTypeNameNew) as FamilySymbol; // family type&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 08:28:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7300820#M56723</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2017-08-15T08:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7300930#M56724</link>
      <description>&lt;P&gt;Dear Dale,&lt;BR /&gt; &lt;BR /&gt;Glad it helped!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the corrected code and very apt (and all too frequently useful) quote!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh, and you can optimise a bit, if you are using the LINQ Cast method anyway:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  // get all instances by family name then type name
  List&amp;lt;FamilyInstance&amp;gt; familyInstances
    = new FilteredElementCollector(pdoc)
    .OfClass(typeof(FamilyInstance))
    .Cast&amp;lt;FamilyInstance&amp;gt;()
    .Where(x =&amp;gt; x.Symbol.Family.Name.Equals(pstrFamilyNameOld)) // family
    .Where(x =&amp;gt; x.Name.Equals(pstrFamilyTypeNameOld)) // family type               
    .ToList&amp;lt;FamilyInstance&amp;gt;();
  
  // get titleblock family symbol (= definition) by family name then type name
  FamilySymbol fs = new FilteredElementCollector(pdoc)
      .OfClass(typeof(FamilySymbol))
      .OfCategory(BuiltInCategory.OST_TitleBlocks)
      .Cast&amp;lt;FamilySymbol&amp;gt;()
      .Where(x =&amp;gt; x.FamilyName.Equals(pstrFamilyNameNew)) // family
      .FirstOrDefault(x =&amp;gt; x.Name == pstrFamilyTypeNameNew); // family type&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No need to cast twice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this, `x` is a FamilyInstance (or FamilySymbol) itself, directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;BR /&gt; &lt;BR /&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 09:29:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7300930#M56724</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-08-15T09:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7301167#M56725</link>
      <description>&lt;P&gt;Thanks Jeremy. Much appreciated. Dale&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 11:53:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7301167#M56725</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2017-08-15T11:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7301234#M56726</link>
      <description>&lt;P&gt;My pleasure, Dale.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your appreciation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Added to The Building Coder samples for future reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/commit/ca8fcace3a4c9eb7d6563736800fe79d7624b4b2" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/commit/ca8fcace3a4c9eb7d6563736800fe79d7624b4b2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 12:25:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7301234#M56726</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-08-15T12:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7301415#M56727</link>
      <description>&lt;P&gt;Man, I wish I'd found that a week ago.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 13:24:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7301415#M56727</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2017-08-15T13:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7301424#M56728</link>
      <description>&lt;P&gt;That was impossible, since I only added it just now after our conversation.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 13:27:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7301424#M56728</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-08-15T13:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7308150#M56729</link>
      <description>&lt;P&gt;Edited and published on the blog for future reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2017/08/forge-installed-version-move-group-filter-by-name.html#7" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2017/08/forge-installed-version-move-group-filter-by-name.html#7&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 14:41:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/7308150#M56729</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-08-17T14:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Family Instance Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/9207587#M56730</link>
      <description>&lt;P&gt;There is an easier:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;private List&amp;lt;FamilyInstance&amp;gt; GetInstancesBySymbol(Document doc, FamilySymbol symb)
{
	List&amp;lt;FamilyInstance&amp;gt; fams = new FilteredElementCollector(doc)
		.OfClass(typeof(FamilyInstance))
		.Cast&amp;lt;FamilyInstance&amp;gt;()
		.Where(fi =&amp;gt; fi.Symbol.Id == symb.Id)
		.ToList();
	return fams;
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 17:10:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/family-instance-filter/m-p/9207587#M56730</guid>
      <dc:creator>Extraneous</dc:creator>
      <dc:date>2019-12-17T17:10:11Z</dc:date>
    </item>
  </channel>
</rss>

