]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Debug of naming of Boolean operation of extrusion and revolution results.
authormpv <mpv@opencascade.com>
Thu, 3 Sep 2015 08:38:14 +0000 (11:38 +0300)
committermpv <mpv@opencascade.com>
Thu, 3 Sep 2015 08:38:14 +0000 (11:38 +0300)
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp
src/Model/Model_BodyBuilder.cpp
src/Model/Model_BodyBuilder.h
src/Model/Model_Update.cpp
src/ModelAPI/ModelAPI_BodyBuilder.h
src/ModelAPI/ModelAPI_ResultBody.cpp
src/ModelAPI/ModelAPI_ResultBody.h

index 98735660fed6c1487267221d32e118534cd7be88..64cd498840544d1bbf49d6e4e6acfa207242d4f7 100644 (file)
@@ -103,7 +103,7 @@ void FeaturesPlugin_CompositeBoolean::execute()
   // Getting faces to create solids.
   std::shared_ptr<ModelAPI_Feature> aSketchFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(
                                                      reference(SKETCH_OBJECT_ID())->value());
-  if(!aSketchFeature) {
+  if(!aSketchFeature || aSketchFeature->results().empty()) {
     return;
   }
   ResultPtr aSketchRes = aSketchFeature->results().front();
@@ -218,11 +218,11 @@ void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptr<ModelAPI_Resu
     theResultBody->store(theAlgo.shape());
   } else {
     const int aGenTag = 1;
-    const int aFromTag = 2;
-    const int aToTag = 3;
-    const int aModTag = 4;
-    const int aDelTag = 5;
-    const int aSubsolidsTag=6; /// sub solids will be placed at labels 6, 7, etc. if result is compound of solids
+    const int aModTag = 2;
+    const int aDelTag = 3;
+    const int aSubsolidsTag=4; /// sub solids will be placed at labels 6, 7, etc. if result is compound of solids
+    int aToTag = 5; // may be many labels, starting from this index
+    int aFromTag = 10000; // may be many labels, starting from this index or last aToTag index
     const std::string aGenName = "Generated";
     const std::string aModName = "Modified";
     const std::string aLatName = "LateralFace";
@@ -262,16 +262,17 @@ void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptr<ModelAPI_Resu
         if(aSubShapes->isBound(aToFace)) {
           aToFace = aSubShapes->find(aToFace);
         }
-        theResultBody->generated(aToFace, aToName, aToTag);
+        theResultBody->generated(aToFace, aToName, aToTag++);
       }
 
       //Insert from faces
+      if (aFromTag < aToTag) aFromTag = aToTag;
       for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
         std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
         if(aSubShapes->isBound(aFromFace)) {
           aFromFace = aSubShapes->find(aFromFace);
         }
-        theResultBody->generated(aFromFace, aFromName, aFromTag);
+        theResultBody->generated(aFromFace, aFromName, aFromTag++);
       }
     }
 
index 85b5b665deaa103ed604b6e9857b4a82ef6cfc12..c8ac130c44e0f33c8d7fe49615b8ccc3aa3d156c 100644 (file)
@@ -190,25 +190,25 @@ void FeaturesPlugin_Extrusion::loadNamingDS(GeomAlgoAPI_Prism& thePrismAlgo,
 
   //Insert to faces
   const std::string aToName = "ToFace";
-  const int aToTag = 2;
+  int aToTag = 2;
   const ListOfShape& aToFaces = thePrismAlgo.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);
+    theResultBody->generated(aToFace, aToName, aToTag++);
   }
 
   //Insert from faces
   const std::string aFromName = "FromFace";
-  const int aFromTag = 3;
+  int aFromTag = aToTag > 10000 ? aToTag : 10000;
   const ListOfShape& aFromFaces = thePrismAlgo.fromFaces();
   for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
     std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
     if(aSubShapes->isBound(aFromFace)) {
       aFromFace = aSubShapes->find(aFromFace);
     }
-    theResultBody->generated(aFromFace, aFromName, aFromTag);
+    theResultBody->generated(aFromFace, aFromName, aFromTag++);
   }
 }
index 26bbe7010e0a2112f091e9d647291be301e77caf..fd06b5f961e9dcd16761ca806a9aece60a5c451e 100644 (file)
@@ -198,25 +198,25 @@ void FeaturesPlugin_Revolution::loadNamingDS(GeomAlgoAPI_Revolution& theRevolAlg
 
   //Insert to faces
   const std::string aToName = "ToFace";
-  const int aToTag = 2;
+  int aToTag = 2;
   const ListOfShape& aToFaces = theRevolAlgo.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);
