Skip to content

Instantly share code, notes, and snippets.

@robshep
Last active April 26, 2019 14:46
Show Gist options
  • Save robshep/8070e48b96d27fa5de5d8855d47443d1 to your computer and use it in GitHub Desktop.
Save robshep/8070e48b96d27fa5de5d8855d47443d1 to your computer and use it in GitHub Desktop.
box in pipe
OD = 106; // outer diameter
PLATE_TH = 2; // base plate thickness
RING_TH = 5; // ring thickness
RING_DEPTH = 12; // depth of outer fixing ring
BOX_W = 35; // width of supplied enclosure
BOX_L = 50; // length of supplied enclosure
BOX_D = 12; // height of box grab. (20mm deep box)
module sector(radius, angles, fn = 100) {
r = radius / cos(180 / fn);
step = -360 / fn;
points = concat([[0, 0]],
[for(a = [angles[0] : step : angles[1] - 360])
[r * cos(a), r * sin(a)]
],
[[r * cos(angles[1]), r * sin(angles[1])]]
);
difference() {
circle(radius, $fn = fn);
polygon(points);
}
}
module arc(radius, angles, width = 1, fn = 100) {
difference() {
sector(radius + width, angles, fn);
sector(radius, angles, fn);
}
}
// base plate with drain slots
module baseplate(){
difference(){
color("teal")
cylinder(h=PLATE_TH,d=OD,center=true, $fn=100); // top plate
cylinder(h=9,d=33,center=true, $fn=100); // center cut-out
translate([0,0,-3]) {
for(n = [0 : 60 : 360])
// drain slots
linear_extrude(6) arc(OD/2-12, [n+12, n+60], 3);
}
}
}
// sides to snugly locate a suppled box
module box_grab(){
difference(){
GRAB_Z_PLANE_CENTER = PLATE_TH/2 + BOX_D/2 - 0.01; // wierd artifacting drop by a smidge
BOX_GRAB_DIA = sqrt( pow(BOX_W,2) + pow(BOX_L,2) ) +3;
translate([0,0, GRAB_Z_PLANE_CENTER]) {
cylinder(h=BOX_D,d=BOX_GRAB_DIA + 1,center=true, $fn=200);
}
translate([0,0, GRAB_Z_PLANE_CENTER]) {
cube([BOX_W,BOX_L,BOX_D+10],center=true, $fn=200);
}
translate([0,0, GRAB_Z_PLANE_CENTER]) {
cube([10,BOX_GRAB_DIA+5,BOX_D+10],center=true, $fn=200);
}
translate([0,0, GRAB_Z_PLANE_CENTER]) {
cube([BOX_GRAB_DIA+5,20,BOX_D+10],center=true, $fn=200);
}
}
}
// fixing ring to attach plate to inside of a pipe
module fixing_ring(){
SCREW_HOLE_DIA = 2; // self-tapper pilot
difference(){
// raise by .01 to get rid of rendering artifacts of adjacent planes
ringz = ((RING_DEPTH/2)+(PLATE_TH/2))+0.01;
color("aquamarine")
// lower fixing ring outer
translate([0,0,ringz])
cylinder(h=RING_DEPTH,d=OD,center=true, $fn=200);
// lower fixing ring inner-cutout
translate([0,0,ringz])
cylinder(h=30,d=OD-(2*RING_TH),center=true, $fn=200);
// punch through two screw holes in outer ring
for(a=[0: 45 : 360])
translate([0,0,ringz])
rotate([90,0,a])
cylinder(h=OD+4,d=SCREW_HOLE_DIA,center=true, $fn=200);
}
}
union(){
baseplate();
box_grab();
fixing_ring();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment