Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created August 21, 2019 17:11
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/ae98e25442131241d2e662657fbceaaf to your computer and use it in GitHub Desktop.
Save ednisley/ae98e25442131241d2e662657fbceaaf to your computer and use it in GitHub Desktop.
OpenSCAD source code: Ruggedized handlebar mount for Zzipper fairing strut on Tour Easy handlebars
// Fairing strut mount for Tour Easy handlebars
// Ed Nisley - KE4ZNU - 2019-08
Layout = "Show"; // [Show,Build,Block]
Support = false;
/* [Hidden] */
ThreadThick = 0.20;
ThreadWidth = 0.40;
HoleWindage = 0.2;
Protrusion = 0.1; // make holes end cleanly
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
ID = 0;
OD = 1;
LENGTH = 2;
inch = 25.4;
//----------------------
// Dimensions
// Handlebar along X axis, strut along Y, Z=0 at handlebar centerline
HandlebarOD = 0.875 * inch + HoleWindage;
StrutOD = 0.375 * inch + HoleWindage;
PlateThick = 1.0 / 16.0 * inch;
WallThick = 2.0;
Screw = [3.0,6.8,4.0]; // M3 OD=washer, length=nut + washers
RoundRadius = IntegerMultiple(Screw[OD]/2,0.5); // corner rounding
ScrewOC = [IntegerMultiple(StrutOD + 2*WallThick + Screw[ID],0.5),
IntegerMultiple(HandlebarOD + 2*WallThick + Screw[ID],0.5)];
echo(str("Screw OC: ",ScrewOC));
BlockSize = [ScrewOC.x + 2*RoundRadius,ScrewOC.y + 2*RoundRadius,HandlebarOD + StrutOD + 3*WallThick];
echo(str("Block: ",BlockSize));
HandleBarOffset = WallThick + HandlebarOD/2; // block bottom to centerline
StrutOffset = HandlebarOD/2 + WallThick + StrutOD/2; // handlebar centerline to strut centerline
echo(str("Screw length: ",BlockSize.z + 2*PlateThick + Screw[LENGTH]));
NumSides = 2*3*4;
//----------------------
// Useful routines
module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
FixDia = Dia / cos(180/Sides);
cylinder(r=(FixDia + HoleWindage)/2,
h=Height,
$fn=Sides);
}
// Basic shapes
// Block with handlebar along X axis
module Block() {
difference() {
hull()
for (i=[-1,1], j=[-1,1])
translate([i*ScrewOC.x/2,j*ScrewOC.y/2,-HandleBarOffset])
cylinder(r=RoundRadius,h=BlockSize.z,$fn=NumSides);
for (i=[-1,1], j=[-1,1])
translate([i*ScrewOC.x/2,j*ScrewOC.y/2,-(HandleBarOffset + Protrusion)])
PolyCyl(Screw[ID],BlockSize.z + 2*Protrusion,8);
translate([-BlockSize.x,0,0])
rotate([0,90,0])
cylinder(d=HandlebarOD,h=2*BlockSize.x,$fn=NumSides);
translate([0,BlockSize.y,StrutOffset])
rotate([90,0,0])
cylinder(d=StrutOD,h=2*BlockSize.y,$fn=NumSides);
}
if (Support) { // totally ad-hoc
color("Yellow")
cube(1,center=true);
}
}
//- Build it
if (Layout == "Block")
Block();
if (Layout == "Show") {
Block();
color("Green",0.25)
translate([-BlockSize.x,0,0])
rotate([0,90,0])
cylinder(d=HandlebarOD,h=2*BlockSize.x,$fn=NumSides);
color("Green",0.25)
translate([0,BlockSize.y,StrutOffset])
rotate([90,0,0])
cylinder(d=StrutOD,h=2*BlockSize.y,$fn=NumSides);
}
if (Layout == "Build") {
translate([-1.2*BlockSize.x,0,HandleBarOffset])
difference() {
Block();
translate([0,0,BlockSize.z])
cube(2*BlockSize,center=true);
}
translate([1.2*BlockSize.x,0,StrutOD/2 + WallThick])
difference() {
rotate([180,0,0])
translate([0,0,-StrutOffset])
Block();
translate([0,0,BlockSize.z])
cube(2*BlockSize,center=true);
}
translate([0,0,StrutOffset])
rotate([180,0,0])
intersection() {
Block();
translate([0,0,StrutOffset/2])
cube([2*BlockSize.x,2*BlockSize.y,StrutOffset],center=true);
}
}
@ednisley
Copy link
Author

More details on my blog at https://wp.me/poZKh-8nV

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