The Belfry OpenScad Library, v2.0. An OpenSCAD library of shapes, masks, and manipulators to make working with OpenSCAD easier. BETA
Find a file
2025-12-06 09:30:10 -05:00
.github workflow additional fix 2025-06-13 18:14:15 -04:00
examples New assets: geotiff2scad.py script and worldmap_360x180.scad 2025-05-08 21:34:05 -07: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 updated 3d2scad.py to output raw VNF list instead of named objects 2025-06-29 22:34:30 -07:00
tests glued circle fixes 2025-10-05 14:52:45 -04:00
tutorials doc fixes 2025-10-15 22:28:59 -04:00
.gitignore Improved mkdocspdf.sh 2023-05-08 16:45:38 -07:00
.openscad_docsgen_rc Add ring hook 2025-10-23 16:50:23 -04:00
.openscad_mdimggen_rc Make docs use PNG animations. 2023-02-03 12:09:46 -08:00
affine.scad Fix teardrop for threaded screws 2024-01-27 10:52:54 -05:00
attachments.scad doc fixes, add spin to attach_prism() 2025-11-14 06:11:18 -05:00
ball_bearings.scad Added rounding parameter as discussed in #1476 2024-12-12 10:20:17 -08:00
beziers.scad rounded caps on sweeps 2025-05-11 20:48:13 -04:00
bosl1compat.scad doc fixes 2022-10-23 08:05:40 -04:00
bottlecaps.scad remove debug echoes 2025-05-02 23:27:28 -04:00
builtins.scad bug fixes for "default" color 2022-03-20 09:03:18 -04:00
color.scad Add Debugging topic to some color modules 2025-08-29 01:41:04 +02:00
comparisons.scad fix VNF rounding bugs; fix bug where chamfers/roundings were measured 2025-05-24 23:00:58 -04:00
constants.scad remove blank lines from new slop calibration code 2025-11-09 11:18:57 -05:00
CONTRIBUTING.md Moving to BelfrySCAD org. 2023-05-21 21:00:05 -07:00
coords.scad doc fixes 2025-09-05 18:43:05 -04:00
cubetruss.scad cubetruss anchor fix 2025-03-17 20:57:46 -04:00
distributors.scad doc fix 2025-06-14 21:58:39 -04:00
drawing.scad expand glued_circles to different size circles 2025-10-05 11:20:32 -04:00
fnliterals.scad Some 2-arg fnliteral factory fixes. 2023-08-07 23:24:28 -07:00
gears.scad doc fix 2025-10-15 21:15:50 -04:00
geometry.scad Add topic to various debugging modules 2025-08-29 01:37:29 +02:00
hinges.scad Corrected some uses of ellipse(circum=true,realign=true) 2025-09-01 00:26:37 -07:00
hooks.scad fix include 2025-10-24 08:18:20 -04:00
isosurface.scad Minor updates to documentation 2025-11-04 21:58:23 -08:00
joiners.scad doc tweaks 2025-12-05 23:31:48 -05: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 doc fixes 2025-09-05 18:43:05 -04:00
linear_bearings.scad Deprecating metric_screws.scad 2023-06-01 21:44:23 -07:00
lists.scad fix typo 2025-04-28 19:16:26 -04:00
masks.scad doc fixes, add spin to attach_prism() 2025-11-14 06:11:18 -05:00
math.scad expand glued_circles to different size circles 2025-10-05 11:20:32 -04:00
metric_screws.scad Change Extra Anchors to Named Anchors 2024-05-20 19:42:07 -04:00
miscellaneous.scad doc fixes 2025-04-18 06:15:59 -04:00
modular_hose.scad All the SynTags. 2023-05-29 21:48:48 -07:00
nema_steppers.scad All the SynTags. 2023-05-29 21:48:48 -07:00
nurbs.scad nurbs bugfix singleton point evaluation 2025-02-07 17:47:06 -05:00
partitions.scad partition doc fix 2025-07-17 19:07:40 -04:00
paths.scad Fix minor doc errors 2025-08-08 14:02:46 -07:00
polyhedra.scad doc fix 2024-11-19 19:01:01 -05:00
README.md link correction 2025-06-21 10:59:08 -04:00
regions.scad Add ring hook 2025-10-23 16:50:23 -04:00
rounding.scad allow array valued shift for prism_connector and attach_prism 2025-11-30 16:20:50 -05:00
screw_drive.scad attachability for torx, roberson, screw_head 2023-06-18 20:20:01 -04:00
screws.scad Adds #9 screws. 2025-08-12 09:04:36 -04:00
shapes2d.scad Minor updates to documentation 2025-11-04 21:58:23 -08:00
shapes3d.scad bugfixes and remove debug echoes 2025-11-09 17:12:53 -05:00
skin.scad fix invalid outputs from module version of path_sweep 2025-11-30 16:16:51 -05:00
sliders.scad Added slider/rail anchor examples. 2025-05-15 15:49:14 -07:00
std.scad masks reorg 2025-10-15 20:01:17 -04:00
strings.scad strings doc fixes 2025-04-21 19:20:55 -04:00
structs.scad add structs.scad to std.scad; fix various it's typos in docs 2024-11-03 07:12:38 -05:00
threading.scad fix for threaded_nut bevang 2025-12-01 11:36:32 -05:00
transforms.scad Add top_edge anchor to wedge and make anchors to degenerate prismoids 2025-06-19 22:21:11 -04:00
trigonometry.scad Synopses, etc for trigonometry.scad 2023-04-28 18:39:26 -07:00
tripod_mounts.scad All the SynTags. 2023-05-29 21:48:48 -07:00
turtle3d.scad doc fix for turtle3d 2025-06-25 20:52:37 -04:00
utility.scad fix rotate_sweep centroid calculation 2025-08-27 17:38:15 -04:00
vectors.scad Improved fit_to_box(), added example 2025-04-30 16:17:03 -07:00
version.scad Merge branch 'master' into master 2024-02-12 00:19:58 -08:00
vnf.scad doc tweaks 2025-09-27 22:32:20 -04:00
walls.scad improved size error handling, round3d docs & default size change 2025-02-23 16:09:24 -05:00
wiring.scad All the SynTags. 2023-05-29 21:48:48 -07: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.

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);