Download this thing or ask me how I made it at thingiverse.com
back
snub square torus

//snub_square_torus
v1 = [0, 0];
v2 = [-1, 0];
v3 = [-.5, .8660254038];
v4 = [.3660254038, 1.366025404];
v5 = [.8660254038, .5];
v6 = [.8660254038, -.5];
v7 = [.3660254038, -1.366025404];
v8 = [-.5, -.8660254038];
v9 = [-1.366025404, -1.366025404];
v10 = [-1.866025404, -.5];
v11 = [-1.866025404, .5];
v12 = [-2.366025404, 1.366025404];
v13 = [-1.866025404, 2.23205808];
v14 = [-1.366025404, 1.366025404];
v15 = [-.5, 1.866025404];
v16 = [-1, 2.732050808];
v17 = [0, 2.732050808];

paths = [
v12, v14, v13, v12, v11, v14, v3, v2, v11, v10, v2, v8, v9, v10,
v2, v1, v8, v7, v6, v1, v5, v4, v3, v15, v4,
v14, v15, v3, v1, v5, v6
];

//scaling constant h to make the shape 1 in the x and y directions
h = .3660254037;

list_1 = [
     for(n=[0:12])
     for(t=[0:10])
     let(
         A = paths[n],
         B = paths[n+1],
         x = h*(A[0] + .1*t*(B[0] - A[0])),
         y = h*(A[1] + .1*t*(B[1] - A[1]))
         )
     [x, y]
     ];
    
list_2 = [
     for(n=[14:23])
     for(t=[0:10])
     let(
         A = paths[n],
         B = paths[n+1],
         x = h*(A[0] + .1*t*(B[0] - A[0])),
         y = h*(A[1] + .1*t*(B[1] - A[1]))
         )
     [x, y]
     ];

list_3 = [
     for(n=[25:25])
     for(t=[0:10])
     let(
         A = paths[n],
         B = paths[n+1],
         x = h*(A[0] + .1*t*(B[0] - A[0])),
         y = h*(A[1] + .1*t*(B[1] - A[1]))
         )
     [x, y]
     ];
    
list_4 = [
     for(n=[27:27])
     for(t=[0:10])
     let(
         A = paths[n],
         B = paths[n+1],
         x = h*(A[0] + .1*t*(B[0] - A[0])),
         y = h*(A[1] + .1*t*(B[1] - A[1]))
         )
     [x, y]
     ];

list_5 = [
     for(n=[29:29])
     for(t=[0:10])
     let(
         A = paths[n],
         B = paths[n+1],
         x = h*(A[0] + .1*t*(B[0] - A[0])),
         y = h*(A[1] + .1*t*(B[1] - A[1]))
         )
     [x, y]
     ];

for(l=[0:8])
{
for(m=[0:2])
{
for(n=[0:141])
{
     point_1 = list_1[n];
     point_2 = list_1[n+1];
     hull()
     {
         translate([(9 + 6*cos(point_1[1]*120 + 120*m))*cos(point_1[0]*40 + 40*l),
                     (9 + 6*cos(point_1[1]*120 + 120*m))*sin(point_1[0]*40 + 40*l),
                     6*sin(point_1[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
         translate([(9 + 6*cos(point_2[1]*120 + 120*m))*cos(point_2[0]*40 + 40*l),
                     (9 + 6*cos(point_2[1]*120 + 120*m))*sin(point_2[0]*40 + 40*l),
                     6*sin(point_2[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
     }
}

for(n=[0:108])
{
     point_1 = list_2[n];
     point_2 = list_2[n+1];
     hull()
     {
         translate([(9 + 6*cos(point_1[1]*120 + 120*m))*cos(point_1[0]*40 + 40*l),
                     (9 + 6*cos(point_1[1]*120 + 120*m))*sin(point_1[0]*40 + 40*l),
                     6*sin(point_1[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
         translate([(9 + 6*cos(point_2[1]*120 + 120*m))*cos(point_2[0]*40 + 40*l),
                     (9 + 6*cos(point_2[1]*120 + 120*m))*sin(point_2[0]*40 + 40*l),
                     6*sin(point_2[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
     }
}

for(n=[0:9])
{
     point_1 = list_3[n];
     point_2 = list_3[n+1];
     hull()
     {
         translate([(9 + 6*cos(point_1[1]*120 + 120*m))*cos(point_1[0]*40 + 40*l),
                     (9 + 6*cos(point_1[1]*120 + 120*m))*sin(point_1[0]*40 + 40*l),
                     6*sin(point_1[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
         translate([(9 + 6*cos(point_2[1]*120 + 120*m))*cos(point_2[0]*40 + 40*l),
                     (9 + 6*cos(point_2[1]*120 + 120*m))*sin(point_2[0]*40 + 40*l),
                     6*sin(point_2[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
     }
}

for(n=[0:9])
{
     point_1 = list_4[n];
     point_2 = list_4[n+1];
     hull()
     {
         translate([(9 + 6*cos(point_1[1]*120 + 120*m))*cos(point_1[0]*40 + 40*l),
                     (9 + 6*cos(point_1[1]*120 + 120*m))*sin(point_1[0]*40 + 40*l),
                     6*sin(point_1[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
         translate([(9 + 6*cos(point_2[1]*120 + 120*m))*cos(point_2[0]*40 + 40*l),
                     (9 + 6*cos(point_2[1]*120 + 120*m))*sin(point_2[0]*40 + 40*l),
                     6*sin(point_2[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
     }
}

for(n=[0:9])
{
     point_1 = list_5[n];
     point_2 = list_5[n+1];
     hull()
     {
         translate([(9 + 6*cos(point_1[1]*120 + 120*m))*cos(point_1[0]*40 + 40*l),
                     (9 + 6*cos(point_1[1]*120 + 120*m))*sin(point_1[0]*40 + 40*l),
                     6*sin(point_1[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
         translate([(9 + 6*cos(point_2[1]*120 + 120*m))*cos(point_2[0]*40 + 40*l),
                     (9 + 6*cos(point_2[1]*120 + 120*m))*sin(point_2[0]*40 + 40*l),
                     6*sin(point_2[1]*120 + 120*m)])
         {
             sphere($fn=20, .5, true);
         }
     }
}
}
}