Skip to content

indirectlylit/kittycad-modeling-app

 
 

Repository files navigation

KittyCAD Modeling App

KittyCAD Modeling App

live at app.kittycad.io

A CAD application from the future, brought to you by the KittyCAD team.

The KittyCAD modeling app is our take on what a modern modelling experience can be. It is applying several lessons learned in the decades since most major CAD tools came into existence:

  • All artifacts—including parts and assemblies—should be represented as human-readable code. At the end of the day, your CAD project should be "plain text"
    • This makes version control—which is a solved problem in software engineering—trivial for CAD
  • All GUI (or point-and-click) interactions should be actions performed on this code representation under the hood
    • This unlocks a hybrid approach to modeling. Whether you point-and-click as you always have or you write your own KCL code, you are performing the same action in KittyCAD Modeling App
  • Everything graphics has to be built for the GPU
    • Most CAD applications have had to retrofit support for GPUs, but our geometry engine is made for GPUs (primarily Nvidia's Vulkan), getting the order of magnitude rendering performance boost with it
  • Make the resource-intensive pieces of an application auto-scaling
    • One of the bottlenecks of today's hardware design tools is that they all rely on the local machine's resources to do the hardest parts, which include geometry rendering and analysis. Our geometry engine parallelizes rendering and just sends video frames back to the app (seriously, inspect source, it's just a <video> element), and our API will offload analysis as we build it in

We are excited about what a small team of people could build in a short time with our API. We welcome you to try our API, build your own applications, or contribute to ours!

KittyCAD Modeling App is a hybrid user interface for CAD modeling. You can point-and-click to design parts (and soon assemblies), but everything you make is really just kcl code under the hood. All of your CAD models can be checked into source control such as GitHub and responsibly versioned, rolled back, and more.

The 3D view in KittyCAD Modeling App is just a video stream from our hosted geometry engine. The app sends new modeling commands to the engine via WebSockets, which returns back video frames of the view within the engine.

Tools

Original demo video

Original demo slides

Get started

We recommend downloading the latest application binary from our Releases page. If you don't see your platform or architecture supported there, please file an issue.

Running a development build

First, install Rust via rustup. This project uses a lot of Rust compiled to WASM within it. Then, run:

yarn install

followed by:

yarn build:wasm-dev

That will build the WASM binary and put in the public dir (though gitignored)

finally, to run the web app only, run:

yarn start

Developing in Chrome

Chrome is in the process of rolling out a new default which blocks Third-Party Cookies. If you're having trouble logging into the modeling-app, you may need to enable third-party cookies. You can enable third-party cookies by clicking on the eye with a slash through it in the URL bar, and clicking on "Enable Third-Party Cookies".

Running tests

First, start the dev server following "Running a development build" above.

Then in another terminal tab, run:

yarn test

Which will run our suite of Vitest unit and React Testing Library E2E tests, in interactive mode by default.

For running the rust (not tauri rust though) only, you can

cd src/wasm-lib
cargo test

but you will need to have install ffmpeg prior to.

Tauri

To spin up up tauri dev, yarn install and yarn build:wasm-dev need to have been done before hand then

yarn tauri dev

Will spin up the web app before opening up the tauri dev desktop app. Note that it's probably a good idea to close the browser tab that gets opened since at the time of writting they can conflict.

The dev instance automatically opens up the browser devtools which can be disabled by commenting it out

To build, run yarn tauri build, or yarn tauri build --debug to keep access to the devtools.

Note that these became separate apps on Macos, so make sure you open the right one after a build 😉 image

image

image (1)

Before submitting a PR

Before you submit a contribution PR to this repo, please ensure that:

  • There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
  • You have separated out refactoring commits from feature commits as much as possible
  • You have run all of the following commands locally:
    • yarn fmt
    • yarn tsc
    • yarn test
    • Here they are all together: yarn fmt && yarn tsc && yarn test

Release a new version

  1. Bump the versions in the .json files by creating a Cut release v{x}.{y}.{z} PR, committing the changes from
VERSION=x.y.z yarn run bump-jsons

The PR may serve as a place to discuss the human-readable changelog and extra QA. A quick way of getting PR's merged since the last bump is to use this PR filter, open up the browser console and past in the following

console.log(
  '- ' +
    Array.from(
      document.querySelectorAll('[data-hovercard-type="pull_request"]')
    ).map((a) => `[${a.innerText}](${a.href})`).join(`
- `)
)

grab the md list and delete any that are older than the last bump

  1. Merge the PR

  2. Create a new release and tag pointing to the bump version commit using semantic versioning v{x}.{y}.{z}

  3. A new Action kicks in at https://github.com/KittyCAD/modeling-app/actions, uploading artifacts to the release

Fuzzing the parser

Make sure you install cargo fuzz:

$ cargo install cargo-fuzz
$ cd src/wasm-lib/kcl

# list the fuzz targets
$ cargo fuzz list

# run the parser fuzzer
$ cargo +nightly fuzz run parser

For more information on fuzzing you can check out this guide.

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 52.6%
  • Rust 45.5%
  • CSS 1.7%
  • Other 0.2%