How to manage external references in STEP file ?

I wrote a code that correctly retrieve shapes from a single STEP file, see below. But it fails for a file including external references. It actually finds some shapes but it seems that they do not contain any faces. Do I need to do something special to get this case work or would it be fine ?

Thanks in advance.

Bool OCCImport::loadStep(const String& p_Filename)
{
// Initialize a STEP reader
STEPCAFControl_Reader l_Reader;

// Read the file
Int l_Status = l_Reader.ReadFile(Standard_CString(p_Filename.c_str()));

// check if file reading is successful
if (l_Status != IFSelect_RetDone)
{
OREALIA_LOG_WARN("Error while loading file " + p_Filename);
return false;
}

// Create the target document
XCAFApp_Application::GetApplication()->NewDocument("MDTV-XCAF", m_Document);

// Translate the shapes from STEP to OCC
if (!l_Reader.Transfer(m_Document))
{
OREALIA_LOG_WARN("Error while converting file " + p_Filename);
XCAFApp_Application::GetApplication()->Close(m_Document);
m_Document.Nullify();
return false;
}

// Get the top-level free shapes
loadShapes();
return true;
}

void OCCImport::loadShapes()
{
Handle (XCAFDoc_ShapeTool) l_ShapeTool = XCAFDoc_DocumentTool::ShapeTool(m_Document->Main());

// Get the top-level free shapes
TDF_LabelSequence l_ShapeLabels;
l_ShapeTool->GetFreeShapes(l_ShapeLabels);

for (UInt i = 1 ; i {
// Get current shape label
TDF_Label l_Label = l_ShapeLabels.Value(i);
// Get the shape according to current shape label
TopoDS_Shape l_Shape = l_ShapeTool->GetShape(l_Label);

// Add current shape and its label to shape list
m_Shapes[l_Label] = l_Shape;
}
}

claustres's picture

OK, I've just found the bug : external references are not correctly managed when the input file is a network path such as "\\Server1\STEP\bc_9078_bcp_18-14-xc-ba_asm.stp" under Windows (I did not test other OS).

Maybe there is something to setup in OCC to manage this specific case or do I need to send a bug report via your Contact Form at http://www.opencascade.org/about/contacts/ ?