EDF 2281 : Add 2 primitives for hexa mesh

- A disk primitive "pre-divided" into blocks has been added
- Picture, translations and doc to be added soon
- Other constructors to be added too
This commit is contained in:
rnc 2012-07-09 12:19:55 +00:00
parent 1c165e8006
commit d31a3237c7
21 changed files with 198 additions and 2 deletions

View File

@ -6,6 +6,7 @@
<ul>
<li>\subpage create_pipetshape_page</li>
<li>\subpage create_divideddisk_page</li>
<!--@@ insert new functions before this line @@ do not remove this line @@-->
</ul>

View File

@ -80,5 +80,23 @@ gg.createAndDisplayGO(id_pipetshapefillet_position)
\endcode
\anchor tui_creation_divideddisk
<br><h2>Creation of DividedDisk</h2>
\code
import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
# create DividedDisk object
divideddisk = geompy.MakeDividedDisk(100, 50)
# add object in the study
id_divideddisk = geompy.addToStudy(divideddisk,"DividedDisk")
# display divideddisk
gg.createAndDisplayGO(id_divideddisk)
\endcode
<!--@@ insert new functions before this line @@ do not remove this line @@-->
*/

View File

@ -3758,6 +3758,15 @@ module GEOM
in double theR2, in double theW2, in double theL2,
in double theRF, in boolean theHexMesh,
in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3);
/*!
* This function allows to create a disk already divided into blocks. It
* 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
* \return New GEOM_Object, containing the created shape.
*/
GEOM_Object MakeDividedDisk (in double theR, in double theRatio);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};

View File

@ -617,6 +617,8 @@ 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);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
};

View File

@ -5225,6 +5225,33 @@
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>MakeDividedDisk</service-name>
<service-author></service-author>
<service-version></service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<inParameter>
<inParameter-name>theR</inParameter-name>
<inParameter-type>double</inParameter-type>
<inParameter-comment>Radius of the disk</inParameter-comment>
</inParameter>
<inParameter>
<inParameter-name>theRatio</inParameter-name>
<inParameter-type>double</inParameter-type>
<inParameter-comment>Relative size of the central square diagonal against the disk diameter</inParameter-comment>
</inParameter>
</inParameter-list>
<outParameter-list>
<outParameter>
<outParameter-name>return</outParameter-name>
<outParameter-type>GEOM_Object</outParameter-type>
<outParameter-comment>Result object</outParameter-comment>
</outParameter>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<!-- @@ insert new functions before this line @@ do not remove this line @@ -->
</component-service-list>
</component-interface-list>

View File

@ -251,6 +251,7 @@ ADVANCED_RESOURCES += dlg_pipetshapechamferh.png dlg_pipetshapechamferw.png
ADVANCED_RESOURCES += dlg_pipetshapefilletl1.png dlg_pipetshapefilletr1.png dlg_pipetshapefilletw1.png
ADVANCED_RESOURCES += dlg_pipetshapefilletl2.png dlg_pipetshapefilletr2.png dlg_pipetshapefilletw2.png
ADVANCED_RESOURCES += dlg_pipetshapefilletrf.png
#ADVANCED_RESOURCES += divideddisk.png divideddisk_r_ratio.png tree_divideddisk.png
##@@ insert new functions before this line @@ do not remove this line @@##
dist_salomeres_DATA += $(ADVANCED_RESOURCES)

View File

@ -29,6 +29,7 @@
#include <SalomeApp_Application.h>
#include "AdvancedGUI_PipeTShapeDlg.h"
#include "AdvancedGUI_DividedDiskDlg.h"
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
#include <QDialog>
@ -69,6 +70,9 @@ bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
// case GEOMOp::OpPipeTShapeGroups:
// aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent );
// break;
case GEOMOp::OpDividedDisk:
aDlg = new AdvancedGUI_DividedDiskDlg( getGeometryGUI(), parent );
break;
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );

View File

@ -28,6 +28,7 @@ salomeinclude_HEADERS = \
ADVANCED_INCLUDES =
ADVANCED_INCLUDES += AdvancedGUI_PipeTShapeDlg.h
ADVANCED_INCLUDES += AdvancedGUI_DividedDiskDlg.h
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
@ -41,6 +42,7 @@ dist_libAdvancedGUI_la_SOURCES = \
ADVANCED_SOURCES =
ADVANCED_SOURCES += AdvancedGUI_PipeTShapeDlg.h AdvancedGUI_PipeTShapeDlg.cxx
ADVANCED_SOURCES += AdvancedGUI_DividedDiskDlg.h AdvancedGUI_DividedDiskDlg.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
dist_libAdvancedGUI_la_SOURCES += $(ADVANCED_SOURCES)
@ -49,6 +51,7 @@ MOC_FILES =
ADVANCED_MOC_FILES =
ADVANCED_MOC_FILES += AdvancedGUI_PipeTShapeDlg_moc.cxx
ADVANCED_MOC_FILES += AdvancedGUI_DividedDiskDlg_moc.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
MOC_FILES += $(ADVANCED_MOC_FILES)

View File

@ -1276,6 +1276,18 @@
<translation>pipetshapegroups.png</translation>
</message>
-->
<message>
<source>ICON_DLG_DIVIDEDDISK_R_RATIO</source>
<translation>divideddisk_r_ratio.png</translation>
</message>
<message>
<source>ICO_DIVIDEDDISK</source>
<translation>divideddisk.png</translation>
</message>
<message>
<source>ICON_OBJBROWSER_ADVANCED_202</source>
<translation>tree_divideddisk.png</translation>
</message>
<!-- @@ insert new functions before this line @@ do not remove this line @@ -->
</context>
</TS>

