Grasshopper-Tekla Live Link — how to find duplicated elements

few hours with…
6 min readJan 30, 2022

A few days ago I got some silly mistake in my Tekla model. Long story short — I got duplicated objects copied over each other a couple of times. I didn't find what I did wrong, I had created a few quick components and assume that probably there was some problem. So there was an option to try to delete duplicated details one by one, but the amount was too large and it would take quite a lot of time and I'm too lazy for such repetitive tasks. Another option was to delete all details, try to recreate components, and hope for the best. It would be quicker than doing one-by-one deletion but also unnecessary long time if compared with possibilities that Rhinos Grasshopper offers us.

In this tutorial, I will show you how to remove duplicated elements from Tekla Structures using the Grasshopper plugin.

Let's start by creating a fake model. In this example, I will create small tubes from the beam element and copy them 50 times on Y-axis and 20 times on X-axis. Element size and profile do not matter, the only thing — it must be made as a beam, not a plate. You can do it also with a plate, just need a few small adjustments. So no we have a nice grid to work with. Next, select a few hundred random beams and copy with the same step so they are on each other. I did it on both axes so it's more complicated to find where duplicates are. To make sure you have this problem open “Clash check” and run it to see there are a lot of details with clashes. Now let's create a solution for this on Grasshopper (to follow along you need to have Rhino software and installed Grasshopper-Tekla Live Link).

Open Rhino and navigate to Grasshopper plugin. Let's start by getting “Model Object” in our new empty canvas, it's located in the “Tekla 2019i” tab (if you have a different Tekla version name must include your version. Right-click on “Model Object” and choose “Set Multiple Model Objects”. Now you can select all elements from Tekla or as I do, when creating Grasshopper logic, I use a small amount of Teklas objects so it works faster, and when everything is finished and works then I use it for all elements. Of course, your test set must include at least one duplicated element to make sure it really works. After selecting beams in Tekla you need to push the middle mouse button to accept them. Now we have stored some Tekla beams in the “Model Object”, next add “Deconstruct Beam” and feed “Model Object” to it. Add “End Points” to canvas and feed “Curve” from “Deconstruct Beam”. This block now has information about our Tekla beam start and end coordinates.

Add “Create Set” block to canvas and feed “Start” from the “End Points” block. To see what's happening add to empty “Panel” block and in one feed “Start” from “End Points” and in other feed “Set” from “Create Set”. Now you can see that “End Points” hold all coordinates and duplicated coordinated can be found in the list. “Create Set” block removes all duplicates and you are left only with unique coordinate values.

Now we can group elements by unique coordinates. Add “Evaluate” block to canvas and I usually change variables to shorter ones like A and B (right-click on a variable to change it). Add “Panel” block and insert value “A=B” and feed it to “Evaluate” blocks “Expression”. For value first variable (in my case A) feed on the “Create Set” block “Set”, but here's one important thing. We need to right-click on “Set” and choose “Graft” (feed line will change from solid to dashed). It will create a separate block for each unique value (like a separate list). For the second variable (in my case B) feed “Start” from the “End Points” block.

In my example, there are three unique values and nine beams, so we know six values are duplicates. In our new list from “Evaluate”, we now have three lists and on each list, we have True/ False values. To understand better we need to compare this new list to the previous list from “End Points” and “Create Set”. Here we can see that “Evaluate” creates a result panel with three separate lists. Each list corresponds to info from the previously created “Create Set” panel. As we have nine beams coordinates we need to check each coordinate against unique values from “Create Set, that is why we used to graft on “Set”. Now “Evaluate” block takes for example first coordinate and compere to all nine “End Point” values and in result, it finds that first four elements are True and al other are False. Next, it takes the second coordinate and again compares to all nine values, this time it founds that rows 4–7 are equal and sets them True, others are False. And same for the third unique value, this time 8th is only True, because it doesn't have duplicated beam on it.

Now we have some patterns and we will use them to create lists with Tekla beams. All beams with identical coordinates will fall in one list. To do that let's add the “Cull Pattern” block to canvas and feed from “Evaluate” block “Result” to “Cull Pattern” and from the very first block “Model Object” to “List”. As result, we now have a list of duplicated Tekla beams in separated lists.

From Tekla, we need to remove only duplicates and leave one piece not deleted, so there is one last thing we need to do — remove the first beam of the list. Add “Panel” block and insert value 0. Next, add the “Cull Index” block and feed “List” from “Cull Pattern” to “List” and panel with 0 to “Indices”. Now you have a final list with only duplicates. As you can see in my example, the third list is empty because it has no duplicates.

To interact with Tekla structures and select duplicates add a new block “Model Object” in the end and feed “List” from the “Cull Index” block. Now when you click on “Model Object”, objects in Tekla are going to highlight and you can delete them. Now when you see everything is working, you can clear values from the very first “Model Object” block and add all beams from Tekla. It's gonna take some time to calculate but as result, you will have a list of all duplicated beams. When calculations are done, click on the “Model Object” block at the end of the block and in Tekla, all duplicates will be highlighted, so press delete and you will have no duplicates. To be sure everything went right, do another “Clash Check”. Hope this tutorial helped some of you, thanks for reading, and here is the final block scheme.

--

--

few hours with…

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