Wanting to contribute to FreeCad, but go some small questions..

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
WorldDj
Posts: 2
Joined: Sat Sep 07, 2019 3:36 pm

Wanting to contribute to FreeCad, but go some small questions..

Postby WorldDj » Sun Nov 10, 2019 8:55 pm

Hello people, I am trying to get familiar with 3d programming.

I am a civil engineer working for a company that is interested in Trimble Tekla Structures plugins, I develop many plugins for them, their plugins mainly automate many tasks for steel structures modelling, but I still want to invest more time to investigate a from scratch 3d program and get familiar with their internal structure, as I only worked with plugins.. So I decided to try giving FreeCAD some of my part time.

What I know: I am good (can learn more easily) at linear algebra, I have been developing in C#.NET for 2 years, familiar with C++ (Thought still not that far with the STL) but I am getting there.

I have read some of the topics here, and I noticed the usage of QT as the main UI framework, and OpenCascade, I am still fairly new in geometry modelling kernels, I know why they exist and what's their overall outcome (Since I use BIM products and CAD modellers everyday) but other than that, really nothing...

Should I first invest some time learned open cascade or is there any good/sufficient resources for modelling kernels? Or should I dive into the source code of freecad directly?

Thanks in advance.
User avatar
Joel_graff
Posts: 1537
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby Joel_graff » Sun Nov 10, 2019 11:12 pm

WorldDj wrote:
Sun Nov 10, 2019 8:55 pm
Should I first invest some time learned open cascade or is there any good/sufficient resources for modelling kernels? Or should I dive into the source code of freecad directly?
That really depends on what you're interested in doing with FreeCAD. The goal of just learning a geometry kernel is a bit vague and probably won't yield great results. You need a particular project to keep you motivated and give you a reason to explore the internals.

So, there's really a couple of ways to get yourself into FC. The first option is to pick something you'd like to model and learn how to do it in FC. You'll learn the way FreeCAD is organized and, even without exposure to the underlying code, you'll get a pretty good feel for how the application is put together.

The other option is to try your hand at writing a tool or workbench that does something. Because FreeCAD has a Python API that has nearly 1:1 correspondence with it's C++ API, it makes it possible for you to interact with it in ways you just can't with commercial packages. Focusing on Python-based development (as opposed to C++) also has the benefit of not having to build FreeCAD from source on your own machine. It's challenging enough on Linux, even more so on Win / Mac.

Since you have experience developing plugins for commercial packages, why not attempt the same with FreeCAD? Check out the FEM workbench.. or Architecture, perhaps, and see if there's something there that interests you. We just completed a Google Summer of Code that yielded great improvements to the rebar layout tool in the Arch workbench, expanding the range of layouts it supports. As a civil engineer myself, I was interested in adapting it to support reinforced concrete box culvert designs. It wasn't quite there when I last looked at it, but I haven't really explored the changes since the GOSC project ended.

Anyway, while it's not an entirely accurate analogy, a workbench is, more or less, a FreeCAD plugin. I suspect it'd make a great entry point for you to start exploring and a good way to introduce yourself to it's internals.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
openBrain
Posts: 2138
Joined: Fri Nov 09, 2018 5:38 pm

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby openBrain » Sun Nov 10, 2019 11:20 pm

If you feel comfortable with C++ code (in general), maybe another useful path to dive into Freecad is to browse the bug tracker and try to fix some issues or add some features. :)
User avatar
Joel_graff
Posts: 1537
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby Joel_graff » Sun Nov 10, 2019 11:24 pm

openBrain wrote:
Sun Nov 10, 2019 11:20 pm
If you feel comfortable with C++ code (in general), maybe another useful path to dive into Freecad is to browse the bug tracker and try to fix some issues or add some features.
What he said. There's always bugs to be squashed. :)
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
wandererfan
Posts: 3062
Joined: Tue Nov 06, 2012 5:42 pm

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby wandererfan » Mon Nov 11, 2019 12:31 am

openBrain wrote:
Sun Nov 10, 2019 11:20 pm
If you feel comfortable with C++ code (in general), maybe another useful path to dive into Freecad is to browse the bug tracker and try to fix some issues or add some features. :)
This is how I started more or less. It gets you used to the build process, the general structure of the application, the various libraries, etc.

It would be nice to know all of Qt, OCC, etc before starting, but those are big elephants, best eaten one bite at a time.
ezzieyguywuf
Posts: 557
Joined: Tue May 19, 2015 1:11 am

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby ezzieyguywuf » Mon Nov 11, 2019 4:18 am

for what it's worth, when I first got involved with FreeCAD a few years ago, I knew only a bit of c++ and zero about opencascade. I decided to get involved with freecad because I wanted to get better at c++.

it's like the others have said - find something that interests you, and use that to drive your exploration into the code base. (a bug fix is a great starting point!)

I'd say by now I have a very firm understanding of both c++ and opencascade, all from letting my curiosity take me where it will.
vocx
Posts: 1590
Joined: Thu Oct 18, 2018 9:18 pm

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby vocx » Mon Nov 11, 2019 5:15 am

