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 import salome
00025 import geompy
00026 import smesh
00027
00028
00029
00030
00031 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
00032 idbox = geompy.addToStudy(box, "box")
00033
00034 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
00035 face = subShapeList[0]
00036 name = geompy.SubShapeName(face, box)
00037 idface = geompy.addToStudyInFather(box, face, name)
00038
00039 box = salome.IDToObject(idbox)
00040 face = salome.IDToObject(idface)
00041
00042
00043
00044 smesh.SetCurrentStudy(salome.myStudy)
00045 mesh = smesh.Mesh(box, "Meshbox")
00046
00047
00048 algo1 = mesh.Segment()
00049 algo1.NumberOfSegments(10)
00050
00051
00052 algo2 = mesh.Triangle(smesh.MEFISTO)
00053 algo2.MaxElementArea(10)
00054
00055
00056 algo3 = mesh.Segment(face)
00057 algo3.NumberOfSegments(10)
00058 algo4 = mesh.Triangle(smesh.MEFISTO, face)
00059 algo4.MaxElementArea(100)
00060 submesh = algo4.GetSubMesh()
00061 smesh.SetName(submesh, "SubMeshFace")
00062
00063
00064 mesh.Compute()
00065
00066 faces = submesh.GetElementsByType(smesh.FACE)
00067 if len(faces) > 1:
00068 print len(faces), len(faces)/2
00069 group1 = mesh.CreateEmptyGroup(smesh.FACE,"Group of faces")
00070 group2 = mesh.CreateEmptyGroup(smesh.FACE,"Another group of faces")
00071 group1.Add(faces[:int(len(faces)/2)])
00072 group2.Add(faces[int(len(faces)/2):])
00073
00074 salome.sg.updateObjBrowser(1)