{"id":2781,"date":"2024-11-27T09:43:59","date_gmt":"2024-11-27T09:43:59","guid":{"rendered":"https:\/\/infralligence.com\/?p=2781"},"modified":"2024-12-31T09:28:10","modified_gmt":"2024-12-31T09:28:10","slug":"filteredelementscollector-getting-elements-with-revit-api","status":"publish","type":"post","link":"https:\/\/infralligence.com\/pl\/resources\/filteredelementscollector-getting-elements-with-revit-api\/","title":{"rendered":"FilteredElementsCollector: Getting elements with Revit API"},"content":{"rendered":"<div data-elementor-type=\"wp-post\" data-elementor-id=\"2781\" class=\"elementor elementor-2781\">\n\t\t\t\t<div class=\"elementor-element elementor-element-a636728 e-con-full kk-blog-post e-flex rael-particle-no e-con e-parent\" data-id=\"a636728\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-978bece elementor-widget elementor-widget-text-editor\" data-id=\"978bece\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>FilteredElementCollector allows you to access all kinds of Elements in Revit projects \u2013 model elements, families, geometries, views \u2013 based on specific criteria.<\/p><p>Long chains of FilteredElementCollector methods can be daunting. But don\u2019t worry \u2013 breaking them down clarifies a lot. Actually, most cases can be resolved with the image below.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-98d5948 elementor-widget elementor-widget-text-editor\" data-id=\"98d5948\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h5>\ud83d\udccc TLDR \u2013 Summary Upfront:<\/h5>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-acc30ef elementor-widget elementor-widget-image\" data-id=\"acc30ef\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"2653\" height=\"1493\" src=\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png\" class=\"attachment-full size-full wp-image-2784\" alt=\"\" srcset=\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png 2653w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-300x169.png 300w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1024x576.png 1024w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-768x432.png 768w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1536x864.png 1536w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-2048x1153.png 2048w\" sizes=\"(max-width: 2653px) 100vw, 2653px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ecaaabc elementor-widget elementor-widget-rael-table-of-contents\" data-id=\"ecaaabc\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;rael_headings_by_tags&quot;:[&quot;h3&quot;,&quot;h4&quot;],&quot;rael_exclude_headings_by_selector&quot;:[],&quot;rael_min_height&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:0,&quot;sizes&quot;:[]},&quot;rael_marker_view&quot;:&quot;numbers&quot;,&quot;rael_hierarchical_view&quot;:&quot;yes&quot;,&quot;rael_min_height_tablet&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]},&quot;rael_min_height_mobile&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"rael-table-of-contents.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"rael-toc__header\">\n\t\t\t\t<h5 class=\"rael-toc__header-title\">\ud83d\udd0dContent: <\/h5>\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"rael-toc__body\">\n\t\t\t<div class=\"rael-toc__spinner-container\">\n\t\t\t\t<i class=\"rael-toc__spinner eicon-loading eicon-animation-spin\" aria-hidden=\"true\"><\/i>\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1b80a3c elementor-widget elementor-widget-text-editor\" data-id=\"1b80a3c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>Typical FilteredElementCollector<\/h3>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-85e3718 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"85e3718\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>var elements = new FilteredElementCollector(doc)\n.OfCategory(BuiltInCategory.OST_Walls) \/\/ or OfClass(typeof(Wall))\n.WhereElementIsNotElementType() \/\/ or WhereElementIsElementType()\n.ToElements()\n.Cast&lt;Wall&gt;() \/\/optional\n.Where(wall =&gt; wall.Width &gt; 1); \/\/optional<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9bd40e2 elementor-widget elementor-widget-text-editor\" data-id=\"9bd40e2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Let\u2019s break it down.<\/p><h3>Constructor<\/h3><p>Initialize the collector for a document.<\/p><p>You can also limit the collector to elements visible in a specific view.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2a89e67 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"2a89e67\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>var collector = new FilteredElementCollector(doc);\nvar collectorForView = new FilteredElementCollector(doc, viewId);<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9f61207 elementor-widget elementor-widget-text-editor\" data-id=\"9f61207\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>OfCategory or OfClass<\/h3><ul><li><strong>OfCategory<\/strong>: Filters elements by a specific category (BuiltInCategory members).<\/li><li><strong>OfClass<\/strong>: Filters elements by their API class.<\/li><\/ul><p>These methods are often interchangeable. For example, Wall has both category and specific class.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-58affd3 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"58affd3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>.OfCategory(BuiltInCategory.OST_Walls)\n.OfClass(typeof(Wall))<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d85fee2 elementor-widget elementor-widget-text-editor\" data-id=\"d85fee2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tBut some model elements have no specific classes. For example, instances of Columns and Beams share the same class: FamilyInstance. To distinguish between them, use the OfCategory method.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4b8c677 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"4b8c677\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>.OfClass(typeof(FamilyInstance) \/\/gets all FamilyInstances, including Columns and Beams\n.OfCategory(BuiltInCategory.OST_StructuralColumns) \/\/gets only Columns\n.OfCategory(BuiltInCategory.OST_StructuralFraming) \/\/gets only Beams<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ce4ed8e elementor-widget elementor-widget-text-editor\" data-id=\"ce4ed8e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>Element Types vs Instances<\/h3><p>Understanding the difference between Element Types and Element Instances is crucial.<\/p><ul><li><strong>Element Types<\/strong>: Definitions or templates of elements (e.g., a family type)<\/li><li><strong>Element Instances<\/strong>: Actual elements placed in the project (e.g., several columns inserted into the model).<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0909d65 elementor-widget elementor-widget-image\" data-id=\"0909d65\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"2325\" height=\"1357\" src=\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1.png\" class=\"attachment-full size-full wp-image-2783\" alt=\"\" srcset=\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1.png 2325w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1-300x175.png 300w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1-1024x598.png 1024w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1-768x448.png 768w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1-1536x896.png 1536w, https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503-1-2048x1195.png 2048w\" sizes=\"(max-width: 2325px) 100vw, 2325px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-218011b elementor-widget elementor-widget-text-editor\" data-id=\"218011b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Use:<\/p><ul><li><strong>WhereElementIsElementType<\/strong> to get <strong>types<\/strong><\/li><li><strong>WhereElementIs<span style=\"text-decoration: underline;\">Not<\/span>ElementType<\/strong> to get <strong>instances<\/strong><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c6c44e1 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"c6c44e1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>var columnTypes = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsElementType().ToElements(); \/\/gets 10 Column Family Types (e.g., M_Concrete_Rectangular-Column 300 x 450 mm, UC-Universal Column-Column 203x203x46UC)\n\nvar columnInstances = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsNotElementType().ToElements(); \/\/gets 3 instances of M_Concrete_Rectangular-Column 300 x 450 mm columns inserted into the model<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c9ff85b elementor-widget elementor-widget-text-editor\" data-id=\"c9ff85b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"kk-infobox-info\">\u2139\ufe0f When classes are specific for types (e.g., WallType), using WhereElementIsElementType() isn\u2019t required. However, including it makes your code clearer and more robust.<\/span>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-30a3ae5 elementor-widget elementor-widget-text-editor\" data-id=\"30a3ae5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>Retrieving Elements<\/h3><p>Convert the collector to a list of Elements using <b>ToElements()<\/b> or ElementIds using <b>ToElementIds()<\/b>.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-eb3abe3 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"eb3abe3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>var collector = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).WhereElementIsNotElementType(); \/\/ a collector\n\nvar familyInstances = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).WhereElementIsNotElementType().ToElements(); \/\/ a list of Elements.<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-383696b elementor-widget elementor-widget-text-editor\" data-id=\"383696b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>Casting to a specific class<\/h3><p>To have a list of specific elements (e.g., Walls) \u2013 instead of generic Elements returned by ToElements() \u2013 you need to cast them.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4ba28c7 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"4ba28c7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>var walls = new FilteredElementCollector(doc)\n    .OfClass(typeof(Wall))\n    .WhereElementIsNotElementType()\n    .ToElements()\n    .Cast&lt;Wall&gt;();<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3c2f7eb elementor-widget elementor-widget-text-editor\" data-id=\"3c2f7eb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Now, you can access properties and methods specific to the class. Which is helpful for\u2026<\/p><h3>Further filtering with Where()<\/h3><p>To further filter elements based on their properties, you can use LINQ\u2019s Where() method.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6fc7441 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"6fc7441\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>\/\/ collecting walls wider than 1 feet\nvar wideWalls = new FilteredElementCollector(doc)\n    .OfCategory(BuiltInCategory.OST_Walls)\n    .WhereElementIsNotElementType()\n    .ToElements()\n    .Cast&lt;Wall&gt;()\n    .Where(wall =&gt; wall.Width &gt; 1);\n\n\n\/\/ getting a specific family type\nvar familySymbols = new FilteredElementCollector(doc)\n    .OfClass(typeof(FamilySymbol))\n    .WhereElementIsElementType()\n    .Cast&lt;FamilySymbol&gt;();\n\nstring familyName = &quot;Test Family&quot;;\nstring familyTypeName = &quot;Test Family Type&quot;;\n\nvar specificFamilySymbol = familySymbols\n    .FirstOrDefault(symbol =&gt; symbol.FamilyName == familyName &amp;&amp; symbol.Name == familyTypeName);<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-57a52ae elementor-widget elementor-widget-text-editor\" data-id=\"57a52ae\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>Examples<\/h3>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a304f26 elementor-widget elementor-widget-text-editor\" data-id=\"a304f26\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"kk-infobox-info\"><p>\u2139\ufe0f Some crucial model elements, like Columns or Beams (Structural Framings), have no specific classes. Their types are FamilySymbols and their instances are FamilyInstances.<\/p><\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-eee4002 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"eee4002\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre class='line-numbers theme-default' data-show-toolbar='no'><code class='language-csharp'>var columnTypes  = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsElementType().ToElements().Cast&lt;FamilySymbol&gt;();\nvar columnInstances = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsNotElementType().ToElements().Cast&lt;FamilyInstance&gt;();\nvar columnFamilyType = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).ToElements().Cast&lt;FamilySymbol&gt;().Where(symbol =&gt; symbol.FamilyName == &bdquo;Square Column&rdquo; &amp;&amp; symbol.Name == &bdquo;40 x 40&rdquo;);\n\nvar wallTypes = new FilteredElementCollector(doc).OfClass(typeof(WallType)).ToElements().Cast&lt;WallType&gt;();\nvar wideWallInstances = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElmentType().ToElements().Cast&lt;Wall&gt;().Where(wall =&gt; wall.Width &gt; 1);<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>FilteredElementCollector allows you to access all kinds of Elements in Revit projects \u2013 model elements, families, geometries, views \u2013 based on specific criteria. Long chains of FilteredElementCollector methods can be daunting. But don\u2019t worry \u2013 breaking them down clarifies a lot. Actually, most cases can be resolved with the image below. \ud83d\udccc TLDR \u2013 Summary [&hellip;]<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[6],"tags":[],"post_folder":[],"class_list":["post-2781","post","type-post","status-publish","format-standard","hentry","category-revit-api-basics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FilteredElementsCollector: Getting elements with Revit API - Infralligence<\/title>\n<meta name=\"description\" content=\"FilteredElementCollector allows you to access all kinds of Elements in Revit projects based on specific criteria.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/infralligence.com\/pl\/resources\/filteredelementscollector-getting-elements-with-revit-api\/\" \/>\n<meta property=\"og:locale\" content=\"pl_PL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FilteredElementsCollector: Getting elements with Revit API - Infralligence\" \/>\n<meta property=\"og:description\" content=\"FilteredElementCollector allows you to access all kinds of Elements in Revit projects based on specific criteria.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/infralligence.com\/pl\/resources\/filteredelementscollector-getting-elements-with-revit-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Infralligence\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-27T09:43:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-31T09:28:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2653\" \/>\n\t<meta property=\"og:image:height\" content=\"1493\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kamil Korus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Napisane przez\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kamil Korus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Szacowany czas czytania\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minuty\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/\"},\"author\":{\"name\":\"Kamil Korus\",\"@id\":\"https:\/\/infralligence.com\/#\/schema\/person\/838177275b7d3b8b217b13180a74aeda\"},\"headline\":\"FilteredElementsCollector: Getting elements with Revit API\",\"datePublished\":\"2024-11-27T09:43:59+00:00\",\"dateModified\":\"2024-12-31T09:28:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/\"},\"wordCount\":324,\"publisher\":{\"@id\":\"https:\/\/infralligence.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png\",\"articleSection\":[\"Revit API Basics\"],\"inLanguage\":\"pl-PL\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/\",\"url\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/\",\"name\":\"FilteredElementsCollector: Getting elements with Revit API - Infralligence\",\"isPartOf\":{\"@id\":\"https:\/\/infralligence.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png\",\"datePublished\":\"2024-11-27T09:43:59+00:00\",\"dateModified\":\"2024-12-31T09:28:10+00:00\",\"description\":\"FilteredElementCollector allows you to access all kinds of Elements in Revit projects based on specific criteria.\",\"breadcrumb\":{\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#breadcrumb\"},\"inLanguage\":\"pl-PL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#primaryimage\",\"url\":\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png\",\"contentUrl\":\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/infralligence.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FilteredElementsCollector: Getting elements with Revit API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/infralligence.com\/#website\",\"url\":\"https:\/\/infralligence.com\/\",\"name\":\"Infralligence\",\"description\":\"Digital Automation and AI for civil engineering\",\"publisher\":{\"@id\":\"https:\/\/infralligence.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/infralligence.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pl-PL\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/infralligence.com\/#organization\",\"name\":\"Infralligence\",\"url\":\"https:\/\/infralligence.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@id\":\"https:\/\/infralligence.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/11\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/11\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"Infralligence\"},\"image\":{\"@id\":\"https:\/\/infralligence.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/infralligence.com\/#\/schema\/person\/838177275b7d3b8b217b13180a74aeda\",\"name\":\"Kamil Korus\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@id\":\"https:\/\/infralligence.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/95bd7da2ac29ff34a2ab9bf4ea30273b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/95bd7da2ac29ff34a2ab9bf4ea30273b?s=96&d=mm&r=g\",\"caption\":\"Kamil Korus\"},\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/kamil-korus\/\"],\"url\":\"https:\/\/infralligence.com\/pl\/resources\/author\/kamil-korus\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FilteredElementsCollector: Getting elements with Revit API - Infralligence","description":"FilteredElementCollector allows you to access all kinds of Elements in Revit projects based on specific criteria.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/infralligence.com\/pl\/resources\/filteredelementscollector-getting-elements-with-revit-api\/","og_locale":"pl_PL","og_type":"article","og_title":"FilteredElementsCollector: Getting elements with Revit API - Infralligence","og_description":"FilteredElementCollector allows you to access all kinds of Elements in Revit projects based on specific criteria.","og_url":"https:\/\/infralligence.com\/pl\/resources\/filteredelementscollector-getting-elements-with-revit-api\/","og_site_name":"Infralligence","article_published_time":"2024-11-27T09:43:59+00:00","article_modified_time":"2024-12-31T09:28:10+00:00","og_image":[{"width":2653,"height":1493,"url":"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png","type":"image\/png"}],"author":"Kamil Korus","twitter_card":"summary_large_image","twitter_misc":{"Napisane przez":"Kamil Korus","Szacowany czas czytania":"2 minuty"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#article","isPartOf":{"@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/"},"author":{"name":"Kamil Korus","@id":"https:\/\/infralligence.com\/#\/schema\/person\/838177275b7d3b8b217b13180a74aeda"},"headline":"FilteredElementsCollector: Getting elements with Revit API","datePublished":"2024-11-27T09:43:59+00:00","dateModified":"2024-12-31T09:28:10+00:00","mainEntityOfPage":{"@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/"},"wordCount":324,"publisher":{"@id":"https:\/\/infralligence.com\/#organization"},"image":{"@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#primaryimage"},"thumbnailUrl":"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png","articleSection":["Revit API Basics"],"inLanguage":"pl-PL"},{"@type":"WebPage","@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/","url":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/","name":"FilteredElementsCollector: Getting elements with Revit API - Infralligence","isPartOf":{"@id":"https:\/\/infralligence.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#primaryimage"},"image":{"@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#primaryimage"},"thumbnailUrl":"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png","datePublished":"2024-11-27T09:43:59+00:00","dateModified":"2024-12-31T09:28:10+00:00","description":"FilteredElementCollector allows you to access all kinds of Elements in Revit projects based on specific criteria.","breadcrumb":{"@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#breadcrumb"},"inLanguage":"pl-PL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/"]}]},{"@type":"ImageObject","inLanguage":"pl-PL","@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#primaryimage","url":"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png","contentUrl":"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/12\/c892ed13-1f6b-43c4-9e96-3a539526e503.png"},{"@type":"BreadcrumbList","@id":"https:\/\/infralligence.com\/resources\/filteredelementscollector-getting-elements-with-revit-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/infralligence.com\/"},{"@type":"ListItem","position":2,"name":"FilteredElementsCollector: Getting elements with Revit API"}]},{"@type":"WebSite","@id":"https:\/\/infralligence.com\/#website","url":"https:\/\/infralligence.com\/","name":"Infralligence","description":"Digital Automation and AI for civil engineering","publisher":{"@id":"https:\/\/infralligence.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/infralligence.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pl-PL"},{"@type":"Organization","@id":"https:\/\/infralligence.com\/#organization","name":"Infralligence","url":"https:\/\/infralligence.com\/","logo":{"@type":"ImageObject","inLanguage":"pl-PL","@id":"https:\/\/infralligence.com\/#\/schema\/logo\/image\/","url":"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/11\/android-chrome-192x192-1.png","contentUrl":"https:\/\/infralligence.com\/wp-content\/uploads\/2024\/11\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"Infralligence"},"image":{"@id":"https:\/\/infralligence.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/infralligence.com\/#\/schema\/person\/838177275b7d3b8b217b13180a74aeda","name":"Kamil Korus","image":{"@type":"ImageObject","inLanguage":"pl-PL","@id":"https:\/\/infralligence.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/95bd7da2ac29ff34a2ab9bf4ea30273b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/95bd7da2ac29ff34a2ab9bf4ea30273b?s=96&d=mm&r=g","caption":"Kamil Korus"},"sameAs":["https:\/\/www.linkedin.com\/in\/kamil-korus\/"],"url":"https:\/\/infralligence.com\/pl\/resources\/author\/kamil-korus\/"}]}},"_links":{"self":[{"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/posts\/2781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/comments?post=2781"}],"version-history":[{"count":10,"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/posts\/2781\/revisions"}],"predecessor-version":[{"id":2794,"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/posts\/2781\/revisions\/2794"}],"wp:attachment":[{"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/media?parent=2781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/categories?post=2781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/tags?post=2781"},{"taxonomy":"post_folder","embeddable":true,"href":"https:\/\/infralligence.com\/pl\/wp-json\/wp\/v2\/post_folder?post=2781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}