• API
• FAQ
• Tools
• Archive
SHARE
TWEET

a guest Sep 4th, 2019 193 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. //special variables control the number of facets used to generate an arc
2. \$fa=1; // minimum angle for a fragment
3. \$fs=0.05; //minimum size of a fragment
4.
5.     vbarreldim   = 27; //[mm] Lens barrel size
6.     vopticenter  = 10; //[mm] how far optical lens center is from len barrel; if in doubts add a few mm to be on safe side
7.
8.     vnegativex  = 5*25.4; //[mm] negative/sensor size x*y
9.     vnegativey  = 4*25.4;
10.     vfocal      = 150;  //[mm] focal lenght (at infinity)
11.
12.     vg          = 1; //[mm] lens hood thickness
13.
14.     vslots      = 0; //[mm] slots cut on mount end to make it more flexible
15.     vcut        = 0.2; //[mm] - one long slot cut to make hood more flexible
16.
17.     vsafety     = 1.50; //1+ safety factor to make hood a little bit wider
18.
19.     //3d print tollerenaces
20.     vintadd     = 0.3; //tollerance to add on internal holes when no slots are used
21.
22.
23.
24.    // vnegativex*vsafety
25.
26. difference() {
27.     difference() {
28.         cylinder(r=(vbarreldim/2)+vg, h=(vfocal-vopticenter));
29.         if ( (vslots>0) || (vcut>0) ) cylinder(r=(vbarreldim/2), h=(vfocal-vopticenter)+2);
30.         if ( (vslots==0) && (vcut==0) ) cylinder(r=(vbarreldim/2)+vintadd, h=(vfocal-vopticenter)+2);
31.     }
32.     /**/
33.     translate([0,0,vfocal-vopticenter]) rotate([180,0,0])
34.     #polyhedron(
35.       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
36.                [0,0,vfocal]  ],                                 // the apex point
37.       faces=[ [0,1,4],[1,2,4],[2,3,4],[3,0,4],              // each triangle side
38.                   [1,0,3],[2,1,3] ]                         // two triangles for square base
39.      );
40.     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);
41.     if ( (vcut>0) ) #cube([vcut,vbarreldim+vg+10,vfocal], center=false);
42.
43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top