OpenSCAD User Manual/Libraries
OpenSCAD uses three library locations, the installation library, built-in library, and user-defined libraries.
- The Installation library location is the
librariesdirectory under the directory where OpenSCAD is installed.
- The Built-In library location is O/S dependent. Since version 2014.03, it can be opened in the system specific file manager using the "File->Show Library Folder..." menu entry.
- Mac OS X:
- The User-Defined library path can be created using the OPENSCADPATH Environment Variable to point to the library(s). OPENSCADPATH can contain multiple directories in case you have library collections in more than one place, separate directories with a semi-colon for Windows, and a colon for Linux/Mac OS. For example:
C:\Users\A_user\Documents\OpenSCAD\MyLib;C:\Thingiverse Stuff\OpenSCAD Things;D:\test_stuff
- (Note: For Windows, in versions prior to 2014.02.22 there is a bug preventing multiple directories in OPENSCADPATH as described above, it uses a colon (:) to separate directories. A workaround, if your libraries are on C: is to leave off the drive letter & colon, e.g.
\Thingiverse Stuff\OpenSCAD Things:\stuff. For more about setting Windows environment variables, see User Environment Variables.
- Linux/Mac OS:
- OpenSCAD must be restarted to recognize any change to the OPENSCADPATH Environment Variable.
When you specify a non-fully qualified path and filename in the
use <...> or
include <...> statement OpenSCAD looks for the file in the following directories in the following order:
- the directory of the calling .scad file
- the User-Defined library paths (OPENSCADPATH)
- the Built-In library (i.e. the O/S dependent locations above)
- the Installation library
In the case of a library file itself having
use <...> or
include <...> the directory of the library .scad file is the 'calling' file, i.e. when looking for libraries within a library, it does not check the directory of the top level .scad file.
For example, with the following locations and files defined: (with OPENSCADPATH=
1. <installation library>/lib1.scad 2. <built-in library>/lib2.scad 3. <built-in library>/sublib/lib2.scad 4. <built-in library>/sublib/lib3.scad 5. /usr/lib/lib2.scad 6. /home/lib_os/sublib/lib3.scad
include <...> statements match to the nominated library files
include <lib1.scad> // #1. include <lib2.scad> // #5. include <sublib/lib2.scad> // #3. include <sublib/lib3.scad> // #6.
Since 2014.03, the currently active list of locations can be verified in the "Help->Library Info" dialog.
The details info shows both the content of the OPENSCADPATH variable and the list of all library locations. The locations are searched in the order they appear in this list. For example;
OPENSCADPATH: /data/lib1:/data/lib2 OpenSCAD library path: /data/lib1 /data/lib2 /home/user/.local/share/OpenSCAD/libraries /opt/OpenSCAD/libraries
In Windows, Environment Variables are set via the
Control panel, select
Advanced System Settings, click
Environment Variables. Create a new
User Variable, or edit OPENSCADPATH if it exists.
On Linux, to simply add the environment variable to all users, you can type in terminal:
sudo sh -c 'echo "OPENSCADPATH=$HOME/openscad/libraries" >>/etc/profile'
to set the OPENSCADPATH to openscad/libraries under each user's home directory. For more control on environment variables, you'll need to edit the configuration files; see for example this page.
On Mac, you need to modify the /etc/launchd.conf:
sudo sh -c 'echo "setenv OPENSCADPATH /Users/myuser/my/own/path" >>/etc/launchd.conf'
The variable will be available at next reboot.
To avoid to reboot and use it immediately, issue the following commands:
egrep "^setenv\ " /etc/launchd.conf | xargs -t -L 1 launchctl
OpenSCAD bundles the MCAD library.
MCAD bundles a lot of stuff, of varying quality, including:
- Many common shapes like rounded boxes, regular polygons and polyhedra in 2D and 3D
- Gear generator for involute gears and bevel gears.
- Stepper motor mount helpers, stepper and servo outlines
- Nuts, bolts and bearings
- Screws and augers
- Material definitions for common materials
- Mathematical constants, curves
- Teardrop holes and polyholes
The git repo also contains python code to scrape OpenSCAD code, a testing framework and SolidPython, an external python library for solid cad.
More details on using MCAD are in a later chapter, OpenSCAD User Manual/MCAD.
- BOLTS tries to build a standard part and vitamin library that can be used with OpenSCAD and other CAD tools: 
- Obiscad contains various useful tools, notably a framework for attaching modules on other modules in a simple and modular way: 
- This library provides tools to create proper 2D technical drawings of your 3D objects: 
- Stephanie Shaltes wrote a fairly comprehensive fillet library (https://github.com/StephS/i2_xends/blob/master/inc/fillets.scad)
- The shapes library contains many shapes like rounded boxes, regular polygons. It is also included in MCAD.
- Also Giles Bathgates shapes library provides regular polygons and polyeders and is included in MCAD.
- The OpenSCAD threads library provides ISO conform metric and imperial threads and support internal and external threads and multiple starts.
- Sprockets for ANSI chains and motorcycle chains can be created with the Roller Chain Sprockets OpenSCAD Module. Contains hard coded fudge factors, may require tweaking.
- The Pinball Library provides many components for pinball design work, including models for 3d printing of the parts, 3d descriptions of mount holes for CNC drilling and 2d descriptions of parts footprint
- For the generation of celtic knots there is the Celtic knot library
- The 2D connection library helps with connections between 2D sheets, which is useful for laser cut designs.
- local.scad provides a flexible method for positioning parts of a design. Is also used in BOLTS.
- SCADBoard is a library for designing 3D printed PCBs in OpenSCAD.
- A Ruler for determining the size of things in OpenSCAD.
- A colorspace converter for working with colors in HSV and RGB: http://www.thingiverse.com/thing:279951/
- A number of utility functions is collected in https://github.com/oampo/missile
- Unit test framework https://github.com/oampo/testcard
- Knurled surface library by aubenc http://www.thingiverse.com/thing:9095
- Text module based on technical lettering style https://github.com/thestumbler/alpha
- Round corners for Openscad https://www.thingiverse.com/thing:8812 https://www.makerbot.com/media-center/2011/05/26/script-for-rounded-corners-for-openscad-by-warrantyvoider
- Bevel library for OpenScad https://www.thingiverse.com/thing:30336
- SCAD libraries used by Michigan Tech's Open Sustainability Technology Lab (MOST) https://github.com/mtu-most/most-scad-libraries
- A full Workflow library by Ulrich Bär can be found at "github.com/UBaer21/UB.scad"
- The Belfry OpenScad Library has many shapes, masks, manipulators, and support for threading, gears, polylines and beziers. It can be found at GitHub with extensive documentation here
There is also a list with more libraries here: 
Other OpenSCAD tutorials and documentationEdit
- "OpenSCAD User Manual" http://www.openscad.org/documentation.html
- "Know only 10 things to be dangerous in OpenSCAD" https://cubehero.com/2013/11/19/know-only-10-things-to-be-dangerous-in-openscad/
- "OpenScad beginners tutorial" http://edutechwiki.unige.ch/en/OpenScad_beginners_tutorial
- "How to use Openscad, tricks and tips to design a parametric 3D object" http://www.tridimake.com/2014/09/how-to-use-openscad-tricks-and-tips-to.html
- OpenSCAD discussion forum http://forum.openscad.org