ReferenceIntersector.FindNearest Method

ReferenceIntersectorFindNearest Method

Projects a ray from the origin along the given direction, and returns the nearest reference from intersected elements which match the ReferenceIntersector's criteria.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
public ReferenceWithContext FindNearest(
	XYZ origin,
	XYZ direction
)
Public Function FindNearest ( 
	origin As XYZ,
	direction As XYZ
) As ReferenceWithContext
public:
ReferenceWithContext^ FindNearest(
	XYZ^ origin, 
	XYZ^ direction
)
member FindNearest : 
        origin : XYZ * 
        direction : XYZ -> ReferenceWithContext 

Parameters

origin  XYZ
The origin of the ray.
direction  XYZ
The direction of the ray.

Return Value

ReferenceWithContext
The intersected reference nearest to the ray origin, if none is found
Exceptions
ExceptionCondition
ArgumentNullException A non-optional argument was null
Remarks
Note that FindNearest() is a convenience method, and other references that may be nearly the same distance from the origin can be obtained from Find(XYZ, XYZ).
See Also