- std::shared_ptr<GeomAPI_Face> aGeomFace(new GeomAPI_Face(aGeomShape));
- if (aGeomFace.get() != NULL) {
- switch(aFaceType) {
- case GeomAbs_Plane:
+ if (!aGeomShape.get()) {
+ // if the shape is empty, apply the validator to the shape of result
+ aGeomShape = aSelectionAttr->context()->shape();
+ }
+ // it is necessary to check whether the shape is face in order to set in selection a value
+ // with any type and check the type in this validator
+ // It is realized to select any object in OB and filter it in this validator (sketch plane)
+ if (!aGeomShape->isFace()) {
+ aValid = false;
+ theError = "The shape is not a face.";
+ }
+ else {
+ std::shared_ptr<GeomAPI_Face> aGeomFace(new GeomAPI_Face(aGeomShape));
+ if (!aGeomFace.get()) {
+ aValid = false;
+ theError = "The shape is not a face.";
+ }
+ else {
+ GeomAbs_SurfaceType aFaceType = GeomAbs_Plane;
+ if (theArguments.size() == 1)
+ aFaceType = faceType(theArguments.front());
+
+ switch (aFaceType) {
+ case GeomAbs_Plane: {