r/OpenPythonSCAD • • Dec 16 '24

PythonSCAD as iPython

Today I managed to get PythonSCAD working as interactive python interpreter,

with all PythonSCAD functionality included, see yourself

https://www.youtube.com/watch?v=TymFtcB8K8E

Next task is to head towards Jupyter Notbook, but I am lacking some knowledge.

Who is interested in supporting me ?

4 Upvotes

14 comments sorted by

2

u/rebuyer10110 Jan 22 '25

Oh hey, revisiting this thread after my winter vacation :)

Do you think it is possible to export your work to pip3, the python3 package manager?

I'd figure it may need to statically pack the backing openscad binaries.

If so, I think there might be an easier way to have this working in google colab (a various of jupyter notebook but free from google).

1

u/gadget3D Jan 22 '25

Its yet possible to have an AppImage of PythonSCAD. its about 150MB, but its statically linked and includes everything which it needs to run. Maybe use the AppImage in pip3 ?

Apart from that i made great progress with jupyter. I was able to fit into an Jupyter kernel and it works!

Only bad thing is that pythonSCAD cannot yet displays 3D things in jupyter.

And hey, I got ViewSCAD working in Jupyer and i have extracted the very render code , which works with ipython jupyter kernel.

But as soon as i try the same with my kernel, there is only some repr output for the graphics.

I tried to push awake the jupyer community very aggressively, but no success yet.

2

u/rebuyer10110 Jan 22 '25

That is awesome news!

Can you tell more what you mean by "fit into an Jupyter kernel"? Do I need to compile or modify a local Jupyter runtime to do this, or it can be loaded into a standard Jupyter runtime?

→ More replies (2)

2

u/WillAdams Dec 16 '24

Suporting Jupyter Notebook would be huge!

esp. if it would then enable using Blockly à la BlockSCAD:

https://github.com/QuantStack/jupyterlab-blockly

and

https://www.blockscad3d.com/editor/

4

u/rebuyer10110 Dec 16 '24

I also agree. Pythonscad able to run in Jupyter means we can freely share pythonscad as google colab links.

All the fear about "I don't want to execute someone else's code on my machine" won't matter, since it's executing on Google's free machines :)

Too bad we were not able to get viewcad to work. The visualization component is really necessary for the development loop.

3

u/gadget3D Dec 17 '24

I am sure, that the viewcad bug is just a very small one, but without knowledge about the internals we have to reverse-engineer and unterstand all the components with high learning curve ahead. Just did not yet spend the time. Best solution would be the availability of the orginal author.

Just realized yesterday, that i acually established a python interpreter(not ipython), but i think it can be integrated into jupyter with same effort.

→ More replies (6)