]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add arc to solver if any its attribute is added
authorazv <azv@opencascade.com>
Wed, 16 Dec 2015 05:18:01 +0000 (08:18 +0300)
committerazv <azv@opencascade.com>
Tue, 22 Dec 2015 05:48:08 +0000 (08:48 +0300)
src/SketchSolver/SketchSolver_Manager.cpp
src/SketchSolver/SketchSolver_Storage.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp

index 34b2ea0405d432afa86608c2ee8a5c0fbf683b0e..354a3d9d8a43bd794bcd050d36e2a908145a3645 100644 (file)
@@ -258,8 +258,11 @@ bool SketchSolver_Manager::changeFeature(std::shared_ptr<SketchPlugin_Feature> t
     }
 
     if (aConstraint)
-      return (*aFirstGroupIter)->changeConstraint(aConstraint);
-    return (*aFirstGroupIter)->updateFeature(theFeature);
+      (*aFirstGroupIter)->changeConstraint(aConstraint);
+    else
+      (*aFirstGroupIter)->updateFeature(theFeature);
+    // groups are merged => need to resolve them
+    return true;
   }
 
   // Something goes wrong
index 2e283a90f6cde0897740b187b0570429134d9237..e440a795b1f888227abdde6877564dc67aa5f024 100644 (file)
@@ -132,6 +132,20 @@ bool SketchSolver_Storage::update(AttributePtr theAttribute, const GroupID& theG
 
   EntityWrapperPtr aRelated = entity(anAttribute);
   if (!aRelated) { // Attribute is not exist, create it
+    // verify the attribute is a point of arc and add whole arc
+    if (anAttribute->owner()) {
+      FeaturePtr aFeature = ModelAPI_Feature::feature(anAttribute->owner());
+      if (aFeature->getKind() == SketchPlugin_Arc::ID() &&
+          myFeatureMap.find(aFeature) == myFeatureMap.end()) {
+        // Additional checking that all attributes are initialized
+        if (aFeature->attribute(SketchPlugin_Arc::CENTER_ID())->isInitialized() && 
+            aFeature->attribute(SketchPlugin_Arc::START_ID())->isInitialized() && 
+            aFeature->attribute(SketchPlugin_Arc::END_ID())->isInitialized()) {
+////          myFeatureMap[aFeature] = EntityWrapperPtr();
+          return SketchSolver_Storage::update(aFeature);
+        }
+      }
+    }
     BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder();
     GroupID aGroup = theGroup != GID_UNKNOWN ? theGroup : myGroupID;
     aRelated = aBuilder->createAttribute(anAttribute, aGroup);
index d48730926de2283aa027aedee5272dbf776bf200..96b7ec0779b90fb6845eb3803e6cb8de2bfa84d3 100644 (file)
@@ -184,21 +184,6 @@ 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()) {
-        // Additional checking that all attributes are initialized
-        if (aFeature->attribute(SketchPlugin_Arc::CENTER_ID())->isInitialized() && 
-            aFeature->attribute(SketchPlugin_Arc::START_ID())->isInitialized() && 
-            aFeature->attribute(SketchPlugin_Arc::END_ID())->isInitialized()) {
-          myFeatureMap[aFeature] = EntityWrapperPtr();
-          return SketchSolver_Storage::update(aFeature);
-        }
-      }
-    }
   }
 
   return isUpdated;