Part: move refine model parameter to separate function

This commit is contained in:
wmayer
2024-07-02 08:46:15 +02:00
committed by wwmayer
parent 23999464e4
commit fed93b78f3
3 changed files with 12 additions and 20 deletions

View File

@@ -58,6 +58,13 @@ void throwIfInvalidIfCheckModel(const TopoDS_Shape& shape)
}
}
bool getRefineModelParameter()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean");
return hGrp->GetBool("RefineModel", false);
}
}
PROPERTY_SOURCE_ABSTRACT(Part::Boolean, Part::Feature)
@@ -73,10 +80,7 @@ Boolean::Boolean()
ADD_PROPERTY_TYPE(Refine,(0),"Boolean",(App::PropertyType)(App::Prop_None),"Refine shape (clean up redundant edges) after this boolean operation");
//init Refine property
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean");
this->Refine.setValue(hGrp->GetBool("RefineModel", false));
this->Refine.setValue(getRefineModelParameter());
}
short Boolean::mustExecute() const

View File

@@ -30,9 +30,6 @@
# include <TopTools_IndexedMapOfShape.hxx>
#endif
#include <App/Application.h>
#include <Base/Parameter.h>
#include "FeaturePartCommon.h"
#include "TopoShapeOpCode.h"
#include "modelRefine.h"
@@ -43,6 +40,7 @@ using namespace Part;
namespace Part
{
extern void throwIfInvalidIfCheckModel(const TopoDS_Shape& shape);
extern bool getRefineModelParameter();
}
PROPERTY_SOURCE(Part::Common, Part::Boolean)
@@ -76,10 +74,7 @@ MultiCommon::MultiCommon()
ADD_PROPERTY_TYPE(Refine,(0),"Boolean",(App::PropertyType)(App::Prop_None),"Refine shape (clean up redundant edges) after this boolean operation");
//init Refine property
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean");
this->Refine.setValue(hGrp->GetBool("RefineModel", false));
this->Refine.setValue(getRefineModelParameter());
}
short MultiCommon::mustExecute() const

View File

@@ -30,10 +30,6 @@
# include <TopTools_IndexedMapOfShape.hxx>
#endif
#include <App/Application.h>
#include <Base/Console.h>
#include <Base/Parameter.h>
#include "FeaturePartFuse.h"
#include "TopoShape.h"
#include "modelRefine.h"
@@ -46,6 +42,7 @@ using namespace Part;
namespace Part
{
extern void throwIfInvalidIfCheckModel(const TopoDS_Shape& shape);
extern bool getRefineModelParameter();
}
PROPERTY_SOURCE(Part::Fuse, Part::Boolean)
@@ -79,11 +76,7 @@ MultiFuse::MultiFuse()
ADD_PROPERTY_TYPE(Refine,(0),"Boolean",(App::PropertyType)(App::Prop_None),"Refine shape (clean up redundant edges) after this boolean operation");
//init Refine property
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean");
this->Refine.setValue(hGrp->GetBool("RefineModel", false));
this->Refine.setValue(getRefineModelParameter());
}
short MultiFuse::mustExecute() const