<?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 Rooms in Linked Docs in Active View in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5791345#M70836</link>
    <description>&lt;P&gt;Thank you very much Jeremy!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess I've found my criterion.. DirectShape it is.. I just love it &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;&lt;A href="http://youtu.be/GrjgbDcgy6M" target="_blank"&gt;http://youtu.be/GrjgbDcgy6M&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Aug 2015 13:48:29 GMT</pubDate>
    <dc:creator>redhotbim</dc:creator>
    <dc:date>2015-08-27T13:48:29Z</dc:date>
    <item>
      <title>Collect Rooms in Linked Docs in Active View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5781526#M70834</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        public static List&amp;lt;Element&amp;gt; RoomsInView(DocumentSet docs, View view)
        {
            List&amp;lt;Element&amp;gt; riv = new List&amp;lt;Element&amp;gt;();
            foreach (Document dc in docs)
            {
                FilteredElementCollector viewElementCollector = new FilteredElementCollector(dc, view.Id);
                ElementCategoryFilter roomFilter = new ElementCategoryFilter(BuiltInCategory.OST_Rooms);
                viewElementCollector.WhereElementIsNotElementType();
                viewElementCollector.WherePasses(roomFilter);
                riv.AddRange(viewElementCollector.ToElements());
            }
            return riv;
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code above doesn't work because the FilteredElementCollector(doc, viewId) expects the viewId to be from the same document I guess?&lt;/P&gt;&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/revit-api/viewid-is-not-a-view-filteredelementcollector-on-rooms/td-p/3848650" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/viewid-is-not-a-view-filteredelementcollector-on-rooms/td-p/3848650&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to collect rooms in Linked Documents that are visible in a view that belongs to the current document? Any workaround?&lt;/P&gt;&lt;P&gt;Thanks..&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2015 09:24:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5781526#M70834</guid>
      <dc:creator>redhotbim</dc:creator>
      <dc:date>2015-08-21T09:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Collect Rooms in Linked Docs in Active View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5782076#M70835</link>
      <description>&lt;P&gt;Yes, the filtered element collector definitely expects the view id to be from the same document that the collector is instantiated for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, of course there is a workaround. There always is. It is just a question of how much effort it takes, and how efficient it turns out to be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, you can simply collect the rooms from the linked document and add some other criterion to select the ones you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of instantiating filtered element collectors for all linked documents (I think):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/revit-api/hide-elements-in-linked-file/td-p/5777305" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/hide-elements-in-linked-file/td-p/5777305&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you may ask:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What criterion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hah.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You tell me, please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, here is another example related to&amp;nbsp;filtering for rooms in linked documents:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/revit-api/viewid-is-not-a-view-filteredelementcollector-on-rooms/td-p/3848650" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/viewid-is-not-a-view-filteredelementcollector-on-rooms/td-p/3848650&lt;/A&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;Happy weekend to all.&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>Fri, 21 Aug 2015 14:28:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5782076#M70835</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-08-21T14:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Collect Rooms in Linked Docs in Active View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5791345#M70836</link>
      <description>&lt;P&gt;Thank you very much Jeremy!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess I've found my criterion.. DirectShape it is.. I just love it &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;&lt;A href="http://youtu.be/GrjgbDcgy6M" target="_blank"&gt;http://youtu.be/GrjgbDcgy6M&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:48:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5791345#M70836</guid>
      <dc:creator>redhotbim</dc:creator>
      <dc:date>2015-08-27T13:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Collect Rooms in Linked Docs in Active View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5962016#M70837</link>
      <description>&lt;P&gt;Dear mr Tammik,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a problem on my desktop computer that i couldn't debug my code in visual studio 2015, &amp;lt;&amp;lt;some said that revit is only compatible with VS 2010, is that right?! &amp;gt;&amp;gt; .Finally I moved to my laptop computer and the debugger was working properly, anyway my code was right except a minor mistake in the GetAllRooms(); function that made my program not to collect anyrooms from the document so the count was 0 and that's why it didn't draw any floors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached my new method for collecting the rooms from the doc and it worked properly.&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt; public List&amp;lt;Room&amp;gt; GetAllRooms(Document document)
        {
            FilteredElementCollector roomCollect = new FilteredElementCollector(document);
            roomCollect.OfCategory(BuiltInCategory.OST_Rooms);
            Room room = null;
            foreach (Element elem in roomCollect)
            {
                room = elem as Room;
                if(room != null)
                {
                    projectRooms.Add(room);
                }
            }
            return projectRooms;
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to thank you for your reply and I hope I can learn a lot from you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;,&lt;/P&gt;&lt;P&gt;Amr,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 15:06:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5962016#M70837</guid>
      <dc:creator>amrshaalan</dc:creator>
      <dc:date>2015-12-22T15:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Collect Rooms in Linked Docs in Active View</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5962178#M70838</link>
      <description>&lt;P&gt;Dear Amr,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Congratulations on finding and fixing the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Debugging helps, doesn't it? &amp;nbsp;&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;To answer your new question, please take a look at the Revit API Developer Guide:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://help.autodesk.com/view/RVT/2016/ENU/?guid=GUID-FEF0ED40-8658-4C69-934D-7F83FB5D5B63" target="_blank"&gt;http://help.autodesk.com/view/RVT/2016/ENU/?guid=GUID-FEF0ED40-8658-4C69-934D-7F83FB5D5B63&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2 class="title sectiontitle"&gt;Development Requirements&lt;/H2&gt;
&lt;P class="p"&gt;The Autodesk Revit API requires the Microsoft .NET Framework v4.5. To edit and debug your API applications, you need an interactive development environment such as Microsoft Visual Studio 2012 Professional or one of the MS Visual Studio Express Editions for C# or Visual Basic.NET. (Visual Studio Professional is recommended, as Express editions do not support DLL debugging.) When developing with the Autodesk Revit API, ensure that your project references two DLLs: &lt;STRONG id="GUID-FEF0ED40-8658-4C69-934D-7F83FB5D5B63__GUID-ED60F2AE-FDB1-45C3-9FAC-77157EFF3E41" class="ph b"&gt;RevitAPI.dll&lt;/STRONG&gt; and &lt;STRONG id="GUID-FEF0ED40-8658-4C69-934D-7F83FB5D5B63__GUID-89AE6F6E-03F8-4D31-A0D9-2663B53AA679" class="ph b"&gt;RevitAPIUI.dll&lt;/STRONG&gt; contained in the Autodesk Revit Program directory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Merry Xmas and a Happy New Year to you!&lt;/P&gt;
&lt;P&gt;&lt;BR /&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>Tue, 22 Dec 2015 16:29:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/collect-rooms-in-linked-docs-in-active-view/m-p/5962178#M70838</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-12-22T16:29:05Z</dc:date>
    </item>
  </channel>
</rss>

