3 \page smeshpy_interface_page Python interface
5 Python package smesh defines several classes, destined for easy and
6 clear mesh creation and edition.
8 Documentation for smesh package is available in two forms:
10 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 and the \ref smeshDC "linear documentation for smesh package"
14 grouped only by classes, declared in the smesh.py file.
16 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 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 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 Class \b Mesh allows assigning algorithms to a mesh.
30 Please note, that some algorithms, included in the standard SALOME
31 distribution are always available:
39 There are also some algorithms, which can be installed optionally,
40 some of them are based on open-source meshers:
41 - NETGEN (1D-2D, 2D, 1D-2D-3D, 3D)
43 ... and others are based on commercial meshers:
47 To add hypotheses, use the interfaces, provided by the assigned
50 Below you can see an example of usage of the package smesh for 3d mesh generation.
52 \anchor example_3d_mesh
53 <h2>Example of 3d mesh generation with NETGEN:</h2>
60 # Geometry: an assembly of a box, a cylinder and a truncated cone
61 # meshed with tetrahedral
74 box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
77 pt1 = MakeVertex(0, 0, cote/3)
78 di1 = MakeVectorDXDYDZ(0, 0, 1)
79 cyl = MakeCylinder(pt1, di1, section, size)
81 # Build a truncated cone
82 pt2 = MakeVertex(0, 0, size)
83 cone = MakeCone(pt2, di1, radius_1, radius_2, height)
86 box_cyl = MakeFuse(box, cyl)
87 piece = MakeFuse(box_cyl, cone)
90 addToStudy(piece, name)
92 # Create a group of faces
93 group = CreateGroup(piece, ShapeType["FACE"])
94 group_name = name + "_grp"
95 addToStudy(group, group_name)
96 group.SetName(group_name)
98 # Add faces to the group
99 faces = SubShapeAllIDs(piece, ShapeType["FACE"])
100 UnionIDs(group, faces)
106 # Define a mesh on a geometry
107 tetra = smesh.Mesh(piece, name)
109 # Define 1D hypothesis
110 algo1d = tetra.Segment()
111 algo1d.LocalLength(10)
113 # Define 2D hypothesis
114 algo2d = tetra.Triangle()
115 algo2d.LengthFromEdges()
117 # Define 3D hypothesis
118 algo3d = tetra.Tetrahedron(smesh.NETGEN)
119 algo3d.MaxElementVolume(100)
124 # Create a groupe of faces
129 Examples of Python scripts for all Mesh operations are available by
132 - \subpage tui_creating_meshes_page
133 - \subpage tui_viewing_meshes_page
134 - \subpage tui_defining_hypotheses_page
135 - \subpage tui_quality_controls_page
136 - \subpage tui_grouping_elements_page
137 - \subpage tui_modifying_meshes_page
138 - \subpage tui_transforming_meshes_page
139 - \subpage tui_notebook_smesh_page