frame.scad 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. frame_depth = 3.3;
  2. stock_inset_height = 0.5;
  3. stock_inset_depth = 1.0;
  4. header_width = 45.0;
  5. header_height = header_width * 0.15;
  6. footer_width = header_width * 1.0;
  7. footer_height = header_height * 1.0;
  8. riser_width = header_width * 0.1;
  9. riser_height = header_height * 6.0;
  10. stock_width = header_width * 0.67;
  11. stock_height = stock_width * 0.67;
  12. stock_foot_height = footer_height * 1.0;
  13. neck_radius = stock_width / 5;
  14. header_riser_offset = ((header_width - stock_width) / 2) - riser_width;
  15. module stock_surface(surface_depth) {
  16. translate([stock_height / 2, 0, surface_depth]) {
  17. cube([stock_inset_height, stock_width, stock_inset_depth + clean_buffer]);
  18. }
  19. translate([0, 0, surface_depth]) {
  20. cube([stock_height, stock_inset_height, stock_inset_depth + clean_buffer]);
  21. }
  22. translate([0, stock_width - stock_inset_height, surface_depth]) {
  23. cube([stock_height, stock_inset_height, stock_inset_depth + clean_buffer]);
  24. }
  25. }
  26. module stock(stock_translate) {
  27. translate(stock_translate) {
  28. difference() {
  29. cube([stock_height, stock_width, frame_depth]);
  30. translate([stock_height / 2, stock_width / 2, -clean_buffer]) {
  31. cylinder(h = frame_depth + (clean_buffer * 2),
  32. r1 = neck_radius, r2 = neck_radius);
  33. }
  34. stock_surface(frame_depth - stock_inset_depth);
  35. stock_surface(0 - clean_buffer);
  36. }
  37. }
  38. }
  39. module frame() {
  40. cube([header_height, header_width, frame_depth]);
  41. translate([header_height, header_riser_offset, 0]) {
  42. cube([riser_height + stock_height + stock_foot_height, riser_width, frame_depth]);
  43. translate([0, stock_width + riser_width, 0]) {
  44. cube([riser_height + stock_height + stock_foot_height, riser_width, frame_depth]);
  45. }
  46. }
  47. stock([header_height + riser_height, header_riser_offset + riser_width, 0]);
  48. translate([
  49. header_height + riser_height + stock_height + stock_foot_height,
  50. (header_width - footer_width) / 2,
  51. 0
  52. ]) {
  53. cube([footer_height, footer_width, frame_depth]);
  54. }
  55. }