WorldDj wrote:
Sun Nov 10, 2019 8:55 pm
...
Should I first invest some time learned open cascade or is there any good/sufficient resources for modelling kernels? Or should I dive into the source code of freecad directly?

Thanks in advance.
I'm more in the camp of Joel Graff, than in the camp of wandererfan and ezzieyguywuf.

What do you want to do with FreeCAD? If you want to do something useful, and see quick results, then learning to write small Python macros is all you need to get you started. The Python interface to create and manipulate objects is quite powerful; you can write code, and see results immediately.

In my opinion it's entirely unnecessary to learn OpenCASCADE and the rest of the C++ code, unless this is really what interests you (computer graphics?). The internals are "hard", and the code is complex, so I wouldn't bother.

Maybe you'd like to see nicer tools to create a steel structure with simple options. This is a much more interesting objective that will help you keep motivated while you learn the internals. You will need basic mathematics (vectors), and understanding how to create a solid body; the rest is just adding properties to those bodies, and how to handle the body when the properties change. See Scripted objects.

Of course, if you really want to learn C++ and know more about computer graphics, then go ahead and dive into C++ books and references, and try to untangle all concepts of the FreeCAD source code that sadly aren't that well documented. See the Developers hub.

In particular, qingfeng's FreeCAD Mod Dev Guide is a nice reference that explains with some details the internals of FreeCAD which aren't well documented in the wiki, which is supposed to be the official documentation.
WorldDj
Posts: 2
Joined: Sat Sep 07, 2019 3:36 pm

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby WorldDj » Mon Nov 11, 2019 7:33 pm

vocx wrote:
Mon Nov 11, 2019 5:15 am
WorldDj wrote:
Sun Nov 10, 2019 8:55 pm
...
Should I first invest some time learned open cascade or is there any good/sufficient resources for modelling kernels? Or should I dive into the source code of freecad directly?

Thanks in advance.
I'm more in the camp of Joel Graff, than in the camp of wandererfan and ezzieyguywuf.

What do you want to do with FreeCAD? If you want to do something useful, and see quick results, then learning to write small Python macros is all you need to get you started. The Python interface to create and manipulate objects is quite powerful; you can write code, and see results immediately.

In my opinion it's entirely unnecessary to learn OpenCASCADE and the rest of the C++ code, unless this is really what interests you (computer graphics?). The internals are "hard", and the code is complex, so I wouldn't bother.

Maybe you'd like to see nicer tools to create a steel structure with simple options. This is a much more interesting objective that will help you keep motivated while you learn the internals. You will need basic mathematics (vectors), and understanding how to create a solid body; the rest is just adding properties to those bodies, and how to handle the body when the properties change. See Scripted objects.

Of course, if you really want to learn C++ and know more about computer graphics, then go ahead and dive into C++ books and references, and try to untangle all concepts of the FreeCAD source code that sadly aren't that well documented. See the Developers hub.

In particular, qingfeng's FreeCAD Mod Dev Guide is a nice reference that explains with some details the internals of FreeCAD which aren't well documented in the wiki, which is supposed to be the official documentation.
Actually, I am trying to get better in both C++ and Computer Graphics.
ezzieyguywuf
Posts: 557
Joined: Tue May 19, 2015 1:11 am

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby ezzieyguywuf » Mon Nov 11, 2019 8:48 pm

WorldDj wrote:
Mon Nov 11, 2019 7:33 pm
Actually, I am trying to get better in both C++ and Computer Graphics.
I don’t know that you’ll learn much about computer graphics delving into opencascade (or even FreeCAD that much...)

I learned a lot about graphics when I decided to try making a video game (pong). I’m no expert, mind you, but it was definitely a worthy project for all sorts of neat programming stuff that you don’t think about when making non-real-time-sensitive applications.
User avatar
Joel_graff
Posts: 1537
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Wanting to contribute to FreeCad, but go some small questions..

Postby Joel_graff » Tue Nov 12, 2019 5:15 pm

WorldDj wrote:
Mon Nov 11, 2019 7:33 pm
Actually, I am trying to get better in both C++ and Computer Graphics.
If you want to do it with FreeCAD, I'd pick one or the other, frankly.

"Computer Graphics" is a bit generic. If you want to deal with CG from a code perspective, you're really talking about the Coin3D scenegraph (or OpenCascade).

Either project would meet both of those goals, though I tend to agree with @ezzieyguywuf... Coin3D would probably be better and it doesn't have commercial support like OpenCascade does, which means it could really use some developers. ;)

If you're still committed to working with FreeCAD, design a workbench in Python for a project that interests you. That will give you great exposure to FreeCAD's internals (the Python API is very similar to the C++ API), require less work, and you'll probably have an easier time getting questions answered. You'll also be able to play with graphics and visualization both at the high and low levels that way.

If C++ is really important, start squashing bugs in the bug tracker. You probably won't find much of the kind of work you're looking for, but it will be an excellent opportunity to expand your C++ skills if you stick with it. Definitely check out Mantis, though.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers