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
SystemObject
  Tekla.Structures.DrawingPreferredPlacingTypeBase
    More...

Namespace:  Tekla.Structures.Drawing
Assembly:  Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2024.0.0+a110b435391768740483e3032720a566518c9a63
Syntax
[SerializableAttribute]
public abstract class PreferredPlacingTypeBase
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();
        if(AllViews.MoveNext())
        {
            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);
            MyText.Insert();

            // 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);
            MyText.Insert();

            // Let's try something different, going through all the marks in the drawing assigning PreferredPlacingTypes to all of them.
            DrawingObjectEnumerator AllObjectsInView = CurrentView.GetAllObjects();
            while(AllObjectsInView.MoveNext())
            {
                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();
                    CurrentMark.Modify();
                }
            }
        }
    }
}
See Also
Inheritance Hierarchy
SystemObject
  Tekla.Structures.DrawingPreferredPlacingTypeBase
    Tekla.Structures.DrawingAlongLineOrWithLeaderLineAndParentObjectAlongPartPlacingType
    Tekla.Structures.DrawingAlongLineOrWithLeaderLinePlacingType
    Tekla.Structures.DrawingAlongLinePlacingType
    Tekla.Structures.DrawingAlongPartCenteredPlacingType
    Tekla.Structures.DrawingBaseLinePlacingType
    Tekla.Structures.DrawingBaseLineWithArrowAtEndPointPlacingType
    Tekla.Structures.DrawingBaseLineWithArrowAtStartPointPlacingType
    Tekla.Structures.DrawingInsidePartAlongPartOrWithLeaderLinePlacingType
    Tekla.Structures.DrawingInsidePartAlongPartPlacingType
    Tekla.Structures.DrawingInsidePartHorizontalOrWithLeaderLinePlacingType
    Tekla.Structures.DrawingInsidePartHorizontalPlacingType
    Tekla.Structures.DrawingLeaderLineAndParentObjectAlongPartPlacingType
    Tekla.Structures.DrawingLeaderLinePlacingType
    Tekla.Structures.DrawingPointPlacingType
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next