STEP and Shape names

Hi,

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?

Thanks.

Patrik Mueller's picture

Hi,

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?

Thanks.

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.
Thank's

Patrik Mueller's picture

Hm,

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.

Regards,

Patrik

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. 

DO YOU HAVE ANY SOLUTION?

david lee's picture

take https://dev.opencascade.org/doc/overview/html/occt_user_guides__xde.html#occt_xde_2_1_1 for reference, 

TDF_LabelSequence frshapes;

myAssembly->GetShapes(frshapes);

...

Handle(TDataStd_Name) N;

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

// no name is attached

}

TCollection_ExtendedString name = N->Get();

魏涛 魏's picture

Hi:

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

jason jiang's picture

Hi,
It seem that I have same question.after Import STEP file and show 3D graph by OCC,I choose a Face or Wire.then want to find the ID and other information from Step file,what is the way to do it?could you give me sample C++ code?
Thanks
Jason.Jiang