Hi,
I would like to give a try at adding python bindings to Surface workbench.
Some people sometimes want to access the surface tools from python.
And it would add flexibility, making it a hybrid C++ / python workbench.
After a little web search, I saw that there are several solutions available.
The one that seems to be already used in FreeCAD are :
- pybind11
- boost.python
- PyCXX (not sure about this one, but I think I saw this name several times ???)
- custom FreeCAD bindings, like in the Part module, and looking much like this.
I am used to the Part module solution, but it is quite a lot of code writing.
So, I would like to have advise from skilled developers.
Thanks in advance.
Python bindings for Surface WB
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Python bindings for Surface WB
Hello Chris,
it is possible the use pythonocc-core now with conda. [1]
[1] https://forum.freecadweb.org/viewtopic. ... 62#p425495
kind regards
it is possible the use pythonocc-core now with conda. [1]
[1] https://forum.freecadweb.org/viewtopic. ... 62#p425495
kind regards
Re: Python bindings for Surface WB
Maybe this can be of help: https://forum.freecadweb.org/viewtopic.php?f=10&t=43316
Re: Python bindings for Surface WB
Thanks,
This look like a good OCC testing / exploring solution, but not really suited for python bindings inside FreeCAD master.
And I have not been able to build it from AUR on Manjaro Linux
Thanks, maybe this will be of help, if the same python binding generator is chosen.openBrain wrote: ↑Sat Sep 19, 2020 3:54 pm Maybe this can be of help: https://forum.freecadweb.org/viewtopic.php?f=10&t=43316
Re: Python bindings for Surface WB
I found this historical thread, How these things work together.
Unfortunately, it's unclear if the situation has changed a lot in 10 years or not. It seems to me that manual wrapping is still the norm, and I don't quite see where PyCXX and pybind11 are used. I think pybind11 is used at least in the Mesh Workbench with a couple of commands, surface flattening, (boost-python deprecated?).
This is the most recent thread I can think about, [How to ?] Expose C++ functions to FreeCAD Python API.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: Python bindings for Surface WB
pybind11 is relatively easy and apparently very good. python-occ-core and ifcopenshell use swig which looks awful. Also there is one like more like pybind made by Qt guys. See Cristián Maureira-Fredes - Unleash the power of C++ in Python and Talk: Dr. Cristián Maureira-Fredes - C++ ♥ Python: from modules to hybrid applications there also some talks specific about pybind.
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
Re: Python bindings for Surface WB
The most reliable way to build it is to use Docker: https://wiki.freecadweb.org/Compile_on_Docker
It takes some time to get used to but after you learn it you would forget you ever had any issues with development dependencies.
Re: Python bindings for Surface WB
It seems to be a good candidate, along with FreeCAD custom one.
I was talking about pythonocc. FreeCAD builds flawlessly.vanuan wrote: ↑Sun Sep 20, 2020 2:37 am The most reliable way to build it is to use Docker: https://wiki.freecadweb.org/Compile_on_Docker
Re: Python bindings for Surface WB
See this issue : https://github.com/tpaviot/pythonocc-co ... -683884628 I personally just rolled back to OCC previous version.
Also, you don't need to build python-occ-core from AUR, it is in community packages : https://www.archlinux.org/packages/comm ... -occ-core/
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.