Hi,
I am trying to start macro scripting and looking for documentation of the available Python bindings.
https://wiki.freecadweb.org/Selection_API is sadly quite incomplete, so I wanted to directly look at the source code which should give me everything I need (basically available functions, their signatures, object descriptions and what functions are doing).
Starting with the top level module FreeCADGui should give me everything I need by browsing its hierarchy.
However, I am having trouble to find the definition of FreeCADGui Python module in https://github.com/FreeCAD/FreeCAD/tree/master/src Can anyone help me out where it is defined?
PS: I Tried to look at https://freecad.github.io/SourceDoc/ but I did not find FreeCADGui neither in index, nor modules or classes. Then I looked at https://wiki.freecadweb.org/Exposing_Cp ... _to_Python which references the FreeCAD/src/Mod/* path. However, it seems that the next level in directory hierarchy are workbenches, so I also had no luck to find the FreeCADGui definition there. Any hint where this module is defined is highly appreciated
thanks alot and best
Martin
C++ / Python source code location (=path in repo) of FreeCADGui and FreeCADGui.Selection
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: C++ / Python source code location (=path in repo) of FreeCADGui and FreeCADGui.Selection
Probably under:
https://github.com/FreeCAD/FreeCAD/tree/master/src/Gui
You will find things related to the Gui.
But note that Python is not C++, so what is exposed by Python could be retrieved probablu more simply issuing:
But as it is very long it result in a truncation, however you could collect the output and print somewhere.
Regards
Carlo D.
https://github.com/FreeCAD/FreeCAD/tree/master/src/Gui
You will find things related to the Gui.
But note that Python is not C++, so what is exposed by Python could be retrieved probablu more simply issuing:
Code: Select all
import FreeCADGui ## maybe it will work even without this line
help(FreeCADGui)
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: C++ / Python source code location (=path in repo) of FreeCADGui and FreeCADGui.Selection
Python in FreeCAD has an included documentation. Open the Python console and type:
Code: Select all
>>> Gui.
During scrolling down, a short "manual" describing the objects appeares. If you hit ENTER, the selected object is added to your line. Scroll down until 'Selection'. Hit ENTER and add a dot
Code: Select all
>>> Gui.Selection.
Code: Select all
>>> Gui.Selection.clearSelection()