Salome HOME
Redesign SALOME documentation
[modules/smesh.git] / doc / salome / gui / SMESH / input / sewing_meshes.rst
1 .. _sewing_meshes_page:
2
3 *************
4 Sewing meshes
5 *************
6
7 In SMESH you can sew elements of a mesh. The current
8 functionality allows you to sew:
9
10 * :ref:`free_borders_anchor`
11 * :ref:`conform_free_borders_anchor`
12 * :ref:`border_to_side_anchor`
13 * :ref:`side_elements_anchor`
14
15
16 .. image:: ../images/sewing.png 
17         :align: center
18
19 .. centered::
20         "Sewing button"
21
22 **To sew elements of a mesh:**
23
24 #. From the **Modification** menu choose the **Transformation** item and from its sub-menu select the **Sewing** item.
25 #. Check in the dialog box one of the radio buttons corresponding to the type of sewing operation you would like to perform.
26 #. Fill the other fields available in the dialog box.
27 #. Click the **Apply** or **Apply and Close** button to perform the operation of sewing.
28
29
30
31 .. _free_borders_anchor:
32
33 Sew free borders
34 ################
35
36 This functionality allows you to unite free borders of a 2D mesh.
37
38 There are two working modes: *Automatic* and *Manual*. In the 
39 **Automatic** mode, the program finds free borders coincident within the
40 specified tolerance and sews them. Optionally it is possible to
41 visually check and correct if necessary the found free borders before
42 sewing. 
43 In the **Manual** mode you are to define borders to sew by picking
44 three nodes of each of two borders.
45
46 .. image:: ../images/sewing1.png
47         :align: center
48
49 .. centered::
50         Default mode is *Automatic*
51
52 To use **Automatic** sewing:
53
54 * Specify the mesh you want to sew by selecting it or any its part (group or sub-mesh) in the Object Browser or in the VTK Viewer.
55 * Specify the **Tolerance**, within which free borders are considered coincident. At the default zero **Tolerance**, the tolerance used by he search algorithm is defined as one tenth of an average size of elements adjacent to compared free borders.
56 * To visually check the coincident free borders found by the algorithm, switch off **Auto Sewing** check-box. The controls to adjust groups of coincident free borders will become available in the dialog.
57
58         .. image:: ../images/sewing_auto.png
59                 :align: center
60
61         .. centered::
62                 Controls to adjust groups of coincident free borders
63
64 * **Detect** button launches the algorithm of search of coincident free borders.
65 * The found groups of **Coincident Free Borders** are shown in the list, one group per line. Each group has its own color, which is used to display the group borders in the VTK Viewer. A free border within a group is designated by the IDs of its first, second and last nodes within parenthesis. All borders present in the list will be sewn upon **Apply**. 
66 * **Remove** button removes the selected groups from the list.
67 * **Select All** check-box selects all groups in the list.
68 * When a group is selected, its borders appear in **Edit Selected Group** list that allows you to change this group.
69
70         .. image:: ../images/sort.png
71                 :align: center
72
73         .. centered::
74                 **Set First** button moves the selected border to the first position in the group, as a result other borders will be moved to this border during sewing.
75
76         .. image:: ../images/remove.png
77                 :align: center
78
79         .. centered::
80                 **Remove Border** button removes the selected borders from the group. It is active if there are more than two borders in the group.
81
82
83 * Selection of a border in the list allows changing its first and last nodes whose IDs appear in two fields below the list. *Arrow* buttons near each field move the corresponding end node by the number of nodes defined by **Step** field.
84  
85         .. image:: ../images/swap.png
86                 :align: center
87
88         .. centered::
89                 **Swap** button swaps the first and last nodes of a selected border.
90
91
92 * For sewing free borders manually you should switch the **Mode** to **Manual** and define three points on each border: the first, the second and the last node:
93
94         .. image:: ../images/sewing_manual.png
95                 :align: center
96
97 * the first node specifies beginning of the border;
98 * the second node specifies the part of the border which should be considered (as far as the free border usually forms a closed contour);
99 * the last node specifies the end of the border.
100
101
102 You can select these nodes in the 3D viewer or define by its id.
103
104 The first and the second nodes should belong to the same link of a
105 face. The second and the last nodes of a border can be the same. The
106 first and the last nodes of two borders can be the same. The
107 corresponding end nodes of two borders will be merged. Intermediate
108 nodes of two borders will be either merged or inserted into faces of
109 the opposite border.
110
111 In practice the borders to sew often coincide and in this case it is
112 difficult to specify the first and the last nodes of a border since
113 they coincide with the first and the last nodes of the other
114 border. To cope with this,
115 :ref:`merging_nodes_page` coincident nodes into one
116 beforehand. Two figures below illustrate this approach.
117
118 .. image:: ../images/sew_using_merge.png                
119         :align: center
120
121 .. centered::
122         "Merge coincident nodes, which are difficult to distinguish"
123
124 .. image:: ../images/sew_after_merge.png
125                 :align: center
126
127 .. centered::
128         "After merging nodes it is easy to specify border nodes"
129
130 The sewing algorithm is as follows:
131
132 #. The parameter (U) of each node within a border is computed. So that the first node has U=0.0, the last node has U=1.0, for the rest nodes 0.0 < U < 1.0;
133 #. Compare node parameters of the two borders. If two nodes of the opposite borders have close parameters, they are merged, i.e. a node of the first border is replaced in all elements by a node of the second border. If a node has no node with a close parameter in the opposite border, it is inserted into an edge of element of the opposite border, an element is split. Two nodes are considered close enough to merge, if difference of their parameters is less than one fifth of minimum length of adjacent face edges on the borders.
134
135
136         .. image:: ../images/image22.jpg 
137                 :align: center
138
139         .. centered::
140                 "Sewing free borders"
141
142 **See Also** a sample TUI Script of a 
143 :ref:`tui_sew_free_borders` operation.
144
145
146 .. _conform_free_borders_anchor:
147
148 Sew conform free borders
149 ########################
150
151 This functionality can be used to unite two free borders of a 2D mesh.
152
153 .. image:: ../images/sewing2.png
154         :align: center
155
156 The borders of meshes for sewing are defined as for "Sew free borders"
157 except that the second free border is not limited and can be defined
158 by the first and the second nodes only. The first nodes of two borders
159 can be the same.
160
161 The algorithm is following: counting nodes starting at the first ones,
162 the n-th node of the first border is merged with the n-th node of the
163 other border, until the end of either of borders. Nodes of the first
164 border are replaced in all elements with corresponding nodes of the
165 second border.
166
167 .. note:: 
168         For sewing conform free borders you should define three points on the first border and two points on the second one. User can select these nodes in 3D viewer or define node by its id.
169
170 .. image:: ../images/image23.jpg 
171         :align: center
172
173 .. centered::
174         "Sewing conform free borders"
175
176 **See Also** a sample TUI Script of a 
177 :ref:`tui_sew_conform_free_borders` operation.
178
179
180 .. _border_to_side_anchor:
181
182 Sew border to side
183 ##################
184
185 "Sew border to side" is intended to sew a free border to a mesh
186 surface.
187
188 .. note:: 
189         The free border is defined as for "Sewing of free borders". The place where to sew the border is defined by two nodes, between which the border faces are placed, so that the first border node is merged with the first node on the side and the last node of the border is merged with the second specified node on the side.
190
191 .. image:: ../images/sewing3.png
192         :align: center
193
194 The algorithm is following.
195
196 #. Find a sequence of linked nodes on the side such that the found links to be most co-directed with the links of the free border.
197 #. Sew two sequences of nodes using algorithm of "Sewing of free berders".
198
199 .. note:: 
200         For sewing border to side you should define three points on the border and two points on the side. User can select these nodes in 3D viewer or define node by its id.
201
202 .. image:: ../images/image30.jpg 
203         :align: center
204
205 .. centered::
206         "Sewing border to side"
207
208 **See Also** a sample TUI Script of a 
209 :ref:`tui_sew_meshes_border_to_side` operation.  
210
211
212 .. _side_elements_anchor:
213
214 Sew side elements
215 =================
216
217 This operation is intended to unite two mesh surfaces.
218
219 .. image:: ../images/sewing4.png 
220         :align: center
221
222 Surfaces may be defined by either 2d or 3d elements. The number of
223 given elements of the sides must be the same. The sets of given
224 elements must be topologically equal, i.e. each node of one element
225 set must have a corresponding node in the other element set and
226 corresponding nodes must be equally linked. If there are 3d elements
227 in a set, only their free faces must obey to that rule.
228
229 .. note:: Two corresponding nodes on each side must be specified. They must belong to one element and must be located on an element set boundary.
230
231 Sewing algorithm finds and merges the corresponding nodes starting
232 from the specified ones.
233
234 .. image:: ../images/image31.jpg 
235         :align: center
236
237 .. centered::
238         "Step-by-step sewing process"
239
240 .. image:: ../images/image32.jpg 
241         :align: center
242
243 .. centered::
244         "The result of side elements sewing"
245
246 For sewing side elements you should define elements for sewing and two
247 nodes for merging on the each side. User can select these elements and
248 nodes in 3D viewer or define them by its id.
249
250 **See Also** a sample TUI Script of a 
251 :ref:`tui_sew_side_elements` operation.  
252
253