AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
GeomShapePtr aShape = aSelection->value();
if(!aShape.get()) {
- aShape = aSelection->context()->shape();
+ if (aSelection->context().get())
+ aShape = aSelection->context()->shape();
}
- aListOfShapes.push_back(aShape);
+ if (aShape.get())
+ aListOfShapes.push_back(aShape);
}
// Create wire.
}
}
+ if(anEdges.empty()) {
+ theError = "Objects not selected.";
+ return false;
+ }
+
// Check that edges does not have intersections.
if(anEdges.size() > 1) {
GeomAlgoAPI_PaveFiller aPaveFiller(anEdges, false);
// Check that they are planar.
std::shared_ptr<GeomAPI_Pln> aPln = GeomAlgoAPI_ShapeTools::findPlane(anEdges);
if(!aPln.get()) {
- theError = "Selected objects are not planar.";
+ theError = "Selected object(s) should belong to only one plane.";
return false;
}
GeomAlgoAPI_SketchBuilder::createFaces(aPln->location(), aPln->xDirection(),
aPln->direction(), anEdges, aFaces);
if(aFaces.empty()) {
- theError = "Selected objects does not have closed contours.";
+ theError = "Selected objects do not generate closed contour.";
return false;
}