thread.scad 767 B

123456789101112131415161718192021222324252627282930313233
  1. include <../config/thread.scad>
  2. module thread_object(screw = false) {
  3. module base_object() {
  4. translate([0, 0, -thread_height / 2]) {
  5. cylinder(r = thread_diameter / 2, h = thread_height);
  6. cylinder(r = thread_top_diameter / 2, h = thread_top_height);
  7. }
  8. }
  9. module screw() {
  10. cylinder(r = thread_screw / 2, h = thread_height, center = true);
  11. }
  12. module final_object() {
  13. if (!screw) {
  14. base_object();
  15. } else {
  16. difference() {
  17. base_object();
  18. screw();
  19. }
  20. }
  21. }
  22. render() {
  23. final_object();
  24. }
  25. }
  26. module thread_screw_object(height = 5) {
  27. cylinder(r = thread_screw / 2, h = height, center = true);
  28. }