side.scad 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. include <ATX.scad>
  2. include <../config/side.scad>
  3. include <../config/plate.scad>
  4. module side_shape() {
  5. rounding = side_rounding / 2;
  6. module corner(x = 0, y = 0, rounded = true) {
  7. translate([x, y]) {
  8. if (rounded) {
  9. circle(r = rounding);
  10. } else {
  11. square([rounding * 2, rounding * 2], center = true);
  12. }
  13. }
  14. }
  15. module handle() {
  16. top_width = side_handle_width;
  17. bottom_width = side_width;
  18. height = side_handle_height;
  19. move_y = height / 2 - rounding;
  20. move_x_top = top_width / 2 - rounding;
  21. move_x_bottom = bottom_width / 2 - rounding;
  22. union() {
  23. hull() {
  24. corner(-move_x_bottom, -move_y);
  25. corner(-move_x_top, move_y);
  26. }
  27. hull() {
  28. corner(-move_x_top, move_y);
  29. corner(move_x_top, move_y);
  30. }
  31. hull() {
  32. corner(move_x_top, move_y);
  33. corner(move_x_bottom, -move_y);
  34. }
  35. }
  36. }
  37. width = side_width;
  38. handle_height = side_handle_height;
  39. height = side_height + handle_height;
  40. cutoff_width = side_cutoff_width;
  41. cutoff_height = side_cutoff_height;
  42. module base_shape() {
  43. move_x = width / 2 - rounding;
  44. move_y_top = height / 2 - handle_height / 2 + rounding;
  45. move_y_bottom = -(height - rounding * 2) / 2 - handle_height / 2;
  46. cutoff_move_x = cutoff_width / 2 - rounding;
  47. cutoff_move_y = cutoff_height / 2 - rounding;
  48. cutoff_position_y = move_y_bottom + cutoff_move_y;
  49. difference() {
  50. hull() {
  51. corner(move_x, move_y_top);
  52. corner(move_x, move_y_bottom);
  53. corner(-move_x, move_y_top);
  54. corner(-move_x, move_y_bottom);
  55. }
  56. translate([0, cutoff_position_y]) {
  57. hull() {
  58. corner(cutoff_move_x, cutoff_move_y);
  59. corner(-cutoff_move_x, cutoff_move_y);
  60. corner(cutoff_move_x, -cutoff_move_y, false);
  61. corner(-cutoff_move_x, -cutoff_move_y, false);
  62. }
  63. }
  64. }
  65. }
  66. base_shape();
  67. translate([0, height / 2]) {
  68. handle();
  69. }
  70. }
  71. module side_object() {
  72. linear_extrude(height = side_thickness, center = true) {
  73. side_shape();
  74. }
  75. }