From: rnc Date: Mon, 9 Jul 2012 12:19:55 +0000 (+0000) Subject: EDF 2281 : Add 2 primitives for hexa mesh X-Git-Tag: V6_6_0a1~95 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d31a3237c7845182896f0a2b9d276eb89a8e273f;p=modules%2Fgeom.git 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 --- diff --git a/doc/salome/gui/GEOM/input/creating_adv_obj.doc b/doc/salome/gui/GEOM/input/creating_adv_obj.doc index eb11522cf..5c2aca195 100644 --- a/doc/salome/gui/GEOM/input/creating_adv_obj.doc +++ b/doc/salome/gui/GEOM/input/creating_adv_obj.doc @@ -6,6 +6,7 @@ diff --git a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc index 654cdd158..655234d87 100644 --- a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc @@ -80,5 +80,23 @@ gg.createAndDisplayGO(id_pipetshapefillet_position) \endcode +\anchor tui_creation_divideddisk +

Creation of DividedDisk

+ +\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 + */ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 783392170..d61328dea 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -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 @@*/ }; diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 7bc184a7f..e7c538402 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -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 @@*/ }; }; diff --git a/resources/GEOMCatalog.xml.in b/resources/GEOMCatalog.xml.in index db645d25b..28e7dc147 100644 --- a/resources/GEOMCatalog.xml.in +++ b/resources/GEOMCatalog.xml.in @@ -5225,6 +5225,33 @@ + + MakeDividedDisk + + + unknown + 0 + + + theR + double + Radius of the disk + + + theRatio + double + Relative size of the central square diagonal against the disk diameter + + + + + return + GEOM_Object + Result object + + + + diff --git a/resources/Makefile.am b/resources/Makefile.am index 187ca89c6..c3d21181f 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -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) diff --git a/src/AdvancedGUI/AdvancedGUI.cxx b/src/AdvancedGUI/AdvancedGUI.cxx index a092ecc3a..03b3d97bc 100644 --- a/src/AdvancedGUI/AdvancedGUI.cxx +++ b/src/AdvancedGUI/AdvancedGUI.cxx @@ -29,6 +29,7 @@ #include #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 @@ -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 ) ); diff --git a/src/AdvancedGUI/Makefile.am b/src/AdvancedGUI/Makefile.am index 1a1005aeb..f2fa4d4db 100644 --- a/src/AdvancedGUI/Makefile.am +++ b/src/AdvancedGUI/Makefile.am @@ -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) diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 98439825d..da9fb9db0 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -1276,6 +1276,18 @@ pipetshapegroups.png --> + + ICON_DLG_DIVIDEDDISK_R_RATIO + divideddisk_r_ratio.png + + + ICO_DIVIDEDDISK + divideddisk.png + + + ICON_OBJBROWSER_ADVANCED_202 + tree_divideddisk.png + diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index cf1fc0aba..1cc5d4a26 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -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 -------------------------- diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index 807643831..e15c9695a 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -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 @@// }; } diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx index 6fd6cb8dd..982a6faa7 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.cxx +++ b/src/GEOMImpl/GEOMImpl_Gen.cxx @@ -83,6 +83,7 @@ #include // Advanced operations #include +#include /*@@ 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); diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx index 1ede66bc7..4f388aac2 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -45,6 +45,8 @@ #include "GEOMImpl_PipeTShapeDriver.hxx" #include "GEOMImpl_IPipeTShape.hxx" +#include +#include /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ #include @@ -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 @@*/ diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx index 6c0d3f677..627c2bef4 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx @@ -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 diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index a18cd853c..250092f52 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -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 @@*/ diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index 5cb682251..be7f4743a 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -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) diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc index 271c3cecb..4f932f157 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc @@ -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 @@*/ diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh index d0d3308c7..52197095f 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh @@ -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() diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index e29a8faa9..cac250787 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -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 @@*/ //===================================================================================== diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 7594d8077..3f968b961 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -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: diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 25c167e55..88a05c1bc 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -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