Grasshopper-Tekla Live Link - sharing information between dwg and Tekla structures with Grasshopper

few hours with…
7 min readAug 24, 2021

Grasshopper from Rhino is probably one plugin that surprised me a lot when I first was introduced to it. My hobby is programming and I have done projects in Swift, Python, Javascript, C# and had never heard about visual programming which Grasshopper and other similar software allows you to do. At first, I had some problems in changing my mindset but after taking few courses about it I managed to adapt to it. My everyday job is related to Tekla Structures so when I was introduced to the Grasshopper plugin and what is possible to do I was quite surprised. So I decided to share one cool feature which is sharing data between different software, in this case, we will have some dwg data in Autocad, and let's move it to Tekla Structures. Of course, you can draw something directly in Rhino and pass it to Tekla but at least in my case I always get data from Autocad.

Explain everything in detail is quite complicated so if you got stuck somewhere I also created a video:

Some important information — to follow this tutorial you will need to have Tekla Structures and Rhino on your computer (Autocad is optional). To connect the Rhinos Grasshopper plugin to Tekla Structures you will need to add Tekla Live Link to your Grasshopper. Live Link can be found here and detailed information about installation and components here. I will not go through very basic stuff in this tutorial, but I hope it will make sense if you work with Tekla and want to start automating some boring and repetitive stuff.

In Autocad, I prepared a very simple block scheme with 10x10 blocks and in each block, there is a randomly placed color name. Then we can open Rhino and open this Autocad file there. When the file is opened we can open the Grasshopper plugin (type “Grasshopper” in Rhinos command line). In this example, we will be working on one plane so there is no need to adjust Teklas and Rhino axis. When you work on multiple axes you will have to adjust something, in my opinion, the easiest way is just to change axis directions in Tekla. So now everything is ready so we can start making some logic.

We will start by adding the “Curve” block to Grasshopper canvas, next right-click on the block and choose “Set Multiple Curves”. Now the function is active and we need to select all rectangles in Rhino. If everything is done correctly block color will change from black to yellow and then click the mouse middle button (scroll) to accept it. If it's done correctly blocks will change back to black and when you single press the “Curve” block in canvas all blocks will turn green.

Next, add the “Plate” block to canvas and “Panel”. Add value “PL10” to “Panel” and connect it to “Plate” property “Profile”. Previously created “Curve” block add to “Plates” property “Boundry”. If everything is correct now in your Tekla should be 100 blocks.

This is not what I wanted to show in this tutorial (just a small bonus), it's just a bit faster than creating blocks manually in Tekla. Now we need to pass information about block colors from the dwg file to Tekla. To do that we need to deconstruct the “Plate” block so we can access its properties. It's important to understand that we will deconstruct Teklas object, not dwg curve. Now we need to find which color belongs to which box. There are multiple ways to do that, I usually like to draw boxes around elements and see if there is any text inside.

In this case, add the “Deconstruct Plate” block, “Box Rectangle” block, “Panel” block with value 50, another “Panel” block with value minus 25, “Unit Z” block, and “Move” block to canvas and connect as it is in the scheme below.

If you check your Rhino you will see that all blocks are now filled with color (in 3D view you will see that they are also with some thickness). Next, let's make Grasshopper read color names from Rhino's environment. To do that you will have to add a “Human” ribbon to Grasshopper, to do that download it here.

Add “Panel” block, “Dynamic Geometry Pipeline” block, “Text Object Info” block, “Point” block, and connect them as in scheme. Basically, this will find all text elements in Rhino. Property “Plane” can be added to block “Point” and now you will have all texts presented as points in Grasshopper. Now we can search which color text point is in which box.

For that, we will use a block named “Point in Brep”. Connect as it is in the scheme. Additionally, we need to graft the “Point” block so Grasshopper can check each color text point against all boxes. Click the right mouse button on the “Point” block and it will add a symbol — arrow pointing up in the block. Do the same in “Point In Brep” only here choose “Simplify”. Now we have a large list with a lot of True/ False values. In a very simple explanation — we take the first box and check if the color text is inside it, if yes we get back True, if not — False. So in each information group, we have 99 False and 1 True. This is done to all 100 boxes.

Next, we need to take the original list with Tekla plate objects and filter it out according to the color text list. To make it more “readable” add an empty “Plate” block and connect to it previously created plate. Now let's filter data, for that we will use the “Cull Pattern” block. To this block, we add the “Plate” block and result from the “Point In Brep” block. This will create a new list with plates according to color text. To make it more “readable” again add empty “Plate” block and “Text” block and connect as in the scheme below. Additionally, click the right mouse button on this new “Plate” block and choose “Flatten”.

Now we are at the last part, we have collected all the necessary information so we can pass it to Tekla. To do that we will need to add the “Set UDAs” block which sends information from Grasshopper to Tekla. In this block there are two inputs “Tekla Object”, here we connect our “Plate” block. The second input is UDA where we need to pass information in specific formatting. The first parameter is UDAs name, I will call it BLOCK_COLOR, and the second parameter is a value that must be in quotation marks. Value in this case is box color. For example, the top left box UDA would look like this — BLOCK_COLOR “yellow”. To format it we need to use an additional block named “Concatenate”. When you zoom in to the “Concatenate” block there will be a + sign, click it once to get additional value to put in. Now add two “Panel” blocks. In the first type in BLOCK_COLOR than space and one quotation mark. In the second “Panel” block add just one quotation mark. Now connect everything as in the scheme below and you will send information to Tekla.

Now we reached the end of this tutorial. If everything went well, in Tekla you will see a new UDA value for each block with the correct color according to the dwg file. Now you can work with this information in the Tekla environment. This is quite a simple situation but you can do a lot of complicated things with Grasshopper and Tekla live link.

--

--

few hours with…

Writing a blog about learning and exploring new stuff just for fun.