VB.Net Delete Parts, Tekla Open API
This article explains how you can delete parts in a Tekla Structure model using the Tekla Open API in VB.Net.
Add reference to the Tekla.Structures.Model library located in the path “C:Program FilesTekla Structures20.0ntbinplugins” and manually open the tekla model. This has been covered in the article below:
In order to delete a part you will need to have a reference to the parts object. In order to get reference to the parts object. I’ve explained how this can be done in the article below:
In this example we are going to delete all the Beam type Parts in the model. This can be done using the code below:
The code iterates through all the ModelObjects in the current model.
Note: Aside from the objects you have drawn there will be many system objects in there as well.
The code below will try to cast the object to a Beam type. If it succeeds, then we will know that the object is of the Beam type:
Note: Beams and column are both of the Beam type in the Tekla Open API.
You can download the file and code used in this article from the link below: