Code Monkey home page Code Monkey logo

declaracad's Introduction

declaracad

A declarative parametric 3D modeling program built using OpenCascade and enaml.

Declaracad preview

It's similar to OpenSCAD in that everything is intended to be defined programatically. However the language being used is enaml (a superset of python) instead of javascript.
Python users/developers will find this very easy and intuitive.

See the project site (coming soon).

Features

Currently the following 3D features can be used:

  1. Basic shapes (Box, Sphere, Cylinder, Wedge, Torus) see shapes
  2. Boolean operations (Cut, Fuse, Common) see algo
  3. Fillet and Chamfer edges see algo
  4. 2D Drawing of wires and faces see draw
  5. Pipes algo
  6. Extrude (Prism), LinearForm, RevolutionForm algo
  7. ThickSolid, ThroughSections algo

See the examples and the occ package.

Import / export

Currently there is no import support from other 3d types into editable code, but models can be loaded for display

DeclaraCAD - loading models

Importing 2D paths from SVG (ex Adobe Illustrator, Inkscape, etc..) is possible

DeclaraCAD import from svg

Models can be exported to an stl file for imported into other programs (ex Simplify3D, FreeCAD, etc..)

DeclaraCAD export to stl

Example

This is generates a turners cube of a given number of levels.

from enaml.core.api import Looper
from declaracad.occ.api import Box, Sphere, Cut, Part

enamldef TurnersCube(Part):
    name = "Turners Cube"

    attr levels: int = 3
    Looper:
        iterable << range(1,1+levels)
        Cut:
            Box:
                position = (-loop_item/2.0,-loop_item/2.0,-loop_item/2.0)
                dx = loop_item
                dy = loop_item
                dz = loop_item
            Sphere:
                radius = loop_item/1.5

Docs

The goal is for the building blocks or components to be self documenting.

It's partially there... suggestions are welcome!

DeclaraCAD - Docs and Toolbox

Installing

There is currently no installer as it's in pre-alpha state. It runs on windows and linux (have not yet tested osx but it should also work). To use it:

#: Install conda or miniconda
#: See https://conda.io/miniconda.html

#: Create a conda env
conda create -n occ

#: Activate it
source activate occ

#: Install pythonocc
conda install -c conda-forge -c dlr-sc -c pythonocc -c oce pythonocc-core==0.18 python=3

#: Install enaml from repo (until some pending PR's are merged)
pip install git+https://github.com/frmdstryr/enaml.git@latest

#: Install enamlx
pip install git+https://github.com/frmdstryr/enamlx.git

#: Now install clone this repo
git clone https://github.com/codelv/declaracad.git

#: Go inside the cloned repo
cd declaracad

#: Install the dependencies
pip install .

#: Run 
python main.py

License

The application is released under the GPL v3 (due to the use of PyQt5 and QScintilla). If you want to use this in your own application these can be replaced with alternatives if alternate licensing is needed. Please contact me for more details.

Special thanks to

This project relies on the groundwork laid out by these projects:

Please share your appreciation to them for all the hard work creating these projects!

declaracad's People

Contributors

victorlamoine avatar

Watchers

 avatar

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.