[fixed] leader line disappears when reopening document

Discussions about the development of the TechDraw workbench
User avatar
uwestoehr
Posts: 1356
Joined: Sun Jan 27, 2019 3:21 am

[fixed] leader line disappears when reopening document

Postby uwestoehr » Wed Jan 08, 2020 3:27 pm

I think there is a bug:
When creating a leader line, it is visible and shows the red color I want.

So this is what I designed:
FreeCAD_nifP9lHFdp.png
as designed and desired
FreeCAD_nifP9lHFdp.png (75.83 KiB) Viewed 411 times

Then I close the document and reopen it:
FlyMiBird-Anpressplatte-gefraest.FCStd
FC file
(76.48 KiB) Downloaded 9 times

What I get is this:
FreeCAD_dVQaspx1hU.png
after reopening
FreeCAD_dVQaspx1hU.png (78.11 KiB) Viewed 411 times

So the positions of the projections are wrong and also the leader line is no longer visible.
Last edited by uwestoehr on Tue Jan 14, 2020 1:56 pm, edited 1 time in total.
User avatar
wandererfan
Posts: 3636
Joined: Tue Nov 06, 2012 5:42 pm

Re: leader line disappears when reopening document

Postby wandererfan » Wed Jan 08, 2020 4:05 pm

uwestoehr wrote:
Wed Jan 08, 2020 3:27 pm
So the positions of the projections are wrong and also the leader line is no longer visible.
The second image looks like the views have been autodistributed. Is Autodistribute on for the ProjectionGroup?

I know about the leader line issue. You have to click it in the tree, then it appears. I've looked for the bug a few times, but no success yet. Probably staring right at it without seeing it.
User avatar
uwestoehr
Posts: 1356
Joined: Sun Jan 27, 2019 3:21 am

Re: leader line disappears when reopening document

Postby uwestoehr » Wed Jan 08, 2020 4:42 pm

wandererfan wrote:
Wed Jan 08, 2020 4:05 pm
The second image looks like the views have been autodistributed. Is Autodistribute on for the ProjectionGroup?
Stupid me. It was on by default. I am not sure if it should be on by default. if the ISO norms recommend or even request this then of course it should be on. I don't know the content of the norms, so maybe my drawing is not norm-conform?

wandererfan wrote:
Wed Jan 08, 2020 4:05 pm
I know about the leader line issue. You have to click it in the tree, then it appears. I've looked for the bug a few times, but no success yet.
OK.
A minor issue: in the tree view the auto-label is "DrawLeaderLine" shouldn't it just be "LeaderLine"?
User avatar
wandererfan
Posts: 3636
Joined: Tue Nov 06, 2012 5:42 pm

Re: leader line disappears when reopening document

Postby wandererfan » Thu Jan 09, 2020 12:48 am

uwestoehr wrote:
Wed Jan 08, 2020 4:42 pm
I don't know the content of the norms, so maybe my drawing is not norm-conform?
As far as I know the First/Third angle conventions only address the arrangement of the orthogonal views. So a case could be made that the iso views shouldn't be autodistributed ever.
A minor issue: in the tree view the auto-label is "DrawLeaderLine" shouldn't it just be "LeaderLine"?
Probably. All those "Draw" prefixes are a legacy of when TechDraw was Drawing v2.0.
User avatar
uwestoehr
Posts: 1356
Joined: Sun Jan 27, 2019 3:21 am

Re: leader line disappears when reopening document

Postby uwestoehr » Thu Jan 09, 2020 1:20 am

wandererfan wrote:
Thu Jan 09, 2020 12:48 am
As far as I know the First/Third angle conventions only address the arrangement of the orthogonal views. So a case could be made that the iso views shouldn't be autodistributed ever.
OK, so autodistribute could also be turned off by default. I vote for this since in Solidworks this is also off by default and I stumble over this regularily.
wandererfan wrote:
Thu Jan 09, 2020 12:48 am
Probably. All those "Draw" prefixes are a legacy of when TechDraw was Drawing v2.0.
So we can get rid of them. I'll have a look the next days.
User avatar
wandererfan
Posts: 3636
Joined: Tue Nov 06, 2012 5:42 pm

Re: leader line disappears when reopening document

Postby wandererfan » Thu Jan 09, 2020 1:50 pm

uwestoehr wrote:
Thu Jan 09, 2020 1:20 am
OK, so autodistribute could also be turned off by default. I vote for this since in Solidworks this is also off by default and I stumble over this regularily.
Default for autodistribute can be changed in Preferences in "General" category.
User avatar
uwestoehr
Posts: 1356
Joined: Sun Jan 27, 2019 3:21 am

Re: leader line disappears when reopening document

Postby uwestoehr » Thu Jan 09, 2020 11:24 pm

wandererfan wrote:
Thu Jan 09, 2020 1:50 pm
Default for autodistribute can be changed in Preferences in "General" category.
Thanks. I did not yet notice this.
wmayer
Site Admin
Posts: 15471
Joined: Thu Feb 19, 2009 10:32 am

Re: leader line disappears when reopening document

Postby wmayer » Sat Jan 11, 2020 1:19 pm

wandererfan wrote:
Wed Jan 08, 2020 4:05 pm
I know about the leader line issue. You have to click it in the tree, then it appears. I've looked for the bug a few times, but no success yet. Probably staring right at it without seeing it.
Don't know if this is of any help for you. When loading the project file then relevant function calls are:
  1. MDIViewPage::attachView
  2. QGVPage::addViewLeader
  3. QGILeaderLine::updateView
  4. QGILeaderLine::draw
  5. QGIView::getGraphicsView
  6. ViewProviderDrawingView::getMDIViewPage
  7. ViewProviderPage::getMDIViewPage
Since the ViewProviderPage has no MDI view yet it returns null and its calling instances, too. That's why QGILeaderLine::draw then returns in the middle of the function, too.
If I disable this check (because it nowhere uses the "view" pointer) the leader line is at least shown in the MDI view, however at the wrong position. When selecting it then it jumps to the correct position.

The attachView function is called inside the constructor of MDIViewPage, i.e. before its assigned to the m_mdiView member of the ViewProviderPage. Maybe you should split the constructor into two parts:
leave the pure construction stuff in the constructor and move adding all items to a second function which you call from within ViewProviderPage::showMDIViewPage after the MDIViewPage is assigned to the m_mdiView.
User avatar
wandererfan
Posts: 3636
Joined: Tue Nov 06, 2012 5:42 pm

Re: leader line disappears when reopening document

Postby wandererfan » Sat Jan 11, 2020 2:26 pm

wmayer wrote:
Sat Jan 11, 2020 1:19 pm
Don't know if this is of any help for you. When loading the project file then relevant function calls are:
Thanks for the clues. I'll try your suggestions.

wf
User avatar
wandererfan
Posts: 3636
Joined: Tue Nov 06, 2012 5:42 pm

Re: leader line disappears when reopening document

Postby wandererfan » Sun Jan 12, 2020 11:44 pm

Thanks to @wmayer's hints, this should be fixed by git commit 00c69a9c64.