* \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 @@*/
};
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 @@*/
};
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");
// 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()));
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"));
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 :
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())
{
#include <GEOMBase_Skeleton.h>
class DlgRef_1Spin;
+class DlgRef_3Radio;
//=================================================================================
// class : AdvancedGUI_DividedDiskDlg
private:
DlgRef_1Spin* GroupParams;
+ DlgRef_3Radio* GroupOrientation;
+ int myOrientation;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void ValueChangedInSpinBox();
+ void RadioButtonClicked();
void SetDoubleSpinBoxStep( double );
};
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);
aBuilder.Add(S, F1);
aBuilder.Add(S, F2);
aBuilder.Add(S, F3);
-
-
+
// rotation
V1=V1_60;
V2=V2_60;
E8=E9;
}
- aShape = S;
+ aShape = TransformShape(S, theOrientation);
}
else {
// other construction modes here
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 :
class Handle_Standard_Type;
class GEOMImpl_DividedDiskDriver;
+class TopoDS_Shape;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DividedDiskDriver);
{
return (STANDARD_TYPE(GEOMImpl_DividedDiskDriver) == AType || TFunction_Driver::IsKind(AType));
}
+
+private:
+ TopoDS_Shape TransformShape(TopoDS_Shape aShape, int theOrientation) const;
};
#endif // _GEOMImpl_DividedDiskDriver_HXX
* \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);
aData.SetR(theR);
aData.SetRatio(theRatio);
+ aData.SetOrientation(theOrientation);
//Compute the resulting value
try {
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theRatio << ")";
+ GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theOrientation << ")";
SetErrorCode(OK);
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
#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
{
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;
* \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;
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();
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()
//=============================================================================
// 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;
}
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: