<?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: All model elements in project in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973456#M68533</link>
    <description>&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;Yes i was aware it was only checking active view but forgot to mention that in my post.&lt;/P&gt;&lt;P&gt;My mistake, as you say "call" should in fact be "cat"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything works fine and i am happy tidying up the list after but i just thought there might be a better way of doing it.&lt;/P&gt;&lt;P&gt;The "if (cat.CategoryType == CategoryType.Model)" seems to pick up things like camera's which in my mind arent model elements...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for clarifying i wasnt completely off the ball and my solution is ok.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jan 2016 10:46:48 GMT</pubDate>
    <dc:creator>miketurpin_innovatingfutures</dc:creator>
    <dc:date>2016-01-05T10:46:48Z</dc:date>
    <item>
      <title>All model elements in project</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5972035#M68530</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to search and find all elements that are actually modelled in my project (walls, doors, beam, etc).&lt;/P&gt;&lt;P&gt;From this i will search all elements to find there category and write these to a list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far my code is:&lt;/P&gt;&lt;PRE&gt;List&amp;lt;string&amp;gt; catlist = new List&amp;lt;string&amp;gt;();      

FilteredElementCollector col = new FilteredElementCollector(doc, doc.ActiveView.Id);
            foreach (Element e in col)
            {
                Category cat = e.Category;
                if (call.CategoryType == CategoryType.Model)
                {
                    catlist.Add(cat.Name);
                }
            }&lt;/PRE&gt;&lt;P&gt;I am using the &lt;EM&gt;If(call.categorytype == categorytype.model) &lt;/EM&gt;to try and filter out all non model items but the list still contains things like cameras which i dont want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice on a better way of achieving this greatly received!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2016 16:09:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5972035#M68530</guid>
      <dc:creator>miketurpin_innovatingfutures</dc:creator>
      <dc:date>2016-01-04T16:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: All model elements in project</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973427#M68531</link>
      <description>&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;Your code is only checking the active view and will not get everything in the model, but perhaps you already knew that. In call.CategoryType == CategoryType.Model. What is "call" in your code, did you mean cat? Seems like all elements pass this condition for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are a bunch of other ways to do this, maybe you could use a multicategory filter to fetch the categories you want.&lt;/P&gt;&lt;P&gt;Keep in mind that getting every element of CategoryType.Model(Familyinstances) will get every Curtainwall mullion, panel etc as well, which can be a pretty long list. But I assume you will clean&amp;nbsp;up that list in the end &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Martin&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 10:14:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973427#M68531</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-05T10:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: All model elements in project</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973450#M68532</link>
      <description>&lt;P&gt;Dear Mike and Martin,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your query and helpful answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, indeed, more than a bunch of other ways, I would say the number is absolutely infinite.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am also confused by the sample code you present, since it neither compiles nor makes any sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, luckily for you, a number of approaches to solve this very issue have been presented by The Building Coder in the topic group on filtering for all elements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just updated the links under 'Selecting Model Elements or Visible 3D Elements' for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&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;</description>
      <pubDate>Tue, 05 Jan 2016 10:41:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973450#M68532</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-01-05T10:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: All model elements in project</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973456#M68533</link>
      <description>&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;Yes i was aware it was only checking active view but forgot to mention that in my post.&lt;/P&gt;&lt;P&gt;My mistake, as you say "call" should in fact be "cat"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything works fine and i am happy tidying up the list after but i just thought there might be a better way of doing it.&lt;/P&gt;&lt;P&gt;The "if (cat.CategoryType == CategoryType.Model)" seems to pick up things like camera's which in my mind arent model elements...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for clarifying i wasnt completely off the ball and my solution is ok.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 10:46:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973456#M68533</guid>
      <dc:creator>miketurpin_innovatingfutures</dc:creator>
      <dc:date>2016-01-05T10:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: All model elements in project</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973458#M68534</link>
      <description>&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dont know why my code doesnt work for you, did you pick up my error as pointed out by Martin?&lt;/P&gt;&lt;P&gt;I am using Revit 2016&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have just read through your "Selecting Model Elements" post and think this will give me a better solution than i currently have so will give that a go later today.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help, always appreciated!&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 10:50:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/all-model-elements-in-project/m-p/5973458#M68534</guid>
      <dc:creator>miketurpin_innovatingfutures</dc:creator>
      <dc:date>2016-01-05T10:50:11Z</dc:date>
    </item>
  </channel>
</rss>

