2005-11-28 14:57:47 +05:00
|
|
|
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
|
|
|
|
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Transforming Meshes</title>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
|
|
|
|
<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style type="text/css">
|
|
|
|
<!--
|
|
|
|
h3.whs1 { margin-top:0pt; margin-bottom:0pt; }
|
|
|
|
h4.whs2 { margin-top:0pt; margin-bottom:0pt; }
|
|
|
|
p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0pt; margin-bottom:0pt; }
|
2006-07-14 16:40:47 +06:00
|
|
|
p.whs4 { margin-top:0pt; margin-bottom:0pt; font-weight:bold; color:#ff0000; }
|
2005-11-28 14:57:47 +05:00
|
|
|
p.whs5 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
|
2006-07-14 16:40:47 +06:00
|
|
|
p.whs6 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }
|
|
|
|
p.whs7 { margin-top:0pt; margin-bottom:0pt; }
|
2005-11-28 14:57:47 +05:00
|
|
|
-->
|
|
|
|
</style><script type="text/javascript" language="JavaScript">
|
|
|
|
<!--
|
|
|
|
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
|
|
|
|
{
|
|
|
|
var strNSS = "<style type='text/css'>";
|
|
|
|
strNSS += "h3.whs1 {margin-top:1pt;margin-bottom:1pt; }";
|
|
|
|
strNSS += "h4.whs2 {margin-top:1pt;margin-bottom:1pt; }";
|
|
|
|
strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";
|
|
|
|
strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";
|
|
|
|
strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";
|
2006-07-14 16:40:47 +06:00
|
|
|
strNSS += "p.whs6 {margin-top:1pt;margin-bottom:1pt; }";
|
|
|
|
strNSS += "p.whs7 {margin-top:1pt;margin-bottom:1pt; }";
|
2005-11-28 14:57:47 +05:00
|
|
|
strNSS +="</style>";
|
|
|
|
document.write(strNSS);
|
|
|
|
}
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
|
|
|
<!--
|
|
|
|
function reDo() {
|
|
|
|
if (innerWidth != origWidth || innerHeight != origHeight)
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
|
|
|
|
origWidth = innerWidth;
|
|
|
|
origHeight = innerHeight;
|
|
|
|
onresize = reDo;
|
|
|
|
}
|
|
|
|
onerror = null;
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
<style type="text/css">
|
|
|
|
<!--
|
|
|
|
div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
|
2006-06-01 17:39:17 +06:00
|
|
|
p.WebHelpNavBar { text-align:right; }
|
2005-11-28 14:57:47 +05:00
|
|
|
-->
|
|
|
|
</style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
|
|
|
|
<script type="text/javascript" language="javascript" src="whver.js"></script>
|
|
|
|
<script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
|
|
|
|
<script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
|
|
|
|
<script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
|
2006-06-01 17:39:17 +06:00
|
|
|
<script type="text/javascript" language="javascript1.2">
|
2005-11-28 14:57:47 +05:00
|
|
|
<!--
|
|
|
|
if (window.gbWhTopic)
|
|
|
|
{
|
2006-06-01 17:39:17 +06:00
|
|
|
if (window.setRelStartPage)
|
2005-11-28 14:57:47 +05:00
|
|
|
{
|
|
|
|
addTocInfo("MESH module\nTUI Scripts\nTransforming Meshes");
|
2006-06-01 17:39:17 +06:00
|
|
|
addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");
|
|
|
|
addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (window.setRelStartPage)
|
|
|
|
{
|
2006-06-01 17:39:17 +06:00
|
|
|
setRelStartPage("index.htm");
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
autoSync(1);
|
|
|
|
sendSyncInfo();
|
|
|
|
sendAveInfoOut();
|
|
|
|
}
|
2006-06-01 17:39:17 +06:00
|
|
|
|
2005-11-28 14:57:47 +05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
if (window.gbIE4)
|
|
|
|
document.location.reload();
|
|
|
|
//-->
|
|
|
|
</script>
|
2006-06-01 17:39:17 +06:00
|
|
|
</head>
|
|
|
|
<body><script type="text/javascript" language="javascript1.2">
|
|
|
|
<!--
|
|
|
|
if (window.writeIntopicBar)
|
|
|
|
writeIntopicBar(4);
|
|
|
|
//-->
|
|
|
|
</script>
|
2005-11-28 14:57:47 +05:00
|
|
|
<h1>Transforming Meshes</h1>
|
|
|
|
|
|
|
|
<h3 class="whs1">Transforming Meshes</h3>
|
|
|
|
|
|
|
|
<h4 class="whs2"> </h4>
|
|
|
|
|
|
|
|
<h4 class="whs2"><a name=bookmark>Translation</a></h4>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to translate meshes. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">import SMESH</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">import SMESH_mechanic</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">mesh = SMESH_mechanic.mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">anEditor = mesh.GetMeshEditor()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># define translation
|
|
|
|
vector</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">point = SMESH.PointStruct(-150.,
|
|
|
|
-150., 0.)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">vector = SMESH.DirStruct(point)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># translate a mesh</p>
|
|
|
|
|
|
|
|
<p class="whs5">doCopy = 1</p>
|
|
|
|
|
|
|
|
<p class="whs5">anEditor.TranslateObject(mesh,
|
|
|
|
vector, doCopy) </p>
|
|
|
|
|
|
|
|
<p class="whs7"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h4 class="whs2"><a name=bookmark1>Rotation</a></h4>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to rotate meshes. </p>
|
|
|
|
|
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
2006-05-06 14:51:48 +06:00
|
|
|
<p class="whs3">import math</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import SMESH</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import SMESH_mechanic</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh = SMESH_mechanic.mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs3">anEditor = mesh.GetMeshEditor()</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs6"># define rotation axis
|
|
|
|
and angle</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">axisXYZ = SMESH.AxisStruct(0., 0., 0.,
|
|
|
|
5., 5., 20.)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">angle270 = 1.5 * math.pi</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># rotate a mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">anEditor.RotateObject(mesh, axisXYZ, angle270,
|
|
|
|
1) </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs7"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h4 class="whs2"><a name=bookmark2>Symmetry</a></h4>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to create symmetrical copies of meshes. </p>
|
|
|
|
|
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">import math</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import SMESH</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import SMESH_mechanic</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh = SMESH_mechanic.mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs3">anEditor = mesh.GetMeshEditor()</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create a symmetrical
|
|
|
|
copy of the mesh mirrored through a point</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">axis = SMESH.AxisStruct(0, 0, 0, 0, 0,
|
|
|
|
0)</p>
|
|
|
|
|
|
|
|
<p class="whs3">anEditor.MirrorObject(mesh, axis, SMESH.SMESH_MeshEditor.POINT,
|
|
|
|
1) </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs7"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h4 class="whs2"><a name=bookmark3>Merging
|
|
|
|
Nodes</a></h4>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to merge nodes. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">import SMESH_mechanic</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">mesh = SMESH_mechanic.mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">aMeshEditor = mesh.GetMeshEditor()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># merge nodes</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">Tolerance = 25.0</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">GroupsOfNodes =
|
|
|
|
aMeshEditor.FindCoincidentNodes(Tolerance)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs7"><span style="font-family: 'Lucida Console', monospace;">aMeshEditor.MergeNodes(GroupsOfNodes)</span>
|
2005-11-28 14:57:47 +05:00
|
|
|
</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs7"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-05-06 14:51:48 +06:00
|
|
|
<h4><a name=bookmark8>Merging Elements</a></h4>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to merge elements. </p>
|
|
|
|
|
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
|
|
|
|
|
|
|
<p class="whs6"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5">import salome</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs5">import smesh</p>
|
|
|
|
|
2006-05-06 14:51:48 +06:00
|
|
|
<p class="whs5">import SMESH</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create a face to
|
|
|
|
be meshed</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5">px = geompy.MakeVertex(100.,
|
|
|
|
0. , 0.
|
|
|
|
)</p>
|
|
|
|
|
|
|
|
<p class="whs5">py = geompy.MakeVertex(0.
|
|
|
|
, 100.,
|
|
|
|
0. )</p>
|
|
|
|
|
|
|
|
<p class="whs5">pz = geompy.MakeVertex(0.
|
|
|
|
, 0. ,
|
|
|
|
100.)</p>
|
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">vxy = geompy.MakeVector(px,
|
|
|
|
py)</p>
|
|
|
|
|
|
|
|
<p class="whs5">arc = geompy.MakeArc(py,
|
|
|
|
pz, px)</p>
|
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">wire = geompy.MakeWire([vxy,
|
|
|
|
arc])</p>
|
|
|
|
|
|
|
|
<p class="whs5">isPlanarFace = 1</p>
|
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">face1 = geompy.MakeFace(wire,
|
|
|
|
isPlanarFace)</p>
|
|
|
|
|
|
|
|
<p class="whs5">id_face1 = geompy.addToStudy(face1,
|
|
|
|
"Face1")</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create a circle to
|
|
|
|
be an extrusion path</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">px1 = geompy.MakeVertex(
|
|
|
|
100., 100.,
|
|
|
|
0.)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">py1 = geompy.MakeVertex(-100.,
|
|
|
|
-100., 0.)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">pz1 = geompy.MakeVertex(
|
|
|
|
0.,
|
|
|
|
0.,
|
|
|
|
50.)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">circle = geompy.MakeCircleThreePnt(py1,
|
|
|
|
pz1, px1)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">id_circle = geompy.addToStudy(circle,
|
|
|
|
"Path")</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create a 2D mesh
|
|
|
|
on the face</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">trias = smesh.Mesh(face1,
|
|
|
|
"Face : 2D mesh")</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D = trias.Segment()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D.NumberOfSegments(6)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo2D = trias.Triangle()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo2D.LengthFromEdges()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">trias.Compute()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">tri_mesh = trias.GetMesh()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"> </p>
|
|
|
|
|
|
|
|
<p class="whs6"># create a path mesh</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5">circlemesh = smesh.Mesh(circle,
|
|
|
|
"Path mesh")</p>
|
|
|
|
|
|
|
|
<p class="whs5">algo = circlemesh.Segment()</p>
|
|
|
|
|
|
|
|
<p class="whs5">algo.NumberOfSegments(10)</p>
|
|
|
|
|
|
|
|
<p class="whs5">circlemesh.Compute()</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># extrusion of the
|
|
|
|
mesh</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5">aMeshEditor = tri_mesh.GetMeshEditor()</p>
|
|
|
|
|
|
|
|
<p class="whs5">aMeshEditor.ExtrusionAlongPathObject(tri_mesh,
|
2006-07-14 16:40:47 +06:00
|
|
|
circlemesh.GetMesh(), circle,</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> 1,
|
|
|
|
0, [], 0, SMESH.PointStruct(0, 0, 0))</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># merge nodes</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5">print "Number
|
|
|
|
of nodes before MergeNodes:", tri_mesh.NbNodes()</p>
|
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">tolerance = 0.001</p>
|
|
|
|
|
|
|
|
<p class="whs5">array_of_nodes_groups
|
|
|
|
= aMeshEditor.FindCoincidentNodes(tolerance)</p>
|
|
|
|
|
|
|
|
<p class="whs5">aMeshEditor.MergeNodes(array_of_nodes_groups)</p>
|
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Number
|
|
|
|
of nodes after MergeNodes:", tri_mesh.NbNodes()</p>
|
|
|
|
|
|
|
|
<p class="whs5">print ""</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Number
|
|
|
|
of elements before MergeEqualElements:"</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Edges
|
|
|
|
:
|
|
|
|
", tri_mesh.NbEdges()</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Triangles
|
|
|
|
: ",
|
|
|
|
tri_mesh.NbTriangles()</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Quadrangles:
|
|
|
|
", tri_mesh.NbQuadrangles()</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Volumes
|
|
|
|
:
|
|
|
|
", tri_mesh.NbVolumes()</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># merge elements</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs5">aMeshEditor.MergeEqualElements()</p>
|
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Number
|
|
|
|
of elements after MergeEqualElements:"</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Edges
|
|
|
|
:
|
|
|
|
", tri_mesh.NbEdges()</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Triangles
|
|
|
|
: ",
|
|
|
|
tri_mesh.NbTriangles()</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Quadrangles:
|
|
|
|
", tri_mesh.NbQuadrangles()</p>
|
|
|
|
|
|
|
|
<p class="whs5">print "Volumes
|
|
|
|
:
|
|
|
|
", tri_mesh.NbVolumes()</p>
|
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">salome.sg.updateObjBrowser(1)
|
2006-05-06 14:51:48 +06:00
|
|
|
</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2005-11-28 14:57:47 +05:00
|
|
|
<h3>Sewing Meshes</h3>
|
|
|
|
|
|
|
|
<h4><a name=bookmark4>Sew Meshes Border to Border</a></h4>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
|
|
|
|
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to sew meshes border to border. </p>
|
|
|
|
|
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
|
|
|
|
|
|
|
<p class="whs7"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs5">import smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create two faces
|
|
|
|
of a box</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">box1 = geompy.MakeBox(0.,
|
|
|
|
0., -10., 30., 20., 25.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">facesList1 = geompy.SubShapeAll(box1,
|
|
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
|
|
|
|
<p class="whs5">face1 = facesList1[2]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">box2 = geompy.MakeBox(0.,
|
|
|
|
5., 0., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">facesList2 = geompy.SubShapeAll(box2,
|
|
|
|
geompy.ShapeType["FACE"])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">face2 = facesList2[1]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">edgesList = geompy.SubShapeAll(face2,
|
|
|
|
geompy.ShapeType["EDGE"])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">edge1 = edgesList[2]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">aComp = geompy.MakeCompound([face1,
|
|
|
|
face2])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">geompy.addToStudy(aComp,
|
|
|
|
"Two faces")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create a mesh on
|
|
|
|
two faces</p>
|
|
|
|
|
|
|
|
<p class="whs5">mesh = smesh.Mesh(aComp,
|
|
|
|
"Two faces : quadrangle mesh")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D = mesh.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D.NumberOfSegments(9)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo2D = mesh.Quadrangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local = mesh.Segment(edge1)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local.Arithmetic1D(1,
|
|
|
|
4)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local.Propagation()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">mesh.Compute()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># sew border to side</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># FirstNodeIDOnFreeBorder,
|
|
|
|
SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># FirstNodeIDOnSide,
|
|
|
|
LastNodeIDOnSide,</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># CreatePolygons, CreatePolyedrs</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">anEditor.SewBorderToSide(5,
|
2006-07-14 16:40:47 +06:00
|
|
|
45, 6, 113, 109, 0, 0) </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<h4><a name=bookmark5>Sew Conform Free Borders</a></h4>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to sew conform free borders. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs5">import smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create two faces
|
|
|
|
of the box</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">box1 = geompy.MakeBox(0.,
|
|
|
|
0., -10., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">facesList1 = geompy.SubShapeAll(box1,
|
|
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
|
|
|
|
<p class="whs5">face1 = facesList1[2]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
|
|
|
<p class="whs5">box2 = geompy.MakeBox(0.,
|
|
|
|
5., 0., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">facesList2 = geompy.SubShapeAll(box2,
|
|
|
|
geompy.ShapeType["FACE"])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">face2 = facesList2[1]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">edgesList = geompy.SubShapeAll(face2,
|
|
|
|
geompy.ShapeType["EDGE"])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">edge1 = edgesList[2]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">aComp = geompy.MakeCompound([face1,
|
|
|
|
face2])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">geompy.addToStudy(aComp,
|
|
|
|
"Two faces")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create a mesh on
|
|
|
|
two faces</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">mesh = smesh.Mesh(aComp,
|
|
|
|
"Two faces : quadrangle mesh")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D = mesh.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D.NumberOfSegments(9)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo2D = mesh.Quadrangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local = mesh.Segment(edge1)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local.Arithmetic1D(1,
|
2005-11-28 14:57:47 +05:00
|
|
|
4)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local.Propagation()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">mesh.Compute()</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># sew conform free
|
|
|
|
borders</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># FirstNodeID1, SecondNodeID1,
|
|
|
|
LastNodeID1, FirstNodeID2, SecondNodeID2</p>
|
|
|
|
|
|
|
|
<p class="whs5">anEditor.SewConformFreeBorders(5,
|
|
|
|
45, 6, 3, 24) </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h4><a name=bookmark6>Sew Free Borders</a></h4>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
|
|
|
|
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to sew free borders. </p>
|
|
|
|
|
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
|
|
|
|
|
|
|
<p class="whs7"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs5">import smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create two faces
|
|
|
|
of the box</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">box1 = geompy.MakeBox(0.,
|
|
|
|
0., 0., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">facesList1 = geompy.SubShapeAll(box1,
|
|
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
|
|
|
|
<p class="whs5">face1 = facesList1[2]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">box2 = geompy.MakeBox(0.,
|
|
|
|
5., 0., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">facesList2 = geompy.SubShapeAll(box2,
|
|
|
|
geompy.ShapeType["FACE"])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">face2 = facesList2[1]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">edgesList = geompy.SubShapeAll(face2,
|
|
|
|
geompy.ShapeType["EDGE"])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">edge1 = edgesList[2]</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">aComp = geompy.MakeCompound([face1,
|
|
|
|
face2])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">geompy.addToStudy(aComp,
|
|
|
|
"Two faces")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create a mesh on
|
|
|
|
two faces</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">mesh = smesh.Mesh(aComp,
|
|
|
|
"Two faces : quadrangle mesh")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D = mesh.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D.NumberOfSegments(4)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo2D = mesh.Quadrangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local = mesh.Segment(edge1)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local.Arithmetic1D(1,
|
2005-11-28 14:57:47 +05:00
|
|
|
4)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local.Propagation()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">mesh.Compute()</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># sew free borders</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># FirstNodeID1, SecondNodeID1,
|
|
|
|
LastNodeID1,</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># FirstNodeID2, SecondNodeID2,
|
|
|
|
LastNodeID2, CreatePolygons, CreatePolyedrs</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs7"><span style="font-family: 'Lucida Console', monospace;">anEditor.SewFreeBorders(6,
|
|
|
|
21, 5, 1, 12, 3, 0, 0)</span> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h4><a name=bookmark7>Sew Side Elements</a></h4>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
|
|
|
|
Attention! This script has been written using the old approach basing
|
|
|
|
on direct usage of SMESH idl interface.</B></font></span></p>
|
|
|
|
|
|
|
|
<p class="whs4"># For the moment smesh package doesn't provide
|
|
|
|
methods to sew side elements. </p>
|
|
|
|
|
|
|
|
<p class="whs4"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs5">import smesh</p>
|
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create two boxes</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">box1 = geompy.MakeBox(0.,
|
|
|
|
0., 0.,
|
|
|
|
10., 10., 10.)</p>
|
|
|
|
|
|
|
|
<p class="whs5">box2 = geompy.MakeBox(0.,
|
|
|
|
15., 0., 20., 25., 10.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2005-11-28 14:57:47 +05:00
|
|
|
<p class="whs5">EdgesList = geompy.SubShapeAll(box2,
|
|
|
|
geompy.ShapeType["EDGE"])</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">aComp = geompy.MakeCompound([box1,
|
|
|
|
box2])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">geompy.addToStudy(aComp,
|
|
|
|
"Two boxes")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># create a mesh on
|
|
|
|
two boxes</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">mesh = smesh.Mesh(aComp,
|
2005-11-28 14:57:47 +05:00
|
|
|
"Two faces : quadrangle mesh")</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D = mesh.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo1D.NumberOfSegments(2)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo2D = mesh.Quadrangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local = mesh.Segment(EdgesList[8])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local.NumberOfSegments(4)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">algo_local.Propagation()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">mesh.Compute()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs5"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># sew side elements</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># IDsOfSide1Elements,
|
|
|
|
IDsOfSide2Elements,</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs6"># NodeID1OfSide1ToMerge,
|
|
|
|
NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs5">anEditor.SewSideElements([69,
|
|
|
|
70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)</p>
|
|
|
|
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
|
|
<!--
|
|
|
|
if (window.writeIntopicBar)
|
|
|
|
writeIntopicBar(0);
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|