Eigenmode frequency always 0?

About the development of the FEM module/workbench.

Moderator: bernd

wmayer
Founder
Posts: 20203
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Eigenmode frequency always 0?

Post by wmayer »

For some reason, the Eigenmode frequency field (in the "Data" tab) is editable for me and it is always set to 0,00.
When loading the project on Windows I have the same issues.
file = '/tmp/Revolution_Mesh.dat'
Is it supposed to create this file when loading the project? If so, then we have a problem because on Windows there is no directory "/tmp". Furthermore, the WorkingDir property better shouldn't be stored to the project file but should be set internally.
For some reason, scrolling Data Tab is laggy, while View Tab is not.
The problem is that the properties NodeNumbers, DisplacementLength and StressValue show >50,000 values which takes quite some time to create a string for. The property editor could be changed to show only let's say the first 10 values and only show all of them when requested by the user.
Btw, is the user actually supposed to change these properties or should they be read-only or even hidden?
wmayer
Founder
Posts: 20203
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Eigenmode frequency always 0?

Post by wmayer »

git commit 33c9c02 limits the lists to 10 elements
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Eigenmode frequency always 0?

Post by bernd »

wmayer wrote:
For some reason, the Eigenmode frequency field (in the "Data" tab) is editable for me and it is always set to 0,00.
When loading the project on Windows I have the same issues.
should be fixed with https://github.com/FreeCAD/FreeCAD/comm ... af0db488ad attaced a much simpler file to test with.

OS: Windows XP
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.6045 (Git)
Build type: Release
Branch: master
Hash: e305f079d0cfe83d388c5f62ca4dcc7c6777099f
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a

wmayer wrote:
file = '/tmp/Revolution_Mesh.dat'
Is it supposed to create this file when loading the project? If so, then we have a problem because on Windows there is no directory "/tmp". Furthermore, the WorkingDir property better shouldn't be stored to the project file but should be set internally.
The file is one of the results files created by CalculiX in the workindirectory
wmayer wrote:
For some reason, scrolling Data Tab is laggy, while View Tab is not.
The problem is that the properties NodeNumbers, DisplacementLength and StressValue show >50,000 values which takes quite some time to create a string for. The property editor could be changed to show only let's say the first 10 values and only show all of them when requested by the user.
Btw, is the user actually supposed to change these properties or should they be read-only or even hidden?
At the moment I do not know a use case for changeing this values by the user.
Attachments
box-freq.FCStd
(159.02 KiB) Downloaded 117 times
wmayer
Founder
Posts: 20203
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Eigenmode frequency always 0?

Post by wmayer »

should be fixed with https://github.com/FreeCAD/FreeCAD/comm ... af0db488ad attaced a much simpler file to test with.
With your file I get values <> 0.
At the moment I do not know a use case for changeing this values by the user.
In the property editor we should take care to make fields read-only if the user is not supposed to edit them and even hide those he is not supposed to see.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Eigenmode frequency always 0?

Post by bernd »

wmayer wrote:
should be fixwartburgritered with https://github.com/FreeCAD/FreeCAD/comm ... af0db488ad attaced a much simpler file to test with.
With your file I get values <> 0.
You should get values > 0 for any model.
wmayer wrote:
At the moment I do not know a use case for changeing this values by the user.
In the property editor we should take care to make fields read-only if the user is not supposed to edit them and even hide those he is not supposed to see.
There seams a FreeCAD problem at reload for read only properties. As two examples take the Eigenmode Frequency of the FemResult Object or the Solver Type of the solver object (https://github.com/FreeCAD/FreeCAD/blob ... lix.py#L42). They both are read only at creation but after reloading a file they are not read only anymore. To be honest I have not been able to add any read only property by python in FreeCAD which stays read only after loading a saved file.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Eigenmode frequency always 0?

Post by bernd »

wmayer wrote:git commit 33c9c02 limits the lists to 10 elements
cool, thanks works great here. Makes the gui faster for huge models :D
wmayer
Founder
Posts: 20203
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Eigenmode frequency always 0?

Post by wmayer »

They both are read only at creation but after reloading a file they are not read only anymore. To be honest I have not been able to add any read only property by python in FreeCAD which stays read only after loading a saved file.
There are basically two ways of making an attribute read-only or hidden.

1. You can pass this to addProperty in the __init__function. When a property is conceptual supposed to be read-only or hidden this is the preferred way. The read-only/hidden attributes are stored inside the meta-information of a fcstd project. When loading the project file the attributes are automatically restored. However, when a property is read-only you can't modify it from Python any more.

2. With setEditorMode() you can change the behaviour in the property editor. But it's only a pure GUI thing and it doesn't affect the property itself. Usually this way is used to tmp. make a property read-only. So, this attribute is not stored in the project file and you have to restore it by yourself.
When loading a project an object's __init__ function won't be called but its __setstate__ function is called instead. So, it should work to call

Code: Select all

self.Object.setEditorMode("MyProperty", 1)
wmayer
Founder
Posts: 20203
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Eigenmode frequency always 0?

Post by wmayer »

The FEM result object is a C++ class https://github.com/FreeCAD/FreeCAD/blob ... ct.cpp#L38

There the attributes can be set inside the constructor. I hope git commit 1a8c643d50ba66d3357 is OK.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Eigenmode frequency always 0?

Post by bernd »

Thanks for the explanation.
wmayer wrote:The FEM result object is a C++ class https://github.com/FreeCAD/FreeCAD/blob ... ct.cpp#L38

There the attributes can be set inside the constructor. I hope git commit 1a8c643d50ba66d3357 is OK.
This will be 2. Read only for the PropertyEditor. It is what I would have been suggested for the result object. For the solver object I'm gone take the 1. version because this should really be read only and not be changed since it is taken from the class type of the object.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Eigenmode frequency always 0?

Post by bernd »

wmayer wrote:There are basically two ways of making an attribute read-only or hidden.

1. You can pass this to addProperty in the __init__function. When a property is conceptual supposed to be read-only or hidden this is the preferred way. The read-only/hidden attributes are stored inside the meta-information of a fcstd project. When loading the project file the attributes are automatically restored. However, when a property is read-only you can't modify it from Python any more.
How do I pass the setEditorMode directly in the addProperty method. I tried

Code: Select all

obj.addProperty("App::PropertyString", "SolverType", "Base", "Type of the solver").setEditorMode("SolverType", 1)
There seams no difference in coding to the Version2. Thus the property is not read only at file reload. See https://github.com/berndhahnebach/FreeC ... diff=split
Post Reply