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: 2023.0.3
Syntax
The DrawingObjectSelector type exposes the following members.
Methods
Name | Description | |
---|---|---|
GetSelected |
Gets the selected objects in the drawing.
| |
SelectObject |
Selects a single object in the drawing.
| |
SelectObjects |
Selects the specified drawing objects in the drawing.
| |
UnselectAllObjects |
Unselects all the selected objects.
| |
UnselectObject |
Unselects a drawing object.
| |
UnselectObjects |
Unselects the specified drawing objects keeping the other objects still selected.
|
Examples
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) { ObjectsToBeSelected.Add(drawingObject); } } 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