diff --git a/src/Mod/PartDesign/App/FeatureRevolution.cpp b/src/Mod/PartDesign/App/FeatureRevolution.cpp index 4b550638d1..99a548d927 100644 --- a/src/Mod/PartDesign/App/FeatureRevolution.cpp +++ b/src/Mod/PartDesign/App/FeatureRevolution.cpp @@ -197,6 +197,9 @@ App::DocumentObjectExecReturn *Revolution::execute() else return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Could not revolve the sketch!")); + // eventually disable some settings that are not valid for the current method + updateProperties(method); + return App::DocumentObject::StdReturn; } catch (Standard_Failure& e) { @@ -326,4 +329,45 @@ void Revolution::generateRevolution(TopoDS_Shape& revol, } } +void Revolution::updateProperties(const std::string &method) +{ + // disable settings that are not valid on the current method + // disable everything unless we are sure we need it + bool isAngleEnabled = false; + bool isAngle2Enabled = false; + bool isMidplaneEnabled = false; + bool isReversedEnabled = false; + bool isUpToFaceEnabled = false; + if (method == "Angle") { + isAngleEnabled = true; + isMidplaneEnabled = true; + isReversedEnabled = !Midplane.getValue(); + } + else if (method == "UpToLast") { + isReversedEnabled = true; + } + else if (method == "ThroughAll") { + isMidplaneEnabled = true; + isReversedEnabled = !Midplane.getValue(); + } + else if (method == "UpToFirst") { + isReversedEnabled = true; + } + else if (method == "UpToFace") { + isReversedEnabled = true; + isUpToFaceEnabled = true; + } + else if (method == "TwoAngles") { + isAngleEnabled = true; + isAngle2Enabled = true; + isReversedEnabled = true; + } + + Angle.setReadOnly(!isAngleEnabled); + Angle2.setReadOnly(!isAngle2Enabled); + Midplane.setReadOnly(!isMidplaneEnabled); + Reversed.setReadOnly(!isReversedEnabled); + UpToFace.setReadOnly(!isUpToFaceEnabled); +} + } diff --git a/src/Mod/PartDesign/App/FeatureRevolution.h b/src/Mod/PartDesign/App/FeatureRevolution.h index 60da317a38..79dbbfc196 100644 --- a/src/Mod/PartDesign/App/FeatureRevolution.h +++ b/src/Mod/PartDesign/App/FeatureRevolution.h @@ -107,6 +107,11 @@ protected: RevolMode Mode, Standard_Boolean Modify); + /** + * Disables settings that are not valid for the current method + */ + void updateProperties(const std::string &method); + private: static const char* TypeEnums[]; };