Pick Point Methods

The PickPoint and PickPoints methods allow users to interactively select points in the Revit model space. These methods are part of the Launchpad UI class and provide a simple way to get coordinates.

PickPoint Method

Description

Prompts the user to pick a single point in the model space.

Syntax

csharppublic XYZ PickPoint(string promptMessage = "Pick a point:", bool showTaskDialog = true)

Parameters

  • promptMessage (string, optional): The message displayed to guide the user. Default: "Pick a point:"

  • showTaskDialog (bool, optional): Whether to show a confirmation dialog before picking. Default: true

Returns

  • XYZ: The selected point coordinates

  • null: If the user cancels the operation

Example Usage

// Basic usage - pick a single point with default prompt
XYZ point = UI.PickPoint();
if (point != null)
{    
    Console.WriteLine($"Selected point: X={point.X:F2}, Y={point.Y:F2}, Z={point.Z:F2}");
}
    
// Custom prompt message
XYZ insertionPoint = UI.PickPoint("Select insertion point for family:");
if (insertionPoint != null)
{
    // Place family at selected point    
    doc.Create.NewFamilyInstance(insertionPoint, familySymbol, StructuralType.NonStructural);
}
        
// Skip confirmation dialog for faster workflow
XYZ quickPoint = UI.PickPoint("Click to place marker:", false);
        
// Calculate distance between two points
XYZ startPoint = UI.PickPoint("Pick start point:");
XYZ endPoint = UI.PickPoint("Pick end point:");
        
if (startPoint != null && endPoint != null)
{    
    double distance = startPoint.DistanceTo(endPoint);    
    Console.WriteLine($"Distance: {distance:F2} feet");
}

PickPoints Method

Description

Prompts the user to pick multiple points in the model space. The user continues picking points until pressing ESC to finish.

Syntax

Parameters

  • promptMessage (string, optional): The message displayed to guide the user. Default: "Pick points (ESC when done):"

  • showTaskDialog (bool, optional): Whether to show a confirmation dialog before picking. Default: true

  • showCount (bool, optional): Whether to display the point count during selection and show a summary. Default: true

Returns

  • List<XYZ>: A list of selected points (empty list if cancelled immediately)

Example Usage

Last updated