]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
New example files for 19939
authorsln <sln@opencascade.com>
Mon, 1 Dec 2008 09:47:55 +0000 (09:47 +0000)
committersln <sln@opencascade.com>
Mon, 1 Dec 2008 09:47:55 +0000 (09:47 +0000)
src/SMESH_SWIG/ex30_groupsOp.py [new file with mode: 0755]
src/SMESH_SWIG/ex31_dimGroup.py [new file with mode: 0755]

diff --git a/src/SMESH_SWIG/ex30_groupsOp.py b/src/SMESH_SWIG/ex30_groupsOp.py
new file mode 100755 (executable)
index 0000000..af892e7
--- /dev/null
@@ -0,0 +1,73 @@
+\r
+import sys\r
+import salome\r
+import geompy\r
+import math\r
+import SALOMEDS\r
+import SMESH\r
+import smesh\r
+\r
+salome.salome_init()\r
+aStudyId = salome.myStudy._get_StudyId()\r
+\r
+geompy.init_geom(salome.myStudy)\r
+global Face_1\r
+Face_1 = geompy.MakeFaceHW(100, 100, 1)\r
+geompy.addToStudy( Face_1, "Face_1" )\r
+\r
+#smesh.smesh.SetCurrentStudy(aStudyId)\r
+import StdMeshers\r
+pattern = smesh.GetPattern()\r
+Mesh_1 = smesh.Mesh(Face_1)\r
+Regular_1D = Mesh_1.Segment()\r
+Nb_Segments_1 = Regular_1D.NumberOfSegments(10)\r
+Nb_Segments_1.SetDistrType( 0 )\r
+Quadrangle_2D = Mesh_1.Quadrangle()\r
+isDone = Mesh_1.Compute()\r
+\r
+# groups creation\r
+\r
+aListOfElems = [ 52, 53, 54, 55, 56, 57,\r
+                 62, 63, 64, 65, 66, 67,\r
+                 72, 73, 74, 75, 76, 77,\r
+                 82, 83, 84, 85, 86, 87 ]\r
+                 \r
+aRedGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Red" )\r
+aRedGroup.Add( aListOfElems );\r
+aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) )\r
+\r
+aListOfElems = [ 55, 56, 57, 58, 59,\r
+                 65, 66, 67, 68, 69,\r
+                 75, 76, 77, 78, 79,\r
+                 85, 86, 87, 88, 89,\r
+                 95, 96, 97, 98, 99,\r
+                 105, 106, 107, 108, 109,\r
+                 115, 116, 117, 118, 119,\r
+                 125, 126, 127, 128, 129 ]\r
+                 \r
+aGreenGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Green" )\r
+aGreenGroup.Add( aListOfElems );\r
+aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) )\r
+\r
+aListOfElems = [ 63, 64, 65, 66, 67, 68, \r
+                 73, 74, 75, 76, 77, 78,\r
+                 83, 84, 85, 86, 87, 88, \r
+                 93, 94, 95, 96, 97, 98, \r
+                 103, 104, 105, 106, 107, 108, \r
+                 113, 114, 115, 116, 117, 118 ]\r
+                 \r
+aBlueGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Blue" )\r
+aBlueGroup.Add( aListOfElems );\r
+aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) )\r
+\r
+# UnionListOfGroups()\r
+aUnGrp = Mesh_1.UnionListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "UnionGrp" )\r
+\r
+# IntersectListOfGroups()\r
+aIntGrp=Mesh_1.IntersectListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "IntGrp" )\r
+\r
+# CutListOfGroups()\r
+aCutGrp=Mesh_1.CutListOfGroups([aRedGroup],[aGreenGroup,aBlueGroup],"CutGrp")\r
+\r
+salome.sg.updateObjBrowser( 1 )\r
+\r
diff --git a/src/SMESH_SWIG/ex31_dimGroup.py b/src/SMESH_SWIG/ex31_dimGroup.py
new file mode 100755 (executable)
index 0000000..13cd9cf
--- /dev/null
@@ -0,0 +1,47 @@
+import sys\r
+import salome\r
+import geompy\r
+import math\r
+import SALOMEDS\r
+import SMESH\r
+import smesh\r
+\r
+salome.salome_init()\r
+aStudyId = salome.myStudy._get_StudyId()\r
+\r
+geompy.init_geom(salome.myStudy)\r
+\r
+geompy.init_geom(salome.myStudy)\r
+global Box_1\r
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)\r
+geompy.addToStudy( Box_1, "Box_1" )\r
+\r
+#smesh.smesh.SetCurrentStudy(theStudy)\r
+import StdMeshers\r
+Mesh_1 = smesh.Mesh(Box_1)\r
+Regular_1D = Mesh_1.Segment()\r
+Nb_Segments_1 = Regular_1D.NumberOfSegments(10)\r
+Nb_Segments_1.SetDistrType( 0 )\r
+Quadrangle_2D = Mesh_1.Quadrangle()\r
+Hexa_3D = Mesh_1.Hexahedron()\r
+isDone = Mesh_1.Compute()\r
+\r
+### CreateDimGroup()\r
+\r
+aListOf3d_1=range(721,821)\r
+\r
+aGrp3D_1=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 1" )\r
+aGrp3D_1.Add( aListOf3d_1 )\r
+\r
+aListOf3d_2=range(821, 921)\r
+aGrp3D_2=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 2" )\r
+aGrp3D_2.Add( aListOf3d_2 )\r
+\r
+aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.FACE, "Faces" )\r
+\r
+aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.EDGE, "Edges" )\r
+\r
+aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.NODE, "Nodes" )\r
+\r
+salome.sg.updateObjBrowser( 1 )\r
+\r