+    theResultBody->generated(aToFace, aToName, aToTag++);
   }
 
   //Insert from faces
   const std::string aFromName = "FromFace";
-  const int aFromTag = 3;
+  int aFromTag = aToTag > 10000 ? aToTag : 10000;
   const ListOfShape& aFromFaces = theRevolAlgo.fromFaces();
   for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
     std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
     if(aSubShapes->isBound(aFromFace)) {
       aFromFace = aSubShapes->find(aFromFace);
     }
-    theResultBody->generated(aFromFace, aFromName, aFromTag);
+    theResultBody->generated(aFromFace, aFromName, aFromTag++);
   }
 }
index 0efc177974662432e046e31a3bcbb562d2f2456c..bacee75ebf41ae62d1dca4d11fa31add5e425b7c 100755 (executable)
@@ -86,6 +86,8 @@ static void evolutionToSelectionRec(TDF_Label theLab, const bool theFlag) {
       aBuilder.Delete(aPairsIter->first);
     } else if (anEvol == TNaming_PRIMITIVE) {
       aBuilder.Generated(aPairsIter->second);
+    } else if (anEvol == TNaming_SELECTED) {
+      aBuilder.Select(aPairsIter->first, aPairsIter->second);
     }
   }
   // recursive call for all sub-labels
@@ -213,6 +215,22 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr<GeomAPI_Shape>& theO
     }
   }
 }
+
+void  Model_BodyBuilder::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
+{
+  std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+  if (aData) {
+    clean();   
+    if (!theShape.get())
+      return; // bad shape
+    TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+    if (aShape.IsNull())
+      return;  // null shape inside
+    TNaming_Builder aBuilder(aData->shapeLab());
+    aBuilder.Select(aShape, aShape);
+  }
+}
+
 void Model_BodyBuilder::clean()
 {
   std::vector<TNaming_Builder*>::iterator aBuilder = myBuilders.begin();
index 5097fc17ddab71867a196925fe4db492b88da40c..fbbcce9f631615aef1ad11d91fbbc318a3aa5d11 100755 (executable)
@@ -42,6 +42,10 @@ public:
                                                const std::shared_ptr<GeomAPI_Shape>& theNewShape,
                                           const int theDecomposeSolidsTag = 0);
 
+  /// Stores the shape without naming support
+  /// \param theShape shape to store
+  MODEL_EXPORT virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape);
+
   /// Returns the shape-result produced by this feature
   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
 
index 3ec27e47ff1144dc2c137822fbd77138f9dbe982..244aa68678f78cc2ad1d0dbaa10869a6fafbfafe 100644 (file)
@@ -222,7 +222,8 @@ void Model_Update::processOperation(const bool theTotalUpdate, const bool theFin
     for(aFIter = myWaitForFinish.begin(); aFIter != myWaitForFinish.end(); aFIter++)
     {
       FeaturePtr aF = std::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter);
-      if (aF && aF->data()->isValid() && aF->getKind() == "Extrusion") {
+      if (aF && aF->data()->isValid() && 
+           (aF->getKind() == "Extrusion" || aF->getKind() == "Revolution")) {
         AttributeSelectionListPtr aBase = aF->selectionList("base");
         if (aBase.get()) {
           for(int a = aBase->size() - 1; a >= 0; a--) {
index 6f857e46cfd9b8307e7ccdcceb355e9a4779a509..ff43ca7c454dc375fe6e19e128d1642309635e48 100755 (executable)
@@ -38,6 +38,9 @@ public:
                                  const std::shared_ptr<GeomAPI_Shape>& theNewShape,
                             const int theDecomposeSolidsTag = 0) = 0;
 
+  /// Stores the shape without naming support
+  virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+
   /// Returns the shape-result produced by this feature
   virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
 
index 5728190de96e895371b3285892d906e3b1c03009..17d01edc7e21161245c901708ab64992b22908a6 100644 (file)
@@ -41,6 +41,11 @@ void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& th
   myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
 }
 
+void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
+{
+  myBuilder->storeWithoutNaming(theShape);
+}
+
 std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
 {
   return myBuilder->shape();
index 7565d07bfeaab1c80b81aafe71b07961b114b7a4..1cce02786096552175a566dcf0adbbd0700be349 100644 (file)
@@ -55,6 +55,10 @@ public:
   MODELAPI_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag = 0);
 
+  /// Stores the shape without naming support
+  MODELAPI_EXPORT virtual void storeWithoutNaming(
+    const std::shared_ptr<GeomAPI_Shape>& theShape);
+
   /// Returns the shape-result produced by this feature
   MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();