Personal tools
You are here: Home Forum Use Name of object

Name of object

Up to Use

Name of object

Posted by mihe at Wednesday 01:12

 

Hi,

- how han i find out the name of a geometri object, e.g a face without publishing the face in the gui and usling getname()

-how do i find out what attributes that a objekt has?

 

BR/Micke 

Re: Name of object

Posted by mihe at Wednesday 16:16

To describe more in detail:

-I have a script that I run from the Gui File+Load script. The script works with names of solids, faces, edges and vertices. So far to access those names I publish the objects  geompy.addToStudyInFather() and then access the names with object[i].GetName(). The problem is that geompy.addToStudyInFather() publish each objects one at a time  in a for loop and it takes a very long time to run through all objects. In the end I am only interested in objects with certain names so the code would run much faster if I could access the names without the need to publish the object. After that I would then publish the objects that I am interested in.

So: - how kan I find out the name of a object, e.g a face, without publishing the face first? -is it possible? -Are there other ways to do what I want?


Regarding my second question:  For example if I use objects = geompy.ExtractShapes(...). How do I find out available methods/attributes that can be used on/retrieved from the objects[i] ? -Is there a  description in the documentation? -Is there some function that can list whet options that are available?.

For example:

objects[0].GetName() => the name -OK

but:

objects[0].GetAllAttributes() =>  "  AttributeError: _objref_GEOM_Object instance has no attribute 'GetAllAttributes' "

BR/Micke

Re: Name of object

Posted by Saint Michael at Wednesday 18:08

Hi Micke

If you use names that come from STEP file import, I suspect there is no other way than publishing a GEOM object.

To get object attributes, use usual Python way: dir( objects[0] )

Note the difference between a GEOM object and a study object (SALOMEDS.SObject) which holds a GEOM object. Try also:

dir( salome.ObjectToSObject( objects[0] ))

See docs here http://docs.salome-platform.org/latest/gui/GEOM/geompy_page.html

St.Michael

Powered by Ploneboard
Document Actions