Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ednisley/80c51322d9ed986a6a2003f310a9ce82 to your computer and use it in GitHub Desktop.
Save ednisley/80c51322d9ed986a6a2003f310a9ce82 to your computer and use it in GitHub Desktop.
OpenSCAD source code: Flashlight mount ball
//- Ball around flashlight
// Must print two!
module BodyBall() {
difference() {
intersection() {
sphere(d=BallOD,$fn=2*NumSides); // basic ball
cube([BallLength,2*BallOD,2*BallOD],center=true); // max of flashlight grip length
}
translate([-LightBodies[FlashIndex][F_GRIPOD],0,0])
rotate([0,90,0]) rotate(180/NumSides)
PolyCyl(LightBodies[FlashIndex][F_GRIPOD],2*BallOD,NumSides); // flashlight body
for (j=[-1,1])
translate([0,j*BallScrewOC/2,0]) // commmon screw offset
translate([0,0,-BallOD])
PolyCyl(BallInsert[ID],2*BallOD,6); // punch screw shaft through everything
translate([0,BallScrewOC/2,-Protrusion])
PolyCyl(BallInsert[OD],(BallInsert[LENGTH] + 3*ThreadThick + Protrusion),6); // threaded insert
translate([0,-BallScrewOC/2,BallThick])
PolyCyl(BallScrew[OD],BallOD,6); // screw head clearance
translate([0,0,-BallOD/2]) // remove bottom half
cube(BallOD,center=true);
translate([0,0,BallOD - BallThick/2]) // slice off top = bottom for E-Z build
cube(BallOD,center=true);
}
if (Support) {
NumRibs = 24;
RibHeight = (BallOD - LightBodies[FlashIndex][F_GRIPOD]/cos(180/NumSides) - BallThick) / 2;
ChordC = 2*sqrt(BallThick*BallOD/2 - pow(BallThick/2,2));
intersection() {
cube([BallLength,2*BallOD,2*BallOD],center=true); // max of flashlight grip length
translate([0,0,BallOD/2 - BallThick/2])
for (i=[0:NumRibs - 1])
rotate(i*360/NumRibs + 180/NumRibs) // avoid screw holes
translate([ChordC/2 + BallOD/8,0,-RibHeight/2])
cube([BallOD/4,2*ThreadWidth,RibHeight],center=true);
}
}
}
@ednisley
Copy link
Author

More details on my blog at http://wp.me/poZKh-6V3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment