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.

CustomPartBase Class

The CustomPartBase class is a base class for defining custom parts. 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: 2018.1.0.0 (2018.1.0.0)
public abstract class CustomPartBase : MarshalByRefObject

The CustomPartBase type exposes the following members.

  Name Description
Public property Identifier
The identifier of the executable plug-in instance.
Public property Positions
The positional attributes for a custom part instance.
  Name Description
Public method IsDefaultValue(Double)
Returns true if the given value is set to the default value for this type.
Public method IsDefaultValue(Int32)
Returns true if the given value is set to the default value for this type.
Public method IsDefaultValue(String)
Returns true if the given value is set to the default value (empty string).
Public method Run
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.
using System;
using System.Windows.Forms;

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

public class StructuresData3
    public double Parameter1;
    public string Parameter2;

[Plugin("CustomBeam")] // The name of the connection in the catalog
public class CustomBeam: CustomPartBase
    private readonly StructuresData3 data;

    public CustomBeam(StructuresData3 data)
        this.data = data;

    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;

    static void CreateFitting(double thickness, Beam myPart)
        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 = myPart;


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

            // Get input points
            Point point1 = new Point(this.Positions[0]);
            Point point2 = new Point(this.Positions[1]);
            if (data.Parameter1 > 0)
                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);
            CreateFitting(thickness, newBeam);
        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