<?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: Is it Show Filter in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8714210#M43256</link>
    <description>&lt;P&gt;If this works for you and does what you need, then all is fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, this is not a fast filter, nor is it a slow filter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is slower still.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Where clause is a LINQ construct, in .NET, not a Revit filter at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In order for it to work, the Revit API has to transport all the element data out of the Revit memory space to .NET, where it is being post-processed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This transport process is called marshalling and costs more time than all Revit filters, regardless whether they are fast or slow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cleaned up and published my previous answer on The Building Coder, in case that helps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2019/04/slow-slower-still-and-faster-filtering.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2019/04/slow-slower-still-and-faster-filtering.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Apr 2019 10:45:26 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2019-04-08T10:45:26Z</dc:date>
    <item>
      <title>Is it Show Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8712175#M43252</link>
      <description>&lt;P&gt;I have use.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it Show Filter&lt;/P&gt;
&lt;P&gt;String&amp;nbsp;Section_Name = "XXXXXXX";&lt;/P&gt;
&lt;P&gt;IEnumerable&amp;lt;Element&amp;gt; elems = collect.OfClass(typeof(FamilyInstance)).Cast&amp;lt;FamilyInstance&amp;gt;()&lt;BR /&gt;&amp;nbsp;.Where(x =&amp;gt; x.get_Parameter(BuiltInParameter.ELEM_FAMILY_PARAM).AsValueString() == Section_Name);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any alternate method using LINQ without&amp;nbsp;BuiltInParameter?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Apr 2019 16:19:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8712175#M43252</guid>
      <dc:creator>Arciviz</dc:creator>
      <dc:date>2019-04-06T16:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Show Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8712790#M43253</link>
      <description>&lt;P&gt;Please check your spelling before posting!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume you mean to ask:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question: Is this filter a &lt;U&gt;slow&lt;/U&gt; filter?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Answer: No, it is not. It is &lt;U&gt;even slower&lt;/U&gt; than a slow filter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This example retrieves the element data from Revit to the .NET add-in memory space, and the uses .NET and LINQ to &lt;U&gt;post-process&lt;/U&gt; it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&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;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could convert it to a fast filter by implementing a parameter filter to compare the family name:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2018/06/forge-tutorials-and-filtering-for-a-parameter-value.html#3" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2018/06/forge-tutorials-and-filtering-for-a-parameter-value.html#3&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2019 11:25:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8712790#M43253</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-04-07T11:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Show Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8712804#M43254</link>
      <description>&lt;P&gt;I cleaned up The Building Coder sample code demonstrating&amp;nbsp;retrieving named family symbols using either LINQ or a parameter filter for you:&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/blob/master/BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs#L1203-L1255" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdCollectorPerformance.cs#L1203-L1255&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    #region Retrieve named family symbols using either LINQ or a parameter filter
    static FilteredElementCollector
      GetStructuralColumnSymbolCollector(
        Document doc )
    {
      return new FilteredElementCollector( doc )
        .OfCategory( BuiltInCategory.OST_StructuralColumns )
        .OfClass( typeof( FamilySymbol ) );
    }

    static IEnumerable&amp;lt;Element&amp;gt; Linq( 
      Document doc, 
      string familySymbolName )
    {
      return GetStructuralColumnSymbolCollector( doc )
        .Where( x =&amp;gt; x.Name == familySymbolName );
    }

    static IEnumerable&amp;lt;Element&amp;gt; Linq2( 
      Document doc, 
      string familySymbolName )
    {
      return GetStructuralColumnSymbolCollector( doc )
        .Where( x =&amp;gt; x.get_Parameter( 
          BuiltInParameter.SYMBOL_NAME_PARAM )
            .AsString() == familySymbolName );
    }

    private static IEnumerable&amp;lt;Element&amp;gt; FilterRule( 
      Document doc, 
      string familySymbolName )
    {
      return GetStructuralColumnSymbolCollector( doc )
        .WherePasses(
          new ElementParameterFilter(
            new FilterStringRule(
              new ParameterValueProvider(
                new ElementId( BuiltInParameter.SYMBOL_NAME_PARAM ) ),
              new FilterStringEquals(), familySymbolName, true ) ) );
    }

    private static IEnumerable&amp;lt;Element&amp;gt; Factory( 
      Document doc, 
      string familySymbolName )
    {
      return GetStructuralColumnSymbolCollector( doc )
        .WherePasses(
          new ElementParameterFilter(
            ParameterFilterRuleFactory.CreateEqualsRule(
              new ElementId( BuiltInParameter.SYMBOL_NAME_PARAM ),
              familySymbolName, true ) ) );
    }
    #endregion // Retrieve named family symbols using either LINQ or a parameter filter&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this clarifies.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2019 11:42:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8712804#M43254</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-04-07T11:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Show Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8713762#M43255</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please verify below code&lt;/P&gt;
&lt;PRE&gt;//FilteredElementCollector collect = new FilteredElementCollector(doc);
        //IEnumerable&amp;lt;Element&amp;gt; elems = collect.OfClass(typeof(FamilyInstance)).Cast&amp;lt;FamilyInstance&amp;gt;()
        //  .Where(x =&amp;gt; x.get_Parameter(BuiltInParameter.ELEM_FAMILY_PARAM).AsValueString() == "Modular Gang Box");

        FilteredElementCollector collect = new FilteredElementCollector(doc,uidoc.ActiveView.Id);
        IEnumerable&amp;lt;Element&amp;gt; elems = collect.OfClass(typeof(FamilyInstance)).Cast&amp;lt;FamilyInstance&amp;gt;()
          .Where(x =&amp;gt; x.Symbol.Family.Name.Equals("Modular Gang Box"));&lt;/PRE&gt;
&lt;P&gt;I ask you sorry if I made mistake.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sudhan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 07:32:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8713762#M43255</guid>
      <dc:creator>Arciviz</dc:creator>
      <dc:date>2019-04-08T07:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Show Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8714210#M43256</link>
      <description>&lt;P&gt;If this works for you and does what you need, then all is fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, this is not a fast filter, nor is it a slow filter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is slower still.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Where clause is a LINQ construct, in .NET, not a Revit filter at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In order for it to work, the Revit API has to transport all the element data out of the Revit memory space to .NET, where it is being post-processed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This transport process is called marshalling and costs more time than all Revit filters, regardless whether they are fast or slow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cleaned up and published my previous answer on The Building Coder, in case that helps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2019/04/slow-slower-still-and-faster-filtering.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2019/04/slow-slower-still-and-faster-filtering.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 10:45:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8714210#M43256</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-04-08T10:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Is it Show Filter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8714988#M43257</link>
      <description>Thanks for the valuable blog. It is very much useful.</description>
      <pubDate>Mon, 08 Apr 2019 15:02:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/is-it-show-filter/m-p/8714988#M43257</guid>
      <dc:creator>Arciviz</dc:creator>
      <dc:date>2019-04-08T15:02:38Z</dc:date>
    </item>
  </channel>
</rss>

