Exercise 6: Let user select rebars for pad footings

Updated: 10 Apr 2024

You will now learn how to use customized user interface controls to select profiles and meshes from the catalogs in Tekla Structures.

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

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

Let the user select rebars for pad footings

 

  1. Add the ReinforcementCatalog user interface control to your form to select the rebars for pad footings.

  2. Add three textboxes to show the size, grade and bending radius of the selected rebar.

    • Use the values of these textboxes to select values in the reinforcement catalog dialog when the dialog opens.

  3. Create callbacks for the events “SelectClicked” and “SelectionDone”.

  4. Modify the hardcoded values for the rebars in the code.

    • Rebar bending radius can have several values in the catalog, for example “20 40” so those values need to be handled by the application. So instead of defining the radius values in code as we did earlier Radiusvalues.Add(40.0) we can ask the values from the user:
      char[] Separator = {' '};
      string[] Radiuses = BendingRadiusTextBox.Text.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
      foreach(string Item in Radiuses)
                Rebar.RadiusValues.Add(Convert.ToDouble(Item));
  5. Set default values for the rebars, pad footing size and column profile.
    • To do that, it is possible to modify the form constructor method to include several calls to SetAttributeValue method. Like this: 
      public Form6()
      {
          InitializeComponent();
          base.InitializeForm();
          SetAttributeValue(FootingSize, "1500");
          SetAttributeValue(ColumnsProfileTextBox, "HEA300");
          SetAttributeValue(SizeTextBox, "12");
          SetAttributeValue(GradeTextBox, "A500HW");
          SetAttributeValue(BendingRadiusTextBox, new TSD.Distance(144.0));
          MyModel = new Model();
      }
  6. Bound values of controls to attributes.
  7. Test your application.

 

Your application form should look something like this:

 Tekla structures open api Application form user select rebars for pad footings

Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.