+<p class="whs2"><img src="pics/create_group.png" x-maintain-ratio="TRUE" width="430px" height="391px" border="0" class="img_whs3"></p>\r
+\r
+<h4><a name=bookmark5>Create a Group on Geometry</a></h4>\r
+\r
+<p class="whs1">import salome</p>\r
+\r
+<p class="whs1">import geompy</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">import StdMeshers</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
+ "SMESH")</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+\r
+<p class="whs1">smeshgui.Init(salome.myStudyId);</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># create a box</p>\r
+\r
+<p class="whs1">box = geompy.MakeBox(0., \r
+ 0., 0., 100., 100., 100.)</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># add the box to the study</p>\r
+\r
+<p class="whs1">idbox = geompy.addToStudy(box, \r
+ "box")</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># add the first face of \r
+ the box to the study</p>\r
+\r
+<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
+ geompy.ShapeType["FACE"])</p>\r
+\r
+<p class="whs1">face = subShapeList[0]</p>\r
+\r
+<p class="whs1">name = geompy.SubShapeName(face, \r
+ box)</p>\r
+\r
+<p class="whs1">idface = geompy.addToStudyInFather(box, \r
+ face, name)</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># create a hypothesis</p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ create Hypothesis"</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ NumberOfSegments"</p>\r
+\r
+<p class="whs1">numberOfSegments \r
+ = 7</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", \r
+ "libStdMeshersEngine.so")</p>\r
+\r
+<p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">print hypNbSeg.GetName()</p>\r
+\r
+<p class="whs1">print hypNbSeg.GetId()</p>\r
+\r
+<p class="whs1">print hypNbSeg.GetNumberOfSegments()</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypNbSeg), \r
+ "NumberOfSegments_10")</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ MaxElementArea"</p>\r
+\r
+<p class="whs1">maxElementArea = \r
+ 800</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">hypArea = smesh.CreateHypothesis("MaxElementArea", \r
+ "libStdMeshersEngine.so")</p>\r
+\r
+<p class="whs1">hypArea.SetMaxElementArea(maxElementArea)</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">print hypArea.GetName()</p>\r
+\r
+<p class="whs1">print hypArea.GetId()</p>\r
+\r
+<p class="whs1">print hypArea.GetMaxElementArea()</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypArea), \r
+ "MaxElementArea_500")</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ MaxElementVolume"</p>\r
+\r
+<p class="whs1">maxElementVolume \r
+ = 900</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">hypVolume = smesh.CreateHypothesis("MaxElementVolume", \r
+ "libStdMeshersEngine.so")</p>\r
+\r
+<p class="whs1">hypVolume.SetMaxElementVolume(maxElementVolume)</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs1">print hypVolume.GetName()</p>\r
+\r
+<p class="whs1">print hypVolume.GetId()</p>\r
+\r
+<p class="whs1">print hypVolume.GetMaxElementVolume()</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypVolume), \r
+ "MaxElementVolume_500")</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># create algorithms</p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ create Algorithms"</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ Regular_1D"</p>\r
+\r
+<p class="whs1">regular1D = smesh.CreateHypothesis("Regular_1D", \r
+ "libStdMeshersEngine.so")</p>\r
+\r
+<p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D), \r
+ "Wire Discretisation")</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ Quadrangle_2D"</p>\r
+\r
+<p class="whs1">quad2D = smesh.CreateHypothesis("Quadrangle_2D", \r
+ "libStdMeshersEngine.so")</p>\r
+\r
+<p class="whs1">smeshgui.SetName(salome.ObjectToID(quad2D), \r
+ "Quadrangle_2D")</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># initialize a mesh with \r
+ the box</p>\r
+\r
+<p class="whs1">mesh = smesh.CreateMesh(box)</p>\r
+\r
+<p class="whs1">smeshgui.SetName(salome.ObjectToID(mesh), \r
+ "MeshBox")</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># add a hypothesis to the \r
+ box</p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ add hypothesis to the box"</p>\r
+\r
+<p class="whs1">mesh.AddHypothesis(box,hypNbSeg)</p>\r
+\r
+<p class="whs1">mesh.AddHypothesis(box,hypArea)</p>\r
+\r
+<p class="whs1">mesh.AddHypothesis(box,hypVolume)</p>\r
+\r
+<p class="whs1">mesh.AddHypothesis(box,regular1D)</p>\r
+\r
+<p class="whs1">mesh.AddHypothesis(box,quad2D)</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># compute the mesh</p>\r
+\r
+<p class="whs1">print "-------------------------- \r
+ compute the mesh of the box"</p>\r
+\r
+<p class="whs1">ret = smesh.Compute(mesh,box)</p>\r
+\r
+<p class="whs1">print ret</p>\r
+\r
+<p class="whs1">if ret == 0:</p>\r
+\r
+<p class="whs1"> print \r
+ "probleme when computing the mesh"</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># create geometry groups \r
+ on the plane:</p>\r
+\r
+<p class="whs1">aGeomGroup1 = geompy.CreateGroup(face \r
+ , geompy.ShapeType["FACE"])</p>\r
+\r
+<p class="whs1">geompy.AddObject(aGeomGroup1, \r
+ 1)</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">aGeomGroup2 = geompy.CreateGroup(face \r
+ , geompy.ShapeType["EDGE"])</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">geompy.AddObject(aGeomGroup2, \r
+ 3)</p>\r
+\r
+<p class="whs1">geompy.AddObject(aGeomGroup2, \r
+ 6)</p>\r
+\r
+<p class="whs1">geompy.AddObject(aGeomGroup2, \r
+ 8)</p>\r
+\r
+<p class="whs1">geompy.AddObject(aGeomGroup2, \r
+ 10)</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">geompy.addToStudy(aGeomGroup1, \r
+ "Group on Faces")</p>\r
+\r
+<p class="whs1">geompy.addToStudy(aGeomGroup2, \r
+ "Group on Edges")</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs1">aSmeshGroup1 = mesh.CreateGroupFromGEOM(SMESH.FACE, \r
+ "SMESHGroup1", aGeomGroup1)</p>\r
+\r
+<p class="whs1">aSmeshGroup2 = mesh.CreateGroupFromGEOM(SMESH.EDGE, \r
+ "SMESHGroup2", aGeomGroup2)</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+ </p>\r
+\r
+<p class="whs2"> </p>\r
+\r