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.

PlacingAttributes Class

The PlacingAttributes class contains the basic attributes for determining an object's placing.
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 PlacingAttributes : GenericAttributesBase, 
	ICloneable

The PlacingAttributes type exposes the following members.

Constructors
  Name Description
Public method PlacingAttributes
Creates a new placing attributes instance. The default parameters are: IsFixed = true, default PlacingDistanceAttributes, default PlacingQuarterAttributes.
Public method PlacingAttributes(Boolean, PlacingDistanceAttributes, PlacingQuarterAttributes)
Creates a new placing quarter attributes instance with the given parameters.
Top
Properties
  Name Description
Public property IsFixed
Defines whether the object is using fixed or free placing. If set to true, it means that fixed placing is enabled, and the object will not be rearranged in the drawing automatically. If set to false, then free placing is enabled, and the object will be placed in the most appropriate location near the original location.
Public property PlacingDistance
Gets or sets the placing distance attributes.
Public property PlacingQuarter
Gets or sets the placing quarter attributes.
Top
Methods
  Name Description
Public method Clone
Creates a new object that is a copy of the current instance.
Public method IsEqual
Compares the current object with an object of the same type.
(Overrides GenericAttributesBaseIsEqual(Object).)
Top
Examples
The following example enumerates through all marks in all views and changes their PlacingAttributes and InsertionPoints. You may try commenting out either Modify part to see how it affects the end result.
using Tekla.Structures.Drawing;
using Tekla.Structures.Geometry3d;

public class Example
{
    public void Example1()
    {
        DrawingHandler MyDrawingHandler = new DrawingHandler();
        if(MyDrawingHandler.GetConnectionStatus())
        {
            MarkBase MyMarkBase;
            DrawingObjectEnumerator views = MyDrawingHandler.GetActiveDrawing().GetSheet().GetAllViews();
            while(views.MoveNext())
            {
                DrawingObjectEnumerator allObjects = (views.Current as ViewBase).GetAllObjects();
                while(allObjects.MoveNext())
                {
                    if(allObjects.Current is MarkBase)
                    {
                        MyMarkBase = allObjects.Current as MarkBase;
                        // Using PlacingAttributes.IsFixed = true will force the mark to go to the specified point.
                        MyMarkBase.Attributes.PlacingAttributes.IsFixed = true;
                        MyMarkBase.InsertionPoint = new Point(100, 100);
                        MyMarkBase.Modify();
                        // Using PlacingAttributes.IsFixed = false will try to place the mark to the specified point,
                        // however, if there's already an object there, it will find a new place around that area.
                        // When finding a place around the area, the rest of the PlacingAttributes take effect.
                        MyMarkBase.Attributes.PlacingAttributes.IsFixed = false;
                        // Minimum distance from other objects when searching for a space to place the mark
                        MyMarkBase.Attributes.PlacingAttributes.PlacingDistance.SearchMargin = 10.0;
                        // Minimum distance from the drawing object
                        MyMarkBase.Attributes.PlacingAttributes.PlacingDistance.MinimalDistance = 1.0;
                        // Maximum distance from the drawing object (0.0 = no limit)
                        MyMarkBase.Attributes.PlacingAttributes.PlacingDistance.MaximalDistance = 0.0;
                        // The directions to look for possible places
                        MyMarkBase.Attributes.PlacingAttributes.PlacingQuarter = new PlacingQuarterAttributes(TopLeft: true, TopRight: true, BottomLeft: true, BottomRight: true);
                        MyMarkBase.InsertionPoint = new Point(100, 100);
                        MyMarkBase.Modify();
                    }
                }
            }
        }
    }
}
See Also