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: 2024.0.0+a110b435391768740483e3032720a566518c9a63
public sealed class DrawingObjectSelector

The DrawingObjectSelector type exposes the following members.

Public methodGetSelected
Gets the selected objects in the drawing.
Public methodSelectObject
Selects a single object in the drawing.
Public methodSelectObjects
Selects the specified drawing objects in the drawing.
Public methodUnselectAllObjects
Unselects all the selected objects.
Public methodUnselectObject
Unselects a drawing object.
Public methodUnselectObjects
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
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.