Guides and Articles

Use this documentation when building your Tekla Structures apps

Ask user to pick model and drawing objects

Updated: 1 Nov 2017

Use the Picker class to prompt the user to select model or drawing objects and points in Tekla Structures. The methods throw an exception if the user interrupts the pick command.

Picker class for model objects

The following code shows how to prompt the user to pick model objects.

//Create a new instance from the picker class
Picker Picker = new Picker();
Point p = null;
try
{
    // Create the point from user input
    p = Picker.PickPoint();
}
catch (Exception e)
{
    // User cancels selection (interrupt) 
}

Picker class for drawing objects

The following code shows how to prompt the user to pick drawing objects.

//Create a new instance from the DrawingHandler class
DrawingHandler drawingHandler = new DrawingHandler();

//Create a new instance from the picker class
Picker picker = drawingHandler.GetPicker();
Point point = null; 
ViewBase view = null; 
 
try 
{
    // Create the point from user input
    picker.PickPoint("Pick_point", out point, out view); 
} 
catch (PickerInterruptedException) 
{ 
    // User cancels selection (interrupt) 
}