customizable_sanding_stick.scad 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. /*
  2. * Customizable Sanding Stick - https://www.thingiverse.com/thing:2404850
  3. * by Dennis Hofmann - https://www.thingiverse.com/mightynozzle/about
  4. * created 2017-08-08
  5. * version v1.3
  6. *
  7. * Changelog
  8. * --------------
  9. * v1.3 - 2017-08-08:
  10. * - [feature] parts will be generated in separate stl-Files additionally.
  11. * v1.2 - 2017-07-31:
  12. * - [fix] reduce the tolerance of the threaded hole. If you have problems, to insert the screw in, you can change the tolerance in the Screw Settings (Advanced!) -> Screw Thread Hole Dia In Millimeter.
  13. * - [feature] parameter to add extra height of the screws head
  14. * v1.1 - 2017-06-27:
  15. * - [feature] added color
  16. * - [cosmetic] updated description for screw settings
  17. * v1.0 - 2017-06-26:
  18. * - initial design
  19. * --------------
  20. *
  21. * This work is licensed under the Creative Commons - Attribution - Non-Commercial ShareAlike license.
  22. * https://creativecommons.org/licenses/by-nc-sa/3.0/
  23. */
  24. // Parameter Section //
  25. //-------------------//
  26. // preview[view:south, tilt:top diagonal]
  27. /* [Sanding Stick Settings] */
  28. // Choose, which part you want to see!
  29. part = "all_parts__"; //[all_parts__:All Parts,screws__:Screws,bottom_part__:Bottom,top_part__:Top]
  30. // The width of the Sanding Stick / Sanding Paper Strip
  31. stick_width_in_millimeter = 15.0; //[9:70]
  32. // The height of the Stick will not be higher than the Base height. This value influences the width of wedge ends.
  33. base_height_in_millimeter = 12.0; //[10:40]
  34. // This is the length of the Base without the length of the ends
  35. base_length_in_millimeter = 50.0; //[37:200]
  36. // Choose, which option for the first end you wish.
  37. end_1_option = "wedge"; //[none,round,wedge]
  38. // Choose between the base_height and half_base_height of the first end. This value also influences the width of the ends. half_base_height is the same height, as the main part of the Sanding Stick.
  39. end_1_height = "base_height"; //[base_height,half_base_height]
  40. // Set the wedge angle of the first end
  41. end_1_wedge_angle = 22.5; // [5:75]
  42. // If you want a sharp end of the wedge, set 0. If you want a round end, set > 0.
  43. end_1_wedge_round_tip_diameter_in_millimeter = 2.0;
  44. // Choose, which option for the second end you wish.
  45. end_2_option = "round"; //[none,round,wedge]
  46. // Choose between the base_height and half_base_height of the second end. This value also influences the width of the ends. half_base_height is the same height, as the main part of the Sanding Stick.
  47. end_2_height = "base_height"; //[base_height,half_base_height]
  48. // Set the wedge angle of the second end.
  49. end_2_wedge_angle = 10.0; //[3:135]
  50. // If you want a sharp end of the wedge, set 0. If you want a round end, set > 0.
  51. end_2_wedge_round_tip_diameter_in_millimeter = 3.0;
  52. /* [Screw Settings (Advanced!)] */
  53. // Thread diameter of the screw
  54. screw_thread_dia_in_millimeter = 6.0;
  55. // Max head diameter of the screw. If the stick width is smaller, the stick width takes place as the head diameter. If you set a higher value, you should also increase the Screw Head Space value for the top part.
  56. screw_head_dia_in_millimeter = 12.0;
  57. // Thread hole diameter of the sanding stick bottom part. You should use Screw Thread Dia and add about 0.5-0.8 mm for tolerance. Otherwise the screw won't fit the threaded hole of the bottom part.
  58. screw_thread_hole_dia_in_millimeter = 6.4;
  59. // The hole diameter of the sanding stick top part. You should use Screw Thread Dia and add about 0.5-0.8 mm for tolerance. Otherwise the screw won't fit through the top part.
  60. screw_hole_dia_in_millimeter = 6.6;
  61. // The space of the sanding stick top part. This space is needed for the screw. This value should be higher than the Screw Head Dia value.
  62. screw_head_space_in_millimeter = 15.0;
  63. // Number of teeth of the screw head.
  64. screw_head_teeth = 8; //[2:32]
  65. // Additional Screw Head Height. Default is 0.0 to meet the max height of the whole assembled stick. Add an extra would be easier to screw in or turn the screw of.
  66. extra_screw_head_height_in_millimeter = 0.0;
  67. // Max thread height for screw and sanding stick bottom part. Higher value results in a stronger join between the bottom and top part of the sanding stick, but also takes longer to screw it in.
  68. max_thread_height_in_millimeter = 3.5;
  69. /* [Hidden] */
  70. stick_width = stick_width_in_millimeter;
  71. base_length = base_length_in_millimeter;
  72. base_height = base_height_in_millimeter;
  73. screw_thread_dia = screw_thread_dia_in_millimeter;
  74. screw_head_dia = screw_head_dia_in_millimeter;
  75. screw_thread_hole_dia = screw_thread_hole_dia_in_millimeter;
  76. screw_hole_dia = screw_hole_dia_in_millimeter;
  77. screw_head_space = screw_head_space_in_millimeter;
  78. extra_screw_head_height = extra_screw_head_height_in_millimeter;
  79. max_thread_height = max_thread_height_in_millimeter;
  80. $fn=100;
  81. // Program Section //
  82. //-----------------//
  83. if(part == "bottom_part__") {
  84. bottom_part();
  85. } else if(part == "top_part__") {
  86. top_part();
  87. } else if(part == "screws__") {
  88. screws();
  89. } else if(part == "all_parts__") {
  90. all_parts();
  91. } else {
  92. all_parts();
  93. }
  94. // Module Section //
  95. //----------------//
  96. module bottom_part() {
  97. union() {
  98. color("Tan") base_bottom(base_length, base_height / 2, stick_width);
  99. if(end_1_option == "round") {
  100. color("YellowGreen") round_end_1(base_height, stick_width, end_1_height);
  101. }
  102. if(end_1_option == "wedge") {
  103. color("YellowGreen") wedge_end_1(base_height, end_1_height, stick_width, end_1_wedge_angle, end_1_wedge_round_tip_diameter_in_millimeter);
  104. }
  105. translate([base_length, 0, 0]) {
  106. if(end_2_option == "round") {
  107. color("RoyalBlue") round_end_2(base_height, stick_width, end_2_height);
  108. }
  109. if(end_2_option == "wedge") {
  110. color("RoyalBlue") wedge_end_2(base_height, end_2_height, stick_width, end_2_wedge_angle, end_2_wedge_round_tip_diameter_in_millimeter);
  111. }
  112. }
  113. }
  114. }
  115. module all_parts() {
  116. bottom_part();
  117. translate([0, stick_width + 4.0, 0]) {
  118. top_part();
  119. }
  120. translate([0, stick_width + screw_head_dia + 3.0, 0]) {
  121. screws();
  122. }
  123. }
  124. module top_part() {
  125. color("HotPink") base_top(base_length, base_height / 2 - 0.5, stick_width);
  126. }
  127. module screws() {
  128. translate([screw_head_dia / 2, 0, 0]) {
  129. color("Sienna") screw(screw_thread_dia, base_height / 2 - 1.5, base_height / 4 - 0.3, screw_head_dia, base_height / 4, extra_screw_head_height);
  130. }
  131. translate([screw_head_dia * 1.5 + 4, 0, 0]) {
  132. color("Sienna") screw(screw_thread_dia, base_height / 2 - 1.5, base_height / 4 - 0.3, screw_head_dia, base_height / 4, extra_screw_head_height);
  133. }
  134. }
  135. module base_bottom(length, height, width) {
  136. difference() {
  137. rotate([90, 0, 0]) {
  138. linear_extrude(height = width) {
  139. square([length, height]);
  140. }
  141. }
  142. // Hole 1
  143. if(height < max_thread_height + 1.5) {
  144. translate([4 + screw_head_space / 2, - width / 2, 1.5]) {
  145. screw_thread(screw_thread_hole_dia, 1.25, 45, height - 1, PI / 4, 1);
  146. }
  147. } else {
  148. translate([4 + screw_head_space / 2, - width / 2, height - max_thread_height]) {
  149. screw_thread(screw_thread_hole_dia, 1.25, 45, max_thread_height + 0.3, PI / 4, 1);
  150. }
  151. }
  152. // Hole 2
  153. if(height < max_thread_height + 1.5) {
  154. translate([length - 4 - screw_head_space / 2, - width / 2, 1.5]) {
  155. screw_thread(screw_thread_hole_dia, 1.25, 45, height - 1, PI / 3, 1);
  156. }
  157. } else {
  158. translate([length - 4 - screw_head_space / 2, - width / 2, height - max_thread_height]) {
  159. screw_thread(screw_thread_hole_dia, 1.25, 45, max_thread_height + 0.3, PI / 3, 1);
  160. }
  161. }
  162. // Chamfer
  163. translate([4 + screw_head_space / 2, - width / 2, height - 0.6]) {
  164. cylinder(d1 = screw_thread_hole_dia, d2 = screw_hole_dia * 1.2, h = 0.7);
  165. }
  166. translate([length - 4 - screw_head_space / 2, - width / 2, height - 0.6]) {
  167. cylinder(d1 = screw_thread_hole_dia, d2 = screw_hole_dia * 1.2, h = 0.7);
  168. }
  169. }
  170. }
  171. module base_top(length, height, width) {
  172. difference() {
  173. rotate([90, 0, 0]) {
  174. linear_extrude(height = width) {
  175. offset(r= + height * 0.3, $fn = 32) {
  176. offset(delta = - height * 0.3) {
  177. square([length, height]);
  178. }
  179. }
  180. }
  181. }
  182. // Screw Space 1
  183. translate([4, -width - 0.5, height / 2 + 0.1]) {
  184. cube([screw_head_space, width + 1.0, height / 2]);
  185. }
  186. // Screw Hole 1
  187. translate([4 + screw_head_space / 2, - width / 2, - 0.1]) {
  188. cylinder(d = screw_hole_dia, h = height / 2 + 0.3);
  189. }
  190. // Screw Space 1
  191. translate([length - 4 - screw_head_space, - width - 0.5, height / 2 + 0.1]) {
  192. cube([screw_head_space, width + 1.0, height / 2]);
  193. }
  194. // Screw Hole 2
  195. translate([length - 4 - screw_head_space / 2, - width / 2, - 0.1]) {
  196. cylinder(d = screw_hole_dia, h = height / 2 + 0.3);
  197. }
  198. }
  199. }
  200. module screw(thread_dia, thread_height, threadless_height, head_dia, head_height, extra_screw_head_height) {
  201. union() {
  202. if(head_dia > stick_width) {
  203. gear(stick_width, head_height + extra_screw_head_height, screw_head_teeth);
  204. } else {
  205. gear(head_dia, head_height + extra_screw_head_height, screw_head_teeth);
  206. }
  207. translate([0, 0, head_height + extra_screw_head_height]) {
  208. cylinder(d = thread_dia, h = threadless_height, $fn = 16);
  209. }
  210. translate([0, 0, head_height + threadless_height - 0.1 + extra_screw_head_height]) {
  211. if(thread_height < max_thread_height) {
  212. screw_thread(thread_dia, 1.25, 45, thread_height, PI / 4, 1);
  213. } else {
  214. screw_thread(thread_dia, 1.25, 45, max_thread_height, PI / 3, 1);
  215. }
  216. }
  217. }
  218. }
  219. module gear(dia, height, teeth) {
  220. union() {
  221. translate([0, 0, height / 2]) {
  222. for(tooth = [0 : teeth / 2]) {
  223. rotate([0, 0, 360 / teeth * tooth]) {
  224. cube([dia, dia / screw_head_teeth, height], center = true);
  225. }
  226. }
  227. }
  228. cylinder(d = dia - 2.0, h = height, $fn=16);
  229. }
  230. }
  231. module round_end_1(dia, width, height_option) {
  232. dia = height_option == "base_height" ? dia : dia / 2;
  233. transition_width = height_option == "base_height" ? -dia / 2 + dia / 4 + 0.0001 : 0;
  234. union() {
  235. translate([transition_width, 0, dia / 2]) {
  236. rotate([90, 0, 0]) {
  237. difference() {
  238. cylinder(d = dia, h = width, $fn = 128);
  239. translate([0, -dia / 2, -0.1]) {
  240. cube([dia, dia + 0.2, width + 0.2]);
  241. }
  242. }
  243. }
  244. }
  245. if(height_option == "base_height") {
  246. base_end_transition(dia, width);
  247. }
  248. }
  249. }
  250. module round_end_2(dia, width, height_option) {
  251. translate([0, -width, 0]) {
  252. rotate([0, 0, 180]) {
  253. round_end_1(dia, width, height_option);
  254. }
  255. }
  256. }
  257. module wedge_end_1(max_height, height_option, width, angle, tip_dia) {
  258. tip_r = tip_dia / 2;
  259. height = height_option == "base_height" ? max_height : max_height / 2;
  260. bottom_width = height / tan(angle) - tip_r / tan(angle / 2);
  261. top_delta = sin(angle) * tip_r;
  262. top_height = height - (tan(angle) * (bottom_width + top_delta));
  263. transition_width = height_option == "base_height" ? height / 4 - 0.05 : 0;
  264. union() {
  265. translate([-bottom_width - transition_width, 0, 0]) {
  266. rotate([90, 0, 0]) {
  267. linear_extrude(height = width) {
  268. polygon(points = [
  269. [0, 0],
  270. [bottom_width, 0],
  271. [bottom_width, height],
  272. [0 - top_delta, top_height],
  273. [0, tip_r]
  274. ]);
  275. translate([0, tip_r]) {
  276. circle(d = tip_dia, $fn = 64);
  277. }
  278. }
  279. }
  280. }
  281. if(height_option == "base_height") {
  282. base_end_transition(height, width);
  283. }
  284. }
  285. }
  286. module wedge_end_2(max_height, height_option, width, angle, tip_dia) {
  287. translate([0, -width, 0]) {
  288. rotate([0, 0, 180]) {
  289. wedge_end_1(max_height, height_option, width, angle, tip_dia);
  290. }
  291. }
  292. }
  293. module base_end_transition(dia, width) {
  294. translate([-dia / 2 + dia / 4 , 0, dia / 2]) {
  295. rotate([90, 0, 0]) {
  296. union() {
  297. translate([0, dia / 2 - dia / 8, 0]) {
  298. difference() {
  299. cylinder(d = dia / 4, width, $fn = 32);
  300. translate([-dia / 4, -dia / 4, -0.1]) {
  301. cube([dia / 4, dia / 2, width + 0.2]);
  302. }
  303. }
  304. translate([-0.1, -dia + dia / 8, 0]) {
  305. cube([dia / 8 + 0.1, dia - dia / 8, width]);
  306. }
  307. }
  308. translate([dia / 4, dia/2 - dia / 8, 0]) {
  309. difference() {
  310. translate([-dia / 8, -dia + dia / 8, 0]) {
  311. cube([dia / 8, dia / 2 + dia / 8, width]);
  312. }
  313. translate([0, -dia / 4, -0.1]) {
  314. cylinder(d = dia / 4, width + 0.2, $fn = 32);
  315. }
  316. }
  317. }
  318. }
  319. }
  320. }
  321. }
  322. ////////////////////////////////////////////////////////////////////////
  323. /*
  324. * polyScrewThread_r1.scad by aubenc @ Thingiverse
  325. *
  326. * This script contains the library modules that can be used to generate
  327. * threaded rods, screws and nuts.
  328. *
  329. * http://www.thingiverse.com/thing:8796
  330. *
  331. * CC Public Domain
  332. *
  333. * Changes by Dennis Hofmann:
  334. * - removed unused modules
  335. * - fixed deprecated parts
  336. */
  337. module screw_thread(od,st,lf0,lt,rs,cs)
  338. {
  339. or=od/2;
  340. ir=or-st/2*cos(lf0)/sin(lf0);
  341. pf=2*PI*or;
  342. sn=floor(pf/rs);
  343. lfxy=360/sn;
  344. ttn=round(lt/st+1);
  345. zt=st/sn;
  346. intersection()
  347. {
  348. if (cs >= -1)
  349. {
  350. thread_shape(cs,lt,or,ir,sn,st);
  351. }
  352. full_thread(ttn,st,sn,zt,lfxy,or,ir);
  353. }
  354. }
  355. module thread_shape(cs,lt,or,ir,sn,st)
  356. {
  357. if ( cs == 0 )
  358. {
  359. cylinder(h=lt, r=or, $fn=sn, center=false);
  360. }
  361. else
  362. {
  363. union()
  364. {
  365. translate([0,0,st/2])
  366. cylinder(h=lt-st+0.005, r=or, $fn=sn, center=false);
  367. if ( cs == -1 || cs == 2 )
  368. {
  369. cylinder(h=st/2, r1=ir, r2=or, $fn=sn, center=false);
  370. }
  371. else
  372. {
  373. cylinder(h=st/2, r=or, $fn=sn, center=false);
  374. }
  375. translate([0,0,lt-st/2])
  376. if ( cs == 1 || cs == 2 )
  377. {
  378. cylinder(h=st/2, r1=or, r2=ir, $fn=sn, center=false);
  379. }
  380. else
  381. {
  382. cylinder(h=st/2, r=or, $fn=sn, center=false);
  383. }
  384. }
  385. }
  386. }
  387. module full_thread(ttn,st,sn,zt,lfxy,or,ir)
  388. {
  389. if(ir >= 0.2)
  390. {
  391. for(i=[0:ttn-1])
  392. {
  393. for(j=[0:sn-1]) {
  394. pt = [ [0, 0, i*st-st ],
  395. [ir*cos(j*lfxy), ir*sin(j*lfxy), i*st+j*zt-st ],
  396. [ir*cos((j+1)*lfxy), ir*sin((j+1)*lfxy), i*st+(j+1)*zt-st ],
  397. [0, 0, i*st ],
  398. [or*cos(j*lfxy), or*sin(j*lfxy), i*st+j*zt-st/2 ],
  399. [or*cos((j+1)*lfxy), or*sin((j+1)*lfxy), i*st+(j+1)*zt-st/2 ],
  400. [ir*cos(j*lfxy), ir*sin(j*lfxy), i*st+j*zt ],
  401. [ir*cos((j+1)*lfxy), ir*sin((j+1)*lfxy), i*st+(j+1)*zt ],
  402. [0, 0, i*st+st ] ];
  403. polyhedron(points=pt,
  404. faces=[ [1,0,3],[1,3,6],[6,3,8],[1,6,4],
  405. [0,1,2],[1,4,2],[2,4,5],[5,4,6],[5,6,7],[7,6,8],
  406. [7,8,3],[0,2,3],[3,2,7],[7,2,5] ]);
  407. }
  408. }
  409. }
  410. else
  411. {
  412. echo("Step Degrees too agresive, the thread will not be made!!");
  413. echo("Try to increase de value for the degrees and/or...");
  414. echo(" decrease the pitch value and/or...");
  415. echo(" increase the outer diameter value.");
  416. }
  417. }