2005-11-28 14:57:47 +05:00
|
|
|
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
|
|
|
|
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Quality Controls</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">
|
|
|
|
<!--
|
2006-07-14 16:40:47 +06:00
|
|
|
p.whs1 { margin-top:0pt; margin-bottom:0pt; font-weight:bold; color:#ff0000; }
|
2005-11-28 14:57:47 +05:00
|
|
|
p.whs2 { margin-top:0pt; margin-bottom:0pt; }
|
2006-07-14 16:40:47 +06:00
|
|
|
p.whs3 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
|
|
|
|
p.whs4 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }
|
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 += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";
|
|
|
|
strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";
|
|
|
|
strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";
|
2006-07-14 16:40:47 +06:00
|
|
|
strNSS += "p.whs4 {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\nQuality Controls");
|
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>Quality Controls</h1>
|
|
|
|
|
|
|
|
<h3><a name=bookmark>Free Borders</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># Attention! This script has been written
|
|
|
|
using the old approach basing on direct usage of SMESH idl interface.</p>
|
2006-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check free borders. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs2"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">import salome</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import geompy</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">import smesh</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
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># create open shell: a
|
|
|
|
box without one plane</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeBox(0.,
|
2005-11-28 14:57:47 +05:00
|
|
|
0., 0., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">FaceList = geompy.SubShapeAll(box,
|
2005-11-28 14:57:47 +05:00
|
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">FaceList.remove(FaceList[5])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeShell(FaceList)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">idbox = geompy.addToStudy(box,
|
|
|
|
"box")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs2"># create a mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria = smesh.Mesh(box,
|
|
|
|
"Mesh_free_borders")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.NumberOfSegments(5)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Triangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.MaxElementArea(20.)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria.Compute()</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 = tria.GetMesh()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">gen = smesh.smesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># criterion : free borders</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilterMgr = gen.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate = aFilterMgr.CreateFreeBorders()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Free borders Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.EDGE,
|
|
|
|
"Free borders")</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup.Add(anIds)</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
|
|
|
|
|
|
|
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark1>Borders at Multiconnection</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><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-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check borders at multiconnection. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import salome</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import geompy</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">import smesh</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"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># create open shell:
|
|
|
|
a box without one plane</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeBox(0.,
|
2005-11-28 14:57:47 +05:00
|
|
|
0., 0., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">FaceList = geompy.SubShapeAll(box,
|
2005-11-28 14:57:47 +05:00
|
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">FaceList.remove(FaceList[5])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeShell(FaceList)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">idbox = geompy.addToStudy(box,
|
|
|
|
"box")</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="whs4"># create a mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria = smesh.Mesh(box,
|
|
|
|
"Mesh_borders_at_multi-connections")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.NumberOfSegments(5)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Triangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.MaxElementArea(20.)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria.Compute()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh = tria.GetMesh()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">gen = smesh.smesh</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="whs4"># Criterion : Borders
|
|
|
|
at multi-connection</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">nb_conn = 2</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">aFilterMgr = gen.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateMultiConnection()</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">aPredicate = aFilterMgr.CreateEqualTo()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(nb_conn)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Borders at multi-connections Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</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="whs4"># create a group</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.EDGE,
|
|
|
|
"Borders at multi-connections")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup.Add(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1)
|
2005-11-28 14:57:47 +05:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark2>Length 1D</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><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-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check length 1D. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs2"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import salome</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import geompy</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">import smesh</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
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># create open shell: a
|
|
|
|
box without one plane</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeBox(0.,
|
2005-11-28 14:57:47 +05:00
|
|
|
0., 0., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">FaceList = geompy.SubShapeAll(box,
|
2005-11-28 14:57:47 +05:00
|
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">FaceList.remove(FaceList[5])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeShell(FaceList)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">idbox = geompy.addToStudy(box,
|
|
|
|
"box")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs2"># create a mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria = smesh.Mesh(box,
|
|
|
|
"Mesh_Length_1D")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.NumberOfSegments(5)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Triangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.MaxElementArea(20.)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria.Compute()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh = tria.GetMesh()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">gen = smesh.smesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># Criterion : Length >
|
|
|
|
3.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">length_margin =
|
|
|
|
3.</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">aFilterMgr = gen.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateLength()</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">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(length_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Edges length > ", length_margin, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.EDGE,
|
|
|
|
"Edges with length > " + `length_margin`)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup.Add(anIds)</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="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
|
|
|
</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h3><a name=bookmark3>Free Edges</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><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="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check free edges. </p>
|
2006-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs3"> </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>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">smesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic.salome</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">aFilterMgr = smesh.CreateFilterManager()</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="whs4"># Remove some elements
|
|
|
|
to obtain free edges</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># Criterion : AREA
|
|
|
|
> 95.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">area_margin = 95.</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">aFunctor = aFilterMgr.CreateArea()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(area_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">anEditor = mesh.GetMeshEditor()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">anEditor.RemoveElements(anIds)</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="whs4"># Criterion : Free
|
|
|
|
Edges</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate = aFilterMgr.CreateFreeEdges()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMesh(mesh)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aBorders = aPredicate.GetBorders()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># create groups</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroupF = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Faces with free edges")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroupN = mesh.CreateGroup(SMESH.NODE,
|
|
|
|
"Nodes on free edges")</p>
|
2006-05-06 14:51:48 +06: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="whs4"># fill groups with
|
|
|
|
elements, corresponding to the criterion</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Free edges Nb = ", len(aBorders)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(aBorders)):</p>
|
|
|
|
|
|
|
|
<p class="whs3"> aBorder
|
|
|
|
= aBorders[i]</p>
|
|
|
|
|
|
|
|
<p class="whs3"> print
|
2006-05-06 14:51:48 +06:00
|
|
|
"Face # ", aBorder.myElemId, " : Edge between nodes (",</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
2006-05-06 14:51:48 +06:00
|
|
|
aBorder.myPnt1, ", ", aBorder.myPnt2, ")"</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"> <span
|
|
|
|
style="margin-top: 0pt;
|
|
|
|
margin-bottom: 0pt;
|
|
|
|
font-family: 'Lucida Console', monospace;">aGroupF.Add([aBorder.myElemId])</span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> aGroupN.Add([aBorder.myPnt1,
|
|
|
|
aBorder.myPnt2])</p>
|
2006-05-06 14:51:48 +06: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">salome.sg.updateObjBrowser(1)
|
2005-11-28 14:57:47 +05:00
|
|
|
</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h3><a name=bookmark4>Length 2D</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span><font color=red ><B><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></B></font></span></p>
|
2006-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check length 2D. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import salome</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import geompy</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">import smesh</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"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># create open shell:
|
|
|
|
a box without one plane</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeBox(0.,
|
2005-11-28 14:57:47 +05:00
|
|
|
0., 0., 20., 20., 15.)</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">FaceList = geompy.SubShapeAll(box,
|
2005-11-28 14:57:47 +05:00
|
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">FaceList.remove(FaceList[5])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeShell(FaceList)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">idbox = geompy.addToStudy(box,
|
|
|
|
"box")</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="whs4"># create a mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria = smesh.Mesh(box,
|
|
|
|
"Mesh_Length_2D")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.NumberOfSegments(5)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Triangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.MaxElementArea(20.)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria.Compute()</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 = tria.GetMesh()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">gen = smesh.smesh</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="whs4"># Criterion : Length
|
|
|
|
2D > 5.7</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">length_margin =
|
|
|
|
5.7</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">aFilterMgr = gen.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateLength2D()</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">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(length_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Edges length 2D > ", length_margin, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</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="whs4"># create a group</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Faces with length 2D > " + `length_margin`)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup.Add(anIds)</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">salome.sg.updateObjBrowser(1)
|
|
|
|
</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<h3><a name=bookmark5>Borders at Multiconnection 2D</a></h3>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check borders at multiconnection 2D. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import salome</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import geompy</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">import smesh</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"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs4"># create a compound
|
|
|
|
of two glued boxes</p>
|
2006-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box1 = geompy.MakeBox(0.,
|
|
|
|
0., 0., 20., 20., 15.)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box2 = geompy.MakeTranslation(box1,
|
|
|
|
0., 20., 0)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">comp = geompy.MakeCompound([box1,
|
|
|
|
box2])</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">box = geompy.MakeGlueFaces(comp,
|
|
|
|
0.000001)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">idbox = geompy.addToStudy(box,
|
|
|
|
"box")</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="whs4"># create a mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria = smesh.Mesh(box,
|
|
|
|
"Box compound : 2D triangle mesh")</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Segment()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.NumberOfSegments(5)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo = tria.Triangle()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">algo.MaxElementArea(20.)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">tria.Compute()</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 = tria.GetMesh()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">gen = smesh.smesh</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="whs4"># Criterion : MULTI-CONNECTION
|
|
|
|
2D = 3</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">nb_conn = 3</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">aFilterMgr = gen.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateMultiConnection2D()</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">aPredicate = aFilterMgr.CreateEqualTo()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(nb_conn)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Borders at multi-connection 2D = ", nb_conn, " Nb = ",
|
|
|
|
len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</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="whs4"># create a group</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Borders at multi-connection 2D = " + `nb_conn`)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup.Add(anIds)</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">salome.sg.updateObjBrowser(1)
|
|
|
|
</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
|
|
|
<h3><a name=bookmark6>Area</a></h3>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check area. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs2"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import SMESH</p>
|
|
|
|
|
|
|
|
<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">smesh =
|
|
|
|
SMESH_mechanic.smesh</p>
|
|
|
|
|
|
|
|
<p class="whs3">mesh =
|
|
|
|
SMESH_mechanic.mesh</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic.salome</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># Criterion : AREA >
|
|
|
|
100.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">area_margin = 100.</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">aFilterMgr = smesh.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateArea()</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">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2006-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(area_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Area > ", area_margin, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</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="whs2"># create a group</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Area > " + `area_margin`)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup.Add(anIds)</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="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
|
|
|
</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<h3><a name=bookmark7>Taper</a></h3>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check taper. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs3"> </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">smesh =
|
|
|
|
SMESH_mechanic.smesh</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
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic.salome</p>
|
2006-06-08 20:05:08 +06: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="whs4"># Criterion : Taper
|
|
|
|
> 3e-20</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">taper_margin = 3e-20</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">aFilterMgr = smesh.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateTaper()</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">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(taper_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Taper > ", taper_margin, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</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="whs4"># create a group</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Taper > " + `taper_margin`)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup.Add(anIds)</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">salome.sg.updateObjBrowser(1)
|
2005-11-28 14:57:47 +05:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark8>Aspect Ratio</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
2006-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check aspect ratio. </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import SMESH</p>
|
|
|
|
|
|
|
|
<p class="whs3">import SMESH_mechanic</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">smesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic.salome</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="whs4"># Criterion : ASPECT
|
|
|
|
RATIO > 1.8</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">ar_margin = 1.8</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">aFilterMgr = smesh.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateAspectRatio()</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">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(ar_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
|
|
|
|
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs4"># create a group</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Aspect Ratio > " + `ar_margin`)</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1)
|
2005-11-28 14:57:47 +05:00
|
|
|
</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h3><a name=bookmark9>Minimum Angle</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
|
|
|
|
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check minimum angle. </p>
|
|
|
|
|
|
|
|
<p class="whs1"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2006-06-08 20:05:08 +06: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">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">smesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic.salome</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="whs4"># Criterion : MINIMUM
|
|
|
|
ANGLE < 35.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">min_angle = 35.</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">aFilterMgr = smesh.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateMinimumAngle()</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">aPredicate = aFilterMgr.CreateLessThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(min_angle)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Minimum Angle < ", min_angle, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs4"># create a group</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Minimum Angle < " + `min_angle`)</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1)
|
2005-11-28 14:57:47 +05:00
|
|
|
</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h3><a name=bookmark10>Warping</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
|
|
|
|
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check warping. </p>
|
2006-06-08 20:05:08 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># 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="whs3"> </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>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">smesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic.salome</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="whs4"># Criterion : WARP
|
|
|
|
ANGLE > 1e-15</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">wa_margin = 1e-15</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">aFilterMgr = smesh.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateWarping()</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">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(wa_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Warp > ", wa_margin, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
|
|
|
|
|
|
|
<p class="whs3">print ""</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs4"># create a group</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Warp > " + `wa_margin`)</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1)
|
2005-11-28 14:57:47 +05:00
|
|
|
</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h3><a name=bookmark12>Skew</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
|
|
|
|
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check skew. </p>
|
|
|
|
|
|
|
|
<p class="whs1"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2006-06-08 20:05:08 +06: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">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>
|
|
|
|
|
|
|
|
<p class="whs3">smesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic.mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic.salome</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="whs4"># Criterion : Skew
|
|
|
|
> 38.</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">skew_margin = 38.</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">aFilterMgr = smesh.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateSkew()</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">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(skew_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Skew > ", skew_margin, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs4"># create a group</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE,
|
|
|
|
"Skew > " + `skew_margin`)</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1)
|
2005-11-28 14:57:47 +05:00
|
|
|
</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
|
|
|
<h3><a name=bookmark11>Aspect Ratio 3D</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
|
|
|
|
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check aspect ratio 3D. </p>
|
|
|
|
|
|
|
|
<p class="whs1"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
2006-06-08 20:05:08 +06: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">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_tetra</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">smesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic_tetra.smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh =
|
2005-11-28 14:57:47 +05:00
|
|
|
SMESH_mechanic_tetra.mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic_tetra.salome</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="whs4"># Criterion : ASPECT
|
|
|
|
RATIO 3D > 4.5</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">ar_margin = 4.5</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">aFilterMgr = smesh.CreateFilterManager()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateAspectRatio3D()</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">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(ar_margin)</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">aFilter = aFilterMgr.CreateFilter()</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</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">anIds = aFilter.GetElementsId(mesh)</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="whs4"># print the result</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">j = 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
2005-11-28 14:57:47 +05:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs4"># create a group</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.VOLUME,
|
|
|
|
"Aspect Ratio 3D > " + `ar_margin`)</p>
|
|
|
|
|
|
|
|
<p class="whs3">aGroup.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1)
|
|
|
|
</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<h3><a name=Volume>Volume</a></h3>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><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></B></font></span></p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs1"># For the moment smesh package doesn't provide
|
|
|
|
methods to check volume. </p>
|
|
|
|
|
|
|
|
<p class="whs1"># In the next SALOME version the scripts will
|
|
|
|
be updated to use only the commands from smesh package.</p>
|
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import SMESH</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">import SMESH_mechanic_tetra</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3">smesh =
|
2006-05-06 14:51:48 +06:00
|
|
|
SMESH_mechanic_tetra.smesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">mesh =
|
2006-05-06 14:51:48 +06:00
|
|
|
SMESH_mechanic_tetra.mesh</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">salome = SMESH_mechanic_tetra.salome</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"># Criterion : VOLUME <
|
|
|
|
7.</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">volume_margin =
|
|
|
|
7.</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>
|
|
|
|
|
|
|
|
<p class="whs3">aFunctor = aFilterMgr.CreateVolume3D()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate = aFilterMgr.CreateLessThan()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aPredicate.SetMargin(volume_margin)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aFilter.SetPredicate(aPredicate)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs2"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs2"># print the result</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">print ""</p>
|
|
|
|
|
|
|
|
<p class="whs3">print "Criterion:
|
|
|
|
Volume < ", volume_margin, " Nb = ", len(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs3">j = 1</p>
|
|
|
|
|
|
|
|
<p class="whs3">for i in range(len(anIds)):</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> print
|
|
|
|
anIds[i],</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> j
|
|
|
|
= j + 1</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> pass</p>
|
|
|
|
|
|
|
|
<p class="whs3">print ""</p>
|
|
|
|
|
|
|
|
<p class="whs2"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
<p class="whs2"># create a group</p>
|
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup = mesh.CreateGroup(SMESH.VOLUME,
|
|
|
|
"Volume < " + `volume_margin`)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3">aGroup.Add(anIds)</p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2006-07-14 16:40:47 +06:00
|
|
|
<p class="whs3"> </p>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2005-11-28 14:57:47 +05:00
|
|
|
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
|
|
<!--
|
|
|
|
if (window.writeIntopicBar)
|
|
|
|
writeIntopicBar(0);
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|