The Belfry OpenScad Library, v2.0. An OpenSCAD library of shapes, masks, and manipulators to make working with OpenSCAD easier. BETA
  • OpenSCAD 97.4%
  • HTML 1.8%
  • Python 0.6%
  • Shell 0.1%
Find a file
2026-10-16 06:16:42 -04:00
.github Run the regression suite on BelfrySCAD (#2042) 2026-09-06 07:00:43 -07:00
examples Added skew:ANGLE and pinch:PERCENT modifiers to ptn_sect() 2026-02-13 15:37:13 -08:00
images Texturing edits 2025-06-23 13:25:12 -07:00
resources PDF font size tweaks. 2023-05-09 18:08:32 -07:00
scripts add html file 2026-09-28 22:18:32 -04:00
tests segs(): support $fe, the max-error segment rule 2026-10-13 09:37:28 -07:00
tutorials Merge pull request #1960 from junhinhow/docs/tutorials-89 2026-05-11 08:25:24 -07:00
.gitignore Ignore temp .scad files left by openscad-test runner 2026-03-16 16:17:45 -07:00
.openscad_docsgen_rc Nurbs Interpolation Merge 2026-04-29 15:42:21 -07:00
.openscad_mdimggen_rc Make docs use PNG animations. 2023-02-03 12:09:46 -08:00
affine.scad Massive bug fix and doc fix update 2026-10-07 18:26:47 -04:00
attachments.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
ball_bearings.scad Assorted bugfixes and doc fixes/API corrections 2026-10-01 19:16:51 -04:00
beziers.scad collinear bug fix 2026-10-10 14:02:10 -04:00
bosl1compat.scad Dependency Warning Updates 2025-12-14 14:18:55 -08:00
bottlecaps.scad Various fixes to attachments: 2026-09-25 20:16:31 -04:00
builtins.scad Massive bug fix and doc fix update 2026-10-07 18:26:47 -04:00
CLAUDE.md Add CI check run times to CLAUDE.md 2026-02-16 12:34:15 -08:00
color.scad coords.scad and vectors.scad bugfixes 2026-09-29 19:00:37 -04:00
comparisons.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
constants.scad hide private functions in colors. small fixes to constants.scad 2026-09-26 19:22:21 -04:00
CONTRIBUTING.md Moving to BelfrySCAD org. 2023-05-21 21:00:05 -07:00
coords.scad coords.scad and vectors.scad bugfixes 2026-09-29 19:00:37 -04:00
cubetruss.scad misc bugfixes and doc corrections 2026-09-30 20:09:58 -04:00
distributors.scad major partitions refactoring affecting the half_of modules/functions 2026-10-14 22:12:21 -04:00
drawing.scad add half_mask() 2026-10-15 21:10:15 -04:00
fnliterals.scad Rename f_is_patch() to f_is_bezier_patch() 2026-03-16 15:59:43 -07:00
gears.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
geometry.scad doc fixes 2026-10-15 08:30:58 -04:00
hinges.scad misc bugfixes and doc corrections 2026-09-30 20:09:58 -04:00
hooks.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
isosurface.scad Integrated BelfrySCAD levelset(), other improvements 2026-10-12 21:26:39 -07:00
joiners.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
LICENSE Updated copyright years. Split math.scad up. Enabled attach for lots of shapes. Removed backwards compatability. 2019-04-19 17:02:17 -07:00
linalg.scad Massive bug fix and doc fix update 2026-10-07 18:26:47 -04:00
linear_bearings.scad misc bugfixes and doc corrections 2026-09-30 20:09:58 -04:00
lists.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
masks.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
math.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
metric_screws.scad docs: add missing Synopsis to 14 functions in metric_screws.scad 2026-04-05 17:17:23 -04:00
miscellaneous.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
modular_hose.scad misc bugfixes and doc corrections 2026-09-30 20:09:58 -04:00
nema_steppers.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
nurbs.scad fix comment 2026-09-22 19:13:06 -04:00
partitions.scad doc fixes 2026-10-15 22:59:37 -04:00
paths.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
polyhedra.scad Massive bug fix and doc fix update 2026-10-07 18:26:47 -04:00
README.md Added note that the version might be older than the current release. 2026-03-18 20:47:44 +01:00
regions.scad Massive bug fix and doc fix update 2026-10-07 18:26:47 -04:00
rounding.scad major partitions refactoring affecting the half_of modules/functions 2026-10-14 22:12:21 -04:00
screw_drive.scad misc bugfixes and doc corrections 2026-09-30 20:09:58 -04:00
screws.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
shapes2d.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
shapes3d.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
skin.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
sliders.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
std.scad change_anchor() rewritten, edge masks provide "corner" anchor 2026-03-14 13:33:24 -04:00
strings.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
structs.scad misc bugfixes and doc corrections 2026-09-30 20:09:58 -04:00
TESTING.md Add TESTING.md documenting the openscad-test framework 2026-03-16 14:23:34 -07:00
threading.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
transforms.scad Assorted bugfixes and doc fixes/API corrections 2026-10-01 19:16:51 -04:00
trigonometry.scad misc bugfixes and doc corrections 2026-09-30 20:09:58 -04:00
tripod_mounts.scad Assorted bugfixes and doc fixes/API corrections 2026-10-01 19:16:51 -04:00
turtle3d.scad Assorted bugfixes and doc fixes/API corrections 2026-10-01 19:16:51 -04:00
utility.scad segs(): support $fe, the max-error segment rule 2026-10-13 09:37:28 -07:00
vectors.scad coords.scad and vectors.scad bugfixes 2026-09-29 19:00:37 -04:00
version.scad Version bump to v2.0.772 2026-10-15 12:36:37 +00:00
vnf.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
walls.scad minor bug fixes and doc fixes 2026-10-08 19:02:27 -04:00
wiring.scad docs cleanup for vectors.scad and wiring.scad 2026-09-27 15:20:30 -04:00
WRITING_DOCS.md include beziers.scad in std.scad, remove include line from all other files containing it 2025-01-05 11:40:20 -08:00

BOSL2

BOSL2 Logo

The Belfry OpenScad Library, v2

A library for OpenSCAD, filled with useful tools, shapes, masks, math and manipulators, designed to make OpenSCAD easier to use.

Requires OpenSCAD 2021.01 or later.

  • NOTE: BOSL2 IS BETA CODE. THE CODE IS STILL BEING REORGANIZED.
  • NOTE2: CODE WRITTEN FOR BOSLv1 WON'T WORK WITH BOSL2!

Join the developer chat at https://gitter.im/revarbat/BOSL2

The BOSL2 library is an enormous library that provides many different kinds of capabilities to simplify the development of models in OpenSCAD, and to make things possible that are difficult in native OpenSCAD. Some of the things BOSL2 provides are:

  • Attachments. Unless you make models containing just one object, the attachments features can revolutionize your modeling. They let you position components of a model relative to other components so you don't have to keep track of the positions and orientations of parts of the model. You can instead place something on the TOP of something else, perhaps aligned to the RIGHT. For a full introduction to attachments, consult the Attachments Tutorial.
  • Rounding and filleting. Rounding and filleting is hard in OpenSCAD. The library provides modules like cuboid() to make a cube with any of the edges rounded, offset_sweep() to round the ends of a linear extrusion, and prism_connector() which works with the attachments feature to create filleted prisms between a variety of objects, or holes through a single object with rounded edges at the ends. You can also use edge_profile() to apply a variety of different mask profiles to chosen edges of a cubic shape, or you can directly subtract 3d mask shapes from an edge of objects that are not cubes.
  • Shorthands. The shorthands make your code a little shorter, and more importantly, they can make it significantly easier to read. Compare up(z) to translate([0,0,z]). The shorthands include operations for creating copies of objects and for applying transformations to objects, including rot() which extends rotate() in some useful ways that are not easy to do directly.
  • Complex object support. The path_sweep() function/module takes a 2d polygon moves it through space along a path and sweeps out a 3d shape as it moves. You can link together a series of arbitrary polygons with skin() or vnf_vertex_array(). Support for beziers and NURBS can help you construct the building blocks you need. Metaballs can create organic surfaces that blend shapes together.
  • Building Blocks. OpenSCAD provides cubes, cones and spheres. The BOSL2 library extends this to provide different kinds of prisms, tubes, and other abstract geometrical building blocks. In many cases the BOSL2 objects include options to round their edges. Basic objects have extensions like the ability to specify the inner radius of a circle to create holes with a guaranteed minimum size.
  • Texturing. Many kinds of objects can be created with textures applied. This can create knurling, but it can do much more than that. A texture can be any repeating pattern, and applying a texture can actually replace the base object with something different based on repeating copies of the texture element. A texture can also be an image; using texturing you can emboss an arbitrary image onto your model.
  • Parts library. The parts library includes many useful specific functional parts including gears, generic threading, and specific threading to match plastic bottles, pipe fittings, or standard screws. Also included are clips, hinges, and dovetail joints.
  • Geometrical operations on curves In OpenSCAD, geometrical operations happen on geometry, and information can never be extracted from geometry. The BOLS2 library provides operations on 2d point lists (called "paths" or "regions") to make rounded paths from ones with corners or do operations like intersection and offset. It can also do some limited operations on three dimensional data.
  • Geometrical operations on polyhedra Openscad describes a polyhedron using a list of vertices and faces, which BOSL2 refers to as a VNF (for Vertices 'N' Faces). When working directly with polyhedra it is tedious to ensure a valid result. The library provides tools to create VNFs that are guaranteed to be valid, and it offers some limited geometrical operations on VNFs.
  • Programming aids. The library provides basic mathematical operations including solutions to linear systems of equations and generic and polynomial numerical root finding. It provides geometrical operations like line intersection or circle intersection, coordinate transformations, string manipulation, and list processing.

Documentation

You can find the full BOSL2 library documentation at: https://github.com/BelfrySCAD/BOSL2/wiki

Installation

  1. Download the .zip or .tar.gz release file for this library. Currently you should be able to find this at https://github.com/BelfrySCAD/BOSL2/archive/refs/heads/master.zip
  2. Unpack it. Make sure that you unpack the whole file structure. Some zipfile unpackers call this option "Use folder names". It should create either a BOSL-v2.0 or BOSL2-master directory with the library files within it. You should see "examples", "scripts", "tests", and other subdirectories.
  3. Rename the unpacked main directory to BOSL2.
  4. Move the BOSL2 directory into the apropriate OpenSCAD library directory. The library directory may be on the list below, but for SNAP or other prepackaged installations, it is probably somewhere else. To find it, run OpenSCAD and select Help→Library Info, and look for the entry that says "User Library Path". This is your default library directory. You may choose to change it to something more convenient by setting the environment variable OPENSCADPATH. Using this variable also means that all versions of OpenSCAD you install will look for libraries in the same location.
    • Windows: My Documents\OpenSCAD\libraries\
    • Linux: $HOME/.local/share/OpenSCAD/libraries/
    • Mac OS X: $HOME/Documents/OpenSCAD/libraries/
  5. Restart OpenSCAD.

Fedora Linux

Users on Fedora Linux can install directly from their package repository by runnning:

sudo dnf install openscad-bosl2

  • NOTE: The version might be older than the current release.

Examples

A lot of the features of this library are to allow shorter, easier-to-read, intent-based coding. For example:

BOSL2/transforms.scad Examples Raw OpenSCAD Equivalent
up(5) translate([0,0,5])
xrot(30,cp=[0,10,20]) translate([0,10,20]) rotate([30,0,0]) translate([0,-10,-20])
xcopies(20,n=3) for (dx=[-20,0,20]) translate([dx,0,0])
zrot_copies(n=6,r=20) for (zr=[0:5]) rotate([0,0,zr*60]) translate([20,0,0])
skew(sxz=0.5,syz=0.333) multmatrix([[1,0,0.5,0],[0,1,0.333,0],[0,0,1,0],[0,0,0,1]])
BOSL2/shapes.scad Examples Raw OpenSCAD Equivalent
cube([10,20,30], anchor=BOTTOM); translate([0,0,15]) cube([10,20,30], center=true);
cuboid([20,20,30], rounding=5); minkowski() {cube([10,10,20], center=true); sphere(r=5, $fn=32);}
prismoid([30,40],[20,30],h=10); hull() {translate([0,0,0.005]) cube([30,40,0.01], center=true); translate([0,0,9.995]) cube([20,30,0.01],center=true);}
xcyl(l=20,d=4); rotate([0,90,0]) cylinder(h=20, d=4, center=true);
cyl(l=100, d=40, rounding=5); minkowski() {cylinder(h=90, d=30, center=true); sphere(r=5);}
tube(od=40,wall=5,h=30); difference() {cylinder(d=40,h=30,center=true); cylinder(d=30,h=31,center=true);}
torus(d_maj=100, d_min=30); rotate_extrude() translate([50,0,0]) circle(d=30);