]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix incorrect number of results returned by MultiRotation/MultiTranslation feature...
authorArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Thu, 3 Dec 2020 12:51:41 +0000 (15:51 +0300)
committerArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Thu, 3 Dec 2020 12:51:41 +0000 (15:51 +0300)
Update errors in unit tests.

src/BuildPlugin/Test/Test19056.py
src/FeaturesPlugin/Test/Test2724.py
src/SketchAPI/SketchAPI_Rotation.cpp
src/SketchAPI/SketchAPI_Translation.cpp
src/SketchPlugin/Test/Test2393.py
src/SketchPlugin/Test/Test3240.py

index 6807f3bf31baad14c12e61e4de6fc3e4897a95c6..868a08fe51c8e4eba17a30f59896a5b09699b815 100644 (file)
@@ -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")
index 40a0dc7bf743c9a6bb8333f065254c64ff8a218b..ec0fb61edda16b01f0bb46feae8f6047a0e20af0 100644 (file)
@@ -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()
index 07e426a71467d839673f45a23ce52328b0b15178..7b5ec3831fd28d50250bfd64d3755f015d7845fb 100644 (file)
@@ -67,11 +67,16 @@ void SketchAPI_Rotation::setRotationList(
 
 std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_Rotation::rotated() const
 {
-  std::list<ObjectPtr> aList = rotatedObjects()->list();
+  std::list<ObjectPtr> aList = rotationList()->list();
+  std::set<ObjectPtr> anOriginalObjects;
+  anOriginalObjects.insert(aList.begin(), aList.end());
   // remove all initial features
   std::list<FeaturePtr> anIntermediate;
+  aList = rotatedObjects()->list();
   std::list<ObjectPtr>::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())
index 3c95ce76b5fa140f2cf48f5a0a349ff4f673e2d8..ff32e3fa2e221500faec4e12d5995fe8c62a10ff 100644 (file)
@@ -64,11 +64,16 @@ void SketchAPI_Translation::setTranslationList(
 
 std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_Translation::translated() const
 {
-  std::list<ObjectPtr> aList = translatedObjects()->list();
+  std::list<ObjectPtr> aList = translationList()->list();
+  std::set<ObjectPtr> anOriginalObjects;
+  anOriginalObjects.insert(aList.begin(), aList.end());
   // remove all initial features
   std::list<FeaturePtr> anIntermediate;
+  aList = translatedObjects()->list();
   std::list<ObjectPtr>::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())
index 804c68428512696bf1c514ad925a20de98f8e72a..df93682c8c02f6af033c10fb066a8b855f3bae6d 100644 (file)
@@ -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)
index c6b0a2971b7d2863a9bccd5900ffa168e2c6124b..3380e5643547aff00dad791a0cf3838e855c97be 100644 (file)
@@ -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()