<?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: collect all room in leve xx in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6939202#M59734</link>
    <description>&lt;P&gt;thx ...much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is some funny &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; its not element type and then is typ of spacial element and type of room....not so much logical.....&lt;/P&gt;&lt;PRE&gt;WhereElementIsNotElementType()
        .OfClass( typeof( SpatialElement ) )
        .Where( e =&amp;gt; e.GetType() == typeof( Room ) &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Mar 2017 11:07:05 GMT</pubDate>
    <dc:creator>sonicer</dc:creator>
    <dc:date>2017-03-11T11:07:05Z</dc:date>
    <item>
      <title>collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6936959#M59728</link>
      <description>&lt;P&gt;How can I collect all rooms in level 01...a then do somethin with this rooms?&lt;/P&gt;&lt;P&gt;i used coolectelement filter....no idea how to get....have somebody complet source code....&lt;/P&gt;&lt;P&gt;I can do that in dynamo ...now I want do that in c# ....c# beginner programmer...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code for revit 2016 api or revit 2017 api.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 12:36:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6936959#M59728</guid>
      <dc:creator>sonicer</dc:creator>
      <dc:date>2017-03-10T12:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6937364#M59729</link>
      <description>&lt;P&gt;you have problem because you can't collect Rooms, you need collect SpatialElement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        public List&amp;lt;Room&amp;gt; getRoomFromLevel(Document document, Level level)
        {
            
            List&amp;lt;Element&amp;gt; Rooms = new FilteredElementCollector(document).OfClass(typeof(SpatialElement)).WhereElementIsNotElementType().Where(room =&amp;gt; room.GetType() == typeof(Room)).ToList();

            return new List&amp;lt;Room&amp;gt;(Rooms.Where(room =&amp;gt; document.GetElement(room.LevelId) == level).Select(r =&amp;gt; r as Room));
        }&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Mar 2017 14:43:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6937364#M59729</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2017-03-10T14:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6937917#M59730</link>
      <description>&lt;P&gt;sorry don't work..&lt;/P&gt;&lt;P&gt;it does!nt know "Where.()..."and new List&amp;lt;room&amp;gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 17:52:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6937917#M59730</guid>
      <dc:creator>sonicer</dc:creator>
      <dc:date>2017-03-10T17:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6938013#M59731</link>
      <description>&lt;P&gt;Very good solution!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Where' and 'List&amp;lt;&amp;gt;' come from the System.Collections.Generic namespace.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some further small improvements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;      return new FilteredElementCollector( doc )
        .WhereElementIsNotElementType()
        .OfClass( typeof( SpatialElement ) )
        .Where( e =&amp;gt; e.GetType() == typeof( Room ) )
        .Where( e =&amp;gt; e.LevelId.IntegerValue.Equals( 
          idLevel.IntegerValue ) )
        .Cast&amp;lt;Room&amp;gt;();&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More efficient because of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Elimination of ToList()&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Elimination of &lt;/SPAN&gt;New List&amp;lt;&amp;gt;()&lt;/LI&gt;
&lt;LI&gt;Elimination of doc.GetElement()&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You can see how to compile it in The Building Coder samples:&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/compare/2017.0.132.7...2017.0.132.8" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/compare/2017.0.132.7...2017.0.132.8&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>Fri, 10 Mar 2017 18:20:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6938013#M59731</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-03-10T18:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6938629#M59732</link>
      <description>&lt;P&gt;wou thx Tammik your code work for me....But I want know how to use the first code?I make some change&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;List&amp;lt;Element&amp;gt; Rooms = new FilteredElementCollector(doc).OfClass(typeof(SpatialElement)).WhereElementIsNotElementType().Where(room =&amp;gt; room.GetType() == typeof(Room)).ToList();&lt;BR /&gt;&lt;BR /&gt;List&amp;lt;Room&amp;gt; Rooms1 = new List&amp;lt;Room&amp;gt;(Rooms.Where(room =&amp;gt; doc.GetElement(room.LevelId) == level).Select(r =&amp;gt; r as Room));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I know the level 01 have id =355....why can I use 355 &lt;SPAN&gt;&lt;SPAN&gt;instead of "level"??? Or make some other mistake? Levelid is string, integer ??&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;In your code I inserted value 355 instead of idLevel.IntegerValue ...this work.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 22:10:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6938629#M59732</guid>
      <dc:creator>sonicer</dc:creator>
      <dc:date>2017-03-10T22:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6938772#M59733</link>
      <description>&lt;P&gt;level.levelId is type ElementId and you can use integervalue if you what have (int) or toString and then you gonna have string.&lt;/P&gt;&lt;P&gt;I suggest using Jeremy code, don't focus much on code that I write in one minute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;by the way thanks jeremy for improving it. It look much better in one lane.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 23:20:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6938772#M59733</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2017-03-10T23:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6939202#M59734</link>
      <description>&lt;P&gt;thx ...much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is some funny &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; its not element type and then is typ of spacial element and type of room....not so much logical.....&lt;/P&gt;&lt;PRE&gt;WhereElementIsNotElementType()
        .OfClass( typeof( SpatialElement ) )
        .Where( e =&amp;gt; e.GetType() == typeof( Room ) &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 11:07:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6939202#M59734</guid>
      <dc:creator>sonicer</dc:creator>
      <dc:date>2017-03-11T11:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6939344#M59735</link>
      <description>&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2010/08/filtering-for-a-nonnative-class.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2010/08/filtering-for-a-nonnative-class.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the remarks on the&amp;nbsp;ElementClassFilter Class:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2017/4b7fb6d7-cb9c-d556-56fc-003a0b8a51b7.htm" target="_blank"&gt;http://www.revitapidocs.com/2017/4b7fb6d7-cb9c-d556-56fc-003a0b8a51b7.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 14:14:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6939344#M59735</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-03-11T14:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6945877#M59736</link>
      <description>&lt;P&gt;I summarised this discussion on The Building Coder for legibility and 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/03/events-uv-coordinates-and-rooms-on-level.html#6" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2017/03/events-uv-coordinates-and-rooms-on-level.html#6&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, 14 Mar 2017 20:43:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/6945877#M59736</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-03-14T20:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10147663#M59737</link>
      <description>&lt;P&gt;Jeremy:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please explain what is the variable e in your reply? It was not used in the example you corrected. Does it need to be defined as the selected element?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 09:28:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10147663#M59737</guid>
      <dc:creator>greg7KTAR</dc:creator>
      <dc:date>2021-03-11T09:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10147674#M59738</link>
      <description>&lt;P&gt;I see no variable `e` except within the LINQ query expressions, so I do not understand your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 09:33:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10147674#M59738</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-03-11T09:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10370425#M59739</link>
      <description>hi Greg, the 'e' in his code is used for LINQ/Lambda expressions. It is a sort of abbreviated (and in most cases preferred IMO) 'foreach loop notation'. The logic is you are assigning an arbitrary variable name (in this case e) to each item in the enumerable on which you are using the expression, ultimately applying some function to each item. GoogleSearch can provide much nicer additional examples and explanations than I could. Additionally, I believe the BuildingCoder also has a few nice articles that discuss the topic.</description>
      <pubDate>Mon, 07 Jun 2021 16:02:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10370425#M59739</guid>
      <dc:creator>rhanzlick</dc:creator>
      <dc:date>2021-06-07T16:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10376415#M59740</link>
      <description>&lt;P&gt;I realize the API has very likely been updated since this OP, but I find the addition of .OfCategory(BuiltinCategory.OST_Rooms) in lieu of the oftype filters.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 14:05:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10376415#M59740</guid>
      <dc:creator>rhanzlick</dc:creator>
      <dc:date>2021-06-09T14:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: collect all room in leve xx</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10376849#M59741</link>
      <description>&lt;P&gt;Oh yes! Thank you for the pointer. OfCategory is much better, being a fast filter, rather than post-processing with .NET Where, which is not a filter at all, and hence much, much less performant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 16:41:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-all-room-in-leve-xx/m-p/10376849#M59741</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-06-09T16:41:40Z</dc:date>
    </item>
  </channel>
</rss>

