Personal tools
You are here: Home Forum Extension of the platform Get mesh names in a study

Get mesh names in a study

Up to Extension of the platform

Get mesh names in a study

Posted by DT at July 15. 2019

Hello,

I would like to get the names of all meshes in a study.

I have found this method: smesh.GetMeshNames(), but it requires a string argument. What should be that string?

Thank you for your help,

DT

Re: Get mesh names in a study

Posted by Nabil Ghodbane at July 16. 2019

Hi,

a similar question was raised some time ago and a solution was posted:

https://www.salome-platform.org/forum/forum_10/725619627

I tried it with two Mesh objects in release 9.3 and it works quite nicely:

 

smeshComp = salome.myStudy.FindComponent("SMESH")

from salome.smesh import smeshBuilder

smesh =  smeshBuilder.New()

iterator = salome.myStudy.NewChildIterator( smeshComp )

while iterator.More():

  sobj = iterator.Value()

  iterator.Next()

  if hasattr( sobj.GetObject(), "NbNodes" ): 

     print("Mesh =",smeshBuilder.GetName(sobj))

 

HTH

 

Re: Get mesh names in a study

Posted by DT at July 17. 2019

Thanks, it works perfectly. Obviously I was careless with searching on the forum, even if, I found the referenced topic...:)


DT

 

Powered by Ploneboard
Document Actions