<?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 Going through all the element of a model in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8726677#M43057</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to go through every component/element of the model extracting the information of each of the elements without having to do it by families, like the SDK of Material Quantities does?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;m_elementsToProcess = collector.OfCategory(BuiltInCategory.OST_Floors).WhereElementIsNotElementType().ToElements();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do something similar to this but without having to go through all the BuiltInCategories.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;JMGP&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2019 14:48:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-04-12T14:48:34Z</dc:date>
    <item>
      <title>Going through all the element of a model</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8726677#M43057</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to go through every component/element of the model extracting the information of each of the elements without having to do it by families, like the SDK of Material Quantities does?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;m_elementsToProcess = collector.OfCategory(BuiltInCategory.OST_Floors).WhereElementIsNotElementType().ToElements();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do something similar to this but without having to go through all the BuiltInCategories.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;JMGP&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 14:48:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8726677#M43057</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-12T14:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Going through all the element of a model</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8727077#M43058</link>
      <description>&lt;P&gt;Yes, of course!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take a look at The Building Coder topic group on element filtering and the samples, especially in the module&amp;nbsp;CmdCollectorPerformance.cs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9&lt;/A&gt;&lt;/LI&gt;
&lt;LI&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;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Together, there must be a hundred examples in there, and almost all of them fulfil your requirements.&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>Fri, 12 Apr 2019 17:11:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8727077#M43058</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-04-12T17:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Going through all the element of a model</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8730906#M43059</link>
      <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply, those posts to your blog have really interesting information, yet, after going over lots of them, they all had one thing in common: That is that we need to have the families specified before we do the search and/or filtering.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I would like to ask you if there is a way of doing so without knowing the families that we have to search for. For example, what if I would like to retrieve all the objects that contain wood as a material, regardless of the family that they belong to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;JMGP&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 12:55:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8730906#M43059</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-15T12:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Going through all the element of a model</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8730961#M43060</link>
      <description>&lt;P&gt;You can still use filtered element collector for collecting all families in the active Revit Document.&lt;/P&gt;
&lt;P&gt;Here is the sample code:&lt;/P&gt;
&lt;PRE&gt;List&amp;lt;FamilySymbol&amp;gt; woodFamilies = new List&amp;lt;FamilySymbol&amp;gt;();

List&amp;lt;FamilySymbol&amp;gt; families = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Cast&amp;lt;FamilySymbol&amp;gt;().ToList();

foreach (var family in families)
 {
        if (family.StructuralMaterialType == StructuralMaterialType.Wood)
        {
          woodFamilies.Add(family);
        }
}&lt;/PRE&gt;
&lt;P&gt;I hope this helps,&lt;/P&gt;
&lt;P&gt;Recep.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 13:16:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8730961#M43060</guid>
      <dc:creator>recepagah12</dc:creator>
      <dc:date>2019-04-15T13:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Going through all the element of a model</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8731606#M43061</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5535549"&gt;@recepagah12&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All of this results are using the Sample Architecture Project Model from Revit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been playing around with the idea you proposed and I get the following:&lt;/P&gt;
&lt;P&gt;If I use&amp;nbsp;&lt;EM&gt;FamilySymbol&amp;nbsp;&lt;/EM&gt;the StructuralMaterialType turns out to be undefined.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After this and some reading, I changed&amp;nbsp;&lt;EM&gt;FamilySymbol&amp;nbsp;&lt;/EM&gt;for&amp;nbsp;&lt;EM&gt;FamilyInstance&amp;nbsp;&lt;/EM&gt;and now the StructuralMaterialType property different values in the different families. The families I get that have Concrete as a StructuralMaterialType have names like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;type Other&lt;BR /&gt;name wardrobe&lt;BR /&gt;&lt;BR /&gt;type Concrete&lt;BR /&gt;name 600 x 600 x 900mm&lt;BR /&gt;&lt;BR /&gt;type Steel&lt;BR /&gt;name 600mm Diameter&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;What is being printed as "name" is the family name of each element in&lt;EM&gt; families&lt;/EM&gt;&amp;nbsp;when instead we should get things like "Wall", "Roof" etc.&amp;nbsp; Do you have any idea of why or how to get to that output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;JMGP&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 16:52:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8731606#M43061</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-15T16:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Going through all the element of a model</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8731803#M43062</link>
      <description>&lt;P&gt;You said "family". If you want to access to wall and roof, they have their own class, like Wall, Roof, Floor etc.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the sample code.&lt;/P&gt;
