[bug#2682] -constraints with external geometry disapear after closing/opening the sketch

Post here for help on using FreeCAD's graphical user interface (GUI).
jnxd
Posts: 115
Joined: Mon Mar 30, 2015 2:30 pm

Re: [bug#2682] -constraints with external geometry disapear after closing/opening the sketch

Postby jnxd » Mon Mar 20, 2017 9:16 am

DeepSOIC wrote:
jnxd wrote:Once the deletion is triggered, the code tries to delete constraints related to these external geometries, but due to the structure of the constraintlist object, we only get an empty list, and the code replaces the constraints with this empty list.
I remember that evil bit of code, I messed with it some long time ago. It makes it look like the sketch has no constraints if geometry types change, and eventually that state of no constraints is stored permanently, with no way back.

I searched up the commit that introduced the code, and it was some kind of an experimental measure against crashes when edge kind of external geometry changes.

I thought on how to solve it better, but unfortunately didn't come up with anything.

So the way to go should be to patch up validateExternalLinks, I think.

I could not figure out the logic behind constraintlist returing an empty getvalues() when the geometry is invalid. However, without changing that class, I was able to avoid it by calling acceptgeometry right before validateExternalLinks. Yet the battle is only half done, since we still need a way to validate datums!
jnxd
Posts: 115
Joined: Mon Mar 30, 2015 2:30 pm

Re: [bug?] -constraints with external geometry disapear after closing/opening the sketch

Postby jnxd » Mon Mar 20, 2017 2:56 pm

nemesis wrote:and the test file


The test file currently seems out of date, due to the transitional nature of PDN. Nemesis, could you update it?

I patched up validateExternalLinks as DeepSOIC suggested, and that seems to have sorted the issue as far as the removal of constraints on restore is concerned. But the original issue, that nemesis mentioned, doesn't seem to even exist without the patch.
User avatar
nemesis
Posts: 176
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: [bug#2682] -constraints with external geometry disapear after closing/opening the sketch

Postby nemesis » Mon Mar 20, 2017 8:26 pm

Done in the Tracker.

with this version :

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10519 (Git)
Build type: Release
Branch: (detached from e3d5584)
Hash: e3d55841065cc22b32eda7ff53a648698c748562
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
jnxd
Posts: 115
Joined: Mon Mar 30, 2015 2:30 pm

Re: [bug#2682] -constraints with external geometry disapear after closing/opening the sketch

Postby jnxd » Mon Mar 20, 2017 9:39 pm

nemesis wrote:Done in the Tracker.

with this version :

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10519 (Git)
Build type: Release
Branch: (detached from e3d5584)
Hash: e3d55841065cc22b32eda7ff53a648698c748562
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0

Thanks. I presume the steps to reproduce are the same as the first post of this thread.
User avatar
nemesis
Posts: 176
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: [bug#2682] -constraints with external geometry disapear after closing/opening the sketch

Postby nemesis » Mon Mar 20, 2017 10:06 pm

jnxd wrote:Thanks. I presume the steps to reproduce are the same as the first post of this thread.

Absolutely
jnxd
Posts: 115
Joined: Mon Mar 30, 2015 2:30 pm

Re: [bug#2682] -constraints with external geometry disapear after closing/opening the sketch

Postby jnxd » Mon Mar 20, 2017 10:34 pm

nemesis wrote:
jnxd wrote:Thanks. I presume the steps to reproduce are the same as the first post of this thread.

Absolutely

I opened your file and there is no external geometry even in your fcstd file. What constraints did you apply? I created the edge and applied some arbitrary constraints, and I could change the angle of the datum plane from 45 to 40 degrees without seeing any constraints removed. With my patch I was also able to save and restore all external geometries and constraints. Can you build from here, and check if you can do all these things?

version details:
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10539 +1 (Git)
Build type: Debug
Branch: bugsquash
Hash: 7ce31a805a84ae75a51148f6c4c421b6a351ab74
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
User avatar
nemesis
Posts: 176
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: [bug#2682] -constraints with external geometry disapear after closing/opening the sketch

Postby nemesis » Tue Mar 21, 2017 12:10 pm

jnxd wrote:I opened your file and there is no external geometry even in your fcstd file......

that's the point ;)
here is an example, but it bug whatever the constraint is with the external ref to datum plane
SketcExtRef.PNG
SketcExtRef.PNG (87.84 KiB) Viewed 85 times


jnxd wrote:Can you build from here, and check if you can do all these things?

unfortunatly I've never succed to compile freeCAD :D (but my last try was some years ago... )
jnxd
Posts: 115
Joined: Mon Mar 30, 2015 2:30 pm

Re: [bug#2682] -constraints with external geometry disapear after closing/opening the sketch

Postby jnxd » Tue Mar 21, 2017 12:35 pm

nemesis wrote:
jnxd wrote:I opened your file and there is no external geometry even in your fcstd file......

that's the point ;)
here is an example, but it bug whatever the constraint is with the external ref to datum plane
SketcExtRef.PNG

jnxd wrote:Can you build from here, and check if you can do all these things?

unfortunatly I've never succed to compile freeCAD :D (but my last try was some years ago... )

PR is merged now so you can try the daily when its released.
abdullah
Posts: 1501
Joined: Sun May 04, 2014 3:16 pm

Re: [bug?] -constraints with external geometry disapear after closing/opening the sketch

Postby abdullah » Wed Mar 22, 2017 1:28 pm

jnxd wrote:
Summoning some people to shed some light on what to do
abdullah wrote:...

If necessary, we could move the talks to the development thread.


Sorry, I have been away. Glad you figured it out. :)
jnxd
Posts: 115
Joined: Mon Mar 30, 2015 2:30 pm

Re: [bug?] -constraints with external geometry disapear after closing/opening the sketch

Postby jnxd » Wed Mar 22, 2017 1:51 pm

abdullah wrote:
Sorry, I have been away. Glad you figured it out. :)


That's quite alright. And as I said the battle is only half over. There is still this problem of all the constraint deletion on failure of a single external element. If you've roamed around these streets, please input.