{"id":811,"date":"2023-04-30T14:31:16","date_gmt":"2023-04-30T17:31:16","guid":{"rendered":"https:\/\/ricaun.com\/?p=811"},"modified":"2023-04-30T14:52:43","modified_gmt":"2023-04-30T17:52:43","slug":"boundingbox-view-filter","status":"publish","type":"post","link":"https:\/\/ricaun.com\/br\/boundingbox-view-filter\/","title":{"rendered":"BoundingBox View Filter"},"content":{"rendered":"<p>In the Revit Api the <strong>FilteredElemetCollector <\/strong>class enables search in the document for elements, and filters could be used to select what you need.<\/p>\n\n\n\n<p><strong>BoundingBox <\/strong>filters use the <strong>get_BoundingBox <\/strong>of the element to check if the element is inside or interested with an <strong>Outline <\/strong>that is defined with a min and max <strong>XYZ<\/strong>.<\/p>\n\n\n\n<p>But if you need to specify a view to be used to get the <strong>BoundingBox <\/strong>of the element, is not possible in the current <strong>BoundingBoxIntersectsFilter <\/strong>or <strong>BoundingBoxIsInsideFilter<\/strong>.<\/p>\n\n\n\n<p>If you try to use this filter in a Wire element, for example, the filter always gonna return false because the only way to get the BoundingBox of a Wire that is a 2d element is in the View that the element is own.<\/p>\n\n\n\n<p>One way is to create a filter that queries a View to use in the filter check and could be used to get a proper <strong>get_BoundingBox <\/strong>in the specific view.<\/p>\n\n\n\n<p>Here is a code example with the <strong>BoundingBoxViewIntersectsFilter <\/strong>and<br><strong>BoundingBoxViewIsInsideFilter <\/strong>implementation and a command example to select <strong>Wire <\/strong>elements using the custom filter.<\/p>\n\n\n<p><script src=\"https:\/\/gist.github.com\/ricaun\/14ec0730e7efb3cc737f2134475e2539.js\"><\/script><\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h3 class=\"wp-block-heading\">References<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/forums.autodesk.com\/t5\/revit-api-forum\/electrical-wire-not-found-in-boundingboxisinsidefilter\/td-p\/11926866\" target=\"_blank\" rel=\"noopener\" title=\"\">Forum Revit Api &#8211; Electrical Wire not found in BoundingBoxIsInsideFilter<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.revitapidocs.com\/2023\/1fbe1cff-ed94-4815-564b-05fd9e8f61fe.htm\" target=\"_blank\" rel=\"noopener\" title=\"Revit Api Docs - BoundingBoxIntersectsFilter\">Revit Api Docs &#8211; BoundingBoxIntersectsFilter<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.revitapidocs.com\/2023\/eb8735d7-28fc-379d-9de9-1e02326851f5.htm\" target=\"_blank\" rel=\"noopener\" title=\"\">Revit Api Docs &#8211; BoundingBoxIsInsideFilter<\/a><\/li>\n<\/ul>\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>In the Revit Api the FilteredElemetCollector class enables search in the document for elements, and filters could be used to select what you need. BoundingBox filters use the get_BoundingBox of the element to check if the element is inside or interested with an Outline that is defined with a min and max XYZ. But if&hellip;&nbsp;<a href=\"https:\/\/ricaun.com\/br\/boundingbox-view-filter\/\" class=\"\" rel=\"bookmark\">Continue a ler &raquo;<span class=\"screen-reader-text\">BoundingBox View Filter<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":812,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","_ti_tpc_template_sync":false,"_ti_tpc_template_id":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-811","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-revit-api"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/posts\/811","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/comments?post=811"}],"version-history":[{"count":2,"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/posts\/811\/revisions"}],"predecessor-version":[{"id":815,"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/posts\/811\/revisions\/815"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/media\/812"}],"wp:attachment":[{"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/media?parent=811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/categories?post=811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ricaun.com\/br\/wp-json\/wp\/v2\/tags?post=811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}