Regression on deleting constraints?

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!
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Regression on deleting constraints?

Post by chrisb »

We had discussed this quite a while ago and I think that Abdullah had it already fixed, but now it is back: When I delete a constraint it seems that a recompute is performed, even if Autoupdate is not checked.
abdullah wrote: ping
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Regression on deleting constraints?

Post by bejant »

The entire document recomputeds or only the Solver recomputes?
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: Regression on deleting constraints?

Post by chrisb »

bejant wrote: Tue Oct 16, 2018 10:49 pm The entire document recomputeds or only the Solver recomputes?
It seems to be the entire document. That can be quite some time. It speeds up, if I disable recomputes.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Regression on deleting constraints?

Post by wmayer »

The recompute is done with git commit f35871f6b95
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: Regression on deleting constraints?

Post by chrisb »

So I was mistaken: We had discussed it in the forum, but it wasn't fixed.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Regression on deleting constraints?

Post by DeepSOIC »

wmayer wrote: Wed Oct 17, 2018 8:00 pm The recompute is done with git commit f35871f6b95
Any ideas why is the recompute needed at all? I would prefer it OFF.
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: Regression on deleting constraints?

Post by chrisb »

DeepSOIC wrote: Wed Oct 17, 2018 8:32 pm Any ideas why is the recompute needed at all? I would prefer it OFF.
No idea. The solver works perfect if recompute are manually switched off. Can it be, that simply the check for "Auto update" is missing?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Regression on deleting constraints?

Post by abdullah »

chrisb wrote: Wed Oct 17, 2018 8:37 pm
DeepSOIC wrote: Wed Oct 17, 2018 8:32 pm Any ideas why is the recompute needed at all? I would prefer it OFF.
No idea. The solver works perfect if recompute are manually switched off. Can it be, that simply the check for "Auto update" is missing?
I think it was discussed in the past. No decision was taken. If think that Werner said that most probably we could remove it, but nobody actually checked if it could be or not. Maybe we do not want to break something so closed to the release. I would make a ticket with v.19 as target.
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: Regression on deleting constraints?

Post by chrisb »

abdullah wrote: Thu Oct 18, 2018 12:19 pm I would make a ticket with v.19 as target.
Done: issue #3642. Assigned to Abdullah, target version 0.19.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Regression on deleting constraints?

Post by wmayer »

There are for sure use cases where a recompute() is needed when deleting an object from the document and since the vast majority of commands are implemented that way that the document is up-to-date when invoking them it's probably best to leave this line.

Now the sketcher is something special in several regards and IMO it's best to also handle the Del shortcut in a special way.
You may know the Delete commands of the context-menus of the constraints or elements panels of the sketcher where the connected slot functions do completely different things compared to the general Delete command. The latter tries to cover all eventualities but after all it doesn't know anything about the context where it's used and thus there you always will find a case where it doesn't do what you want.
So, to avoid this kind of problem we should make the sketcher to handle the Del shortcut instead and that the system-wide Delete function won't be invoked if the sketcher is active.

How to implement this:
Whenever you press a shortcut Qt first sends an event of type QEvent::ShortcutOverride and if a recipient claims to handle it Qt then directly sends the QKeyEvent to this recipient. Only if no recipient can be found to handle QEvent::ShortcutOverride Qt triggers the global shortcut.

Since for the sketcher we cannot rely on a certain widget having the focus (sometimes it's one of the task panel and sometimes the 3d view) we could implement a listener class derived from QObject and override its eventFilter method accordingly. This listener object can be added to QApplication (or Gui::MainWindow?) when starting to edit a sketch and removed when finishing to edit it.

Recently I used this trick for the spreadsheet table: git commit ac66048b8b
Post Reply