diff --git a/src/XCAFDoc/XCAFDoc_AssemblyGraph.cxx b/src/XCAFDoc/XCAFDoc_AssemblyGraph.cxx index ec03e400c3..d25e6d048f 100644 --- a/src/XCAFDoc/XCAFDoc_AssemblyGraph.cxx +++ b/src/XCAFDoc/XCAFDoc_AssemblyGraph.cxx @@ -127,19 +127,30 @@ void XCAFDoc_AssemblyGraph::buildGraph(const TDF_Label& theLabel) { TDF_Label aLabel = it.Value(); - TDF_Label anOriginal; + TDF_Label anOriginal; + Standard_Integer aRootId, anIdToProceed; if (!myShapeTool->GetReferredShape(aLabel, anOriginal)) - anOriginal = aLabel; + { + anOriginal = aLabel; + aRootId = addNode(anOriginal, 0); + anIdToProceed = aRootId; + } + else + { + aRootId = addNode(aLabel, 0); + if (aRootId == 0) + continue; + anIdToProceed = addNode(anOriginal, aRootId); + } - const Standard_Integer aRootId = addNode(anOriginal, 0); - if (aRootId == 0) + if (aRootId == 0 || anIdToProceed == 0) continue; myRoots.Add(aRootId); // Add components (the objects nested into the current one). if (myShapeTool->IsAssembly(anOriginal)) - addComponents(anOriginal, aRootId); + addComponents(anOriginal, anIdToProceed); } } @@ -208,7 +219,7 @@ Standard_Integer XCAFDoc_AssemblyGraph::addNode(const TDF_Label& theLabel, else aNodeType = NodeType_Subassembly; } - else if (myShapeTool->IsComponent(theLabel)) + else if (myShapeTool->IsReference(theLabel)) { aNodeType = NodeType_Occurrence; } diff --git a/tests/bugs/xde/ar10850 b/tests/bugs/xde/ar10850 new file mode 100644 index 0000000000..26703179ab --- /dev/null +++ b/tests/bugs/xde/ar10850 @@ -0,0 +1,17 @@ +puts "AR10850 - XCAFDoc_Editor::RescaleGeometry does not rescale translation of roots references" + +pload OCAF +Close D -silent +XOpen [locate_data_file "ar10850_3D-EYE_chair_OCC_noscale.xbf"] D + +XGetOneShape a D +set ref_diag [eval distpp [bounding a]] + +XRescaleGeometry D 0.001 + +XGetOneShape a D +set diag [eval distpp [bounding a]] + +checkreal "bounding box diagonal" $diag [expr $ref_diag * 0.001] 0 0.001 + +Close D