An OpenSCAD library of useful functions, modules and components.
- All shapes and solids default to
center = true, though component mocks are positioned to suit their typical use case (e.g. screws are aligned with head in positive and shank in negative y axis).
- Millimeters per inch
- Pi
- Metric nuts/screw dimensions
- Component dimensions
circumference(r)- circumference of a circleclamp(value, v1, v2)- clamps a value between two other valuescontains(needle, haystack)- checks if vector contains given valueerror(msg)- logs a vector of error message values to the consolefor_unity3d(scale = 0.001)- scales and orients models for use in Unity3Dget_fragments_from_r(r, fa = $fa, fn = $fn, fs = $fs)- derives$fnfrom radius, as per docshelix_angle(r, pitch)- determines angle of a helix at given pitch and radiusindex_of(needle, haystack)- finds index of given valuejoin(values, sep = ", ")- creates a string from vector elementslinear_extrude_chamfer(h, chamfer, round = false, center = false, convexity = 1, $fn = $fn)- applies alinear_extrudeandminkowskito a shape resulting in chamfered edgelinear_rotate_extrude(h = 1, a = 360, center = true, convexity = 1, $fn = 0)- mimicsrotate_extrudewhile applying a linear transform. It's a hack! -hulls two thinlinear_extrudes, since we can't hull 2D shapes in 3Dlookup_vector(i, table)- same aslookupbut also works on vector valuesoffset_point(p, delta = 0)- INVESTIGATEdelta * 2- should be *1?oscillate(min = -1, max = 1, t = $t)- sweeps a value between given minimum and maximum, for animationpoly_coords(n, r = 1, mid = true)- creates vector of points with faces at radius (rather than points)print_registration_bounds(bounds = [180, 180], h = 0.2, t = 0.5)- used to ensure position when slicing separate models on one plate (e.g. two material prints)print(msg)- logs a vector of message values to the consolereflect(x = true, y = true, z = false)- mirrors children across axesrotate_point_x(p, a)- rotates given point around x axisrotate_point_y(p, a)- rotates given point around y axisrotate_point_z(p, a)- rotates given point around z axisrotate_point(p, a)- rotates given point around all axesrotate_points(p, a)- rotates given points around all axesshow_half(r = [0, 0, 0], t = [0, 0, 0], d = 1000, 2d = false)- cuts children in half for internals investigation or simple bisectionssum(v)- sums numeric values of a vectortranslate_point(p, a)- translates given pointtranslate_points(p, a)- translates given pointstranspose(pos = [])- positions children reflected without mirroring across all axeswarn(msg)- logs a vector of warning message values to the console
arc(a, r1, r2, $fn = $fn)- like a rainbowbezier(points, width = 0.5, connect = true, n = -1)- draws a bezier curve from given three (cubic) or four (quadratic) points, of either given width or by hulling children, if anycircle_true(r, center = true, $fa = $fa, $fn = $fn, $fs = $fs)- circle with edges at radius (rather than points)grid(coords = [100, 100], x = 10, y = 10, walls = 1, edges = false, center = false)- draws a grid of linesl(dim = [10, 10], t = 1, t1, t2)- "L" shape, for beamsrounded_gear(r = 10, n = 3, inset = true, s = [1, 1], $fn = $fn)- a simple lobed gear (for knob handles)rounded_square(dim, r, center = true)- square with corners of given radiussegment(a, r, $fn = $fn)- a portion of given angle of a circlesemicircle(r = 1, $fa = $fa, $fn = $fn, $fs = $fs)- half a circlesemicircle_true(r = 1, $fa = $fa, $fn = $fn, $fs = $fs)- half a circle, with edges at radius (instead of points)smooth(r)- applies two consectiveoffsets to achieve a simple smoothing effectsmooth_acute(r = 0, dim = [1000, 1000])- smoothing, but also applies to acute anglessq(dim, center = true)- convenience wrapper for centred square; handles dimension array lengths > 2star(r, n = 5, inset = 0.5)- makes star shapes with given side insett(dim = [10, 10], t = 1, t1, t2)- "T" shape, for beamsu(dim = [10, 10], t = 1, t1, t2)- "U" shape, for beams
capsule(h = 10, r, r1, r2, center = false)- a cylinder with semi-spherical endscylinder_true(h, r = 0, r1 = 0, r2 = 0, center = true, $fa = $fa, $fn = $fn, $fs = $fs)- cylinder with faces at radius (instead of edges)pie(a = 90, r = 1, h = 1, center = true)- an extrudedsegmentrounded_cube(dim, r, edges = false, center = true, $fa = $fa, $fn = $fn, $fs = $fs)- a cube with edges of given radiusrounded_cylinder(h, r, f, f1, f2, r1, r2, center = true, $fa = $fa, $fn = $fn, $fs = $fs)- a cylinder with top and bottom edges of given radiisphere_true(r, $fa = $fa, $fn = $fn, $fs = $fs)- sphere with faces at radius (instead of edges)torus(r1, r2, fa = $fa, fn = $fn, fs = $fs)- a donuttorus_true(r1, r2, $fa = $fa, $fn = $fn, $fs = $fs)- a donut with extruded circle having edges at radius (instead of points)
- Buzzer
- Chip
- Connectors
- Displays
- Jacks
- LEDs
- Pin headers
- Potentiometers
- Stepper motors
- Switches (DIP, slide, tact)
- Voltage regulators
- Wire
- Beams (L/T/U)
- Bearings
- Gears
- Nuts
- Screws
- Threads
- Truss
- Washers
- Centrifugal fan (blower)
- Duct/pipe flange
- 5.8GHz antenna
- Batteries
- Cameras
- DVRs
- ESCs
- Flight controllers
- GPS
- Motors
- Propellers
- Receivers
- Servos
- Video receivers
- Video transmitters
