]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix problems discovered by model tests
authorazv <azv@opencascade.com>
Thu, 2 Mar 2017 08:20:21 +0000 (11:20 +0300)
committerazv <azv@opencascade.com>
Thu, 2 Mar 2017 08:20:35 +0000 (11:20 +0300)
src/SketchSolver/SketchSolver_ConstraintMulti.cpp
src/SketchSolver/SketchSolver_ConstraintTangent.cpp
test.models/bearing_puller.py

index 4ca7e088b2911bf1067f87703b6c126d84485e8d..53d5b9e7fd9e5e46e0e5bde40549aa3713911d60 100644 (file)
@@ -99,6 +99,10 @@ void SketchSolver_ConstraintMulti::update()
     remove();
     process();
   }
+
+  // update derived object
+  updateLocal();
+  adjustConstraint();
 }
 
 void SketchSolver_ConstraintMulti::adjustConstraint()
index 2551c2074ca5bcf71eff20ef3e72746a5906109d..1bf442634e914bc9286a85af8290a96adf060f4b 100644 (file)
@@ -26,13 +26,14 @@ static bool hasSingleCoincidence(FeaturePtr theFeature1, FeaturePtr theFeature2)
     if (aRef && aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID())
       aCoincidences.insert(aRef);
   }
+  int aNbCoinCidentPoints = 0;
   for (anIt = aRefs2.begin(); anIt != aRefs2.end(); ++anIt) {
     FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner());
-    if (aRef)
-      aCoincidences.erase(aRef);
+    if (aCoincidences.find(aRef) != aCoincidences.end())
+      ++aNbCoinCidentPoints;
   }
 
-  return aCoincidences.size() <= 1;
+  return aNbCoinCidentPoints <= 1;
 }
 
 void SketchSolver_ConstraintTangent::getAttributes(
index cbbae19c2e2a8f4b8f5a4e4c8e38dc36683b02b6..3f2537e39c86360b335ac0a7cbb5a39feb272e9c 100644 (file)
@@ -359,7 +359,7 @@ SketchArc_16.result().setName("SketchArc_7")
 SketchArc_16.results()[1].setName("SketchArc_7_2")
 SketchConstraintCoincidence_63 = Sketch_4.setCoincident(SketchArc_16.startPoint(), SketchArc_12.startPoint())
 SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_51")
-SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchArc_16.endPoint(), SketchAPI_Arc(SketchArc_14).startPoint())
+SketchConstraintCoincidence_64 = Sketch_4.setCoincident(SketchArc_16.endPoint(), SketchAPI_Arc(SketchArc_14).endPoint())
 SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_52")
 SketchConstraintCoincidence_65 = Sketch_4.setCoincident(SketchArc_16.center(), SketchLine_30.result())
 SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_53")
