import Cadova

3D models,
written in Swift.

Cadova is a Swift library for building precise, parametric 3D models in code, with a focus on 3D printing. Your models are plain Swift: easy to version, reuse and extend, and as expressive as the language itself.

Change a number.
Change the model.

Every shape in Cadova is a value you can compute with. Drag the orange numbers, or click one and use the arrow keys. Each variant below was built by Cadova from this exact code.

Vase.swift
1import Cadova
2
3await Model("vase") {
4    RegularPolygon(sideCount: 6, circumradius: 22)
5        .rounded(radius: 5)
6        .extruded(height: 70, twist: 120°)
7        .colored(.tomato)
8}
A tomato-colored hexagonal vase, twisted 120 degrees
6 sides · 120° twist

Try before
you install.

Curious, but not ready to set anything up? The Cadova Playground is a quick way to get a feel for Cadova in your browser. Open an example or start from scratch, write some code, and watch the model update as you type. When you want to build something real, install Cadova and take it from there.

From a vase
to a whole machine.

The same few ideas scale from a single part to complete projects. Every model here is Cadova code, several of them open source.

A modeling toolkit,
as an API.

Combine shapes

Add, subtract and intersect solids the way you think about them.

.subtracting { … }

Model in 2D, build in 3D

Round, offset and trim profiles, then extrude, twist or revolve them.

.extruded(height: 70, twist: 120°)

Paths, sweeps and lofts

Sweep a profile along a Bézier path, or blend between cross-sections.

.swept(along: path, …)

Edges and finishing

Fillet and chamfer edges, and keep holes printable without supports.

.shapingEdges(.fillet(radius: 2), …)

Parts, colors, materials

Export 3MF with separate parts and colors, straight into your slicer.

.withMaterial(.brass)

Everywhere Swift runs

Write and build models on macOS, Linux and Windows.

swift run

Cadova Viewer

A native macOS viewer for 3MF that reloads the moment your model is regenerated. Slice it with cross-sections, measure it, and look at it from several angles at once.

Download for macOS

Cadova for VS Code

Generate and preview models without leaving your editor, on macOS, Linux and Windows. The preview updates as you save, with parts, measuring and cross-sections.

Get it from the Marketplace

Let anyone
adjust it.

Mark the values people should be able to change with @Parameter, run one command, and Cadova turns your model into a web page with sliders, switches and a live 3D preview. Visitors set it up the way they need and download a file for their slicer, no Swift required.

The model runs in the visitor’s browser, so the page is just static files you can put on any host. Cadova’s GitHub action can publish it to GitHub Pages every time you push.

More examples: a keystone patch panel and a QR code sign.

Scoop.swift
await Model("scoop") {
    @Parameter("Volume", in: 20...100, unit: "ml")
    var volume = 30.0

    @Parameter("Hanging hole")
    var hangingHole = true

    Scoop(volume: volume, hangingHole: hangingHole)
}
$ swift package generate-customizer

Learn Cadova
in nine short videos.

A tutorial series from your first model to paths, lofts and sweeps, each episode about two minutes long. The code from every episode is on GitHub, ready to run.

Your first model
in three steps.

  1. Add Cadova to your package

    .package(
        url: "https://github.com/tomasf/Cadova.git",
        from: "1.0.0"
    )
  2. Describe your model

    import Cadova
    
    await Model("gizmo") {
        Box([10, 10, 5])
            .subtracting {
                Sphere(diameter: 10)
                    .translated(z: 5)
            }
    }
  3. Run it

    $ swift run

    Open Models/gizmo.3mf in Cadova Viewer or your slicer. Edit, save, run again, and watch it update.