View File

@ -567,6 +567,7 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
// case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
case GEOMOp::OpDividedDisk: // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
libName = "AdvancedGUI";
break;
@ -888,6 +889,7 @@ void GeometryGUI::initialize( CAM_Application* app )
"Geometry:Decrease number of isolines");
// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create menus --------------------------
@ -934,9 +936,10 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::OpFilling, genId, -1 );
createMenu( GEOMOp::OpPipe, genId, -1 );
// int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
// createMenu( GEOMOp::OpPipeTShape, advId, -1 );
// createMenu( GEOMOp::OpPipeTShapeGroups, advId, -1 );
createMenu( GEOMOp::OpDividedDisk, advId, -1 );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
createMenu( separator(), newEntId, -1 );
@ -1191,7 +1194,9 @@ void GeometryGUI::initialize( CAM_Application* app )
#ifdef WITH_OPENCV
createTool( GEOMOp::OpFeatureDetect, picturesTbId );
#endif
int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
createTool( GEOMOp::OpDividedDisk, advancedTbId );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create popup menus --------------------------

View File

@ -185,6 +185,7 @@ namespace GEOMOp {
OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base)
OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
// OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
OpDividedDisk = 10003, // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
//@@ insert new functions before this line @@ do not remove this line @@//
};
}

View File

@ -83,6 +83,7 @@
#include <GEOMImpl_MeasureDriver.hxx>
// Advanced operations
#include <GEOMImpl_PipeTShapeDriver.hxx>
#include <GEOMImpl_DividedDiskDriver.hxx>
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
//=============================================================================
@ -166,6 +167,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
// Advanced operations
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedDiskDriver::GetID(), new GEOMImpl_DividedDiskDriver());
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
SetEngine(this);

View File

@ -45,6 +45,8 @@
#include "GEOMImpl_PipeTShapeDriver.hxx"
#include "GEOMImpl_IPipeTShape.hxx"
#include <GEOMImpl_DividedDiskDriver.hxx>
#include <GEOMImpl_IDividedDisk.hxx>
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
#include <TopExp.hxx>
@ -2233,4 +2235,55 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou
return aSeq;
}
//=============================================================================
/*!
* This function allows to create a disk already divided into blocks. It 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
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (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_RATIO);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_DividedDiskDriver::GetID()) return NULL;
GEOMImpl_IDividedDisk aData (aFunction);
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.MakeDividedDisk(" << theR << ", " << theRatio << ")";
SetErrorCode(OK);
return aShape;
}
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/

View File

@ -109,6 +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);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
#endif

View File

@ -329,9 +329,11 @@
// Advanced functions (base = 200)
#define ADVANCED_BASE 200 // NO OPERATION (advanced operations base)
#define GEOM_TSHAPE 201
#define GEOM_DIVIDEDDISK 202
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
// Advanced functions sub-operations codes
#define TSHAPE_BASIC 1
#define TSHAPE_CHAMFER 2
#define TSHAPE_FILLET 3
#define DIVIDEDDISK_R_RATIO 1
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/

View File

@ -144,6 +144,7 @@ salomeinclude_HEADERS = \
ADVANCED_INCLUDES =
ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx
ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
@ -214,6 +215,7 @@ dist_libGEOMimpl_la_SOURCES = \
ADVANCED_SOURCES =
ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx
ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES)

View File

@ -321,4 +321,28 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CO
return aSeq._retn();
}
//=============================================================================
/*!
* This function allows to create a disk already divided into blocks. It 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
* \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_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
//Create the DividedDisk
Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
/*@@ insert new functions before this line @@ do not remove this line @@*/

View File

@ -63,6 +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);
/*@@ insert new functions before this line @@ do not remove this line @@*/
::GEOMImpl_IAdvancedOperations* GetOperations()

View File

@ -3402,6 +3402,19 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeFilletWithPosition
return aSeqPtr->_this();
}
//=============================================================================
// MakeDividedDisk
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio)
{
beginService( " GEOM_Superv_i::MakeDividedDisk" );
MESSAGE("GEOM_Superv_i::MakeDividedDisk");
getAdvancedOp();
GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedDisk(theR, theRatio);
endService( " GEOM_Superv_i::MakeDividedDisk" );
return anObj;
}
/*@@ insert new functions before this line @@ do not remove this line @@*/
//=====================================================================================

View File

@ -706,6 +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);
/*@@ insert new functions before this line @@ do not remove this line @@*/
private:

View File

@ -8548,6 +8548,20 @@ class geompyDC(GEOM._objref_GEOM_Gen):
if Parameters: anObj[0].SetParameters(Parameters)
return anObj
## This function allows to create a disk already divided into blocks. It
# 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
# @return New GEOM_Object, containing the created shape.
#
# @ref tui_creation_divideddisk "Example"
def MakeDividedDisk(self, theR, theRatio):
theR, theRatio, Parameters = ParseParameters(theR, theRatio)
anObj = self.AdvOp.MakeDividedDisk(theR, theRatio)
RaiseIfFailed("MakeDividedDisk", self.AdvOp)
if Parameters: anObj.SetParameters(Parameters)
return anObj
#@@ insert new functions before this line @@ do not remove this line @@#
# end of l4_advanced