Code example: Create views in drawings
Create Basic Views is an example application showing how to create general arrangement drawings with different views.
Application uses the same definitions for the view rotations as the model command "Add component basic views". This should not be mixed with single part, assembly or cast unit drawing views, which have their own definitions for views.
Drawings created with this application are not automatically updated. Therefore, if the basic views are created from assembly or from task, these drawings must be recreated after adding new parts to the assembly or task.
Watch the video about how to create an app that creates drawings
The video explains how to create part drawings based on user selection and how to add views to the drawings.
Application contains following functionality:
- Create: Creates drawings from the selected model objects. If there are several model objects selected, one drawing is created for each model object. Model object can be part, assembly, task, component or cast unit.
- Open drawings: If this check box is checked, drawing creation is visible. If there are multiple model objects selected, the last drawing is left open when the application has completed all drawings. When this check box is not selected, the drawings are created in invisible mode similar to normal Tekla Structures drawing creation.
- Top/Front/End/3d view: When selected, the specified view is created.
Download the source code
Click Get code button above to download the source code of this code example.
After downloading the TSOpenAPIExamples package from GitHub, find BasicViews example at \Drawings\Applications\BasicViews.
Test the example application
You can test the application in Tekla Structures as follows:
- In Tekla Structures, open a model.
- Select parts in model view.
- Open and build Basicviews.csproj in Microsoft Visual Studio to create the application file. The file is located at Examples\Drawings\Applications\BasicViews.
- Run the application BasicViews.exe located at Examples\Drawings\Applications\BasicViews\bin\Debug.