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

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

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

Post by jnxd »

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!
My latest (or last) project: B-spline Construction Project.
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

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

Post by jnxd »

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.
My latest (or last) project: B-spline Construction Project.
User avatar
nemesis
Posts: 372
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

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

Post by nemesis »

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
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

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

Post by jnxd »

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.
My latest (or last) project: B-spline Construction Project.
User avatar
nemesis
Posts: 372
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

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

Post by nemesis »

jnxd wrote: Thanks. I presume the steps to reproduce are the same as the first post of this thread.
Absolutely
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

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

Post by jnxd »

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
My latest (or last) project: B-spline Construction Project.
User avatar
nemesis
Posts: 372
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

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

Post by nemesis »

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 1918 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... )
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

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

Post by jnxd »

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.
My latest (or last) project: B-spline Construction Project.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

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

Post by abdullah »

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. :)
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

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

Post by jnxd »

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.
My latest (or last) project: B-spline Construction Project.
Post Reply