My self-made 3D-printable designs, mainly in OpenSCAD
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

pipe-light.scad 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. gap = 15;
  2. wall = 3;
  3. add_outlet = gap - wall;
  4. support = 2;
  5. tab_w = 8;
  6. tab_p = 2;
  7. tab_x = 2;
  8. tab_d = tab_w + tab_p;
  9. tab_h1 = 3.8;
  10. tab_h2 = 6;
  11. display = true;
  12. $fn = 42;
  13. module wall() {
  14. difference() {
  15. translate([-18, -50, -50])
  16. cube([18, 100, 100]);
  17. translate([1, 0, 0])
  18. rotate([0, -90, 0])
  19. cylinder(d = 15, h = 20);
  20. }
  21. }
  22. module prism(l, w, h) {
  23. polyhedron(
  24. points = [[0,0,0], [l,0,0], [l,w,0], [0,w,0], [0,w,h], [l,w,h]],
  25. faces = [[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]]
  26. );
  27. }
  28. module prism_arc(w, n = 5, d = 0.1) {
  29. hull()
  30. for (i = [0 : n]) {
  31. rotate([0, 0, i / n * 90])
  32. translate([0, w, 0])
  33. rotate([0, 0, 180])
  34. translate([-d / 2, 0, 0]) // TODO
  35. prism(d, w, w);
  36. }
  37. }
  38. module addition(h) {
  39. translate([0, -wall, 0])
  40. cube([gap + wall, wall, h]);
  41. translate([gap, 0, 0])
  42. cube([wall, gap, h]);
  43. translate([0, gap, 0])
  44. cube([gap + wall, wall, h]);
  45. translate([gap - support, gap, h])
  46. rotate([90, 90, 0])
  47. prism(h + wall + gap, support, support);
  48. translate([gap, support, h])
  49. rotate([180, 90, 0])
  50. prism(h + wall, support, support);
  51. translate([gap, 0, -wall])
  52. rotate([0, -90, 0])
  53. prism_arc(support);
  54. }
  55. module tab() {
  56. difference() {
  57. cube([tab_w, tab_d, tab_x]);
  58. translate([tab_w / 2, (tab_d - tab_p) / 2, -0.1])
  59. cylinder(d1 = tab_h1, d2 = tab_h2, h = tab_x + 0.2);
  60. }
  61. translate([0, tab_d - tab_p, tab_x])
  62. prism(tab_w, tab_p, tab_p);
  63. for (i = [0 : 1])
  64. translate([i * tab_w, 0, 0])
  65. scale([i * 2 - 1, 1, 1]) {
  66. translate([0, tab_d - tab_p, tab_x])
  67. rotate([0, 90, 0])
  68. prism(tab_x, tab_p, tab_p);
  69. translate([0, tab_d, tab_x])
  70. rotate([90, 90, 0])
  71. prism_arc(tab_p);
  72. }
  73. }
  74. module block(base = true) {
  75. //%translate([0, 0, wall])
  76. //cube([gap, gap, gap]);
  77. if (base) {
  78. cube([gap, gap, wall]);
  79. } else {
  80. cube([gap, gap + wall, wall]);
  81. }
  82. if (base) {
  83. translate([0, 0, wall + gap])
  84. cube([gap, gap, wall]);
  85. }
  86. if (base) {
  87. translate([0, -wall, 0])
  88. cube([gap, wall, gap + 2 * wall]);
  89. } else {
  90. translate([0, -wall, 0])
  91. cube([gap, wall, gap + wall]);
  92. }
  93. if (base) {
  94. translate([gap, -wall, 0])
  95. cube([wall, gap + wall, gap + 2 * wall]);
  96. } else {
  97. translate([gap, -wall, 0])
  98. cube([wall, gap + wall * 2, gap + wall]);
  99. }
  100. }
  101. module pipeblock() {
  102. translate([0, -gap / 2, -gap / 2 - wall])
  103. block();
  104. translate([0, gap * 3 / 2 + wall, -gap / 2])
  105. rotate([90, 0, 0])
  106. block(false);
  107. translate([0, gap / 2, gap / 2 + wall])
  108. addition(add_outlet);
  109. translate([0, gap * 3 / 2 - support, -gap / 2])
  110. prism(gap, support, support);
  111. translate([0, -gap / 2, -gap / 2 + support])
  112. rotate([-90, 0, 0])
  113. prism(gap, support, support);
  114. translate([0, -gap / 2 + support, gap / 2])
  115. rotate([180, 0, 0])
  116. prism(gap, support, support);
  117. translate([gap, gap / 2, gap / 2 - support])
  118. rotate([90, 0, -90])
  119. prism(gap, support, support);
  120. translate([gap, -gap / 2 + support, gap / 2])
  121. rotate([90, 90, -90])
  122. prism(gap, support, support);
  123. translate([gap, -gap / 2, -gap / 2 + support])
  124. rotate([-90, 0, 90])
  125. prism(gap * 2, support, support);
  126. if (add_outlet > 0) {
  127. translate([0, gap / 2 - wall - support, gap / 2 + wall])
  128. prism(gap + wall, support, support);
  129. }
  130. translate([0, 0, tab_d + gap / 2 + wall])
  131. rotate([-90, 0, -90])
  132. tab();
  133. translate([0, -gap / 2 - tab_d - wall, tab_w / 2])
  134. rotate([-90, 90, -90])
  135. tab();
  136. translate([0, gap * 3 / 2 + wall + tab_d, tab_w / 2])
  137. rotate([-90, -90, -90])
  138. tab();
  139. translate([0, gap / 2 - tab_w / 2, -gap / 2 - wall - tab_d])
  140. rotate([-90, 180, -90])
  141. tab();
  142. }
  143. if (display) {
  144. %wall();
  145. pipeblock();
  146. translate([-18, 0, 0])
  147. rotate([-90, 180, 0])
  148. pipeblock();
  149. } else {
  150. translate([0, 0, gap + wall])
  151. rotate([0, 90, 0])
  152. pipeblock();
  153. }