Last active
August 23, 2025 14:58
-
-
Save LeSpocky/7880703 to your computer and use it in GitHub Desktop.
rounded square in openscad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module rounded_square( width, radius_corner ) { | |
translate( [ radius_corner, radius_corner, 0 ] ) | |
minkowski() { | |
square( width - 2 * radius_corner ); | |
circle( radius_corner ); | |
} | |
} | |
module alternative_square( width, r_c ) { | |
hull() { | |
translate( [r_c, r_c, 0] ) circle( r_c ); | |
translate( [r_c, width - r_c, 0 ] ) circle( r_c ); | |
translate( [width - r_c, r_c, 0] ) circle( r_c ); | |
translate( [width - r_c, width - r_c, 0] ) circle( r_c ); | |
} | |
} |
@jcoehoorn I guess you have a typo (l-(2*4)
) in there.
The following produces the correct length for me:
module rounded_rect(l, w, r)
{
translate([r, r, 0])
offset(r=r, $fn = 60)
square([l-(2*r), w-(2*r)]);
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be simplified and add a feature at the same time: