5 unstable releases

Uses new Rust 2021

0.3.1 Nov 22, 2021
0.3.0 Nov 21, 2021
0.2.0 Jul 7, 2021
0.1.1 May 19, 2021
0.1.0 May 19, 2021

#23 in Rendering

49 downloads per month

0BSD license

90 lines



Experimental CAD system, written in the Rust programming language.

Screenshot of the spacer model

The following models are currently available:


Fornjot is still highly experimental. Development is currently focused on incrementally expanding features, to support specific new CAD models. This grounds the development effort in practical use cases and ensures steady progress. Which is good, because CAD is a very difficult subject, and there's always the danger of getting lost in the weeds, trying to implement some complicated algorithm from a barely legible paper.

However, that also means that other models, even if they're very similar to existing ones, are often not supported, because the algorithms make simplifying assumptions. If you're interested in Fornjot and are considering to use it, you should fully expect to run into limitation pretty much immediately. Unless you are willing to contribute to its development, it would be better to wait for a year or ten, to let it mature.

At this point, performance is not much of a concern. Models are simple so far, and liberally sprinkling heap allocations makes algorithms easy to write. At some point, that focus will likely change, but for now ease of coding is more important than scalability.


Code-CAD in Rust

Models are defined as Rust code. They are compiled separately, and loaded into a host application as a plug-in, to ensure fast compile times.

use std::collections::HashMap;

pub extern "C" fn model(args: &HashMap<String, String>) -> fj::Shape {
    let outer = args
    let inner = args
    let height = args

    let outer_edge = fj::Circle { radius: outer };
    let inner_edge = fj::Circle { radius: inner };

    let footprint = fj::Difference {
        a: outer_edge.into(),
        b: inner_edge.into(),

    let spacer = fj::Sweep {
        shape: footprint.into(),
        length: height,


This is the code for the spacer model. As you can see, there's still some work to do, to make the process of defining models more convenient.

Export to 3MF

Exporting models to the 3D Manufacturing Format (3MF), which is used in 3D printing, is supported.


Defining models

Models depend on the fj library, which they use to define the geometry. Furthermore, they need to be built as a dynamic library. Just use the examples in the models/ directory as a template.

Viewing models

To compile and view a model, run it from the host application.

# Compile/view the spacer model
cargo run -- -m spacer

This invocation expects that the model exists in the models/spacer directory, with a package name of spacer.

Rotate the model by pressing the left mouse button while moving the mouse. Move the model by pressing the right mouse button while moving the mouse. Zoom with the mouse wheel.

Toggle model rendering by pressing 1. Toggle mesh rendering by pressing 2.

So far, the host application is not published on crates.io, and the whole process is not really optimized for being used outside of this repository. Contributions to improve that situations are very welcome.

Exporting models

To export a model to a 3MF file, run:

cargo run -- -m spacer --export spacer.3mf

Model parameters

Some models have parameters that can be overridden. For example, to override the inner and outer radii of the spacer model:

cargo run -- -m spacer --arguments outer=8.0 inner=5.0


This project is open source, licensed under the terms of the Zero Clause BSD License (0BSD, for short). This basically means you can do anything with it, without any restrictions, but you can't hold the authors liable for problems.

See LICENSE.md for full details.

No runtime deps