Tekla Open API

Detailed and full API reference helps you master Tekla Open API

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

LeaderLine Class

The LeaderLine class defines a leader line attached to a parent object, for example a Text or a Mark. The LeaderLine can be modified to add/remove elbow points or to change where it is pointing.
Inheritance Hierarchy

Namespace:  Tekla.Structures.Drawing
Assembly:  Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2018.1.0.0 (2018.1.0.0)
Syntax
[SerializableAttribute]
public sealed class LeaderLine : DrawingObject

The LeaderLine type exposes the following members.

Properties
  Name Description
Public property Attributes
Gets or sets the attributes of the current object. Only attributes of the same type as the object are allowed.
(Inherited from DrawingObject.)
Public property ElbowPoints
The leader line's elbow points (middle points).
Public property EndPoint
The end point of the leader line (set by the parent object).
Public property LeaderLineType
Gets the type of the leader line. For a list of the available leader line types see LeaderLineLeaderLineTypes.
Public property QueryReturnValue
Status information about the latest database operation (select, insert, modify, delete).
(Inherited from DatabaseObject.)
Public property StartPoint
The starting point of the leader line.
Top
Methods
  Name Description
Public method Delete
A leader line cannot be deleted.
(Overrides DatabaseObjectDelete.)
Public method GetDoubleUserProperties(DictionaryString, Double)
Retrieves all double user properties for the object with the given list of names.
(Inherited from DatabaseObject.)
Public method GetDoubleUserProperties(ListString, DictionaryString, Double)
Retrieves all double user properties for the object with the given list of names.
(Inherited from DatabaseObject.)
Public method GetDrawing
Gets the drawing where the drawing object is.
(Inherited from DrawingObject.)
Public method GetIntegerUserProperties(DictionaryString, Int32)
Retrieves all integer user properties for the object with the given list of names.
(Inherited from DatabaseObject.)
Public method GetIntegerUserProperties(ListString, DictionaryString, Int32)
Retrieves all integer user properties for the object with the given list of names.
(Inherited from DatabaseObject.)
Public method GetRelatedObjects
Gets the related objects of the current object.
(Inherited from DrawingObject.)
Public method GetRelatedObjects(Type)
Gets the related objects of the current object that are of certain types.
(Inherited from DrawingObject.)
Public method GetStringUserProperties(DictionaryString, String)
Retrieves all string user properties for the object with the given list of names.
(Inherited from DatabaseObject.)
Public method GetStringUserProperties(ListString, DictionaryString, String)
Retrieves all string user properties for the object with the given list of names.
(Inherited from DatabaseObject.)
Public method GetUserProperty(String, Double)
Gets a double property from the drawing object. The object has to be in a drawing before the method can be used.
(Inherited from DatabaseObject.)
Public method GetUserProperty(String, Int32)
Gets an integer property from the drawing object. The object has to be in a drawing before the method can be used.
(Inherited from DatabaseObject.)
Public method GetUserProperty(String, String)
Gets a string property from the drawing object. The object has to be in a drawing before the method can be used.
(Inherited from DatabaseObject.)
Public method GetView
Gets the view where the drawing object is.
(Inherited from DrawingObject.)
Public method Insert
A leader line cannot be inserted.
(Overrides DatabaseObjectInsert.)
Public method IsEqual
Compares the current object with an object of the same type.
(Overrides DrawingObjectIsEqual(Object).)
Public method IsSameDatabaseObject
Returns true if the current object and the given object are referencing the same database object.
(Inherited from DatabaseObject.)
Public method Modify
Modifies the leader line in the current drawing database.
(Overrides DatabaseObjectModify.)
Public method Select
Selects the leader line from the current drawing database.
(Overrides DatabaseObjectSelect.)
Public method SetUserProperty(String, Double)
Sets a double property for the drawing object. The object has to be in a drawing before the method can be used.
(Inherited from DatabaseObject.)
Public method SetUserProperty(String, Int32)
Sets an integer property for the drawing object. The object has to be in a drawing before the method can be used.
(Inherited from DatabaseObject.)
Public method SetUserProperty(String, String)
Sets a string property for the drawing object. The object has to be in a drawing before the method can be used.
(Inherited from DatabaseObject.)
Public method ToString
Changes the string presentation of the drawing object.
(Inherited from DrawingObject.)
Top
Examples
using Tekla.Structures.Drawing;
using Point = Tekla.Structures.Geometry3d.Point;

public class Example
{
    public void Example1()
    {
        DrawingHandler DrawHandler = new DrawingHandler();
        Drawing CurrentDrawing = DrawHandler.GetActiveDrawing();
        ContainerView Sheet = CurrentDrawing.GetSheet();
        DrawingObjectEnumerator AllViews = Sheet.GetViews();
        while(AllViews.MoveNext())
        {
            if(AllViews.Current is View)
            {
                View CurrentView = (View)AllViews.Current;

                Point MyInsertionPoint = new Point(200, 600);
                Text.TextAttributes MyTextAttributes = new Text.TextAttributes();

                // Here we create one Text with a LeaderLine attached to it.
                MyTextAttributes.PreferredPlacing = PreferredTextPlacingTypes.LeaderLinePlacingType();
                Text MyText = new Text(CurrentView, MyInsertionPoint, "Text with a LeaderLine.",
                                       new LeaderLinePlacing(new Point(10, 10)), MyTextAttributes);
                MyText.Insert();

                // Next we enumerate through all its children, which in this case is the LeaderLine.
                DrawingObjectEnumerator TextChildren = MyText.GetObjects();
                while(TextChildren.MoveNext())
                {
                    if(TextChildren.Current is LeaderLine)
                    {
                        // We then modify the LeaderLine to contain some elbow points of our choosing.
                        LeaderLine CurrentLeaderLine = (LeaderLine)TextChildren.Current;
                        CurrentLeaderLine.ElbowPoints.Add(new Point(50, 250));
                        CurrentLeaderLine.ElbowPoints.Add(new Point(150, 250));
                        CurrentLeaderLine.Modify();
                        CurrentLeaderLine.Delete();
                    }
                }
            }
            else
            {
                AllViews = ((ContainerView)AllViews.Current).GetViews();
            }
        }
    }
}
See Also