Help on TechDraw source code

Discussions about the development of the TechDraw workbench
fjullien
Posts: 55
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Help on TechDraw source code

Postby fjullien » Tue Feb 26, 2019 9:48 pm

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.
wandererfan
Posts: 2898
Joined: Tue Nov 06, 2012 5:42 pm

Re: Help on TechDraw source code

Postby wandererfan » Wed Feb 27, 2019 12:41 am

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: 55
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Re: Help on TechDraw source code

Postby fjullien » Wed Feb 27, 2019 6:24 am

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.
wandererfan
Posts: 2898
Joined: Tue Nov 06, 2012 5:42 pm

Re: Help on TechDraw source code

Postby wandererfan » Wed Feb 27, 2019 1:45 pm

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: 55
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Re: Help on TechDraw source code

Postby fjullien » Wed Feb 27, 2019 7:30 pm

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

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

Re: Help on TechDraw source code

Postby fjullien » Sun Mar 10, 2019 9:17 pm

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.
wandererfan
Posts: 2898
Joined: Tue Nov 06, 2012 5:42 pm

Re: Help on TechDraw source code

Postby wandererfan » Mon Mar 11, 2019 12:27 am

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 572 times
@wandererfan, did you design TechDraw icons yourself ?
We inherited some, I did some, @agryson did some. Probably a few other contributors too.
triplus
Posts: 8605
Joined: Mon Dec 12, 2011 4:45 pm

Re: Help on TechDraw source code

Postby triplus » Mon Mar 11, 2019 12:37 am

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

Re: Help on TechDraw source code

Postby chrisb » Mon Mar 11, 2019 6:15 am

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 541 times
fjullien
Posts: 55
Joined: Wed Jan 17, 2018 7:46 am
Location: France

Re: Help on TechDraw source code

Postby fjullien » Mon Mar 11, 2019 9:51 pm

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

Should I post anything somewhere else in the forum ?

Franck.