mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-12 00:29:17 +05:00
785 lines
17 KiB
HTML
785 lines
17 KiB
HTML
|
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
|
||
|
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<title>Grouping Elements</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">
|
||
|
<!--
|
||
|
p.whs1 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
|
||
|
p.whs2 { margin-top:0pt; margin-bottom:0pt; }
|
||
|
-->
|
||
|
</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 +="</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; }
|
||
|
-->
|
||
|
</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>
|
||
|
</head>
|
||
|
<body><script type="text/javascript" language="javascript1.2">
|
||
|
<!--
|
||
|
if (window.gbWhTopic)
|
||
|
{
|
||
|
if (window.addTocInfo)
|
||
|
{
|
||
|
addTocInfo("MESH module\nTUI Scripts\nGrouping Elements");
|
||
|
addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");
|
||
|
|
||
|
}
|
||
|
if (window.writeBtnStyle)
|
||
|
writeBtnStyle();
|
||
|
|
||
|
if (window.writeIntopicBar)
|
||
|
writeIntopicBar(1);
|
||
|
|
||
|
if (window.setRelStartPage)
|
||
|
{
|
||
|
setRelStartPage("smesh.htm");
|
||
|
|
||
|
autoSync(1);
|
||
|
sendSyncInfo();
|
||
|
sendAveInfoOut();
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
if (window.gbIE4)
|
||
|
document.location.reload();
|
||
|
//-->
|
||
|
</script>
|
||
|
<h1>Grouping Elements</h1>
|
||
|
|
||
|
<h3><a name=bookmark>Create a Group</a></h3>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">import SMESH</p>
|
||
|
|
||
|
<p class="whs1">import SMESH_mechanic</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">smesh =
|
||
|
SMESH_mechanic.smesh</p>
|
||
|
|
||
|
<p class="whs1">mesh =
|
||
|
SMESH_mechanic.mesh</p>
|
||
|
|
||
|
<p class="whs1">salome = SMESH_mechanic.salome</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA >
|
||
|
100</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
100 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs2"># print the result</p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area > 100 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group consisting
|
||
|
of faces with area > 100</p>
|
||
|
|
||
|
<p class="whs1">aGroup = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area > 100" )</p>
|
||
|
|
||
|
<p class="whs1">aGroup.Add( anIds
|
||
|
)</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
||
|
</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<h3><a name=bookmark1>Edit a Group</a></h3>
|
||
|
|
||
|
<p class="whs1">import SMESH</p>
|
||
|
|
||
|
<p class="whs1">import SMESH_mechanic</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">smesh =
|
||
|
SMESH_mechanic.smesh</p>
|
||
|
|
||
|
<p class="whs1">mesh =
|
||
|
SMESH_mechanic.mesh</p>
|
||
|
|
||
|
<p class="whs1">salome = SMESH_mechanic.salome</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA >
|
||
|
20</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
30 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group by adding
|
||
|
elements with area > 20</p>
|
||
|
|
||
|
<p class="whs1">aGroup = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area > 20" )</p>
|
||
|
|
||
|
<p class="whs1">aGroup.Add( anIds
|
||
|
)</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area > 20 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA >
|
||
|
60</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
60 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group of elements
|
||
|
with area [20; 60] by removing elements with area > 60 from group
|
||
|
aGroup </p>
|
||
|
|
||
|
<p class="whs1">aGroup.Remove(anIds)</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs2"># print the result</p>
|
||
|
|
||
|
<p class="whs1">aGroupElemIDs =
|
||
|
aGroup.GetListOfID()</p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
20 < Area < 60 = ", len( aGroupElemIDs )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( aGroupElemIDs ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
aGroupElemIDs[ i ]</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
||
|
</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<h3><a name=bookmark2>Union of two groups</a></h3>
|
||
|
|
||
|
<p class="whs1">import SMESH</p>
|
||
|
|
||
|
<p class="whs1">import SMESH_mechanic</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">smesh =
|
||
|
SMESH_mechanic.smesh</p>
|
||
|
|
||
|
<p class="whs1">mesh =
|
||
|
SMESH_mechanic.mesh</p>
|
||
|
|
||
|
<p class="whs1">salome = SMESH_mechanic.salome</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA >
|
||
|
20</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
20 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group by adding
|
||
|
elements with area > 20</p>
|
||
|
|
||
|
<p class="whs1">aGroup1 = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area > 20" )</p>
|
||
|
|
||
|
<p class="whs1">aGroup1.Add( anIds
|
||
|
)</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area > 20 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA = 20</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateEqualTo()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
20 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group by adding
|
||
|
elements with area > 20</p>
|
||
|
|
||
|
<p class="whs1">aGroup2 = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area = 20" )</p>
|
||
|
|
||
|
<p class="whs1">aGroup2.Add( anIds
|
||
|
)</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area = 20 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs2"># create union group :
|
||
|
area >= 20</p>
|
||
|
|
||
|
<p class="whs1">aGroup3 = mesh.UnionGroups(aGroup1,
|
||
|
aGroup2, "Area >= 20")</p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area >= 20 Nb = ", len( aGroup3.GetListOfID() )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA <
|
||
|
20</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateLessThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
20 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group by adding
|
||
|
elements with area < 20</p>
|
||
|
|
||
|
<p class="whs1">aGroup4 = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area < 20" )</p>
|
||
|
|
||
|
<p class="whs1">aGroup4.Add( anIds
|
||
|
)</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area < 20 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs2"># create union group :
|
||
|
area >= 20 and area < 20</p>
|
||
|
|
||
|
<p class="whs1">aGroup5 = mesh.UnionGroups(aGroup3,
|
||
|
aGroup4, "Any Area")</p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Any Area Nb = ", len( aGroup5.GetListOfID() )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">salome.sg.updateObjBrowser(1)
|
||
|
</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<h3><a name=bookmark3>Intersection of two groups</a></h3>
|
||
|
|
||
|
<p class="whs1">import SMESH</p>
|
||
|
|
||
|
<p class="whs1">import SMESH_mechanic</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">smesh =
|
||
|
SMESH_mechanic.smesh</p>
|
||
|
|
||
|
<p class="whs1">mesh =
|
||
|
SMESH_mechanic.mesh</p>
|
||
|
|
||
|
<p class="whs1">salome = SMESH_mechanic.salome</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA >
|
||
|
20</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
20 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group by adding
|
||
|
elements with area > 20</p>
|
||
|
|
||
|
<p class="whs1">aGroup1 = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area > 20" )</p>
|
||
|
|
||
|
<p class="whs1">aGroup1.Add( anIds
|
||
|
)</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area > 20 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA <
|
||
|
60</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateLessThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
60 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group by adding
|
||
|
elements with area < 60</p>
|
||
|
|
||
|
<p class="whs1">aGroup2 = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area < 60" )</p>
|
||
|
|
||
|
<p class="whs1">aGroup2.Add( anIds
|
||
|
)</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area < 60 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs2"># create an intersection
|
||
|
of groups : 20 < area < 60</p>
|
||
|
|
||
|
<p class="whs1">aGroup3 = mesh.IntersectGroups(aGroup1,
|
||
|
aGroup2, "20 < Area < 60")</p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
20 < Area < 60 Nb = ", len( aGroup3.GetListOfID() )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
||
|
</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<h3><a name=bookmark4>Cut of two groups</a></h3>
|
||
|
|
||
|
<p class="whs1">import SMESH</p>
|
||
|
|
||
|
<p class="whs1">import SMESH_mechanic</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">smesh =
|
||
|
SMESH_mechanic.smesh</p>
|
||
|
|
||
|
<p class="whs1">mesh =
|
||
|
SMESH_mechanic.mesh</p>
|
||
|
|
||
|
<p class="whs1">salome = SMESH_mechanic.salome</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA >
|
||
|
20</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
20 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group by adding
|
||
|
elements with area > 20</p>
|
||
|
|
||
|
<p class="whs1">aGroupMain = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area > 20" )</p>
|
||
|
|
||
|
<p class="whs1">aGroupMain.Add(
|
||
|
anIds )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area > 20 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># Criterion : AREA <
|
||
|
60</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate = aFilterMgr.CreateLessThan()</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetNumFunctor(
|
||
|
aFunctor )</p>
|
||
|
|
||
|
<p class="whs1">aPredicate.SetMargin(
|
||
|
60 )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>
|
||
|
|
||
|
<p class="whs1">aFilter.SetPredicate(
|
||
|
aPredicate )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">anIds = aFilter.GetElementsId(
|
||
|
mesh )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"># create a group by adding
|
||
|
elements with area < 60</p>
|
||
|
|
||
|
<p class="whs1">aGroupTool = mesh.CreateGroup(
|
||
|
SMESH.FACE, "Area < 60" )</p>
|
||
|
|
||
|
<p class="whs1">aGroupTool.Add(
|
||
|
anIds )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area < 60 Nb = ", len( anIds )</p>
|
||
|
|
||
|
<p class="whs1">for i in range(
|
||
|
len( anIds ) ):</p>
|
||
|
|
||
|
<p class="whs1"> print
|
||
|
anIds[ i ]</p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<p class="whs2"># create an intersection
|
||
|
of groups : area >= 60</p>
|
||
|
|
||
|
<p class="whs1">aGroupRes = mesh.CutGroups(aGroupMain,
|
||
|
aGroupTool, "Area >= 60")</p>
|
||
|
|
||
|
<p class="whs1">print "Criterion:
|
||
|
Area >= 60 Nb = ", len( aGroupRes.GetListOfID() )</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs1">salome.sg.updateObjBrowser(1)
|
||
|
</p>
|
||
|
|
||
|
<p class="whs1"> </p>
|
||
|
|
||
|
<p class="whs2"> </p>
|
||
|
|
||
|
<script type="text/javascript" language="javascript1.2">
|
||
|
<!--
|
||
|
if (window.writeIntopicBar)
|
||
|
writeIntopicBar(0);
|
||
|
//-->
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|