]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROTools/hydroGeoMeshUtils.py
Salome HOME
introducing test on mesh extension, with resources generated first
[modules/hydro.git] / src / HYDROTools / hydroGeoMeshUtils.py
1 import sys
2 import salome
3
4 salome.salome_init()
5
6 def getChildrenInStudy(obj):
7     """
8     Given an object published in SALOME study (for instance a GEOM object), retreive its children.
9     return a dictionary [name] --> object
10     """
11     SO = salome.myStudy.FindObjectIOR(salome.myStudy.ConvertObjectToIOR(obj))
12     childIterator = salome.myStudy.NewChildIterator(SO)
13     children = {}
14     while childIterator.More():
15         childItem = childIterator.Value()
16         print("item", childItem)
17         itemName = childItem.GetName()
18         itemID = childItem.GetID()
19         itemObj = salome.IDToObject(str(itemID))
20         children[itemName] = itemObj
21         childIterator.Next()
22     return children