Skip to main content

3D modeling automation in your favorite modeling software.

Project description

CodeToCAD

One language for all your CAD needs

Discord GitHub Repo stars GitHub top language Static Badge

Table of Contents

What is CodeToCAD

CodeToCAD is an open source code-CAD automation. It provides extendable, declarative and imperative interfaces that allow engineers and developers to write code-CAD scripts that can be checked into source control, collaborated on, and run on any supported 3D modeling software.

Why CodeToCAD?

✅ Simplified modeling interface - it's all text! No more scrolling and clicking into sub-menus to edit your models.

🔓 Not vendor locked - your models are created in an open-source language. If you want to use another software, you do not lose the features you have defined. Note: There is no guarantee that a model created for, e.g. Blender, will work right away for another software, but with some refactoring, it theoretically should!

🪶 Lightweight and portable. All you need is a text-editor to model. You can occasionally fire-up your modeling software to run your creations.

💪 Leverages existing programming languages, like Python. You can keep using the languages you're familiar with and love. There is no one-off language you and your team has to learn. Use CodeToCAD like a library or a framework.

🚦Easy version control. Your models are written in code, you can use industry-loved git to keep track of versions of your models.

💕 Built by people who believe in automation and that modeling workflows should be intuitive, reliable and most importantly free and open source!

Getting started

Pre-requisites: Python 3.11 or newer.

  1. Install the CodeToCAD PIP Package to get intellisense syntax highlighting.

    pip install CodeToCAD
    
  2. Create your own CodeToCAD python file and save it (docs):

    # my_codetocad_script.py
    # More examples can be found under CodeToCAD/examples/
    from codetocad import *
    
    my_material = Material("material").set_color(169, 76, 181, 0.8)
    Part("Cube").create_cube(1, 1, 1).set_material(my_material)
    
  3. Watch as your code gets seemlessly translated into CAD using our custom addon for your desired application

Material Cube

  1. You may also run codetocad my_codetocad_script.py from the CLI to run your script.

Above is the above script being run in blender using our Blender Addon below.

Warning: Since CodeToCAD scripts are written and executed in Python, be careful when running scripts you find on the internet!

Supported Applications

Alpha/Beta Support

To Be Developed

  • PyBullet - Real-time Physics Simulation Library
  • KiCAD - Electronic/PCB Design Software
  • LLM/AI based model generation
  • FreeCAD - CAD Software
  • ThreeJS - Web-based 3D Library
  • Libfive - Signed Distance Field Modeling library

Working with the software of your choice

Remember to first follow the getting started instructions

Compatible software

  1. Blender 4.1
  2. Fusion360
  3. Onshape

Blender

  1. Download a release of the Blender Addon from the latest release

    Note for developers: instead of downloading a release, you can clone this repository, then import blender_addon.py and set to CodeToCAD path in the addon to the root of this repository. Please watch this guide to get set up: Video Guide

  2. Install the Blender Addon in the blender software

  3. Import your script using the file menu > import > CodeToCAD or the CodeToCAD menu in the sidebar.

Note, you can also run CodeToCAD in Blender via cli: blender -- --codetocad $(pwd)/yourScript.py or codetocad yourScript.py blender /path/to/blender/executable

Sidebar Panel

You can use the side-panel to import CodeToCAD files or start a debugger server.

Fusion 360

To use CodeToCAD with Fusion 360, please install the Add-In. Please check out the README for more information.

Onshape

Please refer to the Onshape README for more information on how to setup an API key and connect to the Onshape Client.

What's next

For the developers

We welcome all contributors to the project, to get started with contributing check out our Contributing guidelines

Additional Resources

Contributors

Thank you to all our contributors for their invaluable time, effort, and expertise in making CodeToCAD possible:

Support us ❤️

Any and all donations toward the project are much appreciated and help greatly:

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codetocad-0.4.1724940633.tar.gz (53.0 kB view details)

Uploaded Source

File details

Details for the file codetocad-0.4.1724940633.tar.gz.

File metadata

  • Download URL: codetocad-0.4.1724940633.tar.gz
  • Upload date:
  • Size: 53.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for codetocad-0.4.1724940633.tar.gz
Algorithm Hash digest
SHA256 96c75890f079b8a12ca9f6611aa0d3cb12cd61bf71214216c61929699b4fc902
MD5 392d73c302567a311607de202e477ac6
BLAKE2b-256 311b17f82c4857551a187c7b791237c1e73a8daef9333adaae4033d39b4d6a70

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page