Display ResultMesh not Updated

About the development of the FEM module/workbench.

Moderator: bernd

UR_
Posts: 1147
Joined: Tue Jan 03, 2017 8:42 pm

Display ResultMesh not Updated

Post by UR_ » Thu Dec 26, 2019 10:12 am

Display of result mesh isn't updated correctly.


workflow:
load cantilever3D example from FreeCAD's start page
set ResultMesh Transparency to 50%
set checkbox: Edit->Preferences->FEM->General->Restore result dialog settings
open task panel "CCX_Results"
select radio button "Abs displacement"

view not updated :(
Screenshot 004.png
Screenshot 004.png (28.31 KiB) Viewed 311 times

exit task panel and reopen :)
Screenshot 002.png
Screenshot 002.png (46.98 KiB) Viewed 311 times

But updating view should work like it works if transparency is set to zero
i.e.: immediately



OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19055 (Git)
Build type: Release
Branch: master
Hash: 0af2e760a154ceb08ac2b7230b8ab93e6a20e364
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
UR_
Posts: 1147
Joined: Tue Jan 03, 2017 8:42 pm

Re: Display ResultMesh not Updated

Post by UR_ » Mon Dec 30, 2019 5:04 pm

bernd wrote: :bell:
Hi bernd,
any thoughts about this :?
User avatar
bernd
Posts: 8959
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Display ResultMesh not Updated

Post by bernd » Tue Dec 31, 2019 11:44 am

no computer around, no FreeCAD on my mobil, but would be worth a try. Since it is sailfish it should be doable. :mrgreen:
User avatar
bernd
Posts: 8959
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Display ResultMesh not Updated

Post by bernd » Fri Jan 03, 2020 10:36 pm

UR_ wrote:
Thu Dec 26, 2019 10:12 am
load cantilever3D example from FreeCAD's start page
set ResultMesh Transparency to 50%
set checkbox: Edit->Preferences->FEM->General->Restore result dialog settings
open task panel "CCX_Results"
select radio button "Abs displacement"
For me it is the other way around ...

load cantilever3D example from FreeCAD's start page
set ResultMesh Transparency to 50%
unset checkbox: Edit->Preferences->FEM->General->Restore result dialog settings
open task panel "CCX_Results"
select radio button "Abs displacement"

than the result view does not work as expected ... But this is even more strange ...

