Salome HOME
Merge from BR_DEBUG_3_2_0b1
[modules/smesh.git] / doc / salome / gui / SMESH / viewing_meshes.htm
1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
2
3 <html>
4
5 <head>
6 <title>Viewing Meshes</title>
7 <meta http-equiv="content-type" content="text/html; charset=windows-1252">
8 <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style type="text/css">
9 <!--
10 p.whs1 { font-family:'Lucida Console' , monospace; margin-top:0pt; margin-bottom:0pt; }
11 p.whs2 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }
12 -->
13 </style><script type="text/javascript" language="JavaScript">
14 <!--
15 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
16 {
17   var strNSS = "<style type='text/css'>";
18   strNSS += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";
19   strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";
20   strNSS +="</style>";
21   document.write(strNSS);
22 }
23 //-->
24 </script>
25 <script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
26 <!--
27 function reDo() {
28   if (innerWidth != origWidth || innerHeight != origHeight)
29      location.reload();
30 }
31 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
32         origWidth = innerWidth;
33         origHeight = innerHeight;
34         onresize = reDo;
35 }
36 onerror = null; 
37 //-->
38 </script>
39 <style type="text/css">
40 <!--
41 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
42 p.WebHelpNavBar { text-align:right; }
43 -->
44 </style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
45 <script type="text/javascript" language="javascript" src="whver.js"></script>
46 <script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
47 <script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
48 <script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
49 <script type="text/javascript" language="javascript1.2">
50 <!--
51 if (window.gbWhTopic)
52 {
53         if (window.setRelStartPage)
54         {
55         addTocInfo("MESH module\nTUI Scripts\nViewing Meshes");
56 addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");
57 addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");
58
59         }
60
61
62         if (window.setRelStartPage)
63         {
64         setRelStartPage("index.htm");
65
66                 autoSync(1);
67                 sendSyncInfo();
68                 sendAveInfoOut();
69         }
70
71 }
72 else
73         if (window.gbIE4)
74                 document.location.reload();
75 //-->
76 </script>
77 </head>
78 <body><script type="text/javascript" language="javascript1.2">
79 <!--
80 if (window.writeIntopicBar)
81         writeIntopicBar(4);
82 //-->
83 </script>
84 <h1>Viewing Meshes</h1>
85
86 <h3>Viewing Mesh Infos</h3>
87
88 <p class="whs1">import salome</p>
89
90 <p class="whs1">import geompy</p>
91
92 <p class="whs1">import SMESH</p>
93
94 <p class="whs1">import StdMeshers</p>
95
96 <p class="whs1">&nbsp;</p>
97
98 <p class="whs1">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;, 
99  &quot;SMESH&quot;)</p>
100
101 <p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>
102
103 <p class="whs1">&nbsp;</p>
104
105 <p class="whs1">box &nbsp;&nbsp;= 
106  geompy.MakeBox(0., 0., 0., 20., 20., 20.)</p>
107
108 <p class="whs1">idbox = geompy.addToStudy(box, &quot;box&quot;)</p>
109
110 <p class="whs1">&nbsp;</p>
111
112 <p class="whs1">subShapeList = geompy.SubShapeAll(box, 
113  geompy.ShapeType[&quot;EDGE&quot;])</p>
114
115 <p class="whs1">edge &nbsp;&nbsp;= 
116  subShapeList[0]</p>
117
118 <p class="whs1">name &nbsp;&nbsp;= 
119  geompy.SubShapeName(edge, box)</p>
120
121 <p class="whs1">idedge = geompy.addToStudyInFather(box, 
122  edge, name)</p>
123
124 <p class="whs1">&nbsp;</p>
125
126 <p class="whs1">box &nbsp;= 
127  salome.IDToObject(idbox)</p>
128
129 <p class="whs1">edge = salome.IDToObject(idedge)</p>
130
131 <p class="whs1">&nbsp;</p>
132
133 <p class="whs1">hyp1 = smesh.CreateHypothesis(&quot;NumberOfSegments&quot;, 
134  &quot;libStdMeshersEngine.so&quot;)</p>
135
136 <p class="whs1">hyp1.SetNumberOfSegments(3)</p>
137
138 <p class="whs1">hyp2 = smesh.CreateHypothesis(&quot;MaxElementArea&quot;, 
139  &quot;libStdMeshersEngine.so&quot;)</p>
140
141 <p class="whs1">hyp2.SetMaxElementArea(10)</p>
142
143 <p class="whs1">hyp3 = smesh.CreateHypothesis(&quot;Arithmetic1D&quot;, 
144  &quot;libStdMeshersEngine.so&quot;)</p>
145
146 <p class="whs1">hyp3.SetLength(1,1)</p>
147
148 <p class="whs1">hyp3.SetLength(6,0)</p>
149
150 <p class="whs1">hyp4 = smesh.CreateHypothesis(&quot;Propagation&quot;, 
151  &quot;libStdMeshersEngine.so&quot;)</p>
152
153 <p class="whs1">&nbsp;</p>
154
155 <p class="whs1">algo1 = smesh.CreateHypothesis(&quot;Regular_1D&quot;, 
156  &quot;libStdMeshersEngine.so&quot;)</p>
157
158 <p class="whs1">algo2 = smesh.CreateHypothesis(&quot;MEFISTO_2D&quot;, 
159  &quot;libStdMeshersEngine.so&quot;)</p>
160
161 <p class="whs1">mesh = smesh.CreateMesh(box)</p>
162
163 <p class="whs1">&nbsp;</p>
164
165 <p class="whs1">mesh.AddHypothesis(box,hyp1)</p>
166
167 <p class="whs1">mesh.AddHypothesis(box,hyp2)</p>
168
169 <p class="whs1">mesh.AddHypothesis(box,algo1)</p>
170
171 <p class="whs1">mesh.AddHypothesis(box,algo2)</p>
172
173 <p class="whs1">mesh.AddHypothesis(edge,hyp3)</p>
174
175 <p class="whs1">mesh.AddHypothesis(edge,hyp4)</p>
176
177 <p class="whs1">mesh.AddHypothesis(edge,algo1)</p>
178
179 <p class="whs1">smesh.Compute(mesh,box)</p>
180
181 <p class="whs1">salome.sg.updateObjBrowser(1)</p>
182
183 <p class="whs1">&nbsp;</p>
184
185 <p class="whs2"># remove one hypothesis</p>
186
187 <p class="whs1">mesh.RemoveHypothesis(edge,hyp4)</p>
188
189 <p class="whs1">smesh.Compute(mesh,box)</p>
190
191 <p class="whs1">salome.sg.updateObjBrowser(1)</p>
192
193 <p class="whs1">&nbsp;</p>
194
195 <p class="whs2"># change the value 
196  of the hypothesis</p>
197
198 <p class="whs1">hyp2.SetMaxElementArea(2)</p>
199
200 <p class="whs1">mesh.AddHypothesis(box,hyp2)</p>
201
202 <p class="whs1">smesh.Compute(mesh,box)</p>
203
204 <p class="whs1">print &quot;Information about mesh:&quot;</p>
205
206 <p class="whs1">print &quot;Number of nodes &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 
207  &quot;, mesh.NbNodes()</p>
208
209 <p class="whs1">print &quot;Number of edges &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 
210  &quot;, mesh.NbEdges()</p>
211
212 <p class="whs1">print &quot;Number of faces &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 
213  &quot;, mesh.NbFaces()</p>
214
215 <p class="whs1">print &quot;Number of triangles &nbsp;&nbsp;: 
216  &quot;, mesh.NbTriangles()</p>
217
218 <p class="whs1">print &quot;Number of quadrangles : &quot;, 
219  mesh.NbQuadrangles()</p>
220
221 <p class="whs1">print &quot;Number of polygons &nbsp;&nbsp;&nbsp;: 
222  &quot;, mesh.NbPolygons()</p>
223
224 <p class="whs1">print &quot;Number of volumes &nbsp;&nbsp;&nbsp;&nbsp;: 
225  &quot;, mesh.NbVolumes()</p>
226
227 <p class="whs1">print &quot;Number of tetrahedrons: &quot;, 
228  mesh.NbTetras()</p>
229
230 <p class="whs1">print &quot;Number of hexahedrons : &quot;, 
231  mesh.NbHexas()</p>
232
233 <p class="whs1">print &quot;Number of prisms &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 
234  &quot;, mesh.NbPrisms()</p>
235
236 <p class="whs1">print &quot;Number of pyramids &nbsp;&nbsp;&nbsp;: 
237  &quot;, mesh.NbPyramids()</p>
238
239 <p class="whs1">print &quot;Number of polyhedrons : &quot;, 
240  mesh.NbPolyhedrons()</p>
241
242 <p class="whs1">salome.sg.updateObjBrowser(1) </p>
243
244 <p class="whs1">&nbsp;</p>
245
246 <script type="text/javascript" language="javascript1.2">
247 <!--
248 if (window.writeIntopicBar)
249         writeIntopicBar(0);
250 //-->
251 </script>
252 </body>
253 </html>