PartDesign Hole Feature implemented.
Minor contributions from Mateusz Skowroński <skowri@gmail.com>
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
#include "FeaturePolarPattern.h"
|
||||
#include "FeatureScaled.h"
|
||||
#include "FeatureMultiTransform.h"
|
||||
//#include "FeatureHole.h"
|
||||
#include "FeatureHole.h"
|
||||
#include "DatumPlane.h"
|
||||
#include "DatumLine.h"
|
||||
#include "DatumPoint.h"
|
||||
@@ -96,7 +96,7 @@ PyMOD_INIT_FUNC(_PartDesign)
|
||||
PartDesign::PolarPattern ::init();
|
||||
PartDesign::Scaled ::init();
|
||||
PartDesign::MultiTransform ::init();
|
||||
//PartDesign::Hole ::init();
|
||||
PartDesign::Hole ::init();
|
||||
PartDesign::Body ::init();
|
||||
PartDesign::Pad ::init();
|
||||
PartDesign::Pocket ::init();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,12 @@
|
||||
#include <App/PropertyUnits.h>
|
||||
#include "FeatureSketchBased.h"
|
||||
|
||||
class Property;
|
||||
|
||||
namespace Base {
|
||||
class XMLReader;
|
||||
}
|
||||
|
||||
namespace PartDesign
|
||||
{
|
||||
|
||||
@@ -37,27 +43,94 @@ class PartDesignExport Hole : public ProfileBased
|
||||
public:
|
||||
Hole();
|
||||
|
||||
App::PropertyEnumeration Type;
|
||||
App::PropertyEnumeration HoleType;
|
||||
App::PropertyBool Threaded;
|
||||
App::PropertyBool ModelActualThread;
|
||||
App::PropertyLength ThreadPitch;
|
||||
App::PropertyAngle ThreadAngle;
|
||||
App::PropertyLength ThreadCutOffInner;
|
||||
App::PropertyLength ThreadCutOffOuter;
|
||||
App::PropertyEnumeration ThreadType;
|
||||
App::PropertyLength Length;
|
||||
App::PropertyFloat ThreadSize;
|
||||
App::PropertyEnumeration ThreadSize;
|
||||
App::PropertyEnumeration ThreadClass;
|
||||
App::PropertyEnumeration ThreadFit;
|
||||
App::PropertyLength Diameter;
|
||||
App::PropertyEnumeration ThreadDirection;
|
||||
App::PropertyEnumeration HoleCutType;
|
||||
App::PropertyLength HoleCutDiameter;
|
||||
App::PropertyLength HoleCutDepth;
|
||||
App::PropertyAngle HoleCutCountersinkAngle;
|
||||
App::PropertyEnumeration DepthType;
|
||||
App::PropertyLength Depth;
|
||||
App::PropertyEnumeration DrillPoint;
|
||||
App::PropertyAngle DrillPointAngle;
|
||||
App::PropertyBool Tapered;
|
||||
App::PropertyAngle TaperedAngle;
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the feature
|
||||
App::DocumentObjectExecReturn *execute(void);
|
||||
//short mustExecute() const;
|
||||
|
||||
/// returns the type name of the view provider
|
||||
const char* getViewProviderName(void) const {
|
||||
return "PartDesignGui::ViewProviderHole";
|
||||
}
|
||||
//@}
|
||||
private:
|
||||
static const char* TypeEnums[];
|
||||
static const char* HoleTypeEnums[];
|
||||
static const char* ThreadEnums[];
|
||||
short mustExecute() const;
|
||||
|
||||
typedef struct {
|
||||
const char * designation;
|
||||
double diameter;
|
||||
double pitch;
|
||||
} ThreadDescription;
|
||||
|
||||
static const ThreadDescription threadDescription[][171];
|
||||
|
||||
virtual void Restore(Base::XMLReader & reader);
|
||||
|
||||
virtual void updateProps();
|
||||
|
||||
protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
private:
|
||||
static const char* DepthTypeEnums[];
|
||||
static const char* ThreadTypeEnums[];
|
||||
static const char* ThreadFitEnums[];
|
||||
static const char* DrillPointEnums[];
|
||||
static const char* ThreadDirectionEnums[];
|
||||
|
||||
/* "None" thread profile */
|
||||
static const char* HoleCutType_None_Enums[];
|
||||
static const char* ThreadSize_None_Enums[];
|
||||
static const char* ThreadClass_None_Enums[];
|
||||
|
||||
/* ISO metric coarse profile */
|
||||
static const char* HoleCutType_ISOmetric_Enums[];
|
||||
static const char* ThreadSize_ISOmetric_Enums[];
|
||||
static const char* ThreadClass_ISOmetric_Enums[];
|
||||
|
||||
/* ISO metric fine profile */
|
||||
static const char* HoleCutType_ISOmetricfine_Enums[];
|
||||
static const char* ThreadSize_ISOmetricfine_Enums[];
|
||||
static const char* ThreadClass_ISOmetricfine_Enums[];
|
||||
|
||||
/* UNC profile */
|
||||
static const char* HoleCutType_UNC_Enums[];
|
||||
static const char* ThreadSize_UNC_Enums[];
|
||||
static const char* ThreadClass_UNC_Enums[];
|
||||
|
||||
/* UNF profile */
|
||||
static const char* HoleCutType_UNF_Enums[];
|
||||
static const char* ThreadSize_UNF_Enums[];
|
||||
static const char* ThreadClass_UNF_Enums[];
|
||||
|
||||
/* UNEF profile */
|
||||
static const char* HoleCutType_UNEF_Enums[];
|
||||
static const char* ThreadSize_UNEF_Enums[];
|
||||
static const char* ThreadClass_UNEF_Enums[];
|
||||
|
||||
void updateHoleCutParams();
|
||||
void updateDiameterParam();
|
||||
};
|
||||
|
||||
} //namespace PartDesign
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "Workbench.h"
|
||||
#include "ViewProviderPocket.h"
|
||||
#include "ViewProviderHole.h"
|
||||
#include "ViewProviderBody.h"
|
||||
#include "ViewProviderSketchBased.h"
|
||||
#include "ViewProviderPad.h"
|
||||
@@ -127,6 +128,7 @@ PyMOD_INIT_FUNC(PartDesignGui)
|
||||
PartDesignGui::ViewProviderBody ::init();
|
||||
PartDesignGui::ViewProviderSketchBased ::init();
|
||||
PartDesignGui::ViewProviderPocket ::init();
|
||||
PartDesignGui::ViewProviderHole ::init();
|
||||
PartDesignGui::ViewProviderPad ::init();
|
||||
PartDesignGui::ViewProviderRevolution ::init();
|
||||
PartDesignGui::ViewProviderDressUp ::init();
|
||||
|
||||
@@ -40,7 +40,7 @@ set(PartDesignGui_MOC_HDRS
|
||||
TaskDraftParameters.h
|
||||
TaskThicknessParameters.h
|
||||
TaskDressUpParameters.h
|
||||
#TaskHoleParameters.h
|
||||
TaskHoleParameters.h
|
||||
TaskRevolutionParameters.h
|
||||
TaskTransformedMessages.h
|
||||
TaskTransformedParameters.h
|
||||
@@ -74,7 +74,7 @@ set(PartDesignGui_UIC_SRCS
|
||||
TaskDraftParameters.ui
|
||||
TaskThicknessParameters.ui
|
||||
TaskBooleanParameters.ui
|
||||
#TaskHoleParameters.ui
|
||||
TaskHoleParameters.ui
|
||||
TaskRevolutionParameters.ui
|
||||
TaskTransformedMessages.ui
|
||||
TaskMirroredParameters.ui
|
||||
@@ -106,8 +106,8 @@ SET(PartDesignGuiViewProvider_SRCS
|
||||
ViewProviderSketchBased.h
|
||||
ViewProviderPad.cpp
|
||||
ViewProviderPad.h
|
||||
#ViewProviderHole.cpp
|
||||
#ViewProviderHole.h
|
||||
ViewProviderHole.cpp
|
||||
ViewProviderHole.h
|
||||
ViewProviderPocket.cpp
|
||||
ViewProviderPocket.h
|
||||
ViewProviderChamfer.cpp
|
||||
@@ -214,9 +214,9 @@ SET(PartDesignGuiTaskDlgs_SRCS
|
||||
TaskMultiTransformParameters.ui
|
||||
TaskMultiTransformParameters.cpp
|
||||
TaskMultiTransformParameters.h
|
||||
#TaskHoleParameters.ui
|
||||
#TaskHoleParameters.cpp
|
||||
#TaskHoleParameters.h
|
||||
TaskHoleParameters.ui
|
||||
TaskHoleParameters.cpp
|
||||
TaskHoleParameters.h
|
||||
TaskDatumParameters.cpp
|
||||
TaskDatumParameters.h
|
||||
TaskShapeBinder.ui
|
||||
|
||||
@@ -1038,6 +1038,52 @@ bool CmdPartDesignPocket::isActive(void)
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// PartDesign_Hole
|
||||
//===========================================================================
|
||||
DEF_STD_CMD_A(CmdPartDesignHole);
|
||||
|
||||
CmdPartDesignHole::CmdPartDesignHole()
|
||||
: Command("PartDesign_Hole")
|
||||
{
|
||||
sAppModule = "PartDesign";
|
||||
sGroup = QT_TR_NOOP("PartDesign");
|
||||
sMenuText = QT_TR_NOOP("Hole");
|
||||
sToolTipText = QT_TR_NOOP("Create a hole with the selected sketch");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "PartDesign_Hole";
|
||||
}
|
||||
|
||||
void CmdPartDesignHole::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
App::Document *doc = getDocument();
|
||||
if (!PartDesignGui::assureModernWorkflow(doc))
|
||||
return;
|
||||
|
||||
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(true);
|
||||
|
||||
if (!pcActiveBody)
|
||||
return;
|
||||
|
||||
Gui::Command* cmd = this;
|
||||
auto worker = [this, cmd](Part::Feature* sketch, std::string FeatName) {
|
||||
|
||||
if (FeatName.empty()) return;
|
||||
|
||||
finishProfileBased(cmd, sketch, FeatName);
|
||||
cmd->adjustCameraPosition();
|
||||
};
|
||||
|
||||
prepareProfileBased(this, "Hole", worker);
|
||||
}
|
||||
|
||||
bool CmdPartDesignHole::isActive(void)
|
||||
{
|
||||
return hasActiveDocument();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// PartDesign_Revolution
|
||||
//===========================================================================
|
||||
@@ -2138,6 +2184,7 @@ void CreatePartDesignCommands(void)
|
||||
|
||||
rcCmdMgr.addCommand(new CmdPartDesignPad());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignPocket());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignHole());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignRevolution());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignGroove());
|
||||
rcCmdMgr.addCommand(new CmdPartDesignAdditivePipe);
|
||||
|
||||
@@ -34,18 +34,20 @@
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/Command.h>
|
||||
|
||||
#include <Mod/PartDesign/App/FeatureHole.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace PartDesignGui;
|
||||
using namespace Gui;
|
||||
|
||||
/* TRANSLATOR PartDesignGui::TaskHoleParameters */
|
||||
|
||||
TaskHoleParameters::TaskHoleParameters(QWidget *parent)
|
||||
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("TaskHoleParameters"),true, parent)
|
||||
TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *parent)
|
||||
: TaskSketchBasedParameters(HoleView, parent, "PartDesign_Hole",tr("Hole parameters"))
|
||||
, observer(new Observer(this, static_cast<PartDesign::Hole*>(vp->getObject())))
|
||||
, isApplying(false)
|
||||
{
|
||||
// we need a separate container widget to add all controls to
|
||||
proxy = new QWidget(this);
|
||||
@@ -53,15 +55,267 @@ TaskHoleParameters::TaskHoleParameters(QWidget *parent)
|
||||
ui->setupUi(proxy);
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
/* 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);
|
||||
|
||||
Gui::Selection().Attach(this);
|
||||
ui->ThreadType->addItem(tr("None"));
|
||||
ui->ThreadType->addItem(tr("ISO metric coarse profile"));
|
||||
ui->ThreadType->addItem(tr("ISO metric fine profile"));
|
||||
ui->ThreadType->addItem(tr("UTS coarse profile"));
|
||||
ui->ThreadType->addItem(tr("UTS fine profile"));
|
||||
ui->ThreadType->addItem(tr("UTS extra fine profile"));
|
||||
|
||||
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)));
|
||||
connect(ui->Diameter, SIGNAL(valueChanged(double)), this, SLOT(threadDiameterChanged(double)));
|
||||
connect(ui->directionRightHand, SIGNAL(clicked(bool)), this, SLOT(threadDirectionChanged()));
|
||||
connect(ui->directionLeftHand, SIGNAL(clicked(bool)), this, SLOT(threadDirectionChanged()));
|
||||
connect(ui->HoleCutType, SIGNAL(currentIndexChanged(int)), this, SLOT(holeCutChanged(int)));
|
||||
connect(ui->HoleCutDiameter, SIGNAL(valueChanged(double)), this, SLOT(holeCutDiameterChanged(double)));
|
||||
connect(ui->HoleCutDepth, SIGNAL(valueChanged(double)), this, SLOT(holeCutDepthChanged(double)));
|
||||
connect(ui->HoleCutCountersinkAngle, SIGNAL(valueChanged(double)), this, SLOT(holeCutCountersinkAngleChanged(double)));
|
||||
connect(ui->DepthType, SIGNAL(currentIndexChanged(int)), this, SLOT(depthChanged(int)));
|
||||
connect(ui->Depth, SIGNAL(valueChanged(double)), this, SLOT(depthValueChanged(double)));
|
||||
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->Tapered, SIGNAL(clicked(bool)), this, SLOT(taperedChanged()));
|
||||
connect(ui->TaperedAngle, SIGNAL(valueChanged(double)), this, SLOT(taperedAngleChanged(double)));
|
||||
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->updateProps();
|
||||
|
||||
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);
|
||||
ui->HoleCutCountersinkAngle->bind(pcHole->HoleCutCountersinkAngle);
|
||||
ui->Depth->bind(pcHole->Depth);
|
||||
ui->DrillPointAngle->bind(pcHole->DrillPointAngle);
|
||||
ui->TaperedAngle->bind(pcHole->TaperedAngle);
|
||||
|
||||
connectPropChanged = App::GetApplication().signalChangePropertyEditor.connect(boost::bind(&TaskHoleParameters::changedObject, this, _1));
|
||||
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
}
|
||||
|
||||
TaskHoleParameters::~TaskHoleParameters()
|
||||
{
|
||||
delete ui;
|
||||
Gui::Selection().Detach(this);
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadedChanged()
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->Threaded.setValue(ui->Threaded->isChecked());
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::modelActualThreadChanged()
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->ModelActualThread.setValue(ui->ModelActualThread->isChecked());
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadPitchChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->ThreadPitch.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadAngleChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->ThreadAngle.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadCutOffInnerChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->ThreadCutOffInner.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadCutOffOuterChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->ThreadCutOffOuter.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::holeCutChanged(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->HoleCutType.setValue(index);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::holeCutDiameterChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->HoleCutDiameter.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::holeCutDepthChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->HoleCutDepth.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::holeCutCountersinkAngleChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->HoleCutCountersinkAngle.setValue((double)value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::depthChanged(int index)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->DepthType.setValue(index);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::depthValueChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->Depth.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::drillPointChanged()
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
if (sender() == ui->drillPointFlat)
|
||||
pcHole->DrillPoint.setValue((long)0);
|
||||
else if (sender() == ui->drillPointAngled)
|
||||
pcHole->DrillPoint.setValue((long)1);
|
||||
else
|
||||
assert( 0 );
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::drillPointAngledValueChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->DrillPointAngle.setValue((double)value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::taperedChanged()
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->Tapered.setValue(ui->Tapered->isChecked());
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::taperedAngleChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->TaperedAngle.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadTypeChanged(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
pcHole->ThreadType.setValue(index);
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadSizeChanged(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->ThreadSize.setValue(index);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadClassChanged(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->ThreadClass.setValue(index);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadDiameterChanged(double value)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->Diameter.setValue(value);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadFitChanged(int index)
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
pcHole->ThreadFit.setValue(index);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::threadDirectionChanged()
|
||||
{
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
|
||||
if (sender() == ui->directionRightHand)
|
||||
pcHole->ThreadDirection.setValue((long)0);
|
||||
else
|
||||
pcHole->ThreadDirection.setValue((long)1);
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::changeEvent(QEvent *e)
|
||||
@@ -72,17 +326,412 @@ void TaskHoleParameters::changeEvent(QEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
/// @cond DOXERR
|
||||
void TaskHoleParameters::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
|
||||
Gui::SelectionSingleton::MessageType Reason)
|
||||
void TaskHoleParameters::changedObject(const App::Property &Prop)
|
||||
{
|
||||
if (Reason.Type == SelectionChanges::AddSelection ||
|
||||
Reason.Type == SelectionChanges::RmvSelection ||
|
||||
Reason.Type == SelectionChanges::SetSelection ||
|
||||
Reason.Type == SelectionChanges::ClrSelection) {
|
||||
// happens when aborting the command
|
||||
if (vp == nullptr)
|
||||
return;
|
||||
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
bool ro = Prop.isReadOnly();
|
||||
|
||||
Base::Console().Log("Parameter %s was updated\n", Prop.getName());
|
||||
|
||||
if (&Prop == &pcHole->Threaded) {
|
||||
ui->Threaded->setEnabled(true);
|
||||
if (ui->Threaded->isChecked() ^ pcHole->Threaded.getValue()) {
|
||||
ui->Threaded->blockSignals(true);
|
||||
ui->Threaded->setChecked(pcHole->Threaded.getValue());
|
||||
ui->Threaded->blockSignals(false);
|
||||
}
|
||||
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);
|
||||
|
||||
ui->ThreadSize->blockSignals(true);
|
||||
ui->ThreadSize->clear();
|
||||
const char ** cursor = pcHole->ThreadSize.getEnums();
|
||||
while (*cursor) {
|
||||
ui->ThreadSize->addItem(tr(*cursor));
|
||||
++cursor;
|
||||
}
|
||||
ui->ThreadSize->setCurrentIndex(pcHole->ThreadSize.getValue());
|
||||
ui->ThreadSize->blockSignals(false);
|
||||
|
||||
// Thread type also updates HoleCutType and ThreadClass
|
||||
ui->HoleCutType->blockSignals(true);
|
||||
ui->HoleCutType->clear();
|
||||
cursor = pcHole->HoleCutType.getEnums();
|
||||
while (*cursor) {
|
||||
ui->HoleCutType->addItem(tr(*cursor));
|
||||
++cursor;
|
||||
}
|
||||
ui->HoleCutType->setCurrentIndex(pcHole->HoleCutType.getValue());
|
||||
ui->HoleCutType->blockSignals(false);
|
||||
|
||||
ui->ThreadClass->blockSignals(true);
|
||||
ui->ThreadClass->clear();
|
||||
cursor = pcHole->ThreadClass.getEnums();
|
||||
while (*cursor) {
|
||||
ui->ThreadClass->addItem(tr(*cursor));
|
||||
++cursor;
|
||||
}
|
||||
ui->ThreadClass->setCurrentIndex(pcHole->ThreadClass.getValue());
|
||||
ui->ThreadClass->blockSignals(false);
|
||||
|
||||
if (ui->ThreadType->currentIndex() != pcHole->ThreadType.getValue()) {
|
||||
ui->ThreadType->blockSignals(true);
|
||||
ui->ThreadType->setCurrentIndex(pcHole->ThreadType.getValue());
|
||||
ui->ThreadType->blockSignals(false);
|
||||
}
|
||||
ui->ThreadType->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->ThreadSize) {
|
||||
ui->ThreadSize->setEnabled(true);
|
||||
if (ui->ThreadSize->currentIndex() != pcHole->ThreadSize.getValue()) {
|
||||
ui->ThreadSize->blockSignals(true);
|
||||
ui->ThreadSize->setCurrentIndex(pcHole->ThreadSize.getValue());
|
||||
ui->ThreadSize->blockSignals(false);
|
||||
}
|
||||
ui->ThreadSize->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->ThreadClass) {
|
||||
ui->ThreadClass->setEnabled(true);
|
||||
if (ui->ThreadClass->currentIndex() != pcHole->ThreadClass.getValue()) {
|
||||
ui->ThreadClass->blockSignals(true);
|
||||
ui->ThreadClass->setCurrentIndex(pcHole->ThreadClass.getValue());
|
||||
ui->ThreadClass->blockSignals(false);
|
||||
}
|
||||
ui->ThreadClass->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->ThreadFit) {
|
||||
ui->ThreadFit->setEnabled(true);
|
||||
if (ui->ThreadFit->currentIndex() != pcHole->ThreadFit.getValue()) {
|
||||
ui->ThreadFit->blockSignals(true);
|
||||
ui->ThreadFit->setCurrentIndex(pcHole->ThreadFit.getValue());
|
||||
ui->ThreadFit->blockSignals(false);
|
||||
}
|
||||
ui->ThreadFit->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->Diameter) {
|
||||
ui->Diameter->setEnabled(true);
|
||||
if (ui->Diameter->value().getValue() != pcHole->Diameter.getValue()) {
|
||||
ui->Diameter->blockSignals(true);
|
||||
ui->Diameter->setValue(pcHole->Diameter.getValue());
|
||||
ui->Diameter->blockSignals(false);
|
||||
}
|
||||
ui->Diameter->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->ThreadDirection) {
|
||||
ui->directionRightHand->setEnabled(true);
|
||||
ui->directionLeftHand->setEnabled(true);
|
||||
std::string direction(pcHole->ThreadDirection.getValueAsString());
|
||||
if (direction == "Right" && !ui->directionRightHand->isChecked()) {
|
||||
ui->directionRightHand->blockSignals(true);
|
||||
ui->directionRightHand->setChecked(true);
|
||||
ui->directionRightHand->blockSignals(false);
|
||||
}
|
||||
if (direction == "Left" && !ui->directionLeftHand->isChecked()) {
|
||||
ui->directionLeftHand->blockSignals(true);
|
||||
ui->directionLeftHand->setChecked(true);
|
||||
ui->directionLeftHand->blockSignals(false);
|
||||
}
|
||||
ui->directionRightHand->setDisabled(ro);
|
||||
ui->directionLeftHand->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->HoleCutType) {
|
||||
ui->HoleCutType->setEnabled(true);
|
||||
if (ui->HoleCutType->currentIndex() != pcHole->HoleCutType.getValue()) {
|
||||
ui->HoleCutType->blockSignals(true);
|
||||
ui->HoleCutType->setCurrentIndex(pcHole->HoleCutType.getValue());
|
||||
ui->HoleCutType->blockSignals(false);
|
||||
}
|
||||
ui->HoleCutType->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->HoleCutDiameter) {
|
||||
ui->HoleCutDiameter->setEnabled(true);
|
||||
if (ui->HoleCutDiameter->value().getValue() != pcHole->HoleCutDiameter.getValue()) {
|
||||
ui->HoleCutDiameter->blockSignals(true);
|
||||
ui->HoleCutDiameter->setValue(pcHole->HoleCutDiameter.getValue());
|
||||
ui->HoleCutDiameter->blockSignals(false);
|
||||
}
|
||||
ui->HoleCutDiameter->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->HoleCutDepth) {
|
||||
ui->HoleCutDepth->setEnabled(true);
|
||||
if (ui->HoleCutDepth->value().getValue() != pcHole->HoleCutDepth.getValue()) {
|
||||
ui->HoleCutDepth->blockSignals(true);
|
||||
ui->HoleCutDepth->setValue(pcHole->HoleCutDepth.getValue());
|
||||
ui->HoleCutDepth->blockSignals(false);
|
||||
}
|
||||
ui->HoleCutDepth->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->HoleCutCountersinkAngle) {
|
||||
ui->HoleCutCountersinkAngle->setEnabled(true);
|
||||
if (ui->HoleCutCountersinkAngle->value().getValue() != pcHole->HoleCutCountersinkAngle.getValue()) {
|
||||
ui->HoleCutCountersinkAngle->blockSignals(true);
|
||||
ui->HoleCutCountersinkAngle->setValue(pcHole->HoleCutCountersinkAngle.getValue());
|
||||
ui->HoleCutCountersinkAngle->blockSignals(false);
|
||||
}
|
||||
ui->HoleCutCountersinkAngle->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->DepthType) {
|
||||
ui->DepthType->setEnabled(true);
|
||||
if (ui->DepthType->currentIndex() != pcHole->DepthType.getValue()) {
|
||||
ui->DepthType->blockSignals(true);
|
||||
ui->DepthType->setCurrentIndex(pcHole->DepthType.getValue());
|
||||
ui->DepthType->blockSignals(false);
|
||||
}
|
||||
ui->DepthType->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->Depth) {
|
||||
ui->Depth->setEnabled(true);
|
||||
if (ui->Depth->value().getValue() != pcHole->Depth.getValue()) {
|
||||
ui->Depth->blockSignals(true);
|
||||
ui->Depth->setValue(pcHole->Depth.getValue());
|
||||
ui->Depth->blockSignals(false);
|
||||
}
|
||||
ui->Depth->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->DrillPoint) {
|
||||
ui->drillPointFlat->setEnabled(true);
|
||||
ui->drillPointAngled->setEnabled(true);
|
||||
std::string drillPoint(pcHole->DrillPoint.getValueAsString());
|
||||
if (drillPoint == "Flat" && !ui->drillPointFlat->isChecked()) {
|
||||
ui->drillPointFlat->blockSignals(true);
|
||||
ui->drillPointFlat->setChecked(true);
|
||||
ui->drillPointFlat->blockSignals(false);
|
||||
}
|
||||
if (drillPoint == "Angled" && !ui->drillPointAngled->isChecked()) {
|
||||
ui->drillPointAngled->blockSignals(true);
|
||||
ui->drillPointAngled->setChecked(true);
|
||||
ui->drillPointAngled->blockSignals(false);
|
||||
}
|
||||
ui->drillPointFlat->setDisabled(ro);
|
||||
ui->drillPointAngled->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->DrillPointAngle) {
|
||||
ui->DrillPointAngle->setEnabled(true);
|
||||
if (ui->DrillPointAngle->value().getValue() != pcHole->DrillPointAngle.getValue()) {
|
||||
ui->DrillPointAngle->blockSignals(true);
|
||||
ui->DrillPointAngle->setValue(pcHole->DrillPointAngle.getValue());
|
||||
ui->DrillPointAngle->blockSignals(false);
|
||||
}
|
||||
ui->DrillPointAngle->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->Tapered) {
|
||||
ui->Tapered->setEnabled(true);
|
||||
if (ui->Tapered->isChecked() ^ pcHole->Tapered.getValue()) {
|
||||
ui->Tapered->blockSignals(true);
|
||||
ui->Tapered->setChecked(pcHole->Tapered.getValue());
|
||||
ui->Tapered->blockSignals(false);
|
||||
}
|
||||
ui->Tapered->setDisabled(ro);
|
||||
}
|
||||
else if (&Prop == &pcHole->TaperedAngle) {
|
||||
ui->TaperedAngle->setEnabled(true);
|
||||
if (ui->TaperedAngle->value().getValue() != pcHole->TaperedAngle.getValue()) {
|
||||
ui->TaperedAngle->blockSignals(true);
|
||||
ui->TaperedAngle->setValue(pcHole->TaperedAngle.getValue());
|
||||
ui->TaperedAngle->blockSignals(false);
|
||||
}
|
||||
ui->TaperedAngle->setDisabled(ro);
|
||||
}
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
void TaskHoleParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
{
|
||||
Q_UNUSED(msg)
|
||||
}
|
||||
|
||||
bool TaskHoleParameters::getThreaded() const
|
||||
{
|
||||
return ui->Threaded->isChecked();
|
||||
}
|
||||
|
||||
long TaskHoleParameters::getThreadType() const
|
||||
{
|
||||
return ui->ThreadType->currentIndex();
|
||||
}
|
||||
|
||||
long TaskHoleParameters::getThreadSize() const
|
||||
{
|
||||
if ( ui->ThreadSize->currentIndex() == -1 )
|
||||
return 0;
|
||||
else
|
||||
return ui->ThreadSize->currentIndex();
|
||||
}
|
||||
|
||||
long TaskHoleParameters::getThreadClass() const
|
||||
{
|
||||
if ( ui->ThreadSize->currentIndex() == -1 )
|
||||
return 0;
|
||||
else
|
||||
return ui->ThreadClass->currentIndex();
|
||||
}
|
||||
|
||||
long TaskHoleParameters::getThreadFit() const
|
||||
{
|
||||
if (ui->Threaded->isChecked())
|
||||
return ui->ThreadFit->currentIndex();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
Base::Quantity TaskHoleParameters::getDiameter() const
|
||||
{
|
||||
return ui->Diameter->value();
|
||||
}
|
||||
|
||||
bool TaskHoleParameters::getThreadDirection() const
|
||||
{
|
||||
return ui->directionRightHand->isChecked();
|
||||
}
|
||||
|
||||
long TaskHoleParameters::getHoleCutType() const
|
||||
{
|
||||
if (ui->HoleCutType->currentIndex() == -1)
|
||||
return 0;
|
||||
else
|
||||
return ui->HoleCutType->currentIndex();
|
||||
}
|
||||
|
||||
Base::Quantity TaskHoleParameters::getHoleCutDiameter() const
|
||||
{
|
||||
return ui->HoleCutDiameter->value();
|
||||
}
|
||||
|
||||
Base::Quantity TaskHoleParameters::getHoleCutDepth() const
|
||||
{
|
||||
return ui->HoleCutDepth->value();
|
||||
}
|
||||
|
||||
Base::Quantity TaskHoleParameters::getHoleCutCountersinkAngle() const
|
||||
{
|
||||
return ui->HoleCutCountersinkAngle->value();
|
||||
}
|
||||
|
||||
long TaskHoleParameters::getDepthType() const
|
||||
{
|
||||
return ui->DepthType->currentIndex();
|
||||
}
|
||||
|
||||
Base::Quantity TaskHoleParameters::getDepth() const
|
||||
{
|
||||
return ui->Depth->value();
|
||||
}
|
||||
|
||||
long TaskHoleParameters::getDrillPoint() const
|
||||
{
|
||||
if ( ui->drillPointFlat->isChecked() )
|
||||
return 0;
|
||||
if ( ui->drillPointAngled->isChecked() )
|
||||
return 1;
|
||||
assert( 0 );
|
||||
return -1; // to avoid a compiler warning
|
||||
}
|
||||
|
||||
Base::Quantity TaskHoleParameters::getDrillPointAngle() const
|
||||
{
|
||||
return ui->DrillPointAngle->value();
|
||||
}
|
||||
|
||||
bool TaskHoleParameters::getTapered() const
|
||||
{
|
||||
return ui->Tapered->isChecked();
|
||||
}
|
||||
|
||||
Base::Quantity TaskHoleParameters::getTaperedAngle() const
|
||||
{
|
||||
return ui->TaperedAngle->value();
|
||||
}
|
||||
|
||||
void TaskHoleParameters::apply()
|
||||
{
|
||||
std::string name = vp->getObject()->getNameInDocument();
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(vp->getObject());
|
||||
const char * cname = name.c_str();
|
||||
|
||||
isApplying = true;
|
||||
|
||||
ui->ThreadPitch->apply();
|
||||
ui->ThreadAngle->apply();
|
||||
ui->ThreadCutOffInner->apply();
|
||||
ui->ThreadCutOffOuter->apply();
|
||||
ui->Diameter->apply();
|
||||
ui->HoleCutDiameter->apply();
|
||||
ui->HoleCutDepth->apply();
|
||||
ui->HoleCutCountersinkAngle->apply();
|
||||
ui->Depth->apply();
|
||||
ui->DrillPointAngle->apply();
|
||||
ui->TaperedAngle->apply();
|
||||
|
||||
if (!pcHole->Threaded.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Threaded = %u", cname, getThreaded() ? 1 : 0);
|
||||
if (!pcHole->ModelActualThread.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ModelActualThread = %u", cname, getThreaded() ? 1 : 0);
|
||||
if (!pcHole->ThreadType.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadType = %u", cname, getThreadType());
|
||||
if (!pcHole->ThreadSize.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadSize = %u", cname, getThreadSize());
|
||||
if (!pcHole->ThreadClass.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadClass = %u", cname, getThreadClass());
|
||||
if (!pcHole->ThreadFit.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadFit = %u", cname, getThreadFit());
|
||||
if (!pcHole->ThreadDirection.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.ThreadDirection = %u", cname, getThreadDirection());
|
||||
if (!pcHole->HoleCutType.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.HoleCutType = %u", cname, getHoleCutType());
|
||||
if (!pcHole->DepthType.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.DepthType = %u", cname, getDepthType());
|
||||
if (!pcHole->DrillPoint.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.DrillPoint = %u", cname, getDrillPoint());
|
||||
if (!pcHole->Tapered.isReadOnly())
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Tapered = %u", cname, getTapered());
|
||||
|
||||
isApplying = false;
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
//**************************************************************************
|
||||
@@ -90,10 +739,10 @@ void TaskHoleParameters::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
TaskDlgHoleParameters::TaskDlgHoleParameters(ViewProviderHole *HoleView)
|
||||
: TaskDialog(),HoleView(HoleView)
|
||||
: TaskDlgSketchBasedParameters(HoleView)
|
||||
{
|
||||
assert(HoleView);
|
||||
parameter = new TaskHoleParameters();
|
||||
parameter = new TaskHoleParameters(static_cast<ViewProviderHole*>(vp));
|
||||
|
||||
Content.push_back(parameter);
|
||||
}
|
||||
@@ -103,40 +752,19 @@ TaskDlgHoleParameters::~TaskDlgHoleParameters()
|
||||
|
||||
}
|
||||
|
||||
//==== calls from the TaskView ===============================================================
|
||||
|
||||
|
||||
void TaskDlgHoleParameters::open()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TaskDlgHoleParameters::clicked(int)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool TaskDlgHoleParameters::accept()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskDlgHoleParameters::reject()
|
||||
{
|
||||
Gui::Command::openCommand("Hole changed");
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TaskDlgHoleParameters::helpRequested()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "moc_TaskHoleParameters.cpp"
|
||||
|
||||
TaskHoleParameters::Observer::Observer(TaskHoleParameters *_owner, PartDesign::Hole * _hole)
|
||||
: DocumentObserver(_hole->getDocument())
|
||||
, owner(_owner)
|
||||
, hole(_hole)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskHoleParameters::Observer::slotChangedObject(const App::DocumentObject &Obj, const App::Property &Prop)
|
||||
{
|
||||
if (&Obj == hole) {
|
||||
Base::Console().Log("Parameter %s was updated with a new value\n", Prop.getName());
|
||||
owner->changedObject(Prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,10 @@
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <App/DocumentObserver.h>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "TaskSketchBasedParameters.h"
|
||||
#include "ViewProviderHole.h"
|
||||
|
||||
class Ui_TaskHoleParameters;
|
||||
@@ -40,35 +43,95 @@ namespace Gui {
|
||||
class ViewProvider;
|
||||
}
|
||||
|
||||
namespace PartDesign {
|
||||
class Hole;
|
||||
}
|
||||
|
||||
namespace PartDesignGui {
|
||||
|
||||
|
||||
|
||||
class TaskHoleParameters : public Gui::TaskView::TaskBox, public Gui::SelectionSingleton::ObserverType
|
||||
class TaskHoleParameters : public TaskSketchBasedParameters
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskHoleParameters(QWidget *parent = 0);
|
||||
TaskHoleParameters(ViewProviderHole *HoleView, QWidget *parent = 0);
|
||||
~TaskHoleParameters();
|
||||
/// Observer message from the Selection
|
||||
void OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
|
||||
Gui::SelectionSingleton::MessageType Reason);
|
||||
|
||||
void apply() override;
|
||||
|
||||
bool getThreaded() const;
|
||||
long getThreadType() const;
|
||||
long getThreadSize() const;
|
||||
long getThreadClass() const;
|
||||
long getThreadFit() const;
|
||||
Base::Quantity getDiameter() const;
|
||||
bool getThreadDirection() const;
|
||||
long getHoleCutType() const;
|
||||
Base::Quantity getHoleCutDiameter() const;
|
||||
Base::Quantity getHoleCutDepth() const;
|
||||
Base::Quantity getHoleCutCountersinkAngle() const;
|
||||
long getDepthType() const;
|
||||
Base::Quantity getDepth() const;
|
||||
long getDrillPoint() const;
|
||||
Base::Quantity getDrillPointAngle() const;
|
||||
bool getTapered() const;
|
||||
Base::Quantity getTaperedAngle() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void threadedChanged();
|
||||
void threadTypeChanged(int index);
|
||||
void threadSizeChanged(int index);
|
||||
void threadClassChanged(int index);
|
||||
void threadFitChanged(int index);
|
||||
void modelActualThreadChanged();
|
||||
void threadPitchChanged(double value);
|
||||
void threadCutOffOuterChanged(double value);
|
||||
void threadCutOffInnerChanged(double value);
|
||||
void threadAngleChanged(double value);
|
||||
void threadDiameterChanged(double value);
|
||||
void threadDirectionChanged();
|
||||
void holeCutChanged(int index);
|
||||
void holeCutDiameterChanged(double value);
|
||||
void holeCutDepthChanged(double value);
|
||||
void holeCutCountersinkAngleChanged(double value);
|
||||
void depthChanged(int index);
|
||||
void depthValueChanged(double value);
|
||||
void drillPointChanged();
|
||||
void drillPointAngledValueChanged(double value);
|
||||
void taperedChanged();
|
||||
void taperedAngleChanged(double value);
|
||||
private:
|
||||
class Observer : public App::DocumentObserver {
|
||||
public:
|
||||
Observer(TaskHoleParameters * _owner, PartDesign::Hole * _hole);
|
||||
private:
|
||||
virtual void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop);
|
||||
TaskHoleParameters * owner;
|
||||
PartDesign::Hole * hole;
|
||||
};
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void changedObject(const App::Property& Prop);
|
||||
|
||||
private:
|
||||
void onSelectionChanged(const Gui::SelectionChanges &msg);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
typedef boost::BOOST_SIGNALS_NAMESPACE::scoped_connection Connection;
|
||||
Connection connectPropChanged;
|
||||
|
||||
std::unique_ptr<Observer> observer;
|
||||
QWidget* proxy;
|
||||
Ui_TaskHoleParameters* ui;
|
||||
bool isApplying;
|
||||
};
|
||||
|
||||
/// simulation dialog for the TaskView
|
||||
class TaskDlgHoleParameters : public Gui::TaskView::TaskDialog
|
||||
class TaskDlgHoleParameters : public TaskDlgSketchBasedParameters
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -76,30 +139,9 @@ public:
|
||||
TaskDlgHoleParameters(ViewProviderHole *HoleView);
|
||||
~TaskDlgHoleParameters();
|
||||
|
||||
ViewProviderHole* getHoleView() const
|
||||
{ return HoleView; }
|
||||
|
||||
public:
|
||||
/// is called the TaskView when the dialog is opened
|
||||
virtual void open();
|
||||
/// is called by the framework if an button is clicked which has no accept or reject role
|
||||
virtual void clicked(int);
|
||||
/// is called by the framework if the dialog is accepted (Ok)
|
||||
virtual bool accept();
|
||||
/// is called by the framework if the dialog is rejected (Cancel)
|
||||
virtual bool reject();
|
||||
/// is called by the framework if the user presses the help button
|
||||
virtual void helpRequested();
|
||||
virtual bool isAllowedAlterDocument(void) const
|
||||
{ return false; }
|
||||
|
||||
/// returns for Close and Help button
|
||||
virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const
|
||||
{ return QDialogButtonBox::Close|QDialogButtonBox::Help; }
|
||||
ViewProviderHole* getHoleView() const { return static_cast<ViewProviderHole*>(vp); }
|
||||
|
||||
protected:
|
||||
ViewProviderHole *HoleView;
|
||||
|
||||
TaskHoleParameters *parameter;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,77 +1,453 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartDesignGui::TaskHoleParameters</class>
|
||||
<widget class="QWidget" name="PartDesignGui::TaskHoleParameters">
|
||||
<class>TaskHoleParameters</class>
|
||||
<widget class="QWidget" name="TaskHoleParameters">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>137</width>
|
||||
<height>116</height>
|
||||
<width>356</width>
|
||||
<height>660</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Task Hole Parameters</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="changeMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dimension</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Up to last</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Up to first</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="11" column="5" colspan="2">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="Diameter" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="2" colspan="2">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Diameter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="2" colspan="2">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<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="11" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Class</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="Tapered">
|
||||
<property name="text">
|
||||
<string>Tapered</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="5" colspan="2">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="Depth" native="true"/>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Direction</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="2" colspan="5">
|
||||
<widget class="QComboBox" name="HoleCutType"/>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Fit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="4" colspan="3">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="HoleCutDepth" native="true"/>
|
||||
</item>
|
||||
<item row="15" column="4" colspan="3">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="HoleCutDiameter" native="true"/>
|
||||
</item>
|
||||
<item row="9" column="2" colspan="5">
|
||||
<widget class="QComboBox" name="ThreadSize"/>
|
||||
</item>
|
||||
<item row="19" column="2" colspan="5">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="drillPointFlat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="drillPointAngled">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="DrillPointAngle" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="label_Pitch">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pitch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2" colspan="5">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="directionRightHand">
|
||||
<property name="text">
|
||||
<string>Right hand</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="directionLeftHand">
|
||||
<property name="text">
|
||||
<string>Left hand</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="5">
|
||||
<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="2" column="2" colspan="5">
|
||||
<widget class="QCheckBox" name="Threaded">
|
||||
<property name="text">
|
||||
<string>Threaded</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="label_Angle">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QComboBox" name="ThreadClass"/>
|
||||
</item>
|
||||
<item row="17" column="2" colspan="2">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Countersink angle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" 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="1" column="2" colspan="5">
|
||||
<widget class="QComboBox" name="ThreadType"/>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="4" colspan="3">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="HoleCutCountersinkAngle" native="true"/>
|
||||
</item>
|
||||
<item row="12" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="DepthType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="text">
|
||||
<string>Dimension</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::QuantitySpinBox" name="doubleSpinBox">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="text">
|
||||
<string>Through all</string>
|
||||
</property>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2" colspan="5">
|
||||
<widget class="QComboBox" name="ThreadFit">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard fit</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Close fit</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<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="4" column="3" colspan="4">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="ThreadPitch" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3" colspan="4">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="ThreadAngle" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3" colspan="4">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="ThreadCutOffInner" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3" colspan="4">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="ThreadCutOffOuter" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="0" colspan="7">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><b>Drill point</b></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0" colspan="7">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string><b>Misc</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0" colspan="7">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string><b>Hole cut</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="7">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string><b>Threading and size</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="2" colspan="2">
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="TaperedAngle" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::QuantitySpinBox</class>
|
||||
<class>Gui::PrefQuantitySpinBox</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Gui/QuantitySpinBox.h</header>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
||||
@@ -26,8 +26,16 @@
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include "ViewProviderHole.h"
|
||||
#include <Mod/PartDesign/App/FeaturePad.h>
|
||||
#include "TaskHoleParameters.h"
|
||||
#include <Mod/PartDesign/App/FeatureHole.h>
|
||||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Application.h>
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
||||
@@ -45,9 +53,72 @@ ViewProviderHole::~ViewProviderHole()
|
||||
std::vector<App::DocumentObject*> ViewProviderHole::claimChildren(void)const
|
||||
{
|
||||
std::vector<App::DocumentObject*> temp;
|
||||
temp.push_back(static_cast<PartDesign::Pad*>(getObject())->Profile.getValue());
|
||||
temp.push_back(static_cast<PartDesign::Hole*>(getObject())->Profile.getValue());
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
void ViewProviderHole::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||
{
|
||||
QAction* act;
|
||||
act = menu->addAction(QObject::tr("Edit hole"), receiver, member);
|
||||
act->setData(QVariant((int)ViewProvider::Default));
|
||||
PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member);
|
||||
}
|
||||
|
||||
bool ViewProviderHole::setEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// When double-clicking on the item for this hole the
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgHoleParameters *holeDlg = qobject_cast<TaskDlgHoleParameters *>(dlg);
|
||||
if (holeDlg && holeDlg->getHoleView() != this)
|
||||
holeDlg = 0; // another hole left open its task panel
|
||||
if (dlg && !holeDlg) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
|
||||
msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?"));
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
int ret = msgBox.exec();
|
||||
if (ret == QMessageBox::Yes)
|
||||
Gui::Control().closeDialog();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (holeDlg)
|
||||
Gui::Control().showDialog(holeDlg);
|
||||
else
|
||||
Gui::Control().showDialog(new TaskDlgHoleParameters(this));
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return PartGui::ViewProviderPart::setEdit(ModNum);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderHole::onDelete(const std::vector<std::string> &s)
|
||||
{
|
||||
// get the Sketch
|
||||
PartDesign::Hole* pcHole = static_cast<PartDesign::Hole*>(getObject());
|
||||
Sketcher::SketchObject *pcSketch = 0;
|
||||
if (pcHole->Profile.getValue())
|
||||
pcSketch = static_cast<Sketcher::SketchObject*>(pcHole->Profile.getValue());
|
||||
|
||||
// if abort command deleted the object the sketch is visible again
|
||||
if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
|
||||
Gui::Application::Instance->getViewProvider(pcSketch)->show();
|
||||
|
||||
return ViewProvider::onDelete(s);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ public:
|
||||
|
||||
/// grouping handling
|
||||
std::vector<App::DocumentObject*> claimChildren(void)const;
|
||||
void setupContextMenu(QMenu *menu, QObject *receiver, const char *member);
|
||||
bool onDelete(const std::vector<std::string> &s);
|
||||
protected:
|
||||
bool setEdit(int ModNum);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -366,6 +366,7 @@ void Workbench::activated()
|
||||
"PartDesign_NewSketch",
|
||||
"PartDesign_Pad",
|
||||
"PartDesign_Pocket",
|
||||
"PartDesign_Hole",
|
||||
"PartDesign_Revolution",
|
||||
"PartDesign_Groove",
|
||||
"PartDesign_AdditivePipe",
|
||||
@@ -456,6 +457,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
<< "PartDesign_CompPrimitiveAdditive"
|
||||
<< "Separator"
|
||||
<< "PartDesign_Pocket"
|
||||
<< "PartDesign_Hole"
|
||||
<< "PartDesign_Groove"
|
||||
<< "PartDesign_SubtractiveLoft"
|
||||
<< "PartDesign_SubtractivePipe"
|
||||
@@ -522,6 +524,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "PartDesign_CompPrimitiveAdditive"
|
||||
<< "Separator"
|
||||
<< "PartDesign_Pocket"
|
||||
<< "PartDesign_Hole"
|
||||
<< "PartDesign_Groove"
|
||||
<< "PartDesign_SubtractiveLoft"
|
||||
<< "PartDesign_SubtractivePipe"
|
||||
|
||||
Reference in New Issue
Block a user