Bundled OpenSCAD libraries
The browser-based AI CAD Modeler ships with two popular OpenSCAD libraries pre-installed: BOSL2 (Belfry OpenSCAD Library 2) and MCAD. They're lazy-loaded the first time you reference them — no manual setup, no install. This page documents what's bundled, how the loader works, and the license terms we honor for each library.
Usage
Just write use <…> or include <…> as you would in desktop OpenSCAD:
include <BOSL2/std.scad>
include <BOSL2/gears.scad>
spur_gear(teeth=24, mod=2, thickness=6,
shaft_diam=8, chamfer=0.4);
The same works for any MCAD file:
use <MCAD/involute_gears.scad>
use <MCAD/teardrop.scad>
use <MCAD/nuts_and_bolts.scad>
gear(number_of_teeth=24, circular_pitch=300);
How the loader works
OpenSCAD compiled to WebAssembly has no host filesystem to read library
files from, so use <BOSL2/std.scad> would normally
silently fail. To make libraries work in the browser:
- Every
.scadfile from BOSL2 and MCAD is bundled as a single JSON blob and served as a static asset (/static/openscad/libraries/<name>-bundle.json). - Before every render, the editor scans your code for
use <LibName/...>andinclude <LibName/...>patterns. - The first time a library is referenced in your session, its bundle is fetched (~1 MB gzipped for BOSL2, ~50 KB for MCAD) and cached.
- For every render after that, every file from the cached bundle
is written into the WASM filesystem at
/BOSL2/...//MCAD/...before OpenSCAD runs, soinclude <...>resolves like it would on desktop.
NopSCADlib, Round-Anything, dotscad/threads, and your own private libraries aren't bundled by default. Two workarounds: (1) paste the helper modules you need at the top of your file (the AI agent does this automatically for hardware), or (2) open the project in desktop OpenSCAD where the OS filesystem is available. If there's a library you'd like us to bundle, let us know.
BOSL2 — Belfry OpenSCAD Library 2
BOSL2 is the de-facto standard library for OpenSCAD: hardware (screws/nuts/washers), gears, threads, splines, attachables, masks for fillets and chamfers, and a richer math toolkit. The AI agent will reach for BOSL2 idioms by default when generating mechanical parts.
| Field | Value |
|---|---|
| Upstream | github.com/BelfrySCAD/BOSL2 |
| Snapshot | master, 56 .scad files (4.1 MB raw / ≈ 1 MB gzipped) |
| Bundle | /static/openscad/libraries/bosl2-bundle.json |
| Source files | /static/openscad/libraries/BOSL2/ |
| License | BSD 2-Clause — full text |
| Copyright | Copyright (c) 2017-2019, Revar Desmera. All rights reserved. |
BSD 2-Clause License (BOSL2)
BSD 2-Clause License
Copyright (c) 2017-2019, Revar Desmera
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MCAD — OpenSCAD MCAD Library
MCAD is the older, OpenSCAD-team-maintained library of common mechanical parts: gears, motors (NEMA mounts), bearings, screws, teardrop holes, regular shapes, units, materials, and many more. It's smaller and less actively maintained than BOSL2, but the modules are well-tested and useful as drop-in primitives.
| Field | Value |
|---|---|
| Upstream | github.com/openscad/MCAD |
| Snapshot | master, 42 .scad files (203 KB raw / ≈ 42 KB gzipped) |
| Bundle | /static/openscad/libraries/mcad-bundle.json |
| Source files | /static/openscad/libraries/MCAD/ |
| License | GNU LGPL 2.1 — full text |
| Copyright | Various authors, named in individual file comments. Some files allow distribution under more permissive terms (see each file). |
LGPL 2.1 attribution (MCAD)
MCAD is distributed under the GNU Lesser General Public License, version 2.1. You can read the full license text here. In summary, the LGPL allows commercial use of MCAD as long as:
- The MCAD source remains available to anyone using the modeler
(it is — under
/static/openscad/libraries/MCAD/). - The copyright notices and license stay attached (they do —
unmodified in each
.scadfile's header). - Users can replace the bundled MCAD with their own modified
version. You can — write your own
MCAD/foo.scadinline (overrides the bundled file via the WASM filesystem), or use desktop OpenSCAD with your own MCAD checkout.
Models you design with MCAD modules are your work, not derivative works of MCAD. You can use them commercially with no restrictions. The LGPL only constrains what we (PrintPal) can do with the MCAD source — not what you can do with your OpenSCAD output.
Updates
Bundled libraries are vendored at build time. We update them
periodically — the snapshot date is recorded inside each
bundle.json:
curl https://printpal.io/static/openscad/libraries/bosl2-bundle.json \
| jq '{name, snapshot_date, source, license, files: (.files | keys | length)}'
If BOSL2 or MCAD ships a release with a bug fix or new module you need, drop us a line and we'll refresh the bundle. The whole vendoring pipeline is one Python script (~20 lines) so the turnaround is fast.