r/OpenPythonSCAD • • Mar 30 '25

OpenPythonSCAD: Integration status, performance, and use of external libraries

Hey everyone,

I’ve got a few general questions regarding PythonSCAD and its integration with OpenSCAD:

  1. Integration status Has PythonSCAD already been fully merged into OpenSCAD and enabled by default? If not, is there any rough ETA for when this is expected?

(Alternatively, is there an option or ongoing effort to merge recent changes from OpenSCAD’s master branch into PythonSCAD, to keep it up to date?)

2. Performance
Are there any known performance drawbacks to using PythonSCAD compared to standard OpenSCAD?
If so, are there best practices or guidelines to help minimize the performance hit?

3. Using Python libraries
Is it possible to import and use external Python libraries within PythonSCAD scripts?
If so, could someone point to a guide or example?
(I saw this asked before but couldn’t quite figure out the current state)

Appreciate any insights. Thanks!

4 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/PurchaseSpecific7699 Mar 30 '25

Great!

Regarding CI — I'm not familiar with CircleCI myself, but maybe one of the OpenSCAD devs could help out.
It might even be possible to reuse their existing scripts more or less as-is.
Having automated builds would definitely give PythonSCAD a nice boost.

As for parsing overhead — totally not a concern. I’m talking about models that take minutes to render anyway. 🙂
Out of curiosity though — has anyone actually benchmarked the performance of core operations (like translate, hull, union, etc.) in Python vs native-OpenSCAD to confirm that the overhead is truly negligible?

And about the libraries — I’ll test out using external ones, and if I run into anything unusual, I’ll report back.

Thanks again!

4

u/rebuyer10110 Mar 30 '25

If you happen to run into trouble loading any pip3 packages, this should be a good reference point: https://www.reddit.com/r/OpenPythonSCAD/comments/1ijhpy5/what_do_i_need_to_do_to_import_python_modules/mbjdykm/

If you want to load-your-own python libraries, you can either paste them into one of the folders in sys.path and import as usual, or use the nimport() function mentioned at https://www.reddit.com/r/OpenPythonSCAD/wiki/index#wiki_loading_libraries.

as anyone actually benchmarked the performance of core operations (like translate, hull, union, etc.) in Python vs native-OpenSCAD to confirm that the overhead is truly negligible?

I haven't benchmarked. I haven't came across the need yet, which itself is a positive sign.

union(list-of-shapes) anecdotally feels faster than functools.reduce(lambda x, y: x | y, list-of-solids). Which does not surprise me.

Happy CADing.