+ std::shared_ptr<GeomAPI_Trsf> aTrsf = aPlacementAlgo.transformation();
+
+ // Applying transformation to each object.
+ int aResultIndex = 0;
+ std::list<ResultPtr>::iterator aContext = aContextes.begin();
+ for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
+ anObjectsIt++, aContext++) {
+
+ if ((*aContext)->groupName() == ModelAPI_ResultPart::group()) { // for part results just set transformation
+ ResultPartPtr anOrigin = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aContext);
+ ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex);
+ aResultPart->setTrsf(aContextRes, aTrsf);
+ setResult(aResultPart, aResultIndex);
+ } else {
+ std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
+ GeomAlgoAPI_Transform aTransformAlgo(aBaseShape, aTrsf);
+
+ // Checking that the algorithm worked properly.
+ if(!aTransformAlgo.isDone()) {
+ static const std::string aFeatureError = "Transform algorithm failed";
+ setError(aFeatureError);
+ break;
+ }
+ if(aTransformAlgo.shape()->isNull()) {
+ static const std::string aShapeError = "Resulting shape is Null";
+ setError(aShapeError);
+ break;
+ }
+ if(!aTransformAlgo.isValid()) {
+ std::string aFeatureError = "Warning: resulting shape is not valid";
+ setError(aFeatureError);
+ break;
+ }
+
+ //LoadNamingDS
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
+ LoadNamingDS(aTransformAlgo, aResultBody, aBaseShape);
+ setResult(aResultBody, aResultIndex);
+ }
+ aResultIndex++;