Tag: Tekla API

  • 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;

  • How to Get Tekla Model Objects if selected by Users (Tekla API)

    How to Get Tekla Model Objects if selected by Users (Tekla API)

    A user has pre-selected a set of model objects.

    We need to retrieve them via the API. How do we do it?

    All of our code is extracted from our production apps.

  • ByCoordinateSystems (i.e. the Tekla API method)? AlignCoordinateSystem (the AutoCAD .net API method)? What are they? What do they mean?

    What problem does it solve?

    I have some treasure, buried somewhere.

    I know how to get there from my town.

    • Go 10km forward, and then 5 km left, and then 2 km right.
    • Walk forward 10 steps, and now
    • dig.

    This is great from my current location. But how will you get there from YOUR location? Without changing the location of the treasure, I can tell you how to get there, from your location by aligning coordinate systems.

    But it can be confusing. Here’s how I think about it intuitively. Forget the maths, just think about it intuitively.

    Consider both examples:

    If you think about it that way, it will be much harder to get confused.

  • How to Get Drawing Revision Numbers

    How to Get Drawing Revision Numbers

    Couldn’t do it, because it’s not exposed. This is a hack that I used to circumvent:

     

     

  • Exploring a New Approach to Copying Objects in Tekla


     

    copy to another Object in Tekla

     

    Normally in Tekla, if we want to copy objects or components from one object to another, we have to follow these steps :

     

    • Select the objects and components you want to copy.
    • Execute the “Copy to Another Object” command.
    • Choose the source object.
    • Select the destination object.
    • The objects will be copied by reference, aligning their coordination system with that of the source object to the destination object’s coordination system.

     

    Please note that the coordination system is used to ensure the accurate positioning of the copied objects in relation to the source and destination objects.

     


     

    Macro: Copy to another object multiple

     

    The command “Copy to Another Object” poses an issue when used in Tekla. It does not allow the selection of multiple destination objects at once; instead, we can only choose them one by one. This limitation can be time-consuming, particularly when working on large projects.

     

    Tekla offers a macro called “Copy to Another Object Multiple” that fulfills the requirement of selecting multiple destination objects. This macro functions similarly to the command mentioned earlier. First, we need to select the objects before running the macro. Once the macro is executed, it prompts us to select an object. Then, we select one source part, after which we can conveniently use drag selection to choose multiple destination objects. Finally, press the mouse middle button.

     

    the snapshot was taken on Tekla version 2022

     

    You can find this macro in the Applications & Components catalog of Tekla Structures.

     


     

    Introducing a New Approach: The Modified Implementation for Copying Objects in Tekla

     

    The ‘Copy to Another Object‘ command works by copying objects in relation to the source object and pasting them according to the destination objects

     

    • The coordination system plays a crucial role in defining the position and rotation of a part in Tekla
    • It is primarily based on the start handle of the part
    • Altering the coordination system of a part is not possible

     

    If the destination object’s lengths differ from the source object, a problem arises where the objects are positioned based on the start point

     

    After copying the small beam to other destination objects of varying lengths

     

    In many situations, we often find ourselves having to manually utilize the ‘Copy Linear’ or ‘Move Linear’ commands to perform copying tasks.

     

    We utilized the Tekla API to Create a new macro that helps to copy objects in relation to the end handle of the part. When executing this macro, it prompts the user to select the desired handling method for copying objects

     

    This is the dialog box that appears while running the modified “Copy Multiple Tek1” macro.

     

    When the “End Handle to End Handle Copy” option is selected, the operation produces an outcome that is similar to the image shown.

    members of the Tek1 organization can download the tsep installer file of the above macro by clicking the download button

    Here is the code of the macro. if anyone wants to have a look around and find out how things work, just go through the code:

    https://gist.github.com/ansonsuhesh/582062d65e83fad2a74540e2fddd795c

    Here is the video to explain the process of the newly created macro. Check this out:

    GitHub/ansonsuhesh

    LinkedIn/ansonsuhesh

  • Tek1 – Tekla Tools

    Dimension Bolts

    Set up Instructions

    • Source code (sorry folks it’s a private repository).
    • Download program here.
    • Only works for: Tekla version: 19.1i
    • Run Installer.
    • SmartScreen may warn you about this program – by pass SmartScreen.

    Instructions:

    • Only dimensions horizontally and vertically. This means if you use some crazy views / angles it won’t work – and it will give the wrong dimensions.
    • You must select a window from within the view, or else it will crash.

    Trouble shooting: it doesn’t work!

    • Please check that “Toggle crossing selection” is on.
    • Allow “Select points”.

  • How to Get Bolt Information From A Tekla Part (Tekla Open API)

    Given a Tekla Part (regardless of how it was obtained, we want to obtain the bolt information. We can do so as follows (see the hello world example):

  • Refactoring the Code – Printing Selected Beams to Excel – Part 3 – (Tekla Open API)

    An apposite photo for refactoring, yet it is also oxymoronic.
    Refactoring is when you change, but don’t change.

     

    Let us now continue to refactor according to good design principles.

     

  • Refactoring the Code – Printing Selected Beams to Excel – Part 1 – (Tekla Open API)

    Improve by refactoring.
    Strive to improve the code. Just like this guy is trying to improve his swing. Looks like a fine golfer by the way. probably low single figure handicap, if not scratch.

    We will attempt to do something which is seldom done or discussed in Tekla code samples: and that is the very important issue of refactoring code.

     

    1. Start with Tests.

     

    The first thing you need is a good suite of tests. That way you will know whether something has gone wrong or not. It might be tricky doing this since we are developing within the Tekla environment, but I do suppose it’s possible.

     

    2. General Themes:

     

    • Change names to more appropriate titles.
    • Restructure the code to make it understandable.
    • Correct any obvious defects: