The <...> form of use / include resolves against an ordered search path,
so built-in (bundled) libraries are referenced by bare name and never depend on
where bCAD is actually installed.
Resolution order
- directory of the file containing the directive (a local file of the same name
wins — tests keep using
use <lib/testing.scad>); - user library directories from
settings.conf:
[general]
library_path = /home/user/scad_libs:/opt/team_libs
Separator is os.pathsep (: POSIX, ; Windows) or a comma.
⚠ the OCCT worker reads settings.conf on startup, so change the path and
restart (or open the worker again) before rendering.
- bundled standard libraries —
bcad/assets/libraries/. The directory is resolved from__file__, so it works for any install layout (dev tree, AppImage, Windows build).
Absolute paths resolve as-is; nested use/include inside a library file are
anchored to that library's own directory.
Implementation
bcad/binterpreter/library_paths.py is the single source of truth:
library_search_paths(base_path)— ordered roots;resolve_path(path, base_path, search_libraries=True)— first existing file orNone(noos.path.abspath(None)crash for unsaved editor buffers).
Used by scl.py (_expand_scope include flattening, use and include
handlers) and the editor's Ctrl+E jump (bcode_editor.py).
import() / surface() stay strictly file-relative (search_libraries=False),
keeping OpenSCAD semantics while still guarding the unsaved-buffer case.
Bundled libraries
bcad/assets/libraries/ ships with the app (see its README). Drop .scad files
there — or in a subdirectory referenced as use <MCAD/…> — and they become
available globally. Test: tests/library_search.scad covers bundled resolution
and nested use inside a bundled library.