ReferenceIntersector Class

ReferenceIntersector Class

A class used to find and return elements that intersect a ray created from an origin point and direction.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBReferenceIntersector

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
public class ReferenceIntersector : IDisposable
Public Class ReferenceIntersector
	Implements IDisposable
public ref class ReferenceIntersector : IDisposable
type ReferenceIntersector = 
    class
        interface IDisposable
    end

The ReferenceIntersector type exposes the following members.

Constructors
 NameDescription
Public methodReferenceIntersector(View3D) Constructs a ReferenceIntersector which is set to return intersections from all elements and representing all reference target types.
Public methodReferenceIntersector(ElementFilter, FindReferenceTarget, View3D) Constructs a ReferenceIntersector which is set to return intersections from any element which passes an input filter.
Public methodReferenceIntersector(ElementId, FindReferenceTarget, View3D) Constructs a ReferenceIntersector which is set to return intersections from a single target element only.
Public methodReferenceIntersector(ICollectionElementId, FindReferenceTarget, View3D)Initializes a new instance of the ReferenceIntersector class
Top
Properties
 NameDescription
Public propertyFindReferencesInRevitLinks Determines if references inside Revit Links should be found.
Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public propertyTargetType The type of reference to find.
Public propertyViewId The id of the 3D view used for evaluation.
Top
Methods
 NameDescription
Public methodDisposeReleases all resources used by the ReferenceIntersector
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodFind Projects a ray from the origin along the given direction, and returns all references from intersected elements which match the ReferenceIntersector's criteria.
Public methodFindNearest Projects a ray from the origin along the given direction, and returns the nearest reference from intersected elements which match the ReferenceIntersector's criteria.
Public methodGetFilter Gets the ElementFilter used in intersection testing.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTargetElementIds Gets the set of ElementIds to test from in intersection testing.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodSetFilter Sets the ElementFilter used in intersection testing.
Public methodSetTargetElementIds 
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Remarks

An instance of this class can be constructed to return any 3D geometric element that intersects the ray created by the origin and direction, or to return a subset of elements based on filtering and flags. The caller can opt to filter the results using an ElementFilter, or by applying a specific list of acceptable elements. The caller can also specify the type of object to be returned, which might be whole elements, geometry objects, or a combination. In all cases the caller is required to supply a 3D view for evaluation; the view and visibility settings on the input view will determine if a particular element is returned (for example, hidden elements will never be returned by this tool, nor will elements whose geometry is outside the section box of the view).

The class is configured so that a single instance can be constructed and used for multiple evaluations of different rays. The results of the evaluation are not preserved between invocations on the same ReferenceIntersector.

The class also offers an option to return element results encountered in Revit Links. When the FindReferencesInRevitLinks flag is set, the results may include elements in the host document and in any RevitLinkInstance encountered, depending on the other flags set. See the remarks for FindReferencesInRevitLinks for details on how the flags affect the results obtained from links.

See Also