The Problem
Designing and manipulating NURBS‑based boundary representations in a production CAD pipeline requires a library that can convert USD scenes to solid models, perform Boolean operations, and expose a Python API for automated workflows. Existing solutions often tie tightly to proprietary tooling or lack a clear build path for cross‑platform C++ extensions.
What This Does
usd-brep supplies a C++ core and a Python wrapper that expose NURBS BRep functionality to Omniverse and other USD‑based workflows.
- The core is located under
source/(357 C++ files, 331 headers) and implements kernel operations such assmlib::kernel::operations::boolean::makeBoolean. - The Python layer lives in
tools/pyproject/setup.pyandtools/smlib_gui/app.py, providing an interactive GUI (tools/smlib_gui.py) and a pip‑installable package built byuv. - Tests and examples reside in
tests/andExamples/, demonstrating usage of the public API.
How It Is Wired
- Entry point:
tools/pyproject/setup.pycallsuv run --locked --group gui python tools/scripts/smlib_gui.py. - Python API construction:
setup.pyimportssmlib::kernelviapybind11, generating extension modules in_build. - GUI flow:
tools/smlib_gui/app.pyimports the compiled modules, creates a Qt window, and routes user actions tosmlib::kernel::operations. - Build orchestration:
repo.sh(wrapper aroundrepo_build) triggersprebuild.shto stage theomniSolidschema into_build/schema/omniSolid/resources, then compiles the C++ code with the host MSVC toolchain on Windows org++on Linux. - Testing:
tests.shexecutes unit tests intests/via the compiled binaries; it also drives smoke tests for the GUI.
The graph shows a single hub in setup.py that loads all extensions; any change here can affect the entire build and runtime. No cycles were detected in the call graph, but the hub’s wide blast radius means modifications must be fully regression‑tested.
How To Use It
# Clone the repo
git clone https://github.com/moses-y/usd-brep
cd usd-brep
# Prepare large assets
git lfs pull
# Build
./prebuild.sh # Stage schema resources
./repo.sh build # Compile C++ and generate Python wheels
# Run tests
./repo.sh test
./tests.sh linux-x86_64
# Launch the GUI
uv run --locked --group gui python tools/scripts/smlib_gui.py
Prerequisites are listed in README.md and include a C++ toolchain (MSVC on Windows) and Python 3.12. Configuration is minimal; environment variables such as SMLIB_USD_ROOT can be set when using OpenUSD tier‑1 schemas, but the default build works with the bundled dependencies.
Real-World Use
A pipeline component that converts USD scenes exported from CAD tools into NURBS BReps, applies Boolean operations, and feeds the result back into Omniverse:
import smlib.brep as brep
mesh = brep.load_usd("design.usd")
solid = brep.boolean_union([mesh.part1, mesh.part2])
brep.export_usd(solid, "result.usd")
The script can be called from a CI job or integrated into a larger simulation workflow.
Code Health & Issues
- Medium (SDLC) – No CI/CD configuration (
.github/,.gitlab-ci.ymlmissing). - Low (Build reproducibility) –
pyproject.tomllists dependencies but no lockfile; builds may vary across environments. - Low (Documentation) – 24 markdown docs exist, but the README lacks a license header.
- Low (Testing coverage) – 690 tests are present, but CI is absent to enforce passing status.
The Bottom Line
usd-brep is a solid foundation for NURBS‑based solid modeling with a clear build path and functional Python bindings. Its lack of automated testing pipelines and missing lockfile make it less reliable for production use without additional CI setup. Teams needing a rapid integration into Omniverse or USD workflows should consider it, provided they add their own build and test gates.