3 \page introduction_to_mesh_python_page Introduction to MESH module python interface
5 \n Package smesh provides a standard API for creation and edition of meshes.
6 \n Below you can see an example of usage of the package smesh for 3d mesh generation.
8 <h2>Example of 3d mesh generation with NETGEN:</h2>
10 \n from geompy import *
14 \n <b># an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral</b>.
16 <b># Define values</b>
26 \n box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
28 <b># Build a cylinder</b>
29 \n pt1 = MakeVertex(0, 0, cote/3)
30 \n di1 = MakeVectorDXDYDZ(0, 0, 1)
31 \n cyl = MakeCylinder(pt1, di1, section, size)
33 <b># Build a truncated cone</b>
34 \n pt2 = MakeVertex(0, 0, size)
35 \n cone = MakeCone(pt2, di1, radius_1, radius_2, height)
38 \n box_cyl = MakeFuse(box, cyl)
39 \n piece = MakeFuse(box_cyl, cone)
42 \n addToStudy(piece, name)
44 <b># Create a group of faces</b>
45 \n group = CreateGroup(piece, ShapeType["FACE"])
46 \n group_name = name + "_grp"
47 \n addToStudy(group, group_name)
48 \n group.SetName(group_name)
50 <b># Add faces in the group</b>
51 \n faces = SubShapeAllIDs(piece, ShapeType["FACE"])
52 \n UnionIDs(group, faces)
54 <b># Create a mesh</b>
56 <b># Define a mesh on a geometry</b>
57 \n tetra = smesh.Mesh(piece, name)
59 <b># Define 1D hypothesis</b>
60 \n algo1d = tetra.Segment()
61 \n algo1d.LocalLength(10)
63 <b># Define 2D hypothesis</b>
64 \n algo2d = tetra.Triangle()
65 \n algo2d.LengthFromEdges()
67 <b># Define 3D hypothesis</b>
68 \n algo3d = tetra.Tetrahedron(smesh.NETGEN)
69 \n algo3d.MaxElementVolume(100)
71 <b># Compute the mesh</b>
74 <b># Create a groupe of faces</b>