I would like to report a possible problem about the use of the OpenCascade instruction XCAFDoc_ShapeTool::Expand( const TDF_Label &Shape ).
I wrote code to load an assembly step and navigate through the tree nodes in order to collect information about the assembly step childs.
Handle(XCAFDoc_ShapeTool) MyAssembly = XCAFDoc_DocumentTool::ShapeTool( occdoc->Main() );
MyAssembly->GetFreeShapes( free_shapes );
for ( Standard_Integer i = 1; i <= free_shapes.Length(); i++ )
TDF_Label root_i = free_shapes.Value( i );
if ( !MyAssembly->GetComponents( root_i, label_sequence ) ) MyAssembly->Expand( root_i );
It could be possible to encounter an object that it is not an assembly but, in this case,
I can use the instruction Expand to convert the node-shape to assembly object.
All it's OK the first time, the execution of the instruction is fast.
The problem arises if I try to load the same step file again.
In this second case the application is freezed inside the instruction Expand,
seems to be an infinite loop or some pending task not well closed the first time.
Only after some minutes the situation is unlocked.
I wrote the instruction MyAssembly->Delete(); at the end of my function, but the problem it's the same.
Is there something to reset to avoid the problem?