We have been experimenting a lot lately with 3D printed joinery for complex piped networks. A major effort has been to find a way to reduce the amount of material in the print in order to minimize the cost. Naturally, we wanted to automate this process so we developed a script in grasshopper that takes any network of curves and generates the smallest joint possible at every intersection. A bit of math made this possible and if you click through you’ll see the logic.
In the meantime you can grab the definition here: Min_Length_Joint (note: The RemoveDuplicateLines component from Kangaroo is necessary)
The lines we are inputting are “dumb”. That is to say they are not part of a network and have no clue which lines they are connected to. The first part of the script sorts through the lines and intersection points and returns each point with the lines connected to it as vectors radiating away from the point.
The idea is the segments will be some kind of pipe. Because of this the joints need to be just big enough so that the pipes don’t intersect with their neighbors (fig.1). The size of the connection is dependent on two things; the radius of the pipe and the angle between it and it’s neighbors (fig.2). Since each pipe has multiple neighbors at different angles we need to find the smallest angle between each center-line and its neighbor (fig.3). Once the smallest angle is found a geometric relationship can be set up between the radius the angle and the minimum length of the joint via two identical right triangles(fig.4).
From there we just need to recall our 8th grade trig to set up a tangent function and find the minimum length. The length is then used to create a new line along the vectors we previously found and then we can pipe and boolean all the pipes together to create our joint.