]> SALOME platform Git repositories - plugins/gmshplugin.git/blob - tests/basicGroup.py
Salome HOME
148b29e5bd0e4ad7d30cb6d1838c183296624aab
[plugins/gmshplugin.git] / tests / basicGroup.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2018-2019  EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 ###
22 ### This file is generated automatically by SALOME v8.5.0 with dump python functionality
23 ###
24
25 import sys
26 import salome
27
28 salome.salome_init()
29
30 ###
31 ### GEOM component
32 ###
33
34 import GEOM
35 from salome.geom import geomBuilder
36 import math
37 import SALOMEDS
38
39
40 geompy = geomBuilder.New()
41
42 O = geompy.MakeVertex(0, 0, 0)
43 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
44 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
45 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
46 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
47 Cylinder_1 = geompy.MakeCylinderRH(100, 300)
48 Sphere_1 = geompy.MakeSphereR(100)
49 Fuse_1 = geompy.MakeFuseList([Box_1, Cylinder_1, Sphere_1], True, True)
50 Group_1 = geompy.CreateGroup(Fuse_1, geompy.ShapeType["FACE"])
51 geompy.UnionIDs(Group_1, [46, 37])
52 geompy.addToStudy( O, 'O' )
53 geompy.addToStudy( OX, 'OX' )
54 geompy.addToStudy( OY, 'OY' )
55 geompy.addToStudy( OZ, 'OZ' )
56 geompy.addToStudy( Box_1, 'Box_1' )
57 geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
58 geompy.addToStudy( Sphere_1, 'Sphere_1' )
59 geompy.addToStudy( Fuse_1, 'Fuse_1' )
60 geompy.addToStudyInFather( Fuse_1, Group_1, 'Group_1' )
61
62 ###
63 ### SMESH component
64 ###
65
66 import  SMESH, SALOMEDS
67 from salome.smesh import smeshBuilder
68
69 smesh = smeshBuilder.New()
70 Mesh_1 = smesh.Mesh(Fuse_1)
71 GMSH = Mesh_1.Tetrahedron(algo=smeshBuilder.GMSH)
72 Gmsh_Parameters = GMSH.Parameters()
73 Gmsh_Parameters.Set2DAlgo( 0 )
74 Gmsh_Parameters.SetMinSize( 1 )
75 Gmsh_Parameters.SetMaxSize( 20 )
76 Gmsh_Parameters.SetIs2d( 0 )
77 Gmsh_Parameters.SetCompoundOnShape(Group_1)
78 isDone = Mesh_1.Compute()
79
80
81 ## Set names of Mesh objects
82 smesh.SetName(GMSH.GetAlgorithm(), 'GMSH')
83 smesh.SetName(Gmsh_Parameters, 'Gmsh Parameters')
84 smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
85
86
87 if salome.sg.hasDesktop():
88   salome.sg.updateObjBrowser()