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 import StdMeshers
00032
00033
00034
00035 print "Define box"
00036 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
00037 idbox = geompy.addToStudy(box, "box")
00038
00039
00040 print "Add faces to study"
00041 idface = []
00042 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
00043 for f in subShapeList:
00044 name = geompy.SubShapeName(f, box)
00045 print name
00046 idface.append( geompy.addToStudyInFather(box, f, name) )
00047
00048
00049 print "Add edges to study"
00050 idedge = []
00051 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
00052 for f in subShapeList:
00053 name = geompy.SubShapeName(f, box)
00054 print name
00055 idedge.append( geompy.addToStudyInFather(box, f, name) )
00056
00057 salome.sg.updateObjBrowser(1);
00058
00059
00060 smeshgui = salome.ImportComponentGUI("SMESH")
00061 smeshgui.Init(salome.myStudyId)
00062 smesh.SetCurrentStudy(salome.myStudy)
00063
00064
00065
00066 box = salome.IDToObject(idbox)
00067 names = [ "MeshBoxReg", "MeshBoxScale", "MeshBoxTable", "MeshBoxExpr" ]
00068
00069
00070 print "-------------------------- Create ", names[0], " mesh"
00071 mesh = smesh.Mesh(box, names[0])
00072 algo = mesh.Segment()
00073 hyp = algo.NumberOfSegments(7)
00074 hyp.SetDistrType(0)
00075 smesh.SetName(hyp, "NumberOfSegmentsReg")
00076 algo = mesh.Triangle()
00077 algo.MaxElementArea(2500)
00078
00079 print "-------------------------- Create ", names[1], " mesh"
00080 mesh = smesh.Mesh(box, names[1])
00081 algo = mesh.Segment()
00082 hyp = algo.NumberOfSegments(7)
00083 hyp.SetDistrType(1)
00084 hyp.SetScaleFactor(2)
00085 smesh.SetName(hyp, "NumberOfSegmentsScale")
00086 algo = mesh.Triangle()
00087 algo.MaxElementArea(2500)
00088
00089 print "-------------------------- Create ", names[2], " mesh"
00090 mesh = smesh.Mesh(box,names[2])
00091 algo = mesh.Segment()
00092 hyp = algo.NumberOfSegments(7)
00093 hyp.SetDistrType(2)
00094 hyp.SetTableFunction( [0, 0.1, 0.5, 1.0, 1.0, 0.1] )
00095 hyp.SetConversionMode(0)
00096 smesh.SetName(hyp, "NumberOfSegmentsTable")
00097 algo = mesh.Triangle()
00098 algo.MaxElementArea(2500)
00099
00100 print "-------------------------- Create ", names[3], " mesh"
00101 mesh = smesh.Mesh(box, names[3])
00102 algo = mesh.Segment()
00103 hyp = algo.NumberOfSegments(10)
00104 hyp.SetDistrType(3)
00105 hyp.SetExpressionFunction("sin(3*t)")
00106 hyp.SetConversionMode(1)
00107 smesh.SetName(hyp, "NumberOfSegmentsExpr")
00108 algo = mesh.Triangle()
00109 algo.MaxElementArea(2500)
00110
00111
00112 salome.sg.updateObjBrowser(1);
00113