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
00028 import salome
00029 import geompy
00030 import smesh
00031
00032
00033
00034 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
00035 idb = geompy.addToStudy(box, "box")
00036
00037
00038
00039 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
00040 face = subShapeList[0]
00041 name = geompy.SubShapeName(face, box)
00042 idf = geompy.addToStudyInFather(box, face, name)
00043
00044
00045
00046 subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
00047 shell = subShellList[0]
00048 name = geompy.SubShapeName(shell, box)
00049 ids = geompy.addToStudyInFather(box, shell, name)
00050
00051
00052
00053 edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
00054 edge = edgeList[0];
00055 name = geompy.SubShapeName(edge, face)
00056 ide = geompy.addToStudyInFather(face, edge, name)
00057
00058
00059
00060 smesh.SetCurrentStudy(salome.myStudy)
00061 box = salome.IDToObject(idb)
00062 mesh = smesh.Mesh(box, "Meshbox")
00063
00064 print "-------------------------- add hypothesis to box"
00065
00066 algo_1 = mesh.Segment(box)
00067 hyp = algo_1.LocalLength(100)
00068 print hyp.GetName()
00069 print hyp.GetId()
00070 print hyp.GetLength()
00071
00072 algo_2 = mesh.Triangle(smesh.MEFISTO, box)
00073 hyp = algo_2.MaxElementArea(5000)
00074 print hyp.GetName()
00075 print hyp.GetId()
00076 print hyp.GetMaxElementArea()
00077
00078 smesh.SetName(algo_2.GetSubMesh(), "SubMeshBox")
00079
00080
00081 print "-------------------------- add hypothesis to edge"
00082
00083 edge = salome.IDToObject(ide)
00084
00085 algo_3 = mesh.Segment(edge)
00086 hyp = algo_3.LocalLength(100)
00087 print hyp.GetName()
00088 print hyp.GetId()
00089 print hyp.GetLength()
00090
00091 smesh.SetName(algo_3.GetSubMesh(), "SubMeshEdge")
00092
00093
00094 print "-------------------------- compute face"
00095
00096 face = salome.IDToObject(idf)
00097
00098 ret = mesh.Compute(face)
00099 print ret
00100 log = mesh.GetLog(0)
00101 for a in log:
00102 print "-------"
00103 ii = 0
00104 ir = 0
00105 comType = a.commandType
00106 if comType == 0:
00107 for i in range(a.number):
00108 ind = a.indexes[ii]
00109 ii = ii+1
00110 r1 = a.coords[ir]
00111 ir = ir+1
00112 r2 = a.coords[ir]
00113 ir = ir+1
00114 r3 = a.coords[ir]
00115 ir = ir+1
00116 print "AddNode %i - %g %g %g" % (ind, r1, r2, r3)
00117 elif comType == 1:
00118 for i in range(a.number):
00119 ind = a.indexes[ii]
00120 ii = ii+1
00121 i1 = a.indexes[ii]
00122 ii = ii+1
00123 i2 = a.indexes[ii]
00124 ii = ii+1
00125 print "AddEdge %i - %i %i" % (ind, i1, i2)
00126 elif comType == 2:
00127 for i in range(a.number):
00128 ind = a.indexes[ii]
00129 print ind
00130 ii = ii+1
00131 print ii
00132 i1 = a.indexes[ii]
00133 ii = ii+1
00134 i2 = a.indexes[ii]
00135 print i2
00136 ii = ii+1
00137 print "ii", ii
00138 i3 = a.indexes[ii]
00139 print i3
00140
00141 ii = ii+1
00142 print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)