X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Pattern_i.cxx;h=f48a6fab3f95fa78617096fa8551a08a9a475f2b;hb=d0f366c4a3a66a71b0be94f7a6e2d146f80a94c4;hp=fa664b4a83208e2f6e8bfd6f6468255b7dd44dec;hpb=090aff07266d376ae028ae43434bdea7c0a0f9bb;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_Pattern_i.cxx b/src/SMESH_I/SMESH_Pattern_i.cxx index fa664b4a8..f48a6fab3 100644 --- a/src/SMESH_I/SMESH_Pattern_i.cxx +++ b/src/SMESH_I/SMESH_Pattern_i.cxx @@ -32,6 +32,7 @@ #include "SMESH_Gen_i.hxx" #include "SMESH_Mesh.hxx" #include "SMESH_Mesh_i.hxx" +#include "SMESH_PythonDump.hxx" #include "SMDS_MeshFace.hxx" #include "SMDS_MeshVolume.hxx" @@ -42,10 +43,21 @@ #include #include -// ============================================================================= +using SMESH::TPythonDump; + +//======================================================================= +//function : dumpErrorCode +//purpose : +//======================================================================= + +static void addErrorCode(const char* thePyCommand) +{ + TPythonDump() << "if (isDone != 1):"; + TPythonDump() << "\tprint '" << thePyCommand << " :', pattern.GetErrorCode()"; +} + //============================================================================= /*! -// ============================================================================= * SMESH_Gen_i::GetPattern * * Create pattern mapper @@ -54,6 +66,9 @@ SMESH::SMESH_Pattern_ptr SMESH_Gen_i::GetPattern() { + // Update Python script + TPythonDump() << "pattern = " << this << ".GetPattern()"; + SMESH_Pattern_i* i = new SMESH_Pattern_i( this ); SMESH::SMESH_Pattern_var anObj = i->_this(); return anObj._retn(); @@ -91,6 +106,10 @@ SMESH_Pattern_i::SMESH_Pattern_i( SMESH_Gen_i* theGen_i ): CORBA::Boolean SMESH_Pattern_i::LoadFromFile(const char* theFileContents) { + // Update Python script + TPythonDump() << "isDone = pattern.LoadFromFile(" << theFileContents << ")"; + addErrorCode( "LoadFromFile" ); + return myPattern.Load( theFileContents ); } @@ -110,11 +129,16 @@ CORBA::Boolean SMESH_Pattern_i::LoadFromFace(SMESH::SMESH_Mesh_ptr theMesh, if ( !aMesh ) return false; - TopoDS_Face aFace = TopoDS::Face( myGen->GeomObjectToShape( theFace )); - if ( aFace.IsNull() ) + TopoDS_Shape aFace = myGen->GeomObjectToShape( theFace ); + if ( aFace.IsNull() || aFace.ShapeType() != TopAbs_FACE ) return false; - return myPattern.Load( aMesh, aFace, theProject ); + // Update Python script + TPythonDump() << "isDone = pattern.LoadFromFace( " << theMesh << ", " + << theFace << ", " << theProject << " )"; + addErrorCode( "LoadFromFace" ); + + return myPattern.Load( aMesh, TopoDS::Face( aFace ), theProject ); } //======================================================================= @@ -140,6 +164,10 @@ CORBA::Boolean SMESH_Pattern_i::LoadFrom3DBlock(SMESH::SMESH_Mesh_ptr theMesh, if ( !exp.More() ) return false; + // Update Python script + TPythonDump() << "isDone = pattern.LoadFrom3DBlock( " << theMesh << ", " << theBlock << " )"; + addErrorCode( "LoadFrom3DBlock" ); + return myPattern.Load( aMesh, TopoDS::Shell( exp.Current() )); } @@ -172,6 +200,10 @@ SMESH::point_array* SMESH_Pattern_i::ApplyToFace(GEOM::GEOM_Object_ptr theFace, } } + // Update Python script + TPythonDump() << "pattern.ApplyToFace( " << theFace << ", " + << theVertexOnKeyPoint1 << ", " << theReverse << " )"; + return points._retn(); } @@ -208,6 +240,10 @@ SMESH::point_array* SMESH_Pattern_i::ApplyTo3DBlock(GEOM::GEOM_Object_ptr theBlo } } + // Update Python script + TPythonDump() << "pattern.ApplyTo3DBlock( " << theBlock << ", " + << theVertex000 << ", " << theVertex001 << " )"; + return points._retn(); } @@ -248,6 +284,11 @@ SMESH::point_array* } } + // Update Python script + TPythonDump() << "pattern.ApplyToMeshFaces( " << theMesh << ", " + << theFacesIDs << ", " + << theNodeIndexOnKeyPoint1 << ", " << theReverse << " )"; + return points._retn(); } @@ -288,6 +329,11 @@ SMESH::point_array* } } + // Update Python script + TPythonDump() << "pattern.ApplyToHexahedrons( " << theMesh << ", " + << theVolumesIDs << ", " + << theNode000Index << ", " << theNode001Index << " )"; + return points._retn(); } @@ -296,13 +342,20 @@ SMESH::point_array* //purpose : //======================================================================= -CORBA::Boolean SMESH_Pattern_i::MakeMesh(SMESH::SMESH_Mesh_ptr theMesh) +CORBA::Boolean SMESH_Pattern_i::MakeMesh (SMESH::SMESH_Mesh_ptr theMesh, + const CORBA::Boolean CreatePolygons, + const CORBA::Boolean CreatePolyedrs) { ::SMESH_Mesh* aMesh = getMesh( theMesh ); if ( !aMesh ) return false; - return myPattern.MakeMesh( aMesh ); + // Update Python script + TPythonDump() << "isDone = pattern.MakeMesh( " << theMesh << ", " + << CreatePolygons << ", " << CreatePolyedrs << " )"; + addErrorCode( "MakeMesh" ); + + return myPattern.MakeMesh( aMesh, CreatePolygons, CreatePolyedrs ); } //======================================================================= @@ -374,11 +427,11 @@ SMESH::long_array* SMESH_Pattern_i::GetKeyPoints() //purpose : //======================================================================= -SMESH::array_of_long_array* SMESH_Pattern_i::GetElementPoints() +SMESH::array_of_long_array* SMESH_Pattern_i::GetElementPoints(CORBA::Boolean applied) { SMESH::array_of_long_array_var arrayOfArray = new SMESH::array_of_long_array; - const list< list< int > >& listOfIdList = myPattern.GetElementPointIDs(); + const list< list< int > >& listOfIdList = myPattern.GetElementPointIDs(applied); arrayOfArray->length( listOfIdList.size() ); list< list< int > >::const_iterator llIt = listOfIdList.begin(); for ( int i = 0 ; llIt != listOfIdList.end(); llIt++, i++ )