3d_print/Sasza/bron/cz457/Tłumik.scad

127 lines
No EOL
3.2 KiB
OpenSCAD

/*
Silencer
Inspired by the QuickCan Parametric Printable Silencer Tool
quickcan.scad by Hillary Izabych. I couldn't find her or any
way to contact her, and her project had no license.
I modified the silencer to print a threaded portion to screw onto
barrel threads instead of as a muzzle brake slip-on device.
The thread should ensure better fitment and alignment, lessening
the possibility of baffle strikes, and of course better ease of use.
*/
include <BOSL2/std.scad>
include <BOSL2/screws.scad>
test = 0; // 1 for cutaway
hold = 0; // 0 - screw, 1 - clamp
$fn=36*5;
// overall dimensions
len = 50;
out_d = 70;
hold_d = 22;
t = 2.5;
bullet_hole_1 = 6.5; // for .22lr 5.6mm + some spare
bullet_hole_2 = 8; // for .22lr 5.6mm + some spare
// threaded portion
th_len = 20;
th_spec = str("1/2-20,", th_len/10); // change to your barrel thread spec
$slop = 0.15; // For my printer, no slop results in an extremely tight thread.
// clamp
cl_len = 30;
cl_in_d = 13.1;
// baffles
baf_end = 40; // basically num of baffles
baf_dist = -20; // spacing between baffles
baf_h_num = 6; // number of holes in a single baffle
baf_h_d1 = 5;
baf_h_d2 = 10;
// Do not modify - internal calculations
in_d = out_d - 2*t;
baf_len = len - th_len;
chamfer = (out_d - hold_d)/2;
module body() {
diff(keep="k", "r") {
cyl(d=out_d, h=len, anchor=BOTTOM);
tag("r") cyl(d=in_d, h=len, anchor=BOTTOM)
tag("r") cyl(d=hold_d-1, h=len*2, anchor=BOTTOM);
up((len+chamfer/2)) if(chamfer) {
cyl(d1=out_d, d2=hold_d, h=chamfer);
tag("r") cyl(d1=out_d-2*t, d2=hold_d-2*t, h=chamfer);
}
}
}
module baffle() {
difference() {
cyl(d1=out_d, d2=0, h=out_d/2, anchor=BOTTOM);
down(t) cyl(d1=out_d, d2=0, h=out_d/2, anchor=BOTTOM);
// holes
for(i=[0:baf_h_num]) {
zrot(60*i) left(in_d*3/7) cyl(d=baf_h_d1, h=len);
zrot(60*i + 30) left(in_d*3/10) cyl(d=baf_h_d2, h=len);
}
}
}
module baffles() {
difference() {
for(i=[0:out_d/2 + baf_dist:baf_end]) {
up(i) baffle();
}
// hole for bullet
cyl(d2=bullet_hole_1, d1=bullet_hole_2, h=len + chamfer, anchor=BOTTOM);
}
}
module cap() {
difference() {
cyl(d=out_d, h=t, anchor=BOTTOM);
cyl(d=bullet_hole_2, h=t, anchor=BOTTOM);
}
}
module thread() {
up(len+chamfer-t) difference() {
cyl(h=th_len, d=hold_d, anchor=BOTTOM);
up(th_len) screw_hole(th_spec, thread=true, head="flat small", anchor="head_center");
cyl(h=hold_d/2, d1=hold_d, d2=0, anchor=BOTTOM);
}
}
module clamp() {
up(len+chamfer-t) difference() {
cyl(h=cl_len, d=hold_d, anchor=BOTTOM);
cyl(h=cl_len, d=cl_in_d, anchor=BOTTOM);
cuboid([out_d, t, cl_len], anchor=BOTTOM);
cyl(h=hold_d, d1=hold_d, d2=0, anchor=BOTTOM);
}
}
module silencer() {
diff("R") {
body();
baffles();
cap();
if(hold == 0) {
thread();
} else {
clamp();
}
if(test) tag("R") cuboid([len*2,len*2,len*2], anchor=LEFT+BOTTOM);
}
}
silencer();
echo(th_spec);