Category: Tekla API

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

  • Introduction – Setting up your Environment (Tekla Open API Course)

    Tekla - "open" api
    The API is really closed, though it says it is open

    This is a course on how to program using Tekla’s Open API. We will start from the very beginning and get into some complicated topics. These are the principles I use when developing Tekla API applications.

    The following posts a video tutorial on how to get started using the Tekla Open API. The first thing you need is visual studio.

    Ensure you have enough memory on your C (or XYZ drive). If you do not have enough memory, then watch me trouble shoot this problem.

    Getting Set-up:

    • Ensure you have Windows 7+ installed.
    • Download Visual Studio (Community Edition) is fine for your purposes.
    • Ensure you are using .NET Framework (which is different to .NET Core and .NET 5 / 6 / 7 / 8 and upwards). They sounds similar, and it is confusing but you want the Framework version.
    • If you wish, you can download and use Resharper (which is helpful).

  • The Code Behind the Shed Builder Application – via Tekla’s Open API

    The Code Behind the Shed Builder Application – via Tekla’s Open API

    The Code Behind the Shed Builder

    As promised, here are the key methods behind the ShedBuilder:

    I have separate classes – e.g. Facia, Column, Chord, Girt etc. to better represent the concepts and the interplay between all the items – and then I simply tie them all together to get the output that I want, but the main logic is here – if you wish to write the code yourself:

    And to extract properties given a particular profile:

    And finally to get all profiles which have a “HEIGHT” property:

    The Key Libraries I use:

    Automation

    This is a live production / job example of how we can quickly / accurately detail sheds at scale.

    Meaning we can handle:

    (i) volume
    (ii) speed

    You can do the same too!

    If you have questions or need assistance automating – feel free to email: [email protected] or [email protected] or visit our website: https://www.tek1.com.au/ or +61 0411 022 502 if you need to call me.

    Or if you wish to develop the software yourself checkout our blog posts – where all the basic elements to create this type of automation is present.

    For more posts checkout our Tekla API blog.

  • How to Automate the Modelling of Sheds (using Tekla’s Open API)

    The way of the future is automation.

    Use the Tekla API to automate the modelling of items that are relatively standardised – e.g. sheds, or warehouses etc.

    The following is a program we putting into production re: the detailing of Sheds. If the designs can be standardized, you can turbo-charge the detailing / design.

    You may want to use further automation re: custom components to further automate.

    Further Configuration: How-to Videos

    I will provide to you the full details on how you can do the above via our Tekla API blog.

    Need to automate?

    Call: +61 0411 022 502 or email:

    With some a basic idea of what you want to automate – whether simple, or more complex requirements which may pull data from various sources, or which may require a workflow that is more complicated.

  • How to extract Properties from Tekla Profiles (Tekla Open API)

    How to extract Properties from Tekla Profiles (Tekla Open API)

    Beam Profile Properties. We want to extract them with the Tekla API.
    How to get beam properties.

    You have a profile e.g. “CC200755.0″ obtained via the Tekla API. How can you extract it’s HEIGHT or WIDTH or other parameters (or properties) such as density? The Tekla Documentation is not good on this point, and it took me some time to find this out. I have documented the methodology, so hopefully that will save you some time.

    In our use case, users select a profile via text (or rather via a CLI). How we need to build a shed from it. In order to build that shed, we need to know the specific properties of the profile that is selected. How do you do that via the Tekla Open API?

            public double getHeight(string profileString)
            {
                LibraryProfileItem libraryProfileItem = new LibraryProfileItem();
                libraryProfileItem.Select(profileString);
    
                List<ProfileItemParameter> parameters = libraryProfileItem.aProfileItemParameters.Cast<ProfileItemParameter>().ToList();
                double height = parameters.First(p => p.Property.ToUpper() == "HEIGHT").Value;
    
                return height;
            }

    If you need some further explanation on what this all means, check out the video explanation below:

    For more information our Tekla’s API’s feel free to check out our Tekla API blog.

    Tekla - "open" api
    The API is really closed, though it says it is open
  • Batch Edit a Part in Tekla Structures

    Batch Edit a Part in Tekla Structures

    TeklaStructures has a batch editing utility for Assemblies.

    However, if we have to batch edit parts there is nothing.

    Expert Steel Detailers demand Utilities

    Our detailers have demanded that we develop a utility to do batch editing of parts.

    (more…)
  • Tekla Open API: How to access a Tekla Model Object from the Equivalent Object in a Drawing?

    Tekla Open API: How to access a Tekla Model Object from the Equivalent Object in a Drawing?

    The trick is to use to the drawing’s “PartIdentifier” to select the relevant object in the model space.

    Once you’ve done that, you can query the model object for whatever you want.

    Here is a code sample I’ve extracted from one of our Tekla API Applications. The basic steps:

    • Get the Drawing
    • Get the part identifier
    • Select it in the model
    SinglePartDrawing singlePartDrawing = (SinglePartDrawing)drawing;
    Tekla.Structures.Model.ModelObject modelObject = model.SelectModelObject(singlePartDrawing.PartIdentifier);
    Tekla.Structures.Model.Part part = (Tekla.Structures.Model.Part)modelObject;

  • QR Code on Drawings

    We are now placing smart QR codes on drawings. Why? What benefit is accrued by doing so?

    1. You can see a 3d view of an assembly.
    2. You can conduct spot measurements of the assembly.
    3. You can check whether your drawing is the latest revision.
    4. You can add markups directly to a document number – and see it’s revisions over time

    Instructions on how to make it work

    • Set up a project on prolox.io
    • Get the project’s public access token.
    • Log into the Prolox’s Tekla’s client application. Use your prolox login email and password and the project’s public access token.
    • Using Tekla 2023 and with the relevant model open (please open only 1 model) – run the client code.
    • All the values will be updated.

    Rules – To prevent obsolete data from being used or shown

    • If you update the model, you must re-upload the IFC file in prolox.
    • If you update the revision number, you must re-do the prolox Tekla client program. This will update the revision numbers in prolox.
    • If you delete a drawing you must update the revision number for the deleted drawing and re-run the TeklaQRCode program. (so that all revision numbers are updated on the cloud, and so that if anyone scans an old drawing, they will be immediately notified.)

    Updating the Drawings:

    • When you update the drawing PLEASE USE THE SAME REPOSITORY. This is so that we can have old revisions.

    Setting up the template

    • You must set up the drawing template to that the QR Code program works and puts the QR code in the right location. If you don’t set it up properly it will fail.
    • Assume each page has an origin point of (0,0) at the bottom left hand side of the page.
    • The drawing template’s borders start at (5,5).
    • There must be a good amount of white space between the QR code and borders, otherwise the QR code may fail to be read. Which means the entire thing fails.
    QR standards / documentation.

  • Dont Lose time with missing dimensions

    Do you loose time with missing dimensions

    Have you ever used the wrong revision?

    Here is what is cooking at Tek1.

    If you would lik to to know more

    Here is a solution where you can scan the QR code and bring up the assembly model. know the revision number of the drawing which you should be using

    you may visite tek1.com.au for more information

  • Why aren’t the user defined attributes being defined – in Tekla’s “Open” API

    Why aren’t the user defined attributes being defined – in Tekla’s “Open” API

    If you want to waste time on a poorly documented API (which doesn’t make any sense) I would highly recommend getting on Tekla. I’m documenting this so some poor soul doesn’t waste a day trying to debug this:

    // what’s wrong with this?
    
      Beam b = new Beam();
    
      b.SetUserProperty("USER_FIELD_1", "your data");
    
      b.Insert();

    Do you see the problem? First insert the beam, and then apply the UDA and it should work:

    // it only works AFTER you insert
    
      Beam b = new Beam();
    
      b.Insert();
    
      b.SetUserProperty("USER_FIELD_1", "your data");

    What glorious waste of time trying to work out why it failed!

    But the problem is not with you – the problem is with the API. It fails silently, and the documentation is poor. Hopefully this note saves someone a lot of headaches.