PickPoint Method (ObjectSnapTypes, String)


Prompts the user to pick a point on the active work plane using specified snap settings while showing a custom status prompt string.

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

Syntax

C#
public XYZ PickPoint(
	ObjectSnapTypes snapSettings,
	string statusPrompt
)
Visual Basic
Public Function PickPoint ( _
	snapSettings As ObjectSnapTypes, _
	statusPrompt As String _
) As XYZ
Visual C++
public:
XYZ^ PickPoint(
	ObjectSnapTypes snapSettings, 
	String^ statusPrompt
)

Parameters

snapSettings
Type: Autodesk.Revit.UI.SelectionObjectSnapTypes
Specifies the object snap types for this pick. Multiple object snap types can be combined with "|"
statusPrompt
Type: SystemString
Specifies the message shown on the status bar.

Return Value

The point picked 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.

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

Examples

CopyC#
public void PickPoint(UIDocument uidoc)
{
    ObjectSnapTypes snapTypes = ObjectSnapTypes.Endpoints | ObjectSnapTypes.Intersections;
    XYZ point = uidoc.Selection.PickPoint(snapTypes, "Select an end point or intersection");

    string strCoords = "Selected point is " + point.ToString();

    TaskDialog.Show("Revit", strCoords);
}
CopyVB.NET
Public Sub PickPoint(uidoc As UIDocument)
    Dim snapTypes As ObjectSnapTypes = ObjectSnapTypes.Endpoints Or ObjectSnapTypes.Intersections
    Dim point As XYZ = uidoc.Selection.PickPoint(snapTypes, "Select an end point or intersection")

    Dim strCoords As String = "Selected point is " & point.ToString()

    TaskDialog.Show("Revit", strCoords)
End Sub

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentNullExceptionThrown when the argument statusPrompt is a null reference (Nothing in Visual Basic).
Autodesk.Revit.ExceptionsInvalidOperationExceptionThrown when no work plane set in current view.
Autodesk.Revit.ExceptionsOperationCanceledExceptionThrown 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.ExceptionsForbiddenForDynamicUpdateExceptionThrown if this method is called during dynamic update.

See Also