-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "FeaturesPlugin_Extrusion.h"
#include <ModelAPI_Validator.h>
#include <GeomAlgoAPI_Prism.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_Dir.h>
#include <GeomAPI_Edge.h>
if(!aToShape.get() && aSelection->context().get()) {
aToShape = aSelection->context()->shape();
}
- if (aToShape->isCompound()) {
+ if (aToShape.get() && aToShape->isCompound()) {
GeomAPI_ShapeIterator anIt(aToShape);
aToShape = anIt.current();
}
if(!aFromShape.get() && aSelection->context().get()) {
aFromShape = aSelection->context()->shape();
}
- if (aFromShape->isCompound()) {
+ if (aFromShape.get() && aFromShape->isCompound()) {
GeomAPI_ShapeIterator anIt(aFromShape);
aFromShape = anIt.current();
}
}
// Generating result for each base shape.
+ std::string anError;
for(ListOfShape::const_iterator
anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo(new GeomAlgoAPI_Prism(aBaseShape, aDir,
aToShape, aToSize,
aFromShape, aFromSize));
- if(!isMakeShapeValid(aPrismAlgo)) {
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPrismAlgo, getKind(), anError)) {
+ setError(anError);
return false;
}