]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix the problem while moving arc with fixed point
authorazv <azv@opencascade.com>
Mon, 8 Feb 2016 13:32:07 +0000 (16:32 +0300)
committerdbv <dbv@opencascade.com>
Tue, 16 Feb 2016 14:04:37 +0000 (17:04 +0300)
src/SketchPlugin/SketchPlugin_Arc.cpp
src/SketchSolver/SketchSolver_Group.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp

index aacdeca1fece7cdbb21a9ef30173b4dd9200d77c..2725d87904146bf25a72cdd2f73457a47c6bebea 100644 (file)
@@ -399,8 +399,6 @@ static inline void calculatePassedPoint(
 
 void SketchPlugin_Arc::updateDependentAttributes()
 {
-  data()->blockSendAttributeUpdated(true);
-
   std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
       GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
   std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
@@ -414,12 +412,19 @@ void SketchPlugin_Arc::updateDependentAttributes()
   AttributeDoublePtr anAngleAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
       data()->attribute(ANGLE_ID()));
 
+  if (!aPassedPoint)
+    return;
+
+  data()->blockSendAttributeUpdated(true);
+
   calculatePassedPoint(aCenterAttr->pnt(), aStartAttr->pnt(), anEndAttr->pnt(),
                        isReversed(), aPassedPoint);
-  std::shared_ptr<GeomAPI_Circ2d> aCircle(
-      new GeomAPI_Circ2d(aStartAttr->pnt(), anEndAttr->pnt(), aPassedPoint->pnt()));
-  calculateArcAngleRadius(aCircle, aStartAttr->pnt(), anEndAttr->pnt(), aPassedPoint->pnt(),
-                          anAngleAttr, aRadiusAttr);
+  if (aRadiusAttr && anAngleAttr) {
+    std::shared_ptr<GeomAPI_Circ2d> aCircle(
+        new GeomAPI_Circ2d(aStartAttr->pnt(), anEndAttr->pnt(), aPassedPoint->pnt()));
+    calculateArcAngleRadius(aCircle, aStartAttr->pnt(), anEndAttr->pnt(), aPassedPoint->pnt(),
+                            anAngleAttr, aRadiusAttr);
+  }
   data()->blockSendAttributeUpdated(false);
 }
 
index 84d6a0bb26e523c00813d148781295018fa9a0c3..1da845930f9b433fe7eec9afc982b1c0141d01f4 100644 (file)
@@ -316,10 +316,10 @@ bool SketchSolver_Group::resolveConstraints()
           aResult = mySketchSolver->solve();
           if (aResult == STATUS_OK || aResult == STATUS_EMPTYSET || isLastChance)
             break;
-          // try to update parameters and resolve once again
-          ConstraintConstraintMap::iterator aConstrIt = myConstraints.begin();
-          for (; aConstrIt != myConstraints.end(); ++aConstrIt)
-            aConstrIt->second->update();
+////          // try to update parameters and resolve once again
+////          ConstraintConstraintMap::iterator aConstrIt = myConstraints.begin();
+////          for (; aConstrIt != myConstraints.end(); ++aConstrIt)
+////            aConstrIt->second->update();
           isLastChance = true;
 
           removeTemporaryConstraints();
index a060f20df32317383b3e201de5c0fb8c7f0d892e..15433435137c32ff4f0108d1c3d83737e255bd60 100644 (file)
@@ -129,7 +129,7 @@ bool SolveSpaceSolver_Storage::update(EntityWrapperPtr theEntity)
   if (anEntity->baseAttribute()) {
     BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance();
     EntityWrapperPtr anUpdAttr = aBuilder->createAttribute(anEntity->baseAttribute(), GID_UNKNOWN);
-    if (anUpdAttr) {
+    if (anUpdAttr && !isFixed(theEntity)) {
       std::list<ParameterWrapperPtr> anUpdParams = anUpdAttr->parameters();
       std::list<ParameterWrapperPtr>::iterator anUpdIt = anUpdParams.begin();
       for (aPIt = aParams.begin(); aPIt != aParams.end() && anUpdIt != anUpdParams.end();
@@ -1129,10 +1129,17 @@ void SolveSpaceSolver_Storage::verifyFixed()
   for (; anAttrIt != myAttributeMap.end(); ++anAttrIt) {
     if (!anAttrIt->second)
       continue;
+    if (anAttrIt->second->group() == GID_OUTOFGROUP) {
+      Slvs_Entity anEnt = getEntity((Slvs_hEntity)anAttrIt->second->id());
+      if (anEnt.group != (Slvs_hEntity)GID_OUTOFGROUP)
+        anEnt.group = (Slvs_hEntity)GID_OUTOFGROUP;
+      updateEntity(anEnt);
+    }
+
     const std::list<ParameterWrapperPtr>& aParameters = anAttrIt->second->parameters();
     std::list<ParameterWrapperPtr>::const_iterator aParIt = aParameters.begin();
     for (; aParIt != aParameters.end(); ++aParIt)
-      if ((*aParIt)->group() == GID_OUTOFGROUP) {
+      if (anAttrIt->second->group() == GID_OUTOFGROUP || (*aParIt)->group() == GID_OUTOFGROUP) {
         Slvs_Param aParam = getParameter((Slvs_hParam)(*aParIt)->id());
         if (aParam.group != (Slvs_hParam)GID_OUTOFGROUP) {
           aParam.group = (Slvs_hParam)GID_OUTOFGROUP;