diff --git a/doc/salome/gui/GEOM/images/divided_disk.png b/doc/salome/gui/GEOM/images/divided_disk.png
index 8f0bb3ee4..fe0868d9e 100644
Binary files a/doc/salome/gui/GEOM/images/divided_disk.png and b/doc/salome/gui/GEOM/images/divided_disk.png differ
diff --git a/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png b/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png
new file mode 100644
index 000000000..c57f8f6b5
Binary files /dev/null and b/doc/salome/gui/GEOM/images/divided_disk_PntVecR_dlg.png differ
diff --git a/doc/salome/gui/GEOM/images/divided_disk_dlg.png b/doc/salome/gui/GEOM/images/divided_disk_dlg.png
new file mode 100644
index 000000000..3a8b8baad
Binary files /dev/null and b/doc/salome/gui/GEOM/images/divided_disk_dlg.png differ
diff --git a/doc/salome/gui/GEOM/input/creating_divideddisk.doc b/doc/salome/gui/GEOM/input/creating_divideddisk.doc
index 0854039ed..b42460f40 100644
--- a/doc/salome/gui/GEOM/input/creating_divideddisk.doc
+++ b/doc/salome/gui/GEOM/input/creating_divideddisk.doc
@@ -2,29 +2,46 @@
\page create_divideddisk_page DividedDisk
-The Divided disk object is a disk divided into \b blocks. It means that it's a shape ready to be meshed with ruled hexaedra.
-Moreover this shape can be used as a basis in an \ref create_extrusion_alongpath_page "Extrusion along a path operation" in order to obtain any tube shape prepared for hexaedral mesh
+The Divided disk object is a disk divided into \b blocks. It means that it's a shape prepared for hexaedral meshing.
+
+\n Moreover this shape can be used as a basis in an \ref create_extrusion_alongpath_page "Extrusion along a path" operation in order to obtain any tube shape prepared for hexaedral meshing
(see example below).
Example:
\image html divided_disk.png
-To create a \b DividedDisk in the Main Menu select New Entity - >
+To create a Divided Disk in the Main Menu select New Entity - >
Advanced - > DividedDisk
+\n Then there are 2 ways to create a Divided Disk in 3D space.
+\n For both operations :
Specify the parameters of the DividedDisk object creation in the opened dialog
box and press "Apply" or "Apply & Close" button.
Result of each operation will be a GEOM_Object.
-TUI Command: geompy.MakeDividedDisk(R, Orientation)
+\n First way : by radius and orientation (plane "OXY", "OYZ" or "OZX"). The resulting disk is located at the origin of coordinates
+
+TUI Command: geompy.MakeDividedDisk(Radius, Orientation)
Arguments:
-- \b R - Radius of the disk
+- \b Radius - Radius of the disk
- \b Orientation - Plane on wich the disk will be built
\image html divided_disk_dlg.png
+\n Second way : by giving its center, normal and radius.
+
+TUI Command: geompy.MakeDividedDiskPntVecR(Center, Vector,
+Radius)
+
+Arguments:
+- \b Center - Center of the disk
+- \b Vector - Normal to the plane of the disk
+- \b Radius - Radius of the disk
+
+\image html divided_disk_PntVecR_dlg.png
+
Our TUI Scripts provide you with useful examples of creation of
\ref tui_creation_divideddisk "Advanced objects".
diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index 370e035a8..b5bfd5630 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -3763,10 +3763,24 @@ module GEOM
* can be use 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
* \return New GEOM_Object, containing the created shape.
*/
GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation);
+ /*!
+ * \brief Create a Disk prepared for hexa meshing with given center, normal vector and radius.
+ * \param thePnt disk center.
+ * \param theVec Vector, normal to the plane of the disk.
+ * \param theR Disk radius.
+ * \param theRatio Relative size of the central square diagonal against the disk diameter
+ * \return New GEOM_Object, containing the created disk.
+ */
+ GEOM_Object MakeDividedDiskPntVecR ( in GEOM_Object thePnt,
+ in GEOM_Object theVec,
+ in double theR,
+ in double theRatio);
+
/*!
* Builds a cylinder prepared for hexa meshes
* \param theR Radius of the cylinder
diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx
index 8b4fed3b7..5ac411273 100644
--- a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx
+++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx
@@ -45,16 +45,19 @@
AdvancedGUI_DividedDiskDlg::AdvancedGUI_DividedDiskDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
: GEOMBase_Skeleton(theGeometryGUI, parent, false)
{
- QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DIVIDEDDISK_R_RATIO")));
+// QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DIVIDEDDISK_R_RATIO")));
+ QPixmap imageOp1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DISK_R")));
+ QPixmap imageOp2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_DISK_PNT_VEC_R")));
QPixmap imageSel (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle(tr("GEOM_DIVIDEDDISK_TITLE"));
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_DIVIDEDDISK"));
- mainFrame()->RadioButton1->setIcon(imageOp);
- mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
- mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton1->setIcon(imageOp1);
+ mainFrame()->RadioButton2->setIcon(imageOp2);
+// mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+// mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
@@ -67,12 +70,23 @@ AdvancedGUI_DividedDiskDlg::AdvancedGUI_DividedDiskDlg (GeometryGUI* theGeometry
GroupOrientation->RadioButton1->setText(tr("GEOM_WPLANE_OXY"));
GroupOrientation->RadioButton2->setText(tr("GEOM_WPLANE_OYZ"));
GroupOrientation->RadioButton3->setText(tr("GEOM_WPLANE_OZX"));
+
+ GroupPntVecR = new DlgRef_2Sel1Spin(centralWidget());
+ GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupPntVecR->TextLabel1->setText(tr("GEOM_CENTER_POINT"));
+ GroupPntVecR->TextLabel2->setText(tr("GEOM_VECTOR"));
+ GroupPntVecR->TextLabel3->setText(tr("GEOM_RADIUS"));
+ GroupPntVecR->PushButton1->setIcon(imageSel);
+ GroupPntVecR->PushButton2->setIcon(imageSel);
+ GroupPntVecR->LineEdit1->setReadOnly(true);
+ GroupPntVecR->LineEdit2->setReadOnly(true);
//@@ setup dialog box layout here @@//
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupParams);
layout->addWidget(GroupOrientation);
+ layout->addWidget(GroupPntVecR);
/***************************************************************/
setHelpFileName("create_divideddisk_page.html");
@@ -100,7 +114,8 @@ 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);
+ GroupParams ->SpinBox_DX->setValue(100);
+ GroupPntVecR->SpinBox_DX->setValue(100);
GroupOrientation->RadioButton1->setChecked(true);
myOrientation = 1;
@@ -110,17 +125,22 @@ void AdvancedGUI_DividedDiskDlg::Init()
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
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()));
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
+
+ connect(GroupPntVecR->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPntVecR->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(GroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPntVecR->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"));
- resize(minimumSizeHint());
- displayPreview(true);
+ ConstructorsClicked(0);
}
//=================================================================================
@@ -132,6 +152,60 @@ void AdvancedGUI_DividedDiskDlg::SetDoubleSpinBoxStep (double step)
//@@ set double spin box step for all spin boxes here @@//
}
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void AdvancedGUI_DividedDiskDlg::ConstructorsClicked (int constructorId)
+{
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+
+ switch (constructorId) {
+ case 0:
+ {
+ GroupPntVecR->hide();
+ GroupParams->show();
+ GroupOrientation->show();
+
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ globalSelection(); // close local contexts, if any
+ break;
+ }
+ case 1:
+ {
+ GroupParams->hide();
+ GroupOrientation->hide();
+ GroupPntVecR->show();
+
+ GroupPntVecR->PushButton1->click();
+ break;
+ }
+ }
+
+ qApp->processEvents();
+ updateGeometry();
+ resize(minimumSizeHint());
+ SelectionIntoArgument();
+
+ displayPreview(true);
+}
+
+//=================================================================================
+// function : RadioButtonClicked()
+// 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;
+
+ displayPreview(true);
+}
+
//=================================================================================
// function : ClickOnOk()
// purpose :
@@ -156,6 +230,99 @@ bool AdvancedGUI_DividedDiskDlg::ClickOnApply()
return true;
}
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection is changed or on dialog initialization or activation
+//=================================================================================
+void AdvancedGUI_DividedDiskDlg::SelectionIntoArgument()
+{
+ if (getConstructorId() == 0)
+ return;
+
+ erasePreview();
+ myEditCurrentArgument->setText("");
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
+
+ if (aSelList.Extent() != 1) {
+ if (myEditCurrentArgument == GroupPntVecR->LineEdit1) myPoint.nullify();
+ else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir.nullify();
+ return;
+ }
+
+ TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPntVecR->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX;
+ GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+ TopoDS_Shape aShape;
+ if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ){
+ QString aName = GEOMBase::GetName( aSelectedObject.get() );
+
+ myEditCurrentArgument->setText(aName);
+
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ if (myEditCurrentArgument == GroupPntVecR->LineEdit1) {
+ myPoint = aSelectedObject;
+ if (myPoint && !myDir)
+ GroupPntVecR->PushButton2->click();
+ }
+ else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
+ myDir = aSelectedObject;
+ if (myDir && !myPoint)
+ GroupPntVecR->PushButton1->click();
+ }
+ }
+ displayPreview(true);
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void AdvancedGUI_DividedDiskDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == GroupPntVecR->PushButton1) {
+ myEditCurrentArgument = GroupPntVecR->LineEdit1;
+
+ GroupPntVecR->PushButton2->setDown(false);
+ GroupPntVecR->LineEdit2->setEnabled(false);
+ }
+ else if (send == GroupPntVecR->PushButton2) {
+ myEditCurrentArgument = GroupPntVecR->LineEdit2;
+
+ GroupPntVecR->PushButton1->setDown(false);
+ GroupPntVecR->LineEdit1->setEnabled(false);
+ }
+
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ }
+ else {
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ }
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ // enable line edit
+ myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setFocus();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+
+ // seems we need it only to avoid preview disappearing, caused by selection mode change
+ displayPreview(true);
+}
+
//=================================================================================
// function : ActivateThisDialog()
// purpose :
@@ -163,7 +330,10 @@ bool AdvancedGUI_DividedDiskDlg::ClickOnApply()
void AdvancedGUI_DividedDiskDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- displayPreview(true);
+ connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( SelectionIntoArgument() ) );
+
+ ConstructorsClicked( getConstructorId() );
}
//=================================================================================
@@ -176,41 +346,12 @@ 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 :
//=================================================================================
void AdvancedGUI_DividedDiskDlg::ValueChangedInSpinBox()
{
- //@@ connect custom spin boxes or other widget to this slot in the Init() method for automatic preview update @@//
displayPreview(true);
}
@@ -247,20 +388,38 @@ bool AdvancedGUI_DividedDiskDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
+ CORBA::Double theRatio = 50;
+ CORBA::Double theR = 0;
+
+ switch (getConstructorId()) {
+ case 0:
+ theR = GroupParams->SpinBox_DX->value(); // init parameter value from dialog box ;
- //@@ retrieve input values from the widgets here @@//
- CORBA::Double theR = GroupParams->SpinBox_DX->value(); //@@ init parameter value from dialog box @@;
- CORBA::Double theRatio = 50; //@@ init parameter value from dialog box @@;
-
- // call engine function
- anObj = anOper->MakeDividedDisk(theR, theRatio, myOrientation);
- res = !anObj->_is_nil();
- if (res && !IsPreview())
- {
- QStringList aParameters;
- aParameters << GroupParams->SpinBox_DX->text();
- if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ // call engine function
+ anObj = anOper->MakeDividedDisk(theR, theRatio, myOrientation);
+ res = !anObj->_is_nil();
+ if (res && !IsPreview())
+ {
+ QStringList aParameters;
+ aParameters << GroupParams->SpinBox_DX->text();
+ if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ }
+ break;
+ case 1:
+ theR = GroupPntVecR->SpinBox_DX->value();
+
+ // call engine function
+ anObj = anOper->MakeDividedDiskPntVecR(myPoint.get(), myDir.get(), theR, theRatio);
+ res = !anObj->_is_nil();
+ if (res && !IsPreview())
+ {
+ QStringList aParameters;
+ aParameters << GroupPntVecR->SpinBox_DX->text();
+ if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+ }
+ break;
}
+
if (res)
objects.push_back(anObj._retn());
diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h
index 5d3ff0a02..b84b63a03 100644
--- a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h
+++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h
@@ -26,6 +26,7 @@
class DlgRef_1Spin;
class DlgRef_3Radio;
+class DlgRef_2Sel1Spin;
//=================================================================================
// class : AdvancedGUI_DividedDiskDlg
@@ -50,13 +51,18 @@ private:
void enterEvent( QEvent* );
private:
+ GEOM::GeomObjPtr myPoint, myDir;
DlgRef_1Spin* GroupParams;
DlgRef_3Radio* GroupOrientation;
+ DlgRef_2Sel1Spin* GroupPntVecR;
int myOrientation;
private slots:
+ void ConstructorsClicked ( int );
void ClickOnOk();
bool ClickOnApply();
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument();
void ActivateThisDialog();
void ValueChangedInSpinBox();
void RadioButtonClicked();
diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx
index d14c6f6b7..e0cecd969 100644
--- a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx
@@ -50,8 +50,9 @@
#include
#include
-#include
+#include
+#include
//@@ include required header files here @@//
//=======================================================================
@@ -91,17 +92,34 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con
double Ratio = aData.GetRatio();
// Build reference disk (in the global coordinate system)
- TopoDS_Shell S = MakeDisk( R, Ratio );
+ TopoDS_Shell aDisk = MakeDisk( R, Ratio );
- if (aType == DIVIDEDDISK_R_RATIO) {
+ if (aType == DIVIDEDDISK_R_RATIO)
+ {
int theOrientation = aData.GetOrientation();
- aShape = TransformShape(S, theOrientation);
+ aShape = TransformShape(aDisk, theOrientation);
}
- else if (aType == DIVIDEDDISK_R_VECTOR_PNT){
- // other construction modes here
- gp_Pnt P = gp::Origin();
- gp_Dir V = gp::DZ();
- aShape = TransformShape(S, P, V);
+ else if (aType == DIVIDEDDISK_R_VECTOR_PNT)
+ {
+ Handle(GEOM_Function) aRefPoint = aData.GetCenter();
+ Handle(GEOM_Function) aRefVector = aData.GetVector();
+ TopoDS_Shape aShapePnt = aRefPoint->GetValue();
+ TopoDS_Shape aShapeVec = aRefVector->GetValue();
+
+ if (aShapePnt.ShapeType() == TopAbs_VERTEX &&
+ aShapeVec.ShapeType() == TopAbs_EDGE)
+ {
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
+ TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(anE, V1, V2, Standard_True);
+ if (!V1.IsNull() && !V2.IsNull())
+ {
+ gp_Vec aVec (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
+ gp_Dir aDir(aVec);
+ aShape = TransformShape(aDisk, aPnt, aDir);
+ }
+ }
}
if (aShape.IsNull()) return 0;
diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx
index fc39655cf..703112c7c 100644
--- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx
@@ -2290,6 +2290,69 @@ Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR,
return aShape;
}
+//=============================================================================
+/*!
+ * This function allows to create a disk already divided into blocks. It can be
+ * 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
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
+ Handle(GEOM_Object) theVec,
+ double theR,
+ double theRatio)
+{
+ SetErrorCode(KO);
+
+ //Add a new object
+ Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK);
+
+ //Add a new shape function with parameters
+ Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_DividedDiskDriver::GetID(), DIVIDEDDISK_R_VECTOR_PNT);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_DividedDiskDriver::GetID()) return NULL;
+
+ GEOMImpl_IDividedDisk aData (aFunction);
+
+ Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
+ Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
+
+ if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
+
+ aData.SetCenter(aRefPnt);
+ aData.SetVector(aRefVec);
+
+ aData.SetR(theR);
+ aData.SetRatio(theRatio);
+
+ //Compute the resulting value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("DividedDisk driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDiskPntVecR(" << thePnt << ", " << theVec << ", " << theR << ")";
+
+ SetErrorCode(OK);
+
+ return aShape;
+}
+
//=============================================================================
/*!
* Builds a cylinder prepared for hexa meshes
diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx
index a687f35b7..c05575fb2 100644
--- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx
@@ -109,7 +109,13 @@ 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, int theOrientation);
+ Standard_EXPORT Handle(GEOM_Object) MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
+ Handle(GEOM_Object) theVec,
+ double theR,
+ double theRatio);
+
Standard_EXPORT Handle(GEOM_Object) MakeDividedCylinder (double theR, double theH);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
diff --git a/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx b/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx
index 0f6b0205a..2c0a8f9b0 100644
--- a/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx
+++ b/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx
@@ -28,6 +28,9 @@
#define DIVIDEDDISK_ARG_RATIO 2
#define DIVIDEDDISK_ARG_ORIENT 3
+#define DIVIDEDDISK_ARG_CENTER 4
+#define DIVIDEDDISK_ARG_VECTOR 5
+
class GEOMImpl_IDividedDisk
{
public:
@@ -41,6 +44,12 @@ public:
void SetOrientation(int theOrientation) { _func->SetInteger(DIVIDEDDISK_ARG_ORIENT, theOrientation); }
double GetOrientation() { return _func->GetInteger(DIVIDEDDISK_ARG_ORIENT); }
+
+ void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(DIVIDEDDISK_ARG_CENTER, theP); }
+ void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(DIVIDEDDISK_ARG_VECTOR, theV); }
+
+ Handle(GEOM_Function) GetCenter() { return _func->GetReference(DIVIDEDDISK_ARG_CENTER); }
+ Handle(GEOM_Function) GetVector() { return _func->GetReference(DIVIDEDDISK_ARG_VECTOR); }
private:
Handle(GEOM_Function) _func;
diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc
index e007eefc4..900fcf544 100644
--- a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc
+++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc
@@ -345,6 +345,36 @@ GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeDividedDiskPntVecR
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr thePnt,
+ GEOM::GEOM_Object_ptr theVec,
+ CORBA::Double theR,
+ CORBA::Double theRatio)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference points
+ Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+ Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
+
+ if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
+
+ // Make DividedDisk
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeDividedDiskPntVecR(aPnt, aVec, theR, theRatio);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* Builds a cylinder prepared for hexa meshes
diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh
index ec09a18f5..c692bc3cc 100644
--- a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh
+++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh
@@ -63,7 +63,16 @@ 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, CORBA::Short theOrientation);
+
+ GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR,
+ CORBA::Double theRatio,
+ CORBA::Short theOrientation);
+
+ GEOM::GEOM_Object_ptr MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr theCenter,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theR,
+ CORBA::Double theRatio);
+
GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH);
/*@@ insert new functions before this line @@ do not remove this line @@*/
diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py
index 4b23d4eab..d178b45a7 100644
--- a/src/GEOM_SWIG/geompyDC.py
+++ b/src/GEOM_SWIG/geompyDC.py
@@ -8562,6 +8562,21 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("MakeDividedDisk", self.AdvOp)
if Parameters: anObj.SetParameters(Parameters)
return anObj
+
+ ## This function allows creating a disk already divided into blocks. It
+ # can be used to create divided pipes for later meshing in hexaedra.
+ # @param theCenter Center of the disk
+ # @param theVector Normal vector to the plane of the created disk
+ # @param theRadius Radius of the disk
+ # @return New GEOM_Object, containing the created shape.
+ #
+ # @ref tui_creation_divideddisk "Example"
+ def MakeDividedDiskPntVecR(self, theCenter, theVector, theRadius):
+ theRadius, Parameters = ParseParameters(theRadius)
+ anObj = self.AdvOp.MakeDividedDiskPntVecR(theCenter, theVector, theRadius, 50.0)
+ RaiseIfFailed("MakeDividedDiskPntVecR", self.AdvOp)
+ if Parameters: anObj.SetParameters(Parameters)
+ return anObj
## Builds a cylinder prepared for hexa meshes
# @param theR Radius of the cylinder