Salome HOME
Issue #2021
authordbv <dbv@opencascade.com>
Mon, 6 Feb 2017 13:34:01 +0000 (16:34 +0300)
committerdbv <dbv@opencascade.com>
Mon, 6 Feb 2017 13:34:01 +0000 (16:34 +0300)
Added flag to Model_BodyBuilder::loadAndOrientModifiedShapes to store modified shapes as generated. It is used to avoid problem when one shapes produce several shapes and they can be distinguished by neighborhoods.

src/Model/Model_BodyBuilder.cpp
src/Model/Model_BodyBuilder.h
src/ModelAPI/ModelAPI_BodyBuilder.h
src/ModelAPI/ModelAPI_ResultBody.cpp
src/ModelAPI/ModelAPI_ResultBody.h

index 38d349bd7386b89dd822b2ab45ff9d03d22b4c22..2e5c4ba6c03b1ec610f64f8cbdd69b74c867779b 100755 (executable)
@@ -348,7 +348,8 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes (
   const int  theTag,
   const std::string& theName,
   GeomAPI_DataMapOfShapeShape& theSubShapes,
-  const bool theIsStoreSeparate)
+  const bool theIsStoreSeparate,
+  const bool theIsStoreAsGenerated)
 {
   int anIndex = 1;
   int aTag = theTag;
@@ -377,7 +378,13 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes (
       GeomShapePtr aGeomNewShape(new GeomAPI_Shape());
       aGeomNewShape->setImpl(new TopoDS_Shape(aNewShape));
       if(!aRoot.IsSame(aNewShape) && aResultShape->isSubShape(aGeomNewShape)) {
-        builder(aTag)->Modify(aRoot,aNewShape);
+        if(theIsStoreAsGenerated) {
+          // Here we store shapes as generated, to avoid problem when one parent shape produce
+          // several child shapes. In this case naming could not determine which shape to select.
+          builder(aTag)->Generated(aRoot,aNewShape);
+        } else {
+          builder(aTag)->Modify(aRoot,aNewShape);
+        }
         if(isBuilt) {
           if(theIsStoreSeparate) {
             aStream.str(std::string());
index 6f2f868eb14c87e9724cc2d453f2b97632c90215..7d805f4c3e6a5dbacfcb1d7977f1e3dd61520e1d 100755 (executable)
@@ -87,7 +87,8 @@ public:
                                                const int  theTag,
                                                                                           const std::string& theName,
                                                GeomAPI_DataMapOfShapeShape& theSubShapes,
-                                               const bool theIsStoreSeparate = false);
+                                               const bool theIsStoreSeparate = false,
+                                               const bool theIsStoreAsGenerated = false);
    /// load and orient generated shapes
   MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
                                                   GeomAlgoAPI_MakeShape* theMS,
index d3216d15e8863d51d5f9521455099021f37f2dd1..8ebe2fe913f145830e1f36e5b86dd7528e6ec74f 100755 (executable)
@@ -83,7 +83,8 @@ public:
                                                const int  theTag,
                                                                                           const std::string& theName,
                                                GeomAPI_DataMapOfShapeShape& theSubShapes,
-                                               const bool theIsStoreSeparate = false) = 0;
+                                               const bool theIsStoreSeparate = false,
+                                               const bool theIsStoreAsGenerated = false) = 0;
   /// load and orient generated shapes
   virtual void loadAndOrientGeneratedShapes (
                                                   GeomAlgoAPI_MakeShape* theMS,
index e5f023f11c46af0cfd20166a1094dd9af6060b62..947dc9bd573ec1a32b59980f23829253284e6093 100644 (file)
@@ -117,10 +117,12 @@ void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
 void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
     const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
-    const bool theIsStoreSeparate)
+    const bool theIsStoreSeparate,
+    const bool theIsStoreAsGenerated)
 {
   myBuilder->loadAndOrientModifiedShapes(
-    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate);
+    theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
+    theIsStoreAsGenerated);
 }
 
 void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
index 8b90e4427440c2796840b274da23063ec6c07f97..ac3e5d3fac03763f7de0f77be5bece869b9cabed 100644 (file)
@@ -113,7 +113,8 @@ public:
   MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
     const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
-    const bool theIsStoreSeparate = false);
+    const bool theIsStoreSeparate = false,
+    const bool theIsStoreAsGenerated = false);
   /// load and orient generated shapes
   MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape,