# Untitled

a guest
Mar 24th, 2021
55
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. \$fn=24;
2.
3. difference(){
4. translate([25,0,0]) body(215,85,12,12,3);
5. union(){
6. translate([0,0,1.5]) body(163,82,11,12,5);
7. translate([0,39,0]) sidebuttons(-60,-40,-20,5,2);
8. translate([5,0,0]) camerahole(30,7);
9. translate([60,-20,5]) cylinder(30,5,5,true);
10. intersection(){
11. }
12. difference(){
13. translate([25,0,0]) body(210,80,10,12,4);
14. cube([165,100,15],true);
15. //screwposts
16. translate([0,0,5]) screwposts();
17.
18. }
19. }
20. //usbc hole
21. translate([80,3,0]) cube([20,15,10],true);
22. //cut out a right door
23. translate([105,0,-8]) difference(){
24. cube([50,100,10],true);
25. translate([.5,0,-.5]) cube([50,101,10],true);
26. }
27. translate([0,0,5]) screws();
29. translate([-80,-20,0]) rotate([0,90,0]) cylinder(50,3,3,true);
30. //kb hole
31. translate([103,0,10]) cube([40,65,20],true);
32. }
33.
34. module body(x,y,z,r1,r2){
35. //r1 is the xy corners
36. //r2 is the zx/y corners
37. for(ix= [-1,1,1]) for(iy=[-1,1,1])
38. translate([ix*(x*.5-r1),iy*(y*.5-r1),0]) bodycorner(x,y,z,r1,r2);
39. bodysides(x,y,z,r1,r2);
40. }
41.
42. module bodycorner(x,y,z,r1,r2){
43. //middle
44. cylinder(z-r2-r2,r1,r1,true);
45. //caps
46. for(iz= [-1,1,1]) translate([0,0,iz*(z*.5-r2)]) scale([1,1,r2/r1]) sphere(r1);
47. }
48.
49. module bodysides(x,y,z,r1,r2){
50. //body sides y
51. //middle
52. cube([x,y-r1-r1,z-r2-r2],true);
53. for(iz= [-1,1,1]) for(ix=[-1,1,1])
54. translate([ix*(x*.5-r1),0,iz*(z*.5-r2)]) scale([1,1,r2/r1]) rotate([90,0,0]) cylinder(y-r1-r1,r1,r1,true);
55.
56. //body sides x
57. //middle
58. cube([x-r1-r1,y,z-r2-r2],true);
59. for(iz= [-1,1,1]) for(iy=[-1,1,1])
60. translate([0,iy*(y*.5-r1),iz*(z*.5-r2)]) scale([1,1,r2/r1]) rotate([90,0,90]) cylinder(x-r1-r1,r1,r1,true);
61.
62. //body sides z
63. //middle
64. cube([x-r1-r1,y-r1-r1,z],true);
65. }
66.
67.
69. cube([x,y-c-c,z],true);
70. cube([x-c-c,y,z],true);
71. }
72.
73. module buttons(sr,br,z){
74. for(ir=[0,90,180,270])
75. rotate([0,0,ir]) translate([0,sr,0]) cylinder(z,br,br,true);
76. }
77.
78. module shoulderbuttons(a,b,c,d,r1,r2){
79.
80. translate([a,6,0]) shoulderbutton(r1,r2);
81. translate([b,6,0])shoulderbutton(r1,r2);
82. translate([c,6,0]) shoulderbutton(r1,r2);
83. translate([d,6,0]) shoulderbutton(r1,r2);
84. }
85.
86. module sidebuttons(a,b,c,r1,r2){
87.
88. translate([a,5,0]) sidebutton(r1,r2);
89. translate([b,5,0])sidebutton(r1,r2);
90. translate([c,5,0]) sidebutton(r1,r2);
91. }
92. module sidebutton(r1,r2){
93. rotate([0,90,90]) cylinder(8,r1,r2,true);
94. }
95. module shoulderbutton(r1,r2){
96. rotate([0,90,90]) cylinder(8,r1,r2,true);
97. }
98.
99. module camerahole(w,r){
100. translate([-65,17,0]) {
101. translate([0,w/2-r,0]) cylinder(20,r,r,true);
102. translate([0,-w/2+r,0]) cylinder(20,r,r,true);
103. cube([r+r,w-r-r,20],true);
104. }
105.
106. }
107. module cabletube(){
108. translate([0,-42,0])rotate([90,0,90]) cylinder(225,4,4,true);
109. }
110.
111. module screwposts(){
112. translate([125,0,0]) cylinder(20,3,3,true);
113. translate([90,-35,0]) cylinder(20,3,3,true);
114. translate([90,35,0]) cylinder(20,3,3,true);
115.
116. }
117.
118. module screws(r){
119. translate([125,0,-10]) cylinder(20,r,r,true);
120. translate([90,-35,-10]) cylinder(20,r,r,true);
121. translate([90,35,-10]) cylinder(20,r,r,true);
122. }
RAW Paste Data