Cadova is a Swift library for creating 3D models through code, with a focus on 3D printing. It offers a programmable alternative to traditional CAD tools, combining precise geometry with the expressiveness and elegance of Swift.
Cadova models are written entirely in Swift, making them easy to version, reuse, and extend. The result is a flexible and maintainable approach to modeling, especially for those already comfortable with code.
Cadova runs on macOS, Windows, and Linux. To get started, read the Getting Started guide.
Full documentation, including What is Cadova?, is available on the Swift Package Index. See the wiki for related projects: the viewer app, libraries, and example models built with Cadova.
await Model("Hex key holder") {
let height = 20.0
let spacing = 8.0
Stack(.x, spacing: spacing) {
for size in stride(from: 1.5, through: 5.0, by: 0.5) {
RegularPolygon(sideCount: 6, widthAcrossFlats: size)
}
}.measuringBounds { holes, bounds in
Stadium(bounds.size + spacing * 2)
.extruded(height: height)
.subtracting {
holes.aligned(at: .centerX)
.extruded(height: height)
.translated(z: 2)
}
}
}For more code examples, see Examples.
To preview your models, check out Cadova Viewer, a native macOS 3MF viewer that reloads automatically as your model regenerates.
Cadova uses Manifold-Swift, Apus, Pelagos and ThreeMF.
Cadova is currently in pre-release, with a version number below 1.0. The API is still evolving, but stability is maintained within each minor version — so upToNextMinor(from:) is recommended for your dependency. You're very welcome to start using Cadova today, and feedback is appreciated!
Contributions are welcome! If you have ideas, suggestions, or improvements, feel free to open an issue or submit a pull request. You’re also welcome to browse the open GitHub issues and pick one to work on — especially those marked as good first issues or help wanted.
This project is licensed under the MIT license. See the LICENSE file for details.
// swift-tools-version: 6.1
import PackageDescription
let package = Package(
name: "<#name#>",
platforms: [.macOS(.v14)],
dependencies: [
.package(url: "https://github.com/tomasf/Cadova.git", .upToNextMinor(from: "0.8.0")),
],
targets: [
.executableTarget(
name: "<#name#>",
dependencies: ["Cadova"],
swiftSettings: [.interoperabilityMode(.Cxx)]
),
]
)