16 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
17 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
19 geom.GetCurrentStudy(salome.myStudy._get_StudyId())
20 smesh.SetCurrentStudy(salome.myStudy)
22 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
23 idbox = geompy.addToStudy(box,"box")
25 subShapeList = geompy.SubShapeAll(box,ShapeTypeFace)
26 face = subShapeList[0]
27 name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
28 idface = geompy.addToStudyInFather(box,face,name)
30 box = salome.IDToObject(idbox)
31 face = salome.IDToObject(idface)
33 hyp1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
34 hyp1.SetNumberOfSegments(10)
35 hyp2 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
36 hyp2.SetMaxElementArea(10)
37 hyp3 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
38 hyp3.SetMaxElementArea(100)
40 algo1 = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
41 algo2 = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
43 mesh = smesh.CreateMesh(box)
44 mesh.AddHypothesis(box,hyp1)
45 mesh.AddHypothesis(box,hyp2)
46 mesh.AddHypothesis(box,algo1)
47 mesh.AddHypothesis(box,algo2)
49 submesh = mesh.GetSubMesh(face, "SubMeshFace")
50 mesh.AddHypothesis(face,hyp1)
51 mesh.AddHypothesis(face,hyp3)
52 mesh.AddHypothesis(face,algo1)
53 mesh.AddHypothesis(face,algo2)
55 smesh.Compute(mesh,box)
57 faces = submesh.GetElementsByType(SMESH.FACE)
59 print len(faces), len(faces)/2
60 group1 = mesh.CreateGroup(SMESH.FACE,"Group of faces")
61 group2 = mesh.CreateGroup(SMESH.FACE,"Another group of faces")
62 group1.Add(faces[:int(len(faces)/2)])
63 group2.Add(faces[int(len(faces)/2):])
65 salome.sg.updateObjBrowser(1)