EDF 2281: Added the possibility to choose the orientation of the divided disk

This commit is contained in:
rnc 2012-07-09 14:28:50 +00:00
parent 1275586706
commit a878bd5408
13 changed files with 118 additions and 20 deletions

View File

@ -3765,7 +3765,7 @@ module GEOM
* \param theRatio Relative size of the central square diagonal against the disk diameter
* \return New GEOM_Object, containing the created shape.
*/
GEOM_Object MakeDividedDisk (in double theR, in double theRatio);
GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};

View File

@ -617,7 +617,7 @@ module GEOM
in double theRF, in boolean theHexMesh,
in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3);
GEOM_Object MakeDividedDisk (in double theR, in double theRatio);
GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};

View File

@ -58,12 +58,21 @@ AdvancedGUI_DividedDiskDlg::AdvancedGUI_DividedDiskDlg (GeometryGUI* theGeometry
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
GroupParams = new DlgRef_1Spin(centralWidget());
GroupParams = new DlgRef_1Spin(centralWidget());
GroupParams->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupParams->TextLabel1->setText(tr("GEOM_RADIUS"));
GroupOrientation = new DlgRef_3Radio(centralWidget());
GroupOrientation->GroupBox1->setTitle(tr("GEOM_ORIENTATION"));
GroupOrientation->RadioButton1->setText(tr("GEOM_WPLANE_OXY"));
GroupOrientation->RadioButton2->setText(tr("GEOM_WPLANE_OYZ"));
GroupOrientation->RadioButton3->setText(tr("GEOM_WPLANE_OZX"));
//@@ setup dialog box layout here @@//
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupParams);
layout->addWidget(GroupOrientation);
/***************************************************************/
setHelpFileName("create_divideddisk_page.html");
@ -92,6 +101,9 @@ void AdvancedGUI_DividedDiskDlg::Init()
// min, max, step and decimals for spin boxes & initial values
initSpinBox(GroupParams->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
GroupParams->SpinBox_DX->setValue(100);
GroupOrientation->RadioButton1->setChecked(true);
myOrientation = 1;
// Signal/slot connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
@ -100,6 +112,10 @@ void AdvancedGUI_DividedDiskDlg::Init()
this, SLOT(SetDoubleSpinBoxStep(double)));
connect(GroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupOrientation->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
connect(GroupOrientation->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
connect(GroupOrientation->RadioButton3, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
initName(tr("GEOM_DIVIDEDDISK"));
@ -160,6 +176,34 @@ void AdvancedGUI_DividedDiskDlg::enterEvent (QEvent*)
ActivateThisDialog();
}
//=================================================================================
// function : RadioBittonClicked()
// purpose : Radio button management
//=================================================================================
void AdvancedGUI_DividedDiskDlg::RadioButtonClicked()
{
if (GroupOrientation->RadioButton1->isChecked())
myOrientation = 1;
else if (GroupOrientation->RadioButton2->isChecked())
myOrientation = 2;
else if (GroupOrientation->RadioButton3->isChecked())
myOrientation = 3;
// gp_Pnt theOrigin = gp::Origin();
// gp_Dir DirZ = gp::DZ();
// gp_Dir DirX = gp::DX();
// gp_Dir DirY = gp::DY();
//
// if (GroupOrientation->RadioButton1->isChecked())
// myWPlane = gp_Ax3(theOrigin, DirZ, DirX);
// else if (GroupOrientation->RadioButton2->isChecked())
// myWPlane = gp_Ax3(theOrigin, DirX, DirY);
// else if (GroupOrientation->RadioButton3->isChecked())
// myWPlane = gp_Ax3(theOrigin, DirY, DirZ);
displayPreview(true);
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
@ -209,7 +253,7 @@ bool AdvancedGUI_DividedDiskDlg::execute (ObjectList& objects)
CORBA::Double theRatio = 50; //@@ init parameter value from dialog box @@;
// call engine function
anObj = anOper->MakeDividedDisk(theR, theRatio);
anObj = anOper->MakeDividedDisk(theR, theRatio, myOrientation);
res = !anObj->_is_nil();
if (res && !IsPreview())
{

View File

@ -25,6 +25,7 @@
#include <GEOMBase_Skeleton.h>
class DlgRef_1Spin;
class DlgRef_3Radio;
//=================================================================================
// class : AdvancedGUI_DividedDiskDlg
@ -50,12 +51,15 @@ private:
private:
DlgRef_1Spin* GroupParams;
DlgRef_3Radio* GroupOrientation;
int myOrientation;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void ValueChangedInSpinBox();
void RadioButtonClicked();
void SetDoubleSpinBoxStep( double );
};

View File

@ -89,8 +89,9 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con
if (aType == DIVIDEDDISK_R_RATIO) {
// Getting data
double R = aData.GetR();
double Ratio = aData.GetRatio();
double R = aData.GetR();
double Ratio = aData.GetRatio();
int theOrientation = aData.GetOrientation();
// Geometry
gp_Dir ZDir(0,0,1);
@ -218,8 +219,7 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con
aBuilder.Add(S, F1);
aBuilder.Add(S, F2);
aBuilder.Add(S, F3);
// rotation
V1=V1_60;
V2=V2_60;
@ -238,7 +238,7 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con
E8=E9;
}
aShape = S;
aShape = TransformShape(S, theOrientation);
}
else {
// other construction modes here
@ -253,6 +253,47 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con
return 1;
}
//=======================================================================
//function : TrasformShape(int theOrientation)
//purpose : Perform shape transformation accordingly with specified
// orientation
//=======================================================================
TopoDS_Shape GEOMImpl_DividedDiskDriver::TransformShape(TopoDS_Shape aShape, int theOrientation) const
{
gp_Dir N, Vx;
gp_Pnt theOrigin = gp::Origin();
switch(theOrientation)
{
case 1:
{
N = gp::DZ();
Vx = gp::DX();
break;
}
case 2:
{
N = gp::DX();
Vx = gp::DY();
break;
}
case 3:
{
N = gp::DY();
Vx = gp::DZ();
break;
}
}
gp_Ax3 aWPlane = gp_Ax3(theOrigin, N, Vx);
gp_Trsf aTrans;
aTrans.SetTransformation(aWPlane);
aTrans.Invert();
BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
return aTransformation.Shape();
}
//=======================================================================
//function : GEOMImpl_DividedDiskDriver_Type_
//purpose :

View File

@ -26,6 +26,7 @@
class Handle_Standard_Type;
class GEOMImpl_DividedDiskDriver;
class TopoDS_Shape;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DividedDiskDriver);
@ -116,6 +117,9 @@ public:
{
return (STANDARD_TYPE(GEOMImpl_DividedDiskDriver) == AType || TFunction_Driver::IsKind(AType));
}
private:
TopoDS_Shape TransformShape(TopoDS_Shape aShape, int theOrientation) const;
};
#endif // _GEOMImpl_DividedDiskDriver_HXX

