2007-02-07 17:14:23 +05:00
|
|
|
<!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; font-family:'Times New Roman' , serif; }
|
|
|
|
p.whs3 { margin-top:0pt; margin-bottom:0pt; }
|
|
|
|
img_whs4 { border:none; width:430px; height:391px; float:none; border-style:none; }
|
|
|
|
img_whs5 { border:none; float:none; width:463px; height:417px; border-style:none; }
|
|
|
|
img_whs6 { border:none; width:541px; height:417px; float:none; border-style:none; }
|
|
|
|
img_whs7 { border:none; width:394px; height:425px; float:none; border-style:none; }
|
|
|
|
img_whs8 { border:none; float:none; width:368px; height:379px; border-style:none; }
|
|
|
|
img_whs9 { border:none; float:none; width:344px; height:381px; border-style:none; }
|
|
|
|
img_whs10 { border:none; width:314px; height:351px; float:none; border-style:none; }
|
|
|
|
img_whs11 { border:none; float:none; width:319px; height:351px; border-style:none; }
|
|
|
|
img_whs12 { border:none; float:none; width:304px; height:352px; border-style:none; }
|
|
|
|
img_whs13 { border:none; width:318px; height:355px; float:none; border-style:none; }
|
|
|
|
img_whs14 { border:none; float:none; width:318px; height:355px; border-style:none; }
|
|
|
|
img_whs15 { border:none; float:none; width:320px; height:354px; border-style:none; }
|
|
|
|
-->
|
|
|
|
</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; }";
|
|
|
|
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; }
|
|
|
|
p.WebHelpNavBar { text-align:right; }
|
|
|
|
-->
|
|
|
|
</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>
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
|
|
<!--
|
|
|
|
if (window.gbWhTopic)
|
|
|
|
{
|
|
|
|
if (window.setRelStartPage)
|
|
|
|
{
|
|
|
|
addTocInfo("MESH module\nTUI Scripts\nGrouping Elements");
|
|
|
|
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");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (window.setRelStartPage)
|
|
|
|
{
|
|
|
|
setRelStartPage("index.htm");
|
|
|
|
|
|
|
|
autoSync(1);
|
|
|
|
sendSyncInfo();
|
|
|
|
sendAveInfoOut();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (window.gbIE4)
|
|
|
|
document.location.reload();
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body><script type="text/javascript" language="javascript1.2">
|
|
|
|
<!--
|
|
|
|
if (window.writeIntopicBar)
|
|
|
|
writeIntopicBar(4);
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
<h1>Grouping Elements</h1>
|
|
|
|
|
|
|
|
<h3><a name=bookmark>Create a Standalone Group</a></h3>
|
|
|
|
|
|
|
|
<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="whs2"># Get ids of all faces
|
|
|
|
with area > 100 </p>
|
|
|
|
|
|
|
|
<p class="whs1">aFilter = smesh.GetFilter(smesh.FACE,
|
|
|
|
smesh.FT_Area, smesh.FT_MoreThan, 100.)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs3"># create a group consisting
|
|
|
|
of faces with area > 100</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup = mesh.MakeGroupByIds("Area
|
|
|
|
> 100", smesh.FACE, anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3"><img src="pics/create_group.png" x-maintain-ratio="TRUE" width="430px" height="391px" border="0" class="img_whs4"></p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark5>Create a Group on Geometry</a></h3>
|
|
|
|
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs1">import smesh</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a box</p>
|
|
|
|
|
|
|
|
<p class="whs1">box = geompy.MakeBox(0.,
|
|
|
|
0., 0., 100., 100., 100.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">geompy.addToStudy(box,
|
|
|
|
"box")</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># add the first face
|
|
|
|
of the box to the study</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">subShapeList
|
|
|
|
= geompy.SubShapeAll(box, geompy.ShapeType["FACE"])</span></p>
|
|
|
|
|
|
|
|
<p class="whs1">face = subShapeList[0]</p>
|
|
|
|
|
|
|
|
<p class="whs1">geompy.addToStudyInFather(box,
|
|
|
|
face, "face 1") </p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create group of edges
|
|
|
|
on the face</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGeomGroupE
|
|
|
|
= geompy.CreateGroup(face, geompy.ShapeType["EDGE"])</span></p>
|
|
|
|
|
|
|
|
<p class="whs1">geompy.AddObject(aGeomGroupE,
|
|
|
|
3)</p>
|
|
|
|
|
|
|
|
<p class="whs1">geompy.AddObject(aGeomGroupE,
|
|
|
|
6)</p>
|
|
|
|
|
|
|
|
<p class="whs1">geompy.AddObject(aGeomGroupE,
|
|
|
|
8)</p>
|
|
|
|
|
|
|
|
<p class="whs1">geompy.AddObject(aGeomGroupE,
|
|
|
|
10)</p>
|
|
|
|
|
|
|
|
<p class="whs1">geompy.addToStudyInFather(face,
|
|
|
|
aGeomGroupE, "Group of Edges")</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create quadrangle
|
|
|
|
2D mesh on the box</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">quadra
|
|
|
|
= smesh.Mesh(box, "Box : quadrangle 2D mesh")</span></p>
|
|
|
|
|
|
|
|
<p class="whs1">algo1D = quadra.Segment()</p>
|
|
|
|
|
|
|
|
<p class="whs1">quadra.Quadrangle()</p>
|
|
|
|
|
|
|
|
<p class="whs1">algo1D.NumberOfSegments(7)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># compute the mesh</p>
|
|
|
|
|
|
|
|
<p class="whs1">quadra.Compute()</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create SMESH group
|
|
|
|
on the face with name "SMESHGroup1"</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aSmeshGroup1
|
|
|
|
= quadra.GroupOnGeom(face, "SMESHGroup1")</span></p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create SMESH group
|
|
|
|
on <aGeomGroupE> with default name</p>
|
|
|
|
|
|
|
|
<p class="whs1">aSmeshGroup2 = quadra.GroupOnGeom(aGeomGroupE)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark1>Edit a Group</a></h3>
|
|
|
|
|
|
|
|
<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="whs2"># Get ids of all faces
|
|
|
|
with area > 35</p>
|
|
|
|
|
|
|
|
<p class="whs1">aFilter = smesh.GetFilter(smesh.FACE,
|
|
|
|
smesh.FT_Area, smesh.FT_MoreThan, 35.)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area > 35, Nb = ", len(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group by
|
|
|
|
adding elements with area > 35</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGroup
|
|
|
|
= mesh.CreateEmptyGroup(smesh.FACE, "Area > 35")</span></p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup.Add(anIds)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># Get ids of all faces
|
|
|
|
with area > 40</p>
|
|
|
|
|
|
|
|
<p class="whs1">aFilter = smesh.GetFilter(smesh.FACE,
|
|
|
|
smesh.FT_Area, smesh.FT_MoreThan, 40.)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area > 40, Nb = ", len(anIds) </p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group of
|
|
|
|
elements with area [35; 40] by removing elements with area > 40 from
|
|
|
|
group aGroup</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup.Remove(anIds)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># print the result</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroupElemIDs =
|
|
|
|
aGroup.GetListOfID()</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
35 < Area < 40, Nb = ", len(aGroupElemIDs)</p>
|
|
|
|
|
|
|
|
<p class="whs1">j = 1</p>
|
|
|
|
|
|
|
|
<p class="whs1">for i in range(len(aGroupElemIDs)):</p>
|
|
|
|
|
|
|
|
<p class="whs1"> if
|
|
|
|
j > 20: j = 1; print ""</p>
|
|
|
|
|
|
|
|
<p class="whs1"> print
|
|
|
|
aGroupElemIDs[i],</p>
|
|
|
|
|
|
|
|
<p class="whs1"> j
|
|
|
|
= j + 1</p>
|
|
|
|
|
|
|
|
<p class="whs1"> pass</p>
|
|
|
|
|
|
|
|
<p class="whs1">print ""</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">salome.sg.updateObjBrowser(1)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3"><img src="pics/editing_groups1.png" x-maintain-ratio="TRUE" width="463px" height="417px" border="0" class="img_whs5"> <img src="pics/editing_groups2.png" x-maintain-ratio="TRUE" width="541px" height="417px" border="0" class="img_whs6"></p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark2>Union of two groups</a></h3>
|
|
|
|
|
|
|
|
<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="whs2"># Criterion : AREA
|
|
|
|
> 20</p>
|
|
|
|
|
|
|
|
<p class="whs1">aFilter = smesh.GetFilter(smesh.FACE,
|
|
|
|
smesh.FT_Area, smesh.FT_MoreThan, 20.)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area > 20, Nb = ", len( anIds ) </p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group by
|
|
|
|
adding elements with area > 20</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE,
|
|
|
|
"Area > 20")</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup1.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># Criterion : AREA
|
|
|
|
= 20</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aFilter
|
|
|
|
= smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 20.)</span></p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area = 20, Nb = ", len( anIds ) </p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group by
|
|
|
|
adding elements with area = 20</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup2 = mesh.CreateEmptyGroup(
|
|
|
|
smesh.FACE, "Area = 20" )</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup2.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create union group
|
|
|
|
: area >= 20</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGroup3
|
|
|
|
= mesh.UnionGroups(aGroup1, aGroup2, "Area >= 20")</span></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="whs1"><span style="font-family: 'Lucida Console', monospace;">aFilter
|
|
|
|
= smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.)</span></p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area < 20, Nb = ", len(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group by
|
|
|
|
adding elements with area < 20</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGroup4
|
|
|
|
= mesh.CreateEmptyGroup(smesh.FACE, "Area < 20")</span></p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup4.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create union group
|
|
|
|
: area >= 20 and area < 20</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGroup5
|
|
|
|
= mesh.UnionGroups(aGroup3, aGroup4, "Any Area")</span></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>
|
|
|
|
|
|
|
|
<p class="whs1"><img src="pics/union_groups1.png" x-maintain-ratio="TRUE" width="394px" height="425px" border="0" class="img_whs7"></p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1"><img src="pics/union_groups2.png" x-maintain-ratio="TRUE" width="368px" height="379px" border="0" class="img_whs8"> <img src="pics/union_groups3.png" x-maintain-ratio="TRUE" width="344px" height="381px" border="0" class="img_whs9"></p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark3>Intersection of two groups</a></h3>
|
|
|
|
|
|
|
|
<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="whs2"># Criterion : AREA
|
|
|
|
> 20</p>
|
|
|
|
|
|
|
|
<p class="whs1">aFilter = smesh.GetFilter(smesh.FACE,
|
|
|
|
smesh.FT_Area, smesh.FT_MoreThan, 20.)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area > 20, Nb = ", len(anIds) </p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group by
|
|
|
|
adding elements with area > 20</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE,
|
|
|
|
"Area > 20")</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup1.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># Criterion : AREA
|
|
|
|
< 60</p>
|
|
|
|
|
|
|
|
<p class="whs1">aFilter = smesh.GetFilter(smesh.FACE,
|
|
|
|
smesh.FT_Area, smesh.FT_LessThan, 60.)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area < 60, Nb = ", len(anIds) </p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group by
|
|
|
|
adding elements with area < 60</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE,
|
|
|
|
"Area < 60")</p>
|
|
|
|
|
|
|
|
<p class="whs1">aGroup2.Add(anIds)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create an intersection
|
|
|
|
of groups : 20 < area < 60</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGroup3
|
|
|
|
= mesh.IntersectGroups(aGroup1, aGroup2, "20 < Area < 60")</span></p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">salome.sg.updateObjBrowser(1)
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
|
|
|
|
<p class="whs3"><img src="pics/intersect_groups1.png" x-maintain-ratio="TRUE" width="314px" height="351px" border="0" class="img_whs10"> <img src="pics/intersect_groups2.png" x-maintain-ratio="TRUE" width="319px" height="351px" border="0" class="img_whs11"> <img src="pics/intersect_groups3.png" x-maintain-ratio="TRUE" width="304px" height="352px" border="0" class="img_whs12"></p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark4>Cut of two groups</a></h3>
|
|
|
|
|
|
|
|
<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="whs2"># Criterion : AREA
|
|
|
|
> 20</p>
|
|
|
|
|
|
|
|
<p class="whs1">aFilter = smesh.GetFilter(smesh.FACE,
|
|
|
|
smesh.FT_Area, smesh.FT_MoreThan, 20.)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area > 20, Nb = ", len(anIds) </p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group by
|
|
|
|
adding elements with area > 20</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGroupMain
|
|
|
|
= mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)</span></p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># Criterion : AREA
|
|
|
|
< 60</p>
|
|
|
|
|
|
|
|
<p class="whs1">aFilter = smesh.GetFilter(smesh.FACE,
|
|
|
|
smesh.FT_Area, smesh.FT_LessThan, 60.)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">anIds = mesh.GetIdsFromFilter(aFilter)</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs1">print "Criterion:
|
|
|
|
Area < 60, Nb = ", len(anIds) </p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a group by
|
|
|
|
adding elements with area < 60</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGroupTool
|
|
|
|
= mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)</span></p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
|
|
|
<p class="whs2"># create a cut of groups
|
|
|
|
: area >= 60</p>
|
|
|
|
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">aGroupRes
|
|
|
|
= mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")</span></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="whs3"><img src="pics/cut_groups1.png" x-maintain-ratio="TRUE" width="318px" height="355px" border="0" class="img_whs13"> <img src="pics/cut_groups2.png" x-maintain-ratio="TRUE" width="318px" height="355px" border="0" class="img_whs14"> <img src="pics/cut_groups3.png" x-maintain-ratio="TRUE" width="320px" height="354px" border="0" class="img_whs15"></p>
|
|
|
|
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
|
|
<!--
|
|
|
|
if (window.writeIntopicBar)
|
|
|
|
writeIntopicBar(0);
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|