Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 import salome
00028 import geompy
00029 import smesh
00030
00031
00032
00033
00034 box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
00035
00036 idbox1 = geompy.addToStudy(box1, "box1")
00037
00038 print "Analysis of the geometry box1 :"
00039 subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"])
00040 subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
00041 subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"])
00042
00043 print "number of Shells in box1 : ", len(subShellList)
00044 print "number of Faces in box1 : ", len(subFaceList)
00045 print "number of Edges in box1 : ", len(subEdgeList)
00046
00047 box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
00048
00049 idbox2 = geompy.addToStudy(box2, "box2")
00050
00051 print "Analysis of the geometry box2 :"
00052 subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"])
00053 subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
00054 subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
00055
00056 print "number of Shells in box2 : ", len(subShellList)
00057 print "number of Faces in box2 : ", len(subFaceList)
00058 print "number of Edges in box2 : ", len(subEdgeList)
00059
00060
00061
00062
00063 shell = geompy.MakePartition([box1, box2])
00064 idshell = geompy.addToStudy(shell, "shell")
00065
00066 print "Analysis of the geometry shell (union of box1 and box2) :"
00067 subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"])
00068 subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"])
00069 subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"])
00070
00071 print "number of Shells in shell : ", len(subShellList)
00072 print "number of Faces in shell : ", len(subFaceList)
00073 print "number of Edges in shell : ", len(subEdgeList)
00074
00075
00076
00077 smesh.SetCurrentStudy(salome.myStudy)
00078
00079
00080
00081 mesh = smesh.Mesh(shell, "MeshBox2")
00082
00083
00084
00085
00086 print "-------------------------- NumberOfSegments"
00087
00088 numberOfSegments = 10
00089
00090 regular1D = mesh.Segment()
00091 hypNbSeg = regular1D.NumberOfSegments(numberOfSegments)
00092 print hypNbSeg.GetName()
00093 print hypNbSeg.GetId()
00094 print hypNbSeg.GetNumberOfSegments()
00095 smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments))
00096
00097 print "-------------------------- MaxElementArea"
00098
00099 maxElementArea = 500
00100
00101 mefisto2D = mesh.Triangle()
00102 hypArea = mefisto2D.MaxElementArea(maxElementArea)
00103 print hypArea.GetName()
00104 print hypArea.GetId()
00105 print hypArea.GetMaxElementArea()
00106 smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
00107
00108 print "-------------------------- MaxElementVolume"
00109
00110 maxElementVolume = 500
00111
00112 netgen3D = mesh.Tetrahedron(smesh.NETGEN)
00113 hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
00114 print hypVolume.GetName()
00115 print hypVolume.GetId()
00116 print hypVolume.GetMaxElementVolume()
00117 smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume))
00118
00119
00120 salome.sg.updateObjBrowser(1)
00121
00122 print "-------------------------- compute shell"
00123 ret = mesh.Compute()
00124 print ret
00125 if ret != 0:
00126 log = mesh.GetLog(0)
00127 for linelog in log:
00128 print linelog
00129 print "Information about the MeshBox2:"
00130 print "Number of nodes : ", mesh.NbNodes()
00131 print "Number of edges : ", mesh.NbEdges()
00132 print "Number of faces : ", mesh.NbFaces()
00133 print "Number of triangles : ", mesh.NbTriangles()
00134 print "Number of volumes : ", mesh.NbVolumes()
00135 print "Number of tetrahedrons: ", mesh.NbTetras()
00136 else:
00137 print "probleme when computing the mesh"