BoundingBoxContainsPointFilter Class


A filter used to match elements with a bounding box that contains the given point.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2011

Syntax

C#
public class BoundingBoxContainsPointFilter : ElementQuickFilter
Visual Basic
Public Class BoundingBoxContainsPointFilter _
	Inherits ElementQuickFilter
Visual C++
public ref class BoundingBoxContainsPointFilter : public ElementQuickFilter

Remarks

This filter excludes all objects derived from View and objects derived from ElementType. This filter is a quick filter. Quick filters operate only on the ElementRecord, a low-memory class which has a limited interface to read element properties. Elements which are rejected by a quick filter will not be expanded in memory.

Examples

CopyC#
// Use BoundingBoxContainsPoint filter to find elements with a bounding box that contains the 
// given point in the document.

// Create a BoundingBoxContainsPoint filter for base point of (0, 0, 0)
XYZ basePnt = new XYZ(0, 0, 0);
BoundingBoxContainsPointFilter filter = new BoundingBoxContainsPointFilter(basePnt);

// Apply the filter to the elements in the active document
// This filter will excludes all objects derived from View and objects derived from ElementType
FilteredElementCollector collector = new FilteredElementCollector(document);
IList<Element> elements = collector.WherePasses(filter).ToElements();


// Find walls that do not contain the given point: use an inverted filter to match elements
// Use shortcut command OfClass() to find walls only
BoundingBoxContainsPointFilter notContainFilter =
    new BoundingBoxContainsPointFilter(basePnt, true); // inverted filter
collector = new FilteredElementCollector(document);
IList<Element> notContainFounds =
    collector.OfClass(typeof(Wall)).WherePasses(notContainFilter).ToElements();
CopyVB.NET
' Use BoundingBoxContainsPoint filter to find elements with a bounding box that contains the 
' given point in the document.


' Create a BoundingBoxContainsPoint filter for base point of (0, 0, 0)
Dim basePnt As New XYZ(0, 0, 0)
Dim filter As New BoundingBoxContainsPointFilter(basePnt)

' Apply the filter to the elements in the active document
' This filter will excludes all objects derived from View and objects derived from ElementType
Dim collector As New FilteredElementCollector(document)
Dim elements As IList(Of Element) = collector.WherePasses(filter).ToElements()


' Find walls that do not contain the given point: use an inverted filter to match elements
' Use shortcut command OfClass() to find walls only
Dim notContainFilter As New BoundingBoxContainsPointFilter(basePnt, True)
' inverted filter
collector = New FilteredElementCollector(document)
Dim notContainFounds As IList(Of Element) = collector.OfClass(GetType(Wall)).WherePasses(notContainFilter).ToElements()

Inheritance Hierarchy

SystemObject
  Autodesk.Revit.DBElementFilter
    Autodesk.Revit.DBElementQuickFilter
      Autodesk.Revit.DBBoundingBoxContainsPointFilter

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →