Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //special variables control the number of facets used to generate an arc
- $fa=1; // minimum angle for a fragment
- $fs=0.05; //minimum size of a fragment
- vbarreldim = 27; //[mm] Lens barrel size
- vopticenter = 10; //[mm] how far optical lens center is from len barrel; if in doubts add a few mm to be on safe side
- vnegativex = 5*25.4; //[mm] negative/sensor size x*y
- vnegativey = 4*25.4;
- vfocal = 150; //[mm] focal lenght (at infinity)
- vg = 1; //[mm] lens hood thickness
- vslots = 0; //[mm] slots cut on mount end to make it more flexible
- vcut = 0.2; //[mm] - one long slot cut to make hood more flexible
- vsafety = 1.50; //1+ safety factor to make hood a little bit wider
- //3d print tollerenaces
- vintadd = 0.3; //tollerance to add on internal holes when no slots are used
- // vnegativex*vsafety
- difference() {
- difference() {
- cylinder(r=(vbarreldim/2)+vg, h=(vfocal-vopticenter));
- if ( (vslots>0) || (vcut>0) ) cylinder(r=(vbarreldim/2), h=(vfocal-vopticenter)+2);
- if ( (vslots==0) && (vcut==0) ) cylinder(r=(vbarreldim/2)+vintadd, h=(vfocal-vopticenter)+2);
- }
- /**/
- translate([0,0,vfocal-vopticenter]) rotate([180,0,0])
- #polyhedron(
- points=[ [(vnegativex*vsafety)/2,(vnegativey*vsafety)/2,0],[(vnegativex*vsafety)/2,-((vnegativey*vsafety)/2),0],[-((vnegativex*vsafety)/2),-((vnegativey*vsafety)/2),0],[-((vnegativex*vsafety)/2),(vnegativey*vsafety)/2,0], // the four points at base
- [0,0,vfocal] ], // the apex point
- faces=[ [0,1,4],[1,2,4],[2,3,4],[3,0,4], // each triangle side
- [1,0,3],[2,1,3] ] // two triangles for square base
- );
- if ( (vslots>0) && (vcut==0) ) #for (i=[0:10:350]) rotate(a=i, v=[0,0,1]) cube([1,vbarreldim+vg+10,vslots*2], center=true);
- if ( (vcut>0) ) #cube([vcut,vbarreldim+vg+10,vfocal], center=false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement