#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAPI_Face.h>
#include <GeomAPI_ShapeIterator.h>
#include <sstream>
anObjects.push_back(anObject);
}
}
+
+ if(anObjects.empty()) {
+ static const std::string aFeatureError = "Error: No objects for partition.";
+ setError(aFeatureError);
+ return;
+ }
+
std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints = GeomAlgoAPI_ShapeTools::getBoundingBox(anObjects, 1.0);
// Resize planes.
ResultBodyPtr aResultBody = document()->createBody(data(), theIndex);
// Store modified shape.
- if(aBaseShape->isEqual(theResultShape)) {
+ if(!aBaseShape.get() || aBaseShape->isEqual(theResultShape)) {
aResultBody->store(theResultShape);
+ setResult(aResultBody, theIndex);
return;
}
std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
int anIndex = 1;
for(ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
- std::ostringstream aStream;
- aStream << aModName << "_" << anIndex++;
+ std::string aModEdgeName = aModName + "_Edge_" + std::to_string((long long)anIndex);
+ std::string aModFaceName = aModName + "_Face_" + std::to_string((long long)anIndex++);
aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::EDGE,
- aModTag, aStream.str(), *aMapOfSubShapes.get(), true);
+ aModTag, aModEdgeName, *aMapOfSubShapes.get(), true);
+ aModTag += 1000;
aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::FACE,
- aModTag, aStream.str(), *aMapOfSubShapes.get(), true);
+ aModTag, aModFaceName, *aMapOfSubShapes.get(), true);
+ aModTag += 1000;
aResultBody->loadDeletedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::EDGE, aDelTag);
aResultBody->loadDeletedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::FACE, aDelTag);
- aModTag += 10000;
}
setResult(aResultBody, theIndex);