Back to index

salome-gui  6.5.0
Functions | Variables
tubebuilder Namespace Reference

Functions

def createGeometry
def createGeometryWithPartition
def createMesh
def createModel
def exportModel
def TEST_createGeometry
def TEST_createMesh
def TEST_createModel
def TEST_exportModel

Variables

int DEFAULT_RADIUS = 100
int DEFAULT_LENGTH = 300
int DEFAULT_WIDTH = 20

Function Documentation

def tubebuilder.createGeometry (   study,
  radius = DEFAULT_RADIUS,
  length = DEFAULT_LENGTH,
  width = DEFAULT_WIDTH 
)
This function creates the geometry on the specified study and with
given parameters.

Definition at line 30 of file tubebuilder.py.

00030 
00031 def createGeometry(study, radius=DEFAULT_RADIUS, length=DEFAULT_LENGTH, width=DEFAULT_WIDTH):
00032     '''
00033     This function creates the geometry on the specified study and with
00034     given parameters.
00035     '''
00036     print "TUBE: creating the geometry ..."
00037     studyId = study._get_StudyId()
00038     geompy = geomtools.getGeompy(studyId)
00039 
00040     radius_ext = radius
00041     radius_int = radius_ext - width
00042 
00043     CylinderExt = geompy.MakeCylinderRH(radius_ext, length)
00044     CylinderInt = geompy.MakeCylinderRH(radius_int, length)
00045     Tube = geompy.MakeCut(CylinderExt, CylinderInt)
00046     return Tube
    

Here is the caller graph for this function:

def tubebuilder.createGeometryWithPartition (   study,
  radius = DEFAULT_RADIUS,
  length = DEFAULT_LENGTH,
  width = DEFAULT_WIDTH 
)
This function create the geometrical shape with a partition so
that the hexaedric algorithm could be used for meshing.

Definition at line 47 of file tubebuilder.py.

00047 
00048 def createGeometryWithPartition(study, radius=DEFAULT_RADIUS, length=DEFAULT_LENGTH, width=DEFAULT_WIDTH):
00049     '''
00050     This function create the geometrical shape with a partition so
00051     that the hexaedric algorithm could be used for meshing.
00052     '''
00053     shape = createGeometry(study,radius,length,width)
00054 
00055     # We have to create a partition so that we can use an hexaedric
00056     # meshing algorithm.
00057     studyId = study._get_StudyId()
00058     geompy = geomtools.getGeompy(studyId)
00059 
00060     print "TUBE: creating a partition ..."
00061     toolPlane = geompy.MakeFaceHW(2.1*length,2.1*radius,3)
00062     partition = geompy.MakePartition([shape], [toolPlane], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
00063     entry = geompy.addToStudy( partition, "TubeWithPartition" )
00064     return partition
    

Here is the call graph for this function:

Here is the caller graph for this function:

def tubebuilder.createMesh (   study,
  shape 
)
This function creates the mesh of the specified shape on the specified study

Definition at line 65 of file tubebuilder.py.

00065 
00066 def createMesh(study, shape):
00067     '''This function creates the mesh of the specified shape on the specified study'''
00068     print "TUBE: creating the mesh ..."
00069     import smesh
00070 
00071     smesh.SetCurrentStudy(study)
00072     mesh = smesh.Mesh(shape)
00073     Regular_1D = mesh.Segment()
00074     Nb_Segments = Regular_1D.NumberOfSegments(10)
00075     Nb_Segments.SetDistrType( 0 )
00076     Quadrangle_2D = mesh.Quadrangle()
00077     Hexa_3D = mesh.Hexahedron()
00078 
00079     isDone = mesh.Compute()
00080 
00081     if salome.sg.hasDesktop():
00082         smesh.SetName(mesh.GetMesh(), 'TubeMesh')
00083         smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
00084         smesh.SetName(Nb_Segments, 'Nb. Segments_1')
00085         smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
00086         smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
00087         salome.sg.updateObjBrowser(0)
00088 
00089     return mesh
00090 

Here is the caller graph for this function:

def tubebuilder.createModel (   study,
  radius = DEFAULT_RADIUS,
  length = DEFAULT_LENGTH,
  width = DEFAULT_WIDTH 
)
This function create the geomtrical shape AND the associated mesh.

Definition at line 91 of file tubebuilder.py.

00091 
00092 def createModel(study, radius=DEFAULT_RADIUS, length=DEFAULT_LENGTH,width=DEFAULT_WIDTH):
00093     '''
00094     This function create the geomtrical shape AND the associated mesh.
00095     '''
00096     # We first create a shape with a partition so that the hexaedric
00097     # algorithm could be used.
00098     shape = createGeometryWithPartition(study,radius,length,width)
00099 
00100     # Then the mesh can be defined and computed
00101     mesh = createMesh(study,shape)
    

Here is the call graph for this function:

Here is the caller graph for this function:

def tubebuilder.exportModel (   mesh,
  filename 
)
This exports the mesh to the specified filename in the med format

Definition at line 102 of file tubebuilder.py.

00102 
00103 def exportModel(mesh, filename):
00104     '''
00105     This exports the mesh to the specified filename in the med format
00106     '''
00107     print "TUBE: exporting mesh to file %s ..."%filename
00108     import SMESH
00109     mesh.ExportMED(filename, 0, SMESH.MED_V2_2, 1 )
00110 
00111 
00112 #
00113 # ===================================================================
00114 # Use cases and test functions
00115 # ===================================================================
#

Here is the caller graph for this function:

Definition at line 116 of file tubebuilder.py.

00116 
00117 def TEST_createGeometry():
00118     salome.salome_init()
00119     theStudy=salome.myStudy
00120     createGeometry(theStudy)

Here is the call graph for this function:

Definition at line 121 of file tubebuilder.py.

00121 
00122 def TEST_createMesh():
00123     salome.salome_init()
00124     theStudy=salome.myStudy
00125     shape = createGeometryWithPartition(theStudy)
00126     mesh  = createMesh(theStudy, shape)

Here is the call graph for this function:

Definition at line 127 of file tubebuilder.py.

00127 
00128 def TEST_createModel():
00129     salome.salome_init()
00130     theStudy=salome.myStudy
00131     createModel(theStudy)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 132 of file tubebuilder.py.

00132 
00133 def TEST_exportModel():
00134     salome.salome_init()
00135     theStudy=salome.myStudy
00136     shape = createGeometryWithPartition(theStudy)
00137     mesh  = createMesh(theStudy, shape)
00138     exportModel(mesh,"tubemesh.med")
    

Here is the call graph for this function:


Variable Documentation

Definition at line 25 of file tubebuilder.py.

Definition at line 24 of file tubebuilder.py.

Definition at line 26 of file tubebuilder.py.