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.

ConnectionBase Class

The ConnectionBase class is a base class for defining connections, details and seams. These types are more specialized and restricted by the input values than the ones derived from PluginBase.

The coordinate system for connections, details and seams is explained in the Tekla Structures help, in the part about the position type of custom components. The position type defines the origin of the custom component, relative to the main part.

Inheritance Hierarchy

Namespace:  Tekla.Structures.Plugins
Assembly:  Tekla.Structures.Plugins (in Tekla.Structures.Plugins.dll) Version: 2023.0.1
public abstract class ConnectionBase : MarshalByRefObject

The ConnectionBase type exposes the following members.

Public propertyCode
The connection code of the executable connection instance. The maximum length is 22 characters.
Public propertyIdentifier
The identifier of the executable plug-in instance.
Public propertyPositions
The positional attributes for a detail or a seam instance; one for a detail, N for a seam.
Public propertyPrimary
The identifier that was selected as the primary object.
Public propertySecondaries
A list of secondary identifiers of a connection or a seam.
Public methodIsDefaultValue(Double)
Returns true if the given value is set to the default value for this type.
Public methodIsDefaultValue(Int32)
Returns true if the given value is set to the default value for this type.
Public methodIsDefaultValue(String)
Returns true if the given value is set to the default value (empty string).
Public methodRun
The main method of the component. Inside Run the user can implement the logic based on the user given attributes and input. Inside the method input can be found from the provided properties: Primary, Secondaries and Positions.
In the following example, a .inp file is used for defining the dialog. Notice that starting from version 15.0, the System.Windows.Forms namespace can be used to create rich user interfaces. See e.g. the PluginFormBase class in the Tekla.Structures.Dialog documentation for more information. When using System.Windows.Forms, the name of the form has to be the same one as the connection name for ConnectionBase, otherwise the form will be loaded and shown but the apply method won't work (modify will work).
using System;
using System.Windows.Forms;

using Tekla.Structures;
using Tekla.Structures.Plugins;
using Tekla.Structures.Geometry3d;
using Tekla.Structures.Model;

public class StructuresData3
    public double Parameter1;
    public string Parameter2;

[Plugin("BeamConnection")] // The name of the connection in the catalog
public class BeamConnection : ConnectionBase
    private readonly StructuresData3 data;
    private readonly Model myModel;
    public BeamConnection(StructuresData3 data)
        this.data = data;
        myModel = new Model();

    static Beam CreateBeam(Point point1, Point point2, string profile)
        Beam myBeam = new Beam(point1, point2);
        myBeam.Profile.ProfileString = profile;
        myBeam.Finish = "PAINT";
        myBeam.Position.Depth = Position.DepthEnum.MIDDLE;
        myBeam.Position.Plane = Position.PlaneEnum.RIGHT;
        return myBeam;

    void CreateFitting(double thickness, ModelObject mySecondary)
        Fitting myFitting = new Fitting();
        myFitting.Plane.Origin = new Point(thickness, 0, 0);
        myFitting.Plane.AxisX = new Vector(0, 1000, 0);
        myFitting.Plane.AxisY = new Vector(0, 0, 1000);
        myFitting.Father = mySecondary;


    public override bool Run()
            // The default values
            if (IsDefaultValue(data.Parameter1))
                data.Parameter1 = 300.0;
            if (IsDefaultValue(data.Parameter2))
                data.Parameter2 = "PL10*300";

            // Get secondary
            Beam secondary = myModel.SelectModelObject(Secondaries[0]) as Beam;

            Point point1 = new Point();
            Point point2 = new Point();

            point1.Y -= data.Parameter1 / 2;
            point2.Y += data.Parameter1 / 2;

            Beam newBeam = CreateBeam(point1, point2, data.Parameter2);

            double thickness = 0.0;
            newBeam.GetReportProperty("PROFILE.WIDTH", ref thickness);
            this.CreateFitting(thickness, secondary);
        catch (Exception e)

        return true;

    public class UserInterfaceDefinitions
        public const string Plugin3 = @"" +
        @"page(""TeklaStructures"","""")" + "\n" +
         "{\n" +
         "    joint(1, BeamConnection)\n" +
         "    {\n" +
        @"        tab_page(""Beam test"", ""Parameters"", 1)" + "\n" +
         "        {\n" +
        @"            parameter(""Plate Length"", ""P1"", distance, number, 1)" + "\n" +
        @"            parameter(""Profile"", ""P2"", profile, text, 2)" + "\n" +
         "        }\n" +
         "    }\n" +
See Also
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.