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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="11in"
height="8.5in"
viewBox="0 0 279.40056 215.90043"
version="1.1"
id="SVGRoot"
inkscape:version="1.4.1 (93de688d07, 2025-03-30)"
sodipodi:docname="Cartridge - 20x102mm outline.svg"
xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"><sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#0000ff"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:document-units="mm"
showgrid="true"
units="mm"
gridtolerance="9.9"
guidetolerance="10.4"
inkscape:snap-perpendicular="true"
inkscape:snap-tangential="true"
width="700mm"
borderlayer="false"
inkscape:showpageshadow="true"
viewbox-width="700"
guidecolor="#ff00e3"
guideopacity="0.49803922"
inkscape:zoom="1.8494139"
inkscape:cx="279.27766"
inkscape:cy="262.5156"
inkscape:window-width="1780"
inkscape:window-height="1091"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer2"
objecttolerance="31"
inkscape:deskcolor="#d1d1d1"
showguides="true"><inkscape:grid
type="xygrid"
id="grid9"
units="mm"
spacingx="5"
spacingy="5"
dotted="false"
empspacing="2"
originx="148.5"
originy="127.29919"
color="#ff0000"
opacity="0.18431373"
empcolor="#4040ff"
empopacity="0.49411765"
visible="true" /></sodipodi:namedview><defs
id="defs2" /><image
width="124.88358"
height="40.724747"
preserveAspectRatio="none"
xlink:href="../Cartridge%20-%2020x103mm%20outline.jpg"
id="image1"
x="22.287945"
y="151.96129" /><g
inkscape:label="Cartridge Outline"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,5.4354331)"><path
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.2;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
d="m 37.769048,157.1879 6.929546,-0.12646 c 3.218826,0.0228 8.830866,-2.80879 9.992216,-2.76278 l 76.95589,-0.98018 1.78297,1.78296 h 2.81987 v -2.01058 h 1.97264 l 1.00877,0.2703 v 29.1781 l -0.70149,0.7015 h -2.20405 v -1.97648 h -2.79595 l -1.75067,1.75067 -76.86291,-1.01725 c -0.87047,0.0302 -7.10576,-3.20305 -10.099511,-3.01749 l -6.971449,0.23553 z"
id="path1"
sodipodi:nodetypes="ccccccccccccccccccc" /></g><metadata
id="metadata11"><rdf:RDF><cc:Work
rdf:about=""><cc:license
rdf:resource="http://creativecommons.org/licenses/by-nc-sa/4.0/" /></cc:Work><cc:License
rdf:about="http://creativecommons.org/licenses/by-nc-sa/4.0/"><cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" /><cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" /><cc:prohibits
rdf:resource="http://creativecommons.org/ns#CommercialUse" /><cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /><cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" /></cc:License></rdf:RDF></metadata><g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Cartridge Aligned Half"><path
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.2;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
d="m 0,109.0648 h 10.978022 l 0.126348,6.86782 c -0.0228,3.21882 2.80879,8.83086 2.76278,9.99221 l 0.98019,76.95589 -1.78297,1.78297 v 2.81987 h 2.01058 v 1.97264 L 14.80454,210.46497 0,210.465 Z"
id="path2"
sodipodi:nodetypes="cccccccccccc"
transform="translate(0,5.4354331)"
inkscape:label="Cartridge Half" /></g></svg>
// 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