X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_MeshEditor_i.cxx;h=a908b3d1441408fcb5fa1379a7220ef060fe90d1;hb=08e0a4de43baa17209cefa536be155f1585297a0;hp=8cdfa30f3d9989df100bfc470089174a33062f9e;hpb=e4737e85f0da6d3f90fd08f6be1c2825195fe16f;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 8cdfa30f3..a908b3d14 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -252,7 +252,7 @@ CORBA::Boolean SMESH_MeshEditor_i::Reorient(const SMESH::long_array & IDsOfEleme CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theObject) { SMESH::long_array_var anElementsId = theObject->GetIDs(); - Reorient(anElementsId); + return Reorient(anElementsId); } //============================================================================= @@ -298,7 +298,7 @@ CORBA::Boolean CORBA::Double MaxAngle) { SMESH::long_array_var anElementsId = theObject->GetIDs(); - TriToQuad(anElementsId, Criterion, MaxAngle); + return TriToQuad(anElementsId, Criterion, MaxAngle); } //============================================================================= @@ -365,7 +365,7 @@ CORBA::Boolean CORBA::Boolean Diag13) { SMESH::long_array_var anElementsId = theObject->GetIDs(); - SplitQuad(anElementsId, Diag13); + return SplitQuad(anElementsId, Diag13); } //============================================================================= @@ -533,6 +533,93 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec ExtrusionSweep(anElementsId, theStepVector, theNbOfSteps); } +#define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm; + +static SMESH::SMESH_MeshEditor::Extrusion_Error convExtrError( const::SMESH_MeshEditor::Extrusion_Error e ) +{ + switch ( e ) { + RETCASE( EXTR_OK ); + RETCASE( EXTR_NO_ELEMENTS ); + RETCASE( EXTR_PATH_NOT_EDGE ); + RETCASE( EXTR_BAD_PATH_SHAPE ); + RETCASE( EXTR_BAD_STARTING_NODE ); + RETCASE( EXTR_BAD_ANGLES_NUMBER ); + RETCASE( EXTR_CANT_GET_TANGENT ); + } + return SMESH::SMESH_MeshEditor::EXTR_OK; +} + +//======================================================================= +//function : ExtrusionAlongPath +//purpose : +//======================================================================= + +SMESH::SMESH_MeshEditor::Extrusion_Error + SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements, + SMESH::SMESH_Mesh_ptr thePathMesh, + GEOM::GEOM_Object_ptr thePathShape, + CORBA::Long theNodeStart, + CORBA::Boolean theHasAngles, + const SMESH::double_array & theAngles, + CORBA::Boolean theHasRefPoint, + const SMESH::PointStruct & theRefPoint) +{ + SMESHDS_Mesh* aMesh = GetMeshDS(); + + if ( thePathMesh->_is_nil() || thePathShape->_is_nil() ) + return SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE; + + SMESH_Mesh_i* aMeshImp = dynamic_cast( SMESH_Gen_i::GetServant( thePathMesh ).in() ); + TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape ); + SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape ); + + if ( !aSubMesh ) + return SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE; + + SMDS_MeshNode* nodeStart = (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart); + if ( !nodeStart ) + return SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE; + + set elements; + for (int i = 0; i < theIDsOfElements.length(); i++) + { + CORBA::Long index = theIDsOfElements[i]; + const SMDS_MeshElement * elem = aMesh->FindElement(index); + if ( elem ) + elements.insert( elem ); + } + + list angles; + for (int i = 0; i < theAngles.length(); i++) + { + angles.push_back( theAngles[i] ); + } + + gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z ); + + ::SMESH_MeshEditor anEditor( _myMesh ); + return convExtrError( anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart, theHasAngles, angles, theHasRefPoint, refPnt ) ); +} + +//======================================================================= +//function : ExtrusionAlongPathObject +//purpose : +//======================================================================= + +SMESH::SMESH_MeshEditor::Extrusion_Error + SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject, + SMESH::SMESH_Mesh_ptr thePathMesh, + GEOM::GEOM_Object_ptr thePathShape, + CORBA::Long theNodeStart, + CORBA::Boolean theHasAngles, + const SMESH::double_array & theAngles, + CORBA::Boolean theHasRefPoint, + const SMESH::PointStruct & theRefPoint) +{ + SMESH::long_array_var anElementsId = theObject->GetIDs(); + return ExtrusionAlongPath( anElementsId, thePathMesh, thePathShape, theNodeStart, theHasAngles, theAngles, theHasRefPoint, theRefPoint ); +} + //======================================================================= //function : Mirror //purpose : @@ -681,7 +768,8 @@ void SMESH_MeshEditor_i::FindCoincidentNodes (CORBA::Double Tol { ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes; ::SMESH_MeshEditor anEditor( _myMesh ); - anEditor.FindCoincidentNodes( Tolerance, aListOfListOfNodes ); + set nodes; // no input nodes + anEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes ); GroupsOfNodes = new SMESH::array_of_long_array; GroupsOfNodes->length( aListOfListOfNodes.size() ); @@ -745,7 +833,7 @@ void SMESH_MeshEditor_i::MergeEqualElements() #define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm; -SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Sew_Error e ) +static SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Sew_Error e ) { switch ( e ) { RETCASE( SEW_OK );