Skip to main content

SolidPython

OpenSCAD for Python

SolidPython is a generalization of Phillip Tiefenbacher’s openscad module, found on Thingiverse. It generates valid OpenSCAD code from Python code with minimal overhead. Here’s a simple example:

This Python code:

from solid2 import *
d = cube(5) + sphere(5).right(5) - cylinder(r=2, h=6)

Generates this OpenSCAD code:

difference(){
    union(){
        cube(5);
        translate( [5, 0,0]){
            sphere(5);
        }
    }
    cylinder(r=2, h=6);
}

As can be clearly seen, the SolidPython code is a lot shorter (and I think a lot better readable and maintainable) than the OpenSCAD code it compiles to.

Advantages

In contrast to OpenSCAD – which is a constrained domain specific language – Python is a full blown modern programming language and as such supports pretty much all modern programming features. Furthermore a huge number of libraries is available.

SolidPython lets you use all these fancy python features to generate your constructive solid geometry models.

On the one hand it makes the generation of your models a lot easier, because you don’t need to learn another domain specific language and you can use all the programming technique you’re already familiar with. On the other hand it gives you a lot more power, because you can use all the comprehensive python libraries to generate your models.

Getting Started

The wiki is the place to look for docs and tutorials. Furthermore the examples might be interesting to you too.

Contact

Enjoy!

If you have any questions or bug reports please report them to the SolidPython GitHub page!

Cheers!

License

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Full text of the license.

Some class docstrings are derived from the OpenSCAD User Manual, so are available under the Creative Commons Attribution-ShareAlike License.

Release files for solidpython2 2.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solidpython2 2.1.3
File Size Uploaded
solidpython2-2.1.3.tar.gz 7.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for solidpython2 2.1.3
File Interpreter ABI Platform
solidpython2-2.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 MB

Release files / solidpython2-2.1.3.tar.gz

Download URL solidpython2-2.1.3.tar.gz
Size 7.3 MB
Tags Source
SHA-256 checksum
How to use checksums
c0cfa93a6fddb34fe74f513396ab371e67747e60d2eba7ae9dfdf6084cff22b9
BLAKE2b-256 checksum
How to use checksums
9515f10e8358b25860606434d2bd9206eb53b257f2578a77efb1bde95ac8c8de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-71-generic

Release files / solidpython2-2.1.3-py3-none-any.whl

Download URL solidpython2-2.1.3-py3-none-any.whl
Size 7.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
92f09069534f719af1494ab62304a180e42bdb631b28186ee1a329d370adb1ff
BLAKE2b-256 checksum
How to use checksums
9936a4349c58aca20c61b34e551ce2282546d691657328882b195915ce3a5508
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-71-generic
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page