Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created November 7, 2017 23:15
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/ade42e6ed5fdf5b80b0baed48bab48f1 to your computer and use it in GitHub Desktop.
Save ednisley/ade42e6ed5fdf5b80b0baed48bab48f1 to your computer and use it in GitHub Desktop.
OpenSCAD source code: Mostly Printed CNC Endstop Mounts for Makerbot-style PCBs
// Tour Easy Fairing Endstop Mount for Makerbot PCB
// Ed Nisley KE4ZNU - 2017-11-07
/* [Build Options] */
Layout = "Build"; // [Build, Show, Block]
Section = false; // show internal details
/* [Extrusion] */
ThreadThick = 0.25; // [0.20, 0.25]
ThreadWidth = 0.40; // [0.40]
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
/* [Hidden] */
Protrusion = 0.01; // [0.01, 0.1]
HoleWindage = 0.2;
ID = 0;
OD = 1;
LENGTH = 2;
/* [Sizes] */
RailOD = 23.5;
Screw = [3.4,6.8,8.0]; // thread dia, head OD, screw length
HoleOffset = [2.5,19.0/2]; // PCB mounting holes from PCB edge, rail center
SwitchClear = [6.0,15,3.0]; // clearance around switch pins
SwitchOffset = [6.0,0]; // center of switch from holes
Strap = [5.5,50,2.0]; // nylon strap securing block to rail
Block = [16.4,26.0,RailOD/2 + SwitchClear[2] + Strap[2] + 6*ThreadThick]; // basic block shape
//- Adjust hole diameter to make the size come out right
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);
}
//- Shapes
module PCBBlock() {
difference() {
cube(Block,center=true);
translate([(SwitchOffset[0] + HoleOffset[0] - Block[0]/2),SwitchOffset[1],(Block[2] - SwitchClear[2] + Protrusion)/2])
cube(SwitchClear + [0,0,Protrusion],center=true);
for (j=[-1,1])
translate([HoleOffset[0] - Block[0]/2,j*HoleOffset[1],(Block[2]/2 - Screw[LENGTH])])
rotate(180/6)
if (false) // true = loose fit
PolyCyl(Screw[ID],Screw[LENGTH] + Protrusion,6);
else
cylinder(d=Screw[ID],h=Screw[LENGTH] + Protrusion,$fn=6);
translate([0,0,Block[2]/2 - SwitchClear[2] - Strap[2]/2 - 3*ThreadThick])
cube(Strap,center=true);
if (Section)
translate([Block[0]/2,0,0])
cube(Block + [0,2*Protrusion,2*Protrusion],center=true);
}
}
module Mount() {
difference() {
translate([0,0,Block[2]/2])
PCBBlock();
rotate([0,90,0])
cylinder(d=RailOD,h=3*Block[0],center=true);
}
}
//- Build things
if (Layout == "Show") {
Mount();
color("Yellow",0.5)
rotate([0,90,0])
cylinder(d=RailOD,h=3*Block[0],center=true);
}
if (Layout == "Block")
PCBBlock();
if (Layout == "Build")
translate([0,0,Block[2]/2])
rotate([0,-90,0])
Mount();
@ednisley
Copy link
Author

ednisley commented Nov 7, 2017

More details on my blog at https://wp.me/poZKh-79B

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