X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMImpl%2FGEOMImpl_ILocalOperations.cxx;h=a00e4d8f66d48f76bfd8e505907310aaa9c27f71;hb=25b91b8d9df5a001f75eb1355412124cb85d8d87;hp=9e552229a7d34601bab584af1dbd96c1bd0c41f1;hpb=392885c1a8d50369708bbe5e6b44033ed8b8ba51;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx index 9e552229a..a00e4d8f6 100644 --- a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include #include @@ -29,10 +30,12 @@ #include #include +#include #include #include #include +#include #include #include @@ -481,6 +484,75 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFillet2D return aFillet2D; } +//============================================================================= +/*! + * MakeFillet1D + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFillet1D + (Handle(GEOM_Object) theShape, double theR, std::list theVertexes) +{ + SetErrorCode(KO); + + //Add a new Fillet object + Handle(GEOM_Object) aFillet1D = GetEngine()->AddObject(GetDocID(), GEOM_FILLET_1D); + + //Add a new Fillet function + Handle(GEOM_Function) aFunction = + aFillet1D->AddFunction(GEOMImpl_Fillet1dDriver::GetID(), FILLET_1D_SHAPE_VERTEXES); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_Fillet1dDriver::GetID()) return NULL; + + GEOMImpl_IFillet1d aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetR(theR); + int aLen = theVertexes.size(); + aCI.SetLength(aLen); + + int ind = 1; + std::list::iterator it = theVertexes.begin(); + for (; it != theVertexes.end(); it++, ind++) { + aCI.SetVertex(ind, (*it)); + } + + //Compute the Fillet value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("1D Fillet 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 pd (aFunction); + pd << aFillet1D << " = geompy.MakeFillet1D(" << theShape + << ", " << theR << ", ["; + + it = theVertexes.begin(); + pd << (*it++); + while (it != theVertexes.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aFillet1D; +} + //============================================================================= /*! * MakeChamferAll @@ -811,7 +883,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdges //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) - { MESSAGE ( "Chamfer Driver is NULL!!!" ); return NULL; } + { MESSAGE ( "Chamfer Driver is NULL!!!" ); return NULL; } GEOMImpl_IChamfer aCI (aFunction); @@ -883,7 +955,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdgesAD //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) - { MESSAGE("Chamfer Driver is NULL!!!"); return NULL;} + { MESSAGE("Chamfer Driver is NULL!!!"); return NULL;} GEOMImpl_IChamfer aCI (aFunction);