Last active
September 13, 2016 22:11
-
-
Save rbuckland/05c28f259d5136492b48df5807f0075f to your computer and use it in GitHub Desktop.
makes a rounded box in openscad with a radius
This file contains hidden or 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
module move(x=0,y=0,z=0,rx=0,ry=0,rz=0) { translate([x,y,z])rotate([rx,ry,rz]) children(); } | |
module rounded_cube(dimensions, rad) { | |
x=dimensions[0]; | |
y=dimensions[1]; | |
z=dimensions[2]; | |
hull() { | |
#move(ry=90,y=y/2-rad,z=z/2-rad) pill(rad=rad,h=x); | |
#move(ry=90,y=-(y/2-rad),z=z/2-rad) pill(rad=rad,h=x); | |
#move(ry=90,y=y/2-rad,z=-(z/2-rad)) pill(rad=rad,h=x); | |
#move(ry=90,y=-(y/2-rad),z=-(z/2-rad)) pill(rad=rad,h=x); | |
} | |
} | |
module pill(rad,h) { | |
end_center_l = h - (rad*2); | |
cylinder(r=rad,h= end_center_l ,center=true); | |
move(z=end_center_l/2) sphere(r=rad,center=true); | |
move(z=-end_center_l/2) sphere(r=rad,center=true); | |
} | |
!rounded_cube([40,80,70],3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment