<?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: How FileteredElementCollector of View works? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9252222#M37371</link>
    <description>&lt;P&gt;try with this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2018.2/4def5498-f47f-870c-ea25-0408b6603dac.htm" target="_blank"&gt;https://www.revitapidocs.com/2018.2/4def5498-f47f-870c-ea25-0408b6603dac.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jan 2020 13:56:07 GMT</pubDate>
    <dc:creator>Yien_Chao</dc:creator>
    <dc:date>2020-01-15T13:56:07Z</dc:date>
    <item>
      <title>How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9251773#M37370</link>
      <description>&lt;P&gt;Can someone please explain how the FilteredElementCollector of the view works?&lt;/P&gt;&lt;PRE&gt;var doc = this.ActiveUIDocument.Document;
var fec = new FilteredElementCollector(doc, doc.activeView.Id);&lt;BR /&gt;// Does it collect all the elements based on view bounding box or view range or View level id?????&lt;/PRE&gt;&lt;P&gt;It seems to me that the Filter also collects the elements from the view below even though the view range of the active view is set to the default like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Level heights" style="width: 425px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/717081i40C71ECA73714C38/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled.png" alt="Level heights" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Level heights&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So the "&lt;STRONG&gt;fec" &lt;/STRONG&gt;sometimes outputs wrong elements which doesn't belong to this view.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 10:38:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9251773#M37370</guid>
      <dc:creator>gprofile</dc:creator>
      <dc:date>2020-01-15T10:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9252222#M37371</link>
      <description>&lt;P&gt;try with this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2018.2/4def5498-f47f-870c-ea25-0408b6603dac.htm" target="_blank"&gt;https://www.revitapidocs.com/2018.2/4def5498-f47f-870c-ea25-0408b6603dac.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 13:56:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9252222#M37371</guid>
      <dc:creator>Yien_Chao</dc:creator>
      <dc:date>2020-01-15T13:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9252766#M37372</link>
      <description>&lt;P&gt;Thanks...&lt;/P&gt;&lt;P&gt;I am not sure if I use the SelectableInView filter right, the result is the same&lt;/P&gt;&lt;PRE&gt;var fec = new FilteredElementCollector(doc, activeView.Id).OfCategory(bic);
var selInView = new SelectableInViewFilter(doc, activeView.Id);

if (selInView.PassesFilter(element)) 
{
	//Select the elements here
}

// Is this right???&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jan 2020 16:59:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9252766#M37372</guid>
      <dc:creator>gprofile</dc:creator>
      <dc:date>2020-01-15T16:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9252928#M37373</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with the selectableInView, any element of any categories that could be selected by the user in the view will appear, even if its hidden behind another element.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the ElementCategoryFilter, you will only select the elements visible in the view, of the specified category.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In both case, the view range affect the selection.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 18:16:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9252928#M37373</guid>
      <dc:creator>Yien_Chao</dc:creator>
      <dc:date>2020-01-15T18:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9254269#M37374</link>
      <description>&lt;P&gt;Sorry for the confusion, I could select the Category I want to select using OfCategory quick filter and it works perfectly. The problem is with filtering of elements that belongs not only from active view but also from the view below. I have tried setting the view range limited to active view, but the result is the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please look at this example below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Active View Properties" style="width: 316px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/717507i5EC506D995A95154/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="Active View Properties" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Active View Properties&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="View Range Properties" style="width: 427px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/717508iE3BC4F4025B7E5CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="View Range Properties" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;View Range Properties&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Task Dialog showing FilteredElementCollector of the View with false elements from the view below" style="width: 329px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/717509i690D52D2AFF842C4/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.png" alt="Task Dialog showing FilteredElementCollector of the View with false elements from the view below" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Task Dialog showing FilteredElementCollector of the View with false elements from the view below&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;int count = 1;
var RevUiDoc = this.ActiveUIDocument;
var RevDoc = RevUiDoc.Document;

var bic = BuiltInCategory.OST_Floors;
var activeView = RevDoc.ActiveView;
var fec = new FilteredElementCollector(RevDoc, activeView.Id).OfCategory(bic);
var selInView = new SelectableInViewFilter(RevDoc, activeView.Id);

var elementLevels = new StringBuilder();
elementLevels.AppendLine("ACTIVE VIEW NAME: " + activeView.Name);
elementLevels.AppendLine("ACTIVE VIEW LEVEL ID: " + activeView.GenLevel.Id);
elementLevels.AppendLine();

foreach (var element in fec) {
	if (selInView.PassesFilter(element)) {
		elementLevels.AppendLine(count + " . " + "ELEMENT ID: " + element.Id);
		elementLevels.AppendLine("ELEMENT LEVEL ID: " + element.LevelId);
		elementLevels.AppendLine("ACTIVE VIEW LEVEL ID: " + activeView.GenLevel.Id);
		elementLevels.AppendLine();
		count++;
	}
}

TaskDialog.Show("Elements in active view", elementLevels.ToString());&lt;/PRE&gt;&lt;P&gt;Why does it select the elements from wrong views... Eventhough the view properties is limited to this view???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 09:52:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9254269#M37374</guid>
      <dc:creator>gprofile</dc:creator>
      <dc:date>2020-01-16T09:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9270269#M37375</link>
      <description>&lt;P&gt;Can somebody please help me with this ???&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 15:28:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9270269#M37375</guid>
      <dc:creator>gprofile</dc:creator>
      <dc:date>2020-01-23T15:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9273087#M37376</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The FilteredElementCollector retrieves everything that's visible in the view.&lt;/P&gt;&lt;P&gt;So even if you're floorplan viewrange is set only to a single level (as in you're sample) it's possible something from another level is selected. For example a family that's placed a level lower, but has geometry (or even 2d info) expand beyond the level to the level in you're sample. (or even a element placed a level higher)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you need all elements of a certain level use the Collector functions to filter for the level.&lt;/P&gt;&lt;P&gt;Otherwise you could even mis a element placed on the level but not visible (detail level, geometry modelled higher etc.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample: Wall, the baseoffset can be set higher then the level it's on, so then you're filter will mis it or select it while it's on another level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it depends what you're goal is, select all in view or all placed on a specific level.&lt;/P&gt;&lt;P&gt;Both methods (workable samples even I think) are posted on this forum and also see the SDK samples.&lt;/P&gt;&lt;P&gt;(Filter By Level, Filter By View)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Michel&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2020 17:40:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9273087#M37376</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2020-01-24T17:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9277315#M37377</link>
      <description>&lt;P&gt;Thanks for your detailed explanation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So which means if I need both then I would have to collect all the elements in view and filter them by level. However I guess this logic won't work if the elements are dependent on View and independent of Level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 16:30:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9277315#M37377</guid>
      <dc:creator>gprofile</dc:creator>
      <dc:date>2020-01-27T16:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9277630#M37378</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually really depends what the purpose is of the addin.&lt;/P&gt;&lt;P&gt;If you want all elements of a specific level, but limited by the element only visible in view then there are a few approaches.&lt;/P&gt;&lt;P&gt;You can use a ElementFilteredCollection By view and limit it by a Level(filter)&lt;/P&gt;&lt;P&gt;use:&amp;nbsp;ElementFilteredCollection.Wherepasses(ElementLevelFilter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Search this for for 'ElementFilter' and 'ElementLevelFilter', I think there will be enough samples (or SDK)&lt;/P&gt;&lt;P&gt;One note though;&amp;nbsp;ElementFilter can be a QuickFilter, but&amp;nbsp;ElementLevelFilter is derived from the slowfilter.&lt;/P&gt;&lt;P&gt;Depending on how many element should be processed, you may limit the&amp;nbsp;ElementFilteredCollection first by a Quickfilter. For example if you only need walls, then filter it first on WallElements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can let me know if you need further help with the approach or code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Michel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 18:50:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9277630#M37378</guid>
      <dc:creator>TripleM-Dev.net</dc:creator>
      <dc:date>2020-01-27T18:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: How FileteredElementCollector of View works?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9284923#M37379</link>
      <description>&lt;P&gt;Thanks for your reply. Its a macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try and see what actually fits in my case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a good day.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 09:43:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-fileteredelementcollector-of-view-works/m-p/9284923#M37379</guid>
      <dc:creator>gprofile</dc:creator>
      <dc:date>2020-01-30T09:43:50Z</dc:date>
    </item>
  </channel>
</rss>

