Translations and update of the doc to be done.
Interpolation
};
+ /*!
+ * \brief Pattern for block division of the disk
+ *
+ * Used in the functions GEOM_IAdvancedOperations.MakeDividedDisk(), GEOM_ICurvesOperations.MakeDividedDiskPntVecR()
+ */
+ enum pattern {
+ /*! Square */
+ SQUARE,
+
+ /*! Hexagon */
+ HEXAGON
+ };
+
typedef sequence<string> string_array;
typedef sequence<short> short_array;
* \param theOrientation Plane on which the disk will be built
* \return New GEOM_Object, containing the created shape.
*/
- GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation);
+ GEOM_Object MakeDividedDisk (in double theR,
+ in double theRatio,
+ in short theOrientation,
+ in pattern thePattern);
/*!
* \brief Create a Disk prepared for hexa meshing with given center, normal vector and radius.
GEOM_Object MakeDividedDiskPntVecR ( in GEOM_Object thePnt,
in GEOM_Object theVec,
in double theR,
- in double theRatio);
+ in double theRatio,
+ in pattern thePattern);
/*!
* Builds a cylinder prepared for hexa meshes
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, in short theOrientation);
+ GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation,
+ in pattern thePattern);
GEOM_Object MakeDividedCylinder (in double theR, in double theH);
#include <GEOMImpl_Types.hxx>
+// enum
+// {
+// SQUARE,
+// HEXAGON
+// };
+
//=================================================================================
// Constructor
//=================================================================================
GroupOrientation->RadioButton2->setText(tr("GEOM_WPLANE_OYZ"));
GroupOrientation->RadioButton3->setText(tr("GEOM_WPLANE_OZX"));
+ GroupPattern = new DlgRef_3Radio(centralWidget());
+ GroupPattern->GroupBox1->setTitle(tr("GEOM_PATTERN"));
+ GroupPattern->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ GroupPattern->RadioButton3->close();
+
+
GroupPntVecR = new DlgRef_2Sel1Spin(centralWidget());
GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupPntVecR->TextLabel1->setText(tr("GEOM_CENTER_POINT"));
layout->addWidget(GroupParams);
layout->addWidget(GroupOrientation);
layout->addWidget(GroupPntVecR);
+ layout->addWidget(GroupPattern);
/***************************************************************/
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" );
+ initSpinBox(GroupPntVecR->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
GroupParams ->SpinBox_DX->setValue(100);
GroupPntVecR->SpinBox_DX->setValue(100);
GroupOrientation->RadioButton1->setChecked(true);
myOrientation = 1;
+
+ GroupPattern->RadioButton1->setChecked(true);
+ myPattern = GEOM::SQUARE;
// Signal/slot connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(GroupOrientation->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
connect(GroupOrientation->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
connect(GroupOrientation->RadioButton3, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
+
+ connect(GroupPattern->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
+ connect(GroupPattern->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
initName(tr("GEOM_DIVIDEDDISK"));
//=================================================================================
void AdvancedGUI_DividedDiskDlg::RadioButtonClicked()
{
- if (GroupOrientation->RadioButton1->isChecked())
+ QRadioButton* send = (QRadioButton*)sender();
+
+ // Orientation
+ if (send == GroupOrientation->RadioButton1)
myOrientation = 1;
- else if (GroupOrientation->RadioButton2->isChecked())
+ else if ( send == GroupOrientation->RadioButton2)
myOrientation = 2;
- else if (GroupOrientation->RadioButton3->isChecked())
+ else if ( send == GroupOrientation->RadioButton3)
myOrientation = 3;
+ // Division pattern
+ else if (send == GroupPattern->RadioButton1)
+ myPattern = GEOM::SQUARE;
+ else if (send == GroupPattern->RadioButton2)
+ myPattern = GEOM::HEXAGON;
+
displayPreview(true);
}
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
- CORBA::Double theRatio = 50;
+ CORBA::Double theRatio = 67; // About 2/3
CORBA::Double theR = 0;
switch (getConstructorId()) {
theR = GroupParams->SpinBox_DX->value(); // init parameter value from dialog box ;
// call engine function
- anObj = anOper->MakeDividedDisk(theR, theRatio, myOrientation);
+ anObj = anOper->MakeDividedDisk(theR, theRatio, myOrientation, myPattern);
res = !anObj->_is_nil();
if (res && !IsPreview())
{
theR = GroupPntVecR->SpinBox_DX->value();
// call engine function
- anObj = anOper->MakeDividedDiskPntVecR(myPoint.get(), myDir.get(), theR, theRatio);
+ anObj = anOper->MakeDividedDiskPntVecR(myPoint.get(), myDir.get(), theR, theRatio, myPattern);
res = !anObj->_is_nil();
if (res && !IsPreview())
{
GEOM::GeomObjPtr myPoint, myDir;
DlgRef_1Spin* GroupParams;
DlgRef_3Radio* GroupOrientation;
+ DlgRef_3Radio* GroupPattern;
DlgRef_2Sel1Spin* GroupPntVecR;
int myOrientation;
-
+ GEOM::pattern myPattern;
+
private slots:
void ConstructorsClicked ( int );
void ClickOnOk();
#include <utilities.h>
//@@ include required header files here @@//
+enum
+{
+ SQUARE,
+ HEXAGON
+};
//=======================================================================
//function : GetID
//purpose :
TopoDS_Shape aShape;
// Getting data
- double R = aData.GetR();
- double Ratio = aData.GetRatio();
+ double R = aData.GetR();
+ double Ratio = aData.GetRatio();
+ int Pattern = aData.GetType();
// Build reference disk (in the global coordinate system)
- TopoDS_Shell aDisk = MakeDisk( R, Ratio );
+ TopoDS_Shape aDisk;
+
+ if (Pattern == SQUARE)
+ aDisk = MakeDiskSquare( R, Ratio );
+ else if (Pattern == HEXAGON)
+ aDisk = MakeDiskHexagon( R, Ratio );
if (aType == DIVIDEDDISK_R_RATIO)
{
//=======================================================================
-//function : MakeDisk
+//function : MakeDiskHexagon
//purpose :
//=======================================================================
-TopoDS_Shell GEOMImpl_DividedDiskDriver::MakeDisk(double R, double Ratio) const
+TopoDS_Shell GEOMImpl_DividedDiskDriver::MakeDiskHexagon(double R, double Ratio) const
{
// Geometry
gp_Dir ZDir(0,0,1);
gp_Circ aCircle(Ax, R);
// Points
- gp_Pnt P1(0.01*Ratio*R,0,0);
+// gp_Pnt P4(0.01*Ratio*R,0,0);
+// gp_Pnt P3(R,0,0);
+// gp_Pnt P2 = P3.Rotated(Ax1,-M_PI/6.0);
+// gp_Pnt P1(P4.X(),
+// P4.X()/sqrt(3.0),0);
+ gp_Pnt P1(0.01*Ratio*R*sqrt(3.0)/2,0,0);
gp_Pnt P2(R,0,0);
gp_Pnt P3 = P2.Rotated(Ax1,M_PI/6.0);
gp_Pnt P4(P1.X(),
P1.X()/sqrt(3.0),0);
+
//surfaces
gp_Ax2 anAx (gp::XOY());
return S;
}
+//=======================================================================
+//function : MakeDiskSquare
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_DividedDiskDriver::MakeDiskSquare(double R, double Ratio) const
+{
+ // Geometry
+ gp_Dir ZDir(0,0,1);
+ gp_Dir XDir(1,0,0);
+ gp_Pnt Orig(0,0,0);
+
+ // Circle
+ gp_Ax1 Ax1(Orig,ZDir);
+ gp_Ax2 Ax(Orig,ZDir,XDir);
+ gp_Circ aCircle(Ax, R);
+
+ // Points
+ gp_Pnt P1(0.01*Ratio*R,0,0);
+ gp_Pnt P2(R,0,0);
+
+ //surfaces
+ gp_Ax2 anAx (gp::XOY());
+ Handle(Geom_Plane) aPlane = new Geom_Plane (anAx);
+
+ // Topology
+
+ // Vertices
+ TopoDS_Vertex V1_init = BRepBuilderAPI_MakeVertex(P1);
+ TopoDS_Vertex V2_init = BRepBuilderAPI_MakeVertex(P2);
+
+ TopoDS_Vertex V1 = V1_init;
+ TopoDS_Vertex V2 = V2_init;
+
+ //Rotation
+ gp_Trsf myTrsf;
+ myTrsf.SetRotation(Ax1, M_PI/2);
+
+ BRepBuilderAPI_Transform xform(myTrsf);
+ xform.Perform(V1,Standard_True);
+ TopoDS_Vertex V1_rotated = TopoDS::Vertex(xform.Shape());
+ xform.Perform(V2,Standard_True);
+ TopoDS_Vertex V2_rotated = TopoDS::Vertex(xform.Shape());
+
+ // Declaration of shapes (used in the loop)
+ TopoDS_Edge E1, E2, E3, E4;
+ TopoDS_Wire W1, W2;
+ TopoDS_Face F1, F2;
+ TopoDS_Shell S;
+
+ BRep_Builder aBuilder;
+ aBuilder.MakeWire(W2); // Central Wire
+ aBuilder.MakeShell(S); // Shell
+
+ // Initialisation of edges
+ TopoDS_Edge E1_init = BRepBuilderAPI_MakeEdge(V1,TopoDS::Vertex(V2.Reversed()));
+ E1 = E1_init;
+
+ for (int i=1;i<=4;i++)
+ {
+ // Edges
+ // for Face1
+
+ E3 = BRepBuilderAPI_MakeEdge(V2_rotated,TopoDS::Vertex(V1_rotated.Reversed()));
+ if (i == 4)
+ {
+ E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V2_init.Reversed()));
+ E4 = BRepBuilderAPI_MakeEdge(V1_init,TopoDS::Vertex(V1.Reversed()));
+ }
+ else
+ {
+ E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V2_rotated.Reversed()));
+ E4 = BRepBuilderAPI_MakeEdge(V1_rotated,TopoDS::Vertex(V1.Reversed()));
+ }
+
+ // Wires
+ //Wire1
+ aBuilder.MakeWire(W1);
+ if (i==1)
+ aBuilder.Add(W1,E1);
+ else
+ aBuilder.Add(W1,TopoDS::Edge(E1.Reversed()));
+ aBuilder.Add(W1,E2);
+ if (i==4)
+ aBuilder.Add(W1,TopoDS::Edge(E1_init.Reversed()));
+ else
+ aBuilder.Add(W1,E3);
+ aBuilder.Add(W1,E4);
+
+ // Wire central
+ aBuilder.Add(W2,TopoDS::Edge(E4.Reversed()));
+
+ // Faces creation
+ F1 = BRepBuilderAPI_MakeFace(aPlane,W1);
+
+ //Shell
+ aBuilder.Add(S, F1);
+
+ // rotation
+ V1=V1_rotated;
+ V2=V2_rotated;
+
+ xform.Perform(V1_rotated,Standard_True);
+ V1_rotated = TopoDS::Vertex(xform.Shape());
+ xform.Perform(V2_rotated,Standard_True);
+ V2_rotated = TopoDS::Vertex(xform.Shape());
+
+ // "Increment" of edges
+ E1=E3;
+ }
+ // Central square Face
+ F2 = BRepBuilderAPI_MakeFace(aPlane,W2);
+ aBuilder.Add(S, F2);
+
+ return S;
+}
+
+
//=======================================================================
//function : TrasformShape(TopoDS_Shape aShape,int theOrientation)
//purpose : Perform shape transformation accordingly with specified
TopoDS_Shape TransformShape (TopoDS_Shape aShape, int theOrientation) const;
TopoDS_Shape TransformShape (TopoDS_Shape aShape, gp_Pnt P, gp_Dir V) const;
TopoDS_Shape WPlaneTransform (TopoDS_Shape aShape, gp_Ax3 theWPlane) const;
- TopoDS_Shell MakeDisk (double R, double Ratio) const;
+ TopoDS_Shell MakeDiskHexagon (double R, double Ratio) const;
+ TopoDS_Shape MakeDiskSquare (double R, double Ratio) const;
};
#endif // _GEOMImpl_DividedDiskDriver_HXX
* used to create divided pipes for later meshing in hexaedra.
* \param theR Radius of the disk
* \param theRatio Relative size of the central square diagonal against the disk diameter
+ * \param theOrientation Plane on which the disk will be built
+ * \param thePattern The division pattern of the disk (hexagon or square in the center)
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio, int theOrientation)
+Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio,
+ int theOrientation, int thePattern)
{
SetErrorCode(KO);
aData.SetR(theR);
aData.SetRatio(theRatio);
aData.SetOrientation(theOrientation);
+ aData.SetType(thePattern);
//Compute the resulting value
try {
Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
Handle(GEOM_Object) theVec,
double theR,
- double theRatio)
+ double theRatio,
+ int thePattern)
{
SetErrorCode(KO);
aData.SetR(theR);
aData.SetRatio(theRatio);
+ aData.SetType(thePattern);
//Compute the resulting value
try {
//Add a new object
Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDCYLINDER);
- Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 50.0, 1);
+ Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 50.0, 1, 0);
aBaseShape->GetLastFunction()->SetDescription(""); // Erase dump of MakeDividedDisk
aShape = my3DPrimOperations->MakePrismDXDYDZ(aBaseShape,0.0,0.0,theH, -1.0);
Handle(GEOM_Object) P2 = 0,
Handle(GEOM_Object) P3 = 0);
- Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio, int theOrientation);
+ Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio,
+ int theOrientation, int thePattern);
Standard_EXPORT Handle(GEOM_Object) MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
Handle(GEOM_Object) theVec,
double theR,
- double theRatio);
+ double theRatio,
+ int thePattern);
Standard_EXPORT Handle(GEOM_Object) MakeDividedCylinder (double theR, double theH);
/*@@ insert new functions before this line @@ do not remove this line @@*/
#define DIVIDEDDISK_ARG_CENTER 4
#define DIVIDEDDISK_ARG_VECTOR 5
+#define DIVIDEDDISK_ARG_TYPE 6
+
class GEOMImpl_IDividedDisk
{
public:
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); }
+ int GetOrientation() { return _func->GetInteger(DIVIDEDDISK_ARG_ORIENT); }
+
+ void SetType(int theType) { _func->SetInteger(DIVIDEDDISK_ARG_TYPE, theType); }
+ int GetType() { return _func->GetInteger(DIVIDEDDISK_ARG_TYPE); }
void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(DIVIDEDDISK_ARG_CENTER, theP); }
void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(DIVIDEDDISK_ARG_VECTOR, theV); }
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, CORBA::Short theOrientation)
+GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR,
+ CORBA::Double theRatio,
+ CORBA::Short theOrientation,
+ GEOM::pattern thePattern)
{
GEOM::GEOM_Object_var aGEOMObject;
GetOperations()->SetNotDone();
//Create the DividedDisk
- Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio, theOrientation);
+ Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio, theOrientation, thePattern);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr thePnt,
GEOM::GEOM_Object_ptr theVec,
CORBA::Double theR,
- CORBA::Double theRatio)
+ CORBA::Double theRatio,
+ GEOM::pattern thePattern)
{
GEOM::GEOM_Object_var aGEOMObject;
// Make DividedDisk
Handle(GEOM_Object) anObject =
- GetOperations()->MakeDividedDiskPntVecR(aPnt, aVec, theR, theRatio);
+ GetOperations()->MakeDividedDiskPntVecR(aPnt, aVec, theR, theRatio, thePattern);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR,
CORBA::Double theRatio,
- CORBA::Short theOrientation);
+ CORBA::Short theOrientation,
+ GEOM::pattern thePattern);
GEOM::GEOM_Object_ptr MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr theCenter,
GEOM::GEOM_Object_ptr theVector,
CORBA::Double theR,
- CORBA::Double theRatio);
-
+ CORBA::Double theRatio,
+ GEOM::pattern thePattern);
+
GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH);
/*@@ insert new functions before this line @@ do not remove this line @@*/
//=============================================================================
// MakeDividedDisk
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, CORBA::Short theOrientation)
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio,
+ CORBA::Short theOrientation, GEOM::pattern thePattern)
{
beginService( " GEOM_Superv_i::MakeDividedDisk" );
MESSAGE("GEOM_Superv_i::MakeDividedDisk");
getAdvancedOp();
- GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedDisk(theR, theRatio, theOrientation);
+ GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedDisk(theR, theRatio, theOrientation, thePattern);
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,CORBA::Short theOrientation );
+ GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio,
+ CORBA::Short theOrientation, GEOM::pattern thePattern);
GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH);
/*@@ insert new functions before this line @@ do not remove this line @@*/