Adding A Dimension to a Beam (Tekla Open API - Tutorial)

_config.yml

This is an example of a hello world program which dimensions a beam. I found this code in the Tekla Drawing Samples folder. 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 it is in action:

_config.yml

Here is the code for your benefit:

Written on June 8, 2017