Has Anyone successfully connected to FC thru Jupyter ?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
randfb1
Posts: 7
Joined: Mon Dec 30, 2013 5:44 pm

Has Anyone successfully connected to FC thru Jupyter ?

Postby randfb1 » Mon Jul 29, 2019 9:05 pm

Has Anyone successfully connected to FC thru Jupyter ?
If yes, could you share the procedure.

I tried using the module at:
https://github.com/looooo/jupyter_freecad_kernel
without success.

thanks
Rand
vocx
Posts: 1687
Joined: Thu Oct 18, 2018 9:18 pm

Re: Has Anyone successfully connected to FC thru Jupyter ?

Postby vocx » Mon Jul 29, 2019 10:26 pm

randfb1 wrote:
Mon Jul 29, 2019 9:05 pm
I tried using the module at:
https://github.com/looooo/jupyter_freecad_kernel
looo wrote: Ping
looo
Posts: 2915
Joined: Mon Nov 11, 2013 5:29 pm

Re: Has Anyone successfully connected to FC thru Jupyter ?

Postby looo » Mon Jul 29, 2019 10:56 pm

randfb1 wrote:
Mon Jul 29, 2019 9:05 pm
Has Anyone successfully connected to FC thru Jupyter ?
If yes, could you share the procedure.

I tried using the module at:
https://github.com/looooo/jupyter_freecad_kernel
without success.

thanks
Rand
This was only a test but as freecad uses python we do not need to write an own kernel.

Easiest way to get compatible freecad and jupyter is by use of conda-package manager. Eg.:

Code: Select all

conda create -n freecad freecad jupyterlab
To start the freecad-gui from jupyter you can have a look here:
https://forum.freecadweb.org/viewtopic. ... 30#p257684

It's possible the commands to launch freecad are a bit different on different pöattforms. But launching freecad from jupyter-notebook worked for me on all 3 major platforms.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
User avatar
Kunda1
Posts: 5799
Joined: Thu Jan 05, 2017 9:03 pm

Re: Has Anyone successfully connected to FC thru Jupyter ?

Postby Kunda1 » Mon Jul 29, 2019 11:34 pm

What would be the benefit of having jupyter connected to FC? Could we show FC models from within a jupyter notebook etc.. ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
looo
Posts: 2915
Joined: Mon Nov 11, 2013 5:29 pm

Re: Has Anyone successfully connected to FC thru Jupyter ?

Postby looo » Tue Jul 30, 2019 5:45 am

Kunda1 wrote:
Mon Jul 29, 2019 11:34 pm
What would be the benefit of having jupyter connected to FC? Could we show FC models from within a jupyer notebook etc.. ?
Not yet. Hopefully we get there at some point. There is not much 3d visualization for notebooks so far, so maybe this will need some time until something useable will be available.
The main advantages of jupyter-notebook over freecad-console is the cell-based code input (imo)
please help with my conda-packaging efforts: https://liberapay.com/looooo/
looo
Posts: 2915
Joined: Mon Nov 11, 2013 5:29 pm

Re: Has Anyone successfully connected to FC thru Jupyter ?

Postby looo » Tue Jul 30, 2019 8:36 am

BTW.: Also auto-complete works better.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
randfb1
Posts: 7
Joined: Mon Dec 30, 2013 5:44 pm

Re: Has Anyone successfully connected to FC thru Jupyter ?

Postby randfb1 » Tue Jul 30, 2019 2:59 pm

Thanks for your help.
I was able to access FC through Jupyter.
I entered the commands below.

After that FC started and the FreeCAD and App objects were available.
I think this could be a very powerful interface to FC.

Rand

""
import sys, os
os.environ["QT_API"] = "pyside"
%gui qt5
import FreeCADGui
FreeCADGui.showMainWindow()
FreeCADGui.exec_loop()
"""

I
Has Anyone successfully connected to FC thru Jupyter ?
If yes, could you share the procedure.

I tried using the module at:
https://github.com/looooo/jupyter_freecad_kernel
without success.

thanks
Rand
[/quote]

This was only a test but as freecad uses python we do not need to write an own kernel.

Easiest way to get compatible freecad and jupyter is by use of conda-package manager. Eg.:

Code: Select all

conda create -n freecad freecad jupyterlab
To start the freecad-gui from jupyter you can have a look here:
https://forum.freecadweb.org/viewtopic. ... 30#p257684

It's possible the commands to launch freecad are a bit different on different pöattforms. But launching freecad from jupyter-notebook worked for me on all 3 major platforms.
[/quote]