PythonSCAD! OpenSCAD with Python code!

We’re a rare breed but I know there are some other OpenSCAD users around here somewhere. I’ve been compiling OpenSCAD from source for some time now because the last official release is from 2021. Recently I noticed a compiler option for Python support. That led me down a rabbit hole to see what Python in OpenSCAD was all about.

What I learned is that OpenSCAD was forked and Python support was added and this project is called PythonSCAD. Now some of the PythonSCAD code is being merged into OpenSCAD. Doing some more reading I discovered that PythonSCAD has support for some things that have not and maybe will not be merged into OpenSCAD e.g. spline curves that you don’t have to code yourself, path_extrude for extruding a polygon along a spline and more.

So I’ve officially switched to PythonSCAD as it supports all of the SCAD you know with the option of using Python and the whole ecosystem of Python libraries with the familiar OpenSCAD interface. You can even use existing SCAD code or write inline SCAD in your Python modules.

Python is a far superior programming language IMHO but it does open up a world of malicious code possibilities that aren’t possible with SCAD code by design so be careful and look at any Python code before opening it with PythonSCAD unless you trust the author.

I find it’s a lot easier to write readable Python modules that I can actually go back to and figure out. It’s too easy for me to end up with nested ad-hoc SCAD code that takes forever to decipher.

I’ve built PythonSCAD from source but there are binaries available for Linux, Macintosh, and Windows.

Resources:
Home Page
Downloads
Tutorial
Cheat Sheet
GitHub

Happy coding!

3 Likes