Skip to content

Instantly share code, notes, and snippets.

@GeoffWilliams
Last active October 2, 2017 02:31
Show Gist options
  • Select an option

  • Save GeoffWilliams/f442f1c577360abaa07239c7168a797f to your computer and use it in GitHub Desktop.

Select an option

Save GeoffWilliams/f442f1c577360abaa07239c7168a797f to your computer and use it in GitHub Desktop.
clips and sockets openscad... clip together pipe
$fn=5;
module beam(w,h,d,j) {
translate([0,0,30-1])
clip(30,30,30,3,7,false );
minkowski() {
sphere(r=1);
difference() {
cube([w,h,d], center=true);
cube([w-j,h-j,d], center=true);
}
}
}
module socket_beam(w,h,d,j) {
difference() {
minkowski() {
sphere(r=1);
difference() {
cube([w,h,d], center=true);
cube([w-j,h-j,d], center=true);
}
}
translate([0,0,-2])
scale([1.05,1.05,1.05])
clip(w-10,h-10,30,j,7, true);
}
// translate([0,0,-1])
//cube([w-j,h-j,d-1], center=true);
//}
}
// j - jut
//k - drop
module clip(w,h,d, j,k,filled=true) {
minkowski() {
sphere(r=1);
difference() {
union() {
translate([0,0,j])
hull() {
translate([0,0,d/2-k])
cube([w,h,k], center=true);
cube([w+j,h+j,j], center=true);
}
// base camfer outer
hull() {
translate([0,0,-d+16])
cube([40,40,1],center=true);
translate([0,0,(d/2-k-d/2)])
cube([30,30,1],center=true);
}
cube([w,h,d], center=true);
}
cube([w-j,h-j,d],center=true);
hull() {
translate([0,0,-d/2])
cube([40-j,40-j,1],center=true);
translate([0,0,(d/2-k-d/2)])
cube([30-j,30-j,1],center=true);
}
// 4x cylinder cutouts
translate([w/2,h/2,d/2-k])
cylinder(r=j*2,h=d,center=true);
translate([-w/2,h/2,d/2-k])
cylinder(r=j*2,h=d,center=true);
translate([-w/2,-h/2,d/2-k])
cylinder(r=j*2,h=d,center=true);
translate([w/2,-h/2,d/2-k])
cylinder(r=j*2,h=d,center=true);
}
}
if (filled) {
cube([w,h,d],center=true);
}
}
//clip(30,30,30,3,7,false );
//translate([0,0,-30])
//beam(40,40,30,3);
translate([0,0,80])
socket_beam(40,40,30,3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment