From ae6699b9c4e784b2d7a25f26e6fcd973b78bbbf1 Mon Sep 17 00:00:00 2001 From: ika Date: Mon, 30 Oct 2017 18:04:12 +0300 Subject: [PATCH] 0029282: Data Exchange - UpdateAssemblies is not working for located root assemblies Add check for located root assemblies. --- src/XCAFDoc/XCAFDoc_ShapeTool.cxx | 8 ++++++-- tests/bugs/xde/bug29282 | 32 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/xde/bug29282 diff --git a/src/XCAFDoc/XCAFDoc_ShapeTool.cxx b/src/XCAFDoc/XCAFDoc_ShapeTool.cxx index 3ea0e64bd9..cb7ebdf3b4 100644 --- a/src/XCAFDoc/XCAFDoc_ShapeTool.cxx +++ b/src/XCAFDoc/XCAFDoc_ShapeTool.cxx @@ -998,8 +998,12 @@ void XCAFDoc_ShapeTool::UpdateAssemblies() // Iterate over the free shapes for ( TDF_LabelSequence::Iterator anIt(aRootLabels); anIt.More(); anIt.Next() ) { - const TDF_Label& aRootLab = anIt.Value(); - + TDF_Label aRefLabel = anIt.Value(); + if (IsReference(aRefLabel)) + { + GetReferredShape(aRefLabel, aRefLabel); + } + const TDF_Label& aRootLab = aRefLabel; TopoDS_Shape anAssemblyShape; updateComponent(aRootLab, anAssemblyShape); } diff --git a/tests/bugs/xde/bug29282 b/tests/bugs/xde/bug29282 new file mode 100644 index 0000000000..0e7819276f --- /dev/null +++ b/tests/bugs/xde/bug29282 @@ -0,0 +1,32 @@ +puts "==========" +puts "OCC29282" +puts "==========" +puts "" +########################################################### +# UpdateAssemblies is not worked for located root assemblies +########################################################### + +pload DCAF + +# create test Document +box b 1 1 1 +compound b c +ttranslate c 0 1 0 +XNewDoc D +XAddShape D c + +# replace box by another one +box bb 2 1 1 +XSetShape D 0:1:1:3 bb +XUpdateAssemblies D +XGetOneShape result D + +# check results +set props [vprops result] +regexp {Mass +: +([-0-9.+eE]+).+} $props full mass +if {$mass != "2"} { + puts "Error: Assemblies are not updated." +} + +Close D + -- 2.39.5