]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2023: Crash during a rotation after an intersection
authordbv <dbv@opencascade.com>
Tue, 7 Feb 2017 11:21:29 +0000 (14:21 +0300)
committerdbv <dbv@opencascade.com>
Tue, 7 Feb 2017 11:21:29 +0000 (14:21 +0300)
Fixed infinite loop in namig for Translation, Rotation, Placement

src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_Placement.cpp
src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp
src/FeaturesPlugin/FeaturesPlugin_Tools.cpp
src/FeaturesPlugin/FeaturesPlugin_Tools.h
src/FeaturesPlugin/FeaturesPlugin_Translation.cpp
src/FeaturesPlugin/Test/Test2023.py [new file with mode: 0644]

index cf821fd9e051dc28768f43fdee83e6298cfbacc9..d63df3b66cb5a6b93e0d9744d8430b1db67ddd19 100644 (file)
@@ -143,4 +143,5 @@ ADD_UNIT_TESTS(TestExtrusion.py
                Test1922.py
                Test1942.py
                Test1915.py
+               Test2023.py
 )
index c28d769d0e073a8c88b33b3e2d09bb9e427e4c55..0039d750d4ab0d6e7e30a161961d67e15fb3fc7f 100644 (file)
@@ -193,11 +193,10 @@ void FeaturesPlugin_Placement::loadNamingDS(GeomAlgoAPI_Transform& theTransformA
   //load result
   theResultBody->storeModified(theBaseShape, theTransformAlgo.shape());
 
-  int aPlacedTag = 1;
   std::string aPlacedName = "Placed";
   std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTransformAlgo.mapOfSubShapes();
 
   FeaturesPlugin_Tools::storeModifiedShapes(theTransformAlgo, theResultBody,
-                                            theBaseShape, aPlacedTag, aPlacedName,
+                                            theBaseShape, 1, 2, 3, aPlacedName,
                                             *aSubShapes.get());
 }
index 9ba830b83b603144021b4cbe62eee553cd8b3cc6..16028546cda773f9cc404da96c96521d5085fc47 100755 (executable)
@@ -128,11 +128,10 @@ void FeaturesPlugin_Rotation::loadNamingDS(GeomAlgoAPI_Rotation& theRotaionAlgo,
   // Store result.
   theResultBody->storeModified(theBaseShape, theRotaionAlgo.shape());
 
-  int aRotatedTag = 1;
   std::string aRotatedName = "Rotated";
   std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theRotaionAlgo.mapOfSubShapes();
 
   FeaturesPlugin_Tools::storeModifiedShapes(theRotaionAlgo, theResultBody,
-                                            theBaseShape, aRotatedTag, aRotatedName,
+                                            theBaseShape, 1, 2, 3, aRotatedName,
                                             *aSubShapes.get());
 }
index 847a8916f7596ed0aac0bb5d2d96bfb4aaa7f050..89f5870b230ef7521c65b3edf3b6ab9c47df1dab 100644 (file)
@@ -13,7 +13,9 @@
 void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
                                                std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                                                std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                                               int& theTag,
+                                               const int theFaceTag,
+                                               const int theEdgeTag,
+                                               const int theVertexTag,
                                                const std::string theName,
                                                GeomAPI_DataMapOfShapeShape& theSubShapes)
 {
@@ -21,7 +23,14 @@ void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
     case GeomAPI_Shape::COMPOUND: {
       for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
       {
-        storeModifiedShapes(theAlgo, theResultBody, theBaseShape, theTag, theName, theSubShapes);
+        storeModifiedShapes(theAlgo,
+                            theResultBody,
+                            anIt.current(),
+                            theFaceTag,
+                            theEdgeTag,
+                            theVertexTag,
+                            theName,
+                            theSubShapes);
       }
       break;
     }
@@ -30,25 +39,22 @@ void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
     case GeomAPI_Shape::SHELL: {
       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
                                 theBaseShape, GeomAPI_Shape::FACE,
-                                theTag, theName + "_Face", theSubShapes);
+                                theFaceTag, theName + "_Face", theSubShapes);
       if (theBaseShape->shapeType() == GeomAPI_Shape::COMPSOLID
           || theBaseShape->shapeType() == GeomAPI_Shape::SOLID) {
         break;
       }
