geom/doc/salome/gui/GEOM/basic_operations.htm

249 lines
6.1 KiB
HTML
Raw Normal View History

2005-11-24 20:34:00 +05:00
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
<html>
<head>
<title>Basic 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; }
-->
</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; }
2005-11-24 20:34:00 +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>
<script type="text/javascript" language="javascript1.2">
2005-11-24 20:34:00 +05:00
<!--
if (window.gbWhTopic)
{
if (window.setRelStartPage)
2005-11-24 20:34:00 +05:00
{
addTocInfo("Geometry module\nTUI Scripts\nTransformation\nBasic 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");
2005-11-24 20:34:00 +05:00
}
if (window.setRelStartPage)
{
setRelStartPage("index.htm");
2005-11-24 20:34:00 +05:00
autoSync(1);
sendSyncInfo();
sendAveInfoOut();
}
2005-11-24 20:34:00 +05:00
}
else
if (window.gbIE4)
document.location.reload();
//-->
</script>
</head>
<body><script type="text/javascript" language="javascript1.2">
<!--
if (window.writeIntopicBar)
writeIntopicBar(4);
//-->
</script>
2005-11-24 20:34:00 +05:00
<h1>Basic Operations</h1>
<h3><a name=bookmark>Partition</a></h3>
<p class="whs1">import geompy</p>
<p class="whs1">import salome</p>
<p class="whs1">gg = salome.ImportComponentGUI(&quot;GEOM&quot;)</p>
<p>&nbsp;</p>
<p># create a vertex and a vector</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p0 &nbsp;&nbsp;=
geompy.MakeVertex( &nbsp;0.,
&nbsp;&nbsp;0.,
&nbsp;&nbsp;0.)</p>
<p class="whs1">p200 = geompy.MakeVertex(200.,
200., 200.)</p>
<p class="whs1">pz &nbsp;&nbsp;=
geompy.MakeVertex( &nbsp;0.,
&nbsp;&nbsp;0.,
100.)</p>
<p>&nbsp;</p>
<p># create a vector</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">vxyz = geompy.MakeVectorDXDYDZ(100.,
100., 100.)</p>
<p>&nbsp;</p>
<p># create a box from two points</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">box = geompy.MakeBoxTwoPnt(p0,
p200)</p>
<p>&nbsp;</p>
<p># create a plane</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">trimsize &nbsp;=
500.</p>
<p class="whs1">plane = geompy.MakePlane(pz,
vxyz, trimsize)</p>
<p>&nbsp;</p>
<p># create partition objects</p>
<p class="whs1">partition1 = geompy.MakePartition([box],
[plane])</p>
<p class="whs1">partition2 = geompy.Partition([box],
[plane])</p>
<p class="whs1">partition3 = geompy.MakeHalfPartition(box,
plane)</p>
<p class="whs1">&nbsp;</p>
<p># add objects in the study</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">id_box = geompy.addToStudy(box,&quot;Box&quot;)</p>
<p class="whs1">id_plane = geompy.addToStudy(plane,&quot;Plane&quot;)</p>
<p class="whs1">id_partition1 = geompy.addToStudy(partition1,&quot;MakePartition&quot;)</p>
<p class="whs1">id_partition2 = geompy.addToStudy(partition2,&quot;Partition&quot;)</p>
<p class="whs1">id_partition3 = geompy.addToStudy(partition3,&quot;MakeHalfPartition&quot;)</p>
<p>&nbsp;</p>
<p># display the partition objects and the plane</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">gg.createAndDisplayGO(id_box)</p>
<p class="whs1">gg.setDisplayMode(id_box,1)</p>
<p class="whs1">gg.createAndDisplayGO(id_plane)</p>
<p class="whs1">gg.setDisplayMode(id_plane,1)</p>
<p class="whs1">gg.createAndDisplayGO(id_partition1)</p>
<p class="whs1">gg.createAndDisplayGO(id_partition2)</p>
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_partition3)</span>
</p>
<h3><a name=bookmark1>Archimede</a></h3>
<p class="whs1">import geompy</p>
<p class="whs1">import salome</p>
<p class="whs1">gg = salome.ImportComponentGUI(&quot;GEOM&quot;)</p>
<p>&nbsp;</p>
<p># create a vertex and a vector</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p0 &nbsp;&nbsp;=
geompy.MakeVertex( &nbsp;0.,
&nbsp;&nbsp;0.,
&nbsp;&nbsp;0.)</p>
<p class="whs1">p200 = geompy.MakeVertex(200.,
200., 200.)</p>
<p>&nbsp;</p>
<p># create a box from two points</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">box = geompy.MakeBoxTwoPnt(p0,
p200)</p>
<p>&nbsp;</p>
<p># perform an Archimede operation on the selected shape with selected
parameters</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">weight &nbsp;=
1000000.</p>
<p class="whs1">waterdensity = 1.</p>
<p class="whs1">meshingdeflection
= 0.01</p>
<p class="whs1">archimede &nbsp;=
geompy.Archimede(box, weight, waterdensity, meshingdeflection)</p>
<p class="whs1">&nbsp;</p>
<p># add objects in the study</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">id_box = geompy.addToStudy(box,&quot;Box&quot;)</p>
<p class="whs1">id_archimede = geompy.addToStudy(archimede,&quot;Archimede&quot;)</p>
<p>&nbsp;</p>
<p># display the box and the result of Archimede operation</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">gg.createAndDisplayGO(id_box)</p>
<p class="whs1">gg.setDisplayMode(id_box,1)</p>
<p class="whs1">gg.createAndDisplayGO(id_archimede)</p>
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_archimede,1)</span>
</p>
<p>&nbsp;</p>
<script type="text/javascript" language="javascript1.2">
<!--
if (window.writeIntopicBar)
writeIntopicBar(0);
//-->
</script>
</body>
</html>