Code example: Drawing list handler
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.
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.
Test example application
You can test the application in Tekla Structures as follows:
- In Tekla Structures, open a model that includes drawings.
- Open and build SimpleDrawingList.csproj in Microsoft Visual Studio to create the application file. The file is located at Examples\Drawings\Applications\SimpleDrawingList.
- Run the application SimpleDrawingList.exe located at Examples\Drawings\Applications\SimpleDrawingList\bin\Debug.
- Select enumeration mode and press Refresh to update list.