From 87b6754797f3c1d393efc06a6850d5039b502d41 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 2 Mar 2017 11:20:21 +0300 Subject: [PATCH] Fix problems discovered by model tests --- .../SketchSolver_ConstraintMulti.cpp | 4 ++++ .../SketchSolver_ConstraintTangent.cpp | 7 +++--- test.models/bearing_puller.py | 24 +++++++++---------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp index 4ca7e088b..53d5b9e7f 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp @@ -99,6 +99,10 @@ void SketchSolver_ConstraintMulti::update() remove(); process(); } + + // update derived object + updateLocal(); + adjustConstraint(); } void SketchSolver_ConstraintMulti::adjustConstraint() diff --git a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp index 2551c2074..1bf442634 100644 --- a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp @@ -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( diff --git a/test.models/bearing_puller.py b/test.models/bearing_puller.py index cbbae19c2..3f2537e39 100644 --- a/test.models/bearing_puller.py +++ b/test.models/bearing_puller.py @@ -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")) -- 2.39.2