Get started with Tekla Structural Designer Open API

Updated: 14 May 2020

 

In this guide you will go through how to get started with Tekla Structural Designer Open API (known also as TSD Open API) and how to create your first Tekla Structural Designer applications.

 

Read this guide to get started with Tekla Structural Designer Open API.

Where to use Tekla Structures Designer Open API

Tekla Structural Designer Open API (TSD Open API), provides an interface for different kind of applications to interact with the analysis model and results in Tekla Structural Designer. 

You can utilize TSD Open API for a variety applications that, for example, automate your routine tasks, extend and enhance Tekla Structural Designer functionality or integrate Tekla Structural Designer into your own processes and workflows.

Prerequisites

You need to have a Tekla Structural Designer license to develop on top of TSD Open API. If you do not have a license yet, or you would like to develop for 3rd parties,  join Tekla Partners Program.

Looking to join Tekla Partners Program?

Then fill out and submit an online application form. 

Apply now

Prepare your setup

  1. To get started you will need to create a new Microsoft Visual Studio project
  2. Then install Tekla Structural Designer Remoting API and add assemblies as references.

    Tekla Structural Designer Remoting API package is available in NuGet.org. Use NuGet Package Manager in Microsoft Visual Studio to install or update the API package. After installation you can use the API assemblies as references in your Microsoft Visual Studio project. 

  3. On the Tools menu, point on NuGet Package Manager and click Manage NuGet Packages for Solution.
  4. Click the Browse tab, on the search box, search TeklaStructuralDesigner.RemotingAPI (no spaces) and click on the first result. Get strarted with Tekla Structural Designer Open API and install TeklaStructuralDesigner.RemotingAPI.
  5. On the Project window, select the projects where you want to add the references.
  6. From the Version list, select your TSD Remoting API version. 
  7. Click Install. The API packages appear on the Installed tab, and also Solution Explorer shows the added packages.

Connect to Tekla Structural Designer

It is possible to connect to the API using standard Microsoft .NET interoperability. Below, you can find short example of connecting using C#. 

The example shows how to connect to Tekla Structural Designer and print the total amount of members to standard output.
 

public static async Task Main()
{
	// Retrieve all instances of Tekla Structural Designer running on local machine (API for connecting to instances on remote machines over TCP/IP network is also available)
	var tsdInstances = await ApplicationFactory.GetRunningApplicationsAsync();
 
	if( tsdInstances.Any() )
	{
    	// Here we simply get first instance found
    	var tsd = tsdInstances.First();
 
    	var document = await tsd.GetDocumentAsync();
 
    	// And if there is a document
    	if( document != null )
    	{
        	// then we get its model
        	var model = await document.GetModelAsync();
 
        	// and from the model all members
        	var members = await model.GetMemberAsync( null );
 
        	// Finally we print total amount of members to standard output
        	Console.WriteLine( $"Members in the model: {members.Count()}" );
    	}
	}
	else
	{
        Console.WriteLine( "No running instance of Tekla Structural Designer found!" );
	}
}

Utilize the TSD remoting API code examples

Take a look at these Tekla Structural Designer Remoting API code examples and learn how TSD Open API can be used.

  1. Download the source code of the examples
  2. View the code and try to understand what's going on
  3. Make some small changes to the code and run the application again
  4. Use the code examples as a starting point of your own Tekla Structural Designer applications. Modify the source code to fit your need.