3 \page smeshpy_interface_page Python interface
5 \n Python package smesh defines several classes, destined for easy and
6 clear mesh creation and edition.
8 \n Documentation for smesh package is available in two forms:
10 \n The <a href="smeshpy_doc/modules.html"> structured
11 documentation for smesh package</a>, where all methods and
12 classes are grouped by their functionality, like it is done in the GUI documentation
13 \n and the \ref smeshDC "linear documentation for smesh package"
14 grouped only by classes, declared in the smesh.py file.
16 \n The main page of the \ref smeshDC "linear documentation for smesh package"
17 contains a list of data structures and a list of
18 functions, provided by the package smesh.py. The first item in
19 the list of data structures (\ref smeshDC::smeshDC "class smesh")
20 also represents documentation for the methods of the package smesh.py itself.
22 \n The package smesh.py provides an interface to create and handle
23 meshes. Use it to create an empty mesh or to import it from the data file.
25 \n Once a mesh has been created, it is possible to manage it via its own
26 methods, described at \ref smeshDC::Mesh "class Mesh" documentation
27 (it is also accessible by the second item "class Mesh" in the list of data structures).
29 \n Class Mesh allows assigning algorithms to a mesh.
30 \n Please note, that some algorithms,
31 included in the standard Salome installation are always available:
32 - REGULAR(1D), COMPOSITE(1D), MEFISTO(2D), Quadrangle(2D), Hexa(3D), etc.
34 \n There are also some algorithms, which can be installed optionally,
35 \n some of them are based on open-source meshers:
36 - NETGEN(1D-2D,2D,1D-2D-3D,3D),
38 \n others are based on commercial meshers:
39 - GHS3D(3D), BLSURF(2D).
41 \n To add hypotheses, use the interfaces, provided by the assigned
44 \n Below you can see an example of usage of the package smesh for 3d mesh generation.
46 <h2>Example of 3d mesh generation with NETGEN:</h2>
48 \n from geompy import *
52 \n <b># an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral</b>.
54 <b># Define values</b>
64 \n box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
66 <b># Build a cylinder</b>
67 \n pt1 = MakeVertex(0, 0, cote/3)
68 \n di1 = MakeVectorDXDYDZ(0, 0, 1)
69 \n cyl = MakeCylinder(pt1, di1, section, size)
71 <b># Build a truncated cone</b>
72 \n pt2 = MakeVertex(0, 0, size)
73 \n cone = MakeCone(pt2, di1, radius_1, radius_2, height)
76 \n box_cyl = MakeFuse(box, cyl)
77 \n piece = MakeFuse(box_cyl, cone)
80 \n addToStudy(piece, name)
82 <b># Create a group of faces</b>
83 \n group = CreateGroup(piece, ShapeType["FACE"])
84 \n group_name = name + "_grp"
85 \n addToStudy(group, group_name)
86 \n group.SetName(group_name)
88 <b># Add faces in the group</b>
89 \n faces = SubShapeAllIDs(piece, ShapeType["FACE"])
90 \n UnionIDs(group, faces)
92 <b># Create a mesh</b>
94 <b># Define a mesh on a geometry</b>
95 \n tetra = smesh.Mesh(piece, name)
97 <b># Define 1D hypothesis</b>
98 \n algo1d = tetra.Segment()
99 \n algo1d.LocalLength(10)
101 <b># Define 2D hypothesis</b>
102 \n algo2d = tetra.Triangle()
103 \n algo2d.LengthFromEdges()
105 <b># Define 3D hypothesis</b>
106 \n algo3d = tetra.Tetrahedron(smesh.NETGEN)
107 \n algo3d.MaxElementVolume(100)
109 <b># Compute the mesh</b>
112 <b># Create a groupe of faces</b>
113 \n tetra.Group(group)
115 \n Examples of Python scripts for all Mesh operations are available by
119 <li>\subpage tui_creating_meshes_page</li>
120 <li>\subpage tui_viewing_meshes_page</li>
121 <li>\subpage tui_defining_hypotheses_page</li>
122 <li>\subpage tui_quality_controls_page</li>
123 <li>\subpage tui_grouping_elements_page</li>
124 <li>\subpage tui_modifying_meshes_page</li>
125 <li>\subpage tui_transforming_meshes_page</li>