From cd3f2b2e26eb0e39263cf0abefd2c463a0491aed Mon Sep 17 00:00:00 2001 From: dbv Date: Mon, 6 Feb 2017 16:34:01 +0300 Subject: [PATCH] Issue #2021 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 | 11 +++++++++-- src/Model/Model_BodyBuilder.h | 3 ++- src/ModelAPI/ModelAPI_BodyBuilder.h | 3 ++- src/ModelAPI/ModelAPI_ResultBody.cpp | 6 ++++-- src/ModelAPI/ModelAPI_ResultBody.h | 3 ++- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 38d349bd7..2e5c4ba6c 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -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()); diff --git a/src/Model/Model_BodyBuilder.h b/src/Model/Model_BodyBuilder.h index 6f2f868eb..7d805f4c3 100755 --- a/src/Model/Model_BodyBuilder.h +++ b/src/Model/Model_BodyBuilder.h @@ -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, diff --git a/src/ModelAPI/ModelAPI_BodyBuilder.h b/src/ModelAPI/ModelAPI_BodyBuilder.h index d3216d15e..8ebe2fe91 100755 --- a/src/ModelAPI/ModelAPI_BodyBuilder.h +++ b/src/ModelAPI/ModelAPI_BodyBuilder.h @@ -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, diff --git a/src/ModelAPI/ModelAPI_ResultBody.cpp b/src/ModelAPI/ModelAPI_ResultBody.cpp index e5f023f11..947dc9bd5 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.cpp +++ b/src/ModelAPI/ModelAPI_ResultBody.cpp @@ -117,10 +117,12 @@ void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS, void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS, std::shared_ptr 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, diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 8b90e4427..ac3e5d3fa 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -113,7 +113,8 @@ public: MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS, std::shared_ptr 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 theShapeIn, const int theKindOfShape, -- 2.39.2