diff --git a/src/Mod/Part/App/FeaturePartBoolean.cpp b/src/Mod/Part/App/FeaturePartBoolean.cpp index 2a1781b6c..0d63d309c 100644 --- a/src/Mod/Part/App/FeaturePartBoolean.cpp +++ b/src/Mod/Part/App/FeaturePartBoolean.cpp @@ -24,6 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include # include #endif @@ -82,13 +83,20 @@ App::DocumentObjectExecReturn *Boolean::execute(void) if (resShape.IsNull()) { return new App::DocumentObjectExecReturn("Resulting shape is invalid"); } + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean"); + + if (hGrp->GetBool("CheckModel", false)) { + BRepCheck_Analyzer aChecker(resShape); + if (! aChecker.IsValid() ) { + return new App::DocumentObjectExecReturn("Resulting shape is invalid"); + } + } std::vector history; history.push_back(buildHistory(*mkBool.get(), TopAbs_FACE, resShape, BaseShape)); history.push_back(buildHistory(*mkBool.get(), TopAbs_FACE, resShape, ToolShape)); - Base::Reference hGrp = App::GetApplication().GetUserParameter() - .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean"); if (hGrp->GetBool("RefineModel", false)) { TopoDS_Shape oldShape = resShape; BRepBuilderAPI_RefineModel mkRefine(oldShape); diff --git a/src/Mod/Part/App/FeaturePartCommon.cpp b/src/Mod/Part/App/FeaturePartCommon.cpp index 01ef09e41..cb1338e05 100644 --- a/src/Mod/Part/App/FeaturePartCommon.cpp +++ b/src/Mod/Part/App/FeaturePartCommon.cpp @@ -25,6 +25,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include # include #endif @@ -112,6 +113,12 @@ App::DocumentObjectExecReturn *MultiCommon::execute(void) Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean"); + if (hGrp->GetBool("CheckModel", false)) { + BRepCheck_Analyzer aChecker(resShape); + if (! aChecker.IsValid() ) { + return new App::DocumentObjectExecReturn("Resulting shape is invalid"); + } + } if (hGrp->GetBool("RefineModel", false)) { TopoDS_Shape oldShape = resShape; BRepBuilderAPI_RefineModel mkRefine(oldShape); diff --git a/src/Mod/Part/App/FeaturePartFuse.cpp b/src/Mod/Part/App/FeaturePartFuse.cpp index ba73877ea..9444524c3 100644 --- a/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/src/Mod/Part/App/FeaturePartFuse.cpp @@ -24,6 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include # include #endif @@ -111,6 +112,12 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void) Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean"); + if (hGrp->GetBool("CheckModel", false)) { + BRepCheck_Analyzer aChecker(resShape); + if (! aChecker.IsValid() ) { + return new App::DocumentObjectExecReturn("Resulting shape is invalid"); + } + } if (hGrp->GetBool("RefineModel", false)) { TopoDS_Shape oldShape = resShape; BRepBuilderAPI_RefineModel mkRefine(oldShape); diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.cpp b/src/Mod/Part/Gui/DlgSettingsGeneral.cpp index a9c917a86..aee0f17a5 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.cpp +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.cpp @@ -70,6 +70,7 @@ void DlgSettingsGeneral::saveSettings() break; } ui->checkBooleanRefine->onSave(); + ui->checkBooleanCheck->onSave(); } void DlgSettingsGeneral::loadSettings() @@ -79,6 +80,7 @@ void DlgSettingsGeneral::loadSettings() int unit = hGrp->GetInt("Unit", 0); ui->comboBoxUnits->setCurrentIndex(unit); ui->checkBooleanRefine->onRestore(); + ui->checkBooleanCheck->onRestore(); } /** diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.ui b/src/Mod/Part/Gui/DlgSettingsGeneral.ui index 535d0f1d3..276f4acd7 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.ui +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.ui @@ -87,6 +87,19 @@ + + + + Automatically check model after boolean operation + + + CheckModel + + + Mod/Part/Boolean + + +