Get started with Tekla Structural Designer Open API
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.
Where to use Tekla Structural Designer Open API
Tekla Structural Designer 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.
Quick introduction
Watch the video below and learn what you can do with the Tekla Structural Designer Remoting API and see how to utilize some code examples. To get the code examples shown in the video, follow the instructions later in this guide.
Prerequisites
You need to have a Tekla Structural Designer license to develop on top of the 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.
Prepare your setup
- To get started you will need to create a new Microsoft Visual Studio project
-
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.
- On the Tools menu, point on NuGet Package Manager and click Manage NuGet Packages for Solution.
- Click the Browse tab, on the search box, search TeklaStructuralDesigner.RemotingAPI (no spaces) and click on the first result.
- On the Project window, select the projects where you want to add the references.
- From the Version list, select your TSD Remoting API version.
- 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
Remoting API provides an interface for different kinds of applications to interact with the analysis model and results in Tekla Structural Designer.
Take a look at these Tekla Structural Designer Remoting API code examples and learn how TSD Open API can be used.
- Download the source code of the examples
- View the code and try to understand what's going on
- Make some small changes to the code and run the application again
- Use the code examples as a starting point of your own Tekla Structural Designer applications. Modify the source code to fit your need.