Merge pull request #4134 from donovaly/PD-Hole-DrillPoint

[PD] improve blind hole depth handling
This commit is contained in:
Kurt Kremitzki
2021-01-30 05:14:52 -06:00
committed by GitHub
6 changed files with 216 additions and 286 deletions

View File

@@ -591,6 +591,8 @@ Hole::Hole()
DrillPoint.setEnums(DrillPointEnums);
ADD_PROPERTY_TYPE(DrillPointAngle, (118.0), "Hole", App::Prop_None, "Drill point angle");
ADD_PROPERTY_TYPE(DrillForDepth, ((long)0), "Hole", App::Prop_None,
"The size of the drill point will be taken into\n account for the depth of blind holes");
ADD_PROPERTY_TYPE(Tapered, (false),"Hole", App::Prop_None, "Tapered");
@@ -1043,19 +1045,19 @@ void Hole::onChanged(const App::Property *prop)
}
else if (prop == &DepthType) {
Depth.setReadOnly((std::string(DepthType.getValueAsString()) != "Dimension"));
DrillForDepth.setReadOnly((std::string(DepthType.getValueAsString()) != "Dimension"));
}
ProfileBased::onChanged(prop);
}
/**
* Compute 2D intersection between the lines (pa1, pa2) and (pb1, pb2).
* Computes 2D intersection between the lines (pa1, pa2) and (pb1, pb2).
* The lines are assumed to be crossing, and it is an error
* to specify parallel lines.
* Only the x and y coordinates of the points are used to compute the 2D intersection.
*
* Only the x and y coordinates are used to compute the 2D intersection.
*
* The result are the x and y coordinate of the intersection point.
*/
static void computeIntersection(gp_Pnt pa1, gp_Pnt pa2, gp_Pnt pb1, gp_Pnt pb2, double & x, double & y)
{
double vx1 = pa1.X() - pa2.X();
@@ -1200,7 +1202,7 @@ App::DocumentObjectExecReturn *Hole::execute(void)
base.Move(invObjLoc);
if (profileshape.IsNull())
return new App::DocumentObjectExecReturn("Pocket: Creating a face from sketch failed");
return new App::DocumentObjectExecReturn("Hole error: Creating a face from sketch failed");
profileshape.Move(invObjLoc);
/* Build the prototype hole */
@@ -1238,10 +1240,10 @@ App::DocumentObjectExecReturn *Hole::execute(void)
length = 1e4;
}
else
return new App::DocumentObjectExecReturn("Hole: Unsupported length specification.");
return new App::DocumentObjectExecReturn("Hole error: Unsupported length specification");
if (length <= 0)
return new App::DocumentObjectExecReturn("Hole: Invalid hole depth");
if (length <= 0.0)
return new App::DocumentObjectExecReturn("Hole error: Invalid hole depth");
BRepBuilderAPI_MakeWire mkWire;
const std::string holeCutType = HoleCutType.getValueAsString();
@@ -1253,26 +1255,27 @@ App::DocumentObjectExecReturn *Hole::execute(void)
holeCutType == "Cheesehead (deprecated)" ||
holeCutType == "Cap screw (deprecated)" ||
isDynamicCounterbore(threadType, holeCutType));
double hasTaperedAngle = Tapered.getValue() ? Base::toRadians( TaperedAngle.getValue() ) : Base::toRadians(90.0);
double radiusBottom = Diameter.getValue() / 2.0 - length * 1.0 / tan( hasTaperedAngle );
double TaperedAngleVal = Tapered.getValue() ? Base::toRadians( TaperedAngle.getValue() ) : Base::toRadians(90.0);
double radiusBottom = Diameter.getValue() / 2.0 - length / tan(TaperedAngleVal);
double radius = Diameter.getValue() / 2.0;
double holeCutRadius = HoleCutDiameter.getValue() / 2.0;
gp_Pnt firstPoint(0, 0, 0);
gp_Pnt lastPoint(0, 0, 0);
double length1 = 0;
double lengthCounter = 0.0;
double xPosCounter = 0.0;
double zPosCounter = 0.0;
if ( hasTaperedAngle <= 0 || hasTaperedAngle > Base::toRadians( 180.0 ) )
return new App::DocumentObjectExecReturn("Hole: Invalid taper angle.");
if (TaperedAngleVal <= 0.0 || TaperedAngleVal > Base::toRadians( 180.0 ) )
return new App::DocumentObjectExecReturn("Hole error: Invalid taper angle");
if ( isCountersink ) {
double x, z;
double countersinkAngle = Base::toRadians( HoleCutCountersinkAngle.getValue() / 2.0 );
if ( countersinkAngle <= 0 || countersinkAngle > Base::toRadians( 180.0 ) )
return new App::DocumentObjectExecReturn("Hole: Invalid countersink angle.");
return new App::DocumentObjectExecReturn("Hole error: Invalid countersink angle");
if (holeCutRadius < radius)
return new App::DocumentObjectExecReturn("Hole: Hole cut diameter too small.");
return new App::DocumentObjectExecReturn("Hole error: Hole cut diameter too small");
// Top point
gp_Pnt newPoint = toPnt(holeCutRadius * xDir);
@@ -1282,28 +1285,27 @@ App::DocumentObjectExecReturn *Hole::execute(void)
computeIntersection(gp_Pnt( holeCutRadius, 0, 0 ),
gp_Pnt( holeCutRadius - sin( countersinkAngle ), -cos( countersinkAngle ), 0 ),
gp_Pnt( radius, 0, 0 ),
gp_Pnt( radiusBottom, -length, 0), x, z );
if (-length > z)
return new App::DocumentObjectExecReturn("Hole: Invalid countersink.");
gp_Pnt( radiusBottom, -length, 0), xPosCounter, zPosCounter);
if (-length > zPosCounter)
return new App::DocumentObjectExecReturn("Hole error: Invalid countersink");
length1 = z;
lengthCounter = zPosCounter;
newPoint = toPnt(x * xDir + z * zDir);
newPoint = toPnt(xPosCounter * xDir + zPosCounter * zDir);
mkWire.Add( BRepBuilderAPI_MakeEdge( lastPoint, newPoint ) );
lastPoint = newPoint;
}
else if ( isCounterbore ) {
double holeCutDepth = HoleCutDepth.getValue();
double x, z;
if (holeCutDepth <= 0)
return new App::DocumentObjectExecReturn("Hole: Hole cut depth must be greater than zero.");
if (holeCutDepth <= 0.0)
return new App::DocumentObjectExecReturn("Hole error: Hole cut depth must be greater than zero");
if (holeCutDepth > length)
return new App::DocumentObjectExecReturn("Hole: Hole cut depth must be less than hole depth.");
return new App::DocumentObjectExecReturn("Hole error: Hole cut depth must be less than hole depth");
if (holeCutRadius < radius)
return new App::DocumentObjectExecReturn("Hole: Hole cut diameter too small.");
return new App::DocumentObjectExecReturn("Hole error: Hole cut diameter too small");
// Top point
gp_Pnt newPoint = toPnt(holeCutRadius * xDir);
@@ -1311,7 +1313,7 @@ App::DocumentObjectExecReturn *Hole::execute(void)
lastPoint = newPoint;
// Bottom of counterbore
newPoint = toPnt(holeCutRadius * xDir -holeCutDepth * zDir);
newPoint = toPnt(holeCutRadius * xDir - holeCutDepth * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
@@ -1319,10 +1321,10 @@ App::DocumentObjectExecReturn *Hole::execute(void)
computeIntersection(gp_Pnt( 0, -holeCutDepth, 0 ),
gp_Pnt( holeCutRadius, -holeCutDepth, 0 ),
gp_Pnt( radius, 0, 0 ),
gp_Pnt( radiusBottom, length, 0 ), x, z );
gp_Pnt( radiusBottom, length, 0 ), xPosCounter, zPosCounter);
length1 = z;
newPoint = toPnt(x * xDir + z * zDir);
lengthCounter = zPosCounter;
newPoint = toPnt(xPosCounter * xDir + zPosCounter * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
}
@@ -1330,10 +1332,12 @@ App::DocumentObjectExecReturn *Hole::execute(void)
gp_Pnt newPoint = toPnt(radius * xDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
length1 = 0;
lengthCounter = 0.0;
}
std::string drillPoint = DrillPoint.getValueAsString();
double xPosDrill = 0.0;
double zPosDrill = 0.0;
if (drillPoint == "Flat") {
gp_Pnt newPoint = toPnt(radiusBottom * xDir + -length * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
@@ -1345,30 +1349,47 @@ App::DocumentObjectExecReturn *Hole::execute(void)
}
else if (drillPoint == "Angled") {
double drillPointAngle = Base::toRadians( ( 180.0 - DrillPointAngle.getValue() ) / 2.0 );
double x, z;
gp_Pnt newPoint;
bool isDrillForDepth = DrillForDepth.getValue();
if ( drillPointAngle <= 0 || drillPointAngle > Base::toRadians( 180.0 ) )
return new App::DocumentObjectExecReturn("Hole: Invalid drill point angle.");
// the angle is in any case > 0 and < 90 but nevertheless this safeguard:
if ( drillPointAngle <= 0.0 || drillPointAngle >= Base::toRadians( 180.0 ) )
return new App::DocumentObjectExecReturn("Hole error: Invalid drill point angle");
computeIntersection(gp_Pnt( 0, -length, 0 ),
gp_Pnt( cos( drillPointAngle ), -length + sin( drillPointAngle ), 0),
gp_Pnt(radius, 0, 0),
gp_Pnt(radiusBottom, -length, 0), x, z);
// if option to take drill point size into account
// the next wire point is the intersection of the drill edge and the hole edge
if (isDrillForDepth) {
computeIntersection(gp_Pnt(0, -length, 0),
gp_Pnt(radius, radius * tan(drillPointAngle) - length, 0),
gp_Pnt(radius, 0, 0),
gp_Pnt(radiusBottom, -length, 0), xPosDrill, zPosDrill);
if (zPosDrill > 0 || zPosDrill >= lengthCounter)
return new App::DocumentObjectExecReturn("Hole error: Invalid drill point");
if (z > 0 || z >= length1)
return new App::DocumentObjectExecReturn("Hole: Invalid drill point.");
newPoint = toPnt(xPosDrill * xDir + zPosDrill * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
newPoint = toPnt(x * xDir + z * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
newPoint = toPnt(-length * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
}
else {
xPosDrill = radiusBottom;
zPosDrill = -length;
newPoint = toPnt(-length * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
newPoint = toPnt(xPosDrill * xDir + zPosDrill * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
// the end point is the size of the drill tip
newPoint = toPnt((-length - radius * tan(drillPointAngle)) * zDir);
mkWire.Add(BRepBuilderAPI_MakeEdge(lastPoint, newPoint));
lastPoint = newPoint;
}
}
mkWire.Add( BRepBuilderAPI_MakeEdge(lastPoint, firstPoint) );
mkWire.Add( BRepBuilderAPI_MakeEdge(lastPoint, firstPoint) );
TopoDS_Wire wire = mkWire.Wire();
@@ -1382,10 +1403,10 @@ App::DocumentObjectExecReturn *Hole::execute(void)
protoHole = RevolMaker.Shape();
if (protoHole.IsNull())
return new App::DocumentObjectExecReturn("Hole: Resulting shape is empty");
return new App::DocumentObjectExecReturn("Hole error: Resulting shape is empty");
}
else
return new App::DocumentObjectExecReturn("Hole: Could not revolve sketch!");
return new App::DocumentObjectExecReturn("Hole error: Could not revolve sketch");
#if 0
// Make thread

View File

@@ -64,6 +64,7 @@ public:
App::PropertyLength Depth;
App::PropertyEnumeration DrillPoint;
App::PropertyAngle DrillPointAngle;
App::PropertyBool DrillForDepth;
App::PropertyBool Tapered;
App::PropertyAngle TaperedAngle;

View File

@@ -67,17 +67,6 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
/* Remove actual threading parameters for now */
ui->ModelActualThread->setVisible(false);
ui->ThreadPitch->setVisible(false);
ui->ThreadCutOffInner->setVisible(false);
ui->ThreadCutOffOuter->setVisible(false);
ui->ThreadAngle->setVisible(false);
ui->label_Pitch->setVisible(false);
ui->label_CutoffInner->setVisible(false);
ui->label_CutoffOuter->setVisible(false);
ui->label_Angle->setVisible(false);
ui->ThreadType->addItem(tr("None"), QByteArray("None"));
ui->ThreadType->addItem(tr("ISO metric regular profile"), QByteArray("ISO"));
ui->ThreadType->addItem(tr("ISO metric fine profile"), QByteArray("ISO"));
@@ -88,11 +77,6 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
// read values from the hole properties
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
ui->Threaded->setChecked(pcHole->Threaded.getValue());
ui->ModelActualThread->setChecked(pcHole->ModelActualThread.getValue());
ui->ThreadPitch->setValue(pcHole->ThreadPitch.getValue());
ui->ThreadAngle->setValue(pcHole->ThreadAngle.getValue());
ui->ThreadCutOffInner->setValue(pcHole->ThreadCutOffInner.getValue());
ui->ThreadCutOffOuter->setValue(pcHole->ThreadCutOffOuter.getValue());
ui->ThreadType->setCurrentIndex(pcHole->ThreadType.getValue());
ui->ThreadSize->clear();
const char** cursor = pcHole->ThreadSize.getEnums();
@@ -167,6 +151,12 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
else
ui->drillPointAngled->setChecked(true);
ui->DrillPointAngle->setValue(pcHole->DrillPointAngle.getValue());
ui->DrillForDepth->setChecked(pcHole->DrillForDepth.getValue());
// DrillForDepth is only enabled (sensible) if type is 'Dimension'
if (std::string(pcHole->DepthType.getValueAsString()) == "Dimension")
ui->DrillForDepth->setEnabled(true);
else
ui->DrillForDepth->setEnabled(false);
ui->Tapered->setChecked(pcHole->Tapered.getValue());
// Angle is only enabled (sensible) if tapered
ui->TaperedAngle->setEnabled(pcHole->Tapered.getValue());
@@ -175,11 +165,6 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
connect(ui->Threaded, SIGNAL(clicked(bool)), this, SLOT(threadedChanged()));
connect(ui->ThreadType, SIGNAL(currentIndexChanged(int)), this, SLOT(threadTypeChanged(int)));
connect(ui->ModelActualThread, SIGNAL(clicked(bool)), this, SLOT(modelActualThreadChanged()));
connect(ui->ThreadPitch, SIGNAL(valueChanged(double)), this, SLOT(threadPitchChanged(double)));
connect(ui->ThreadAngle, SIGNAL(valueChanged(double)), this, SLOT(threadAngleChanged(double)));
connect(ui->ThreadCutOffInner, SIGNAL(valueChanged(double)), this, SLOT(threadCutOffInnerChanged(double)));
connect(ui->ThreadCutOffOuter, SIGNAL(valueChanged(double)), this, SLOT(threadCutOffOuterChanged(double)));
connect(ui->ThreadSize, SIGNAL(currentIndexChanged(int)), this, SLOT(threadSizeChanged(int)));
connect(ui->ThreadClass, SIGNAL(currentIndexChanged(int)), this, SLOT(threadClassChanged(int)));
connect(ui->ThreadFit, SIGNAL(currentIndexChanged(int)), this, SLOT(threadFitChanged(int)));
@@ -195,16 +180,13 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare
connect(ui->drillPointFlat, SIGNAL(clicked(bool)), this, SLOT(drillPointChanged()));
connect(ui->drillPointAngled, SIGNAL(clicked(bool)), this, SLOT(drillPointChanged()));
connect(ui->DrillPointAngle, SIGNAL(valueChanged(double)), this, SLOT(drillPointAngledValueChanged(double)));
connect(ui->DrillForDepth, SIGNAL(clicked(bool)), this, SLOT(drillForDepthChanged()));
connect(ui->Tapered, SIGNAL(clicked(bool)), this, SLOT(taperedChanged()));
connect(ui->Reversed, SIGNAL(clicked(bool)), this, SLOT(reversedChanged()));
connect(ui->TaperedAngle, SIGNAL(valueChanged(double)), this, SLOT(taperedAngleChanged(double)));
vp->show();
ui->ThreadPitch->bind(pcHole->ThreadPitch);
ui->ThreadAngle->bind(pcHole->ThreadAngle);
ui->ThreadCutOffInner->bind(pcHole->ThreadCutOffInner);
ui->ThreadCutOffOuter->bind(pcHole->ThreadCutOffOuter);
ui->Diameter->bind(pcHole->Diameter);
ui->HoleCutDiameter->bind(pcHole->HoleCutDiameter);
ui->HoleCutDepth->bind(pcHole->HoleCutDepth);
@@ -236,7 +218,7 @@ void TaskHoleParameters::modelActualThreadChanged()
{
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
pcHole->ModelActualThread.setValue(ui->ModelActualThread->isChecked());
pcHole->ModelActualThread.setValue(false);
recomputeFeature();
}
@@ -333,6 +315,12 @@ void TaskHoleParameters::depthChanged(int index)
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
pcHole->DepthType.setValue(index);
// disable DrillforDepth if not 'Dimension'
if (std::string(pcHole->DepthType.getValueAsString()) == "Dimension")
ui->DrillForDepth->setEnabled(true);
else
ui->DrillForDepth->setEnabled(false);
recomputeFeature();
}
@@ -348,12 +336,17 @@ void TaskHoleParameters::drillPointChanged()
{
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
if (sender() == ui->drillPointFlat)
if (sender() == ui->drillPointFlat) {
pcHole->DrillPoint.setValue((long)0);
else if (sender() == ui->drillPointAngled)
ui->DrillForDepth->setEnabled(false);
}
else if (sender() == ui->drillPointAngled) {
pcHole->DrillPoint.setValue((long)1);
else
assert( 0 );
ui->DrillForDepth->setEnabled(true);
}
else {
assert(0);
}
recomputeFeature();
}
@@ -365,6 +358,14 @@ void TaskHoleParameters::drillPointAngledValueChanged(double value)
recomputeFeature();
}
void TaskHoleParameters::drillForDepthChanged()
{
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
pcHole->DrillForDepth.setValue(ui->DrillForDepth->isChecked());
recomputeFeature();
}
void TaskHoleParameters::taperedChanged()
{
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
@@ -528,46 +529,6 @@ void TaskHoleParameters::changedObject(const App::Document&, const App::Property
}
ui->Threaded->setDisabled(ro);
}
else if (&Prop == &pcHole->ModelActualThread) {
if (ui->ModelActualThread->isChecked() ^ pcHole->ModelActualThread.getValue()) {
ui->ModelActualThread->blockSignals(true);
ui->ModelActualThread->setChecked(pcHole->ModelActualThread.getValue());
ui->ModelActualThread->blockSignals(false);
}
ui->ModelActualThread->setDisabled(ro);
}
else if (&Prop == &pcHole->ThreadPitch) {
if (ui->ThreadPitch->value().getValue() != pcHole->ThreadPitch.getValue()) {
ui->ThreadPitch->blockSignals(true);
ui->ThreadPitch->setValue(pcHole->ThreadPitch.getValue());
ui->ThreadPitch->blockSignals(false);
}
ui->ThreadPitch->setDisabled(ro);
}
else if (&Prop == &pcHole->ThreadAngle) {
if (ui->ThreadAngle->value().getValue() != pcHole->ThreadAngle.getValue()) {
ui->ThreadAngle->blockSignals(true);
ui->ThreadAngle->setValue(pcHole->ThreadAngle.getValue());
ui->ThreadAngle->blockSignals(false);
}
ui->ThreadAngle->setDisabled(ro);
}
else if (&Prop == &pcHole->ThreadCutOffInner) {
if (ui->ThreadCutOffInner->value().getValue() != pcHole->ThreadCutOffInner.getValue()) {
ui->ThreadCutOffInner->blockSignals(true);
ui->ThreadCutOffInner->setValue(pcHole->ThreadCutOffInner.getValue());
ui->ThreadCutOffInner->blockSignals(false);
}
ui->ThreadCutOffInner->setDisabled(ro);
}
else if (&Prop == &pcHole->ThreadCutOffOuter) {
if (ui->ThreadCutOffOuter->value().getValue() != pcHole->ThreadCutOffOuter.getValue()) {
ui->ThreadCutOffOuter->blockSignals(true);
ui->ThreadCutOffOuter->setValue(pcHole->ThreadCutOffOuter.getValue());
ui->ThreadCutOffOuter->blockSignals(false);
}
ui->ThreadCutOffOuter->setDisabled(ro);
}
else if (&Prop == &pcHole->ThreadType) {
ui->ThreadType->setEnabled(true);
@@ -742,6 +703,15 @@ void TaskHoleParameters::changedObject(const App::Document&, const App::Property
}
ui->DrillPointAngle->setDisabled(ro);
}
else if (&Prop == &pcHole->DrillForDepth) {
ui->DrillForDepth->setEnabled(true);
if (ui->DrillForDepth->isChecked() ^ pcHole->DrillForDepth.getValue()) {
ui->DrillForDepth->blockSignals(true);
ui->DrillForDepth->setChecked(pcHole->DrillForDepth.getValue());
ui->DrillForDepth->blockSignals(false);
}
ui->DrillForDepth->setDisabled(ro);
}
else if (&Prop == &pcHole->Tapered) {
ui->Tapered->setEnabled(true);
if (ui->Tapered->isChecked() ^ pcHole->Tapered.getValue()) {
@@ -866,6 +836,11 @@ bool TaskHoleParameters::getTapered() const
return ui->Tapered->isChecked();
}
bool TaskHoleParameters::getDrillForDepth() const
{
return ui->DrillForDepth->isChecked();
}
Base::Quantity TaskHoleParameters::getTaperedAngle() const
{
return ui->TaperedAngle->value();
@@ -878,10 +853,6 @@ void TaskHoleParameters::apply()
isApplying = true;
ui->ThreadPitch->apply();
ui->ThreadAngle->apply();
ui->ThreadCutOffInner->apply();
ui->ThreadCutOffOuter->apply();
ui->Diameter->apply();
ui->HoleCutDiameter->apply();
ui->HoleCutDepth->apply();
@@ -910,6 +881,8 @@ void TaskHoleParameters::apply()
FCMD_OBJ_CMD(obj,"DepthType = " << getDepthType());
if (!pcHole->DrillPoint.isReadOnly())
FCMD_OBJ_CMD(obj,"DrillPoint = " << getDrillPoint());
if (!pcHole->DrillForDepth.isReadOnly())
FCMD_OBJ_CMD(obj, "DrillForDepth = " << (getDrillForDepth() ? 1 : 0));
if (!pcHole->Tapered.isReadOnly())
FCMD_OBJ_CMD(obj,"Tapered = " << getTapered());

View File

@@ -76,6 +76,7 @@ public:
Base::Quantity getDepth() const;
long getDrillPoint() const;
Base::Quantity getDrillPointAngle() const;
bool getDrillForDepth() const;
bool getTapered() const;
Base::Quantity getTaperedAngle() const;
@@ -100,6 +101,7 @@ private Q_SLOTS:
void depthValueChanged(double value);
void drillPointChanged();
void drillPointAngledValueChanged(double value);
void drillForDepthChanged();
void taperedChanged();
void reversedChanged();
void taperedAngleChanged(double value);

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>710</height>
<width>354</width>
<height>463</height>
</rect>
</property>
<property name="sizePolicy">
@@ -66,116 +66,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="ModelActualThread">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Model actual thread</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_Pitch">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Pitch</string>
</property>
</widget>
</item>
<item row="4" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="ThreadPitch">
<property name="enabled">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>&lt;b&gt;Hole cut&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_Angle">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Angle</string>
</property>
</widget>
</item>
<item row="5" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="ThreadAngle">
<property name="enabled">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_CutoffInner">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Cutoff inner</string>
</property>
</widget>
</item>
<item row="6" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="ThreadCutOffInner">
<property name="enabled">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="label_CutoffOuter">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Cutoff outer</string>
</property>
</widget>
</item>
<item row="7" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="ThreadCutOffOuter">
<property name="enabled">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -191,7 +82,7 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="3" column="1">
<widget class="QRadioButton" name="directionRightHand">
<property name="toolTip">
<string/>
@@ -204,7 +95,7 @@
</attribute>
</widget>
</item>
<item row="10" column="1">
<item row="5" column="1">
<widget class="QRadioButton" name="directionLeftHand">
<property name="text">
<string>Left hand</string>
@@ -214,7 +105,7 @@
</attribute>
</widget>
</item>
<item row="11" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -227,7 +118,7 @@
</property>
</widget>
</item>
<item row="11" column="1">
<item row="6" column="1">
<widget class="QComboBox" name="ThreadSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -243,14 +134,14 @@
</property>
</widget>
</item>
<item row="11" column="3">
<item row="6" column="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Clearance</string>
</property>
</widget>
</item>
<item row="11" column="5">
<item row="6" column="5">
<widget class="QComboBox" name="ThreadFit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -285,7 +176,7 @@ Only available for holes without thread</string>
</item>
</widget>
</item>
<item row="12" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -298,7 +189,7 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="12" column="1">
<item row="7" column="1">
<widget class="QComboBox" name="ThreadClass">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -317,7 +208,7 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="12" column="2">
<item row="7" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -333,7 +224,20 @@ Only available for holes without thread</string>
</property>
</spacer>
</item>
<item row="12" column="5">
<item row="7" column="3" colspan="2">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Diameter</string>
</property>
</widget>
</item>
<item row="7" column="5">
<widget class="Gui::PrefQuantitySpinBox" name="Diameter">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -358,20 +262,7 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="12" column="3" colspan="2">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Diameter</string>
</property>
</widget>
</item>
<item row="13" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -384,7 +275,7 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="8" column="1">
<widget class="QComboBox" name="DepthType">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -410,7 +301,7 @@ Only available for holes without thread</string>
</item>
</widget>
</item>
<item row="13" column="3" colspan="3">
<item row="8" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="Depth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -423,7 +314,14 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="15" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>&lt;b&gt;Hole cut&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -436,7 +334,7 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="15" column="1" colspan="5">
<item row="10" column="1" colspan="5">
<widget class="QComboBox" name="HoleCutType">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -455,14 +353,14 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="16" column="1">
<item row="11" column="1">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Diameter</string>
</property>
</widget>
</item>
<item row="16" column="3" colspan="3">
<item row="11" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="HoleCutDiameter">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -490,14 +388,14 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="17" column="1">
<item row="12" column="1">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Depth</string>
</property>
</widget>
</item>
<item row="17" column="3" colspan="3">
<item row="12" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="HoleCutDepth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -522,14 +420,14 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="18" column="1">
<item row="13" column="1">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Countersink angle</string>
</property>
</widget>
</item>
<item row="18" column="3" colspan="3">
<item row="13" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="HoleCutCountersinkAngle">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -551,7 +449,7 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="19" column="0">
<item row="14" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -567,7 +465,7 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="20" column="0">
<item row="15" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Type</string>
@@ -577,7 +475,7 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="20" column="1">
<item row="15" column="1">
<widget class="QRadioButton" name="drillPointFlat">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -593,7 +491,7 @@ Only available for holes without thread</string>
</attribute>
</widget>
</item>
<item row="23" column="1">
<item row="18" column="1">
<widget class="QRadioButton" name="drillPointAngled">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -609,7 +507,7 @@ Only available for holes without thread</string>
</attribute>
</widget>
</item>
<item row="23" column="3" colspan="3">
<item row="18" column="3" colspan="3">
<widget class="Gui::PrefQuantitySpinBox" name="DrillPointAngle">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -625,21 +523,32 @@ Only available for holes without thread</string>
</property>
</widget>
</item>
<item row="24" column="0">
<item row="19" column="3" colspan="3">
<widget class="QCheckBox" name="DrillForDepth">
<property name="toolTip">
<string>The size of the drill point will be taken into
account for the depth of blind holes</string>
</property>
<property name="text">
<string>Take into account for depth</string>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>&lt;b&gt;Misc&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="25" column="0">
<item row="21" column="0">
<widget class="QCheckBox" name="Tapered">
<property name="text">
<string>Tapered</string>
</property>
</widget>
</item>
<item row="25" column="1">
<item row="21" column="1">
<widget class="Gui::PrefQuantitySpinBox" name="TaperedAngle">
<property name="toolTip">
<string>Taper angle for the hole
@@ -655,7 +564,7 @@ over 90: larger hole radius at the bottom</string>
</property>
</widget>
</item>
<item row="25" column="4" colspan="2">
<item row="21" column="4" colspan="2">
<widget class="QCheckBox" name="Reversed">
<property name="toolTip">
<string>Reverses the hole direction</string>
@@ -679,6 +588,29 @@ over 90: larger hole radius at the bottom</string>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>ThreadType</tabstop>
<tabstop>Threaded</tabstop>
<tabstop>directionRightHand</tabstop>
<tabstop>directionLeftHand</tabstop>
<tabstop>ThreadSize</tabstop>
<tabstop>ThreadFit</tabstop>
<tabstop>ThreadClass</tabstop>
<tabstop>Diameter</tabstop>
<tabstop>DepthType</tabstop>
<tabstop>Depth</tabstop>
<tabstop>HoleCutType</tabstop>
<tabstop>HoleCutDiameter</tabstop>
<tabstop>HoleCutDepth</tabstop>
<tabstop>HoleCutCountersinkAngle</tabstop>
<tabstop>drillPointFlat</tabstop>
<tabstop>drillPointAngled</tabstop>
<tabstop>DrillPointAngle</tabstop>
<tabstop>DrillForDepth</tabstop>
<tabstop>Tapered</tabstop>
<tabstop>TaperedAngle</tabstop>
<tabstop>Reversed</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
@@ -688,12 +620,12 @@ over 90: larger hole radius at the bottom</string>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>40</x>
<y>540</y>
<x>49</x>
<y>451</y>
</hint>
<hint type="destinationlabel">
<x>136</x>
<y>540</y>
<x>163</x>
<y>453</y>
</hint>
</hints>
</connection>
@@ -708,8 +640,8 @@ over 90: larger hole radius at the bottom</string>
<y>63</y>
</hint>
<hint type="destinationlabel">
<x>322</x>
<y>254</y>
<x>344</x>
<y>142</y>
</hint>
</hints>
</connection>
@@ -724,8 +656,8 @@ over 90: larger hole radius at the bottom</string>
<y>63</y>
</hint>
<hint type="destinationlabel">
<x>136</x>
<y>280</y>
<x>163</x>
<y>168</y>
</hint>
</hints>
</connection>

View File

@@ -86,6 +86,7 @@ class TestHole(unittest.TestCase):
self.Hole.DepthType = 0
self.Hole.DrillPoint = 1
self.Hole.Tapered = 0
self.Hole.DrillForDepth = 1
self.Doc.recompute()
self.assertEqual(len(self.Hole.Shape.Faces), 8)