From: Artem Zhidkov Date: Thu, 3 Dec 2020 12:51:41 +0000 (+0300) Subject: Fix incorrect number of results returned by MultiRotation/MultiTranslation feature... X-Git-Tag: V9_7_0a1~79 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9c42741053f277a2903c2385aea645dcad5ab784;p=modules%2Fshaper.git Fix incorrect number of results returned by MultiRotation/MultiTranslation feature if the list of original object has copied features. Update errors in unit tests. --- diff --git a/src/BuildPlugin/Test/Test19056.py b/src/BuildPlugin/Test/Test19056.py index 6807f3bf3..868a08fe5 100644 --- a/src/BuildPlugin/Test/Test19056.py +++ b/src/BuildPlugin/Test/Test19056.py @@ -50,7 +50,7 @@ SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_3.startPoint()) SketchMultiRotation_1_objects = [SketchArc_1.results()[1], SketchLine_2.result(), SketchLine_4.result(), SketchArc_2.results()[1]] SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchAPI_Line(SketchLine_1).startPoint(), 360, "nb", True) -[SketchArc_4, SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_4, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchArc_2, SketchArc_11, SketchArc_12, SketchArc_13, SketchArc_14, SketchArc_15, SketchArc_16, SketchArc_17] = SketchMultiRotation_1.rotated() +[SketchArc_4, SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8, SketchArc_9, SketchArc_10, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchArc_11, SketchArc_12, SketchArc_13, SketchArc_14, SketchArc_15, SketchArc_16, SketchArc_17] = SketchMultiRotation_1.rotated() SketchArc_13.setName("SketchArc_9") SketchArc_13.result().setName("SketchArc_9") SketchArc_13.results()[1].setName("SketchArc_9_2") diff --git a/src/FeaturesPlugin/Test/Test2724.py b/src/FeaturesPlugin/Test/Test2724.py index 40a0dc7bf..ec0fb61ed 100644 --- a/src/FeaturesPlugin/Test/Test2724.py +++ b/src/FeaturesPlugin/Test/Test2724.py @@ -49,7 +49,7 @@ SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_3.result(), SketchConst [SketchLine_5, SketchLine_6, SketchLine_7] = SketchConstraintMirror_1.mirrored() SketchMultiTranslation_1_objects = [SketchLine_1.result(), SketchLine_4.result(), SketchLine_3.result(), SketchLine_5.result(), SketchLine_6.result()] SketchMultiTranslation_1 = Sketch_1.addTranslation(SketchMultiTranslation_1_objects, SketchLine_2.endPoint(), SketchLine_4.startPoint(), 4) -[SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_5, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_6, SketchLine_20, SketchLine_21, SketchLine_22] = SketchMultiTranslation_1.translated() +[SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_20, SketchLine_21, SketchLine_22] = SketchMultiTranslation_1.translated() model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() diff --git a/src/SketchAPI/SketchAPI_Rotation.cpp b/src/SketchAPI/SketchAPI_Rotation.cpp index 07e426a71..7b5ec3831 100644 --- a/src/SketchAPI/SketchAPI_Rotation.cpp +++ b/src/SketchAPI/SketchAPI_Rotation.cpp @@ -67,11 +67,16 @@ void SketchAPI_Rotation::setRotationList( std::list > SketchAPI_Rotation::rotated() const { - std::list aList = rotatedObjects()->list(); + std::list aList = rotationList()->list(); + std::set anOriginalObjects; + anOriginalObjects.insert(aList.begin(), aList.end()); // remove all initial features std::list anIntermediate; + aList = rotatedObjects()->list(); std::list::const_iterator anIt = aList.begin(); for (; anIt != aList.end(); ++anIt) { + if (anOriginalObjects.find(*anIt) != anOriginalObjects.end()) + continue; // skip initial object FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); AttributeBooleanPtr isCopy = aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (isCopy.get() && isCopy->value()) diff --git a/src/SketchAPI/SketchAPI_Translation.cpp b/src/SketchAPI/SketchAPI_Translation.cpp index 3c95ce76b..ff32e3fa2 100644 --- a/src/SketchAPI/SketchAPI_Translation.cpp +++ b/src/SketchAPI/SketchAPI_Translation.cpp @@ -64,11 +64,16 @@ void SketchAPI_Translation::setTranslationList( std::list > SketchAPI_Translation::translated() const { - std::list aList = translatedObjects()->list(); + std::list aList = translationList()->list(); + std::set anOriginalObjects; + anOriginalObjects.insert(aList.begin(), aList.end()); // remove all initial features std::list anIntermediate; + aList = translatedObjects()->list(); std::list::const_iterator anIt = aList.begin(); for (; anIt != aList.end(); ++anIt) { + if (anOriginalObjects.find(*anIt) != anOriginalObjects.end()) + continue; // skip initial object FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); AttributeBooleanPtr isCopy = aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (isCopy.get() && isCopy->value()) diff --git a/src/SketchPlugin/Test/Test2393.py b/src/SketchPlugin/Test/Test2393.py index 804c68428..df93682c8 100644 --- a/src/SketchPlugin/Test/Test2393.py +++ b/src/SketchPlugin/Test/Test2393.py @@ -40,7 +40,7 @@ SketchPoint_1 = SketchProjection_1.createdFeature() SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), True) SketchLine_1 = SketchProjection_2.createdFeature() SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 3) -[SketchLine_1, SketchLine_2, SketchLine_3] = SketchMultiRotation_1.rotated() +[SketchLine_2, SketchLine_3] = SketchMultiRotation_1.rotated() model.do() model.checkSketch(Sketch_1, 0) diff --git a/src/SketchPlugin/Test/Test3240.py b/src/SketchPlugin/Test/Test3240.py index c6b0a2971..3380e5643 100644 --- a/src/SketchPlugin/Test/Test3240.py +++ b/src/SketchPlugin/Test/Test3240.py @@ -32,7 +32,7 @@ Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY")) SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OX"), True) SketchLine_1 = SketchProjection_1.createdFeature() SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Line(SketchLine_1).startPoint(), 360, NB_COPIES, True) -[SketchLine_1, SketchLine_2, SketchLine_3, SketchLine_4, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchMultiRotation_1.rotated() +[SketchLine_2, SketchLine_3, SketchLine_4, SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8] = SketchMultiRotation_1.rotated() model.do() model.end()