Add a function to know kind of mesh element

+    EntityType GetElementGeomType( in long id )
This commit is contained in:
eap 2010-03-04 08:08:21 +00:00
parent c0c6cee1a5
commit a59cbfc28e
4 changed files with 36 additions and 0 deletions

View File

@ -666,6 +666,9 @@ module SMESH
ElementType GetElementType( in long id, in boolean iselem ) ElementType GetElementType( in long id, in boolean iselem )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
EntityType GetElementGeomType( in long id )
raises (SALOME::SALOME_Exception);
long_array GetSubMeshElementsId(in long ShapeID) long_array GetSubMeshElementsId(in long ShapeID)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);

View File

@ -2755,6 +2755,21 @@ SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const boo
return ( SMESH::ElementType )_impl->GetElementType( id, iselem ); return ( SMESH::ElementType )_impl->GetElementType( id, iselem );
} }
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id )
throw (SALOME::SALOME_Exception)
{
const SMDS_MeshElement* e = _impl->GetMeshDS()->FindElement(id);
if ( !e )
THROW_SALOME_CORBA_EXCEPTION( "invalid element id", SALOME::BAD_PARAM );
return ( SMESH::EntityType ) e->GetEntityType();
}
//============================================================================= //=============================================================================
/*! /*!

View File

@ -307,6 +307,9 @@ public:
SMESH::ElementType GetElementType( CORBA::Long id, bool iselem ) SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SMESH::EntityType GetElementGeomType( CORBA::Long id )
throw (SALOME::SALOME_Exception);
/*! /*!
* Returns ID of elements for given submesh * Returns ID of elements for given submesh
*/ */

View File

@ -197,6 +197,10 @@ DefaultSize, DefaultGeom, Custom = 0,0,1
PrecisionConfusion = 1e-07 PrecisionConfusion = 1e-07
# TopAbs_State enumeration
[TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = range(4)
## Converts an angle from degrees to radians ## Converts an angle from degrees to radians
def DegreesToRadians(AngleInDegrees): def DegreesToRadians(AngleInDegrees):
from math import pi from math import pi
@ -1920,6 +1924,12 @@ class Mesh:
def GetElementType(self, id, iselem): def GetElementType(self, id, iselem):
return self.mesh.GetElementType(id, iselem) return self.mesh.GetElementType(id, iselem)
## Returns the geometric type of mesh element
# @return the value from SMESH::EntityType enumeration
# @ingroup l1_meshinfo
def GetElementGeomType(self, id):
return self.mesh.GetElementGeomType(id)
## Returns the list of submesh elements IDs ## Returns the list of submesh elements IDs
# @param Shape a geom object(subshape) IOR # @param Shape a geom object(subshape) IOR
# Shape must be the subshape of a ShapeToMesh() # Shape must be the subshape of a ShapeToMesh()
@ -2285,6 +2295,11 @@ class Mesh:
def FindElementsByPoint(self, x, y, z, elementType = SMESH.ALL): def FindElementsByPoint(self, x, y, z, elementType = SMESH.ALL):
return self.editor.FindElementsByPoint(x, y, z, elementType) return self.editor.FindElementsByPoint(x, y, z, elementType)
# Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
# TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
def GetPointState(self, x, y, z):
return self.editor.GetPointState(x, y, z)
## Finds the node closest to a point and moves it to a point location ## Finds the node closest to a point and moves it to a point location
# @param x the X coordinate of a point # @param x the X coordinate of a point