Guides and Articles

Use this documentation when building your Tekla Structures apps

Exercise 9: Browse through drawings list and open a drawing

Updated: 31 Oct 2017

You will learn how to do simple editing of a drawing that is opened in Tekla Structures. In this exercise you will add lines and texts to a drawing.

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

Before you start, open the project you created in exercise 8.

Browse through drawings list and open a drawing

Create a list view to your form that lists all the drawings available in your Tekla Structures model. The user can open a drawing from this list. Follow these steps to create your application:

  1. Add a ListView control to your form for listing the available drawings.

  2. Add a method that gets the drawings from Tekla Structures and adds them to the list.

    • Use DrawingEnumerator from DrawingHandler to loop through the available drawings.

    • Use Tag in the ListViewItem to store the drawing. ListViewItem represents an item in the ListView.

    • Call the method on the OnLoad event to execute it when the application starts.

  3. Add a button to your form that opens selected drawing in Tekla Structures. In the click-event, see which tag is selected and set that as active drawing.

  4. Test your application.

The result should look similar to this:

Tekla structures Open API browse through drawings list and open a drawing