API Reference

Detailed and full API reference helps you master Tekla development

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

DrawingObjectSelector Class

The DrawingObjectSelector class is used to select drawing objects in the drawing. The class contains methods for selecting/unselecting single objects or a list of objects. Currently, these selections both select the objects from the database and highlight them visually.
Inheritance Hierarchy

Namespace:  Tekla.Structures.Drawing.UI
Assembly:  Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2020.0.0.0 (2020.0.55582.0)
public sealed class DrawingObjectSelector

The DrawingObjectSelector type exposes the following members.

  Name Description
Public method GetSelected
Gets the selected objects in the drawing.
Public method SelectObject
Selects a single object in the drawing.
Public method SelectObjects
Selects the specified drawing objects in the drawing.
Public method UnselectAllObjects
Unselects all the selected objects.
Public method UnselectObject
Unselects a drawing object.
Public method UnselectObjects
Unselects the specified drawing objects keeping the other objects still selected.
In the following example, the lines in the drawing are selected first. The selection is then extended with circles and finally all the selected objects in the drawing are gotten.
using Tekla.Structures.Drawing;
using System;
using System.Collections;

public class Example
       Drawing MyCurrentDrawing = new GADrawing();
       DrawingHandler drawingHandler = new DrawingHandler();

       ArrayList GetDrawingObjectsByType(Type objectType)
           ArrayList ObjectsToBeSelected = new ArrayList();

           foreach(DrawingObject drawingObject in MyCurrentDrawing.GetSheet().GetAllObjects())
               if(drawingObject.GetType() == objectType)

           return ObjectsToBeSelected;

       public void Example1()
           ArrayList MyLines = GetDrawingObjectsByType(typeof(Line));
           if(MyLines.Count > 0)
               drawingHandler.GetDrawingObjectSelector().SelectObjects(MyLines, false);

       public void Example2()
           ArrayList MyCircles = GetDrawingObjectsByType(typeof(Circle));
           if(MyCircles.Count > 0)
               drawingHandler.GetDrawingObjectSelector().SelectObjects(MyCircles, true);

       public void Example3()
           foreach(DrawingObject drawingObject in drawingHandler.GetDrawingObjectSelector().GetSelected())
               if(drawingObject is Line)
                   Line line = drawingObject as Line;
                   // Do something with the line.
               else if(drawingObject is Circle)
                   // Do something with the circle.
See Also