PD: move refine model parameter to separate function

This commit is contained in:
wmayer
2024-07-02 10:08:50 +02:00
committed by wwmayer
parent fed93b78f3
commit 4c5e3979ce
5 changed files with 22 additions and 20 deletions

View File

@@ -49,6 +49,14 @@ FC_LOG_LEVEL_INIT("PartDesign", true, true)
namespace PartDesign {
bool getPDRefineModelParameter()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
return hGrp->GetBool("RefineModel", true);
}
// ------------------------------------------------------------------------------------------------
PROPERTY_SOURCE(PartDesign::Feature,Part::Feature)

View File

@@ -26,9 +26,7 @@
# include <Standard_Failure.hxx>
#endif
#include <App/Application.h>
#include <App/FeaturePythonPyImp.h>
#include <Base/Parameter.h>
#include <Mod/Part/App/modelRefine.h>
#include "FeatureAddSub.h"
@@ -39,6 +37,7 @@ using namespace PartDesign;
namespace PartDesign {
extern bool getPDRefineModelParameter();
PROPERTY_SOURCE(PartDesign::FeatureAddSub, PartDesign::Feature)
@@ -46,10 +45,7 @@ FeatureAddSub::FeatureAddSub()
{
ADD_PROPERTY(AddSubShape,(TopoDS_Shape()));
ADD_PROPERTY_TYPE(Refine,(0),"Part Design",(App::PropertyType)(App::Prop_None),"Refine shape (clean up redundant edges) after adding/subtracting");
//init Refine property
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", true));
this->Refine.setValue(getPDRefineModelParameter());
}
FeatureAddSub::Type FeatureAddSub::getAddSubType()

View File

@@ -29,9 +29,7 @@
# include <Standard_Failure.hxx>
#endif
#include <App/Application.h>
#include <App/DocumentObject.h>
#include <Base/Parameter.h>
#include <Mod/Part/App/modelRefine.h>
#include <Mod/Part/App/TopoShapeOpCode.h>
@@ -44,6 +42,8 @@ using namespace PartDesign;
namespace PartDesign {
extern bool getPDRefineModelParameter();
PROPERTY_SOURCE_WITH_EXTENSIONS(PartDesign::Boolean, PartDesign::Feature)
const char* Boolean::TypeEnums[]= {"Fuse","Cut","Common",nullptr};
@@ -54,9 +54,8 @@ Boolean::Boolean()
Type.setEnums(TypeEnums);
ADD_PROPERTY_TYPE(Refine,(0),"Part Design",(App::PropertyType)(App::Prop_None),"Refine shape (clean up redundant edges) after adding/subtracting");
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", true));
this->Refine.setValue(getPDRefineModelParameter());
ADD_PROPERTY_TYPE(UsePlacement,(0),"Part Design",(App::PropertyType)(App::Prop_None),"Apply the placement of the second ( tool ) object");
this->UsePlacement.setValue(false);

View File

@@ -35,10 +35,8 @@
#include <array>
#include <App/Application.h>
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/Parameter.h>
#include <Base/Reader.h>
#include <Mod/Part/App/modelRefine.h>
@@ -57,6 +55,7 @@ using namespace PartDesign;
namespace PartDesign
{
extern bool getPDRefineModelParameter();
PROPERTY_SOURCE(PartDesign::Transformed, PartDesign::Feature)
@@ -79,10 +78,7 @@ Transformed::Transformed()
(App::PropertyType)(App::Prop_None),
"Refine shape (clean up redundant edges) after adding/subtracting");
//init Refine property
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", true));
this->Refine.setValue(getPDRefineModelParameter());
}
void Transformed::positionBySupport()

View File

@@ -51,6 +51,11 @@ FC_LOG_LEVEL_INIT("PartDesign",true,true)
using namespace PartDesign;
namespace sp = std::placeholders;
namespace PartDesign
{
extern bool getPDRefineModelParameter();
}
// ============================================================================
PROPERTY_SOURCE(PartDesign::ShapeBinder, Part::Feature)
@@ -381,9 +386,7 @@ void SubShapeBinder::setupObject() {
_Version.setValue(2);
checkPropertyStatus();
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", true));
this->Refine.setValue(getPDRefineModelParameter());
}
App::DocumentObject* SubShapeBinder::getSubObject(const char* subname, PyObject** pyObj,