An advanced Python application and library for generating 2D and 3D models in OpenSCAD
Project description
SuperSCAD
Legal | Docs | Release | Code |
---|---|---|---|
|
The OO Programmers Solid 3D CAD Modeller
SuperSCAD is an advanced application/library for generating 2D and 3D models in OpenSCAD in Python. SuperSCAD is based, among others, on the factory pattern and delivers to you as 2D and 3D modeler the superpowers of Python.
Documentation
The full documentation is available at https://superscad.readthedocs.io.
Getting Started and Installing SuperSCAD
We advise to create a Python virtual environment in a project folder:
cd awsesome-project
python -m venv .venv
. .venv/bin/activate
pip install super-scad
Using your favorite editor, copy-paste the code from the demo in the next section and save the file under
openscad-logo.py
.
vi openscad-logo.py
Run python and open the generated openscad-logo.scad
in openscad.
python openscad-logo.py
openscad openscad-logo.scad
Congratulations, you just finished your first SuperSCAD project.
Demo
Below is an example of SuperSCAD utilizing the factory pattern.
from super_scad.boolean.Difference import Difference
from super_scad.d3.Cylinder import Cylinder
from super_scad.d3.Sphere import Sphere
from super_scad.other.Modify import Modify
from super_scad.scad.Context import Context
from super_scad.scad.Scad import Scad
from super_scad.scad.ScadWidget import ScadWidget
from super_scad.scad.Unit import Unit
from super_scad.transformation.Rotate3D import Rotate3D
class Logo(ScadWidget):
"""
SuperSCAD widget for generating OpenSCAD logo.
"""
def build(self, context: Context):
"""
Builds a SuperSCAD widget.
:param context: The build context.
"""
size: float = 50.0
hole: float = size / 2.0
height: float = 1.25 * size
cylinder = Cylinder(height=height, diameter=hole, center=True, fn4n=True)
sphere = Sphere(diameter=size, fn4n=True)
return Difference(children=[sphere,
cylinder,
Modify(highlight=True, child=Rotate3D(angle_x=90.0, child=cylinder)),
Rotate3D(angle_y=90.0, child=cylinder)])
if __name__ == '__main__':
scad = Scad(context=Context(fn=360))
logo = Logo()
scad.run_super_scad(logo, 'logo.scad')
The example generates the logo of OpenSCAD.
Links
License
This project is licensed under the terms of the MIT 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 super_scad-0.8.1.tar.gz
.
File metadata
- Download URL: super_scad-0.8.1.tar.gz
- Upload date:
- Size: 42.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.11.4-201.fc40.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c40df8838c894b44837f8c7927d8aca68aa0c89b8fa4229bc18bc8b5466a3040 |
|
MD5 | 88ae6f21608ab413cb1b4ca066bf7491 |
|
BLAKE2b-256 | 1606b70956095384a41131f017b83469a2e66bf34631fbcd6ad2ba2e5adf30ec |
File details
Details for the file super_scad-0.8.1-py3-none-any.whl
.
File metadata
- Download URL: super_scad-0.8.1-py3-none-any.whl
- Upload date:
- Size: 85.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.11.4-201.fc40.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f54e37866f58cb053c48ee5edcbe99f1e133624fee9b4a9e8d1dd41bbe702e41 |
|
MD5 | b695209490466793f23436188e27d413 |
|
BLAKE2b-256 | 2fb2d510e7b40a5e0857fd35a2add11a8669d5a4c6d17507ccdc1cd1047d59bc |