You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

screw_enclosure.scad 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. //
  2. // Customized Enclosure
  3. //
  4. /*[Dimensions]*/
  5. // Width of the enclosure
  6. width = 75.0;
  7. // Height of the enclosure
  8. height = 55.0;
  9. // Depth of the enclosure
  10. depth = 30.0;
  11. // Thickness of the walls and lid
  12. thickness = 2;
  13. // Amount of corner rounding
  14. fillet_radius = 5.0;
  15. /*[Hidden]*/
  16. // Position offset from the corner for the stand-offs
  17. standoff_offset = 0.5;
  18. // Radius of the stand-offs
  19. standoff_radius = 3.5;
  20. // Radius of the hole in the stand-offs
  21. standoff_hole_radius = 1.5;
  22. //
  23. // builds a solid rectangle with rounded corners (Z-only)
  24. //
  25. module block(width, height, depth, fillet_radius) {
  26. difference() {
  27. cube([width, height, depth], center = true);
  28. fudge = 0.1;
  29. fudge_depth = depth + 1.0;
  30. translate([-(width / 2), -(height / 2), -(fudge_depth / 2)])
  31. intersection () {
  32. cube([fillet_radius, fillet_radius, fudge_depth], center = false);
  33. difference() {
  34. cube([2 * fillet_radius, 2 * fillet_radius, fudge_depth], center = false);
  35. translate([fillet_radius, fillet_radius, 0.0])
  36. cylinder(r = fillet_radius, h = fudge_depth);
  37. }
  38. }
  39. translate([-(width / 2 + fudge), (height / 2 + fudge), -(fudge_depth / 2)])
  40. rotate([0.0, 0.0, -90])
  41. intersection () {
  42. cube([fillet_radius, fillet_radius, fudge_depth], center = false);
  43. difference() {
  44. cube([2 * fillet_radius, 2 * fillet_radius, fudge_depth], center = false);
  45. translate([fillet_radius, fillet_radius, 0.0])
  46. cylinder(r = fillet_radius, h = fudge_depth);
  47. }
  48. }
  49. translate([(width / 2 + fudge), (height / 2 + fudge), -(fudge_depth / 2)])
  50. rotate([0.0, 0.0, 180])
  51. intersection () {
  52. cube([fillet_radius, fillet_radius, fudge_depth], center = false);
  53. difference() {
  54. cube([2 * fillet_radius, 2 * fillet_radius, fudge_depth], center = false);
  55. translate([fillet_radius, fillet_radius, 0.0])
  56. cylinder(r = fillet_radius, h = fudge_depth);
  57. }
  58. }
  59. translate([(width / 2 + fudge), -(height / 2 + fudge), -(fudge_depth / 2)])
  60. rotate([0.0, 0.0, 90])
  61. intersection () {
  62. cube([fillet_radius, fillet_radius, fudge_depth], center = false);
  63. difference() {
  64. cube([2 * fillet_radius, 2 * fillet_radius, fudge_depth], center = false);
  65. translate([fillet_radius, fillet_radius, 0.0])
  66. cylinder(r = fillet_radius, h = fudge_depth);
  67. }
  68. }
  69. }
  70. }
  71. module enclosure(width, height, depth, fillet_radius, thickness, standoff_offset, standoff_radius, standoff_hole_radius) {
  72. union() {
  73. translate([0.0, 0.0, depth / 2.0])
  74. difference() {
  75. block(width, height, depth, fillet_radius);
  76. translate([0.0, 0.0, thickness])
  77. block(width - (2 * thickness), height - (2 * thickness), depth - thickness, fillet_radius);
  78. }
  79. translate([-((width / 2) - (thickness + standoff_radius + standoff_offset)), -((height / 2) - (thickness + standoff_radius + standoff_offset)), thickness ])
  80. difference() {
  81. cylinder(r = standoff_radius, h = (depth - (2 * thickness)), $fn=10);
  82. cylinder(r = standoff_hole_radius, h = (depth - (2 * thickness)), $fn=10);
  83. }
  84. translate([((width / 2) - (thickness + standoff_radius + standoff_offset)), -((height / 2) - (thickness + standoff_radius + standoff_offset)), thickness ])
  85. difference() {
  86. cylinder(r = standoff_radius, h = (depth - (2 * thickness)), $fn=10);
  87. cylinder(r = standoff_hole_radius, h = (depth - (2 * thickness)), $fn=10);
  88. }
  89. translate([-((width / 2) - (thickness + standoff_radius + standoff_offset)), ((height / 2) - (thickness + standoff_radius + standoff_offset)), thickness ])
  90. difference() {
  91. cylinder(r = standoff_radius, h = (depth - (2 * thickness)), $fn=10);
  92. cylinder(r = standoff_hole_radius, h = (depth - (2 * thickness)), $fn=10);
  93. }
  94. translate([((width / 2) - (thickness + standoff_radius + standoff_offset)), ((height / 2) - (thickness + standoff_radius + standoff_offset)), thickness ])
  95. difference() {
  96. cylinder(r = standoff_radius, h = (depth - (2 * thickness)), $fn=10);
  97. cylinder(r = standoff_hole_radius, h = (depth - (2 * thickness)), $fn=10);
  98. }
  99. }
  100. }
  101. module lid(width, height, fillet_radius, thickness, standoff_offset, standoff_radius, standoff_hole_radius) {
  102. difference() {
  103. lid_offset = 10.0;
  104. union() {
  105. translate([0.0, height + lid_offset, thickness / 2.0])
  106. block(width, height, thickness, fillet_radius);
  107. translate([0.0, height + lid_offset, thickness / 2.0 + thickness])
  108. block(width - (2 * thickness), height - (2 * thickness), thickness, fillet_radius);
  109. }
  110. hole_offset = height + lid_offset;
  111. // holes
  112. translate([-((width / 2) - (thickness + standoff_radius + standoff_offset)), -((height / 2) - (thickness + standoff_radius + standoff_offset)) + hole_offset, 0.0])
  113. cylinder(r = standoff_hole_radius, h = (2 * thickness), $fn=10);
  114. translate([-((width / 2) - (thickness + standoff_radius + standoff_offset)), ((height / 2) - (thickness + standoff_radius + standoff_offset)) + hole_offset, 0.0])
  115. cylinder(r = standoff_hole_radius, h = (2 * thickness), $fn=10);
  116. translate([((width / 2) - (thickness + standoff_radius + standoff_offset)), -((height / 2) - (thickness + standoff_radius + standoff_offset)) + hole_offset, 0.0])
  117. cylinder(r = standoff_hole_radius, h = (2 * thickness), $fn=10);
  118. translate([((width / 2) - (thickness + standoff_radius + standoff_offset)), ((height / 2) - (thickness + standoff_radius + standoff_offset)) + hole_offset, 0.0])
  119. cylinder(r = standoff_hole_radius, h = (2 * thickness), $fn=10);
  120. // countersinks
  121. translate([-((width / 2) - (thickness + standoff_radius + standoff_offset)), -((height / 2) - (thickness + standoff_radius + standoff_offset)) + hole_offset, 0.0])
  122. cylinder(r1 = standoff_hole_radius * 2, r2 = 0.0, h = thickness, $fn=10);
  123. translate([-((width / 2) - (thickness + standoff_radius + standoff_offset)), ((height / 2) - (thickness + standoff_radius + standoff_offset)) + hole_offset, 0.0])
  124. cylinder(r1 = standoff_hole_radius * 2, r2 = 0.0, h = thickness, $fn=10);
  125. translate([((width / 2) - (thickness + standoff_radius + standoff_offset)), -((height / 2) - (thickness + standoff_radius + standoff_offset)) + hole_offset, 0.0])
  126. cylinder(r1 = standoff_hole_radius * 2, r2 = 0.0, h = thickness, $fn=10);
  127. translate([((width / 2) - (thickness + standoff_radius + standoff_offset)), ((height / 2) - (thickness + standoff_radius + standoff_offset)) + hole_offset, 0.0])
  128. cylinder(r1 = standoff_hole_radius * 2, r2 = 0.0, h = thickness, $fn=10);
  129. }
  130. }
  131. enclosure(width, height, depth, fillet_radius, thickness, standoff_offset, standoff_radius, standoff_hole_radius);
  132. lid(width, height, fillet_radius, thickness, standoff_offset, standoff_radius, standoff_hole_radius);