Code Snippets OpenSCAD

Short texts OpenSCAD 🧑‍💻 Code snippets OpenSCAD ✍️ Reading lists OpenSCAD 👀

spacer.scad

diameter_small = 3.3; diameter_big = 4.2; distance = 15.5; border = 2; thickness = 0.8; $fn = 80; difference() { hull() { cylinder(thickness, d=diameter_small + border); translate([distance, 0, 0]) cylinder(thickness, d=diameter_big + border); } cylinder(thickness, d=diameter_small); translate([distance, 0, 0]) cylinder(thickness, d=diameter_big); }

OpenSCAD pointed star module

// points = number of points (minimum 3) // outer = radius to outer points // inner = radius to inner points module Star(points, outer, inner) { // polar to cartesian: radius/angle to x/y function x(r, a) = r * cos(a); function y(r, a) = r * sin(a); // angular width of each pie slice […]

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 * […]

Shed design. Open in OpenScad to view 3d model.

windows = false; // show windows stuff = false; // Show bikes, table, mower l = 32; // Length of building in feet (16, 20, 24, 28, 32, …) h = 8*12-4.5+.5; rl=6*12+1.375+.1; // cut to 73.5″ long with 22.5 degree angles tl = 68.7; // Used to tweak headers on top walls // 2×6 […]