OpenCascade entities hash code vs an absolute identifier

maverick

Looking around for some CAD
I usally identify opencascade entities, faces - edges, by getting the hash code given by OpenCascade function. The problem is that hash code
is just valid only for a while. I se that you are using an identifier (ID) that seems to be absolute and valid forever. Is it possible to get this
identifier directly by some function of OpenCascade? Thank you
 

Quaoar

Administrator
Staff member
Use TopExp::MapShapes() to index your faces/edges/vertices first and then use the provided integers as persistent IDs.
 

eue

CAD practitioner
Use TopExp::MapShapes() to index your faces/edges/vertices first and then use the provided integers as persistent IDs.
Is it possible to make an absolute identifier for shape as well? like ElementID?
I have been using hashcode for AIS_Shape identification as well, but if myshape is changed then the ID changes.
 

Quaoar

Administrator
Staff member
Is it possible to make an absolute identifier for shape as well? like ElementID?
I have been using hashcode for AIS_Shape identification as well, but if myshape is changed then the ID changes.
Do you mean an identifier for the entire shape and not its subshapes? This would be application-specific. E.g., for OCAF/XDE users such an ID is an entry of the corresponding OCAF label. For your own data model, it can be whatever you want it to be. Are you working with assemblies?
 
Top