Guest User

https://www.reddit.com/r/3Drequests/comments/1l3b79t/requesting_assistance_to_design_an_endcap_for_a

a guest
Jun 6th, 2025
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | Source Code | 0 0
  1. // endcap for a profile.scad
  2. //
  3. // Version 2, June 6, 2025
  4. // By Stone Age Sculptor, CC0
  5. // Updated with real shape from picture.
  6. //
  7. // By request:
  8. // https://www.reddit.com/r/3Drequests/comments/1l3b79t/requesting_assistance_to_design_an_endcap_for_a/
  9. //
  10.  
  11. // The tolerance to shrink the profile part
  12. // that fits inside in the rail.
  13. tolerance = 0.3;
  14.  
  15. // The height of the square base in z-direction.
  16. height_base = 2;
  17.  
  18. // The height of the profile in z-direction.
  19. height_profile = 10;
  20.  
  21. // The width at the bottom of the profile.
  22. width1 = 16.5/2;
  23. // The width at the top of the profile.
  24. width2 = width1 + 0.25;
  25. // The height of the profile in y-direction.
  26. height1 = 17.2;
  27. // The offset that the profile it lifted in y-direction.
  28. position1 = 18.5-17.2;
  29. // A helper variable to avoid rounding errors.
  30. epsilon = 0.001;
  31.  
  32.  
  33. // The bottom flat part.
  34. translate([-18.5/2,0,0])
  35. cube([18.5,18.5,height_base]);
  36.  
  37. // The profile.
  38. linear_extrude(height_base+height_profile)
  39. {
  40. translate([0,position1])
  41. {
  42. offset(-tolerance)
  43. Profile();
  44.  
  45. // By shrinking the profile, it also
  46. // shrinks at the end where it should
  47. // be the same as the flat bottom part
  48. // below it.
  49. // That is adjusted with a straight piece.
  50. if(tolerance>0)
  51. {
  52. // The new width that is shrunk is guessed.
  53. // The factor 1.09 is good enough for the slope.
  54. shrink = 1.09*tolerance;
  55. translate([-width2+shrink,height1-tolerance-epsilon])
  56. square([2*width2-2*shrink,tolerance]);
  57. }
  58. }
  59. }
  60.  
  61. // The profile for the inside of the rail.
  62. // The bottom-middle is at position (0,0).
  63. module Profile()
  64. {
  65. half_profile =
  66. [
  67. [0,0],[width1,0],[width1,7.8],[width1+0.24,8.0],[width1+0.24,9.05],
  68. [width1-0.34,9.5],[width1-0.64,12.25],[width1-0.16,12.34],[width2,height1],[0,height1],
  69. ];
  70.  
  71. // The complete profile is half the profile
  72. // plus the profile that is mirrored.
  73. polygon(half_profile);
  74. mirror([1,0,0])
  75. polygon(half_profile);
  76. }
  77.  
  78. /*
  79. // Code to tune the coordinates.
  80. %Profile();
  81.  
  82. sc = 0.208;
  83. color("Navy")
  84. translate([0,0,-1.1])
  85. scale([sc,sc])
  86. translate([-44.6,-22.0])
  87. import("profile-converted-to-vector.svg");
  88. */
  89.  
Tags: OpenSCAD
Advertisement
Add Comment
Please, Sign In to add comment