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

Post here for help on using FreeCAD's graphical user interface (GUI).
User avatar
nemesis
Posts: 201
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

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

Postby nemesis » Sun Jan 15, 2017 8:27 am

yep
still there on :

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9641 (Git)
Build type: Release
Branch: (detached from d8afbe5)
Hash: d8afbe563e52281daac5fa63b12ef2e9efc61e9e
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 7.0.0


And maybe I've found another one.
I'm unable to use external geometry on datum plane if the file has not been closed once and re-opened.
User avatar
Kunda1
Posts: 689
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Sun Jan 15, 2017 12:30 pm

nemesis wrote:And maybe I've found another one.
I'm unable to use external geometry on datum plane if the file has not been closed once and re-opened.


@nemesis thanks for retesting.
Please open a new ticket for this bug if you can't find a duplicate on the tracker.
User avatar
nemesis
Posts: 201
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

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

Postby nemesis » Sun Jan 15, 2017 2:07 pm

User avatar
Kunda1
Posts: 689
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Sat Jan 21, 2017 2:21 am

nemesis wrote:issue #2859 done

Just for posterity this thread was initially for issue #2682
User avatar
nemesis
Posts: 201
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

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

Postby nemesis » Sun Jan 29, 2017 8:31 pm

still there
OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9838 (Git)
Build type: Release
Branch: (detached from 1e4b6ed)
Hash: 1e4b6ed00be8bf6931ba6b7acccf6494a5bfbbbf
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 7.0.0

and no warning message or information in the terminal
hokieengr
Posts: 9
Joined: Sat Dec 31, 2016 5:09 pm

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

Postby hokieengr » Mon Feb 06, 2017 10:33 pm

Can anyone tell me how this is supposed to work? This was driving me nuts the other day while modeling something so I'm glad to see it's a bug and not user error.

If someone could outline the desired behavior here and any insight you may have on the nature of the problem, I'll look into fixing it.

Thank you!
Bob
User avatar
nemesis
Posts: 201
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

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

Postby nemesis » Tue Feb 07, 2017 8:35 pm

Hi,

hokieengr wrote:If someone could outline the desired behavior here and any insight you may have on the nature of the problem, I'll look into fixing it.


I guess it should work like any other flat face. if you use a shapebinder on a flat face, you will be able to make a sketch on it.
then using other plane or other "stuff" as external reference should keep it in the sketch.
indeed it looks like nothing is saved in the sketch, if this sketch is on a datum plane.

the other bug looks like the visible datum plane is not accessible in the 3D view until you save the document and open it again, so maybe a viewprovider issue
User avatar
Kunda1
Posts: 689
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Wed Mar 08, 2017 1:55 pm

hokieengr wrote:Can anyone tell me how this is supposed to work? This was driving me nuts the other day while modeling something so I'm glad to see it's a bug and not user error.

If someone could outline the desired behavior here and any insight you may have on the nature of the problem, I'll look into fixing it.

Thank you!
Bob

see the above reply ^
jnxd
Posts: 127
Joined: Mon Mar 30, 2015 2:30 pm

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

Postby jnxd » Sun Mar 19, 2017 4:28 am

nemesis wrote:...it looks like they disappear when saving the file.

They do not. They are still present in the FCSTD file: open it as a zip file and read the Document.xml file.

It appears issue #2682 is two bugs bundled into one:
  • Any external geometries coming from a datum are deleted if a particular function (SketchObject::validateExternalLinks(void)) is called. This happens because the code is trying to access a certain subshape of the object, but the definition is vague for datums. For normal geometries, the subshapes are "face1", "edge1", "vertex1" etc, but for Datums they are "Plane", "Line" and "Point".
  • 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.

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

DeepSOIC wrote:...

abdullah wrote:...

If necessary, we could move the talks to the development thread.
DeepSOIC
Posts: 4693
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

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

Postby DeepSOIC » Sun Mar 19, 2017 11:31 pm

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.