Hi there,
I was wondering if there are some documentation explaining the source code structure?
I seen the ebook (https://github.com/qingfengxia/FreeCAD_Mod_Dev_Guide) which already explained some of the structure. So basically I understood there is one folder for each workbench in scr/mod folder. So my question is more about the structure of the workbench themself.
Specially for the sketcher workbench as I'm trying to add some features there. I tried to compare different workbench (draft for example) and structure seems very different between each workbench.
Even inside the sketcher workbench, it looks like the different commands are not implemented the same way. Some seems to be writen in python, others in Cpp. The core command for fillet and others seems to be located in SketchObject.cpp
But for some reason draw Rectangle or draw circle are not in this file.
And there are very little documentation to explain the structure.
Anyone can introduce me the structure of the sketcher code perhaps?
Also maybe what could be great is a readme file in each workbench to explain how features are implemented to help new comers?
Source code architecture
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Source code architecture
Last edited by paddle on Sun Feb 23, 2020 7:32 pm, edited 3 times in total.
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
Re: Source code architecture
It would be great if you linked to this "ebook". Otherwise how are you going to help newcomers?
You see? This is the problem with documentation. People don't leave bread crumbs for others to follow. You are making the same mistake.
The truth is workbenches are completely flexible in how they are defined.
Draft is a Python only workbench, so it is much more flexible in terms of code architecture.
Most C++ workbenches define App/ and Gui/ directories where they split the inherently non-visual and visual code. The former corresponds to new internal classes, while the latter deals with "view providers" and user interfaces ("GuiCommands", task panels, .ui files, icons, etc.).
To define a workbench you only need the toplevel directory inside Mod/, and the files Init.py and InitGui.py that initialize that workbench for non-GUI, and GUI aspects. They mostly load other modules, which have the real code.
There is a second way to define a Python-only workbench, which is explained in the Workbench-Starterkit.
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.