OpenSCAD Parts Library

by randyy, published

OpenSCAD Parts Library by randyy Feb 2, 2011


I've been using these OpenSCAD modules in my models, developing new parts for my different projects. I decided to compile the parts into one library and release it into the Thingiverse wild. Several people have been looking for printable washers and nyloc nuts recently, and have released them as individual things. Also, someone just asked me for specs on the dovetail I used on my makerbottable filament spool. All of these things are in my library, including:

<b>Shape primitives</b> Hexagrams, Equilateral triangles (prisms), 3 sided pyramids and tetrahedrons, 4 sided pyramids including a Johnson's Solid square pyramid (a cube cut along its diagonal), tubes (hollow cylinders with variable wall thicknesses), slots with selectable round or square end(s), teardrop (as designed by whosawhatsis, www.thingiverse.com/thing:3457) dovetail pins and slots to attach parts without connectors, rounded corner rectangles, and keyhole slots. <small>The rounded rectangles and keyholes can be seen my quick release x-Rod caps, http://www.thingiverse.com/thing:4765 The dovetails can be seen on my Makerbottable filament Spool, http://www.thingiverse.com/thing:4337&lt;/small&gt;

<b> Hardware Parts </b> Hex Nuts, Washers, Cap Bolts, Hex Bolts, and Bearings

These parts are modeled by the part's name or size for mockups or to difference out voids in a model. For instance hexNut("M6") will give the appropriate sized hardware. The sizes are included in an extensible table, so if you have a specific part, you can just add it's dimension, name it, and use it.

<b>Miscellaneous functions and useful stuff</b> I included a function that will globally adjust the number of triangles used in rounded objects based upon a single "displayMode" variable. For screen display, spheres will be facetless, but by changing only one variable, you can reduce the facet count for printing to about 1mm resolution.

Several functions to rotate and translate objects in only one plane, with names that (to me) are easy to remember. for instance, rotate(tighten()) will twist an object along the z plane clockwise 90 degrees (like tightening a lid on a jar). Likewise Push() moves an object away, Slide() to the side, and Lift() up.

Last, is a rudimentary table module and access functions (alluded to under the hardware section). You can put any data in the table, with a named header row, add names for the various columns in a column table, and subsequently locate all of the data in that row or any individual entry by using the functions tableRow(rowName) or tableEntry(rowName, columnName). The library has a selection of bearings, and both metric and US bolts/washers/nuts included, but you can always add more. The table can be used for just about anything, including positions within your model that you can refer to like this: translate(tableRow("Front Tire Position");

I hope you like it and if you have upgrade ideas, e-mail me and I'll try to incorporate the changes here.

If you REALLY like it, feel free to flattr it. :o)

<b>UPDATE</b> New version uploaded on 5/7/11, old version removed. Fixed bug in bearing() module that doubled the expected size (used diameter as radius). Added rezPrinter and rezScreen functions for adjusting facet sizes.

Recent Comments

view all

Bella idea e ottimo lavoro. Grazie! Nice idea and good job. Thanks! CD

Can the size of the solids be adjusted? For example, I'd like to make cubes and also half-cubes of dimensions s x s x s/2 . Thanks!

Really good, plain library easy to understand. Thanks!! /Ice

Liked By

view all
Deal With It


OpenSCAD Parts Library by randyy is licensed under the GNU - LGPL license.

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag


1) Download the Libs.scad file and put it in the same location as your project file. 2) Use the command include <"Libs.scad"> at the start of your file to access the library - 3) Just use the modules like you would use your own.

For a demo (the STL you see here) use the command libDemo(); the command libHelp(); will echo the prototype of all modules to the console. the command libMoveHelp(); will echo the rotation and translation function names to the console.

Bella idea e ottimo lavoro. Grazie! Nice idea and good job. Thanks! CD

Can the size of the solids be adjusted? For example, I'd like to make cubes and also half-cubes of dimensions s x s x s/2 . Thanks!

Really good, plain library easy to understand. Thanks!! /Ice

This is so helpful. The best ever. Thank you so much.

Where can I create my prototype for a children toy I designed that calls for 1050 pieces, most cost effectively?

1000 of the pieces are a very simple 10x10x10mm cubes.

Thanks this library is great. :-D

Had some trouble with the dovetail in this one, would probably like it better if it were just the trapezoid part, for now I'm using jag's dovetail. http://www.thingiverse.com/thing:10269http://www.thingiverse.com/thi... Everything else looks great though!

Dovetail modules for openscad
by jag
randyy - in reply to Thav

Sorry you had issues. What specifically was the problem? Obviously, everybody's workflow is different but I use the tabs to register the parts and assure the male sticks out as far as the female sticks in. Works for me as a sanity check. Depending on your calibration and desired tightness or looseness of the joint, the male may need to be a fraction of a mm smaller than the female. If you can suggest an improvement, lemme know. :-D

You should really add all this to MCAD, the definitive opensca library: http://reprap.org/wiki/MCADhttp://reprap.org/wiki/MCAD

The best way is to fork and merge you code in, but if you do nothing, then I might eventually get to this.