Python OpenSCAD might be on the way

If I understand this MR correctly there might be the option to use Python to write OpenSCAD geometry in the next release. This could be huge!

Obviously refactoring would be a huge task, I don’t see it happening in the short term. I have no idea how much compatibility there will be between the Python and they OpenSCAD code (i.e.) can you make modules in one and call them in the other?

However, if we have Python OpenSCAD as an option this opens up doors for a very bright future:

  • Packaging OpenFlexure libraries
    • Core OpenFlexure elements (gears, motors, actuator columns, flexure mechanisms, mountings) could all sit in a pip-installable package
    • Optics considerations could sit in a pip-installable package
    • Microscope/Block Stage/Delta Stage could then use these underlying modules
    • Opens the doors for other downstream projects to rely on the libraries
    • Hopefully we can package up the rendering/assembly system so it is not Microscope specific.
  • Python ecosystem
    • We can use more advanced syntax and data structures to help us in so many ways:
      • with calculations (we don’t need to do much that is complex… but writing calculations in OpenSCAD is a dark art)
      • Using well defined data structures for passing data through the codebase
      • No weird separation between module and function code allowing us to not have to write code twice so it can work for calculations or for physical geometry.
    • Code robustness can be improved with real linters (SCA2D helps, but is pretty rubbish), with unit tests, coverage reports.
    • Standardised doc strings means we can actually generate documentation for how to use the codebase
  • Possible improved integration with other CAD/visualisation
    • More control over the underlying code should make it easier to actually define parts and sub-assemblies. This should make it possible to use possible to export individual components from OpenSCAD and then with python assembly information build up a more complex CAD model of these components. This should hopefully allow animations of the assembly.
    • Both FreeCAD and CadQuery are Python based. It may be possible to write Python code that defines interfaces like the top of the microscope stage. If this was done in a way that the top stage could be generated in FreeCAD and exported as a STEP, then it could be used for designing add-ons in other CAD packages.


Controlling OpenSCAD fully from Python could be a game changer. But it would take a huge amount of work. Once this is out in the open it would be great to think about how this sort of work could be funded. It would also be great to engage with the OpenSCAD community, however their forum is broken and I can’t handle mailing lists.


Hi Julian, thank you for your post!
I am the author of this PR and i am still developping for it and pushing hard to get this PR into openscad.
Until this becomes true, you test all python-enabled openscad in my site at

And yes - if somebody likes to contribute with ideas or codes of line, this would be awesome!


This does indeed sound like it could be pretty huge for us in the long term! As Python grows in popularity, and if this makes it in to core OpenSCAD, it may even make the codebase a bit more accessible (our worry with the various python scad wrappers is that it’s another layer of complexity that makes our CAD harder to play with).

My own development efforts over the next few months will focus on the software, which has been a bit neglected lately, but I’d be really interested to see where this goes. If anyone else on here has time to play with it, I’m very curious to see how you get on.

Do shout if it gets merged, or if we can somehow add a voice in support of it :slight_smile: I’m also not as well connected with OpenSCAD as I should be…

Hi r.w.bowman, thank you for your post,
The Website explaining the benefits my my python enabled openscad fork has now greatly been rewritten to show even more clearly, what this fork is about.(url is mentioned above)
Do also shout to get it merge it first!
If you cannot wait for it: the new page contains quite simple instructions to compile it even before.
if you have any questions: don’t hesitate to contact me at or guso78 in
Kiwi IRC
IRC channel
See you there!