# Parametric Construction Toy Kit Rod Part

TWEETABLE: Parametric Construction Toy Kit Rod Part is a small reminder of childhood fun and creativity.

For this piece I had considered making an entire assortment of parts that would fit together for building things given all the parameters for the parts. This became too much of an endeavor after waiting 4 minutes for OpenSCAD to compile and render the rounded version of my part. Thus I decided to make just one part, the rod component. The inspiration behind this procedural project is K’NEX.

With radius set to 1 and grooves set to 4.

This configuration is wider with more grooves.

This configuration has grooves that span the whole rod length.

```//CUSTOMIZER VARIABLES

//The length of the rod
length = 40;

//The length of the peg portion
peg_len = 3;

//The length of the rod portion that isn't grooved
non_groove_len = 3;

//Round it?
rounded = 0;//[0, 1]

//The amount of roundness (applied as a sphere's radius applied with minkowski)
roundness = 0.5;

//The number of grooves
grooves = 4;

//Red
R = 140;//[0:255]
//Green
G = 60;//[0:255]
//Blue
B = 40;//[0:255]
//Alpha
A = 255;//[0:255]

//CUSTOMIZER VARIABLES END

\$fn = 50;
rod_color = [R/255.0, G/255.0, B/255.0, A/255.0];

//The diameter of the rod
module rod(length, peg_len = 3, non_groove_len = 3, roundness = 0.5, grooves = 6, rod_rad = 1){
union(){
translate([0,0,peg_len]){
difference(){
cylinder(h = length - 2*peg_len, r = rod_rad);
translate([0,0,non_groove_len]){
for (i = [0:grooves-1]){
rotate([0,0,i*360.0/grooves]){
translate([0.3,0.3*sin(360.0/grooves),0]){
linear_extrude(length - 2*peg_len - 2*non_groove_len){
}
}
}
}
}
}
}
translate([0,0,length - peg_len]){
}
}
}

color(rod_color){
if (rounded==1){
minkowski(){
sphere(roundness);
rod(length, peg_len, non_groove_len, roundness, grooves, rod_rad);
}
} else{
rod(length, peg_len, non_groove_len, roundness, grooves, rod_rad);
}
}
```

[TODO: sketches , github]

This entry was posted in 23-parametricobject on .