OS: Debian GNU/Linux 10 (buster) (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19129 (Git)
Build type: Unknown
Branch: master
Hash: 3c3e946f752c25d834e4d2d9aa3a057642a890be
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Switzerland (de_CH)
User avatar
bernd
Posts: 8959
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Display ResultMesh not Updated

Post by bernd » Fri Jan 03, 2020 11:05 pm

Just to be sure it works at all ...

Code: Select all

# load file and get objects
import FreeCAD
app_home = FreeCAD.ConfigGet("AppHomePath")
doc = FreeCAD.open(app_home + "data/examples/FemCalculixCantilever3D.FCStd")
doc.Pipeline.Visibility = False
doc.WarpVector.Visibility = False
resdata = doc.CalculiX_static_results
resmesh = doc.Result_mesh


# reset result mesh, but use Transparency 50
resmesh.Visibility = True
resmesh.ViewObject.Transparency = 50
resmesh.ViewObject.applyDisplacement(0)
resmesh.ViewObject.NodeColor = {}
resmesh.ViewObject.ElementColor = {}
node_numbers = list(resmesh.FemMesh.Nodes.keys())
zero_values = [0] * len(node_numbers)
resmesh.ViewObject.setNodeColorByScalars(node_numbers, zero_values)

# set abs displacement color
resmesh.ViewObject.setNodeColorByScalars(resdata.NodeNumbers, resdata.DisplacementLengths)


Screenshot_20200104_000319.png
Screenshot_20200104_000319.png (279.68 KiB) Viewed 188 times
User avatar
bernd
Posts: 8959
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Display ResultMesh not Updated

Post by bernd » Fri Jan 03, 2020 11:06 pm

means problem seams inside the Task Panel ... https://github.com/FreeCAD/FreeCAD/blob ... al.py#L119
User avatar
bernd
Posts: 8959
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Display ResultMesh not Updated

Post by bernd » Fri Jan 03, 2020 11:53 pm

found something strange ...

load example and set transparent result

Code: Select all

# load file and get objects
import FreeCAD
app_home = FreeCAD.ConfigGet("AppHomePath")
doc = FreeCAD.open(app_home + "data/examples/FemCalculixCantilever3D.FCStd")
doc.Pipeline.Visibility = False
doc.WarpVector.Visibility = False
resdata = doc.CalculiX_static_results
resmesh = doc.Result_mesh

# reset result mesh, but use Transparency 50
resmesh.Visibility = True
resmesh.ViewObject.Transparency = 50
resmesh.ViewObject.applyDisplacement(0)
resmesh.ViewObject.NodeColor = {}
resmesh.ViewObject.ElementColor = {}
node_numbers = list(resmesh.FemMesh.Nodes.keys())
zero_values = [0] * len(node_numbers)
resmesh.ViewObject.setNodeColorByScalars(node_numbers, zero_values)

# set abs displacement color
resmesh.ViewObject.setNodeColorByScalars(resdata.NodeNumbers, resdata.DisplacementLengths)
set transparency and reset result

Code: Select all

# reset result mesh, use Transparency 0
resmesh.Visibility = True
resmesh.ViewObject.Transparency = 0
resmesh.ViewObject.applyDisplacement(0)
resmesh.ViewObject.NodeColor = {}
resmesh.ViewObject.ElementColor = {}
node_numbers = list(resmesh.FemMesh.Nodes.keys())
zero_values = [0] * len(node_numbers)
resmesh.ViewObject.setNodeColorByScalars(node_numbers, zero_values)
set transparency will get the abs displacement color back ...

Code: Select all

# set Transparency to 50
resmesh.ViewObject.Transparency = 50
User avatar
bernd
Posts: 8959
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Display ResultMesh not Updated

Post by bernd » Fri Jan 03, 2020 11:54 pm

it seams a real result mesh reset has to be done for transparency == 0 and transparency > 0

Code: Select all

# reset result mesh
resmesh.Visibility = True
resmesh.ViewObject.applyDisplacement(0)
# reset for some transparency
resmesh.ViewObject.Transparency = 1
resmesh.ViewObject.NodeColor = {}
resmesh.ViewObject.ElementColor = {}
node_numbers = list(resmesh.FemMesh.Nodes.keys())
zero_values = [0] * len(node_numbers)
resmesh.ViewObject.setNodeColorByScalars(node_numbers, zero_values)
# reset for no transparency
resmesh.ViewObject.Transparency = 0
resmesh.ViewObject.NodeColor = {}
resmesh.ViewObject.ElementColor = {}
node_numbers = list(resmesh.FemMesh.Nodes.keys())
zero_values = [0] * len(node_numbers)
resmesh.ViewObject.setNodeColorByScalars(node_numbers, zero_values)
User avatar
bernd
Posts: 8959
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Display ResultMesh not Updated

Post by bernd » Sun Jan 05, 2020 11:10 pm

Another strange one.

- start FreeCAD
- open FEM 3D canitlever example
- Make the result mesh visible (the child of result object !) --> the mesh is orange
- Double click on result object --> result task panel opens
- close result task panel
- setNodeColorByScalars has been run on zero values thus --> the mesh is green
- the above overwrites the ShapeColor
- it is more possible to change the Color of the mesh

OS: Debian GNU/Linux 10 (buster) (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19129 (Git)
Build type: Unknown
Branch: master
Hash: 3c3e946f752c25d834e4d2d9aa3a057642a890be
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Switzerland (de_CH)
User avatar
bernd
Posts: 8959
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Display ResultMesh not Updated

Post by bernd » Sun Jan 05, 2020 11:27 pm

bernd wrote:
Sun Jan 05, 2020 11:10 pm
Another strange one.

- start FreeCAD
- open FEM 3D canitlever example
- Make the result mesh visible (the child of result object !) --> the mesh is orange
- Double click on result object --> result task panel opens
- close result task panel
- setNodeColorByScalars has been run on zero values thus --> the mesh is green
- the above overwrites the ShapeColor
- it is more possible to change the Color of the mesh
this https://github.com/FreeCAD/FreeCAD/blob ... al.py#L649 would solve the above, and should solve the problem with resetting transparent and non transparent too.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests