top.scad 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. include <ATX.scad>
  2. include <pattern.scad>
  3. include <functions.scad>
  4. include <../config/global.scad>
  5. include <../config/top.scad>
  6. module top_shape() {
  7. padding = top_padding;
  8. rounding = top_rounding;
  9. motherboard_size = top_motherboard_size;
  10. motherboard_holes_positions = top_motherboard_holes;
  11. motherboard_hole = top_motherboard_holes_diameters;
  12. module corner(move = [0, 0]) {
  13. translate(move) {
  14. circle(r = rounding);
  15. }
  16. }
  17. module base_shape() {
  18. width = motherboard_size.x + padding * 2;
  19. height = motherboard_size.y + padding * 2;
  20. hull() {
  21. for (count = square_vector(width, height, rounding)) {
  22. corner(count);
  23. }
  24. }
  25. }
  26. module motherboard_holes() {
  27. translate([0, padding]) {
  28. for (count = motherboard_holes_positions) {
  29. translate(count) {
  30. circle(d = motherboard_hole);
  31. }
  32. }
  33. }
  34. }
  35. difference() {
  36. base_shape();
  37. motherboard_holes();
  38. if (top_pattern) {
  39. pattern(motherboard_size.x, motherboard_size.y);
  40. }
  41. }
  42. }
  43. module top_object() {
  44. linear_extrude(center = true, height = plywood_thickness) {
  45. top_shape();
  46. }
  47. }