[not SOLVED :(] [BUG]: Recursive calling of recompute

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
dino
Posts: 85
Joined: Mon Sep 22, 2014 11:28 pm

[not SOLVED :(] [BUG]: Recursive calling of recompute

Postby dino » Fri Dec 20, 2019 2:08 pm

Hello!
I wrote two functions to dynamically calculate points on a profile to create a bspline3d, the functions individually work very well, but when I use the profile created by one function (the output of the function) as input of the other function and then I edit a parameter passed to the first function (for example move something with Draft.move()) at the time of recalculation the object is moved twice (twice the value entered) and I get as error:

Code: Select all

895.269 <App> Document.cpp (3106): Recursive calling of recompute for document
I think the bug lies in the fact that at the first call of the FreeCAD.ActiveDocument.recompute() the Draft.move() function is not removed from the queue and therefore is called again by my function doing so that the object moves twice as much as I inserted.

On FreeCAD Version 0.19.17651 this bug is not present, on newer it is

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18990 (Git)
Build type: Release
Branch: master
Hash: e499f384240196c415f207520bfbcb8df9d1b0d2
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
Last edited by dino on Sat Mar 28, 2020 1:10 pm, edited 3 times in total.
User avatar
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: [BUG]: Recursive calling of recompute

Postby DeepSOIC » Fri Dec 20, 2019 2:17 pm

This is most likely a bug of your code, I think.

Please post a step-by-step way to reproduce it, otherwise it's going to be a waste of time, i'm afraid.
dino
Posts: 85
Joined: Mon Sep 22, 2014 11:28 pm

Re: [BUG]: Recursive calling of recompute

Postby dino » Fri Dec 20, 2019 3:02 pm

I attatch the .py file and a drow as example.

Try:
- modify Sketch changing Constraint5 of Sketch from 20mm to 25mm
- recompute
(at this time we have an error because "Line001" no longer coincides
- move "Line001" from (20,20,0) to (25,20,0)
(now starting point of Line001 coincides and it is all OK)

In FreeCAD 64-bit Version: 0.19.17651 Line001 moves exactly from (20,20,0) to (20,25,0)

In FreeCAD 64-bit Version: 0.19.18990 Line001 moves from (20,20,0) to (20,25,0) and then from (20,25,0) to (20,30,0)! :shock: It's a BUG!

:D
Attachments
ProvaBUG.FCStd
Test file
(88.56 KiB) Downloaded 15 times
LoftRuledParametric.py
Function that create a Loft using a wire as base and one or more lines as profile limit
(15.67 KiB) Downloaded 15 times
User avatar
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: [BUG]: Recursive calling of recompute

Postby DeepSOIC » Fri Dec 20, 2019 3:19 pm

Moved where expected here:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18234 (Git)
Build type: Release
Branch: master
Hash: 3af5d97e9b2a60823815f662aba25422c4bc45bb
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Russian/Russia (ru_RU)

I'll try a fresher version...
User avatar
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: [BUG]: Recursive calling of recompute

Postby DeepSOIC » Fri Dec 20, 2019 3:25 pm

Still moves as expected:
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18940 (Git)
Build type: Debug
Branch: fix-leak-disttoshape
Hash: c6702814fe48d4545337555636288668a9bfd4c9
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Russian/Russia (ru_RU)
User avatar
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: [BUG]: Recursive calling of recompute

Postby DeepSOIC » Fri Dec 20, 2019 3:29 pm

dino wrote:
Fri Dec 20, 2019 3:02 pm
- move "Line001" from (20,20,0) to (25,20,0)
(now starting point of Line001 coincides and it is all OK)
Just in case, here's what I do at this step:
1. activate Draft wb
2. select Line001 in 3d view
3. invoke Draft Move from toolbar
4. snap to the bottom vertex of Line001. Click.
5. snap to the vertex of sketch it is supposed to match (vertex2 at (25,20,0)). Click
-> finished
dino
Posts: 85
Joined: Mon Sep 22, 2014 11:28 pm

Re: [BUG]: Recursive calling of recompute

Postby dino » Sat Dec 21, 2019 9:09 pm

I also tried with a different version but the problem persists for me

http://www.filedropper.com/kazamscreencast00000

OS: Devuan GNU/Linux 3 (beowulf) (XFCE/xfce)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18947 (Git) AppImage
Build type: Release
Branch: master
Hash: 91f6a5e5ee1b48063d5d4b59cc6250fc2a1021b1
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
dino
Posts: 85
Joined: Mon Sep 22, 2014 11:28 pm

Re: [BUG]: Recursive calling of recompute

Postby dino » Thu Jan 02, 2020 4:42 pm

A friend of mine warned me that with windows you can't see the video, only with VLC you can see.
dino
Posts: 85
Joined: Mon Sep 22, 2014 11:28 pm

Re: [BUG]: Recursive calling of recompute

Postby dino » Fri Jan 03, 2020 12:53 pm

Today I have tried in last FreeCAD 0.19 version (for Windows) and the BUG still in :x

http://www.filedropper.com/freecad0192020-01-0313-47-49

Does anyone have this problem?

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19127 (Git)
Build type: Release
Branch: master
Hash: ec18f070d13b195d946c3d955d8c21b2e60550e2
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
User avatar
bitacovir
Posts: 979
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: [BUG]: Recursive calling of recompute

Postby bitacovir » Mon Jan 06, 2020 12:00 pm

dino wrote:
Fri Jan 03, 2020 12:53 pm
Today I have tried in last FreeCAD 0.19 version (for Windows) and the BUG still in :x

http://www.filedropper.com/freecad0192020-01-0313-47-49

Does anyone have this problem?
Yes. I confirm. In my case happen when I try to move 3 or more objects with Draft Move tool. It jumps twice. It is a constant bug.
3beams.FCStd
(17.49 KiB) Downloaded 15 times
ADABKNotsc.gif
ADABKNotsc.gif (255.82 KiB) Viewed 427 times
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19151 (Git)
Build type: Release
Branch: master
Hash: 1276920feaec772d297ebd9e50ee1ae2881f62fe
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
::bitacovir::
===================================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

My personal web site
My GitHub repository
My old Blog
Mini Airflow Tunnel Project