Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created February 22, 2026 19:14
Show Gist options
  • Select an option

  • Save ednisley/3ce1f80d2f4748e8062212d1ae884606 to your computer and use it in GitHub Desktop.

Select an option

Save ednisley/3ce1f80d2f4748e8062212d1ae884606 to your computer and use it in GitHub Desktop.
OpenSCAD source code: Replacement cap for Crosman BB bottle
// Crosman BB bottle cap
// Ed Nisley - KE4ZNU
// 2026-02-22
include <BOSL2/std.scad>
Layout = "Show"; // [Show,Build,Section]
/* [Hidden] */
ID = 0;
OD = 1;
LENGTH = 2;
HoleWindage = 0.2;
Protrusion = 0.1;
NumSides = 6*3*4;
$fn=NumSides;
WallThick = 1.0;
Heights = [1.2,2.0,13.0,WallThick]; // for easy tweaking
Ring = [34.5,39,WallThick];
Strap = [70.0,5.0,Ring[LENGTH]];
CapOAL = sum(Heights);
//-----
// Conjure it with magic numbers
module Cap() {
tube(Heights[0],id=16.8,wall=WallThick+0.6/2,anchor=BOTTOM) position(TOP)
tube(Heights[1],id=17.4,wall=WallThick,anchor=BOTTOM) position(TOP)
tube(Heights[2],id1=17.4,id2=14.0,wall=WallThick,anchor=BOTTOM) position(TOP)
cyl(Heights[3],d=14.0+2*WallThick,rounding2=WallThick/2,anchor=BOTTOM) position(BOTTOM)
cuboid(Strap,anchor=BOTTOM+LEFT) position(BOTTOM+RIGHT)
left(1.0)
tube(Ring[LENGTH],id=Ring[ID],od=Ring[OD],anchor=BOTTOM+LEFT);
}
//-----
// Build things
if (Layout == "Show") {
Cap();
}
if (Layout == "Section") {
difference() {
Cap();
down(Protrusion)
cuboid(2*Strap.x,anchor=BOTTOM+LEFT+FRONT);
}
}
if (Layout == "Build") {
back(Strap.x/2)
zrot(90)
up(CapOAL)
yrot(180)
Cap();
}
@ednisley
Copy link
Author

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