Fooling around with FreeCAD Source and OCC

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Fooling around with FreeCAD Source and OCC

Post by fosselius »

This thread will be a place where i dump information about things i find while looking at open cascade visualization and how 3d views are currently rendered.

Initially I played around a bit with QT/open cascade visualization. I have created this fork of a OCC/QT project to be used as a sandbox:
https://github.com/maidenone/occQt

I have briefly gone through this documentation:
https://dev.opencascade.org/doc/overvie ... ation.html

I have also spent way to much time trying to generate dependency graphs of the FreeCAD code base..

I used: https://www.flourish.org/cinclude2dot/ to generate the dot file of all "#include" dependencies between all files, some reference errors where reported, so this is not complete. I configured it to merge "file.c" and "file.h" into "file" to reduce the complexity. It still took more then an hour to render the SVG. I found that viewing with eog (image viewer) is better then google-chrome due to zoom limit..
Still way to complex to follow the lines, but it looks cool.
dependency.png
dependency.png (649.63 KiB) Viewed 1966 times
Fullsize (~12Mb) https://drive.google.com/file/d/1yyGnzd ... sp=sharing

I also tried https://github.com/tomtom-international ... pendencies and got this:
https://drive.google.com/file/d/1eE-r6e ... sp=sharing
https://drive.google.com/file/d/1YKMFTs ... sp=sharing
But those are not detailed enough for me. maybe i misconfigured it..
Attachments
source.dot
(585.6 KiB) Downloaded 40 times
Last edited by fosselius on Tue Mar 26, 2019 11:38 pm, edited 1 time in total.
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: Fooling around with FreeCAD Source and OCC

Post by fosselius »

I found that Quarter is the Coin3D -> QT library that i should start looking at in the FreeCAD code, extracting a subset from dependency graph above with:

Code: Select all

head source.dot  -n 7 > test.dot
cat source.dot | grep Quarter >> test.dot
echo "}"  >> test.dot 
neato -Tpng test.dot -o test.png
Results in the following graph:
test.png
test.png (137.72 KiB) Viewed 1937 times
Where QuaterWidget is the widget where 3d graphics is rendered.
From Quater.cpp:
Quarter is a light-weight glue library that provides seamless
integration between Systems in Motions's \COIN high-level 3D
visualization library and Trolltech's \QT 2D user interface
library.

\QT and \COIN is a perfect match since they are both open source,
widely portable and easy to use. Quarter has evolved from Systems in
Motion's own experiences using \COIN and \QT together in our
applications.

The functionality in Quarter revolves around QuarterWidget, a
subclass of QGLWidget. This widget provides functionality for
rendering of Coin scenegraphs and translation of QEvents into
SoEvents. Using this widget is as easy as using any other QWidget.
Now, part of the code we are interested in are named Inventor, lets add that to our grep:

Code: Select all

<same as above>
cat source.dot | grep -E 'Inventor|Quarter' >> test2.dot
<same as above>
 neato -Tpng -Goverlap=false -Gsplines=true test2.dot -o test2.png
Now this is more in line with what i expected:
test2.png
test2.png (201.27 KiB) Viewed 1922 times
test2.svg
(192.02 KiB) Downloaded 53 times
Summery of today's activities:
checked out FreeCAD code, installed dependancies and built (QT4, Py2, OCE....)
downloaded OCC and compiled
generated graphs
read OCC documentation
started reading through Quarter code / integration
forked https://github.com/eryar/occQt, resolved build issues, (built for QT5, OCC) started playing with event handler.
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Fooling around with FreeCAD Source and OCC

Post by ezzieyguywuf »

Not sure if you're aware, but if you `make DevDoc` in the freecad build directory, it will generate the Doxygen documentation which includes dependency graphs for the various freecad components. This has been helpful for me in terms of seem how the code is structured.

Mod/Part/App/TopoShape.cpp is a decent place to start.
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: Fooling around with FreeCAD Source and OCC

Post by fosselius »

yes i know, but i wanted an overview, doxygen dependancy graphs is great for the local scope.
my goal is to identify every source/header file that have dependency on coin3d (including pivy for python), so the scope is quite big...
ezzieyguywuf wrote: Wed Mar 27, 2019 3:03 am Mod/Part/App/TopoShape.cpp is a decent place to start.
thank you, I will take a closer look tomorrow, any input is greatly valued.
toposhape.png
toposhape.png (222.68 KiB) Viewed 1870 times
toposhape.svg
(87.59 KiB) Downloaded 46 times
Here is the DevDoc i built today:
http://foss.site:8080/fc/da/da1/TopoShape_8h.html
compared to:
https://www.freecadweb.org/api/d8/ded/c ... Shape.html (how is this documentation generated?)
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Fooling around with FreeCAD Source and OCC

Post by ezzieyguywuf »

since your interest in more on the Coin3d stuff, I would instead start at Mod/Part/Gui/ViewProvider. h, which describes how a Part:Toposhape is rendered using Coin3d.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Fooling around with FreeCAD Source and OCC

Post by vocx »

fosselius wrote: Wed Mar 27, 2019 4:44 am ...
https://www.freecadweb.org/api/d8/ded/c ... Shape.html (how is this documentation generated?)
I just stumbled onto this. The web documentation is a reduced version of the full documentation.

Code: Select all

make DevDoc # full, around 5GB
make WebDoc # reduced, around 0.6 GB
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.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Fooling around with FreeCAD Source and OCC

Post by Kunda1 »

Forgot about this cool thread. Very cool. need to bookmark this.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: Fooling around with FreeCAD Source and OCC

Post by fosselius »

haha, Typically me, starting a project then changing focus within 10 minutes only to forget what i was doing a week later..
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Fooling around with FreeCAD Source and OCC

Post by Kunda1 »

fosselius wrote: Sun Sep 29, 2019 6:54 am haha, Typically me, starting a project then changing focus within 10 minutes only to forget what i was doing a week later..
This :point_up_2:
(I can relate) :lol: :(
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply