Advertisement
Guest User

Untitled

a guest
May 8th, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. // 2025.04.30 - slight lift on the body, maybe a brim
  2.  
  3.  
  4. include <BOSL2/std.scad>
  5. include <BOSL2/screws.scad>
  6. include <BOSL2/rounding.scad>
  7.  
  8. $fa=10; // minimum angle for fragment. default 12
  9. $fs=0.5; // minimum size of a fragment. default 2
  10. $fn=70; // number of fragments, if not 0, overrides the above
  11.  
  12. $slop=0.0;
  13.  
  14. /* [Hidden] */
  15.  
  16. // DEFINES
  17. plateOuterLength = 42.5; // 2025.04.29 42.0 is slightly too small with the latest design. 42.5 fits, but just barely. maybe 4.6.
  18. plateOuterWidth = 26.7;
  19. plateHeight = 4;
  20.  
  21. // TWEAKABLES
  22. wall = 3;
  23. lengthWall = wall;
  24. widthWall = wall;
  25. topSize = 3.5;
  26. nutTrapDepth = 2.5;
  27. nutSpecDef = "m3";
  28. screwHoleSpec = "m3";
  29. bodyRounding = 3.5;
  30.  
  31. // CALCULATED - do not set directly
  32. bodyLength = plateOuterLength + lengthWall; //44.5;
  33. bodyWidth = plateOuterWidth + widthWall; //28.5;
  34. bodyHeight = plateHeight + topSize; //5.0;
  35. screwHoleLength = bodyHeight-nutTrapDepth;
  36.  
  37. module Body()
  38. {
  39. // back_half() //left_half()
  40. diff()
  41. cuboid([bodyLength, bodyWidth, bodyHeight], anchor = BOT, orient=TOP, rounding=bodyRounding, teardrop=false) //, edges=[TOP, "Z"])
  42. {
  43. // the screw shapes
  44. //color_overlaps()
  45. tag("remove")
  46. position(TOP) translate([0,0,0.001])
  47. nut_trap_inline(nutTrapDepth, nutSpecDef, $slop=0.1, anchor=TOP)
  48. position(BOT) translate([0,0,0.001])
  49. screw_hole(screwHoleSpec, length=screwHoleLength, $slop=0.1, head="flat", anchor=BOT, orient=BOT);
  50.  
  51. // interior cavity
  52. //color_overlaps()
  53. tag("remove")
  54. position(BOT) translate([0,0,-0.001])
  55. cuboid([plateOuterLength, plateOuterWidth, plateHeight], anchor = BOT, rounding=2, edges=[LEFT+FRONT, RIGHT+FRONT, LEFT+BACK, RIGHT+BACK]);
  56. }
  57. }
  58.  
  59. TopOfBodyHeight = 4;
  60. TopOfBodyRadius = 6;
  61.  
  62. module TopOfBody()
  63. {
  64. base = round_corners(square([bodyLength - (bodyRounding * 2), bodyWidth - (bodyRounding * 2)],center=true), radius=0.5);
  65. translate([0,0,5.5])
  66. diff()
  67. skin([
  68. //path3d(base,0),
  69. path3d(base, 2),
  70. path3d(circle(r=TopOfBodyRadius), TopOfBodyHeight),
  71. ], slices=0)
  72. {
  73. // the screw shapes
  74. //color_overlaps()
  75. tag("remove")
  76. position(TOP) translate([0,0,0.001])
  77. nut_trap_inline(nutTrapDepth, nutSpecDef, $slop=0.1, anchor=TOP)
  78. position(BOT) translate([0,0,0.001])
  79. screw_hole(screwHoleSpec, length=screwHoleLength, $slop=0.1, head="flat", anchor=BOT, orient=BOT);
  80.  
  81. }
  82. }
  83.  
  84. module Plate()
  85. {
  86. magnetPosY = 5;
  87. magnetPosX = 5;
  88. plateThickness = 1;
  89. MagnetDiameter = 3.25;
  90.  
  91. module MagnetHole(TranslateX, TranslateY, TranslateZ)
  92. {
  93. //color_overlaps()
  94. tag("remove")
  95. position(TOP)
  96. translate([TranslateX, TranslateY, -TranslateZ + 0.01])
  97. cyl(l=plateHeight - plateThickness, r=MagnetDiameter, anchor = TOP, rounding1=0, rounding2=-1, chamfang=3, $fa=1, $fs=1);
  98. }
  99.  
  100. color_overlaps()
  101. diff()
  102. cuboid([plateOuterLength - 0.1, plateOuterWidth - 0.1, plateHeight], anchor = BOT, rounding=5, edges=[LEFT+FRONT, RIGHT+FRONT, LEFT+BACK, RIGHT+BACK])
  103. {
  104.  
  105. MagnetHole(magnetPosX, magnetPosY, 0);
  106. MagnetHole(magnetPosX*3, magnetPosY, 0);
  107. MagnetHole(magnetPosX, -magnetPosY, 0);
  108. MagnetHole(magnetPosX*3, -magnetPosY, 0);
  109.  
  110. MagnetHole(-magnetPosX, magnetPosY, 0);
  111. MagnetHole(-magnetPosX*3, magnetPosY, 0);
  112. MagnetHole(-magnetPosX, -magnetPosY, 0);
  113. MagnetHole(-magnetPosX*3, -magnetPosY, 0);
  114.  
  115. //color_overlaps()
  116. position(BOT) translate([0,0,0.001])
  117. screw_hole(screwHoleSpec, length=screwHoleLength, $slop=0.0, head="flat", anchor=TOP, orient=BOT);
  118. }
  119. }
  120.  
  121. Body();
  122. TopOfBody();
  123. Plate();
  124.  
  125. ///
  126. /// Testing
  127. ///
  128. // hexregion = circle(r=50.01,$fn=6);
  129. // grid_copies(spacing=10, stagger=true, inside=hexregion)
  130. // union() { // Needed for OpenSCAD 2021.01 as noted above
  131. // ref_v = (unit([0,0,50]-point3d($pos)) + UP)/2;
  132. // half_of(v=-ref_v, cp=[0,0,5])
  133. // zrot(180/6)
  134. // cylinder(h=20, d=10/cos(180/6)+0.01, $fn=6);
  135. // }
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142. use <dotSCAD/src/bezier_curve.scad>
  143. use <dotSCAD/src/surface/sf_splines.scad>
  144. use <dotSCAD/src/surface/sf_thicken.scad>
  145.  
  146. ctrl_pts = [
  147. [[0, 0, 20], [60, 0, -35], [90, 0, 60], [200, 0, 5]],
  148. [[0, 50, 30], [100, 60, -25], [120, 50, 120], [200, 50, 5]],
  149. [[0, 100, 0], [60, 120, 35], [90, 100, 60], [200, 100, 45]],
  150. [[0, 150, 0], [60, 150, -35], [90, 180, 60], [200, 150, 45]]
  151. ];
  152.  
  153. thickness = 2;
  154. t_step = 0.05;
  155.  
  156. bezier = function(points) bezier_curve(t_step, points);
  157.  
  158. sf_thicken(sf_splines(ctrl_pts, bezier), thickness);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement