]> OCCT Git - occt.git/commitdiff
Modeling Algorithms - XCAFDoc_Editor::RescaleGeometry does not rescale translation...
authorikochetkova <irina.kochetkova@opencascade.com>
Wed, 14 May 2025 11:07:52 +0000 (12:07 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Mon, 19 May 2025 21:21:22 +0000 (22:21 +0100)
Add processing of roots, which are transformed references of parts/assemblies.

src/XCAFDoc/XCAFDoc_AssemblyGraph.cxx
tests/bugs/xde/ar10850 [new file with mode: 0644]

index ec03e400c3207ae10321ee095fdda2d669823215..d25e6d048f8e43b0d326d0822e200eba33192062 100644 (file)
@@ -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;
-
-    const Standard_Integer aRootId = addNode(anOriginal, 0);
-    if (aRootId == 0)
+    {
+      anOriginal    = aLabel;
+      aRootId       = addNode(anOriginal, 0);
+      anIdToProceed = aRootId;
+    }
+    else
+    {
+      aRootId = addNode(aLabel, 0);
+      if (aRootId == 0)
+        continue;
+      anIdToProceed = addNode(anOriginal, aRootId);
+    }
+
+    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 (file)
index 0000000..2670317
--- /dev/null
@@ -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