X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMImpl%2FGEOMImpl_IAdvancedOperations.cxx;h=b4b9f714fe8b6c3e826c6c3a09b613734e922f4a;hb=8d08a5a0dd0b07df395028307cc3be8c03df04e7;hp=97b56f1c46ddc16e1f56ff26947b51e011e92456;hpb=a878bd540833e8164cec70ce481e9a021cb18e65;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx index 97b56f1c4..b4b9f714f 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -47,6 +47,8 @@ #include "GEOMImpl_IPipeTShape.hxx" #include #include +// #include +// #include /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ #include @@ -2238,7 +2240,7 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou //============================================================================= /*! * This function allows to create a disk already divided into blocks. It can be - * use to create divided pipes for later meshing in hexaedra. + * 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. @@ -2287,4 +2289,99 @@ 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 + * \param theR Radius of the cylinder + * \param theH Height of the cylinder + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedCylinder (double theR, double theH) +{ + SetErrorCode(KO); + + //Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDCYLINDER); + + Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 50.0, 1); + aBaseShape->GetLastFunction()->SetDescription(""); // Erase dump of MakeDividedDisk + + aShape = my3DPrimOperations->MakePrismDXDYDZ(aBaseShape,0.0,0.0,theH, -1.0); + + Handle(GEOM_Function) aFunction = aShape->GetLastFunction(); + aFunction->SetDescription(""); // Erase dump of MakePrismDXDYDZ + aShape->SetType(GEOM_DIVIDEDCYLINDER); + + //Make a Python command + GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedCylinder(" << theR << ", " << theH << ")"; + + SetErrorCode(OK); + + return aShape; +} /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/