hi, every one, I Ihave some questions to ask you guys! I use OCAF to read Igs File, some problem occured when i get the name of TDF_Label. if aLabel is not Assembly,the name can Get correctly, if aLabel is subLabel, the name get is display like "=>[0:1:1:5]", so I am confused, hope someone can help me,Thanks in advance! here the code and igs file attachment as follow:
BOOL REx3dDoc::ReadIgs(LPCTSTR lpszFile)
{
USES_CONVERSION;
Standard_CString strFileName = T2A(lpszFile);
IGESCAFControl_Reader Reader;
IFSelect_ReturnStatus readstatus = Reader.ReadFile(strFileName);
if (readstatus != IFSelect_RetDone) {
return FALSE;
}
//transfer doc
if (!Reader.Transfer(m_myStdDoc)) {
return FALSE;
}
//Get Shape Tool
m_myAssembly = XCAFDoc_DocumentTool::ShapeTool(m_myStdDoc->Main());
TDF_LabelSequence labels;
m_myAssembly->GetShapes(labels);
Standard_Integer iLen = labels.Length();
for (Standard_Integer i=1; i<=iLen; i++)
{
TDF_Label aLabel = labels.Value(i);
CollectShapeInfo(aLabel);
}
}
void REx3dDoc::CollectShapeInfo(TDF_Label aLabel)
{
if (m_myAssembly->IsAssembly(aLabel))
{
TDF_LabelSequence subLabels;
m_myAssembly->GetComponents(aLabel, subLabels);
int iLen = subLabels.Length();
for (Standard_Integer i=1; i<=iLen; i++)
{
TDF_Label subLabel = subLabels.Value(i);
CollectShapeInfo(subLabel);
}
}
else
{
//Get label name
Handle(TDataStd_Name) N;
if (!aLabel.FindAttribute(TDataStd_Name::GetID(), N)){
return;
}
TCollection_ExtendedString name = N->Get();
//if aLabel is not Assembly,the name can Get correct, if aLabel is subLabel, the name is display like "=>[0:1:1:5]", i am so confused.
CString sName = name.ToWideString();
}
}