]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for groups export to GEOM on CompSolids
authormpv <mpv@opencascade.com>
Mon, 23 Nov 2015 10:25:50 +0000 (13:25 +0300)
committermpv <mpv@opencascade.com>
Mon, 23 Nov 2015 10:25:50 +0000 (13:25 +0300)
src/Model/Model_AttributeSelection.cpp
src/Model/Model_BodyBuilder.cpp
src/Model/Model_ResultCompSolid.cpp

index 9d375b2acdc85f72496f772c8943927a30ec7c64..2353e002fd103eeb080cbc94032807d2d1c5bdea 100644 (file)
@@ -917,6 +917,11 @@ int Model_AttributeSelection::Id()
   int anID = 0;
   std::shared_ptr<GeomAPI_Shape> aSelection = value();
   std::shared_ptr<GeomAPI_Shape> aContext = context()->shape();
+  // support for compsolids:
+  if (context().get() && ModelAPI_Tools::compSolidOwner(context()).get())
+    aContext = ModelAPI_Tools::compSolidOwner(context())->shape();
+
+
   TopoDS_Shape aMainShape = aContext->impl<TopoDS_Shape>();
   const TopoDS_Shape& aSubShape = aSelection->impl<TopoDS_Shape>();
   // searching for the latest main shape
index 45befbcb4889d791083b9edba20b61fad728d490..b8ee2d52f97d2c61c851da5f166dab470c36d8b6 100755 (executable)
@@ -791,8 +791,15 @@ bool Model_BodyBuilder::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theS
       Handle(TNaming_NamedShape) aName;
       if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
         TopoDS_Shape aLatest = TNaming_Tool::CurrentShape(aName);
+        if (aLatest.IsNull())
+          return false;
         if (aLatest.IsEqual(aShape))
           return true;
+        // check sub-shapes for comp-solids:
+        for (TopExp_Explorer anExp(aShape, aLatest.ShapeType()); anExp.More(); anExp.Next()) {
+          if (aLatest.IsEqual(anExp.Current()))
+            return true;
+        }
       }
     }
   }
index 4b83d3d5941327966c599f75e3bb596e635599d5..96cdf32fce3e54337422005673f9a2907b137270 100755 (executable)
@@ -191,5 +191,14 @@ void Model_ResultCompSolid::updateSubs(const std::shared_ptr<GeomAPI_Shape>& the
 
 bool Model_ResultCompSolid::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
 {
-  return myBuilder->isLatestEqual(theShape);
+  if (myBuilder->isLatestEqual(theShape))
+    return true;
+  // also check that it is asked for sub-elements
+  std::vector<std::shared_ptr<ModelAPI_ResultBody> >::const_iterator aSubIter = mySubs.cbegin();
+  for(; aSubIter != mySubs.cend(); aSubIter++) {
+    if (aSubIter->get() && (*aSubIter)->isLatestEqual(theShape)) {
+      return true;
+    }
+  }
+  return false;
 }