1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2012-2015 ALNEOS
3 # Copyright (C) 2016-2022 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.alneos.com/ or email : contact@alneos.fr
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 ### This file is generated automatically by SALOME v8.5.0 with dump python functionality
37 from salome.geom import geomBuilder
42 geompy = geomBuilder.New()
44 O = geompy.MakeVertex(0, 0, 0)
45 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
46 OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
47 OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
48 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
49 Cylinder_1 = geompy.MakeCylinderRH(100, 300)
50 Sphere_1 = geompy.MakeSphereR(100)
51 Fuse_1 = geompy.MakeFuseList([Box_1, Cylinder_1, Sphere_1], True, True)
52 Group_1 = geompy.CreateGroup(Fuse_1, geompy.ShapeType["FACE"])
53 geompy.UnionIDs(Group_1, [46, 37])
54 geompy.addToStudy( O, 'O' )
55 geompy.addToStudy( OX, 'OX' )
56 geompy.addToStudy( OY, 'OY' )
57 geompy.addToStudy( OZ, 'OZ' )
58 geompy.addToStudy( Box_1, 'Box_1' )
59 geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
60 geompy.addToStudy( Sphere_1, 'Sphere_1' )
61 geompy.addToStudy( Fuse_1, 'Fuse_1' )
62 geompy.addToStudyInFather( Fuse_1, Group_1, 'Group_1' )
68 import SMESH, SALOMEDS
69 from salome.smesh import smeshBuilder
71 smesh = smeshBuilder.New()
72 Mesh_1 = smesh.Mesh(Fuse_1)
73 GMSH = Mesh_1.Tetrahedron(algo=smeshBuilder.GMSH)
74 Gmsh_Parameters = GMSH.Parameters()
75 Gmsh_Parameters.Set2DAlgo( 0 )
76 Gmsh_Parameters.SetMinSize( 1 )
77 Gmsh_Parameters.SetMaxSize( 20 )
78 Gmsh_Parameters.SetIs2d( 0 )
79 Gmsh_Parameters.SetCompoundOnShape(Group_1)
80 isDone = Mesh_1.Compute()
83 ## Set names of Mesh objects
84 smesh.SetName(GMSH.GetAlgorithm(), 'GMSH')
85 smesh.SetName(Gmsh_Parameters, 'Gmsh Parameters')
86 smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
89 if salome.sg.hasDesktop():
90 salome.sg.updateObjBrowser()