Help on TechDraw source code

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
fjullien
Posts: 71
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Help on TechDraw source code

Post by fjullien »

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.
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Help on TechDraw source code

Post by wandererfan »

fjullien wrote: Tue Feb 26, 2019 9:48 pm 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 ?
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.
fjullien
Posts: 71
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Re: Help on TechDraw source code

Post by fjullien »

That's what I was actually looking at last night.

Code: Select all

          } else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) {
              temp.push_back((*it));
          }
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.
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Help on TechDraw source code

Post by wandererfan »

fjullien wrote: Wed Feb 27, 2019 6:24 am 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.
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
fjullien
Posts: 71
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Re: Help on TechDraw source code

Post by fjullien »

That was the problem. I removed too much of DrawViewDimension.

Let's continue !
fjullien
Posts: 71
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Re: Help on TechDraw source code

Post by fjullien »

wandererfan wrote: Wed Feb 27, 2019 12:41 am Looking forward to seeing Balloon.
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.
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Help on TechDraw source code

Post by wandererfan »

fjullien wrote: Sun Mar 10, 2019 9:17 pm If you want to see how cool it is, look here:
Very cool!
balloonTest.png
balloonTest.png (39.18 KiB) Viewed 13015 times
@wandererfan, did you design TechDraw icons yourself ?
We inherited some, I did some, @agryson did some. Probably a few other contributors too.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Help on TechDraw source code

Post by triplus »

chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Help on TechDraw source code

Post by chrisb »

Ballons would be great. I had made these all different by hand in Inkscape:
Attachments
Bildschirmfoto 2019-03-11 um 07.14.01.png
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.
fjullien
Posts: 71
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Re: Help on TechDraw source code

Post by fjullien »

I creted a PR here: https://github.com/FreeCAD/FreeCAD/pull/2013

Should I post anything somewhere else in the forum ?

Franck.
Post Reply