int aResultIndex = 0;
ListOfShape::const_iterator aBaseIt = aBaseShapesList.cbegin();
ListOfMakeShape::const_iterator anAlgoIt = aMakeShapesList.cbegin();
- for(; aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend(); ++aBaseIt, ++anAlgoIt) {
+ for(; aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend();
+ ++aBaseIt, ++anAlgoIt) {
storeResult(*aBaseIt, *anAlgoIt, aResultIndex++);
}
{
theMakeShapes.clear();
- /// Sub-feature of the composite should be set in the base list.
- setSketchObjectToList();
-
// Getting base shapes.
getBaseShapes(theBaseShapes);
anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
}
if(anEdge.get()) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+ if(anEdge->isLine()) {
+ anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+ }
+ }
+
+ if(!anAxis.get()) {
+ return false;
}
// Getting angles.
double aToAngle = 0.0;
double aFromAngle = 0.0;
- if(string(CREATION_METHOD())->value() == "ByAngles") {
+ if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_ANGLES()) {
aToAngle = real(TO_ANGLE_ID())->value();
aFromAngle = real(FROM_ANGLE_ID())->value();
} else {
GeomShapePtr aToShape;
GeomShapePtr aFromShape;
- if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") {
+ if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) {
aSelection = selection(TO_OBJECT_ID());
if(aSelection.get()) {
aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(aSelection->value());
}
// Generating result for each base shape.
- for(ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
+ for(ListOfShape::const_iterator
+ anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
GeomShapePtr aBaseShape = *anIter;
- std::shared_ptr<GeomAlgoAPI_Revolution> aRevolAlgo(new GeomAlgoAPI_Revolution(aBaseShape, anAxis,
- aToShape, aToAngle,
- aFromShape, aFromAngle));
+ std::shared_ptr<GeomAlgoAPI_Revolution> aRevolAlgo(new GeomAlgoAPI_Revolution(
+ aBaseShape, anAxis,
+ aToShape, aToAngle,
+ aFromShape, aFromAngle));
if(!isMakeShapeValid(aRevolAlgo)) {
return false;
}