geom/doc/salome/gui/GEOM/blocks_operations.htm
2007-02-07 11:23:40 +00:00

289 lines
7.0 KiB
HTML
Executable File

<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
<html>
<head>
<title>Blocks Operations</title>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">
<link rel="stylesheet" href="default_ns.css"><script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">
<!--
if (navigator.appName !="Netscape")
{ document.write("<link rel='stylesheet' href='default.css'>");}
//-->
</script>
<style type="text/css">
<!--
p.whs1 { font-family:'Lucida Console' , monospace; }
p.whs2 { font-family:'Times New Roman' , serif; }
-->
</style><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("Geometry module\nTUI Scripts\nTransformation\nBlocks Operations");
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>Blocks Operations</h1>
<h3><a name=bookmark4>Multi Transformation</a></h3>
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
geompy</span></p>
<p class="whs1">import salome</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">gg = salome.ImportComponentGUI(&quot;GEOM&quot;)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># create vertices</p>
<p class="whs1">p_25_25_50 = geompy.MakeVertex(25.,
25., 50.)</p>
<p class="whs1">p_50_25_25 = geompy.MakeVertex(50.,
25., 25.)</p>
<p class="whs1">p_25_50_25 = geompy.MakeVertex(25.,
50., 25.)</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">box = geompy.MakeBoxDXDYDZ(50,
50, 50)</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">top_face = geompy.GetFaceNearPoint(box,
p_25_25_50)</p>
<p class="whs1">yz_face = geompy.GetFaceNearPoint(box,
p_50_25_25)</p>
<p class="whs1">xz_face = geompy.GetFaceNearPoint(box,
p_25_50_25)</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">top_face_ind = geompy.GetSubShapeID(box,
top_face)</p>
<p class="whs1">yz_face_ind = geompy.GetSubShapeID(box,
yz_face)</p>
<p class="whs1">xz_face_ind = geompy.GetSubShapeID(box,
xz_face)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># Multi-transformate
block and glue the result</p>
<p class="whs1">box_tr1 = geompy.MakeMultiTransformation1D(box,
yz_face_ind, top_face_ind, 3)</p>
<p class="whs1">box_tr2 = geompy.MakeMultiTransformation2D(box,
xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># add objects in the
study</p>
<p class="whs1">id_box = geompy.addToStudy(box,
&quot;Box&quot;)</p>
<p class="whs1">id_box_tr1 = geompy.addToStudy(box_tr1,
&quot;Multi-transformed Block 1D&quot;)</p>
<p class="whs1">id_box_tr2 = geompy.addToStudy(box_tr2,
&quot;Multi-transformed Block 2D&quot;)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># display the results</p>
<p class="whs1">gg.createAndDisplayGO(id_box)</p>
<p class="whs1">gg.setDisplayMode(id_box,1)</p>
<p class="whs1">gg.createAndDisplayGO(id_box_tr1)</p>
<p class="whs1">gg.createAndDisplayGO(id_box_tr2)
</p>
<p class="whs1">&nbsp;</p>
<h3><a name=bookmark5>Explode on Blocks</a></h3>
<p class="whs1">import geompy</p>
<p class="whs1">import salome</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">gg = salome.ImportComponentGUI(&quot;GEOM&quot;)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># create a box and a
sphere</p>
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
200, 200)</p>
<p class="whs1">sphere = geompy.MakeSphereR(100)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># make a compound</p>
<p class="whs1">compound = geompy.MakeCompound([box,
sphere])</p>
<p class="whs2">&nbsp;</p>
<p class="whs2"># get all the blocks
of the given compound, by criteria: min_nb_faces &lt;= nb. of faces &lt;=
max_nb_faces</p>
<p class="whs1">min_nb_faces = 6</p>
<p class="whs1">max_nb_faces = 6</p>
<p class="whs1">make_block_explode
= geompy.MakeBlockExplode(compound, min_nb_faces, max_nb_faces)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># add objects in the
study</p>
<p class="whs1">id_compound = geompy.addToStudy(compound,
&quot;Compound&quot;)</p>
<p class="whs1">id_make_block_explode
= geompy.addToStudyInFather(compound, make_block_explode[0], &quot;MakeBlockExplode&quot;)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># display the results</p>
<p class="whs1">gg.createAndDisplayGO(id_compound)</p>
<p class="whs1">gg.createAndDisplayGO(id_make_block_explode)</p>
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_make_block_explode,1)</span>
</p>
<p>&nbsp;</p>
<h3><a name=bookmark6>Propagate</a></h3>
<p class="whs1">import geompy</p>
<p class="whs1">import salome</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># create a box</p>
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
200, 200)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># build all possible
propagation groups</p>
<p class="whs1">listChains = geompy.Propagate(check_box)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># add objects in the
study</p>
<p class="whs1">geompy.addToStudy(check_box,
&quot;Box&quot;)</p>
<p class="whs1">ii = 1</p>
<p class="whs1">for chain in listChains:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;geompy.addToStudyInFather(check_box,
chain, &quot;propagation chain &quot; + `ii`)</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;ii
= ii + 1</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;pass</p>
<p>&nbsp;</p>
<p><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>