Skip to content

BoundingBox View Filter

    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 you need to specify a view to be used to get the BoundingBox of the element, is not possible in the current BoundingBoxIntersectsFilter or BoundingBoxIsInsideFilter.

    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.

    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 get_BoundingBox in the specific view.

    Here is a code example with the BoundingBoxViewIntersectsFilter and
    BoundingBoxViewIsInsideFilter implementation and a command example to select Wire elements using the custom filter.