Skip to content

Instantly share code, notes, and snippets.

View mjparme's full-sized avatar

Michael Parmeley mjparme

View GitHub Profile
someVar = adjustedUSize == 2
? stabilizerDistances[0]
: keyUSize == 3
? stabilizerDistances[1]
: keyUSize == 6.25
? stabilizerDistances[2]
: keyUSize == 7
? stabilizerDistances[3]
: keyUSize > 7 && keyUSize < 11
? stabilizerDistances[4]
$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;
@mjparme
mjparme / oval.scad
Last active July 4, 2021 20:47
Generate an Oval
function getOvalPoints(numOfPoints = 16, width = 4, height = 1, degreesAround = 360) = [
let(degreesPerPoint = degreesAround / numOfPoints)
for (point = [0 : numOfPoints - 1])
let(angle = degreesPerPoint * point)
ovalPoint(angle, width, height)
];
//returns [x,y] position of point given height and width of oval
function ovalPoint(angle, width, height) =
[height * sin(angle), width * cos(angle)];