Personal tools
You are here: Home Forum Other... (new forum, problems, etc.) Re: How to get Object's ID

Re: How to get Object's ID

Up to Other... (new forum, problems, etc.)

Re: How to get Object's ID

Posted by Irfan Basha at January 14. 2012
Hi all, 
I want to write the python code which does exactly the same thing as creating groups on object. And the code works if the Group is of type FACE or EDGE, but if the type is of SOLID, I am not able to proceed because I am not able to get the ID's of the selected objects. 
Does any one know how to get the ID of the Object ? (I can get the Id of EDGE, VERTEX etc, but not able to get the Id of complete object) 
I have attached the image... In which you can see that I am trying to create a group of type solid, and I have selected a object (Cylinder). And when I click add, a number 36 gets added to the list. (That is the Object ID. I want to know how I can get that ID)

Re: How to get Object's ID

Posted by DAVID Gilles at January 14. 2012


If you have only 1 solid on your compound, you can use the function SubShapeAllIDs:

ids = geompy.SubShapeAllIDs(shape,geompy.ShapeType["SOLID"])
group = geompy.CreateGroup(shape, geompy.ShapeType["SOLID"])

But if you intend to create groups of shapes in script, I advise you not to rely on Ids of the sub-shapes, but on the functions of type GetShapesOnXXX, GetSame, GetInPlace, on so on...  Indeed the ids are not guaranteed to be identical from a version to another of Salome. Instead the mentioned functions are based on geometrical criteria.



Quick reply
URLs will be automatically hyperlinked. Basic HTML tags are OK.
Powered by Ploneboard
Activate by Irfan Basha on Jan 14, 2012 11:46 AM
Document Actions