camera_mount.scad 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. include <../config/camera_mount.scad>
  2. module camera_mount_monitor_base() {
  3. thickness = camera_mount_thickness;
  4. diameter = camera_mount_diameter;
  5. monitor_base = camera_mount_monitor_base;
  6. rounding = camera_mount_rounding;
  7. module corner(x = 0, y = 0, rounded = true) {
  8. translate([x, y]) {
  9. if (rounded) {
  10. circle(r = rounding);
  11. } else {
  12. square([rounding * 2, rounding * 2], center = true);
  13. }
  14. }
  15. }
  16. monitor_base_outside = [
  17. monitor_base.x,
  18. monitor_base.y + thickness * 2,
  19. monitor_base.z + thickness
  20. ];
  21. module top_shape() {
  22. move_x = monitor_base_outside.x / 2 - rounding;
  23. move_y = monitor_base_outside.y / 2 - rounding;
  24. move_x_right = monitor_base_outside.x / 2 + thickness + diameter;
  25. difference() {
  26. hull() {
  27. corner(-move_x, move_y);
  28. corner(-move_x, -move_y);
  29. corner(move_x, move_y, false);
  30. corner(move_x, -move_y, false);
  31. translate([move_x_right, 0]) {
  32. circle(r = monitor_base_outside.y / 2);
  33. }
  34. }
  35. translate([move_x_right, 0]) {
  36. circle(d = diameter);
  37. }
  38. }
  39. }
  40. module top_base_object() {
  41. linear_extrude(height = monitor_base_outside.z, center = true) {
  42. top_shape();
  43. }
  44. }
  45. module top_object() {
  46. render() {
  47. difference() {
  48. top_base_object();
  49. translate([0, 0, -thickness / 2] ){
  50. cube(monitor_base, center = true);
  51. }
  52. }
  53. }
  54. }
  55. color("#61C9A8") {
  56. top_object();
  57. }
  58. }
  59. module camera_mount_connector() {
  60. monitor_base = camera_mount_monitor_base;
  61. thickness = camera_mount_thickness;
  62. diameter = camera_mount_diameter;
  63. rounding = camera_mount_rounding / 2;
  64. nut_diameter = camera_mount_nut_diameter;
  65. nut_thickness = camera_mount_nut_thickness;
  66. screw_diameter = camera_mount_screw_diameter;
  67. connector_size = [
  68. thickness * 4 + camera_mount_monitor_base.z,
  69. nut_diameter + thickness * 2,
  70. nut_diameter + thickness * 2
  71. ];
  72. module z_rotator_object() {
  73. height = monitor_base.z + thickness;
  74. diameter_tolerance = diameter - camera_mount_tolerance;
  75. translate([0, 0, -height / 2 - connector_size.z / 2]) {
  76. cylinder(d = diameter_tolerance, h = height, center = true);
  77. }
  78. }
  79. module connector_base() {
  80. move_x = connector_size.x / 2 - rounding;
  81. move_y = connector_size.y / 2 - rounding;
  82. height = connector_size.z;
  83. rotate([90, 0, 0]) {
  84. hull() {
  85. translate([-move_x, move_y]) {
  86. cylinder(r = rounding, h = height, center = true);
  87. }
  88. translate([-move_x, -move_y]) {
  89. cylinder(r = rounding, h = height, center = true);
  90. }
  91. translate([move_x, -move_y]) {
  92. cylinder(r = rounding, h = height, center = true);
  93. }
  94. translate([move_x, move_y]) {
  95. cylinder(r = rounding, h = height, center = true);
  96. }
  97. }
  98. }
  99. translate([connector_size.x / 2, 0, 0]) {
  100. rotate([0, 90, 0]) {
  101. cylinder(
  102. d = screw_diameter * 2,
  103. h = thickness,
  104. center = true
  105. );
  106. }
  107. }
  108. }
  109. module connector() {
  110. render() {
  111. difference() {
  112. connector_base();
  113. translate([thickness, 0, 0]) {
  114. rotate([0, 90, 0]) {
  115. cylinder(
  116. d = screw_diameter,
  117. h = connector_size.x,
  118. center = true
  119. );
  120. }
  121. }
  122. nut_cutoff = [
  123. nut_thickness,
  124. nut_diameter,
  125. connector_size.z / 2 + nut_diameter / 2
  126. ];
  127. nut_cutoff_move_z = (
  128. connector_size.z / 4 +
  129. nut_diameter / 4 -
  130. nut_diameter / 2
  131. );
  132. translate([0, 0, nut_cutoff_move_z]) {
  133. cube(nut_cutoff, center = true);
  134. }
  135. }
  136. }
  137. }
  138. color("#A53860") {
  139. render() {
  140. union() {
  141. z_rotator_object();
  142. connector();
  143. }
  144. }
  145. }
  146. }
  147. module camera_mount_camera() {
  148. camera = camera_mount_camera;
  149. camera_shape = [camera.x, camera.z];
  150. thickness = camera_mount_thickness;
  151. first_height = camera_mount_first_height;
  152. outside = [
  153. camera.x + thickness * 2,
  154. camera.z + thickness * 2
  155. ];
  156. inside = [
  157. camera.x - thickness * 2,
  158. camera.z - thickness * 2
  159. ];
  160. module frame_shape() {
  161. difference() {
  162. square(outside, center = true);
  163. square(inside, center = true);
  164. }
  165. }
  166. module first_frame_shape() {
  167. difference() {
  168. square(outside, center = true);
  169. square(camera_shape, center = true);
  170. }
  171. }
  172. module second_frame_shape() {
  173. difference() {
  174. first_frame_shape();
  175. union() {
  176. square([outside.x, inside.y], center = true);
  177. translate([-inside.x / 4, thickness]) {
  178. square([inside.x / 2, camera_shape.y], center = true);
  179. }
  180. }
  181. }
  182. }
  183. module object() {
  184. union() {
  185. linear_extrude(height = thickness) {
  186. frame_shape();
  187. }
  188. linear_extrude(height = thickness + first_height) {
  189. first_frame_shape();
  190. }
  191. linear_extrude(height = camera.y) {
  192. second_frame_shape();
  193. }
  194. }
  195. }
  196. screw_diameter = camera_mount_screw_diameter;
  197. tolerance = camera_mount_tolerance;
  198. in = screw_diameter * 2 + tolerance;
  199. out = screw_diameter * 2 + thickness * 2;
  200. module rotator() {
  201. module outer() {
  202. union() {
  203. circle(d = out);
  204. translate([0, -out / 4]) {
  205. square([out, out / 2], center = true);
  206. }
  207. }
  208. }
  209. module first() {
  210. difference() {
  211. outer();
  212. circle(d = in);
  213. }
  214. }
  215. module second() {
  216. difference() {
  217. outer();
  218. circle(d = screw_diameter);
  219. }
  220. }
  221. union() {
  222. linear_extrude(height = thickness) {
  223. second();
  224. }
  225. linear_extrude(height = thickness * 2) {
  226. first();
  227. }
  228. }
  229. }
  230. color("#ADA8B6") {
  231. render() {
  232. union() {
  233. object();
  234. translate([
  235. -outside.x / 2 + thickness * 2,
  236. outside.y / 2 + out / 2,
  237. out / 2
  238. ]) {
  239. rotate([0, 270, 0]) {
  240. rotator();
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }