]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Changed "From" and "To" face naming in Extrusion and Revolution
authordbv <dbv@opencascade.com>
Fri, 26 Feb 2016 13:36:40 +0000 (16:36 +0300)
committerdbv <dbv@opencascade.com>
Fri, 26 Feb 2016 13:36:40 +0000 (16:36 +0300)
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp
src/FeaturesPlugin/Test/TestGroup.py
src/FeaturesPlugin/Test/TestPlacement.py
src/PythonAPI/examples/MakeBrick1.py
src/PythonAPI/examples/MakeBrick2.py
src/PythonAPI/examples/Platine.py

index b47952c5dbbc97c950b8c92bc3d073e7e7038287..48c4f08d08fc4a75cbaa144b2796477b40d57eab 100644 (file)
@@ -23,6 +23,8 @@
 #include <GeomAlgoAPI_ShapeTools.h>
 #include <GeomAPI_ShapeExplorer.h>
 
+#include <sstream>
+
 //=================================================================================================
 void FeaturesPlugin_CompositeBoolean::initAttributes()
 {
@@ -417,16 +419,20 @@ void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptr<ModelAPI_Resu
         std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(aSolidAlgo);
         if(aSweepAlgo.get()) {
           //Insert to faces
+          int aToFaceIndex = 1;
           const ListOfShape& aToFaces = aSweepAlgo->toFaces();
           for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
             std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
             if(aSubShapes->isBound(aToFace)) {
               aToFace = aSubShapes->find(aToFace);
             }
-            theResultBody->generated(aToFace, aToName, aToTag++);
+            std::ostringstream aStr;
+            aStr << aToName << "_" << aToFaceIndex++;
+            theResultBody->generated(aToFace, aStr.str(), aToTag++);
           }
 
           //Insert from faces
+          int aFromFaceIndex = 1;
           const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
           if (aFromTag < aToTag) aFromTag = aToTag;
           for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
@@ -434,7 +440,9 @@ void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptr<ModelAPI_Resu
             if(aSubShapes->isBound(aFromFace)) {
               aFromFace = aSubShapes->find(aFromFace);
             }
-            theResultBody->generated(aFromFace, aFromName, aFromTag++);
+            std::ostringstream aStr;
+            aStr << aFromName << "_" << aFromFaceIndex++;
+            theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
           }
         }
       }
index 3f95c49e857afc88cbc4d517705847699e4b2939..901433c9955015aa5effa825762ae62bedefcd4e 100644 (file)
@@ -182,6 +182,7 @@ void FeaturesPlugin_CompositeSketch::loadNamingDS(std::shared_ptr<ModelAPI_Resul
   std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(theMakeShape);
   if(aSweepAlgo.get()) {
     //Insert to faces
+    int aToFaceIndex = 1;
     const std::string aToName = "ToFace";
     int aToTag = 2;
     const ListOfShape& aToFaces = aSweepAlgo->toFaces();
@@ -190,10 +191,13 @@ void FeaturesPlugin_CompositeSketch::loadNamingDS(std::shared_ptr<ModelAPI_Resul
       if(aDataMap->isBound(aToFace)) {
         aToFace = aDataMap->find(aToFace);
       }
-      theResultBody->generated(aToFace, aToName, aToTag++);
+      std::ostringstream aStr;
+      aStr << aToName << "_" << aToFaceIndex++;
+      theResultBody->generated(aToFace, aStr.str(), aToTag++);
     }
 
     //Insert from faces
+    int aFromFaceIndex = 1;
     const std::string aFromName = "FromFace";
     int aFromTag = aToTag > 10000 ? aToTag : 10000;
     const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
@@ -202,7 +206,9 @@ void FeaturesPlugin_CompositeSketch::loadNamingDS(std::shared_ptr<ModelAPI_Resul
       if(aDataMap->isBound(aFromFace)) {
         aFromFace = aDataMap->find(aFromFace);
       }
-      theResultBody->generated(aFromFace, aFromName, aFromTag++);
+      std::ostringstream aStr;
+      aStr << aFromName << "_" << aFromFaceIndex++;
+      theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
     }
   }
 }
index c0bcd77f3bcb125d4f58cb8c534c9212ccd66084..535eb2fdd631548d7a1ef911ce84aa7d372f167a 100644 (file)
@@ -19,6 +19,8 @@
 #include <GeomAlgoAPI_Prism.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
+#include <sstream>
+
 //=================================================================================================
 FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
 {
@@ -173,6 +175,7 @@ void FeaturesPlugin_Extrusion::loadNamingDS(GeomAlgoAPI_Prism& thePrismAlgo,
   theResultBody->loadAndOrientGeneratedShapes(&thePrismAlgo, theBasis, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aSubShapes);
 
   //Insert to faces
+  int aToFaceIndex = 1;
   const std::string aToName = "ToFace";
   int aToTag = 2;
   const ListOfShape& aToFaces = thePrismAlgo.toFaces();
@@ -181,10 +184,13 @@ void FeaturesPlugin_Extrusion::loadNamingDS(GeomAlgoAPI_Prism& thePrismAlgo,
     if(aSubShapes->isBound(aToFace)) {
       aToFace = aSubShapes->find(aToFace);
     }
-    theResultBody->generated(aToFace, aToName, aToTag++);
+    std::ostringstream aStr;
+    aStr << aToName << "_" << aToFaceIndex++;
+    theResultBody->generated(aToFace, aStr.str(), aToTag++);
   }
 
   //Insert from faces
+  int aFromFaceIndex = 1;
   const std::string aFromName = "FromFace";
   int aFromTag = aToTag > 10000 ? aToTag : 10000;
   const ListOfShape& aFromFaces = thePrismAlgo.fromFaces();
@@ -193,6 +199,8 @@ void FeaturesPlugin_Extrusion::loadNamingDS(GeomAlgoAPI_Prism& thePrismAlgo,
     if(aSubShapes->isBound(aFromFace)) {
       aFromFace = aSubShapes->find(aFromFace);
     }
-    theResultBody->generated(aFromFace, aFromName, aFromTag++);
+    std::ostringstream aStr;
+    aStr << aFromName << "_" << aFromFaceIndex++;
+    theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
   }
 }
index 6d2c233d604891801e1e9e94fe594f9e03b369ea..c6fc2ed5ca548d2e24a00a85fbb18e14ecbc50a7 100644 (file)
@@ -20,6 +20,8 @@
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
 
+#include <sstream>
+
 //=================================================================================================
 FeaturesPlugin_Revolution::FeaturesPlugin_Revolution()
 {
@@ -189,6 +191,7 @@ void FeaturesPlugin_Revolution::loadNamingDS(GeomAlgoAPI_Revolution& theRevolAlg
   theResultBody->loadAndOrientGeneratedShapes(&theRevolAlgo, theBasis, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aSubShapes);
 
   //Insert to faces
+  int aToFaceIndex = 1;
   const std::string aToName = "ToFace";
   int aToTag = 2;
   const ListOfShape& aToFaces = theRevolAlgo.toFaces();
@@ -197,10 +200,13 @@ void FeaturesPlugin_Revolution::loadNamingDS(GeomAlgoAPI_Revolution& theRevolAlg
     if(aSubShapes->isBound(aToFace)) {
       aToFace = aSubShapes->find(aToFace);
     }
-    theResultBody->generated(aToFace, aToName, aToTag++);
+    std::ostringstream aStr;
+    aStr << aToName << "_" << aToFaceIndex++;
+    theResultBody->generated(aToFace, aStr.str(), aToTag++);
   }
 
   //Insert from faces
+  int aFromFaceIndex = 1;
   const std::string aFromName = "FromFace";
   int aFromTag = aToTag > 10000 ? aToTag : 10000;
   const ListOfShape& aFromFaces = theRevolAlgo.fromFaces();
@@ -209,6 +215,8 @@ void FeaturesPlugin_Revolution::loadNamingDS(GeomAlgoAPI_Revolution& theRevolAlg
     if(aSubShapes->isBound(aFromFace)) {
       aFromFace = aSubShapes->find(aFromFace);
     }
-    theResultBody->generated(aFromFace, aFromName, aFromTag++);
+    std::ostringstream aStr;
+    aStr << aFromName << "_" << aFromFaceIndex++;
+    theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
   }
 }
index e57ed3bce37f89a56d7ae356ed82ee39e56048c3..34adc5240ca8e7a211c8899509a3c8144f81fcdf 100644 (file)
@@ -78,12 +78,12 @@ aSession.startOperation()
 aGroupFeature = aSession.activeDocument().addFeature("Group")
 aSelectionListAttr = aGroupFeature.selectionList("group_list")
 aSelectionListAttr.setSelectionType("vertex")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
 aSession.finishOperation()
 #=========================================================================
 # Check results
@@ -101,12 +101,12 @@ aSelectionListAttr.setSelectionType("edge")
 aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1")
 aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2")
 aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/ToFace_1_1")
 aSession.finishOperation()
 #=========================================================================
 # Check results
@@ -155,7 +155,7 @@ aSession.startOperation()
 aGroupFeature = aSession.activeDocument().addFeature("Group")
 aSelectionListAttr = aGroupFeature.selectionList("group_list")
 aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/ToFace_1_1")
 aSession.finishOperation()
 #=========================================================================
 # Check results
index 4b85903a475fa18fa6e8f5c6cb79aacc0ca6bd43..47790a2cbf18b1f7041915657e6792855b325a9a 100644 (file)
@@ -131,7 +131,7 @@ aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
 aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
@@ -150,7 +150,7 @@ aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
 aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
@@ -168,8 +168,8 @@ aSession.undo()
 aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
@@ -187,8 +187,8 @@ aSession.undo()
 aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
@@ -206,8 +206,8 @@ aSession.undo()
 aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/LateralFace_4&Extrusion_1_1/FromFace_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/LateralFace_4&Extrusion_1_1/FromFace_1_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
index 3f7d6fbbca5942eb08b2fc828fe3342e8dae7bad..b698f0a50105571c9f2a4056357f4b1e32103a68 100644 (file)
@@ -48,7 +48,7 @@ thisface = "Extrusion_1_1/LateralFace_2"
 thisxmin = "Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2"
 thisxmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1"
 thiszmin = "Sketch_1/Edge5_1"
-thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1"
+thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1"
 
 mystand = model.addSketch(mypart, thisface)
 
index 55cc29bbc2f5a3722d1b3b5f72b1eafca0a56615..03c07c4eeb7ff410b7601e7699fd5150623bf01d 100644 (file)
@@ -45,7 +45,7 @@ mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
 
 thisface = "Extrusion_1_1/LateralFace_2"
 thisxmin = "Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2"
-thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1"
+thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1"
 
 mystand = model.addSketch(mypart, thisface)
 circle = mystand.addCircle(0, 25, 5)
index 4d136f95226f66083da3f336d8fb4242656b9658..47d7bf30d5f444f8a39872ef426d4da79608e396 100644 (file)
@@ -87,7 +87,7 @@ def bottom_body():
     sketch.setCoincident(arc.endPoint(), h1.startPoint())
 
     # Binding
-    left_e = sketch.addLine("Extrusion_1_1/LateralFace_4&Extrusion_1_1/ToFace_1")
+    left_e = sketch.addLine("Extrusion_1_1/LateralFace_4&Extrusion_1_1/ToFace_1_1")
     sketch.setCoincident(left_e.startPoint(), left.endPoint())
     sketch.setCoincident(left_e.endPoint(), left.startPoint())