[FIXED] Using undo in Sketcher causes errors after the Big Merge

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: [Bug?] Using undo in Sketcher causes errors after the Big Merge

Post by aapo »

Syres wrote: Fri Aug 23, 2019 6:49 am you'll notice that the constraints are removed from the first geometry as well as the actual undo the user wants to be achieved.
The constraints are not actually removed from the first geometry, they just disappear from the list and UI view, and they also seem to temporarily cease to cause any restrictions on the model. However, the constraints are still there, as exiting Sketcher and either a) using Sketch validator to fix the constraints, or b) simply doing a save-close-load cycle, restores the constraints.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: [Bug?] Using undo in Sketcher causes errors after the Big Merge

Post by realthunder »

aapo wrote: Fri Aug 23, 2019 9:27 am The constraints are not actually removed from the first geometry, they just disappear from the list and UI view, and they also seem to temporarily cease to cause any restrictions on the model. However, the constraints are still there, as exiting Sketcher and either a) using Sketch validator to fix the constraints, or b) simply doing a save-close-load cycle, restores the constraints.
I have just added fix for this. Please try build my LinkMerge branch here.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: [Bug?] Using undo in Sketcher causes errors after the Big Merge

Post by user1234 »

Hello!
realthunder wrote: Fri Aug 23, 2019 11:16 am I have just added fix for this. Please try build my LinkMerge branch here.
I can not confirm if the error was before, because i do not much in the sketcher.

But i can conform that the LinkMerge branch have no errors in this

Code: Select all

OS: Debian GNU/Linux 10 (buster) (X-Cinnamon/lightdm-xsession)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17899 (Git)
Build type: DebWithRelInfo
Branch: LinkMerge
Hash: a17196cdbe868c57e5cdee92b986f730d9956878
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
setup.

Greetings
user
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: [Bug?] Using undo in Sketcher causes errors after the Big Merge

Post by Syres »

user1234 wrote: Fri Aug 23, 2019 1:41 pm Hello!
realthunder wrote: Fri Aug 23, 2019 11:16 am I have just added fix for this. Please try build my LinkMerge branch here.
I can not confirm if the error was before, because i do not much in the sketcher.

But i can conform that the LinkMerge branch have no errors in this
Thanks for the quick fix @realthunder and cheers to @user1234 for the positive swift feedback, I'll have to wait for the PR to be merged into master but in the meantime I can work fine with the 0.19.17651 build.
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: [Bug?] Using undo in Sketcher causes errors after the Big Merge

Post by aapo »

realthunder wrote: Fri Aug 23, 2019 11:16 am I have just added fix for this. Please try build my LinkMerge branch here.
Hopefully I did it correctly, as my git-skills are not top-notch, but I went with

Code: Select all

$ git pull https://github.com/realthunder/FreeCAD/ LinkMerge:LinkMerge
And thus tried to make a local merge between a (local) newly created LinkMerge branch and your LinkMerge branch. Anyway, git pulled some changes that seemed to merge & start to compile ok, so something(TM) happened anyway. I'll have to just wait for the build to finish now. :)
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: [Bug?] Using undo in Sketcher causes errors after the Big Merge

Post by aapo »

realthunder wrote: Fri Aug 23, 2019 11:16 am
aapo wrote: Fri Aug 23, 2019 9:27 am The constraints are not actually removed from the first geometry, they just disappear from the list and UI view, and they also seem to temporarily cease to cause any restrictions on the model. However, the constraints are still there, as exiting Sketcher and either a) using Sketch validator to fix the constraints, or b) simply doing a save-close-load cycle, restores the constraints.
I have just added fix for this. Please try build my LinkMerge branch here.
The compilation has finished, and I did some (very) basic Sketcher tests with the resulting FreeCAD binary. No problems with the Sketcher undo anymore, so I can confirm that your fix also works very well for my case. Nicely done, thanks! Curiously, the resulting FreeCAD still says it's "master" branch, but it does contain the LinkMerge branch fixes, at least according to git:

Code: Select all

$ git pull https://github.com/realthunder/FreeCAD/ LinkMerge:LinkMerge              
remote: Enumerating objects: 177, done.
remote: Counting objects: 100% (177/177), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 177 (delta 142), reused 166 (delta 136), pack-reused 0
Receiving objects: 100% (177/177), 107.91 KiB | 673.00 KiB/s, done.
Resolving deltas: 100% (142/142), completed with 46 local objects.
From https://github.com/realthunder/FreeCAD
 * [new branch]          LinkMerge  -> LinkMerge
 * [new tag]             0.17_pre   -> 0.17_pre
Anyway, I hope the fix lands into the real master soon! :D

OS: Debian GNU/Linux bullseye/sid (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17903 (Git)
Build type: Release
Branch: master
Hash: 7dbca147bcd7358e3c00fe3437a8108235ed3fa9
Python version: 2.7.16+
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: [Bug?] Using undo in Sketcher causes errors after the Big Merge

Post by aapo »

I reverted back to the official FreeCAD/master, and compiled again, and confirmed that the bug is still in there, and FreeCAD crashes. However, I manually cherry-picked your fix a17196c... from your tree, and patched the official FreeCAD/master branch with just this one commit, and compiled once again. Resulting binary worked, so the a17196c... fixes the bug also on top of the official master:

Code: Select all

$ wget https://github.com/realthunder/FreeCAD/commit/a17196cdbe868c57e5cdee92b986f730d9956878.patch
$ git apply --stat a17196cdbe868c57e5cdee92b986f730d9956878.patch
 src/Mod/Sketcher/App/SketchObject.cpp       |   11 ++++-------
 src/Mod/Sketcher/Gui/ViewProviderSketch.cpp |   10 ++++++++++
 2 files changed, 14 insertions(+), 7 deletions(-)
$ git apply a17196cdbe868c57e5cdee92b986f730d9956878.patch
a17196cdbe868c57e5cdee92b986f730d9956878.patch:62: trailing whitespace.
            if(Constr->First < -extGeoCount || Constr->First >= intGeoCount 
a17196cdbe868c57e5cdee92b986f730d9956878.patch:63: trailing whitespace.
                    || (Constr->Second!=Constraint::GeoUndef 
a17196cdbe868c57e5cdee92b986f730d9956878.patch:65: trailing whitespace.
                    || (Constr->Third!=Constraint::GeoUndef 
warning: 3 lines add whitespace errors.
$ make -j4
Git complained about some trailing whitespace in your commit, but it didn't of course have an effect on compiling. So, your fix works for me on top of the official master, and fixes the bug. Well done! :D


OS: Debian GNU/Linux bullseye/sid (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17875 (Git)
Build type: Release
Branch: master
Hash: 6dae8f371735dd54630e6bfb07824c7796509824
Python version: 2.7.16+
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
aapo
Posts: 615
Joined: Mon Oct 29, 2018 6:41 pm

Re: [FIXED] Using undo in Sketcher causes errors after the Big Merge

Post by aapo »

I just tested the latest official Windows Git build v0.19.18024, and undo worked great there. Which is no surprise, as the relevant bugfix by realthunder has finally been merged to the official master. So, this problem should be permanently fixed in all FreeCAD versions above ~ v0.19.18000. Thanks!

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18024 (Git)
Build type: Release
Branch: master
Hash: 9cc8f6eb666b0a0ae2dc256f7bc0beb8c987710c
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
Post Reply