aboutsummaryrefslogtreecommitdiff
path: root/webcam_fmount.scad
blob: 988a2870674322d014713806ddb3572703254ca6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
$fn=50;

// diameter (not radius!)
throat = 44.5;
inner = 47.5;
outer = 57;

lip_width = 1.7;
lip_height = 1.9;
lip_positions = [[50,-35], [55,-155], [55,-270]];
lip_offset = 0.8;

flange_height = 10;

module rounding_circle(radius, corner_radius, angle) {
  rotate_extrude() {
    translate([radius, angle>=180?corner_radius:0]) difference() {
      rotate([0,0,angle]) square(corner_radius);
      circle(corner_radius);
    }
  }
}

module lip(angle, offs) {
  rotate([0,0,offs]) translate([0,0,lip_height/2])
   rotate_extrude(angle=angle)
    translate([inner/2 +0.1 - lip_width/2,0,0]) square([lip_width,lip_height], center=true);
}

module nikon_f_flange() {
  difference() {
    linear_extrude(flange_height) difference() {
      circle(outer/2);
      circle(inner/2);
    }
    translate([0,0,flange_height-1]) rounding_circle(29,1,0);
  }

  translate([0,0,flange_height - lip_height - lip_offset]) {
    for (i = lip_positions) {
      lip(i[0],i[1]);
    }
  }

}

screw_distance = 18.6;
mount_base = 13.3;
mount_wall = 1.2;
sensor_distance = 46.5;

base_thickness = 4;
// if the sensor pertrudes from the mounting plane
sensor_offset = 1;

module filter_mount() {
  tolerance = 0.6;
  l = 6.5 + tolerance;
  h = 1.5;
  lip = 0.3;
  lip_h = 0.6;

  translate([0,0,-h]) {
    linear_extrude(lip_h) difference() {
      square(l, center=true);
      offset(delta=-lip) square(l, center=true);
    }

    linear_extrude(h) difference() {
      square(mount_base-mount_wall, center=true);
      square(l, center=true);
    }

    slant_h = base_thickness;
    translate([0,0,-slant_h]) difference() {
      linear_extrude(slant_h)
        square(mount_base-mount_wall, center=true);
      linear_extrude(slant_h, scale=(l - 2*lip)/(mount_base-mount_wall))
        square(mount_base-mount_wall, center=true);
    }
  }
}

module screwpost_2d() {
  r = 2;
  screw=1;
  difference() {
    union() {
      circle(r);
      translate([0,-r]) square([(screw_distance-mount_base)/2,2*r]);
    }

    circle(screw);
  }
}

module mount_base_2d() {
  difference() {
    square(mount_base,center=true);
    offset(-mount_wall) square(mount_base, center=true);
  }
}

module sensor_mount() {
  mount_base_2d();
  translate([-screw_distance/2,0]) screwpost_2d();
  translate([ screw_distance/2,0]) rotate([0,0,180]) screwpost_2d();
}


translate([0,0,base_thickness]) {
  h = sensor_distance-flange_height-base_thickness;
  difference() {
    hull() {
      linear_extrude(0.01) square(mount_base, center=true);
      translate([0,0,h]) linear_extrude(0.01) circle(d=outer);
    }
    hull() {
      linear_extrude(0.01) offset(-mount_wall)square(mount_base, center=true);
      translate([0,0,h]) linear_extrude(0.01) circle(d=inner);
    }
  }
}

translate([0,0,-sensor_offset]) linear_extrude(base_thickness + sensor_offset) sensor_mount();
translate([0,0,sensor_distance-flange_height]) nikon_f_flange();
translate([0,0,base_thickness + sensor_offset]) filter_mount();