Guides and Articles

Use this documentation when building your Tekla Structures apps

Exercise 4: Create rebars to pad footings

Updated: 31 Oct 2017

You will learn how to select objects from the model and then use an enumerator to loop through those objects.

After downloading the TSOpenAPISelfLearningExercises package from GitHub (button above), find the example code for this exercise at \Exercise4-Rebars\ folder.

Before you start, Open the project that you created in exercise 3. 

Create rebars to pad footings

Modify the last exercise so that you add two more methods:

  • Create rebar on the given object to given position using FootingSize from dialog.

  • Loop through all footings and create rebar on those.

Follow these steps to create your application:

  1. Create a textbox to the form for the user to give the size of the footings. Initialize the value to 1500.

  2. Get the size of the footing from the textbox.

  3. Create a method that adds the circular rebars around the footing. Use the RebarGroup and Polygon classes. Use these values (remember to localize needed values):

    //Polygon: 
    //Use pad footings corner points as polygon points, remember that the end point is same as the start point.
    //Rebar:
    Class = 3
    Name = "FootingRebar" 
    Father = PadFooting 
    Grade = "A500HW" 
    Size = "12" 
    Radiusvalues.Add(40.0)
    SpacingType = SPACING_TYPE_TARGET_SPACE
    Spacings.Add(100.0) 
    ExcludeType = EXCLUDE_TYPE_BOTH 
    NumberingSeries.StartNumber = 0 
    NumberingSeries.Prefix = "Group" 
    OnPlaneOffsets.Add(25.0) 
    FromPlaneOffset = 40
    //StartPoint and EndPoint, use pad footings position and height.
    
  4. Add hooks to make the rebar stronger. Use these values:
    StartHook.Shape = HOOK_90_DEGREES
    EndHook.Shape = HOOK_90_DEGREES
    OnPlaneOffsets.Add(10.0)
    OnPlaneOffsets.Add(25.0)
  5.  Add a new button to the form that creates rebars. The method should include the following:
    • Select all objects from model to enumerator (ModelObjectEnumerator).

    • Loop through enumerator.

    • See if an object is a pad footing, then create rebar group to that using the pad footings StartPoint as position.

    • Commit changes to Tekla Structures 

  6. Test your application.

 

The result should look similar to this:

Tekla Structures model open API create rebars to pad footings