Holodisk model from the Fallout and Fallout 2 games.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

307 line
9.4 KiB

  1. // dependency: https://github.com/revarbat/BOSL
  2. use <BOSL/transforms.scad>
  3. //use <BOSL/metric_screws.scad>
  4. use <BOSL/masks.scad>
  5. use <holodisk_spec.scad>
  6. use <anim.scad>
  7. include <tape.scad>
  8. disk_size = get_holodisk_size();
  9. holodisk_size = get_holodisk_size();
  10. wall=3;
  11. plate=3;
  12. top_rim=2;
  13. bolt_headtype="hex";
  14. front_body_depth=12;
  15. front_body_bolt_offset=8;
  16. back_bumpers_radius=5;
  17. back_bumpers_bolt_size=3;
  18. tape_height=5;
  19. tape_thickness=0.2;
  20. spool_tape_tolerance=1;
  21. spool_inner_height=tape_height+spool_tape_tolerance;
  22. spool_inner_radius=4;
  23. spool_outer_radius=18;
  24. spool_plate_height=2;
  25. spool_plate_holes=3;
  26. spool_plate_hole_angle=360/spool_plate_holes * 0.5;
  27. spool_plate_hole_inner_rim=1;
  28. spool_plate_hole_outer_rim=4;
  29. spool_slit_depth=0.8;
  30. spool1_depth=disk_size.y*0.77;
  31. spool2_depth=disk_size.y*0.40;
  32. spool3_depth=(spool1_depth+spool2_depth)/2;
  33. spool4_depth=disk_size.y*0.16;
  34. main_spools_x=disk_size.x*0.45;
  35. aux_spools_right_x=main_spools_x + spool_outer_radius + 1;
  36. aux_spools_left_x=main_spools_x - 13;
  37. middle_spool_in_r=2;
  38. middle_spool_out_r=7;
  39. aux_spool_plate_hole_inner_rim=2;
  40. aux_spool_plate_hole_outer_rim=2;
  41. spindle_diam=2;
  42. spindle_diam_tolerance=0.2;
  43. tape_z=plate+spool_plate_height;
  44. module frame(size) {
  45. width=size.x;
  46. depth=size.y;
  47. height=size.z;
  48. tr=top_rim;
  49. tc=tr*1.5;
  50. fbd=front_body_depth;
  51. bbr=back_bumpers_radius;
  52. module back_bumpers() {
  53. module bumper() { back_half() circle(r=bbr); }
  54. back(depth) {
  55. right(bbr) bumper();
  56. right(width-bbr) bumper();
  57. }
  58. }
  59. module bolt() { metric_bolt(size=back_bumpers_bolt_size, headtype=bolt_headtype, l=height, pitch=0); }
  60. module nut() { metric_nut(size=back_bumpers_bolt_size, pitch=0); }
  61. module back_bolts() {
  62. back(depth) {
  63. right(bbr) {
  64. up(height) bolt();
  65. nut();
  66. }
  67. right(width-bbr) {
  68. up(height) bolt();
  69. nut();
  70. }
  71. }
  72. }
  73. module front_bolts() {
  74. bolt_offset=front_body_bolt_offset;
  75. back(front_body_depth/2) {
  76. right(bolt_offset) {
  77. up(height) bolt();
  78. nut();
  79. }
  80. right(width-bolt_offset) {
  81. up(height) bolt();
  82. nut();
  83. }
  84. }
  85. }
  86. module top_cover() {
  87. up(height-plate) linear_extrude(height=plate) {
  88. back_bumpers();
  89. polygon(points=[
  90. // frame
  91. [0, 0], [0, depth],
  92. [width, depth], [width, 0],
  93. // window
  94. [tr, tr+fbd], [tr, depth-tr-tc], [tr+tc, depth-tr],
  95. [width-tr-tc, depth-tr], [width-tr, depth-tr-tc], [width-tr, tr+fbd]
  96. ],
  97. paths=[
  98. [0,1,2,3], [4,5,6,7,8,9]
  99. ]);
  100. }
  101. }
  102. module walls() {
  103. walls_height=height-plate*2;
  104. difference() {
  105. up(plate) linear_extrude(height=walls_height) {
  106. //back_bumpers();
  107. shell2d(thickness=-wall) {
  108. square([width, depth]);
  109. }
  110. }
  111. translate(get_holodisk_laserwindow_pos_center()) cube(get_holodisk_laserwindow_size(), center=true);
  112. }
  113. }
  114. module front_plates() {
  115. th = get_holodisk_front_plate_thickness();
  116. slide_pos = get_holodisk_slide_pos();
  117. offset=4.5;
  118. plate_len_side=slide_pos.y - offset/2;
  119. plate_len_left=plate_len_side/2;
  120. plate_len_right=plate_len_left*3;
  121. // front
  122. fwd(th) left(th) up(offset) {
  123. cube([plate_len_left / 2 + th*2, th, height - offset*2]);
  124. }
  125. fwd(th) right(width-plate_len_right-th) up(offset) {
  126. cube([plate_len_right + th*2, th, height - offset*2]);
  127. }
  128. // left
  129. fwd(th) left(th) up(offset) {
  130. cube([th, plate_len_side, height - offset*2]);
  131. }
  132. // right
  133. fwd(th) right(width) up(offset) {
  134. cube([th, plate_len_side, height - offset*2]);
  135. }
  136. }
  137. module slides() {
  138. slide_size = get_holodisk_slide_size();
  139. slide_pos = get_holodisk_slide_pos();
  140. slide_plate_size = [0.1, slide_size.y, slide_size.z];
  141. sliding_size = get_holodisk_slide_sliding_size();
  142. sliding_pos = get_holodisk_slide_sliding_pos();
  143. module slide() {
  144. hull() {
  145. translate(sliding_pos) cube(sliding_size);
  146. translate(slide_pos) cube(slide_plate_size);
  147. }
  148. }
  149. module slider() {
  150. slider_size = get_holodisk_slide_slider_size();
  151. slider_pos = get_holodisk_slide_slider_pos();
  152. slider_plate_size = [0.1, slider_size.y, slider_size.z];
  153. slider_top_size = [slider_size.x, slider_size.y, sliding_size.z];
  154. hull() {
  155. up((slider_size.z-sliding_size.z)/2) translate(slider_pos) cube(slider_top_size);
  156. translate(slider_pos) cube(slider_plate_size);
  157. }
  158. }
  159. right(get_holodisk_size().x) {
  160. slide();
  161. slider();
  162. }
  163. scale([-1,1,1]) {
  164. slide();
  165. slider();
  166. }
  167. }
  168. module bottom_cover() {
  169. difference() {
  170. linear_extrude(height=plate) {
  171. back_bumpers();
  172. square([width, depth]);
  173. }
  174. down(0.1) translate(get_holodisk_laser_cutout_pos()) cube(get_holodisk_laser_cutout_size());
  175. }
  176. }
  177. color("SaddleBrown") top_cover();
  178. color("grey") walls();
  179. color("Silver") slides();
  180. color("SaddleBrown") bottom_cover();
  181. color("SaddleBrown") front_plates();
  182. //color("silver") back_bolts();
  183. //color("silver") front_bolts();
  184. }
  185. module mechanism(size) {
  186. width=size.x;
  187. depth=size.y;
  188. height=size.z;
  189. module spool(r_in, r_out, in_rim, out_rim) {
  190. module spindle(d, h) {
  191. color("Sienna") cylinder(h=h, d=d);
  192. }
  193. module spool_plate() {
  194. difference() {
  195. cylinder(h=spool_plate_height, r=r_out);
  196. if (!$preview && r_out - r_in > out_rim) {
  197. angle=spool_plate_hole_angle;
  198. difference() {
  199. for (i = [1:spool_plate_holes]) {
  200. zrot(360/spool_plate_holes * i) {
  201. angle_pie_mask(r=r_out - out_rim, l=spool_plate_height, ang=angle, center=false);
  202. }
  203. }
  204. cylinder(h=spool_plate_height, r=r_in + in_rim);
  205. }
  206. }
  207. }
  208. }
  209. spindle_h=height-plate;
  210. difference() {
  211. color("Azure") {
  212. spool_plate();
  213. up(spool_plate_height) cylinder(h=spool_inner_height, r=r_in);
  214. up(spool_plate_height + spool_inner_height) spool_plate();
  215. }
  216. up(spool_plate_height + spool_inner_height/2) cube([r_in*2, spool_slit_depth, spool_inner_height], center=true);
  217. // TODO: spindle height
  218. spindle(d=spindle_diam+spindle_diam_tolerance, h=spindle_h);
  219. }
  220. spindle(d=spindle_diam, h=spindle_h);
  221. }
  222. module main_spool() {
  223. spool(r_in=spool_inner_radius,
  224. r_out=spool_outer_radius,
  225. in_rim=spool_plate_hole_inner_rim,
  226. out_rim=spool_plate_hole_outer_rim);
  227. }
  228. module aux_spool() {
  229. spool(r_in=middle_spool_in_r, r_out=middle_spool_out_r,
  230. in_rim=aux_spool_plate_hole_inner_rim,
  231. out_rim=aux_spool_plate_hole_outer_rim);
  232. }
  233. module spools() {
  234. up(plate) {
  235. right(main_spools_x) {
  236. back(spool1_depth) main_spool();
  237. back(spool2_depth) main_spool();
  238. }
  239. right(aux_spools_right_x) {
  240. back(spool3_depth) aux_spool();
  241. back(spool4_depth) aux_spool();
  242. }
  243. right(aux_spools_left_x) {
  244. back(spool4_depth) aux_spool();
  245. }
  246. }
  247. }
  248. module tapes() {
  249. spool1_tape_r = spool_outer_radius * 0.8;
  250. spool2_tape_r = spool_outer_radius * 0.5;
  251. up(plate + spool_plate_height) {
  252. // main spools
  253. right(main_spools_x) {
  254. back(spool1_depth) tape_spool(r_in=spool_inner_radius, r_out=spool1_tape_r);
  255. back(spool2_depth) tape_spool(r_in=spool_inner_radius, r_out=spool2_tape_r);
  256. }
  257. // TODO: convert to path
  258. // main 1 --> middle
  259. tape([main_spools_x + spool1_tape_r, spool1_depth, 0], [aux_spools_right_x + middle_spool_in_r, spool3_depth, 0]);
  260. // --> right corner
  261. right(aux_spools_right_x + middle_spool_in_r) tape([0, spool3_depth, 0], [0, spool4_depth, 0]);
  262. // --> left corner
  263. tape([aux_spools_left_x, spool4_depth - middle_spool_in_r, 0], [aux_spools_right_x, spool4_depth - middle_spool_in_r, 0]);
  264. // --> main 2
  265. tape([aux_spools_left_x - middle_spool_in_r, spool4_depth, 0], [main_spools_x - spool2_tape_r, spool2_depth, 0]);
  266. }
  267. }
  268. spools();
  269. tapes();
  270. }
  271. module holodisk(size) {
  272. frame(size);
  273. mechanism(size);
  274. }
  275. retraction=holodisk_size.y+10;
  276. back((1-anim(1, 2)) * retraction) // anim insert
  277. back((anim(len(get_anim_keys())-2, len(get_anim_keys())-1)) * retraction) // anim remove
  278. holodisk(holodisk_size);