Tekla Open API: Get Part Bounds

This article explains how you can get the min max bounds of a part object in a tekla model. Note part bounds will not be very useful when the part is not aligned in one of the 3 main directions.


Contents

Step 1:

Add reference to the Tekla.Structures.Model and the 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:

You will need to get reference to the part you wish to get this information from . Below are some of the options for achieving this:

1  – Create a new part and keep a reference to the part: Insert Concrete Beam Using VB.Net (Tekla Open API)

2 – Get reference to an existing part in the tekla model: VB.Net Get Reference to Object, Tekla Open API

3- Ask the user to select parts from the model: Tekla Open API: Ask User to Select Objects.


Get Part Bounds:

You can get the part bounds using the function below. Note the part object attained in the previous step must be passed as input to the function below:

Imports TSM = Tekla.Structures.Model


    Private Sub GetPartBounds(ByRef objBeam As TSM.Beam)
        Dim XMax As Double
        Dim YMax As Double
        Dim ZMax As Double
        Dim XMin As Double
        Dim YMin As Double
        Dim ZMin As Double

        XMax = objBeam.GetSolid.MaximumPoint.X
        YMax = objBeam.GetSolid.MaximumPoint.Y
        ZMax = objBeam.GetSolid.MaximumPoint.Z
        XMin = objBeam.GetSolid.MinimumPoint.X
        YMin = objBeam.GetSolid.MinimumPoint.Y
        ZMin = objBeam.GetSolid.MinimumPoint.Z

    End Sub

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 *