PickObject Method (ObjectType, ISelectionFilter)
Prompts the user to select one object which passes a custom filter.

Namespace: Autodesk.Revit.UI.Selection
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 23.0.0.0 (23.1.0.0)

Syntax

C#
public Reference PickObject(
	ObjectType objectType,
	ISelectionFilter selectionFilter
)
Visual Basic
Public Function PickObject ( _
	objectType As ObjectType, _
	selectionFilter As ISelectionFilter _
) As Reference
Visual C++
public:
Reference^ PickObject(
	ObjectType objectType, 
	ISelectionFilter^ selectionFilter
)

Parameters

objectType
Type: Autodesk.Revit.UI.Selection..::..ObjectType
Specifies the type of object to be selected.
selectionFilter
Type: Autodesk.Revit.UI.Selection..::..ISelectionFilter
The selection filter.

Return Value

A reference object selected by user.

Note: if the user cancels the operation (for example, through ESC), the method will throw an OperationCanceledException instance.

Remarks

Revit users will be permitted to manipulate the Revit view (zooming, panning, and rotating the view), but will not be permitted to click other items in the Revit user interface. Users are not permitted to switch the active view, close the active document or Revit application in the pick session, otherwise an exception will be thrown.

The selection will not be automatically added to the active selection buffer.

Note: this method must not be called during dynamic update, otherwise ForbiddenForDynamicUpdateException will be thrown.

Exceptions

ExceptionCondition
Autodesk.Revit.Exceptions..::..ArgumentOutOfRangeExceptionThrown when the objectType is not a recognized value.
Autodesk.Revit.Exceptions..::..ArgumentNullExceptionThrown when the selectionFilter is nullNothingnullptra null reference (Nothing in Visual Basic).
Autodesk.Revit.Exceptions..::..OperationCanceledExceptionThrown when the Revit user cancelled this operation. Thrown when the Revit user tried to switch the active view, close the active document or Revit application when responding to this mode.
Autodesk.Revit.Exceptions..::..ForbiddenForDynamicUpdateExceptionThrown if this method is called during dynamic update.

See Also