Looking entities indexes and names from a step import


I need to build a tree from the TopoDS_Shape loaded from a step import.
For each leave, I need to get the entities types (done with childShape.ShapeType()), and the index and name of the entity that was stored within the step file, as, for example:

#5=PRODUCT('Product1','','',(#2)) ;
#54=PRODUCT('Part1','','',(#2)) ;
#229=PRODUCT('Part2','','',(#2)) ;

with, for example:
index = "#5"
name = "'Product1'"

I am wondering if those fields are mapped into an OpenCASCADE structure when importing step files, and how to access them.

Thank you very much in advance,

Nicolas Berron.

Francesco Argese's picture


I'm searching the same thing.

Is there a manner to retrieve name of a shape through XDE? I have loaded a .stp file but I am able only to retrieve label names.

I have read in the xde.pdf document (page 12) that

"Name is implemented and used as a TDataStd_Name, which can be attached to any label. Before proceeding, consider that:
• In IGES, every entity can have a name with an optional numeric part called a Subscript Label. For example, "MYCURVE" is a name, and "MYCURVE(60)" is a name with a Subscript Label.
• In STEP, there are two levels: Part Names and Entity Names:
Part Names are attached to "main shapes" such as parts and assemblies. These Part Names are specifically supported by XDE.
Entity Names can be attached to every Geometric Entity. This option is rarely used, as it tends to overload the exploitation of the data structure. Only some specific cases justify using this option: for example, when the sending system can really ensure the stability of an entity name after each STEP writing."

How is possible to use this last option? I have not found it neither on the documentation nor on the forum.

Thanks in advance,

Francesco Argese's picture

I have resolved in this manner:

1) I retrieve label from shape
2) I retrieve name from label at point one


Hennig's picture

Hallo Francesco,

do you know if you get only the names from entities which are TopoDS or also from entities which are geom based, like a CARTESIAN_POINT. Is it possible to give an example from your code?

I am faced with the same problem...
Thanks in advance