<?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: Get ElementId of all visible entities in a viewport in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7114494#M69672</link>
    <description>&lt;P&gt;For future reference, I published a summary of this thread:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2017/05/retrieving-elements-visible-in-view.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2017/05/retrieving-elements-visible-in-view.html&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>Mon, 29 May 2017 09:04:07 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2017-05-29T09:04:07Z</dc:date>
    <item>
      <title>Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/5879077#M69666</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking for the code to get all ElementIds of all entities inside a viewport. A viewport is a region of a big view plan. How to get&amp;nbsp;ElementId of all visible entities in a&amp;nbsp;viewport?&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;</description>
      <pubDate>Mon, 26 Oct 2015 22:32:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/5879077#M69666</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-26T22:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/5879345#M69667</link>
      <description>Dear, you can take a look at this question:&lt;BR /&gt;&lt;A href="http://forums.autodesk.com/t5/revit-api/elements-from-linked-document/m-p/5867049#M12287" target="_blank"&gt;http://forums.autodesk.com/t5/revit-api/elements-from-linked-document/m-p/5867049#M12287&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;in order to get visible elements regardless of linked elements, you can use FilteredElementCollector(Document document, ElementId viewId)&lt;BR /&gt;&lt;BR /&gt;in order to include linked elements, you can use CustomExpoter, see examples here:&lt;BR /&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2013/07/graphics-pipeline-custom-exporter.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2013/07/graphics-pipeline-custom-exporter.html&lt;/A&gt;&lt;BR /&gt;when you call CustomExporter.Export, it will go through all the visible elements in the view you specified.</description>
      <pubDate>Tue, 27 Oct 2015 04:59:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/5879345#M69667</guid>
      <dc:creator>Aaron.Lu</dc:creator>
      <dc:date>2015-10-27T04:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/5881194#M69668</link>
      <description>&lt;P&gt;Hi Aaron,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found the solution is to&amp;nbsp;find the ViewPlan associated with the Viewport, then check BoundingBox of all elements in the same level of this ViewPlan to find ones that fit inside this ViewPlan.CropBox.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 02:42:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/5881194#M69668</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-28T02:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/5881203#M69669</link>
      <description>Cool, thanks for posting the solution!</description>
      <pubDate>Wed, 28 Oct 2015 03:20:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/5881203#M69669</guid>
      <dc:creator>Aaron.Lu</dc:creator>
      <dc:date>2015-10-28T03:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7113476#M69670</link>
      <description>&lt;P&gt;Dear Khoa,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am learning Revit API and a beginner. I am so desperate to learn what you have mentioned. Could you provide a code of how the method you have mentioned can be fleshed out? Please, please ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Minho&lt;/P&gt;</description>
      <pubDate>Sun, 28 May 2017 13:31:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7113476#M69670</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-28T13:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7114249#M69671</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Minho,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your query.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Welcome to Revit API programming!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I suggest that you first of all take a look at the getting started material and work through the step-by-step instructions provided by the DevTV and My First Revit Plugin video tutorials:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#2" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#2&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That will show you what other important material is available that you MUST be aware of, answer this question of yours, and many, many more besides.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Once you understand the basics of using filtered element collectors, the answers provided above will become self-explanatory.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;They do already &amp;nbsp;answer your question in full.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The Building Coder discussed the related topic of determining all views displaying a specific element in depth, implementing an external command named CmdViewsShowingElements to try out some approaches:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- Determine Views Displaying Given Element&amp;nbsp;-- &lt;A href="http://thebuildingcoder.typepad.com/blog/2014/05/views-displaying-given-element-svg-and-nosql.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2014/05/views-displaying-given-element-svg-and-nosql.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- Determining Views Showing an Element -- &lt;A href="http://thebuildingcoder.typepad.com/blog/2016/12/determining-views-showing-an-element.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2016/12/determining-views-showing-an-element.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;A similar question recently also arose in a StackOverflow thread on how to&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- Determine whether a FamilyInstance is visible in a View&amp;nbsp;-- &lt;A href="http://stackoverflow.com/questions/44012630/determine-is-a-familyinstance-is-visible-in-a-view" target="_blank"&gt;http://stackoverflow.com/questions/44012630/determine-is-a-familyinstance-is-visible-in-a-view&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Colin Stark answered that succinctly, saying:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I have found that the most reliable way of knowing whether an element is visible in a view is to use a FilteredElementCollector specific to that view. There are so many different ways of controlling the visibility of an element that it would be impractical to try to determine this any other way.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Below is the utility function I use to achieve this. Note this works for any element, and not just for family instances...&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;The category filter is used to eliminate any element not of the desired category before using the slower parameter filter to find the desired element. It is probably possible to speed this up further with clever usage of filters, but I have found that it is plenty fast enough for me in practice.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I added Colin's code to The Building Coder samples&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;CmdViewsShowingElement&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdViewsShowingElements.cs" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdViewsShowingElements.cs&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 06:35:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7114249#M69671</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-05-29T06:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7114494#M69672</link>
      <description>&lt;P&gt;For future reference, I published a summary of this thread:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2017/05/retrieving-elements-visible-in-view.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2017/05/retrieving-elements-visible-in-view.html&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>Mon, 29 May 2017 09:04:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7114494#M69672</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-05-29T09:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7173637#M69673</link>
      <description>&lt;P&gt;Jeremy is the big time saver. Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 12:37:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7173637#M69673</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-23T12:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get ElementId of all visible entities in a viewport</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7174777#M69674</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeremy, thank you so much for the help! Can't thank you enough!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 19:27:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-elementid-of-all-visible-entities-in-a-viewport/m-p/7174777#M69674</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-23T19:27:11Z</dc:date>
    </item>
  </channel>
</rss>

