Holodisk model from the Fallout and Fallout 2 games.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

323 líneas
10 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 laserwindow_door() {
  169. door_size = [
  170. get_holodisk_laserwindow_size().x,
  171. 1,
  172. get_holodisk_laserwindow_size().z
  173. ];
  174. door_pos = [
  175. get_holodisk_laserwindow_pos_center().x,
  176. get_holodisk_laserwindow_pos_center().y + door_size.y/2,
  177. get_holodisk_laserwindow_pos_center().z
  178. ];
  179. translate(door_pos) scale(0.98) down(door_size.z/2) xrot(anim(1,2)*-90) xrot(anim(6,7)*90) up(door_size.z/2) cube(door_size, center=true);
  180. }
  181. module bottom_cover() {
  182. difference() {
  183. linear_extrude(height=plate) {
  184. back_bumpers();
  185. square([width, depth]);
  186. }
  187. down(0.1) translate(get_holodisk_laser_cutout_pos()) cube(get_holodisk_laser_cutout_size());
  188. }
  189. }
  190. color("SaddleBrown") top_cover();
  191. color("grey") walls();
  192. color("gold") laserwindow_door();
  193. color("Silver") slides();
  194. color("SaddleBrown") bottom_cover();
  195. color("SaddleBrown") front_plates();
  196. //color("silver") back_bolts();
  197. //color("silver") front_bolts();
  198. }
  199. module mechanism(size) {
  200. width=size.x;
  201. depth=size.y;
  202. height=size.z;
  203. module spool(r_in, r_out, in_rim, out_rim) {
  204. module spindle(d, h) {
  205. color("Sienna") cylinder(h=h, d=d);
  206. }
  207. module spool_plate() {
  208. difference() {
  209. cylinder(h=spool_plate_height, r=r_out);
  210. if (!$preview && r_out - r_in > out_rim) {
  211. angle=spool_plate_hole_angle;
  212. difference() {
  213. for (i = [1:spool_plate_holes]) {
  214. zrot(360/spool_plate_holes * i) {
  215. angle_pie_mask(r=r_out - out_rim, l=spool_plate_height, ang=angle, center=false);
  216. }
  217. }
  218. cylinder(h=spool_plate_height, r=r_in + in_rim);
  219. }
  220. }
  221. }
  222. }
  223. spindle_h=height-plate;
  224. difference() {
  225. color("Azure") {
  226. spool_plate();
  227. up(spool_plate_height) cylinder(h=spool_inner_height, r=r_in);
  228. up(spool_plate_height + spool_inner_height) spool_plate();
  229. }
  230. up(spool_plate_height + spool_inner_height/2) cube([r_in*2, spool_slit_depth, spool_inner_height], center=true);
  231. // TODO: spindle height
  232. spindle(d=spindle_diam+spindle_diam_tolerance, h=spindle_h);
  233. }
  234. spindle(d=spindle_diam, h=spindle_h);
  235. }
  236. module main_spool() {
  237. spool(r_in=spool_inner_radius,
  238. r_out=spool_outer_radius,
  239. in_rim=spool_plate_hole_inner_rim,
  240. out_rim=spool_plate_hole_outer_rim);
  241. }
  242. module aux_spool() {
  243. spool(r_in=middle_spool_in_r, r_out=middle_spool_out_r,
  244. in_rim=aux_spool_plate_hole_inner_rim,
  245. out_rim=aux_spool_plate_hole_outer_rim);
  246. }
  247. module spools() {
  248. up(plate) {
  249. right(main_spools_x) {
  250. back(spool1_depth) main_spool();
  251. back(spool2_depth) main_spool();
  252. }
  253. right(aux_spools_right_x) {
  254. back(spool3_depth) aux_spool();
  255. back(spool4_depth) aux_spool();
  256. }
  257. right(aux_spools_left_x) {
  258. back(spool4_depth) aux_spool();
  259. }
  260. }
  261. }
  262. module tapes() {
  263. spool1_tape_r = spool_outer_radius * 0.8;
  264. spool2_tape_r = spool_outer_radius * 0.5;
  265. up(plate + spool_plate_height) {
  266. // main spools
  267. right(main_spools_x) {
  268. back(spool1_depth) tape_spool(r_in=spool_inner_radius, r_out=spool1_tape_r);
  269. back(spool2_depth) tape_spool(r_in=spool_inner_radius, r_out=spool2_tape_r);
  270. }
  271. // TODO: convert to path
  272. // main 1 --> middle
  273. tape([main_spools_x + spool1_tape_r, spool1_depth, 0], [aux_spools_right_x + middle_spool_in_r, spool3_depth, 0]);
  274. // --> right corner
  275. right(aux_spools_right_x + middle_spool_in_r) tape([0, spool3_depth, 0], [0, spool4_depth, 0]);
  276. // --> left corner
  277. tape([aux_spools_left_x, spool4_depth - middle_spool_in_r, 0], [aux_spools_right_x, spool4_depth - middle_spool_in_r, 0]);
  278. // --> main 2
  279. tape([aux_spools_left_x - middle_spool_in_r, spool4_depth, 0], [main_spools_x - spool2_tape_r, spool2_depth, 0]);
  280. }
  281. }
  282. spools();
  283. tapes();
  284. }
  285. module holodisk(size) {
  286. frame(size);
  287. mechanism(size);
  288. }
  289. retraction=holodisk_size.y+10;
  290. back((1-anim(1, 2)) * retraction) // anim insert
  291. back((anim(len(get_anim_keys())-2, len(get_anim_keys())-1)) * retraction) // anim remove
  292. holodisk(holodisk_size);