Skip to content

Instantly share code, notes, and snippets.

@ednisley
Last active July 14, 2016 20:29
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/86b0373f8cd120db2578c52924ab9eb3 to your computer and use it in GitHub Desktop.
Save ednisley/86b0373f8cd120db2578c52924ab9eb3 to your computer and use it in GitHub Desktop.
OpenSCAD source code: BOB Yak Fender Mount Repair Plates
// BOB Yak Fender Mounting Bracket
// Ed Nisley - KE4ZNU - July 2016
Layout = "Build"; // Build Fender Rod BlockInner BlockOuter
//- Extrusion parameters must match reality!
// Print with 1 shell and 3 solid layers
ThreadThick = 0.25;
ThreadWidth = 0.40;
HoleWindage = 0.3;
Protrusion = 0.1; // make holes end cleanly
inch = 25.4;
//----------------------
// Dimensions
IR = 0; // radii seem easier to measure here
OR = 1;
LENGTH = 2;
Fender = [25,220,1]; // minor major thickness
FenderSides = 128;
FenderRod = [5.0/2,(Fender[IR] + 10),5.0/2]; // support rod dia/2, arch radius, rod dia/2 again
ChordMajor = Fender[OR] - sqrt(pow(Fender[OR],2) - pow(40,2)/4);
ChordMinor = Fender[IR] - sqrt(pow(Fender[IR],2) - pow(25,2)/4);
ChordFit = max(ChordMajor,ChordMinor);
echo("Chords: ",ChordMajor,ChordMinor,ChordFit);
BlockInnerOA = [40,25,1 + ChordFit];
BlockOuterOA = [35,25,2 + ChordFit];
echo(str("Inner Block: ",BlockInnerOA));
echo(str("Outer Block: ",BlockOuterOA));
ScrewOD = 5.0;
ScrewOC = 20.0;
NumSides = 6*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);
}
module FenderShape() {
rotate([90,0*180/FenderSides,0])
rotate_extrude(angle=180,$fn=FenderSides)
translate([(Fender[OR] - Fender[IR]),0])
circle(r=Fender[IR],$fn=2*NumSides);
}
module RodShape() {
rotate([90,0*180/FenderSides,0])
rotate_extrude(angle=180,convexity=2,$fn=FenderSides)
translate([(FenderRod[OR] - FenderRod[IR]),0])
circle(r=FenderRod[IR],$fn=NumSides);
}
module BlockInner() {
intersection() {
difference() {
linear_extrude(height=BlockInnerOA[LENGTH],convexity=3)
hull() {
for (i=[-1,1])
translate([i*(BlockInnerOA[0]/2 - BlockInnerOA[1]/2),0,0])
circle(d=BlockInnerOA[1]);
}
for (i=[-1,1])
translate([i*(ScrewOC/2),0,-Protrusion])
PolyCyl(ScrewOD,2*BlockInnerOA[2],6);
}
translate([0,0,(BlockInnerOA[2] - Fender[OR])])
FenderShape();
}
}
module BlockOuter() {
difference() {
linear_extrude(height=BlockOuterOA[LENGTH],convexity=4)
hull() {
for (i=[-1,1])
translate([i*(BlockOuterOA[0]/2 - BlockOuterOA[1]/2),0,0])
circle(d=BlockOuterOA[1]);
}
for (i=[-1,1])
translate([i*(ScrewOC/2),0,-Protrusion])
PolyCyl(ScrewOD,2*BlockOuterOA[2],6);
translate([0,0,(BlockOuterOA[2] - ChordFit + Fender[OR])])
rotate([180,0,0])
FenderShape();
translate([0,0,(FenderRod[OR] - 2*FenderRod[IR])])
rotate([180,0,90])
RodShape();
}
}
//- Build things
if (Layout == "Fender")
FenderShape();
if (Layout == "Rod")
RodShape();
if (Layout == "BlockInner")
BlockInner();
if (Layout == "BlockOuter")
BlockOuter();
if (Layout == "Build") {
translate([0,-BlockInnerOA[0]/2,0])
BlockInner();
translate([0,BlockOuterOA[0]/2,0])
BlockOuter();
}
@ednisley
Copy link
Author

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