[Partially solved] Selected element identification in .inp file

About the development of the FEM module/workbench.

Moderator: bernd

EkaitzEsteban
Posts: 96
Joined: Wed Sep 12, 2018 1:31 pm

Re: [Help] Selected element identification in .inp file

Postby EkaitzEsteban » Thu Sep 27, 2018 6:56 am

bernd wrote:
Wed Sep 26, 2018 4:59 pm
remember volumes of the famous :mrgreen: cantilever starts with 149 thus

Code: Select all

Gui.getDocument("FemCalculixCantilever3D").getObject("Box_Mesh").Visibility=True
A=Gui.getDocument("FemCalculixCantilever3D").getObject("Box_Mesh")
A.ElementColor={149:(1,0,0)}
It seams if the element could not be colored all or non (which means all will be green) elements are colored. BTW the code ... https://github.com/FreeCAD/FreeCAD/blob ... #L178-L192 and https://github.com/FreeCAD/FreeCAD/blob ... #L631-L652



screen.jpg
Thank you bernd. it partially works.

Maybe I'm digging too much (sorry for my insistence), but I found another bugs or something that it is not compatible.

Here is a bug 1:
bug_elementColor.png
bug_elementColor.png (681.24 KiB) Viewed 192 times
The visibility changes If you select show inner true or show inner false. Volumes are partially showed...

Code: Select all

FreeCADGui.getDocument("FemCalculixCantilever3D").getObject("Box_Mesh").ShowInner = False
FreeCADGui.getDocument("FemCalculixCantilever3D").getObject("Box_Mesh").ShowInner = True
Here is a bug 2:

If you change the display mode to faces + wireframe + nodes

Code: Select all

FreeCADGui.getDocument("FemCalculixCantilever3D").getObject("Box_Mesh").DisplayMode = u"Faces, Wireframe & Nodes"
bug_nodes.PNG
bug_nodes.PNG (55.99 KiB) Viewed 192 times
Several nodes changes their color and not follows the Point color properties, e.g:

Code: Select all

FreeCADGui.getDocument("FemCalculixCantilever3D").getObject("Box_Mesh").PointColor = (0.33,0.33,1.00)
Here is a bug 3:

By changing the colors of the materials the cantilever beam becomes a superstar :P
bug_materials.png
bug_materials.png (332 KiB) Viewed 192 times
BTW I have another two question related with this visual handling options:

1-) How can I change the colors of more than one element at the same time? (I think it is not possible...)
2-) How can I return to the original colors of the mesh?

Thank you so much,

best regards,

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

Re: [Help] Selected element identification in .inp file

Postby bernd » Thu Sep 27, 2018 7:51 am

:shock: I knew it before ... The cantilever is the superstar :mrgreen: :lol:

try:

Code: Select all

A.ElementColor={149:(1,0,0), 150:(1,0,9)}
A.ElementColor={}
I will try to have a look at all your inputs ...
EkaitzEsteban
Posts: 96
Joined: Wed Sep 12, 2018 1:31 pm

Re: [Help] Selected element identification in .inp file

Postby EkaitzEsteban » Thu Sep 27, 2018 8:00 am

bernd wrote:
Thu Sep 27, 2018 7:51 am
:shock: I knwew it before ... The cantilever is ths superstar :mrgreen: :lol:

try:

Code: Select all

A.ElementColor={149:(1,0,0), 150:(1,0,9)} # Colored two elements
A.ElementColor={} # Returns to the original ones 
I will try to have a look at all your inputs ...
Awesone! Both code lines works perfectly ;)
EkaitzEsteban
Posts: 96
Joined: Wed Sep 12, 2018 1:31 pm

Re: [Help] Selected element identification in .inp file

Postby EkaitzEsteban » Thu Sep 27, 2018 2:59 pm

Hello,

Regarding the visualization of the elements from a mesh. I find another bug or mismatch.

I my mesh two elements are highlighed in red, solely when I selected one.
Bug_ElementColorTwoFaces.PNG
Bug_ElementColorTwoFaces.PNG (88.88 KiB) Viewed 175 times
I do the same in cantilever bean example and looks like correct.
CantileverColorsOK.PNG
CantileverColorsOK.PNG (46.96 KiB) Viewed 175 times
The differences between these two examples is that my box has more than one group (4 exactly), whereas in the cantilever beam the number of groups is 0.

Is there any mismatch here, between color elements and number of groups?

best regards,
Ekaitz.
User avatar
bernd
Posts: 7745
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: [Help] Selected element identification in .inp file

Postby bernd » Thu Sep 27, 2018 4:11 pm

It should not have to do with groups. Would you post your mesh an the the code to produce the problem?
EkaitzEsteban
Posts: 96
Joined: Wed Sep 12, 2018 1:31 pm

Re: [Help] Selected element identification in .inp file

Postby EkaitzEsteban » Fri Sep 28, 2018 6:26 am

bernd wrote:
Thu Sep 27, 2018 4:11 pm
It should not have to do with groups. Would you post your mesh an the the code to produce the problem?
Hi bernd,

Yes absolutely,

I make the following:

1-) open SimpleBox.FCStd
2-) Write in the python API: the following code

Code: Select all

Gui.ActiveDocument.getObject("FEMMeshGmsh").ElementColor={59:(1,0,0)}
Two different faces are highlighted in red.

Furthermore, I select node 16 which is solely in one element: 59. I double check the position of this node that in the .inp file ['59, 26, 41, 8, 6, 59, 45, 30, 27, 44, 16\n'] --> element 59 is a tetra10 C3D10 type element where the nodes on the 4 vertex of the tetrahedron are 26, 41, 8, 6 respectively, whereas intermediate nodes are the following 6: 59, 45, 30, 27, 44, 16 (The selected one!!!)

So, I guess that element 59 should be highlighted in red, but this is not the case... :cry:

I attach a simple figure of my problem:
ElementNodeBug.PNG
ElementNodeBug.PNG (96.88 KiB) Viewed 160 times
best regards,
Ekaitz.
Attachments
SimpleBox.FCStd
(9.31 KiB) Downloaded 5 times
User avatar
bernd
Posts: 7745
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: [Help] Selected element identification in .inp file

Postby bernd » Fri Oct 05, 2018 4:48 am

issue #3624 I'm quite busy ATM, means I did not have the time to have a look at this. Furthermore it is not that easy to tackle down problems in the mesh view provider for me. It takes some time to get into it. I made an issue to keep the problems.

bernd
EkaitzEsteban
Posts: 96
Joined: Wed Sep 12, 2018 1:31 pm

Re: [Help] Selected element identification in .inp file

Postby EkaitzEsteban » Fri Oct 05, 2018 6:05 am

bernd wrote:
Fri Oct 05, 2018 4:48 am
issue #3624 I'm quite busy ATM, means I did not have the time to have a look at this. Furthermore it is not that easy to tackle down problems in the mesh view provider for me. It takes some time to get into it. I made an issue to keep the problems.

bernd
Thank you bernd.

The possibility to select nodes is enough for my project (we got it :lol: ). The colors of the elements is only for enhancing the visualization, it is not vital for my project. If it is possible to improve the visualization in future versions of FreeCAD, it would be awesome!

best regards,
Ekaitz.