Skip to content

Instantly share code, notes, and snippets.

@ednisley
Last active May 19, 2025 23:37
Show Gist options
  • Save ednisley/a4cc85f976a0b586846ecadca5254401 to your computer and use it in GitHub Desktop.
Save ednisley/a4cc85f976a0b586846ecadca5254401 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// 20x102mm cartridge
// Ed Nisley - KE4ZNU
// 2025-05-18
include <BOSL2/std.scad>
Layout = "Show"; // [Show,Build]
Powder = true; // build internal void
/* [Hidden] */
ID = 0;
OD = 1;
LENGTH = 2;
HoleWindage = 0.2;
Protrusion = 0.1;
NumSides = 3*3*4;
$fn = NumSides;
CartridgeOA = [21.0,29.5,101.4]; // must match SVG pretty closely
PrimerOA = [2.0,8.0,2.0];
CapsuleTip = [7.5,7.5,5.0];
Capsule = [7.5,18.8 + HoleWindage,83];
SeatingDepth = 25.0;
Void = [CartridgeOA[ID]- 4.0,CartridgeOA[OD]- 4.0,CartridgeOA[LENGTH] - SeatingDepth - 4*PrimerOA[LENGTH]];
//----------
// Define shapes
module Cartridge() {
difference() {
rotate_extrude()
import("Cartridge - 20x102mm outline.svg",layer="Cartridge Aligned Half");
up(PrimerOA[LENGTH])
cyl(PrimerOA[LENGTH] + Protrusion,d=PrimerOA[OD],anchor=TOP);
up(CartridgeOA[LENGTH] + CapsuleTip[LENGTH])
cyl(SeatingDepth,d=Capsule[OD],anchor=TOP);
up(CartridgeOA[LENGTH] - SeatingDepth)
cyl(Void[LENGTH],d=CapsuleTip[OD],anchor=BOTTOM);
if (Powder) {
up(Void[LENGTH]/2)
cyl(Void[LENGTH],d=CapsuleTip[OD],anchor=BOTTOM);
up(2*PrimerOA[LENGTH])
cyl(Void[LENGTH],d=Void[OD],rounding=Void[OD]/2,anchor=BOTTOM);
down(Protrusion)
cyl(Void[LENGTH],d=PrimerOA[ID],anchor=BOTTOM);
}
}
}
module Primer() {
difference() {
cyl(PrimerOA[LENGTH] - Protrusion,d=PrimerOA[OD] - HoleWindage,anchor=BOTTOM);
up(PrimerOA[LENGTH])
spheroid(d=PrimerOA[ID]);
}
}
//----------
// Build things
if (Layout == "Show")
//render()
difference() {
Cartridge();
cuboid(3*CartridgeOA[LENGTH],anchor=LEFT+BACK);
}
if (Layout == "Build") {
Cartridge();
right(CartridgeOA[OD])
Primer();
}
@ednisley
Copy link
Author

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