Guides and Articles

Use this documentation when building your Tekla Structures apps

Code example: Drawing list handler

Updated: 1 Nov 2017

Simple Drawing List is an example application showing how to go through various drawings and drawing objects. This application is not intended to provide any meaningful functionality to Tekla Structures: it is only a simplified example of the Drawings API.

After downloading the TSOpenAPIExamples package from GitHub (button above), find SimpleDrawingList example at \Drawings\Applications\SimpleDrawingList.

 

Functionality

Application contains following functionality:

  • Refresh: Press this button to regenerate the tree view. Depending on the amount of drawings this might take a while.
  • Show views: When this check box is selected, the application will fetch the views in the drawings. This is considerably slower than just fetching the drawings.
  • Show objects in views: When this check box is selected, the application will fetch the objects in the views. Show view must be selected to enable this.
  • Open selected drawing: Press this button to open the selected drawing in the tree view. If nothing is selected or if the selected tree view item is not a drawing, this button will do nothing.
  • Delete selection: Press this button to delete the selected item on the tree view from the drawing database. This button deletes both drawings and drawing objects.

Tekla structures open api code example drawing list

Test example application

You can test the application in Tekla Structures as follows:

  1. In Tekla Structures, open a model that includes drawings.
  2. Open and build SimpleDrawingList.csproj in Microsoft Visual Studio to create the application file. The file is located at Examples\Drawings\Applications\SimpleDrawingList.
  3. Run the application SimpleDrawingList.exe located at Examples\Drawings\Applications\SimpleDrawingList\bin\Debug.
  4. Select enumeration mode and press Refresh to update list.