0

Joey Bouzek’s OpenSCAD Code

For Loop Object

Here is my for loop coding object. I am terrible at coding, but luckily my friend is doing it for their major so they explained how to do stuff.

20 Objects with Codes

 

intersection_for(i = [

[0, 0, 0],

[10, 20, 300],

[200, 40, 57],

[20, 88, 57]

])

rotate(i) cube([100, 20, 20], center = true);

difference(){

cube([25,25,50], center=true);

cube([25-x,25-x,50], center=true);

}

difference()

{

for(i=[0:2])

rotate([0,20*i,0])

cylinder(r=50,h=70);

 

for(i=[0:2])

rotate([0,120*i,0])

translate([0,0,-1])

cylinder(r=40,h=72);

}

{        sphere(30);        cube(60, true);        cylinder(r = 30, h = 50, center = true);            union() {            cube(45, true);            rotate([45, 0, 0]) cube(50, true);            rotate([0, 45, 0]) cube(50, true);            rotate([0, 0, 45]) cube(50, true);        }    }

module lineup(num, space) {

for (i = [-5 : num-1])

translate([ space*i, 0, 0 ]) child(0);

}

lineup(10, 40) cube(20);

for(i=[0:45:360])

{

rotate([0,0,i])

{

echo(i);

square([10,10]);

}

}

pathRadius=2;

num=10;

difference(){

cylinder(r=3, h=.1, $fn=300);

for (i=[1:num])  {

translate([pathRadius*cos(i*(360/num)),pathRadius*sin(i*(360/num)),0]) cylinder(r=1.5,h=.1, $fn=120);

}

cube(size=[10.5,.5,1], center=true);

}

difference() {

square();

scale(v=[0.8, 0.8, 1.1]) square();

}

module elongate (){

for (i = [0 : $children-1]){

scale([10 , 1, 1 ]) child(i);

}

}

for ( i = [0 : 0.4 : 10] ){

rotate( i * 50, [1, 0, 0])

translate([0, 8, 0])

sphere(r = 1.2);

}

$fn=46;

for ( i = [0 : 10] ){

rotate( i * 70, [1, 0, 0])

translate([0, 15, 0])

sphere(r = 10);

}

translate([29, 0,0]){

difference(){

cube(10, center=true);

sphere(5);

}

for (i = [5:25]){

assign (angle = i*360/40, distance = i*20, r = i*2){

rotate(angle, [1, 0, 0])

translate([0, distance, 0])

sphere(r = r);

}

}

intersection(){

cube(10, center=true);

sphere(5);

}

$fn=20;
for(r=[0:30:360])
rotate([0,r,0])translate([0,0,19])join(2)
{ rotate([0,15,0])translate([5,0,0])torus(1,3);
mirror([1,0,0])
rotate([0,15,0])translate([5,0,0])torus(1,3);}
module join(w){
children();
segs=4;
for(i=[0:w/segs:w])
{ planecutX(1+i, 1-(i/w)*0.8)
children(0);
planecutX(-1-i, 1-(i/w)*0.8)
children(1);}}
module planecutX(offs=0,s=0.75)
{rotate([0,-90,0])
translate([0,0,-offs])
mirror([0,0,min(0,sign(offs))])
linear_extrude( abs(offs),scale=max(0,s))
projection(cut = true) {
translate([0,0,offs])rotate([0,90,0])children();
//translate([0,0,-offs])rotate([0,90,0])children();
}}
module torus(r1=1,r2=3)
{rotate_extrude()
translate([r2,0,0])circle(r1);}

pathRadius=2;

num=8;

for (i=[1:num])  {

translate([pathRadius*cos(i*(360/num)),pathRadius*sin(i*(360/num)),0]) cylinder(r=.5,h=10.1, $fn=20);

}

union() {

square(45, true);

rotate([45, 0, 0]) square(50, true);

rotate([0, 45, 0]) square(50, true);

rotate([0, 0, 45]) square(50, true);

}

translate([-29,0,0]) {

union (){

cube(15, center=true);

sphere(10);

}

}

for (i = [0:10]) {

echo(360*i/6, sin(360*i/6)*40, cos(360*i/6)*40);

translate([sin(360*i/6)*40, cos(360*i/6)*40, 0 ])

cylinder(h = 5, r=5);

}

for (i =  [0 : 0.1 : 6]) {

echo(360*i/6, sin(360*i/6)*40, cos(360*i/6)*40);

translate([sin(360*i/6)*40, cos(360*i/6)*40, 0 ])

cylinder(h = 5, r=5);

}

{

rotate_extrude(angle=180, convexity=10)

translate([8,0,0])

square([2,10]);

}

bouzekjc

Leave a Reply

Your email address will not be published. Required fields are marked *