Skip to main content

An advanced Python application and library for generating 2D and 3D models in OpenSCAD

Project description

SuperSCAD

Legal Docs Release Code
PyPI - License Documentation Status Latest Stable Version
Code Coverage unit Tests

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.

OpenSCAD Logo

Links

License

This project is licensed under the terms of the MIT license.

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

super_scad-0.10.2.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

super_scad-0.10.2-py3-none-any.whl (97.5 kB view details)

Uploaded Python 3

File details

Details for the file super_scad-0.10.2.tar.gz.

File metadata

  • Download URL: super_scad-0.10.2.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.11.8-200.fc40.x86_64

File hashes

Hashes for super_scad-0.10.2.tar.gz
Algorithm Hash digest
SHA256 f931f6e3eb13745332ed914aced87efc5b3351fdcf64d19930be18a4ecb26fbb
MD5 8d9a69cfdedd479e197cf6d3df08ade8
BLAKE2b-256 beff9b6b6ef6007e2cba32be25fc1a5a42f1bdbe02e3e416e6e078008e00bab3

See more details on using hashes here.

File details

Details for the file super_scad-0.10.2-py3-none-any.whl.

File metadata

  • Download URL: super_scad-0.10.2-py3-none-any.whl
  • Upload date:
  • Size: 97.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.11.8-200.fc40.x86_64

File hashes

Hashes for super_scad-0.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a9681fb5a386cb2d4a7f50a3632b43d6498cc6b4f58c4dd953aa40e85deeae72
MD5 ba167694f4e4c55e005b7ee4d0d3bc6f
BLAKE2b-256 ebd75d31668404a740c628c818e3041833e80b78de03869835c418a9abd0869e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page