From c8efc2698240390e75ce5829530b0752409151f9 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 16 Mar 2026 14:02:31 -0300 Subject: [PATCH] PartDesign: fix the range of the custom clearance of threads (#26296) * PartDesign: fix the range of the custom clearance of threads * PartDesign: hole ensure diameter is on the correct range --- src/Mod/PartDesign/App/FeatureHole.cpp | 10 ++++++++++ src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index 3f456d6844..32dce84a7a 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -544,6 +544,10 @@ const App::PropertyAngle::Constraints Hole::floatAngle = { const App::PropertyQuantityConstraint::Constraints diameterRange = {10 * Precision::Confusion(), std::numeric_limits::max(), 1.0}; +// Custom clearance can be negative or positive to adjust for manufacturing +const App::PropertyQuantityConstraint::Constraints clearanceRange + = {std::numeric_limits::lowest(), std::numeric_limits::max(), 0.1}; + Hole::Hole() { addSubType = FeatureAddSub::Subtractive; @@ -636,6 +640,7 @@ Hole::Hole() App::Prop_None, "Custom thread clearance (overrides ThreadClass)" ); + CustomThreadClearance.setConstraints(&clearanceRange); // Defaults to circles & arcs so that older files are kept intact // while new file get points, circles and arcs set in setupObject() @@ -1729,6 +1734,11 @@ App::DocumentObjectExecReturn* Hole::execute() } try { + if (Diameter.getValue() < diameterRange.LowerBound) { + return new App::DocumentObjectExecReturn( + QT_TRANSLATE_NOOP("Exception", "Hole error: Diameter too small") + ); + } std::string method(DepthType.getValueAsString()); double length = 0.0; diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index de4cd629ad..ac0058ace2 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -273,6 +273,9 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare this->groupLayout()->addWidget(proxy); setupGizmos(HoleView); + + ui->CustomThreadClearance->setMinimum(pcHole->CustomThreadClearance.getMinimum()); + ui->CustomThreadClearance->setMaximum(pcHole->CustomThreadClearance.getMaximum()); } TaskHoleParameters::~TaskHoleParameters() = default;