container.scad 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. include <../config/container.scad>
  2. include <../config/wall.scad>
  3. include <hook.scad>
  4. module container_base_object(cut_x = 0, cut_y = 0, cut_z = 0) {
  5. move_x = (container_width - cut_x - container_rounding * 2) / 2;
  6. move_y = (container_depth - cut_y - container_rounding * 2) / 2;
  7. move_z = (container_height - cut_z - container_rounding * 2) / 2;
  8. rounding = container_rounding;
  9. hull() {
  10. translate([move_x, move_y, -move_z]) {
  11. sphere(r = rounding);
  12. }
  13. translate([-move_x, move_y, -move_z]) {
  14. sphere(r = rounding);
  15. }
  16. translate([-move_x, -move_y, -move_z]) {
  17. sphere(r = rounding);
  18. }
  19. translate([move_x, -move_y, -move_z]) {
  20. sphere(r = rounding);
  21. }
  22. translate([move_x, move_y, move_z]) {
  23. cylinder(r = rounding, h = rounding, center = true);
  24. }
  25. translate([-move_x, move_y, move_z]) {
  26. cylinder(r = rounding, h = rounding, center = true);
  27. }
  28. translate([-move_x, -move_y, move_z]) {
  29. cylinder(r = rounding, h = rounding, center = true);
  30. }
  31. translate([move_x, -move_y, move_z]) {
  32. cylinder(r = rounding, h = rounding, center = true);
  33. }
  34. }
  35. }
  36. module container_cut_object() {
  37. cut = container_wall_thickness * 2;
  38. translate([0, 0, cut / 2]) {
  39. container_base_object(cut, cut, cut / 2);
  40. }
  41. }
  42. module container_hook_holes_shape() {
  43. full_width = container_width - container_width % wall_holes_space;
  44. width = full_width - wall_holes_space;
  45. move_x = width / 2;
  46. for (count = [-move_x : wall_holes_space : move_x]) {
  47. translate([count, 0]) {
  48. hook_mounting_hole_shape();
  49. }
  50. }
  51. }
  52. module container_hook_holes_object() {
  53. translate([0, container_depth / 2 + 0.5, 0]) {
  54. rotate([90, 0, 0]) {
  55. linear_extrude(height = container_wall_thickness + 1) {
  56. container_hook_holes_shape();
  57. }
  58. }
  59. }
  60. }
  61. module container_object() {
  62. color(container_color) {
  63. render() {
  64. difference() {
  65. container_base_object();
  66. container_cut_object();
  67. container_hook_holes_object();
  68. }
  69. }
  70. }
  71. }