Help on TechDraw source code
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Help on TechDraw source code
Hi,
I'm working on a new "balloon" command for TechDraw (an arrow with a circle on its end and a number inside this circle).
I'm starting to understand a bit how TechDraw works.
As a starting point I copied all DimensionView related files/calls into BalloonView ones. QGIViewBalloon functions are empty for now but QGIViewBalloon::draw gets called when I clic on my ballon command.
My problem it that I can't make my Balloon object a child of the selected view (in the Tree view at least). It is display at the same level as View.
Can someone (@wandererfan) can point me to the part of the code I should look closely ?
Thanks in advance.
Franck.
I'm working on a new "balloon" command for TechDraw (an arrow with a circle on its end and a number inside this circle).
I'm starting to understand a bit how TechDraw works.
As a starting point I copied all DimensionView related files/calls into BalloonView ones. QGIViewBalloon functions are empty for now but QGIViewBalloon::draw gets called when I clic on my ballon command.
My problem it that I can't make my Balloon object a child of the selected view (in the Tree view at least). It is display at the same level as View.
Can someone (@wandererfan) can point me to the part of the code I should look closely ?
Thanks in advance.
Franck.
- wandererfan
- Veteran
- Posts: 6268
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Help on TechDraw source code
This is done in the parent's ViewProvider (ViewProviderViewPart.cpp) by the "claimChildren()" method. This is a general pattern for DocumentObjects.
Looking forward to seeing Balloon.
Re: Help on TechDraw source code
That's what I was actually looking at last night.
I stepped in the method with gdb and it seems like my Balloon was not in the view list so it can't be claimed.
I'll do some more tests tonight.
Thanks for your confirmation.
Franck.
Code: Select all
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) {
temp.push_back((*it));
}
I'll do some more tests tonight.
Thanks for your confirmation.
Franck.
- wandererfan
- Veteran
- Posts: 6268
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Help on TechDraw source code
Does App/Balloon have a PropertyLink that points to a parentApp/DrawViewPart? If not, it won't be in the InList.
For DrawViewDimension (that's still your starting point?) the link(s) are in the References2D property.
Code: Select all
App::PropertyLinkSubList References2D; //Points to Projection SubFeatures
Re: Help on TechDraw source code
That was the problem. I removed too much of DrawViewDimension.
Let's continue !
Let's continue !
Re: Help on TechDraw source code
If you want to see how cool it is, look here:
https://github.com/fjullien/FreeCAD/commits/master
Select a view, click on the Balloon icon (a mean this kind of half circle) then click on a point in the view. The Balloon should appears.
Then drag the label to place it where you want. CTRL + label drag moves the ballon symbol.
Don't look at the code for now. Need to clean up, make proper commits, figure out what to do with App side of the code and write a test in TestTechDrawApp.py.
@wandererfan, did you design TechDraw icons yourself ?
Franck.
- wandererfan
- Veteran
- Posts: 6268
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Help on TechDraw source code
Ballons would be great. I had made these all different by hand in Inkscape:
- Attachments
-
- Bildschirmfoto 2019-03-11 um 07.14.01.png (116.01 KiB) Viewed 12984 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Help on TechDraw source code
I creted a PR here: https://github.com/FreeCAD/FreeCAD/pull/2013
Should I post anything somewhere else in the forum ?
Franck.
Should I post anything somewhere else in the forum ?
Franck.