Hello @NabilG I am realizing that this is not working anymore for me, and not sure why.
I have on the geom object browser the following:
as you can see it has ‘Group_1’ and ‘defaultFaces’
then in python i am doing:
allGroups=geompy.GetGroups(compound_2ndGen)
#then if i list my objects (input for future findObjectByPath)
['/Geometry/' + compound_2ndGen.GetName() + '/' + group.GetName() for group in allGroups]
#i am getting the following output:
['/Geometry/compound_2ndGen/ group of blocks [BRICKS]', '/Geometry/compound_2ndGen/Quadrangle or Faux-quadrangle group', '/Geometry/compound_2ndGen/Propagation group [0]', '/Geometry/compound_2ndGen/Propagation group [1]', '/Geometry/compound_2ndGen/Propagation group [2]', '/Geometry/compound_2ndGen/ Propagation group [0] [DIRECTION 0]', '/Geometry/compound_2ndGen/ Propagation group [1] [DIRECTION 0]', '/Geometry/compound_2ndGen/ Propagation group [2] [DIRECTION 0]', '/Geometry/compound_2ndGen/ block [0] [BRICK]', '/Geometry/compound_2ndGen/Group_1', '/Geometry/compound_2ndGen/defaultFaces']
#nevertheless when I do:
[ salome.myStudy.FindObjectByPath('/Geometry/' + compound_2ndGen.GetName() + '/' + group.GetName() ) for group in allGroups]
#the output is the following
[<SALOMEDS._objref_SObject object at 0x710761aadf40>, <SALOMEDS._objref_SObject object at 0x71072ffdbd00>, <SALOMEDS._objref_SObject object at 0x71072ffdbf10>, <SALOMEDS._objref_SObject object at 0x710740023880>, <SALOMEDS._objref_SObject object at 0x710740243a60>, <SALOMEDS._objref_SObject object at 0x7107402430a0>, <SALOMEDS._objref_SObject object at 0x710740243250>, <SALOMEDS._objref_SObject object at 0x71072ffc7310>, <SALOMEDS._objref_SObject object at 0x71072ffc7640>, None, <SALOMEDS._objref_SObject object at 0x71072ffc7160>]
as you can see in the element [-2] of the last output the return of the list comprehension is None, where it should not be, as it exist in the object browser. the creation of the object Group_1 i am doing it during the python script to be precise it is too long and to complex to post it. I am missing something? or how could i do it?
to be more clear about this:
I am constructing programatically the specific groups, and I pause my script (wait for user input) where he/she can edit, for example the names of the current groups, create new ones and also delete the existing ones if desired, (by selecting a group and pressing supr key). once finished the user hits continue and the script follow up.
never the less, i want to recover all the groups on my object, so I am using the code that i posted here, but the allGroups will get not only the ones that are showing (including the newly created ones) but also the ones that where deleted. and I want to ensure myself that i am only keeping the ones that ‘ARE’ in the object broser, (so the newly created but not the ones deleted).