Cancel handling issue with FEM constraint dialogs

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by uwestoehr »

wmayer wrote: Mon Feb 24, 2020 7:35 am I find it a bit odd that when I e.g. create a fillet, add and remove edges and then cancel the operation that the fillet is still there.
That is interesting because what you want it how the FEM constraint dialogs behave, but Bernd wants that if the user presses Cancel, also the edge removal is cancelled.
So obviously there is no solution that suits all users.

To speak only for myself, I am with Bernd - when I delete edges or faces in a dialog then change my mind and thus press cancel, I want to undo the removal.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by bernd »

uwestoehr wrote: Mon Feb 24, 2020 4:39 pm To speak only for myself, I am with Bernd - when I delete edges or faces in a dialog then change my mind and thus press cancel, I want to undo the removal.
Python FEM constraints behave like that, and it is what I would expect. If cancel is pressed nothing will be changed at the object. See material for example https://github.com/FreeCAD/FreeCAD/blob ... #L258-L278 All changes inside the task panel are saved in class attributes of the task panel. If cancel is pressed (reject) just nothing is written into the object. If ok is pressed (accepted) all changes made into the task panel are saved into the object.
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by wmayer »

uwestoehr wrote: Mon Feb 24, 2020 4:39 pm
wmayer wrote: Mon Feb 24, 2020 7:35 am I find it a bit odd that when I e.g. create a fillet, add and remove edges and then cancel the operation that the fillet is still there.
That is interesting because what you want it how the FEM constraint dialogs behave, but Bernd wants that if the user presses Cancel, also the edge removal is cancelled.
So obviously there is no solution that suits all users.

To speak only for myself, I am with Bernd - when I delete edges or faces in a dialog then change my mind and thus press cancel, I want to undo the removal.
I don't quite understand where our expectations should differ. You said when deleting edges and then press cancel the removal must be reverted. That's what I say too but I go a step further and say that when I create a fillet and add/remove edges while the dialog is still open and press cancel then I expect that everything must be rolled back to how it was before I started the fillet tool and this means that also the fillet must be removed. This is the behaviour how it was for years until v0.18.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by uwestoehr »

wmayer wrote: Mon Feb 24, 2020 9:22 pm That's what I say too but I go a step further...
Sorry, then I misunderstood you.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Cancel handling issue with FEM constraint dialogs

Post by realthunder »

wmayer wrote: Mon Feb 24, 2020 7:35 am There might be use cases where this is useful but for the current behaviour of the dress-up dialogs I find it a bit odd that when I e.g. create a fillet, add and remove edges and then cancel the operation that the fillet is still there.
PR submitted here addressing this issue.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by uwestoehr »

realthunder wrote: Wed Feb 26, 2020 7:14 am PR submitted here addressing this issue.
Many thanks!
Unfortunately I have a hardware issue with my PC and cannot test it soon :(
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by wmayer »

uwestoehr wrote: Mon Feb 24, 2020 4:39 pm That is interesting because what you want it how the FEM constraint dialogs behave, but Bernd wants that if the user presses Cancel, also the edge removal is cancelled.
PR 3103 and PR 3108 are merged now but none of them fixed this issue.

However, what solved it is moving the disabling of auto transaction _before_ displaying a task dialog: git commit 69ea7a3d51
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by bernd »

works great here.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by bernd »

wmayer wrote: Sat Feb 22, 2020 2:15 pm The transaction works this way:
doc->openTransaction("Operation")
doc->addObject(...)
doc->removeObject(...)
obj->Property.setValue(...)
what would be the correct way in python to not add a object if cancel is clicked in the task panel ?

Code: Select all

FreeCAD.setActiveTransaction("Some Name")  # in  def Activated(self) of objects command class
FreeCADGui.doCommand("FreeCAD.ActiveDocument.addObject(...)")  # adds the new object
FreeCADGui.doCommand("FreeCADGui.ActiveDocument.setEdit(FreeCAD.ActiveDocument.ActiveObject.Name)")  # opens the task panel
FreeCAD.closeActiveTransaction(True)  # in task panel class in def reject(self) , no reset edit and no document recompute needed in reject

for reference ... https://forum.freecadweb.org/viewtopic.php?f=18&t=49764
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Cancel handling issue with FEM constraint dialogs

Post by bernd »

Code: Select all

$ grep -r "closeActiveTransaction(True)"
$
in all FreeCAD source returns nothing. I wonder how this is done in other python commands in other wbs.
Post Reply