Skip to main content

Python library to generate OpenSCAD source code

Project description

OpenPySCAD
==========

Python library to generate OpenSCAD source code. This library provides intuitive interface when you handle 3D data.


Install
-------
You can install OpenPySCAD from PyPI.

.. code-block:: bash

$ pip install openpyscad


3D Shape
--------

Cube
^^^^

Source:

.. code-block:: python

Cube([10, 10, 10])


Generated code: openscad

.. code-block::

cube([10, 10, 10]);

Boolean Operation
-----------------

Union
^^^^^

Source:

.. code-block:: python

Cube([20, 10, 10]) + Cube([10, 20, 10])

# You can also write like this
u = Union()
u.append(Cube[20, 10, 10])
u.append(Cube[10, 20, 10])

Generated code:

.. code-block:: openscad

union(){
cube([20, 10, 10])
cube([10, 20, 10])
};

Difference
^^^^^^^^^^

Source:

.. code-block:: python

Cube([20, 10, 10]) - Cube([10, 20, 10])

# You can also write like this
i = Difference()
i.append(Cube[20, 10, 10])
i.append(Cube[10, 20, 10])

Generated code:

.. code-block:: openscad

difference(){
cube([20, 10, 10]);
cube([10, 20, 10]);
};


Intersection
^^^^^^^^^^^^

Source:

.. code-block:: python

Cube([20, 10, 10]) & Cube([10, 20, 10])

# You can also write like this
i = Intersection()
i.append(Cube[20, 10, 10])
i.append(Cube[10, 20, 10])

Generated code:

.. code-block:: openscad

intersection(){
cube([20, 10, 10]);
cube([10, 20, 10]);
};


Transform
---------

Translate
^^^^^^

Source:

.. code-block:: python

Cube([20, 10, 10]).translate([10, 10, 10])

# You can also write like this
r = Translate([10, 10, 10])
r.append(Cube[20, 10, 10])

Generated code:

.. code-block:: openscad

translate([10, 10, 10]){
cube([20, 10, 10]);
};



Rotate
^^^^^^

Source:

.. code-block:: python

Cube([20, 10, 10]).rotate([0, 0, 45])

# You can also write like this
r = Rotate([0, 0, 45])
r.append(Cube[20, 10, 10])

Generated code:

.. code-block:: openscad

rotate([0, 0, 45]){
cube([20, 10, 10]);
};

Project details


Download files

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

Source Distribution

OpenPySCAD-0.0.2.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distributions

OpenPySCAD-0.0.2.macosx-10.11-x86_64.tar.gz (6.7 kB view hashes)

Uploaded Source

OpenPySCAD-0.0.2-py2.7.egg (8.0 kB view hashes)

Uploaded Source

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