cancel material assignment don't go back to previous state

About the development of the FEM module/workbench.

Moderator: bernd

Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

cancel material assignment don't go back to previous state

Post by Jee-Bee »

I have a bug / weird behavour of FEM Material assignment.
When pressing on material for assigning a new one. And now the material i'm looking for is not found (let's say new FC version)
So i cancel the material assignment. i would expect that it goes to the state that was before. Ín case of creating a new material it should remove it.
But this not the case. it stays in the model tree.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: cancel material assignment don't go back to previous state

Post by bernd »

this one?
- start FreeCAD
- switcht to FEM
- make a new Document
- add a analysis
- add a material, do not do anything in the task panel
- click on cancel in materila task panel
- the material object is still there, but there should be no material object because of cancel
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: cancel material assignment don't go back to previous state

Post by Jee-Bee »

Yes, comparing it with for example force. after canceling the force object isn't created
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: cancel material assignment don't go back to previous state

Post by bernd »

we need to zest all python objects ... selfweight, shell thickness, electrostatic potential etc

How about mesh objects.

BTW: what is general FreeCAD way for example in Part Extrusion?

I am on the way no computer around.
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: cancel material assignment don't go back to previous state

Post by Jee-Bee »

I personal use mort part design than part.
I shall try to create a list (first FEM) with the different behaviours between functions(i add the different selection modus too).
Then i shall go to Part Design and maybe part too
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: cancel material assignment don't go back to previous state

Post by bernd »

Jee-Bee wrote: Wed Aug 26, 2020 4:09 pm I personal use mort part design than part.
I shall try to create a list (first FEM) with the different behaviours between functions(i add the different selection modus too).
Then i shall go to Part Design and maybe part too
- all FEM object developed in Python do not vanish on cancel, including meshes
- on Part if cancel is clicked the object is not created (for example part extrusion)
- you are totally right we should change this behaviour
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: cancel material assignment don't go back to previous state

Post by bernd »

constraint initial flow velo city is best example because it is very small.

- click on object icon:
- https://github.com/FreeCAD/FreeCAD/blob ... ds.py#L191
- https://github.com/FreeCAD/FreeCAD/blob ... #L297-L318
- https://github.com/FreeCAD/FreeCAD/blob ... ity.py#L39

- click on cancel in task panel
- https://github.com/FreeCAD/FreeCAD/blob ... ity.py#L66

How do we know if a object was just created and has be deleted on reject() or if it is an old object and we just restore the property edits as in current implementation?
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: cancel material assignment don't go back to previous state

Post by bernd »

we might need to add a Transaction (a command) for adding a new object and on reject cancel this transaction.

https://github.com/FreeCAD/FreeCAD/blob ... d.cpp#L656
https://github.com/FreeCAD/FreeCAD/blob ... e.cpp#L337
https://github.com/FreeCAD/FreeCAD/blob ... e.cpp#L364
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: cancel material assignment don't go back to previous state

Post by bernd »

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

Re: cancel material assignment don't go back to previous state

Post by bernd »

in Python https://forum.freecadweb.org/viewtopic. ... 56#p141074

this is what we look for ...

Code: Select all

FreeCAD.closeActiveTransaction()   # commiting
FreeCAD.closeActiveTransaction(True)  # abort
FreeCAD.getActiveTransaction()
FreeCAD.setActiveTransaction()  # new Transaction
Post Reply