PartDesign: #2683 add Refine property

resolves #2683

Adds Refine property to sketch-based and transformation features. The
property is initialized according to preferences, and can be altered in
property editor on per-feature basis.
This commit is contained in:
DeepSOIC
2018-01-18 13:34:41 +03:00
committed by wmayer
parent 80e3bfb69c
commit 27701ae852
4 changed files with 19 additions and 6 deletions

View File

@@ -92,6 +92,12 @@ ProfileBased::ProfileBased()
ADD_PROPERTY_TYPE(Midplane,(0),"SketchBased", App::Prop_None, "Extrude symmetric to sketch face");
ADD_PROPERTY_TYPE(Reversed, (0),"SketchBased", App::Prop_None, "Reverse extrusion direction");
ADD_PROPERTY_TYPE(UpToFace,(0),"SketchBased",(App::PropertyType)(App::Prop_None),"Face where feature will end");
ADD_PROPERTY_TYPE(Refine,(0),"SketchBased",(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", false));
}
short ProfileBased::mustExecute() const
@@ -1039,9 +1045,7 @@ void ProfileBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std
TopoDS_Shape ProfileBased::refineShapeIfActive(const TopoDS_Shape& oldShape) const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
if (hGrp->GetBool("RefineModel", false)) {
if (this->Refine.getValue()) {
try {
Part::BRepBuilderAPI_RefineModel mkRefine(oldShape);
TopoDS_Shape resShape = mkRefine.Shape();

View File

@@ -54,6 +54,8 @@ public:
/// Face to extrude up to
App::PropertyLinkSub UpToFace;
App::PropertyBool Refine;
short mustExecute() const;
/** calculates and updates the Placement property based on the features

View File

@@ -63,6 +63,13 @@ Transformed::Transformed()
ADD_PROPERTY(Originals,(0));
Originals.setSize(0);
Placement.setStatus(App::Property::ReadOnly, true);
ADD_PROPERTY_TYPE(Refine,(0),"SketchBased",(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", false));
}
void Transformed::positionBySupport(void)
@@ -374,9 +381,7 @@ App::DocumentObjectExecReturn *Transformed::execute(void)
TopoDS_Shape Transformed::refineShapeIfActive(const TopoDS_Shape& oldShape) const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
if (hGrp->GetBool("RefineModel", false)) {
if (this->Refine.getValue()) {
try {
Part::BRepBuilderAPI_RefineModel mkRefine(oldShape);
TopoDS_Shape resShape = mkRefine.Shape();

View File

@@ -49,6 +49,8 @@ public:
*/
App::PropertyLinkList Originals;
App::PropertyBool Refine;
/**
* Returns the BaseFeature property's object(if any) otherwise return first original,
* which serves as "Support" for old style workflows