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