Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OpenSCAD source code: Repleacement pegs for Shuttles game
// Shuttles game pegs
// Ed Nisley KE4ZNU - July 2020
/* [Layout Options] */
Layout = "Peg"; // [Build, Peg]
Hollow = false;
//-------
//- Extrusion parameters must match reality!
/* [Hidden] */
ThreadThick = 0.25;
ThreadWidth = 0.40;
HoleWindage = 0.2;
Protrusion = 0.1; // make holes end cleanly
ID = 0;
OD = 1;
LENGTH = 2;
//-------
// Dimensions
/* [Dimensions] */
Peg = [4.0,7.5,26.0]; // overall length, including the rounded Cap
Taper = 1.0;
CapRadius = Peg[OD]/2;
PegBaseLength = Peg[LENGTH] - CapRadius;
NumPegs = [1,6]; // lay out in array
ArrayCenter = [NumPegs[0] - 1,NumPegs[1] - 1] / 2;
NumSides = 6*4;
//-------
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/2 + HoleWindage,h=Height,$fn=Sides);
}
//-------
// One peg
module Peg() {
union() {
translate([0,0,PegBaseLength])
difference() {
sphere(d=Peg[OD],$fn=NumSides);
translate([0,0,-Peg[OD]/2])
cube([2*Peg[OD],2*Peg[OD],Peg[OD]],center=true);
}
difference() {
cylinder(d1=Peg[OD] - Taper,d2=Peg[OD],h=PegBaseLength,$fn=NumSides);
if (Hollow)
translate([0,0,-Protrusion])
PolyCyl(Peg[ID],PegBaseLength+Protrusion,NumSides);
}
}
}
//-------
// Build it!
if (Layout == "Peg")
Peg();
if (Layout == "Build")
for (i=[0:NumPegs[0] - 1], j=[0:NumPegs[1] - 1])
translate([(i - ArrayCenter.x)*1.5*Peg[OD],(j - ArrayCenter.y)*1.5*Peg[OD],0])
Peg();
@ednisley

This comment has been minimized.

Copy link
Owner Author

@ednisley ednisley commented Jul 22, 2020

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