front.scad 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. include <ATX.scad>
  2. include <functions.scad>
  3. include <angle.scad>
  4. include <addon.scad>
  5. include <../config/global.scad>
  6. include <../config/front.scad>
  7. function front_size() = [
  8. front_motherboard_size.x + front_padding * 2,
  9. front_height + front_padding * 2
  10. ];
  11. module front_shape() {
  12. padding = front_padding;
  13. rounding = front_rounding;
  14. size = front_size();
  15. width = size.x;
  16. height = size.y;
  17. module corner(vector) {
  18. translate(vector) {
  19. circle(r = rounding);
  20. }
  21. }
  22. module base_shape() {
  23. hull() {
  24. for (count = square_vector(width, height, rounding)) {
  25. corner(count);
  26. }
  27. }
  28. }
  29. module mounting_cutoff() {
  30. move_y
  31. = height / 2
  32. - angle_depth / 2
  33. + plywood_thickness / 2;
  34. move_x
  35. = width / 2
  36. - angle_depth / 2
  37. + plywood_thickness / 2;
  38. module right_cutoff() {
  39. translate([move_x, 0]) {
  40. rotate(90) {
  41. angle_cutoff();
  42. }
  43. }
  44. }
  45. translate([0, move_y]) {
  46. angle_cutoff();
  47. }
  48. right_cutoff();
  49. mirror([1, 0]) {
  50. right_cutoff();
  51. }
  52. }
  53. difference() {
  54. base_shape();
  55. mounting_cutoff();
  56. if (front_addon) {
  57. addon_cutoff();
  58. }
  59. }
  60. }
  61. module front_object() {
  62. height = plywood_thickness;
  63. color("#AAEEFF") {
  64. render() {
  65. linear_extrude(height = height, center = true) {
  66. front_shape();
  67. }
  68. }
  69. }
  70. }