Guides and Articles

Use this documentation when building your Tekla Structures apps

Exercise 7: Load steel materials from catalog to selection form

Updated: 13 May 2019

You will learn how to enumerate through the catalogs and customize the list of items shown in the form.

After downloading the TSOpenAPISelfLearningExercises package from GitHub (button above), find the example code for this exercise at \Exercise7-UI-Load-Steel\ folder.

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

Load steel materials from catalog to selection form

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

  • Load steel materials from the catalog when the form is loaded

  • Add the steel materials to the material selection form

 

Follow these steps to create your application:

  1. Create an instance of List<MaterialItem>

  2. Add a textbox to the form for the user to give the material.

  3. Add a button to the form that selects the material, the click-event should include the following:

    • Create a new MaterialSelectionForm.

    • Set values to the material textbox.

  4. Create a OnLoad event that loads steel materials from the catalog, the event should include the following:

    • Create a new CatalogHandler.

    • Select all material items from model to enumerator using MaterialItemEnumerator.

    • Loop through enumerator.

    • See if an item has steel as material and add it to material list.

  5. Modify the hardcoded value for material in the code. Use value defined in the textbox.

  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 material selection

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