Extracting Bolt Distances of Single Part Drawings (Beams) With an Output In Excel – Part 2 (Tekla Open API)

Posted on Posted in .net (c#), Tekla API
This is a picture of a rusty beam. I added the picture here because it looks cool and for no other reason.

 

In the last part, we left off having collected the relevant Single Part Drawings that we were after. Hopefully we have applied the correct property to filter out the ‘HEA’, ‘IPE’ and ‘CC’ drawings. We will now focus on part II – extracting the distance of the bolts from the beam’s start position.

 

  1. Get every SinglePartDrawing which name starts with “HEA/IPE/CC”
  2. Calculate the distance of every bolt distance from the start of the corresponding Single Part. ** This blog post will address Part II.
  3. Write the name of the Single Part and every bolt distance to Excel.
  4. Refactor the code.

 

I did refactor the code a little bit, so it might not look exactly the same as the last version. The code is pretty self explanatory. But you will note that:

  • I am projecting the bolt positions along the beam’s vector (defined from the start to end point of the beam).
  • Therefore we do not need to save and set the transformation plane.
  • A corollary (and potentially unintended consequence) is that this will capture the bolt positions of all bolts, no matter if they are on the flange of the beam, or on the web etc. This may have some unintended consequences. Again, caveat emptor – programmer beware!

 

Here is the code in all it’s glory – simply follow the well detailed comments and it should be fairly straightforward. As always, any questions, feel free to ask.

We now have extracted the relevant information. Part III will delve into extracting this data in an Excel format. We will most likely use an OpenXML on other such library for that purpose. That post will come shortly, when I get a spare moment. Till that time, enjoy the following – or perhaps it can be left as an exercise for the user?!

Leave a Reply

Your email address will not be published. Required fields are marked *