OpenScad to PythonScad conversion tool

5 views
Skip to first unread message

Matthieu Hendriks

unread,
Nov 26, 2025, 4:01:28 PM (2 days ago) Nov 26
to PythonSCAD
With a lot of help from chatgpt, claude.ai and notebooklm I created a conversion tool which reads a openscad file and convert it to a pythonscad file.
It's fully written in python and there are a few dependencies wich are easy to install with pip
for example 
pip install lark
pip install pprintp
and maybe some others

usage:
python s2p.py design.scad design.py

It passes the first test. The lark definitions where the most difficult ones.
There will probably still some bugs :)
Upload the file to claude.ai, add the errors or tell whats wrong, include a reference to https://pythonscad.org and most of the time he is able to fix it.

Maybe this tool will make the switch for the openscad designer to pythonscad easier

s2p.py

Guenther Sohler

unread,
Nov 26, 2025, 4:22:49 PM (2 days ago) Nov 26
to Matthieu Hendriks, PythonSCAD
Hey Matthieu,
This is great stuff, I love it!

Please bear in mind: the s2p.py script does not include the final show() command.
You need to  show() the result to see something in the 3D view.

Another viable option to convert scad to python is:

open the SCAD file in pythonscad
Select  Design->Display Python Conversion

but it's not perfect either.

--
You received this message because you are subscribed to the Google Groups "PythonSCAD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonscad+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/pythonscad/a0f4ecbd-8f8c-498f-b02d-11999107d284n%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

matthieu.hendriks

unread,
Nov 27, 2025, 2:12:43 AM (yesterday) Nov 27
to Guenther Sohler, PythonSCAD
I'll give it a thought, normally I use a naming convention like print_module for all components to show and a separate script to finalize this, like

objs["o1"]=print_o1()
...
show(union(objs))



Verzonden vanaf mijn Galaxy


-------- Oorspronkelijk bericht --------
Van: Guenther Sohler <guenthe...@gmail.com>
Datum: 26-11-2025 22:22 (GMT+01:00)
Aan: Matthieu Hendriks <matthieu...@gmail.com>
Cc: PythonSCAD <pytho...@googlegroups.com>
Onderwerp: Re: OpenScad to PythonScad conversion tool

Reply all
Reply to author
Forward
0 new messages