diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index 8be9d8ced..61a18aec0 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -30,6 +30,7 @@ # include # include # include +# include # include #endif @@ -439,7 +440,14 @@ App::DocumentObjectExecReturn *Thickness::execute(void) const TopoShape& shape = static_cast(source)->Shape.getShape(); if (shape.isNull()) return new App::DocumentObjectExecReturn("Source shape is empty."); - if (shape._Shape.ShapeType() != TopAbs_SOLID) + + int countSolids = 0; + TopExp_Explorer xp; + xp.Init(shape._Shape,TopAbs_SOLID); + for (;xp.More(); xp.Next()) { + countSolids++; + } + if (countSolids != 1) return new App::DocumentObjectExecReturn("Source shape is not a solid."); TopTools_ListOfShape closingFaces; diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index 7c0673766..53baa755b 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -31,6 +31,7 @@ # include # include # include +# include # include #endif @@ -1066,7 +1067,13 @@ void CmdPartThickness::activated(int iMsg) const Part::Feature* shape = static_cast(result.front().getObject()); if (shape->Shape.getValue().IsNull()) return; - if (shape->Shape.getValue().ShapeType() != TopAbs_SOLID) { + int countSolids = 0; + TopExp_Explorer xp; + xp.Init(shape->Shape.getValue(),TopAbs_SOLID); + for (;xp.More(); xp.Next()) { + countSolids++; + } + if (countSolids != 1) { QMessageBox::warning(Gui::getMainWindow(), QApplication::translate("CmdPartThickness", "Wrong selection"), QApplication::translate("CmdPartThickness", "Selected shape is not a solid"));