Python interface to the OpenSCAD declarative geometry language
Project description
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.
Some class docstrings are derived from the OpenSCAD User Manual, so are available under the Creative Commons Attribution-ShareAlike License.
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
Built Distribution
File details
Details for the file solidpython2-2.1.0.tar.gz
.
File metadata
- Download URL: solidpython2-2.1.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.12 Linux/5.15.0-86-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6658d8fb3416b3356dc701606143dcfd9ed14c63f3c2a8c48400c330c57424bf |
|
MD5 | 845c9cfaedee83b3fd7256ba13bb35d8 |
|
BLAKE2b-256 | 0841de9d9656ef00e38f0df4a5e7f733cb0987e3bf6c82facafac913aaf7b0e9 |
File details
Details for the file solidpython2-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: solidpython2-2.1.0-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.12 Linux/5.15.0-86-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e3fd835554cf578aa1518168dad91c5d454b1d714599daad3514c91ad929a95 |
|
MD5 | 5d3515531d9135dddcdce95c7c7964b5 |
|
BLAKE2b-256 | ed7d746f1fb400886090e95a7d60625bc5fcd427f1c214e1e446ef6adf0dc0d9 |