shelf.scad 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. include <../config/shelf.scad>
  2. module shelf_angle() {
  3. module base_shape() {
  4. move_x = shelf_angle_depth / 2 - shelf_rounding;
  5. move_y = shelf_angle_height / 2 - shelf_rounding;
  6. module base() {
  7. hull() {
  8. translate([-move_x, move_y]) {
  9. circle(r = shelf_rounding);
  10. }
  11. translate([-move_x, -move_y]) {
  12. circle(r = shelf_rounding);
  13. }
  14. }
  15. hull() {
  16. translate([-move_x, shelf_rounding]) {
  17. square(shelf_rounding * 2, center = true);
  18. }
  19. translate([move_x, shelf_rounding]) {
  20. circle(r = shelf_rounding);
  21. }
  22. translate([-move_x, -shelf_rounding]) {
  23. square(shelf_rounding * 2, center = true);
  24. }
  25. translate([move_x, -shelf_rounding]) {
  26. circle(r = shelf_rounding);
  27. }
  28. }
  29. }
  30. module reverse_corner(size = 10, rotation = 0) {
  31. module base() {
  32. difference() {
  33. square(size * 2, center = true);
  34. circle(r = size);
  35. }
  36. }
  37. module mask() {
  38. translate([0, size / 2]) {
  39. square([size * 2, size], center = true);
  40. }
  41. translate([size / 2, -size / 2]) {
  42. square(size, center = true);
  43. }
  44. }
  45. render() {
  46. rotate(90 * rotation) {
  47. translate([size / 2, size / 2]) {
  48. difference() {
  49. base();
  50. mask();
  51. }
  52. }
  53. }
  54. }
  55. }
  56. module indentation() {
  57. width = shelf_angle_depth - shelf_angle_thickness;
  58. height = shelf_thickness;
  59. translate([shelf_angle_thickness / 2, 0]) {
  60. square([width, height], center = true);
  61. }
  62. }
  63. render() {
  64. difference() {
  65. base();
  66. indentation();
  67. }
  68. }
  69. base_size = min(shelf_angle_height / 2, shelf_angle_depth);
  70. size = base_size - shelf_rounding * 2;
  71. corner_move_x = size / 2
  72. - shelf_angle_depth / 2
  73. + shelf_rounding * 2;
  74. corner_move_y = size / 2
  75. - shelf_angle_height / 2;
  76. translate([corner_move_x, -corner_move_y]) {
  77. reverse_corner(size, 0);
  78. }
  79. }
  80. base_shape();
  81. }