3d_print/Sasza/bron/cz457/celownik/celownik2.scad

84 lines
2.5 KiB
OpenSCAD

use <picatinny-rail.scad>
use <Chamfer.scad>
include <BOSL2/std.scad>
include <BOSL2/screws.scad>
// To jest model celownika do karabinu CZ Varmint
// Koncepcyjnie składa się z 3 części - na górze jest szyna
// Picattiny (rail), na środku jest obejma lufy (clamp), i na dole
// wystaje pałąk do przykręcenia (post)
// parameters
length = 4; // ustaw poniżej 5 do testów wymiarów
clamp_inner = 22.15;
clamp_inner_acurracy = 50;
clamp_thickness = 4;
c_s = length>5 ? 1 : 0.4; // chamfer_size używane tylko do testów
rail_height = -9.4 + clamp_inner/2 + 6.8; // -9.4 is to center the picatinny
post_thickness=15;
post_length=10;
post_slit=2;
post_chamfer = 1.665;
nut_wall_t = 0.4;
screw = "M2.5";
info = screw_info(name=screw, head="socket");
hh = struct_val(info, "head_height");
screw_head_h = post_thickness - hh - nut_wall_t;
difference() {
// celownik
union() {
// obejma wokół lufy
cyl_size = clamp_inner/2 + clamp_thickness;
chamferCylinder(h=length, r=cyl_size, ch=1*c_s, q=1);
// na górze picatinny
if (length > 5) {
rotate([90,0,-90]) translate([0,0,rail_height])
picatinny_rail(l=length, d=rail_height, c=1.5, n=1, a=length/2);
}
// na dole wystający trzpień do przykręcenia
translate([clamp_inner/2, post_thickness*-0.5, 0])
chamferCube([post_length, post_thickness, length], ch=c_s);
}
// lufa, śruby oraz przecięcie
union() {
// lufa karabinu
translate([0,0,-0.1])
chamferCylinder(h=length+0.2, r=clamp_inner/2, $fn=clamp_inner_acurracy, ch=-c_s);
// przecięcie
translate([clamp_inner/2-0.1,(post_slit * -0.5),-0.1])
cube([(post_length + 0.2),post_slit,length+0.2]);
// miejsce na śrubę
if (length > 5){
for (i = [length*1/4, length*3/4]) {
translate([(clamp_inner + post_length)/2,0,i])
rotate([90,90,0])
screw_hole(spec=screw, length=screw_head_h, head="socket", thread=0, $fn=100);
translate([(clamp_inner + post_length)/2,post_thickness/2 - nut_wall_t,i])
rotate([90,90,0])
nut_trap_inline(spec=screw, h=hh);
}
}
// chamfer for slit
translate([clamp_inner/2 - post_slit/4,0,length/2-0.5]) rotate([0,0,45])
cube([post_slit*post_chamfer,post_slit*post_chamfer,length+2], center=true);
// debug - wyświetl rozmiar
if(length < 5) {
translate([clamp_inner/2 + 2 ,post_thickness/6,length-0.5])
linear_extrude(5) text(str(clamp_inner), 3);
}
}
}