STEP and Shape names


I'm reading a step file with OC Step support libraries.
I read a TopoDS_Shape that represent all my assembly. This TopoDS_Shape is a Compound object because it is made of other TopoDS_Shape objects. Each sub TopoDS_Shape has a correspondent product in the STEP file, how can I get the STEP file product's name associated with that TopoDS_Shape?


Patrik Mueller's picture


take a look at the file "STEPCAFControl_Reader.cxx". There's a function called "ReadNames". Perhaps this can help - or use XDE.

Best regards,

Patrik Müller

Paolo Mosna's picture

Now I have a different problem.
I'm able to retrieve the list of TDF_Label associated with the shapes in the STEP file, but how can I find which TDF_Label is associated with the main compound shape that contains all the other sub shapes?


Hamri's picture

does this function it need the parameters such as :ReadNames (Handle(XSControl_WorkSession) &WS, Handle(TDocStd_Document)& Doc, STEPCAFControl_DataMapOfSDRExternFile&SDRFileMap,
const STEPCAFControl_DataMapOfShapeLabel &ShapeLabelMap) .
which is the significance of these parameters, and how to use this function to read
the name of each subshape thus attached the dats with the subshape.

Patrik Mueller's picture


depends on your implementation - if you use XDE - XDE does all the naming - if you have to do it by yourself this routine shows you how to do! Using it without XDE doesn't make so much sense because you have to include OCAF and XDE stuff to your project.
For using the XDE functions look at the CDL files in STEPCAFControl (or IGESCAFControl) or look at the PDF file for XDE.



Raffaele Cafiero's picture

Hi, I do have the same problem. Unfortunately the function ReadNames is protected. It cannot be accessed from outside the STEPCAFControl_Reader object. That is what the compiler tells me. I think it is an internal function invoked by the ReadFile public function. :( Any other solution?
Best Regards
Raffaele Cafiero

shantanu kumar das's picture

Dear Sir;

I have the same problem with reading the part names from step file. 


ez.david.lee_156528's picture

take for reference, 

TDF_LabelSequence frshapes;



Handle(TDataStd_Name) N;

if ( !aLabel.FindAttribute(TDataStd_Name::GetID(),N)) {

// no name is attached


TCollection_ExtendedString name = N->Get();

2265636806_166500's picture


    if no name is attached, how to add name to a face and then write to STEP file.