Grasshopper-Tekla Live Link — find the closest object and add connection component

few hours with…
5 min readFeb 6, 2022

From time to time I have quite large Tekla models which need upgrades after receiving additional information. As I am not a big fan of repetitive tasks I usually create some kind of components. If you also use components you probably know that Detail components are the best — just create a component, filter necessary details, and apply to all with one click. But sometimes we need to use the Connection component, it's quite a powerful tool from Tekla but it requires clicking on two or more objects just to add one component. If you have 10–20 elements, it's probably not a big deal, but what if you have hundreds or thousands of elements that need to use the Connection component? My answer would be — Rhinos Grasshopper.

In this tutorial, I will show you how you can use Grasshoppers tools to apply the Teklas Connection component to a lot of elements with a few clicks. An example I will show a very easy example when you need to connect just two pieces, but you can upgrade the solution to use a lot more connections.

In the beginning, we need some Tekla elements to work with. For that, I prepared some grid of beams (squared-tubes). With small modifications, it can also be done with plates or mixed plates + beams.

I colored beams in two colors just so it's easier to see which details I'm planning to connect. Also, I created one connection component which connect's these two nearest details with another beam and screws. If you were doing it manually, you would need to click on purple and then on green, to activate the component.

Now we have everything prepared to start working in Grasshopper. Open Grasshopper and add two “Model object” blocks to canvas. Two follow along easier you can rename them for example “first beams” and “second beams”. Next, right-click on the first block, choose “Select Multiple Model Objects” and then choose all purple beams in Tekla. Do the same with the second block, just choose all green ones. After you select beams in Tekla remember to accept selection with the middle mouse button. This time we will need to use not just the Grasshoppers plugin but also Rhino to see what we are doing. In Rhino double click on view named “Perspective”, so it's full screen. Now you can scroll out till you see lines in green or red (depends if active in Grasshopper). At this moment we can see in Rhino what we have imported from Tekla (lines represent the distance between beam handles in Tekla).

To start working with beams add two “Deconstruct Beam” blocks to canvas and feed Tekla beams to them. Now add “Curve Middle” and feed Curve from the first beam “Deconstruct Beam” block. If you select this “Middle Curve” block and check Rhino you will see that in the middle of the first beams is a small green x symbol.

We will use this to create a cube element and this point will be a reference point for it. Why we need a cube I will explain later. Next, add “Number Slider” or “Panel” and give a value of 200, we will use it in a minute. Add “Center Box” and feed previously created value 200 to X, Y, and Z. Feed midpoint from “Curve Middle” to “Centre Box” base. In Rhino there should be small cubes around the middle points.

We need to get these boxes on second beams, so later it can be recognized which two beams need to be connected. To move the box to right we will use the “Move” block and “Panel” block. In the “Panel” block add value in square bracket “{400,0,0}” and feed it to “Move” blocks Motion. For Geometry feed “Curve Middle” clocks Midpoint. Now change “Cente Box” Base with Geometry from “Move” and you will see how the box moves to other (green) beams.

Now, let's get back to the second beams. Add another “Curve Middle” block and feed Curve from the second “Deconstruct Beam” block. Now in Rhino, you can see that the second beam middle parts x symbol is inside our cubes. The idea behind it — now we will find which middle point is in which box. To do so we need a “Point In Brep” block. Click the right mouse button on Brep and click Graft. Now let's feed lines to our new block — add “Centre Box” to Brep and second “Curve Middle” block to Point.

Now we have information about which middle point is in which box, let's filter new data to get two clean lists. Add “Cull Pattern” block and feed “Points In Brep” to Cull Pattern and “second beams” block to list. Add new “Model Object” block and feed new results from “Cull Pattern”. Right-click on “Model Object” and click Flatten. Now you have the original “first beams” list and this new “Model Object” list with second beams sorted in the same order as “first beams”. So now we need to pass this information back to Tekla. Firstly let's add the “Component Catalog” block, double click on the name and there will be a new pop-up window where you can type in your custom components name, when you find it — click on it and select OK. And let's add finely block “Component” and feed “Component Catalog” to Name, “first beams” to Main Part, and new “Model Object” to Secondary. At this moment Tekla will put components to all tube pairs.

Final block scheme:

--

--

few hours with…

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