]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update for correct movement of sketch elements, when the sketch contains arcs and...
authorazv <azv@opencascade.com>
Fri, 18 Dec 2015 05:16:30 +0000 (08:16 +0300)
committerazv <azv@opencascade.com>
Fri, 18 Dec 2015 05:16:30 +0000 (08:16 +0300)
src/SketchSolver/SketchSolver_Storage.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp

index af6b022be7dceb7191dd9320ac31d1f75365d5d1..8db3eaa5c2c31be9afb6c7bae645d7563f94a1b0 100644 (file)
@@ -50,7 +50,7 @@ void SketchSolver_Storage::addEntity(FeaturePtr       theFeature,
                                      EntityWrapperPtr theSolverEntity)
 {
   std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFound = myFeatureMap.find(theFeature);
-  if (aFound == myFeatureMap.end() || !aFound->second->isEqual(theSolverEntity))
+  if (aFound == myFeatureMap.end() || !aFound->second || !aFound->second->isEqual(theSolverEntity))
     setNeedToResolve(true); // the entity is new or modified
 
   myFeatureMap[theFeature] = theSolverEntity;
@@ -60,7 +60,7 @@ void SketchSolver_Storage::addEntity(AttributePtr     theAttribute,
                                      EntityWrapperPtr theSolverEntity)
 {
   std::map<AttributePtr, EntityWrapperPtr>::const_iterator aFound = myAttributeMap.find(theAttribute);
-  if (aFound == myAttributeMap.end() || !aFound->second->isEqual(theSolverEntity))
+  if (aFound == myAttributeMap.end() || !aFound->second || !aFound->second->isEqual(theSolverEntity))
     setNeedToResolve(true); // the entity is new or modified
 
   myAttributeMap[theAttribute] = theSolverEntity;
index de1cc3edd1880ed05ed5ad3e17eac5aadf309b4b..a46a7c0b37cbef86b0731cf3151bed645c044516 100644 (file)
@@ -82,8 +82,8 @@ void SolveSpaceSolver_Solver::setConstraints(Slvs_Constraint* theConstraints, in
 
 SketchSolver_SolveStatus SolveSpaceSolver_Solver::solve()
 {
-  if (myEquationsSystem.constraints <= 0)
-    return STATUS_EMPTYSET;
+  //if (myEquationsSystem.constraints <= 0)
+  //  return STATUS_EMPTYSET;
 
   myEquationsSystem.calculateFaileds = myFindFaileds ? 1 : 0;
 
index c8113afb835f8ab6f0dd32368dcede80c97d83da..5fe40328e2a088165108d59452b6716dd38bd07c 100644 (file)
@@ -19,6 +19,7 @@
 #include <GeomDataAPI_Point.h>
 #include <GeomDataAPI_Point2D.h>
 #include <ModelAPI_AttributeDouble.h>
+#include <SketchPlugin_Arc.h>
 
 /** \brief Search the entity/parameter with specified ID in the list of elements
  *  \param[in] theEntityID unique ID of the element
@@ -174,7 +175,18 @@ bool SolveSpaceSolver_Storage::update(EntityWrapperPtr& theEntity)
 
     if (anEntity->type() == ENTITY_SKETCH)
       storeWorkplane(anEntity);
+
+    // For the correct work with arcs we will add them if their parameter is added
+    if (theEntity->baseAttribute()) {
+      FeaturePtr aFeature = ModelAPI_Feature::feature(theEntity->baseAttribute()->owner());
+      if (aFeature->getKind() == SketchPlugin_Arc::ID() &&
+          myFeatureMap.find(aFeature) == myFeatureMap.end()) {
+        myFeatureMap[aFeature] = EntityWrapperPtr();
+        return SketchSolver_Storage::update(aFeature, myGroupID);
+      }
+    }
   }
+
   return isUpdated;
 }