Git Product home page Git Product logo

cadmium's Introduction

Cadmium is a python library for Solid Modelling

Cadmium allows you to write python code to create primitive objects (Box, Cylinder, Sphere, etc.) and apply CSG operations (Addition, Subtraction, Intersection) on them to create advanced solid models. The primitives have support for affine transformations too (translation, rotation).

Screenshots and examples

http://jayesh3.github.com/cadmium/.

Typical Solid modelling code with Cadmium

from cadmium import *

box = Box(x=4, y=4, z=4).rotate(Z_axis, 30)
cyl = Cylinder(radius=2, height=4).translate(-1,0,0)

solid = box + cyl

solid.toSTL('solid.stl')

Getting Cadmium

git clone https://github.com/jayesh3/cadmium.git cadmium
cd cadmium
python setup.py install

Getting Dependencies - PythonOCC

Cadmium depends on PythonOCC which in turn requires OpenCASCADE.

The easiest way to setup PythonOCC and OpenCASCADE is to do it in Ubuntu server VM (unless you run Ubuntu natively). Although, PythonOCC includes some GUI utilities Cadmium doesn't need them, so you can use Ubuntu server VM.

To install OpenCASCADE just do apt-get install libopencascade-dev. You can get PythonOCC from here. If you choose to build it from source these instructions are helpful.

Running example code

python examples/<python-script> <filename.stl>

Details

Cadmium is inspired by the OpenSCAD project, but it is a completely independent implementation. Here is what is different about Cadmium.

  • Write your code in Python. No need to learn new syntax. Use your favorite python features as you do advanced calculations for solid modelling.
  • Cadmium has no GUI. It only generates STL files (other formats may be supported in future). You can view these STL files in your favorite STL viewer, on your favorite OS. Becase Cadmium has no GUI, it's very light weight and has minimal dependencies. Hence it should be portable to any platform on which you can install PythonOCC
  • All of the Cadmium code itself is written in Python, hence easy to maintain
  • Cadmium is only creates easy-to-use abstraction on top of PythonOCC. All the real work is done by PythonOCC and the underlying OpenCASCADE library.

Cadmium is a work in progress. Bug reports and patches are welcome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.