Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // endcap for a profile.scad
- //
- // Version 2, June 6, 2025
- // By Stone Age Sculptor, CC0
- // Updated with real shape from picture.
- //
- // By request:
- // https://www.reddit.com/r/3Drequests/comments/1l3b79t/requesting_assistance_to_design_an_endcap_for_a/
- //
- // The tolerance to shrink the profile part
- // that fits inside in the rail.
- tolerance = 0.3;
- // The height of the square base in z-direction.
- height_base = 2;
- // The height of the profile in z-direction.
- height_profile = 10;
- // The width at the bottom of the profile.
- width1 = 16.5/2;
- // The width at the top of the profile.
- width2 = width1 + 0.25;
- // The height of the profile in y-direction.
- height1 = 17.2;
- // The offset that the profile it lifted in y-direction.
- position1 = 18.5-17.2;
- // A helper variable to avoid rounding errors.
- epsilon = 0.001;
- // The bottom flat part.
- translate([-18.5/2,0,0])
- cube([18.5,18.5,height_base]);
- // The profile.
- linear_extrude(height_base+height_profile)
- {
- translate([0,position1])
- {
- offset(-tolerance)
- Profile();
- // By shrinking the profile, it also
- // shrinks at the end where it should
- // be the same as the flat bottom part
- // below it.
- // That is adjusted with a straight piece.
- if(tolerance>0)
- {
- // The new width that is shrunk is guessed.
- // The factor 1.09 is good enough for the slope.
- shrink = 1.09*tolerance;
- translate([-width2+shrink,height1-tolerance-epsilon])
- square([2*width2-2*shrink,tolerance]);
- }
- }
- }
- // The profile for the inside of the rail.
- // The bottom-middle is at position (0,0).
- module Profile()
- {
- half_profile =
- [
- [0,0],[width1,0],[width1,7.8],[width1+0.24,8.0],[width1+0.24,9.05],
- [width1-0.34,9.5],[width1-0.64,12.25],[width1-0.16,12.34],[width2,height1],[0,height1],
- ];
- // The complete profile is half the profile
- // plus the profile that is mirrored.
- polygon(half_profile);
- mirror([1,0,0])
- polygon(half_profile);
- }
- /*
- // Code to tune the coordinates.
- %Profile();
- sc = 0.208;
- color("Navy")
- translate([0,0,-1.1])
- scale([sc,sc])
- translate([-44.6,-22.0])
- import("profile-converted-to-vector.svg");
- */
Advertisement
Add Comment
Please, Sign In to add comment