View File

@ -2244,7 +2244,7 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio)
Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio, int theOrientation)
{
SetErrorCode(KO);
@ -2262,6 +2262,7 @@ Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR,
aData.SetR(theR);
aData.SetRatio(theRatio);
aData.SetOrientation(theOrientation);
//Compute the resulting value
try {
@ -2280,7 +2281,7 @@ Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR,
}
//Make a Python command
GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theRatio << ")";
GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theOrientation << ")";
SetErrorCode(OK);

View File

@ -109,7 +109,7 @@ public:
Handle(GEOM_Object) P1 = 0,
Handle(GEOM_Object) P2 = 0,
Handle(GEOM_Object) P3 = 0);
Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio);
Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio, int theOrientation);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
#endif

View File

@ -24,8 +24,9 @@
#include "GEOM_Function.hxx"
#define DIVIDEDDISK_ARG_R 1
#define DIVIDEDDISK_ARG_RATIO 2
#define DIVIDEDDISK_ARG_R 1
#define DIVIDEDDISK_ARG_RATIO 2
#define DIVIDEDDISK_ARG_ORIENT 3
class GEOMImpl_IDividedDisk
{
@ -37,6 +38,9 @@ public:
void SetRatio(double theRatio) { _func->SetReal(DIVIDEDDISK_ARG_RATIO, theRatio); }
double GetRatio() { return _func->GetReal(DIVIDEDDISK_ARG_RATIO); }
void SetOrientation(int theOrientation) { _func->SetInteger(DIVIDEDDISK_ARG_ORIENT, theOrientation); }
double GetOrientation() { return _func->GetInteger(DIVIDEDDISK_ARG_ORIENT); }
private:
Handle(GEOM_Function) _func;

View File

@ -330,7 +330,7 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CO
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio)
GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, CORBA::Short theOrientation)
{
GEOM::GEOM_Object_var aGEOMObject;
@ -338,7 +338,7 @@ GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double
GetOperations()->SetNotDone();
//Create the DividedDisk
Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio);
Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio, theOrientation);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();

View File

@ -63,7 +63,7 @@ class GEOM_I_EXPORT GEOM_IAdvancedOperations_i :
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theRF, CORBA::Boolean theHexMesh,
GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio);
GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, CORBA::Short theOrientation);
/*@@ insert new functions before this line @@ do not remove this line @@*/
::GEOMImpl_IAdvancedOperations* GetOperations()

View File

@ -3405,12 +3405,12 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeFilletWithPosition
//=============================================================================
// MakeDividedDisk
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio)
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, CORBA::Short theOrientation)
{
beginService( " GEOM_Superv_i::MakeDividedDisk" );
MESSAGE("GEOM_Superv_i::MakeDividedDisk");
getAdvancedOp();
GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedDisk(theR, theRatio);
GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedDisk(theR, theRatio, theOrientation);
endService( " GEOM_Superv_i::MakeDividedDisk" );
return anObj;
}

View File

@ -706,7 +706,7 @@ public:
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theRF, CORBA::Boolean theHexMesh,
GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio);
GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio,CORBA::Short theOrientation );
/*@@ insert new functions before this line @@ do not remove this line @@*/
private: