Tekla Open API: Insert Single Rebar

This article explains how you can add a single rebar to a concrete part in a Tekla Structure model using the Tekla Open API in VB.Net.

Step 1:

Add reference to the Tekla.Structures.Model and Tekla.Structures library located in the path “C:Program FilesTekla Structures20.0ntbinplugins” and manually open the tekla model. This has been covered in the article below:

Step 2:

Using the following code you will be able to add a single rebar to a concrete part.

Imports TSM = Tekla.Structures.Model
Imports TSG = Tekla.Structures.Geometry3d
''' <summary>
''' The function adds as single rebar to a concrete part in tekla
''' </summary>
''' <param name="objBeam">The part to add the rebar to</param>
''' <remarks></remarks>
Private Sub InsertSingleRebar(ByRef objBeam As TSM.Beam)
Dim objSingleRebar As TSM.SingleRebar
Dim appTekla As TSM.Model
Dim objPolygon As TSM.Polygon
Dim objPoint1 As TSG.Point
Dim objPoint2 As TSG.Point
'connect to the tekla model
appTekla = New TSM.Model
objPolygon = New TSM.Polygon
objSingleRebar = New TSM.SingleRebar
'the rebars will be added to the concrete part
objSingleRebar.Father = objBeam
objPoint1 = New TSG.Point
objPoint2 = New TSG.Point
'the start and end coordinates of the rebars
objPoint1 = New TSG.Point(objBeam.GetSolid.MinimumPoint.X, objBeam.GetSolid.MinimumPoint.Y, objBeam.GetSolid.MinimumPoint.Z)
objPoint2 = New TSG.Point(objBeam.GetSolid.MinimumPoint.X, objBeam.GetSolid.MinimumPoint.Y, objBeam.GetSolid.MaximumPoint.Z)
objPolygon = New TSM.Polygon
objSingleRebar.Polygon = objPolygon
objSingleRebar.Grade = "1.4301"
objSingleRebar.Name = "1"
objSingleRebar.Class = 5
objSingleRebar.Size = "22"
'the rebar hooks can be set here
objSingleRebar.StartHook.Shape = Tekla.Structures.Model.RebarHookData.RebarHookShapeEnum.CUSTOM_HOOK
objSingleRebar.StartHook.Radius = 50
objSingleRebar.StartHook.Length = 210
objSingleRebar.StartHook.Angle = 90
objSingleRebar.EndHook.Shape = Tekla.Structures.Model.RebarHookData.RebarHookShapeEnum.CUSTOM_HOOK
objSingleRebar.EndHook.Radius = 50
objSingleRebar.EndHook.Length = 210
objSingleRebar.EndHook.Angle = 90
'the changes will only take effect after the following 2 lines
End Sub

The input to this function is beam object. Although the object name is a “beam”, but it actually can be any concrete part (column, slab, foundation, …). You could either create a new concrete part and pass the object as reference to this function, Insert Concrete Beam Using VB.Net (Tekla Open API) or you can search for existing concrete parts and pass them to the function VB.Net Get Reference to Parts, Tekla Open API.

In lines 24 and 25, the start and end points of the rebar are being defined. Note these points are defined in global coordinate.

Lines 31~35 are essential parameters that must be set. Without setting them the rebar will not be inserted.

Lines 37~46 are optional. They define the start and end hook conditions of the rebar.

The code in line 49~50 is what actually inserts the rebar. Without calling them the rebar will not be inserted.

You can download the file and codes related to this article from the link below:

If you need assistance with your Tekla model, or you are looking for a Tekla Open API programmer to hire feel free to contact me. Also please visit my home page www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *