Category Archives: Tekla API

A series of blog posts exploring the Tekla API.  Code examples, explanations and (where relevant) videos will be provided.

Pick First Selection in the Tekla API (Tekla Open API)

The AutoCAD .net/ObjectARX APIs have a handy feature all the pick first selection. This means that prior to running a command, the user is able to select some objects in the model. The command is then able to use these objects. The question is, how to obtain a selection of objects using the Tekla API – prior to running your plug-in?

It’s really simple (if you already know how):

And that’s all it is! Hope this helps.

How to Set Up a Tekla API Project (Tekla API Application)

Work faster with the Tekla API

The object of a Tekla Application is to ensure that things go smoothly on the construction site. You can see the organised chaos that is here. Avoid the real chaos. Plan ahead and raw well. 

For the newbie this post shows how to set up a Tekla Project.

Let us assume that you are creating a WPF desktop Application.

  1. Go to Visual Studio.
  2. Create a new WPF project.

Follow this gif:

Setting up a Tekla Project
How to Set up a Tekla WPF Application
  1. Next you need to add references to Tekla DLLs. They are contained at this location on my PC. C:\Program Files\Tekla Structures\19.1\nt\bin\plugins\ .They may be in a different version on yours.

Follow this Gif:

Adding Tekla References

Shows how to add references to a Tekla API WPF Project.

  1. The fourth and final step is to add directives and to then get coding.

Some common directives and aliases that I use:


I hope this post helps you!

Showing an Assembly in the Model via a Tekla Drawing (Part II)

We are revisiting a post I made earlier.

Here’s the problem. You are viewing a Tekla drawing. But you have no idea what you are looking at, or where it is. This macro will take you to that very assembly in the model. It’s actually quite handy. And here is the previous post where I made allusion to the facility (you’ll find a video demonstrating its use):

Showing an Assembly in the Model via a Tekla Drawing (Part I) – Tekla Open API Plugin

This post marks the release of the code which does the job! Enjoy!

AutoCAD-Tekla Interoperability

Tekla – AutoCAD Interoperability Tool

Tekla licenses are pricey. About $30k + maintenance per license. What if I told you that you needed 30-50% less licenses than you currently hold. That’s a huge cost saving, isn’t it?

If you only need 5 licenses (as opposed to 10), then you’ve saved $150k instantly, plus maintenance.

AutoCAD licenses are significantly cheaper.

But if only the work you did in AutoCAD could be transferred into Tekla? That would save you some licenses. That’s just what I’ve done here in my latest project. Now a significant portion of any modelling job can be done in AutoCAD and simply imported into Tekla.

You can check it out here:

Tekla – Autocad Interop. from Tek1 on Vimeo.

Human Resources Problem

Interoperability will also help improve the quality of your work: it’s tough finding people who are highly skilled in Tekla. What if I told you that you could use an AutoCAD draftsperson instead of someone well versed in Tekla, to do the same job? Now you have a potentially infinite pool of candidates to draw from.

Interested In more?

I’d love to be able to help. Just call or email us.

Adding a Dimension to a Beam – Drawing – Tekla Open API Tutorial

This is an example of a hello world program which dimensions a beam. I found this code in the Tekla Drawing Samples folder.

You can see it in action here:

How to dimension a beam using the Tekla Open API (c#)
How to dimension a beam using the Tekla Open API (c#)


Let’s walk through it:

  1. We have to get the relevant drawing.
  2. Then we have to get the relevant part we want to dimension.
  3. Then we get the view associated with the part.
  4. We save our current transformation plane, and we set a new transformation plane to the particular view’s display coordinate system.
  5. From here, get the part’s identifier and we select the ModelObject in the model itself – to get the relevant coordinates of the Beam we want to dimension.
  6. Once we’ve used the identifier to get the Beam we are after, and to get it’s relevant parts then we create the dimension.
  7. Remember to save back the original transformation plane.
  8. Note: if you insert the dimension then I obtained an exception. I don’t think you need to insert dimensions when working on drawings.
  9. Note 2: if you forget to save the transformation plane back to the original, then you will find that you dimensions will go wacky, next time you run the command. Always remember to leave things as you found them!
  10. Note 3: You have to have the beam in the same plane as your view otherwise it won’t draw the dimension.


Here is the code for your benefit:



Converting Engineering Components to Detailing Components

What do we want to do?

  1. We have received a Tekla model from someone.
  2. The model we have received was built using an Engineering Modelling license.
  3. We have a full detailing license.
  4. There are components in this model, but we can’t number them because they were produced using an engineering license. If you want to number them, well they ought to have been created with a detailing license. So what do we do now?
  5. The only way to number these components is to first convert these components to a “detailing component”. The detailing component is a “type” of component.
  6. The problem is that there is no method exposed by the Tekla “Open” API which allows us to programmatically call this functionality. Also to make things more confusing: the nomenclature used in the user interface is different to the nomenclature used by the creators of the Open API.
  7. So what then is the solution?

The Solution

Here is a video explaining both the problem and demonstrating a solution:


And here is the code which actually does the work:


I hope you learned something!

Tekla–AutoCAD: Interoperability Tool

Tekla – AutoCAD Interoperability Tool

Tekla licenses are pricey. About $30k + maintenance per license. That’s expensive. And if you had 10 licenses, or perhaps even 50 licenses, what if I told you that you needed: 30-50% less licenses than you currently hold? That’s a huge cost saving. If you only need 5 licenses, then you’ve saved $150k instantly, plus maintenance. You can now do that.


AutoCAD licenses are significantly cheaper than Tekla.


But if only the work you did in AutoCAD could be transferred into Tekla? That would save you some licenses.


That’s just what I’ve done here in my latest project. You can check it out here:


Tekla – Autocad Interop. from Tek1 on Vimeo.

Thanks for visiting this page.

Tekla API – Converting Engineering Components to Detailing Components

Has anyone every given you a  model created form an engineering license and asked you to produce shop drawings from it? Well that’s incredibly difficult to make possibly. Because you can’t easily number parts.

So I created a macro which makes life much easier (and faster) too.

Here is a demo of how it works:

Tekla Macro – How to Convert Engineering Components To Detailing Components from Tek1 on Vimeo.

I will post the code in another post.


Tekla Open API Resources

It seems that there is a dearth of Tekla Resources on the Open API. I haven’t found much online, but what I have found, I will post here for your benefit.

There is a wealth of Tekla Open API articles and resources on this site: you can read them here. It will be growing and growing with increasingly sophisticated plug-ins and I’ll be providing the code for you in the above pages.

The most important resources are as follows:

  1. The Open API Reference.

This was produced by Trimble and is the go-to place for information about classes and methods etc. There are some code examples also given. You can download it all from here. There are some basic code examples in there which is well worth investigating.

  1. Trimble Open API Examples:

Extremely valuable. Thank you Trimble! If you want to see older examples, you’ll have to revert to another branch in the tree.

  1. Tekla ExtraNet

A fairly good resource, but the problem is that in order to have access there, you need to pay maintenance. Not everyone wants to do that. Plus the forum is extremely restrictive in terms of what you can and can’t post.

  1. Teklanology Blog:

You can checkout a blog from my estimable colleague.

And you can learn much from there. Mr Dale doesn’t post everyday, but when he does, it’s good. Here is his GitHub page as well.

  1. Software Solutions – Tekla Blog:

This provides you with some handy code examples.

  1. Tekla Application Library

I love to pay out Trimble for their API but I must give them credit where due – here is an application library they created. But unfortunately, the documentation is lacking. I’m convinced that if you know how to use it, it will save you time.

7. Tekla & AutoCAD Blog

Check it out here!

In my opinion it is a very nice blog – but I am partial to it, I confess. Learn some powerful techniques to manipulate the API, even though certain objects/methods are not exposed – there are ways around it!

If you have any more suggestions, please feel free to post them here. And I will share it to the world.

8. Cad Support Blog

Looks like quite a nice blog with a few code samples to aid in your learning.