</script>\r
<h1>Creating Meshes</h1>\r
\r
+<p>At first see <a href="smesh_py_introduction.htm">Example of 3d mesh generation</a>, using <b>smesh</b> package.\r
+<p>Other examples of python scripts will be also updated soon to use <b>smesh</b> package instead of direct usage of idl interface.\r
+\r
<h3><a name=bookmark>Construction of a Mesh</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import salome</p>\r
\r
<p class="whs1">import geompy</p>\r
\r
<h3><a name=bookmark2>Editing of a mesh</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs3"> </p>\r
\r
<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
\r
<h3><a name=bookmark3>Export of a Mesh</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs4"> </p>\r
\r
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import \r
\r
<h4><a name=bookmark5>Maximum Element Volume</a></h4>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">import \r
salome</span></p>\r
\r
\r
<h3><a name=bookmark8>Defining Meshing Algorithms</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">import \r
salome</span></p>\r
\r
\r
<h3><a name=bookmark5>Create a Group on Geometry</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import salome</p>\r
\r
<p class="whs1">import geompy</p>\r
\r
<h3><a name=bookmark13>Pattern Mapping</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs7">import salome</p>\r
\r
<p class="whs7">import geompy</p>\r
\r
<h3><a name=bookmark>Free Borders</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import salome</p>\r
\r
<p class="whs1">import geompy</p>\r
\r
<h3><a name=bookmark1>Borders at Multiconnection</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import salome</p>\r
\r
<p class="whs1">import geompy</p>\r
\r
<h3><a name=bookmark2>Length 1D</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs2"> </p>\r
\r
<p class="whs1">import salome</p>\r
\r
<h3><a name=bookmark3>Free Edges</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import SMESH</p>\r
\r
<p class="whs1">import SMESH_mechanic</p>\r
\r
<h3><a name=bookmark4>Length 2D</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import salome</p>\r
\r
<p class="whs1">import geompy</p>\r
\r
<h3><a name=bookmark5>Borders at Multiconnection 2D</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import salome</p>\r
\r
<p class="whs1">import geompy</p>\r
\r
<h3><a name=bookmark6>Area</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import SMESH</p>\r
\r
<p class="whs1">import SMESH_mechanic</p>\r
\r
<h3><a name=bookmark7>Taper</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import SMESH</p>\r
\r
<p class="whs1">import SMESH_mechanic</p>\r
\r
<h3><a name=bookmark8>Aspect Ratio</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import SMESH</p>\r
\r
<p class="whs1">import SMESH_mechanic</p>\r
\r
<h3><a name=bookmark9>Minimum Angle</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1"> </p>\r
\r
<p class="whs1">import SMESH</p>\r
\r
<h3><a name=bookmark10>Warping</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import SMESH</p>\r
\r
<p class="whs1">import SMESH_mechanic</p>\r
\r
<h3><a name=bookmark12>Skew</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import SMESH</p>\r
\r
<p class="whs1">import SMESH_mechanic</p>\r
\r
<h3><a name=bookmark11>Aspect Ratio 3D</a></h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import SMESH</p>\r
\r
<p class="whs1">import SMESH_mechanic_tetra</p>\r
--- /dev/null
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<head>\r
+<title>Introduction to MESH module python interface</title>\r
+<meta http-equiv="content-type" content="text/html; charset=windows-1252">\r
+<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style type="text/css">\r
+<!--\r
+p.whs1 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
+p.whs2 { margin-top:0pt; margin-bottom:0pt; }\r
+p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0px; margin-bottom:0px; }\r
+p.whs4 { margin-top:0px; margin-bottom:0px; }\r
+p.whs5 { margin-top:0px; margin-bottom:0px; font-family:'Times New Roman' , serif; }\r
+-->\r
+</style><script type="text/javascript" language="JavaScript">\r
+<!--\r
+if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
+{\r
+ var strNSS = "<style type='text/css'>";\r
+ strNSS += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS +="</style>";\r
+ document.write(strNSS);\r
+}\r
+//-->\r
+</script>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }\r
+p.WebHelpNavBar { text-align:right; }\r
+-->\r
+</style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.setRelStartPage)\r
+ {\r
+ addTocInfo("MESH module\nTUI Scripts\nIntroduction to MESH module python interface");\r
+addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");\r
+addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");\r
+\r
+ }\r
+\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("index.htm");\r
+\r
+ autoSync(1);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+\r
+}\r
+else\r
+ if (window.gbIE4)\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+</head>\r
+<body><script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(4);\r
+//-->\r
+</script>\r
+<h1>Introduction to MESH module python interface</h1>\r
+\r
+<p><a href="smeshpy_doc/namespacesmesh.html">Package smesh</a> provides a standard API for meshes creation and edition.\r
+<p>Below you can see an example of package <b>smesh</b> usage for 3d mesh generation.\r
+<p> \r
+<h3><a name=bookmark>Example of 3d mesh generation with NETGEN</a></h3>\r
+\r
+<br>from geompy import *\r
+<br>\r
+<br>import smesh\r
+<br>\r
+<br># Geometry\r
+<br># ========\r
+<br>\r
+<br># an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral.\r
+<br>\r
+<br># Define values\r
+<br># -------------\r
+<br>\r
+<br>name = "ex21_lamp"\r
+<br>\r
+<br>cote = 60\r
+<br>\r
+<br>section = 20\r
+<br>size = 200\r
+<br>\r
+<br>radius_1 = 80\r
+<br>radius_2 = 40\r
+<br>height = 100\r
+<br>\r
+<br># Build a box\r
+<br># -----------\r
+<br>\r
+<br>box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)\r
+<br>\r
+<br># Build a cylinder\r
+<br># ----------------\r
+<br>\r
+<br>pt1 = MakeVertex(0, 0, cote/3)\r
+<br>di1 = MakeVectorDXDYDZ(0, 0, 1)\r
+<br>cyl = MakeCylinder(pt1, di1, section, size)\r
+<br>\r
+<br># Build a truncated cone\r
+<br># ----------------------\r
+<br>\r
+<br>pt2 = MakeVertex(0, 0, size)\r
+<br>cone = MakeCone(pt2, di1, radius_1, radius_2, height)\r
+<br>\r
+<br># Fuse\r
+<br># ----\r
+<br>\r
+<br>box_cyl = MakeFuse(box, cyl)\r
+<br>piece = MakeFuse(box_cyl, cone)\r
+<br>\r
+<br># Add in study\r
+<br># ------------\r
+<br>\r
+<br>addToStudy(piece, name)\r
+<br>\r
+<br># Create a group of faces\r
+<br># -----------------------\r
+<br>\r
+<br>group = CreateGroup(piece, ShapeType["FACE"])\r
+<br>\r
+<br>group_name = name + "_grp"\r
+<br>addToStudy(group, group_name)\r
+<br>group.SetName(group_name)\r
+<br>\r
+<br># Add faces in the group\r
+<br># ----------------------\r
+<br>\r
+<br>faces = SubShapeAllIDs(piece, ShapeType["FACE"])\r
+<br>\r
+<br>UnionIDs(group, faces)\r
+<br>\r
+<br># Create a mesh\r
+<br># =============\r
+<br>\r
+<br># Define a mesh on a geometry\r
+<br># ---------------------------\r
+<br>\r
+<br>tetra = smesh.Mesh(piece, name)\r
+<br>\r
+<br># Define 1D hypothesis\r
+<br># --------------------\r
+<br>\r
+<br>algo1d = tetra.Segment()\r
+<br>algo1d.LocalLength(10)\r
+<br>\r
+<br># Define 2D hypothesis\r
+<br># --------------------\r
+<br>\r
+<br>algo2d = tetra.Triangle()\r
+<br>algo2d.LengthFromEdges()\r
+<br>\r
+<br># Define 3D hypothesis\r
+<br># --------------------\r
+<br>\r
+<br>algo3d = tetra.Tetrahedron(smesh.NETGEN)\r
+<br>algo3d.MaxElementVolume(100)\r
+<br>\r
+<br># Compute the mesh\r
+<br># ----------------\r
+<br>\r
+<br>tetra.Compute()\r
+<br>\r
+<br># Create a groupe of faces\r
+<br># ------------------------\r
+<br>\r
+<br>tetra.Group(group)\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+</html>\r
<!-- Generated by Doxygen 1.4.6 -->
<h1>Package smesh</h1>
<p>
+Python package smesh defines several classes, destined for easy and clear mesh creation and edition.
+<p class="whs2"><a href="../smesh_py_introduction.htm">Example.</a></p>
+<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
\r
<h3>Viewing Mesh Infos</h3>\r
\r
+<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
+<br> \r
+\r
<p class="whs1">import salome</p>\r
\r
<p class="whs1">import geompy</p>\r
aTE(2,0,"Pattern mapping","pattern_mapping.htm");\r
aTE(2,0,"Access to Mesh module functionality from Python (using smesh.py)","smeshpy_doc/namespacesmesh.html");\r
aTE(1,7,"TUI Scripts");\r
+ aTE(2,0,"Introduction to MESH module python interface","smesh_py_introduction.htm");\r
aTE(2,0,"Creating Meshes","constructing_meshes.htm");\r
aTE(2,0,"Defining Hypotheses","defining_hypotheses_tui.htm");\r
aTE(2,0,"Viewing Meshes","viewing_meshes.htm");\r
<nobr><a name="6"></a><a href="whlstt6.htm#6" target="_self" title="closed book"><img src="../whd_toc1.gif" border="0" align="absmiddle"> Grouping elements</a></nobr><br>\r
<nobr><a name="7"></a><a href="whlstt7.htm#7" target="_self" title="closed book"><img src="../whd_toc1.gif" border="0" align="absmiddle"> Modifying meshes</a></nobr><br>\r
<nobr><a name="9"></a><a href="whlstt1.htm#9" target="_self"><img src="../whd_toc2.gif" border="0" align="absmiddle"> TUI Scripts</a></nobr><br>\r
+ <nobr><a href="../smesh_py_introduction.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Introduction to MESH module python interface</a></nobr><br>\r
<nobr><a href="../constructing_meshes.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Creating Meshes</a></nobr><br>\r
<nobr><a href="../defining_hypotheses_tui.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Defining Hypotheses</a></nobr><br>\r
<nobr><a href="../viewing_meshes.htm"><img src="../whd_toc3.gif" border="0" align="absmiddle"> Viewing Meshes</a></nobr><br>\r
</book>\r
<item name="Access to Mesh module functionality from Python (using smesh.py)" url="smeshpy_doc/namespacesmesh.html" />\r
<book name="TUI Scripts" >\r
+ <item name="Introduction to MESH module python interface" url="smesh_py_introduction.htm" />\r
<item name="Creating Meshes" url="constructing_meshes.htm" />\r
<item name="Defining Hypotheses" url="defining_hypotheses_tui.htm" />\r
<item name="Viewing Meshes" url="viewing_meshes.htm" />\r