clear mesh does not work for Netgen meshes anymore

About the development of the FEM module/workbench.

Moderator: bernd

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

clear mesh does not work for Netgen meshes anymore

Postby bernd » Wed Jan 09, 2019 11:34 am

see title, file attached ...

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15572 (Git)
Build type: Release
Branch: master
Hash: ab1f4c442d443adae106a2ea1ed877f33db86154
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Switzerland (de_CH)

clear_mesh.FCStd
(25.8 KiB) Downloaded 10 times

Edit: see post for Python code to do the above: https://forum.freecadweb.org/viewtopic. ... 83#p279183
fandaL
Posts: 338
Joined: Thu Jul 24, 2014 8:29 am

Re: clear mesh does not work for Netgen meshes anymore

Postby fandaL » Wed Jan 09, 2019 1:29 pm

Cleaning Box_Mesh does not work for

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15252 (Git)
Build type: Release
Branch: master
Hash: 652e1dbdd0fb74f1d3df8034254281df9c24aae6
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Czech/CzechRepublic (cs_CZ)


But it works for older version

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14993 (Git)
Build type: Release
Branch: master
Hash: 1e6818b6fbf86ad08d8fc85252dddcae8891dd54
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Czech/CzechRepublic (cs_CZ)
looo
Posts: 2821
Joined: Mon Nov 11, 2013 5:29 pm

Re: clear mesh does not work for Netgen meshes anymore

Postby looo » Wed Jan 09, 2019 3:39 pm

stupid question:
how to clear/clean a mesh?
User avatar
bernd
Posts: 8330
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: clear mesh does not work for Netgen meshes anymore

Postby bernd » Wed Jan 09, 2019 3:45 pm

looo wrote:
Wed Jan 09, 2019 3:39 pm
stupid question:
how to clear/clean a mesh?
activae FEM workbench. Select the mesh in tree view, clear mesh. If you use german FreeCAD it is translated with Netz löschen, which is wrong.
User avatar
bernd
Posts: 8330
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: clear mesh does not work for Netgen meshes anymore

Postby bernd » Thu Jan 10, 2019 8:41 am

something must have been changed in FreeCADs recomputes ...

Code: Select all

import Fem
FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever3D.FCStd')
App.ActiveDocument.Box_Mesh.FemMesh = Fem.FemMesh()
works great, teh mesh is cleared, but as soon as the document is recomputed by

Code: Select all

App.ActiveDocument.recompute()
the mesh appears again.

A workaround would be to comment this line: https://github.com/FreeCAD/FreeCAD/blob ... ds.py#L528

But the problem is at a recompute the Shape will be remeshed immediately which could go for a looooong time and thus the user has to kill FreeCAD because this is not what the user wants probaly. It should be possible to mark the mesh if it should be meshed on next recompute or not.

bernd
wmayer
Site Admin
Posts: 14782
Joined: Thu Feb 19, 2009 10:32 am

Re: clear mesh does not work for Netgen meshes anymore

Postby wmayer » Thu Jan 10, 2019 11:52 am

There were some problems with the old recompute mechanism where features could be set as touched but the tree view didn't show this with the overlay icon. This is because the mustExecute was not correctly implemented or not implemented at all. Then a regression was introduced with v0.17 where objects are superfluously recomputed and thus took a lot of time.

Thus, the recompute mechanism has been reworked to be more robust against possible incorrect implementations of module feature and to reduce superfluous recomputes.

The misbehaviour in FEM now just demonstrates that things work as expected. :D

To restore the old behaviour you only have to change a single line:
In FemMeshObject.cpp declare FemMesh not as Prop_None but as Prop_NoRecompute or Prop_Output.
User avatar
bernd
Posts: 8330
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: clear mesh does not work for Netgen meshes anymore

Postby bernd » Tue Jan 15, 2019 11:49 am