Naming a face

Is it possible to provide a name for a face? Or in other words, how the face can be connected to a label?

Jawa's picture

As far as I know, you can't name a face, but face's hash codes (TopoDS_Shape::HashCode()) should be a good alternative...

Eric

ninja's picture

I am afraid that the hashcode is not the best, because I need something which is not changed during fuse and cut operations.

Jawa's picture

In this case, either use OCAF (but it may be a bit complicated to handle just a name !) or create your own data structure that contains faces and associated names...

Eric

ninja's picture

Using OCAF is an acceptable choice, but I do not know how this problem could be solved with it.

ninja's picture

I could give a name to a face and the face could be retrieved by the name. But how the name could be retrieved based on the face? And unfortunatelly, the original face could be provided even after cutting the face, despite of the statement of the OCAF users guide chapter 5.

gene's picture

I would like to do the same thing...

I'm presently trying to understand the OCAF shape attributes...

If i found something i'll let you know.

Genevieve

maverick's picture

Well this is somehow related to my question !

You should use a STL map for doing this either using the name or the shape has a key.

Would it fit your need ?

mv

ninja's picture

Meanwhile I could name a face, it is very easy using the TNaming_Builder class. But after a boolean operation the programmer should take care of the consistency between the labels and the associated shapes. So if you have a face which is devided to 2 faces during a boolean operation, the 2 faces do not get the label of the original face as I expected earlier.

x-lhomme's picture

Hi

I have the same probleme than you .
I need to name each Face and each Edge
of my shape to associate them some attribute.

It would be nice, iif we could store some little example on this web site

maverick's picture

yop, but then what is the info you need to retrieve ?

Imagine that for each TopoDS_Shape you associate an attribute. Then having a shape you want the attribute back ? or having the attribute you want the shape back ? or both ?

mv

x-lhomme's picture

Hi
I want to store on a database some attribut associated with each face and each edge.

Then I need to map a Face with an ID. I could use the HachCode but the HachCode change if a translate/scale my objet.
Then it's better to use OCAF and named each Face and each Edge. But It doesn't seems to be easy beceause you need to store each Face in the document instead of storing the solid itself.

xavier_lhomme's picture

I need both : when a I the Face I need it's attribut (ID)

and when I have the attribut (ID)I ant the face back

maverick's picture

Hi,

Do you just want to attach some attribute to a shape and then retrieving this info
later on from a shape. Or would you like to get from an attribute its shape ?

mv