gcdanie

Untitled

Mar 29th, 2025
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.72 KB | Source Code | 0 0
  1. /*
  2. Uses the gridfinity-rebuilt library.
  3. Supply vectors for the socket diameters (sockets), the socket names, the socket height, socket orientation (90 = flat, 0 = vertical), your desired spacing, then use the fineAdjust parameters to get the titles where you'd like them on the body.
  4.  
  5. This does not adjust the base size, you should handle that in the gridfinity setup parameters (below the socket parameters).
  6.  
  7. Includes a number of "presets" for use.
  8. */
  9.  
  10. include <src/core/standard.scad>
  11. use <src/core/gridfinity-rebuilt-utility.scad>
  12. use <src/core/gridfinity-rebuilt-holes.scad>
  13. use <src/helpers/generic-helpers.scad>
  14.  
  15. //socket constants
  16.  
  17. binTitle = "3/8\" Metric Deep 6 Point Impact Sockets";
  18. sockets = [18, 18, 19, 21, 22.5, 22.5, 24, 24, 26, 27];
  19. socketNames = ["10", "11", "12", "13", "14", "15", "16", "17", "18", "19"];
  20. spacing = 1.5;
  21. socketHeight = 67;
  22. orientation = 90;
  23. fineAdjustLabel = 5;
  24. fineAdjustTitle = 3;
  25. fineAdjustSocket = 5;
  26.  
  27. /*
  28. binTitle = "3/8\" SAE Deep 12 Point";
  29. sockets = [18, 18, 18, 18, 19, 21, 23, 25, 27, 28, 31];
  30. socketNames = ["1/4", "5/16", "3/8", "7/16", "1/2", "9/16", "5/8", "11/16", "3/4", "13/16", "7/8"];
  31. spacing = 1.5;
  32. socketHeight = 65;
  33. orientation = 90;
  34. fineAdjustLabel = 6;
  35. fineAdjustTitle = 3;
  36. fineAdjustSocket = 5;
  37. */
  38. /*
  39. binTitle = "1/4\" Metric Deep 6 Point";
  40. sockets = [12.5, 12.5, 12.5, 12.5, 12.5, 13.5, 14.2, 16.2, 17.5, 18.2, 20.5];
  41. socketNames = ["5", "5.5", "6", "7", "8", "9", "10", "11", "12", "13", "14"];
  42. spacing = 1.5;
  43. socketHeight = 52;
  44. orientation = 90;
  45. fineAdjustLabel = 6;
  46. fineAdjustTitle = 3;
  47. fineAdjustSocket = 10.5;
  48. */
  49.  
  50. /*
  51. binTitle = "1/4\" Metric 6 Point";
  52. sockets = [12.5, 12.5, 12.5, 12.5, 12.5, 13.5, 14.2, 16.2, 17.5, 18.2, 20.5];
  53. socketNames = ["5", "5.5", "6", "7", "8", "9", "10", "11", "12", "13", "14"];
  54. spacing = 1.5;
  55. socketHeight = 52;
  56. orientation = 0;
  57. fineAdjustLabel = 6;
  58. fineAdjustTitle = 3;
  59. fineAdjustSocket = 10.5;
  60. */
  61.  
  62. /* gridfinity constants */
  63.  
  64.  
  65. /* [Setup Parameters] */
  66. $fa = 8;
  67. $fs = 0.25;
  68.  
  69. gridx = 6;
  70. gridy = 2;
  71. gridz = 3;
  72.  
  73. gridz_define = 0;
  74.  
  75. /* [Height] */
  76. // determine what the variable "gridz" applies to based on your use case
  77. gridz_define = 0; // [0:gridz is the height of bins in units of 7mm increments - Zack's method,1:gridz is the internal height in millimeters, 2:gridz is the overall external height of the bin in millimeters]
  78. // overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm
  79. height_internal = 0;
  80. // snap gridz height to nearest 7mm increment
  81. enable_zsnap = false;
  82.  
  83. /* [Base Hole Options] */
  84. // only cut magnet/screw holes at the corners of the bin to save uneccesary print time
  85. only_corners = false;
  86. //Use gridfinity refined hole style. Not compatible with magnet_holes!
  87. refined_holes = false;
  88. // Base will have holes for 6mm Diameter x 2mm high magnets.
  89. magnet_holes = false;
  90. // Base will have holes for M3 screws.
  91. screw_holes = false;
  92. // Magnet holes will have crush ribs to hold the magnet.
  93. crush_ribs = false;
  94. // Magnet/Screw holes will have a chamfer to ease insertion.
  95. chamfer_holes = false;
  96. // Magnet/Screw holes will be printed so supports are not needed.
  97. printable_hole_top = false;
  98. // Enable "gridfinity-refined" thumbscrew hole in the center of each base: https://www.printables.com/model/413761-gridfinity-refined
  99. enable_thumbscrew = false;
  100.  
  101. hole_options = bundle_hole_options(refined_holes, magnet_holes, screw_holes, crush_ribs, chamfer_holes, printable_hole_top);
  102.  
  103. main();
  104.  
  105. function getSpacing(n) = n == 0 ? 0 : (spacing + sockets[n] + getSpacing(n - 1));
  106.  
  107. module posLabels(yPos) {
  108. translate([-(getSpacing(len(sockets) - 1))/2 - spacing,
  109. yPos,
  110. 21]) {
  111. for (i = [0 : len(sockets) - 1] ) {
  112. translate([getSpacing(i), 0, 0]) {
  113. linear_extrude(2)
  114. text(socketNames[i], size = 3.5, halign="center");
  115. }
  116. }
  117. }
  118. }
  119.  
  120. module sizeLabels() {
  121. if (orientation != 90) {
  122. posLabels(-(max(sockets)/2) - fineAdjustLabel);
  123. } else {
  124. posLabels(-socketHeight/2 - fineAdjustLabel);
  125. }
  126. }
  127.  
  128. module posTrayLabel(yPos) {
  129. translate([0, yPos, 21]) {
  130. linear_extrude(2)
  131. text(binTitle, size = 4, halign="center");
  132. }
  133. }
  134.  
  135. module trayLabel() {
  136. if (orientation != 90) {
  137. posTrayLabel(max(sockets)/2 + fineAdjustTitle);
  138. } else {
  139. posTrayLabel(socketHeight/2 + fineAdjustTitle);
  140. }
  141. }
  142.  
  143. module posSocketBodies(rotation, sPos) {
  144. translate(sPos) {
  145. rotate( [rotation, 0, 0] ) {
  146. for (i = [0 : len(sockets) - 1]) {
  147. translate([getSpacing(i), 0, 0]) {
  148. cylinder(h = socketHeight, d = sockets[i]);
  149. }
  150. }
  151. }
  152. }
  153. }
  154.  
  155. module socketBodies() {
  156. if (orientation != 90) {
  157. posSocketBodies(0, [-(getSpacing(len(sockets) - 1))/2 - spacing,
  158. 0,
  159. 6]);
  160. } else {
  161. posSocketBodies(90, [-(getSpacing(len(sockets) - 1))/2 - spacing,
  162. socketHeight/2,
  163. (max(sockets)/2 + fineAdjustSocket)]);
  164. }
  165. }
  166.  
  167. module main() {
  168. sizeLabels();
  169. trayLabel();
  170. difference() {
  171. gridBase();
  172. socketBodies();
  173. }
  174. }
  175.  
  176. module gridBase() {
  177. gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), height_internal, sl=style_lip) {
  178.  
  179. if (divx > 0 && divy > 0) {
  180.  
  181. cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop, place_tab = place_tab);
  182.  
  183. } else if (cdivx > 0 && cdivy > 0) {
  184.  
  185. cutCylinders(n_divx=cdivx, n_divy=cdivy, cylinder_diameter=cd, cylinder_height=ch, coutout_depth=c_depth, orientation=c_orientation, chamfer=c_chamfer);
  186. }
  187. }
  188. gridfinityBase([gridx, gridy], hole_options=hole_options, only_corners=only_corners, thumbscrew=enable_thumbscrew);
  189. }
  190.  
Advertisement
Add Comment
Please, Sign In to add comment