Advertisement
Guest User

Untitled

a guest
Feb 19th, 2025
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. //Custom Lidded Box
  2. //based on Hybris Labs Instructable http://www.instructables.com/id/Creating-a-custom-sized-box-for-3D-printing-with-O/
  3.  
  4. // Global resolution
  5. $fs = 0.1; // Don't generate smaller facets than 0.1 mm
  6. $fn = 200; //results in smooth shape
  7.  
  8. //Variables
  9. length = 100; //length of box in mm
  10. width = 100; //width of box in mm
  11. height = 30; //height of box in mm
  12. radius = 10; //radius of corner cylinder in mm
  13. doubleRadius = 2*radius; //doubleRad
  14.  
  15. //cutout
  16. translate([10,10,0])
  17. {
  18. difference()
  19. {
  20. roundedBox(length, width, height, radius);
  21. translate([1,1,1])
  22. {
  23. //box wall thickness parameters
  24. roundedBox(length-2, width-2, height-1, radius);
  25. }
  26. }
  27. }
  28.  
  29. //Lid
  30. translate([length*2, 10, 0]) //if you change the size of the box you will need to move the lid so it does not intersect the box
  31. {
  32. mirror([1,0,0])
  33. {
  34. roundedBox(length, width, 1, radius);
  35. difference()
  36. {
  37. translate([1,1,0])
  38. {
  39. roundedBox(length-2, width-2, 4, radius);
  40. }
  41. translate([2,2,0])
  42. {
  43. roundedBox(length-4, width-4, 4, radius);
  44. }
  45. }
  46. }
  47. }
  48.  
  49. //Lid Tab
  50. // translate([120,length-13,0]) //if you change the size of the box you will need to move the lid tab to fit on the lid
  51. // {
  52. // difference()
  53. // {
  54. // difference()
  55. // {
  56. // cylinder(h=2, r=7);//outer ring
  57. // cylinder(h=2, r=3);//inner ring
  58.  
  59. // }
  60. // translate([0,-10,0])
  61. // {
  62. // cube(size=[10,10,2]);//cut out edge of box
  63. // }
  64. // }
  65. // }
  66.  
  67. //Modules
  68. module roundedBox(length, width, height, radius)
  69. {
  70. //basic box shape, Minkowski function rounds cube corners
  71. minkowski()
  72. {
  73. cube (size=[length-doubleRadius, width-doubleRadius, height]);
  74. cylinder(r=radius, h = 0.01);
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement