Where can I get detailed API documentation?

Need help, or want to share a macro? Post here!
elias
Posts: 10
Joined: Thu Mar 18, 2021 10:41 am

Where can I get detailed API documentation?

Postby elias » Tue Mar 23, 2021 2:20 pm

Hi!

I'm trying to understand the details fo the python API but I'm having a hard time because I can't find a complete source of information. I've read the pinned post, I've gone through the wiki (including the API section) and the https://freecad.github.io/SourceDoc/ documentation but I still can't find things like how many arguments does Mesh.write() accepts. Am I missing something?

I'm guessing there is just no documentation for a lot of things. If this is the case, it would be great if someone could give me a few pointers about how to look for the definition of the python interfaces in the source code. I'm not very familiar with C++ and I'm not able to find them on my own.

Thanks!
edi
Posts: 278
Joined: Fri Jan 17, 2020 1:32 pm

Re: Where can I get detailed API documentation?

Postby edi » Tue Mar 23, 2021 4:58 pm

The python console is very helpfull. Use

Code: Select all

>>> from FreeCAD import Mesh
>>> Mesh.
A pulldown menu opens, showing the attributes and methods of the Mesh class. Rolling through using UP and DOWN keys opens a short help info.
You will find a method Mesh. Next type:

Code: Select all

>>> myMesh=Mesh.Mesh()
>>> myMesh.
Again a pulldown menu opens, indicating you among other things the write() method, and when scrolling explains the required arguments.
User avatar
gbroques
Posts: 102
Joined: Thu Jan 23, 2020 3:28 am
Location: St. Louis, Missouri

Re: Where can I get detailed API documentation?

Postby gbroques » Tue Mar 23, 2021 6:22 pm

elias wrote:
Tue Mar 23, 2021 2:20 pm
I'm guessing there is just no documentation for a lot of things. If this is the case, it would be great if someone could give me a few pointers about how to look for the definition of the python interfaces in the source code. I'm not very familiar with C++ and I'm not able to find them on my own.

Thanks!

I've made a few posts in the past about documentation in regards to the Python API or interface and my understanding is it's lacking.

I'm unaware of any guide or set of pointers for identifying the Python interfaces from the C++ source code.

Such a guide would be great as I feel the same as you! :D

---

What I generally do is use Python's dir function to see the properties of an object, in combination with the help function to see additional information about a particular property, within the Python console, to discover the API.

help is not always so helpful.
elias
Posts: 10
Joined: Thu Mar 18, 2021 10:41 am

Re: Where can I get detailed API documentation?

Postby elias » Wed Mar 24, 2021 7:09 am

Thank you for your answers. I guess I'll use the console to learn as much as I can and keep trying to understand the C++ source code.
jmcornil
Posts: 132
Joined: Mon Nov 02, 2020 9:16 am
Location: Versailles (France)
Contact:

Re: Where can I get detailed API documentation?

Postby jmcornil » Wed Mar 24, 2021 5:43 pm

Hello elias

You can also have a look to this document https://github.com/qingfengxia/FreeCAD_ ... 190912.pdf
heda
Posts: 343
Joined: Sat Dec 12, 2015 5:49 pm

Re: Where can I get detailed API documentation?

Postby heda » Wed Mar 24, 2021 5:52 pm

api.png
api.png (24.41 KiB) Viewed 287 times
User avatar
gbroques
Posts: 102
Joined: Thu Jan 23, 2020 3:28 am
Location: St. Louis, Missouri

Re: Where can I get detailed API documentation?

Postby gbroques » Wed Mar 24, 2021 11:41 pm

jmcornil wrote:
Wed Mar 24, 2021 5:43 pm
Hello elias

You can also have a look to this document https://github.com/qingfengxia/FreeCAD_ ... 190912.pdf
Wow, this looks great to gain a high-level understanding or "lay of the land" for FreeCAD.

Thanks for sharing! :D
elias
Posts: 10
Joined: Thu Mar 18, 2021 10:41 am

Re: Where can I get detailed API documentation?

Postby elias » Thu Mar 25, 2021 12:52 pm

jmcornil wrote:
Wed Mar 24, 2021 5:43 pm
Hello elias

You can also have a look to this document https://github.com/qingfengxia/FreeCAD_ ... 190912.pdf
That document is exactly what I was looking for. Thank you!