desk_mount.scad 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* CONFIG PART */
  2. desk_thickness = 8;
  3. moulding_size = 10;
  4. thickness = 5;
  5. rounding = 2;
  6. $fn = 30;
  7. /* END OF CONFIG PART */
  8. top_width = moulding_size + thickness * 2;
  9. bottom_width = top_width + desk_thickness * 2;
  10. top_depth = moulding_size + thickness;
  11. bottom_depth = moulding_size;
  12. full_depth = top_depth + bottom_depth;
  13. module rounded_square(width, height, rounded = true) {
  14. if (!rounded) {
  15. square([width, height], center = true);
  16. } else {
  17. hull() {
  18. move_x = width / 2 - rounding;
  19. move_y = height / 2 - rounding;
  20. translate([move_x, move_y]) circle(r = rounding);
  21. translate([-move_x, move_y]) circle(r = rounding);
  22. translate([move_x, -move_y]) circle(r = rounding);
  23. translate([-move_x, -move_y]) circle(r = rounding);
  24. }
  25. }
  26. }
  27. module base() {
  28. translate([0, -full_depth / 2]) hull() {
  29. translate([0, top_depth / 2 + bottom_depth]) {
  30. rounded_square(top_width, top_depth);
  31. }
  32. translate([0, bottom_depth / 2]) {
  33. rounded_square(bottom_width, bottom_depth);
  34. }
  35. }
  36. }
  37. module without_moulding() {
  38. difference() {
  39. base();
  40. translate([0, full_depth / 2 - moulding_size / 2]) {
  41. rounded_square(moulding_size, moulding_size, false);
  42. }
  43. }
  44. }
  45. without_moulding();