cancel material assignment don't go back to previous state

About the development of the FEM module/workbench.

Moderator: bernd

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

cancel material assignment don't go back to previous state

Post by Jee-Bee » Wed Aug 26, 2020 10:30 am

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
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Post by bernd » Wed Aug 26, 2020 10:45 am

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
Posts: 2145
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 » Wed Aug 26, 2020 11:01 am

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

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

Post by bernd » Wed Aug 26, 2020 3:59 pm

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
Posts: 2145
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 » 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
User avatar
bernd
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Post by bernd » Thu Aug 27, 2020 3:20 am

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
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Post by bernd » Thu Aug 27, 2020 3:39 am

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
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Post by bernd » Thu Aug 27, 2020 3:52 am

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
Posts: 10956
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Post by bernd » Thu Aug 27, 2020 5:28 am

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

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

Post by bernd » Thu Aug 27, 2020 5:56 am

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

Who is online

Users browsing this forum: No registered users and 1 guest