[PD] add missing hole constraint

- add missing constraint for hole diameter
- add missing sets of angle constraints in the task dialog
This commit is contained in:
Uwe
2022-01-06 04:33:46 +01:00
committed by wwmayer
parent 4b6c0a6f2d
commit 55421ce9cb
2 changed files with 6 additions and 0 deletions

View File

@@ -646,6 +646,8 @@ const char* Hole::ThreadDirectionEnums[] = { "Right", "Left", NULL};
PROPERTY_SOURCE(PartDesign::Hole, PartDesign::ProfileBased)
const App::PropertyAngle::Constraints Hole::floatAngle = { Base::toDegrees<double>(Precision::Angular()), 360.0, 1.0 };
// OCC can only create holes with a min diameter of 10 times the Precision::Confusion()
const App::PropertyQuantityConstraint::Constraints diameterRange = { 10 * Precision::Confusion(), FLT_MAX, 1.0 };
Hole::Hole()
{
@@ -670,6 +672,7 @@ Hole::Hole()
ThreadFit.setEnums(ClearanceMetricEnums);
ADD_PROPERTY_TYPE(Diameter, (6.0), "Hole", App::Prop_None, "Diameter");
Diameter.setConstraints(&diameterRange);
ADD_PROPERTY_TYPE(ThreadDirection, (0L), "Hole", App::Prop_None, "Thread direction");
ThreadDirection.setEnums(ThreadDirectionEnums);

View File

@@ -101,6 +101,7 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
ui->ThreadFit->setCurrentIndex(pcHole->ThreadFit.getValue());
// Fit is only enabled (sensible) if not threaded
ui->ThreadFit->setEnabled(!pcHole->Threaded.getValue());
ui->Diameter->setMinimum(pcHole->Diameter.getMinimum());
ui->Diameter->setValue(pcHole->Diameter.getValue());
// Diameter is only enabled if ThreadType is None
if (pcHole->ThreadType.getValue() != 0L)
@@ -127,6 +128,7 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
ui->HoleCutDiameter->setDisabled(pcHole->HoleCutDiameter.isReadOnly());
ui->HoleCutDepth->setValue(pcHole->HoleCutDepth.getValue());
ui->HoleCutDepth->setDisabled(pcHole->HoleCutDepth.isReadOnly());
ui->HoleCutCountersinkAngle->setMinimum(pcHole->HoleCutCountersinkAngle.getMinimum());
ui->HoleCutCountersinkAngle->setValue(pcHole->HoleCutCountersinkAngle.getValue());
ui->HoleCutCountersinkAngle->setDisabled(pcHole->HoleCutCountersinkAngle.isReadOnly());
@@ -136,6 +138,7 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
ui->drillPointFlat->setChecked(true);
else
ui->drillPointAngled->setChecked(true);
ui->DrillPointAngle->setMinimum(pcHole->DrillPointAngle.getMinimum());
ui->DrillPointAngle->setValue(pcHole->DrillPointAngle.getValue());
ui->DrillForDepth->setChecked(pcHole->DrillForDepth.getValue());
// drill point settings are only enabled (sensible) if type is 'Dimension'