Skip to content

bherbruck/CADmium

 
 

Repository files navigation

CADmium

This project aims to create a new CAD program from scratch. It is small, it runs in a web browser, and the source code is available for free here on Github.

Legacy CAD programs have taken many thousands of years of collective engineering time to get where they are so this program will never be able to compete on breadth of features. But CADmium is intended to capture 80% of the most common CAD use cases while doing less than 10% of the work. For now we are targeting the home hobbyist who just wants to design a widget for their 3D printer, not a company that wants to design a car or airplane, although that will come later.

If you're looking for:

  • A simple, modern, parametric CAD UI that runs in a browser
  • That can export solids as .step, .obj, or .cadmium (a json-based CAD format that this project is inventing)
  • That can export sketches as .svg or .dxf
  • That works without an internet connection

Then this project may be for you!

Status: Early prototype. This tool is not yet an MVP, but is being developed in the open. Please do not share this to HN or Reddit or things like that. ha, well I guess that ship has sailed!

Overall Plan

Demos: We are currently racing toward our first demo release, V0.0.1. This is a good first exercise for us to decide on build and release processes.

After that we will do a few more demo (V0.0.*) releases, aggregating features until it feels pretty usable.

Alpha: When it feels like we've reached an MVP that people might actually want to use, it's time to release an Alpha version (V0.1.0) and actively solicit feedback from users. We'll use that feedback to make more improvements, re-inventing things if necessary to achieve a great workflow.

Beyond that, we'll see!

Technology

The boundary representation engine under the hood is truck, which is written in rust and is not dependent on any legacy b-rep engine.

Leveraging truck, we wrote a small rust library called cadmium which provides structs for projects, workspaces, sketches, extrusions, and constraints. Our goal is that this rust library provides all the same functionality as the UI for anyone who prefers code-first CAD. This library is able to save and load projects to disk as json. We have also built a set of javascript bindings so that the whole thing can be compiled to wasm and run in a browser.

The UI is built with SvelteKit and Tailwind. It is hosted with Github Pages. We use three.js for rendering, which in this case uses WebGL under the hood. We use Threlte to manage the scene graph declaratively.

License

This software is offered under the Elastic License 2.0. In summary, you can do whatever you like with this software except offer it as a service to third parties.

Running The Code

If you're just trying to kick the tires, click here to view the live web demo.

To build locally using pnpm workspace & turbo:

git clone https://github.com/Cadmium-Co/CADmium.git
cd CADmium
pnpm install
pnpm dev

Tooling setup

pnpm

We use pnpm to manage the monorepo. Please follow the instructions here to install: https://pnpm.io/installation#using-a-standalone-script

If you're new to node you can use pnpm to manage nodejs:

# https://pnpm.io/cli/env#use
pnpm env use --global 20

rust

First install rust using rustup: https://rustup.rs

Then install wasm-pack

cargo install wasm-pack

Running Tests

turbo test

Playwright is used for e2e testing. You may be prompted with a command to install it.

For manjaro/archlinux folks it may report missing dependencies. On manjaro the missing dependencies are solved thanks to this comment:

yay -S aur/enchant1.6 aur/icu66 aur/libwebp052

Watch vitest unit tests only:

cd applications/web
pnpm test:unit -w

rust

To build and run the Rust tests:

cargo test

Contributing

We are actively seeking contributors! Please join the Discord and come help out!

Most especially, we need help in the following areas:

Design: The tool must look and feel good and we are not designers. We would love contributions in the form of:

  • Advice, mockups, or tailwindcss examples of how to make different elements look and behave better
  • In particular, help picking a color palette that works well and is unique
  • Help figuring out how to implement dark mode

Rust: This is our first project in Rust. We need help from experienced Rustaceans to:

  • Figure out how to better lay out the rust code
  • Point out any glaring issues with how I'm using the language (We've thus far completely avoided Lifetimes, Traits, Rc, RefCell, etc and that may be hampering things)

Svelte: This is our first project using Svelte. We'd love an experienced set of eyes to:

  • Look over the basic structure and tell us if we're making any big mistakes
  • Help us migrate to Svelte 5 when it comes out

If you feel like you would be willing and able to help, please join our discord!

Immediate TODOs for V0.0.1 release (The Demo)

Github project for tracking progress is here

  • Sketching
    • Implement a standalone first-order 2D constraint solver
    • Integrate that new solver into sketch.rs
    • Ability to create a sketch on the face of a solid
    • Ability to create and modify constraints in the UI
  • Extrusion
    • Configure an extrusion to create new solid or subtract from existing solid
  • Project
    • Ability to rename the project
    • Ability to delete steps
    • bind ctrl s to .cadmium export, and ctrl o to .cadmium import
  • Units
    • Make it clear that the whole file uses millimeter units
  • Marketing
    • Youtube video demonstrating how to make:
      • A simple cube
      • A plate with screw holes
      • Something pretty complex like this

About

A CAD program that runs in the browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 48.3%
  • Svelte 30.4%
  • TypeScript 13.3%
  • JavaScript 7.8%
  • CSS 0.1%
  • HTML 0.1%