&lt;P&gt;I used the material name as &lt;STRONG&gt;"Wood"&amp;nbsp;&lt;/STRONG&gt;but you can change also If you know MaterialId which you want to take you can use it, If you don't know its Id you can snoop with Revit LookUp.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// This is the wood elements name list
                    string woodElementNames = "";

                    // Collect walls and floors in the document
                    List&amp;lt;Wall&amp;gt; walls = new FilteredElementCollector(doc).OfClass(typeof(Wall)).Cast&amp;lt;Wall&amp;gt;().ToList();
                    List&amp;lt;Floor&amp;gt; floors = new FilteredElementCollector(doc).OfClass(typeof(Floor)).Cast&amp;lt;Floor&amp;gt;().ToList();
                    List&amp;lt;FootPrintRoof&amp;gt; footPrintRoofs = new FilteredElementCollector(doc).OfClass(typeof(FootPrintRoof)).Cast&amp;lt;FootPrintRoof&amp;gt;().ToList();
                    List&amp;lt;ExtrusionRoof&amp;gt; extrusionRoofs = new FilteredElementCollector(doc).OfClass(typeof(ExtrusionRoof)).Cast&amp;lt;ExtrusionRoof&amp;gt;().ToList();

                    if (walls != null)
                    {
                        foreach (var wall in walls)
                        {
                            var wallLayers = wall.WallType.GetCompoundStructure().GetLayers();

                            foreach (var layer in wallLayers)
                            {
                                var material = doc.GetElement(layer.MaterialId) as Material;
                                // I typed material name wood, If yours are different type it.
                                if (layer.Function == MaterialFunctionAssignment.Structure &amp;amp;&amp;amp; material.Name == "Wood")
                                {
                                    woodElementNames += (wall.WallType.FamilyName +wall.WallType.Name + "\n");
                                }
                            }
                        }
                    }
                    
                    if (floors != null)
                    {
                        foreach (var floor in floors)
                        {
                            // If you don't want to count paint material set to false
                            var materialIds = floor.GetMaterialIds(false);

                            foreach (var id in materialIds)
                            {
                                var material = doc.GetElement(id) as Material;
                                if (material.Name == "Wood")
                                {
                                    woodElementNames += (floor.FloorType.FamilyName + floor.FloorType.Name + "\n");
                                }
                            }
                        }
                    }
                    
                    if (footPrintRoofs != null)
                    {
                        foreach (var roof in footPrintRoofs)
                        {
                            var materialIds = roof.GetMaterialIds(false);

                            foreach (var id in materialIds)
                            {
                                var material = doc.GetElement(id) as Material;
                                if (material.Name == "Wood")
                                {
                                    woodElementNames += (roof.Name + "\n");
                                }
                            }
                        }
                    }

                    if (extrusionRoofs != null)
                    {
                        foreach (var roof in extrusionRoofs)
                        {
                            var materialIds = roof.GetMaterialIds(false);

                            foreach (var id in materialIds)
                            {
                                var material = doc.GetElement(id) as Material;
                                if (material.Name == "Wood")
                                {
                                    woodElementNames += (roof.Name + "\n");
                                }
                            }
                        }
                    }

                    TaskDialog.Show("Wood Elements", woodElementNames);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know the code is not looking clear, I pasted it from visual studio and everythin is a mess now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tested and worked fine for me, I hope this works for you too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Recep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 17:58:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/going-through-all-the-element-of-a-model/m-p/8731803#M43062</guid>
      <dc:creator>recepagah12</dc:creator>
      <dc:date>2019-04-15T17:58:54Z</dc:date>
    </item>
  </channel>
</rss>

