Created
July 5, 2022 00:06
-
-
Save NigelThorne/2592ba2448b244a4e5be791d4dd188aa to your computer and use it in GitHub Desktop.
An OpenScad model of an infinite cube.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fn=40; | |
sz=10; | |
module ccube(x,y,z){ | |
gap=0.4; | |
ch=(sz+gap)*0.25; | |
xoffset = sz * x; | |
yoffset = sz * y; | |
zoffset = sz * z; | |
csz=sqrt(sz*sz*2); | |
c=csz-ch; | |
s=sz-gap; | |
# translate([xoffset,yoffset,zoffset]) | |
intersection (){ | |
intersection (){ | |
intersection (){ | |
cube([s,s,s],center=true); | |
rotate([0,0,45]) cube([c,c,c],center=true); | |
} | |
rotate([0,45,0]) cube([c,c,c],center=true); | |
} | |
rotate([45,0,0]) cube([c,c,c],center=true); | |
} | |
} | |
module jjoin(x,y,z,rot=[0,0,0],pad=0,g=0){ | |
cd=sz/2; | |
h=-g+sz/2; | |
d=-g+sz/2; | |
p=-g+sz/5.5; | |
co=cd/2; | |
xoffset = sz * x; | |
yoffset = sz * y; | |
zoffset = sz * z; | |
translate([xoffset,yoffset,zoffset]) | |
rotate(rot) | |
difference () { | |
difference () { | |
union() { | |
translate([-co,0,0]) cylinder(h=h,d=d,center=true); | |
translate([co,0,0]) cylinder(h=h,d=d,center=true); | |
translate([-co,-pad,0]) cylinder(h=h,d=d,center=true); | |
translate([co,-pad,0]) cylinder(h=h,d=d,center=true); | |
translate([-co-d/2,-pad,-h/2]) cube([d+2*co,pad,h]); | |
translate([-co,-pad-d/2,-h/2]) cube([2*co,d,h]); | |
translate([-co,-d/2,-h/2]) cube([2*co,d,h]); | |
translate([-co,0,h/2]) cylinder(h=p,d1=d/2,d2=0); | |
rotate([180,180,0]) translate([-co,0,h/2]) cylinder(h=p,d1=d/2,d2=0); | |
} | |
translate([-co,0,-0.01-h/2]) cylinder(h=p+g,d1=g+d/2,d2=0); | |
} | |
rotate([180,180,0]) translate([-co,0,-0.01-h/2]) cylinder(h=p+g,d1=g+d/2,d2=0); | |
} | |
} | |
layer=0; | |
union(){ | |
difference() | |
{ | |
union(){ | |
for( column = [0 : 1] ){ | |
for( row = [0 : 3] ){ | |
ccube(row,column,layer); | |
} | |
} | |
} | |
union(){ | |
jjoin(1.5,-0.25,0,[0,0,0],sz); | |
jjoin(1.5,1.25,0, [0,0,180],sz); | |
jjoin(0.5,1,-0.25,[90,0,0],sz); | |
jjoin(0.5,0,-0.25,[90,0,0],sz); | |
jjoin(2.5,1,-0.25,[90,0,0],sz); | |
jjoin(2.5,0,-0.25,[90,0,0],sz); | |
jjoin(3,0.5,0.25, [-90,00,90],sz); | |
jjoin(0,0.5,0.25, [-90,00,90],sz); | |
} | |
} | |
jjoin(1.5,-0.25,0,[0,0,0],g=0.5); | |
jjoin(1.5,1.25,0, [0,0,180],g=0.5); | |
jjoin(0.5,1,-0.25,[90,0,0],g=0.5); | |
jjoin(0.5,0,-0.25,[90,0,0],g=0.5); | |
jjoin(2.5,1,-0.25,[90,0,0],g=0.5); | |
jjoin(2.5,0,-0.25,[90,0,0],g=0.5); | |
jjoin(3,0.5,0.25, [-90,00,90],g=0.5); | |
jjoin(0,0.5,0.25, [-90,00,90],g=0.5); | |
} | |
Author
NigelThorne
commented
Jul 5, 2022
sorry for the crazy variable names :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment