This article explains how you can create cast unit using the Tekla Open API in VB.Net.
Add reference to the Tekla.Structures.Model and the Tekla.Structures library located in the path “C:\Program Files\Tekla Structures\20.0\nt\bin\plugins” and manually open the tekla model. This has been covered in the article below:
The next step would be to get reference to the parts you would like to add to an assembly. This can be done in different ways. Below are a couple of example for achieving this:
- Get reference to existing objects in the model.
- Create new parts and save their reference.
- Ask the user to select objects from the model
Creating a Cast Unit:
Consider the model below:
The model consists of 3 columns and 2 beams. In reinforced concrete models it is beneficial to add the beams to cast units. The beams in the model can be added to a cast unit using the code below:
Private Sub CreateCastUnit(ByRef objBeam1 As TSM.Beam, ByRef objBeam2 As TSM.Beam) Dim objAssembly As TSM.Assembly objBeam1.CastUnitType = Tekla.Structures.Model.Part.CastUnitTypeEnum.CAST_IN_PLACE objBeam2.CastUnitType = Tekla.Structures.Model.Part.CastUnitTypeEnum.CAST_IN_PLACE objAssembly = objBeam1.GetAssembly objAssembly.Add(objBeam2) objAssembly.Modify() End Sub