[solved] [TD] Bug in Share View?

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

[solved] [TD] Bug in Share View?

Post by balrobs »

Following this steps:
  • with Part workbench create a Cube (500x500x500mm)
  • with Techdraw workbench insert two default pages (Page and Page001)
  • then insert a view of the Cube in Page
  • change Scale to 0,20 and add some dimensions, so you end up with something like this:
    screenshot_01.JPG
    screenshot_01.JPG (55.87 KiB) Viewed 1428 times
  • then share the view with Page001. Your Page now will show something like this:
    screenshot_02.JPG
    screenshot_02.JPG (45.7 KiB) Viewed 1428 times
  • in order to correct your Page you have to reset ScaleType and Scale to their original values (somehow they changed in the background)
  • Page001 continues to show this strange view:
    screenshot_03.JPG
    screenshot_03.JPG (61.84 KiB) Viewed 1428 times
    Obviously there is a problem with the update of the shared view. A recompute does not the job.
    This can only be achieved by closing and reopening Page001.

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.27422 (Git)
Build type: Release
Branch: master
Hash: d938733eaf2c2ce7cb18d1cbb56147185c473530
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: German/Germany (de_DE)
Last edited by balrobs on Tue Jun 07, 2022 3:05 pm, edited 1 time in total.
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Techdraw] Bug in Share View?

Post by wandererfan »

balrobs wrote: Fri May 20, 2022 1:35 pm Obviously there is a problem with the update of the shared view.
I would say that the bug is in the NewView command. When a view is added to a page, if the view doesn't fit on the page, it is supposed to be re-scaled to fit. The ScaleType is changed to Automatic and a sensible scale is calculated.

This is what happens in ShareView, but in NewView, the view is added to the page before the source is set. A view with no source will always fit on the page.

I don't know why the dimensions are messed up in your screen grabs, that doesn't happen here.

So we have inconsistent behaviour. I'm not sure I like the behind the scenes rescaling of the view. My inclination would be to remove the automatic rescaling of large views, but I very rarely deal with large views.
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Techdraw] Bug in Share View?

Post by balrobs »

Thanks @wandererfan for your insights!
So let's assume for my testcase that I added a view to a first page and adjusted the scale factor as needed.
Now I would like to share the same view on a second page. Unfortunately even if the view with its scale would fit on the new page the ScaleType is changed to Automatic and the scale is recalculated. This seems strange to me.
Also I wouldn't expect the ShareView command to change the outlook of my first page ... so IMHO the automatic rescaling should be suppresed for the ShareView operations.
To better explain my observed update problem I recorded the following screencast:
ShareView-min.gif
ShareView-min.gif (978.05 KiB) Viewed 1276 times
Hope it helps :)
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Techdraw] Bug in Share View?

Post by wandererfan »

balrobs wrote: Sun May 22, 2022 8:53 am Unfortunately even if the view with its scale would fit on the new page the ScaleType is changed to Automatic and the scale is recalculated. This seems strange to me.
The checkFit logic was testing if the unscaled view would fit on the page. git commit bfecd1359b should fix that.

balrobs wrote:Also I wouldn't expect the ShareView command to change the outlook of my first page
There is only one view, so if you change it on Page001, Page will also reflect the change. That's the nature of the shared view. From the wiki: "There is only one View object after the share operation. Any changes made to the View will be reflected in both Pages. If the View is deleted from one Page it will also be deleted from the other."
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Techdraw] Bug in Share View?

Post by balrobs »

wandererfan wrote: Mon May 23, 2022 12:55 pm The checkFit logic was testing if the unscaled view would fit on the page. git commit bfecd1359b should fix that.
Thanks @wandererfan for the fix :D
wandererfan wrote: Mon May 23, 2022 12:55 pm There is only one view, so if you change it on Page001, Page will also reflect the change.
So a change of the View-Scale property should reflect in both pages, regardless of if it was changed in Page or Page001.
When I change it, both view objects in the tree view (the original view and the shared view) are marked with a "need a recompute" symbol.
After recomputing the whole document with F5, both recompute symbols disapear and the original view in Page shows updated but the shared view in Page001 stil not. In order to update this view I need to close and reopen Page001 or double click on the Page001 object in the tree view. I would expect to see the updated shared view after pressing F5, that's why I mentioned the update issue in my previous post.

Kind regrads

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.28933 (Git)
Build type: Release
Branch: master
Hash: ee6f0d0ba9dcb2301f09229753d3e87b0d4d8530
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, OCC 7.6.2
Locale: German/Germany (de_DE)
Installed mods: 
  * Assembly3 0.11.3
  * Assembly4 0.11.12
  * Behave-Dark-Colors 0.0.1
  * BIM
  * CfdOF 1.15.1
  * Curves 0.4.3
  * dodo
  * ExtMan
  * fasteners 0.3.41
  * FEM_FrontISTR 0.1.0
  * FreeCAD_SketchArch
  * hfcMystran
  * Plot 2022.4.17
  * ProDarkThemePreferencePack 1.0.0
  * Reinforcement
  * Trails 2022.1.0
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Techdraw] Bug in Share View?

Post by wandererfan »

balrobs wrote: Fri May 27, 2022 9:53 am I would expect to see the updated shared view after pressing F5, that's why I mentioned the update issue in my previous post.
git commit 681d961254 should improve things. You can still get the pages out of sync by adding Dimensions or Balloons that reference the shared view after the share operation.
balrobs
Posts: 449
Joined: Fri Apr 24, 2020 8:58 pm

Re: [Techdraw] Bug in Share View?

Post by balrobs »

wandererfan wrote: Sun Jun 05, 2022 3:15 pm git commit 681d961254 should improve things.
Your commit solved the update problem. Now shared views feels so more intuitive to me!
wandererfan wrote: Sun Jun 05, 2022 3:15 pm You can still get the pages out of sync by adding Dimensions or Balloons that reference the shared view after the share operation.
That's true, but since it's good practice to draw dimensions and baloons at the very end due to the TNP problem, this is IMO rather a secondary problem. Work for 0.21 :mrgreen:
By the way thank you so much for this wonderful workbench!
Post Reply