-      ++theTag;
     }
     case GeomAPI_Shape::FACE:
     case GeomAPI_Shape::WIRE: {
       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
                                 theBaseShape, GeomAPI_Shape::EDGE,
-                                theTag, theName + "_Edge", theSubShapes);
-      ++theTag;
+                                theEdgeTag, theName + "_Edge", theSubShapes);
     }
     case GeomAPI_Shape::EDGE: {
       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
                               theBaseShape, GeomAPI_Shape::VERTEX,
-                              theTag, theName + "_Vertex", theSubShapes);
-      ++theTag;
+                              theVertexTag, theName + "_Vertex", theSubShapes);
     }
   }
 }
index c6cd120dbd4642282ce3a6509915834323160333..3ba38561eae6466dc25138c0022fea514d04bcb8 100644 (file)
@@ -16,7 +16,9 @@ public:
   static void storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
                                   std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                                   std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                                  int& theTag,
+                                  const int theFaceTag,
+                                  const int theEdgeTag,
+                                  const int theVertexTag,
                                   const std::string theName,
                                   GeomAPI_DataMapOfShapeShape& theSubShapes);
 };
index 4e7dcef66a9b08d3b02e39bc27c658b8bd79e7ef..34e5bd1122b2e1a642e6cfdfc82a0e07c7cb171a 100644 (file)
@@ -356,11 +356,10 @@ void FeaturesPlugin_Translation::loadNamingDS(GeomAlgoAPI_Translation& theTransl
   // Store result.
   theResultBody->storeModified(theBaseShape, theTranslationAlgo.shape());
 
-  int aTranslatedTag = 1;
   std::string aTranslatedName = "Translated";
   std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTranslationAlgo.mapOfSubShapes();
 
   FeaturesPlugin_Tools::storeModifiedShapes(theTranslationAlgo, theResultBody,
-                                            theBaseShape, aTranslatedTag, aTranslatedName,
+                                            theBaseShape, 1, 2, 3, aTranslatedName,
                                             *aSubShapes.get());
 }
diff --git a/src/FeaturesPlugin/Test/Test2023.py b/src/FeaturesPlugin/Test/Test2023.py
new file mode 100644 (file)
index 0000000..953a4e5
--- /dev/null
@@ -0,0 +1,41 @@
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(178.3876500857632, 167.2384219554031, -133.7907375643225, 167.2384219554031)
+SketchLine_2 = Sketch_1.addLine(-133.7907375643225, 167.2384219554031, -133.7907375643225, -134.6483704974271)
+SketchLine_3 = Sketch_1.addLine(-133.7907375643225, -134.6483704974271, 178.3876500857632, -134.6483704974271)
+SketchLine_4 = Sketch_1.addLine(178.3876500857632, -134.6483704974271, 178.3876500857632, 167.2384219554031)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 100, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+SketchLine_5 = Sketch_2.addLine(99.48542024013722, 69.46826758147516, -34.30531732418524, 69.46826758147516)
+SketchLine_6 = Sketch_2.addLine(-34.30531732418524, 69.46826758147516, -34.30531732418524, -62.60720411663805)
+SketchLine_7 = Sketch_2.addLine(-34.30531732418524, -62.60720411663805, 99.48542024013722, -62.60720411663805)
+SketchLine_8 = Sketch_2.addLine(99.48542024013722, -62.60720411663805, 99.48542024013722, 69.46826758147516)
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 110)
+Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
+Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "Intersection_1_1")], model.selection("EDGE", "PartSet/OZ"), 45)
+model.end()
+
+assert(model.checkPythonDump())