Last active
September 15, 2021 19:29
-
-
Save mjparme/a16b053a11009ba0a676391a45100822 to your computer and use it in GitHub Desktop.
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
| $fn = 100; | |
| module roundedCube(length = 50, width = 40, height = 10, roundedRadius = 2) { | |
| linear_extrude(height) roundedSquare(length = length, width = width, roundedRadius = roundedRadius); | |
| } | |
| //This is a 2d object | |
| module roundedSquare(length = 50, width = 40, roundedRadius = 2) { | |
| adjustedLength = length - roundedRadius; | |
| adjustedWidth = width - roundedRadius; | |
| hull() { | |
| points = [[roundedRadius, roundedRadius], [adjustedLength, roundedRadius], [adjustedLength, adjustedWidth], [roundedRadius, adjustedWidth]]; | |
| for (point = points) { | |
| translate(point) circle(roundedRadius); | |
| } | |
| } | |
| } | |
| //Test | |
| length = 40; | |
| roundedSquare(length = length); | |
| translate([length + 5, 0, 0]) roundedCube(length = length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment