Retrieved article excerpt
Open article · Retrieved 2026-11-18T21:22:35.254264+00:00
# springrep
**Exact CAD geometry**
in pure Rust.
**MIT**open source license
A boundary-representation (B-rep) kernel. Booleans, fillets, sweeps and STEP on exact geometry, accurate to 1e-7 mm, with every result validated.
brep-conformance leaderboard
kernellicensepass at 1e-7 mmspeed
[see the benchmark ↓](https://springcraft-ai.github.io/springrep/#bench)
[github](https://github.com/springcraft-ai/springrep)
### Accurate to 1e-7 mm
Surfaces are analytic or NURBS, never triangles, so volume, area and mass come straight from the exact shape. Every brep-conformance case holds to a ten-millionth of a millimetre.
### Valid, and named
Each operation's output passes a validity check, or you get an error instead of a broken solid. Faces are named for the operation that made them, like `plate.end`, so a changed dimension never loses a fillet or a reference.
### Safe and fast
100% Rust with no dependencies and no unsafe code. The fastest median case time on brep-conformance, and it compiles to WebAssembly to run in the browser.
## Get started01
01**add the crate**
$
copy
02**run it**
$ cargo run
volume 18276.001643 mm³
area 6452.128187 mm²
wrote bracket.step, 8 faces
or
copy prompt for AI agent
```
Set up springrep, an exact B-rep CAD kernel in Rust, and run its first example.
1. If this folder is not a Cargo project, run `cargo new springrep-start` and work in that folder.
2. Run `cargo add springrep`.
3. Write the program below exactly as given. In a new project it replaces src/main.rs. If the
project already has its own src/main.rs, save it as examples/bracket.rs instead.
4. Run it with `cargo run`, or `cargo run --example bracket` if you saved it as an example. It
must print:
volume 18276.001643 mm³
area 6452.128187 mm²
wrote bracket.step, 8 faces
If it prints anything else, stop and tell me what it printed. Don't change the part to make
the numbers match.
5. Run `cargo doc -p springrep` and read the module docs before writing any new geometry. Then
ask me what I want to build.
```rust
use springrep::{
blend::fillet,
boolean::difference,
math::{Frame, Vec2, Vec3},
measure,
profile::Profile,
step,
sweep::extrude,
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let base = Frame::new(Vec3::ZERO, Vec3::Z, Vec3::X)?;
let below = Frame::new(Vec3::new(0.0, 0.0, -1.0), Vec3::Z, Vec3::X)?;
let plate = extrude(&Profile::rect(Vec2::ZERO, 60.0, 40.0), &base, 8.0, "plate")?;
let bore = extrude(&Profile::circle(Vec2::ZERO, 12.0), &below, 10.0, "bore")?;
let part = difference(&plate, &bore)?;
let part = fillet(&part, &[("plate.end", "bore.side")], 1.5, "round")?;
println!("volume {:.6} mm³", measure::volume(&part));
println!("area {:.6} mm²", measure::area(&part));
std::fs::write("bracket.step", step::write(&part, "bracket")?)?;
println!("wrote bracket.step, {} faces", part.face_count());
Ok(())
}
```
Things to know:
- Every operation returns a Result. Propagate errors with ?; never unwrap a geometry result.
- Faces are named after the feature that made them: plate.end is the top of an extrusion named
plate, bore.side is the wall of one named bore. Fillets and chamfers pick an edge by the names
of the two faces either side of it.
- Run springrep::check::check on each new solid and treat any issue it reports as a bug.
- Units are millimetres.
```
src/main.rscopy
```
use springrep::{
blend::fillet,
boolean::difference,
math::{Frame, Vec2, Vec3},
measure,
profile::Profile,
step,
sweep::extrude,
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let base = Frame::new(Vec3::ZERO, Vec3::Z, Vec3::X)?;
let below = Frame::new(Vec3::new(0.0, 0.0, -1.0), Vec3::Z, Vec3::X)?;
let plate = extrude(&Profile::rect(Vec2::ZERO, 60.0, 40.0), &base, 8.0, "plate")?;
let bore = extrude(&Profile::circle(Vec2::ZERO, 12.0), &below, 10.0, "bore")?;
let part = difference(&plate, &bore)?;
let part = fillet(&part, &[("plate.end", "bore.side")], 1.5, "round")?;
println!("volume {:.6} mm³", measure::volume(&part));
println!("area {:.6} mm²", measure::area(&part));
std::fs::write("bracket.step", step::write(&part, "bracket")?)?;
println!("wrote bracket.step, {} faces", part.face_count());
Ok(())
}
```
## Best in class02
Results from brep-conformance, an open conformance suite for B-rep kernels. Each case's expected result is derived from closed-form mathematics, not from another kernel's output, and every kernel, springrep included, is held to the same criteria.
leaderboard
| kernel | cases by tightest tolerance passed, mm | pass at 1e-7 mm | pass at 1e-5 mm | speed lower is better |
| --- | --- | --- | --- | --- |
[brep-conformance GitHub](https://github.com/springcraft-ai/brep-conformance)
[full benchmark results](https://springcraft-ai.github.io/brep-conformance/)