Created
July 18, 2017 17:41
-
-
Save ednisley/68bbd7727856b56c2554e5163c11eb39 to your computer and use it in GitHub Desktop.
OpenSCAD source code: Flashlight mount ball clamp
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
//- Clamp around flashlight ball | |
module BallClamp() { | |
BossLength = ClampScrew[LENGTH] - ClampScrewNut[LENGTH] - 2*ClampScrewWasher[LENGTH] - 4*ThreadThick; | |
difference() { | |
union() { | |
intersection() { | |
sphere(d=ClampOD,$fn=NumSides); // exterior ball blamp | |
cube([ClampLength,2*ClampOD,2*ClampOD],center=true); // aiming allowance | |
} | |
for (i=[0]) | |
hull() { | |
for (j=[-1,1]) | |
translate([i*(ClampLength/2 - ClampScrew[OD]),j*ClampScrewOC/2,-BossLength/2]) | |
rotate(180/8) | |
cylinder(d=(ClampScrewWasher[OD] + 2*ThreadWidth),h=BossLength,$fn=8); | |
} | |
} | |
sphere(d=(BallOD + 1*ThreadThick),$fn=NumSides); // interior ball | |
for (i=[0] , j=[-1,1]) { | |
translate([i*(ClampLength/2 - ClampScrew[OD]),j*ClampScrewOC/2,-ClampOD]) // screw clearance | |
rotate(180/8) | |
PolyCyl(ClampScrew[ID],2*ClampOD,8); | |
} | |
} | |
color("Yellow") | |
if (Support) { // ad-hoc supports for top half | |
NumRibs = 6; | |
RibLength = 0.5 * BallOD; | |
RibWidth = 1.9*ThreadWidth; | |
SupportOC = ClampLength / NumRibs; | |
cube([ClampLength,RibLength,4*ThreadThick],center=true); // base plate for adhesion | |
intersection() { | |
sphere(d=BallOD - 0*ThreadWidth); // cut at inner sphere OD | |
cube([ClampLength + 2*ThreadWidth,RibLength,BallOD],center=true); | |
union() { // ribs for E-Z build | |
for (j=[-1,0,1]) | |
translate([0,j*SupportOC,0]) | |
cube([ClampLength,RibWidth,1.0*BallOD],center=true); | |
for (i=[0:NumRibs]) // allow +1 to fill the far end | |
translate([i*SupportOC - ClampLength/2,0,0]) | |
rotate([0,90,0]) | |
cylinder(d=BallOD - 2*ThreadThick, | |
h=RibWidth,$fn=NumSides,center=true); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More details on my blog at http://wp.me/poZKh-6Vc