dave

09 Feb 2015

Twisty Tentacle Generator

314 6

I wanted to make something organic, and sprouting out tentacles came into mind immediately. Cordscrew/spirals are also found in many organic objects also, so I wanted to incorporate that too. I made the code such that the number of tentacles, the lengths , the variation in lengths, the twist amount and variation, the offset of the twist, and the width of the tendrils are all customizable, which allows me to generate vastly different looking objects. I was initially reluctant to make this, because most of the examples I have seen of OpenSCAD are more angular and based on industrial shapes. However after digging through the documentation I found many build in functionalities that allows me to basically achieve the exact look I was going for.

Sketches:

IMG_20150208_235753982

 

 

[sketchfab id=”db9c04f4154242318eb2352ff340bd03″ height=”480″ start=”0″ controls=”0″]

[sketchfab id=”f1f65a2ec9a545bda2773012378e3527″ height=”480″ start=”0″ controls=”0″]

Code:

/*
    n: number of tentacles
    h: height
    dh: height variation
    t: twist
    dt: twist variation
    o: offset
    w: width of tendrils
 */
module generate(n, h, dh, t, dt, o, w)
{       
    randomh = rands(-dh,dh,n);
    randomt = rands(-dt,dt,n);

    for(i = [0:n-1])
    {
        rotate(rands(0,360,3))
        {
            translate([-20, 0, 0])
                linear_extrude(height = h, 
                               center = false, 
                               convexity = 10, 
                               twist = t + randomt[i], 
                               scale=-1, 
                               slices = 10)
                        translate([o, 0, 0])
                        circle(r = w);
        }
    }
}
generate(50, 200, 100, -500, 200, 40, 10);