Check for compound with single solid for thickness tool

This commit is contained in:
wmayer 2012-11-27 11:18:25 +01:00
parent de5edb8f88
commit a1bf6277f1
2 changed files with 17 additions and 2 deletions

View File

@ -30,6 +30,7 @@
# include <BRepBuilderAPI_MakeWire.hxx>
# include <BRepOffsetAPI_MakePipeShell.hxx>
# include <TopTools_ListIteratorOfListOfShape.hxx>
# include <TopExp_Explorer.hxx>
# include <Precision.hxx>
#endif
@ -439,7 +440,14 @@ App::DocumentObjectExecReturn *Thickness::execute(void)
const TopoShape& shape = static_cast<Part::Feature*>(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;

View File

@ -31,6 +31,7 @@
# include <QPointer>
# include <Standard_math.hxx>
# include <TopoDS_Shape.hxx>
# include <TopExp_Explorer.hxx>
# include <Inventor/events/SoMouseButtonEvent.h>
#endif
@ -1066,7 +1067,13 @@ void CmdPartThickness::activated(int iMsg)
const Part::Feature* shape = static_cast<const Part::Feature*>(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"));