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.

// try it

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

// built with cadova

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.

// the toolbox

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

// see it instantly

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

// learn

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.

// get started

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.