sketcher : invalid constraint cannot be selected or deleted
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
sketcher : invalid constraint cannot be selected or deleted
Hi,
deleting a constraint which is referenced in another constraint leads to an arbitrary reassignment.
This can often assign a zero value to a length based constraint. It seems that it is them impossible to select the broken constraint in the 3D since it no longer responds to mouse events such and hover and click.
When a constraint is deleted, all constraints above it in the list get renumber down. So any other constrain referring to it via expression evaluation Constraints[xx] now arbitrarily refers to some other variable. If the deleted object was a length and the new object pointed to is non dimenstional ( such as a horizontal , perpendicular or parallel constraint ) the expression now evaluates to zero. This will likely have destructive effects on the sketch.
Worse it seems that such a zero valued dimension cannot be selected, to change or delete it.
Clearly the abitrary reassignment is a serious bug and should not be happening.
A more acceptable outcome would be to keep the previous numerical value, and "clear" the expression entry, probably with a warning
Alternatively, all derivative constraints should be removed entirely, leaving the user to add a new constraint.
I see this in recent master build. I have been making more use of Constraints[xx] references recently , so probably this is nothing new, just I never hit the problem before.
deleting a constraint which is referenced in another constraint leads to an arbitrary reassignment.
This can often assign a zero value to a length based constraint. It seems that it is them impossible to select the broken constraint in the 3D since it no longer responds to mouse events such and hover and click.
When a constraint is deleted, all constraints above it in the list get renumber down. So any other constrain referring to it via expression evaluation Constraints[xx] now arbitrarily refers to some other variable. If the deleted object was a length and the new object pointed to is non dimenstional ( such as a horizontal , perpendicular or parallel constraint ) the expression now evaluates to zero. This will likely have destructive effects on the sketch.
Worse it seems that such a zero valued dimension cannot be selected, to change or delete it.
Clearly the abitrary reassignment is a serious bug and should not be happening.
A more acceptable outcome would be to keep the previous numerical value, and "clear" the expression entry, probably with a warning
Alternatively, all derivative constraints should be removed entirely, leaving the user to add a new constraint.
I see this in recent master build. I have been making more use of Constraints[xx] references recently , so probably this is nothing new, just I never hit the problem before.
- Attachments
-
- zero-dim.png (2.46 KiB) Viewed 1271 times
- adrianinsaval
- Veteran
- Posts: 5553
- Joined: Thu Apr 05, 2018 5:15 pm
Re: sketcher : invalid constraint cannot be selected or deleted
see issue #7668 and the related forum discussion, this is known and we have discussed a potential solution, however it hasn't been coded yet.
Re: sketcher : invalid constraint cannot be selected or deleted
This is a separate issue, which may be fixed in the most recent 0.21. Workaround: increase the font size.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: sketcher : invalid constraint cannot be selected or deleted
thanks Adrian, this looks like a vipers nest ( or rather a python's nest ) of problems . Shame it has stalled for a while. It seems a lot of this should have been coded with linked lists, not linear arrays.
Chris thanks for the tip. I'll try that if I can still find this offending constraint. I think I just backed out the change which created it.
I tried zooming in so that nothing else was present, as seen in the screenshot, and it was still impossible to select it. These is no part of the screen which responds to the mouse. How is this a result of font size when I have no issues on other constraints, just the zero dimensioned one. It seems data related.
Chris thanks for the tip. I'll try that if I can still find this offending constraint. I think I just backed out the change which created it.
I tried zooming in so that nothing else was present, as seen in the screenshot, and it was still impossible to select it. These is no part of the screen which responds to the mouse. How is this a result of font size when I have no issues on other constraints, just the zero dimensioned one. It seems data related.
Last edited by freman on Thu Apr 27, 2023 5:35 am, edited 1 time in total.
Re: sketcher : invalid constraint cannot be selected or deleted
Zooming doesn't help. I discussed this recently with Abdullah and he made a change.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: sketcher : invalid constraint cannot be selected or deleted
OK, if it's already known and fixed that's great. That was my aim in reporting it.
I don't know where Abdullah hangs out but hopefully he can look at the possibility of using linked lists instead of pythons lists which are just dynamnic arrays. The horrible topo instability problem seems to have a similar cause.
I don't know where Abdullah hangs out but hopefully he can look at the possibility of using linked lists instead of pythons lists which are just dynamnic arrays. The horrible topo instability problem seems to have a similar cause.
Re: sketcher : invalid constraint cannot be selected or deleted
I think it's ok to go off topic, because OP is solved. Can you elaborate your thought? I can neither imagine that the TNP is caused by using a certain implementation of lists, nor that some selectability is causing TNP issues.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
- adrianinsaval
- Veteran
- Posts: 5553
- Joined: Thu Apr 05, 2018 5:15 pm
Re: sketcher : invalid constraint cannot be selected or deleted
"Just use linked lists" is not a solution to TNP, people often come here and read some short description of some programming concept and think "well looks like I found a solution to TNP! Why is it that all these programmers with years of experience working on FreeCAD haven't thought of this before?"
But obviously solving TNP problem is much more nuanced than that... There's people working on it already, it's been going on for years now with a lot of thought and research into it, leave it to the experts unless you actually know what you are talking about and can code.
Likewise the constraint renumbering problem is also more nuanced and I have my doubts that linked list are of any use here, after all when using expressions we are not sequentially accessing members of the list so the pointer to the next member is useless, we want to access one specific object via an identifier, linked lists don't magically solve the identifier problem nor are they necessary to solve them. I could of course be wrong since I'm also an amateur programmer
But obviously solving TNP problem is much more nuanced than that... There's people working on it already, it's been going on for years now with a lot of thought and research into it, leave it to the experts unless you actually know what you are talking about and can code.
Likewise the constraint renumbering problem is also more nuanced and I have my doubts that linked list are of any use here, after all when using expressions we are not sequentially accessing members of the list so the pointer to the next member is useless, we want to access one specific object via an identifier, linked lists don't magically solve the identifier problem nor are they necessary to solve them. I could of course be wrong since I'm also an amateur programmer
Re: sketcher : invalid constraint cannot be selected or deleted
You are very right with your conclusion, but the argument is very weak. Great inventions would be impossible, because there were always great inventors before, who would have invented it before.adrianinsaval wrote: ↑Thu Apr 27, 2023 1:02 pm "Just use linked lists" is not a solution to TNP, people often come here and read some short description of some programming concept and think "well looks like I found a solution to TNP! Why is it that all these programmers with years of experience working on FreeCAD haven't thought of this before?"
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
- adrianinsaval
- Veteran
- Posts: 5553
- Joined: Thu Apr 05, 2018 5:15 pm
Re: sketcher : invalid constraint cannot be selected or deleted
You are right and realthunder himself was not an expert either when he started this journey, what I don't like is the oversimplification of both the problem and the solution, treating an inherently complex problem as if it was just due to an oversight.