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.

PreferredPlacingTypeBase Class

The PreferredPlacingTypeBase class is the base class for the preferred placing type. You can set the PreferredPlacingType in the object's attributes to specify how your object should be placed in the drawing. Please note that not all objects accept all types. If you try to use the wrong type it will not be accepted (Insert, Modify will fail). To use valid types you should use the named defaults (PreferredTextPlacingTypes for Text, PreferredMarkPlacingTypes for Mark, PreferredSymbolPlacingTypes for Symbol).
Inheritance Hierarchy

Namespace:  Tekla.Structures.Drawing
Assembly:  Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2023.0.1
public abstract class PreferredPlacingTypeBase
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();
            View CurrentView = (View)AllViews.Current;

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

            // Here we create one Text with a preferred placing type indicating we want the text to have a LeaderLine.
            // Please note that should the object be arranged (using the command Arrange Drawing Objects (Freeplace)),
            // then it will still find a place along a leader line.
            MyTextAttributes.PreferredPlacing = PreferredTextPlacingTypes.LeaderLinePlacingType();
            Text MyText = new Text(CurrentView, MyInsertionPoint, "Text with a LeaderLine.", MyTextAttributes);

            // Here we create a text that is placed along a line with an arrow indicating the starting point of the line.
            MyTextAttributes.ArrowHead.Head = ArrowheadTypes.FilledArrow;
            MyTextAttributes.PreferredPlacing = PreferredTextPlacingTypes.BaseLineWithArrowAtStartPointPlacingType();
            MyText = new Text(CurrentView, MyInsertionPoint, "Text placed along a line with an arrow at the start point.", MyTextAttributes);

            // Let's try something different, going through all the marks in the drawing assigning PreferredPlacingTypes to all of them.
            DrawingObjectEnumerator AllObjectsInView = CurrentView.GetAllObjects();
                if(AllObjectsInView.Current is MarkBase)
                    MarkBase CurrentMark = (MarkBase)AllObjectsInView.Current;

                    // Next the default preferred placing type is set to be AlongLineOrWithLeaderLinePlacingType.
                    // This means that the mark will first try to place itself along the parent object, however if there is not enough room,
                    // it will place itself along a leader line instead.
                    CurrentMark.Attributes.PreferredPlacing = PreferredMarkPlacingTypes.AlongLineOrWithLeaderLinePlacingType();
See Also
Inheritance Hierarchy