FC0.17 recompute strange behaviour (regression)

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
easyw-fc
Posts: 2614
Joined: Thu Jul 09, 2015 9:34 am

FC0.17 recompute strange behaviour (regression)

Postby easyw-fc » Wed Mar 28, 2018 9:48 pm

Hi, I recently just noticed that FC0.17 has a weird behavior when recomputing a document.

Here the result of a
FreeCAD.ActiveDocument.recompute()
command on a semi-complex object in FC0.17
recompute-FC0.17.gif
recompute-FC0.17.gif (126.99 KiB) Viewed 912 times
and the same in FC0.16
recompute-FC0.16.gif
recompute-FC0.16.gif (144.64 KiB) Viewed 912 times
and the testing file
rotating_slider.fcstd
(99.12 KiB) Downloaded 12 times
The recompute is also much more slower in FC0.17 than in FC0.16

Code: Select all

import FreeCAD
App.ActiveDocument.Fillet.touch()
App.ActiveDocument.recompute()
My releases are:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13452 (Git)
Build type: Release
Branch: master
Hash: 34633c144de9133c1f9aeb7da783f369cae9bfaf
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6712 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: da2d364457257a7a8c6fb2137cea12c45becd71a
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Last edited by easyw-fc on Thu Mar 29, 2018 7:16 am, edited 2 times in total.
User avatar
easyw-fc
Posts: 2614
Joined: Thu Jul 09, 2015 9:34 am

Re: FC0.17 recompute strange behaviour

Postby easyw-fc » Thu Mar 29, 2018 7:13 am

I'm adding also a simple change in placement screencast...
FreeCAD0.17 shows a regression:
1) the Placement is getting a bit unresponsive (a bigger delay compared to FC0.16, before updating the scene)
2) the colors get lost during any simple changing of Placement

FC017
FC017-Placement-regression.gif
FC017-Placement-regression.gif (392.93 KiB) Viewed 881 times
FC016
FC016-Placement-behavior.gif
FC016-Placement-behavior.gif (399.55 KiB) Viewed 881 times
the testing file here:
rotating_slider.fcstd
(99.12 KiB) Downloaded 10 times
wmayer
Site Admin
Posts: 14645
Joined: Thu Feb 19, 2009 10:32 am

Re: FC0.17 recompute strange behaviour (regression)

Postby wmayer » Thu Mar 29, 2018 7:45 am

Can you submit a bug report?
User avatar
easyw-fc
Posts: 2614
Joined: Thu Jul 09, 2015 9:34 am

Re: FC0.17 recompute strange behaviour (regression)

Postby easyw-fc » Thu Mar 29, 2018 7:55 am

wmayer wrote:
Thu Mar 29, 2018 7:45 am
Can you submit a bug report?
done here
https://www.freecadweb.org/tracker/view.php?id=3410
mario52
Posts: 2646
Joined: Wed May 16, 2012 2:13 pm

Re: FC0.17 recompute strange behaviour (regression)

Postby mario52 » Thu Mar 29, 2018 11:51 am

hi

very good catch easyw-fc i delete the recompute() in my macro and now work fine also in the 0.17 FC

With Recompute slow and the color change
Rotation_017_WithRecompute00.gif
Rotation_017_WithRecompute00.gif (359.42 KiB) Viewed 790 times
Without Recompute and work fine
Rotation_017_WithOutRecompute00.gif
Rotation_017_WithOutRecompute00.gif (639.29 KiB) Viewed 790 times

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.
freecad-heini-1
Posts: 5692
Joined: Tue Jan 07, 2014 11:10 am
Contact:

Re: FC0.17 recompute strange behaviour (regression)

Postby freecad-heini-1 » Thu Mar 29, 2018 12:08 pm

Nice, another tool for to rotate objects. Thank you so much and happy easter.
mario52
Posts: 2646
Joined: Wed May 16, 2012 2:13 pm

Re: FC0.17 recompute strange behaviour (regression)

Postby mario52 » Thu Mar 29, 2018 12:40 pm

hi freecad-heini-1
freecad-heini-1 wrote:
Thu Mar 29, 2018 12:08 pm
another tool for to rotate objects
old ... forgotten ? feature req: placement - rotate part around its midpoint not yet complete I'm sailing from macro to macro

happy easter.

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.
User avatar
DeepSOIC
Posts: 6877
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: FC0.17 recompute strange behaviour (regression)

Postby DeepSOIC » Wed Apr 04, 2018 10:01 pm

Looks like it was caused by new recompute routine.
Commits: git commit 283ab961b5c4087bf131e74f40d87ddd3335a18b and git commit 283ab961b5c4087bf131e74f40d87ddd3335a18b

Used to work like so:
1. Topological sort
2. for each object, as sorted:
recompute the object if mustExecute() or any dependency (linked or expression-ed) is touched.
-> Recomputing the object touches the object
3. Purge all touched.

Now works like this:
1. Topological sort
2. for each object, as sorted:
* recompute if the object is touched or if mustExecute()
* purge touched for the object
* touch all objects that depend on the object

Changing any property always maked any object touched, a recompute of the object after a change in placement is the result.
How to fix? change back to old logic, I suppose...
User avatar
DeepSOIC
Posts: 6877
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: FC0.17 recompute strange behaviour (regression)

Postby DeepSOIC » Wed Apr 04, 2018 10:11 pm

So, the meaning of object.Touched flag has changed.

Old meaning: object.Touched = the object has been changed since last recompute. That does not mean the object itself must be recomputed, but it does mean that any object depending on this object must be recomputed.

New meaning: object.Touched = object must be recomputed.

Since changing any property except Label makes an object touched, it will be recomputed. mustExecute almost lost its meaning.

So an alternative solution may be to not set object.Touched upon every change to any property.
ickby
Posts: 2914
Joined: Wed Oct 05, 2011 7:36 am

Re: FC0.17 recompute strange behaviour (regression)

Postby ickby » Thu Apr 05, 2018 5:18 am

I can't remember all the details, but I think the reason for this change was the Part hirarchy and scoped links. If a document object linked into a part, it had a link out of scoped and was in error. When draged into the part, a recompute should fix this. However, as it was only touched, mustExcecute() did not return true. Hence the error could not be fixed like this, it needed to be manually marked for recompute. Hence I added the mentioned commit. Seems I unterestimated the impact of this