looking for script or algorithm to generate an octet truss

I want to find or write a script to generate a 3 dimensional octet truss in blender. It is made of tetrahedra and octahedra joined in a repeating pattern. Like the picture, I want to connect the points with cylinders, and that’s where I’m getting stuck. I’ve found several ways to compute the points of a tetrahedron, but I can’t figure out how to connect them with cylinders that are turned to the correct angles. I haven’t even been able to create one manually because I haven’t figured out how to compute the angles.
If anyone has any pointers or suggestions I’d appreciate it. I can program, but my math skills are rusty to say the least, that’s why I’m looking for an algorithm more than a formula.


can you show a close up of the joint

may help to figure out the problem !


couldn’t you technically just use an array?

I could if I could get the pipes to the correct angles, but I can’t figure out how to do that.

The easiest way to build a tetrahedron is to start by the default cube and apply the following script:

from Blender import *

ob = Object.Get("Cube")
me = ob.getData(mesh=1)

Should you want it with one side parallel to XOY - a proper rotation shall be applied. May be some translation would be needed too…

Using verts coords it is possible to calculate all angles needed. A lot of math params regarding tetrahedrons are given here. This is to be used when building the figure of pipes only (no flat faces but using the edges as middle line of cylinders or pipes).


If you want to model it manually you should start from 3/6-sided Circle. It has correct angles: 30/60.

Turning back to the original question/issue… I’ve worked a little on it and I created (by a Python script) an octet as shown in the pic of posting #1 above. It is a matter of defining verts needed, then connect them correctly to build the required net (3D one with a bit hex-style look). Sticking a tetrahedron and an octahedron together does form a unit “brick” which then can be duplicated NX,NY,NZ times on the three directions having in mind that the unit “brick” (both the tetrahedron and the octahedron) is built properly by using an unit edge with length = L. Then basically, it is a matter of coating the tiny edges with cylinders having radius r at the base and height = L, then cut properly the cylinders and join then into ONE and ONLY mesh representing the octet. At the beginning it looks like this (includes some non-script processing):


Naturally, the other tiny edges are to be covered in the way shown. I’ve done the “welding” manually by using my cutting tool published here. My difficulty at present is to formulate criteria (angles) to putting the cutting plane where needed at every point (vertex) and iterating ALL possible “faces” there. I know though that the cutting plane shall divide the angle of edges at the vertex by two equal part (bisector)…


EDIT - now with the link to the cutting tool mentioned :wink: