Part: add Refine property to BOPs

followup to PartDesign
This commit is contained in:
DeepSOIC
2018-01-18 16:21:51 +03:00
committed by wmayer
parent 27701ae852
commit 478611371b
6 changed files with 28 additions and 3 deletions

View File

@@ -47,6 +47,13 @@ Boolean::Boolean(void)
ADD_PROPERTY_TYPE(History,(ShapeHistory()), "Boolean", (App::PropertyType)
(App::Prop_Output|App::Prop_Transient|App::Prop_Hidden), "Shape history");
History.setSize(0);
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));
}
short Boolean::mustExecute() const
@@ -102,7 +109,7 @@ App::DocumentObjectExecReturn *Boolean::execute(void)
history.push_back(buildHistory(*mkBool.get(), TopAbs_FACE, resShape, BaseShape));
history.push_back(buildHistory(*mkBool.get(), TopAbs_FACE, resShape, ToolShape));
if (hGrp->GetBool("RefineModel", false)) {
if (this->Refine.getValue()) {
try {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);

View File

@@ -42,6 +42,7 @@ public:
App::PropertyLink Base;
App::PropertyLink Tool;
PropertyShapeHistory History;
App::PropertyBool Refine;
/** @name methods override Feature */
//@{

View File

@@ -66,6 +66,13 @@ MultiCommon::MultiCommon(void)
ADD_PROPERTY_TYPE(History,(ShapeHistory()), "Boolean", (App::PropertyType)
(App::Prop_Output|App::Prop_Transient|App::Prop_Hidden), "Shape history");
History.setSize(0);
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));
}
short MultiCommon::mustExecute() const
@@ -145,7 +152,7 @@ App::DocumentObjectExecReturn *MultiCommon::execute(void)
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
}
}
if (hGrp->GetBool("RefineModel", false)) {
if (this->Refine.getValue()) {
try {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);

View File

@@ -54,6 +54,7 @@ public:
App::PropertyLinkList Shapes;
PropertyShapeHistory History;
App::PropertyBool Refine;
/** @name methods override feature */
//@{

View File

@@ -65,6 +65,14 @@ MultiFuse::MultiFuse(void)
ADD_PROPERTY_TYPE(History,(ShapeHistory()), "Boolean", (App::PropertyType)
(App::Prop_Output|App::Prop_Transient|App::Prop_Hidden), "Shape history");
History.setSize(0);
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));
}
short MultiFuse::mustExecute() const
@@ -169,7 +177,7 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void)
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
}
}
if (hGrp->GetBool("RefineModel", false)) {
if (this->Refine.getValue()) {
try {
TopoDS_Shape oldShape = resShape;
BRepBuilderAPI_RefineModel mkRefine(oldShape);

View File

@@ -55,6 +55,7 @@ public:
App::PropertyLinkList Shapes;
PropertyShapeHistory History;
App::PropertyBool Refine;
/** @name methods override feature */
//@{