hinge.scad 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. include <../config/hinge.scad>
  2. function hinge_base_width()
  3. = hinge_connector_screw
  4. + hinge_thickness * 2;
  5. module hinge_object_base() {
  6. height = hinge_height;
  7. connector_screw = hinge_connector_screw;
  8. mount_screws = hinge_mount_screws;
  9. thickness = hinge_thickness;
  10. width = hinge_base_width();
  11. module base_shape() {
  12. rounding = width / 2;
  13. move = height - rounding;
  14. hull() {
  15. translate([0, move]) {
  16. square(rounding * 2, center = true);
  17. }
  18. translate([0, -move]) {
  19. circle(r = rounding);
  20. }
  21. }
  22. }
  23. base_thickness = thickness;
  24. module base_object() {
  25. linear_extrude(height = base_thickness) {
  26. base_shape();
  27. }
  28. }
  29. module connector_base_object() {
  30. translate([0, height, width / 2]) {
  31. rotate([90, 0, 0]) {
  32. cylinder(
  33. h = connector_screw * 2,
  34. r = width / 2,
  35. center = false
  36. );
  37. }
  38. }
  39. }
  40. hull() {
  41. base_object();
  42. translate([0, 0, base_thickness]) {
  43. connector_base_object();
  44. }
  45. }
  46. }
  47. module hinge_object() {
  48. hinge_object_base();
  49. }