thread.scad 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. include <../config/thread.scad>
  2. module thread_screw_hole(move_x, move_y) {
  3. translate([move_x, move_y]) {
  4. circle(r = thread_screw / 2);
  5. }
  6. }
  7. module thread_object(screw = false, oversize = 0) {
  8. module base_object() {
  9. top_height = thread_top_height + oversize;
  10. translate([0, 0, -thread_height / 2]) {
  11. translate([0, 0, thread_height]) {
  12. cylinder(r = thread_screw / 2, h = oversize);
  13. }
  14. cylinder(r = thread_diameter / 2, h = thread_height);
  15. translate([0, 0, -oversize]) {
  16. cylinder(r = thread_top_diameter / 2, h = top_height);
  17. }
  18. }
  19. }
  20. module screw() {
  21. cylinder(r = thread_screw / 2, h = thread_height, center = true);
  22. }
  23. module final_object() {
  24. if (!screw) {
  25. base_object();
  26. } else {
  27. difference() {
  28. base_object();
  29. screw();
  30. }
  31. }
  32. }
  33. render() {
  34. final_object();
  35. }
  36. }
  37. module thread_screw_object(height = 5) {
  38. cylinder(r = thread_screw / 2, h = height, center = true);
  39. }