Category Archives: Tekla API

This is blog for posting and commenting on Tekla API

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 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.

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: http://cadsupport.ru/en/blog/

 

Tekla Plug-in #2: Viewing an Assembly in the Model from an Assembly Drawing

Folks

I’ve created another Tekla plug in. And I’m calling it using a macro.

What does this plug in do?

Here is a demo:

 

Basically it display an assembly in the model, from a given assembly drawing. Does that make sense? Well if not let’s elaborate:

The Problem:

I’m sure you’ll be having similar issues. So I’m working in Tekla. I’m busting my brains on this model that we’re working on, the boss is on my back like a monkey, and to add to all of that, I’m looking at an assembly drawing, but I have no idea how the actual drawing looks in real life. Can you make any sense of this?

Can you make sense of this drawing? How does it look in 3d?

This is simply an assembly drawing. Can you imagine how it would look in real life, or in the model?

 

I guess not. What you want to see is the assembly in the model space. Well prior to my plug in, there’s a lot of rigormorale in finally getting to and seeing the drawing. Now you just run the macro and BOOM you can see exactly what that assembly drawing is referring to. In this case it’s referring to this lovely assembly in the model.

 

 

 

 

 

 

 

Saves a lot of time and effort, hey?

Ahh the glorious power of knowing .net and the Tekla API. Makes life a lot easier. But the hard part is learning programming,  .net, Tekla and the Tekla API. I suppose just save yourself the trouble and hire someone who already knows how!

 

Stay tuned for the next post!

Ben Koshy

Tekla Plug-in #1: Multi Drawing Selector

Multi drawing Selector for Tekla drawings

The Multi Drawing Selector Application is a program helps collate the single part drawings of all parts (with the same profile) into a single multi sheet drawing.

If I have a certain profile of flatbar: say 90×10 then wouldn’t it be handy if I had all such flatbars (with their varying lengths) on a single drawing? In the past you would have e.g. 16 different drawings (one for each particular length of the 90×10 flatbar) jumbled all over the place in your folder. If you had to fabricate it then you would have to sift through the folder for all such profiles. Having obtained the 16 different drawings, then you would go to your factory and obtain the 90×10 flatbar and produce the 16 different types of flatbars you need. But what if you did not see a 90×10 flatbar drawing at the back of your folder? What if there were 17 different drawings for that particular profile and you only pulled out 16 from your folder to take with you to the work shop floor. So basically you forget to fabricate a single part. But what if you were required to make 14 of those? When you find out, then you would have to go back into your work shop, get a flat bar and make the cut again and make 14 flatbars that are 90×10 with that particular length. Ideally you’d want it done correctly the first time, but now you have to make two different trips. And we are only talking about one particular profile here.

Now you can dramatically reduce the number of drawings you have in your folder. 90 x 10 flatbar? No problem. Simply pull out the multi drawing which already has everything within it: take it to your work shop and cut all the required flat bars there. No flipping back and forth. You won’t miss a part – because it is ALL there, and you won’t be forced to redo it at a later stage.

What exactly does it do?

It looks through your model for all standard sized flatbars.
All unique flatbar profiles will be written down separately in a “list”. For example, let us consider the following flatbar profile: 90×10. Suppose you have 10 such profiles in your model. This particular profile will be written down on the list, along with the 10 single part drawing numbers of associated with that particular flat bar.
If your model has non-standard flatbars, or plates, this will be collected and highlighted separately in a “plate list”. e.g. suppose a detailer creates a FT 91.3 x 11.1 profile. This will be written down on the “plate list” with all the part numbers associated with that profile.
The program allows you to select all the parts associated with a particular profile. In other words, you can select all the 10 parts associated with that 90×10 profile, and you can put them in one single multi drawing.

It takes about 45 seconds after clicking the refresh button for the list boxes to be populated.

Instruction on how to use.Tekla must run first

Tekla must run first

Single part drawings must exist
You must apply the correct selection filter.
You have configure a .CSV file which lists all standard flatbars in the correct format.
Start flatbar application
Click refresh button.
Double click profile on right lefthand side to see the drawing Nos.
Select Drawing Nos
Click Select button
Now switch to Tekla window and create mulit drawing for selected parts
Benefits

Items are selected by Profile and in increasing length.
The number of drawings associated with a particular profile is placed in brackets around the profile dimensions. e.g. 100 x 16 has 17 different part numbers and single part drawings.
If you’ve already created a multi drawing for a particular part, then it won’t show up in the list again, after you’ve pressed refresh. That way you will know exactly what parts need to be placed in a multi drawing and what parts have already been placed in a multi drawing.
Saves everyone a lot of time and headaches.
If you require the macro please email the admin or email info@tek1.com.au
The flat bar picker is customised for the Australian environment

Multi Drawing Selector

If you require any custom tools in Tekla, Autocad please contact us.

Also any applcations using Ruby on Rails, dot net or Php. (We prefer ruby on rails for web applications)