@@ -367,7 +367,7 @@ SketchArc_17 = Sketch_4.addArc(-3.457737973711317, -7.36102368218484e-015, -6.25
 SketchArc_17.setName("SketchArc_8")
 SketchArc_17.result().setName("SketchArc_8")
 SketchArc_17.results()[1].setName("SketchArc_8_2")
-SketchConstraintCoincidence_66 = Sketch_4.setCoincident(SketchArc_17.startPoint(), SketchAPI_Arc(SketchArc_14).endPoint())
+SketchConstraintCoincidence_66 = Sketch_4.setCoincident(SketchArc_17.startPoint(), SketchAPI_Arc(SketchArc_14).startPoint())
 SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_54")
 SketchConstraintCoincidence_67 = Sketch_4.setCoincident(SketchArc_17.center(), SketchAPI_Arc(SketchArc_14).center())
 SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_55")
@@ -375,7 +375,7 @@ SketchArc_18 = Sketch_4.addArc(-4.74373017345514e-021, 5.762896622852203, 3.0868
 SketchArc_18.setName("SketchArc_9")
 SketchArc_18.result().setName("SketchArc_9")
 SketchArc_18.results()[1].setName("SketchArc_9_2")
-SketchConstraintCoincidence_68 = Sketch_4.setCoincident(SketchArc_18.startPoint(), SketchAPI_Arc(SketchArc_15).endPoint())
+SketchConstraintCoincidence_68 = Sketch_4.setCoincident(SketchArc_18.startPoint(), SketchAPI_Arc(SketchArc_15).startPoint())
 SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_56")
 SketchConstraintCoincidence_69 = Sketch_4.setCoincident(SketchArc_18.center(), SketchAPI_Arc(SketchArc_15).center())
 SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_57")
@@ -387,7 +387,7 @@ SketchArc_19.result().setName("SketchArc_10")
 SketchArc_19.results()[1].setName("SketchArc_10_2")
 SketchConstraintCoincidence_71 = Sketch_4.setCoincident(SketchArc_19.startPoint(), SketchArc_13.startPoint())
 SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_59")
-SketchConstraintCoincidence_72 = Sketch_4.setCoincident(SketchArc_19.endPoint(), SketchAPI_Arc(SketchArc_15).startPoint())
+SketchConstraintCoincidence_72 = Sketch_4.setCoincident(SketchArc_19.endPoint(), SketchAPI_Arc(SketchArc_15).endPoint())
 SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_60")
 model.do()
 Sketch_5 = model.addSketch(Part_2_doc, model.defaultPlane("XOZ"))
@@ -627,7 +627,7 @@ SketchArc_25.result().setName("SketchArc_7")
 SketchArc_25.results()[1].setName("SketchArc_7_2")
 SketchConstraintCoincidence_130 = Sketch_6.setCoincident(SketchArc_25.startPoint(), SketchArc_21.startPoint())
 SketchConstraintCoincidence_130.setName("SketchConstraintCoincidence_51")
-SketchConstraintCoincidence_131 = Sketch_6.setCoincident(SketchArc_25.endPoint(), SketchAPI_Arc(SketchArc_23).startPoint())
+SketchConstraintCoincidence_131 = Sketch_6.setCoincident(SketchArc_25.endPoint(), SketchAPI_Arc(SketchArc_23).endPoint())
 SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_52")
 SketchConstraintCoincidence_132 = Sketch_6.setCoincident(SketchArc_25.center(), SketchLine_51.result())
 SketchConstraintCoincidence_132.setName("SketchConstraintCoincidence_53")
@@ -635,7 +635,7 @@ SketchArc_26 = Sketch_6.addArc(-3.457737973711317, -7.36102368218484e-015, -6.25
 SketchArc_26.setName("SketchArc_8")
 SketchArc_26.result().setName("SketchArc_8")
 SketchArc_26.results()[1].setName("SketchArc_8_2")
-SketchConstraintCoincidence_133 = Sketch_6.setCoincident(SketchArc_26.startPoint(), SketchAPI_Arc(SketchArc_23).endPoint())
+SketchConstraintCoincidence_133 = Sketch_6.setCoincident(SketchArc_26.startPoint(), SketchAPI_Arc(SketchArc_23).startPoint())
 SketchConstraintCoincidence_133.setName("SketchConstraintCoincidence_54")
 SketchConstraintCoincidence_134 = Sketch_6.setCoincident(SketchArc_26.center(), SketchAPI_Arc(SketchArc_23).center())
 SketchConstraintCoincidence_134.setName("SketchConstraintCoincidence_55")
@@ -643,7 +643,7 @@ SketchArc_27 = Sketch_6.addArc(-4.74373017345514e-021, 5.762896622852203, 3.0868
 SketchArc_27.setName("SketchArc_9")
 SketchArc_27.result().setName("SketchArc_9")
 SketchArc_27.results()[1].setName("SketchArc_9_2")
-SketchConstraintCoincidence_135 = Sketch_6.setCoincident(SketchArc_27.startPoint(), SketchAPI_Arc(SketchArc_24).endPoint())
+SketchConstraintCoincidence_135 = Sketch_6.setCoincident(SketchArc_27.startPoint(), SketchAPI_Arc(SketchArc_24).startPoint())
 SketchConstraintCoincidence_135.setName("SketchConstraintCoincidence_56")
 SketchConstraintCoincidence_136 = Sketch_6.setCoincident(SketchArc_27.center(), SketchAPI_Arc(SketchArc_24).center())
 SketchConstraintCoincidence_136.setName("SketchConstraintCoincidence_57")
@@ -655,7 +655,7 @@ SketchArc_28.result().setName("SketchArc_10")
 SketchArc_28.results()[1].setName("SketchArc_10_2")
 SketchConstraintCoincidence_138 = Sketch_6.setCoincident(SketchArc_28.startPoint(), SketchArc_22.startPoint())
 SketchConstraintCoincidence_138.setName("SketchConstraintCoincidence_59")
-SketchConstraintCoincidence_139 = Sketch_6.setCoincident(SketchArc_28.endPoint(), SketchAPI_Arc(SketchArc_24).startPoint())
+SketchConstraintCoincidence_139 = Sketch_6.setCoincident(SketchArc_28.endPoint(), SketchAPI_Arc(SketchArc_24).endPoint())
 SketchConstraintCoincidence_139.setName("SketchConstraintCoincidence_60")
 model.do()
 Sketch_7 = model.addSketch(Part_3_doc, model.defaultPlane("XOZ"))
@@ -895,7 +895,7 @@ SketchArc_34.result().setName("SketchArc_7")
 SketchArc_34.results()[1].setName("SketchArc_7_2")
 SketchConstraintCoincidence_197 = Sketch_8.setCoincident(SketchArc_34.startPoint(), SketchArc_30.startPoint())
 SketchConstraintCoincidence_197.setName("SketchConstraintCoincidence_51")
-SketchConstraintCoincidence_198 = Sketch_8.setCoincident(SketchArc_34.endPoint(), SketchAPI_Arc(SketchArc_32).startPoint())
+SketchConstraintCoincidence_198 = Sketch_8.setCoincident(SketchArc_34.endPoint(), SketchAPI_Arc(SketchArc_32).endPoint())
 SketchConstraintCoincidence_198.setName("SketchConstraintCoincidence_52")
 SketchConstraintCoincidence_199 = Sketch_8.setCoincident(SketchArc_34.center(), SketchLine_72.result())
 SketchConstraintCoincidence_199.setName("SketchConstraintCoincidence_53")
@@ -903,7 +903,7 @@ SketchArc_35 = Sketch_8.addArc(-3.457737973711317, -7.36102368218484e-015, -6.25
 SketchArc_35.setName("SketchArc_8")
 SketchArc_35.result().setName("SketchArc_8")
 SketchArc_35.results()[1].setName("SketchArc_8_2")
-SketchConstraintCoincidence_200 = Sketch_8.setCoincident(SketchArc_35.startPoint(), SketchAPI_Arc(SketchArc_32).endPoint())
+SketchConstraintCoincidence_200 = Sketch_8.setCoincident(SketchArc_35.startPoint(), SketchAPI_Arc(SketchArc_32).startPoint())
 SketchConstraintCoincidence_200.setName("SketchConstraintCoincidence_54")
 SketchConstraintCoincidence_201 = Sketch_8.setCoincident(SketchArc_35.center(), SketchAPI_Arc(SketchArc_32).center())
 SketchConstraintCoincidence_201.setName("SketchConstraintCoincidence_55")
@@ -911,7 +911,7 @@ SketchArc_36 = Sketch_8.addArc(-4.74373017345514e-021, 5.762896622852203, 3.0868
 SketchArc_36.setName("SketchArc_9")
 SketchArc_36.result().setName("SketchArc_9")
 SketchArc_36.results()[1].setName("SketchArc_9_2")
-SketchConstraintCoincidence_202 = Sketch_8.setCoincident(SketchArc_36.startPoint(), SketchAPI_Arc(SketchArc_33).endPoint())
+SketchConstraintCoincidence_202 = Sketch_8.setCoincident(SketchArc_36.startPoint(), SketchAPI_Arc(SketchArc_33).startPoint())
 SketchConstraintCoincidence_202.setName("SketchConstraintCoincidence_56")
 SketchConstraintCoincidence_203 = Sketch_8.setCoincident(SketchArc_36.center(), SketchAPI_Arc(SketchArc_33).center())
 SketchConstraintCoincidence_203.setName("SketchConstraintCoincidence_57")
@@ -923,7 +923,7 @@ SketchArc_37.result().setName("SketchArc_10")
 SketchArc_37.results()[1].setName("SketchArc_10_2")
 SketchConstraintCoincidence_205 = Sketch_8.setCoincident(SketchArc_37.startPoint(), SketchArc_31.startPoint())
 SketchConstraintCoincidence_205.setName("SketchConstraintCoincidence_59")
-SketchConstraintCoincidence_206 = Sketch_8.setCoincident(SketchArc_37.endPoint(), SketchAPI_Arc(SketchArc_33).startPoint())
+SketchConstraintCoincidence_206 = Sketch_8.setCoincident(SketchArc_37.endPoint(), SketchAPI_Arc(SketchArc_33).endPoint())
 SketchConstraintCoincidence_206.setName("SketchConstraintCoincidence_60")
 model.do()
 Sketch_9 = model.addSketch(Part_4_doc, model.defaultPlane("XOZ"))