Salome HOME
The problem of plane of sketch update fix.
authormpv <mpv@opencascade.com>
Fri, 25 May 2018 08:24:04 +0000 (11:24 +0300)
committermpv <mpv@opencascade.com>
Fri, 25 May 2018 08:24:04 +0000 (11:24 +0300)
The plane is based on the trihedron plane. Sketch is created on this plane. The distance between planes is changed, but sketch is not.

src/Model/Model_ResultConstruction.cpp

index 25116990809bb0440cca76236c6da66721d37312..737a63d25df6cfeab3d39769e870f5ad5be33e4f 100644 (file)
@@ -611,10 +611,30 @@ bool Model_ResultConstruction::update(const int theIndex,
       }
       return aRes;
     } else {
+      // check is this modified or not
+      std::shared_ptr<GeomAPI_Shape> aNewShape = shape();
+      TopoDS_Shape anOldSh;
+      Handle(TNaming_NamedShape) aNS;
+      if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+        anOldSh = aNS->Get();
+      }
+      if (aNewShape.get()) {
+        if (anOldSh.IsNull())
+          theModified = true;
+        else {
+          std::shared_ptr<GeomAPI_Shape> anOldShape(new GeomAPI_Shape);
+          anOldShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(anOldSh));
+          theModified = !anOldShape->isEqual(aNewShape);
+        }
+      }
+      else if (!anOldSh.IsNull()) {
+        theModified = true;
+      }
+
       // For correct naming selection, put the shape into the naming structure.
       // It seems sub-shapes are not needed: only this shape is (and can be ) selected.
       TNaming_Builder aBuilder(aLab);
-      aBuilder.Generated(shape()->impl<TopoDS_Shape>());
+      aBuilder.Generated(aNewShape->impl<TopoDS_Shape>());
     }
     return shape() && !shape()->isNull();
   }