6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
14 # Geometry: an assembly of a box, a cylinder and a truncated cone
15 # meshed with tetrahedral
28 box = geompy.MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
31 pt1 = geompy.MakeVertex(0, 0, cote/3)
32 di1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
33 cyl = geompy.MakeCylinder(pt1, di1, section, size)
35 # Build a truncated cone
36 pt2 = geompy.MakeVertex(0, 0, size)
37 cone = geompy.MakeCone(pt2, di1, radius_1, radius_2, height)
40 box_cyl = geompy.MakeFuse(box, cyl)
41 piece = geompy.MakeFuse(box_cyl, cone)
44 geompy.addToStudy(piece, name)
46 # Create a group of faces
47 group = geompy.CreateGroup(piece, geompy.ShapeType["FACE"])
48 group_name = name + "_grp"
49 geompy.addToStudy(group, group_name)
50 group.SetName(group_name)
52 # Add faces to the group
53 faces = geompy.SubShapeAllIDs(piece, geompy.ShapeType["FACE"])
54 geompy.UnionIDs(group, faces)
60 # Define a mesh on a geometry
61 tetra = smesh.Mesh(piece, name)
63 # Define 1D hypothesis
64 algo1d = tetra.Segment()
65 algo1d.LocalLength(10)
67 # Define 2D hypothesis
68 algo2d = tetra.Triangle()
69 algo2d.LengthFromEdges()
71 # Define 3D hypothesis
72 algo3d = tetra.Tetrahedron()
73 algo3d.MaxElementVolume(100)
78 # Create a groupe of faces