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

356 lines
9.0 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>Building by Blocks</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; }
2005-11-24 20:34:00 +05:00
-->
</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\nCreating Geometric Objects\nBuilding by Blocks");
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>Building by Blocks</h1>
<h3>Quadrangle Face</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 vertices</p>
<p class="whs1">p1 = geompy.MakeVertex(
&nbsp;0., &nbsp;&nbsp;0.,
&nbsp;&nbsp;0.)</p>
<p class="whs1">p2 = geompy.MakeVertex(150.,
&nbsp;30., &nbsp;&nbsp;0.)</p>
<p class="whs1">p3 = geompy.MakeVertex(
&nbsp;0., 120.,
&nbsp;50.)</p>
<p class="whs1">p4 = geompy.MakeVertex(
&nbsp;0., &nbsp;40.,
&nbsp;70.)</p>
<p>&nbsp;</p>
<p># create edges</p>
<p class="whs1">edge1 = geompy.MakeEdge(p1,
p2)</p>
<p class="whs1">edge2 = geompy.MakeEdge(p2,
p3)</p>
<p class="whs1">edge3 = geompy.MakeEdge(p3,
p4)</p>
<p class="whs1">edge4 = geompy.MakeEdge(p4,
p1)</p>
<p>&nbsp;</p>
<p># create a quadrangle face from four edges</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface1 = geompy.MakeQuad(edge1,
edge2, edge3, edge4)</p>
<p>&nbsp;</p>
<p># create a quadrangle face from two edges</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface2 = geompy.MakeQuad2Edges(edge1,
edge3)</p>
<p>&nbsp;</p>
<p># create a quadrangle from four points in its corners</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface3 = geompy.MakeQuad4Vertices(p1,
p2, p3, p4)</p>
<p>&nbsp;</p>
<p># add objects in the study</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">id_p1 = geompy.addToStudy(p1,&quot;Point1&quot;)</p>
<p class="whs1">id_p2 = geompy.addToStudy(p2,&quot;Point2&quot;)</p>
<p class="whs1">id_p3 = geompy.addToStudy(p3,&quot;Point3&quot;)</p>
<p class="whs1">id_p4 = geompy.addToStudy(p4,&quot;Point4&quot;)</p>
<p class="whs1">id_edge1 = geompy.addToStudy(edge1,&quot;Edge1&quot;)</p>
<p class="whs1">id_edge2 = geompy.addToStudy(edge2,&quot;Edge2&quot;)</p>
<p class="whs1">id_edge3 = geompy.addToStudy(edge3,&quot;Edge3&quot;)</p>
<p class="whs1">id_edge4 = geompy.addToStudy(edge4,&quot;Edge4&quot;)</p>
<p class="whs1">id_qface1 = geompy.addToStudy(qface1,&quot;Qface1&quot;)</p>
<p class="whs1">id_qface2 = geompy.addToStudy(qface2,&quot;Qface2&quot;)</p>
<p class="whs1">id_qface3 = geompy.addToStudy(qface3,&quot;Qface3&quot;)</p>
<p>&nbsp;</p>
<p># display the vertices, the edges and the quadrangle faces</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">gg.createAndDisplayGO(id_p1)</p>
<p class="whs1">gg.createAndDisplayGO(id_p2)</p>
<p class="whs1">gg.createAndDisplayGO(id_p3)</p>
<p class="whs1">gg.createAndDisplayGO(id_p4)</p>
<p class="whs1">gg.createAndDisplayGO(id_edge1)</p>
<p class="whs1">gg.createAndDisplayGO(id_edge2)</p>
<p class="whs1">gg.createAndDisplayGO(id_edge3)</p>
<p class="whs1">gg.createAndDisplayGO(id_edge4)</p>
<p class="whs1">gg.createAndDisplayGO(id_qface1)</p>
<p class="whs1">gg.setDisplayMode(id_qface1,1)</p>
<p class="whs1">gg.createAndDisplayGO(id_qface2)</p>
<p class="whs1">gg.setDisplayMode(id_qface2,1)</p>
<p class="whs1">gg.createAndDisplayGO(id_qface3)</p>
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_qface3,1)</span>
</p>
<h3>Hexagonal Solid</h3>
<p class="whs1">import geompy</p>
<p class="whs1">import salome</p>
<p class="whs1">gg = salome.ImportComponentGUI(&quot;GEOM&quot;)</p>
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs2"># create vertices</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p0 &nbsp;=
geompy.MakeVertex( &nbsp;0.,
&nbsp;&nbsp;0.,
2005-11-24 20:34:00 +05:00
&nbsp;&nbsp;0.)</p>
<p class="whs1">p1 &nbsp;=
geompy.MakeVertex( &nbsp;0.,
&nbsp;&nbsp;0.,
&nbsp;40.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p2 &nbsp;=
geompy.MakeVertex( 70., -15., &nbsp;&nbsp;0.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p3 &nbsp;=
geompy.MakeVertex( 70., -15., &nbsp;70.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p4 &nbsp;=
geompy.MakeVertex( &nbsp;0.,
&nbsp;70., &nbsp;&nbsp;0.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p5 &nbsp;=
geompy.MakeVertex( &nbsp;0.,
&nbsp;70., &nbsp;40.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p6 &nbsp;=
geompy.MakeVertex( 70., &nbsp;70.,
&nbsp;&nbsp;0.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p7 &nbsp;=
geompy.MakeVertex( 70., &nbsp;70.,
&nbsp;70.)</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">p8 &nbsp;=
geompy.MakeVertex( &nbsp;0.,
-50., &nbsp;&nbsp;0.)</p>
<p class="whs1">p9 &nbsp;=
geompy.MakeVertex( &nbsp;0.,
-50., &nbsp;40.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p10 = geompy.MakeVertex(
70., -35., &nbsp;&nbsp;0.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">p11 = geompy.MakeVertex(
70., -35., &nbsp;70.)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs2"># create faces</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface1 = geompy.MakeQuad4Vertices(p0,
p1, p2, p3)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface2 = geompy.MakeQuad4Vertices(p4,
p5, p6, p7)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface3 = geompy.MakeQuad4Vertices(p0,
p1, p4, p5)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface4 = geompy.MakeQuad4Vertices(p2,
p3, p6, p7)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface5 = geompy.MakeQuad4Vertices(p0,
p2, p4, p6)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface6 = geompy.MakeQuad4Vertices(p1,
p3, p5, p7)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">qface7 = geompy.MakeQuad4Vertices(p8,
p9, p10, p11)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs2"># create a hexahedral
solid between two given faces</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">solid1 = geompy.MakeHexa2Faces(qface1,
qface7)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs2"># create a hexahedral
solid, bounded by six given faces</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">solid2 = geompy.MakeHexa(qface1,
qface2, qface3, qface4, qface5, qface6)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs2"># add objects in the
study</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">geompy.addToStudy(qface1,&quot;qface1&quot;)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">geompy.addToStudy(qface2,&quot;qface2&quot;)</p>
<p class="whs1">geompy.addToStudy(qface3,&quot;qface3&quot;)</p>
<p class="whs1">geompy.addToStudy(qface4,&quot;qface4&quot;)</p>
<p class="whs1">geompy.addToStudy(qface5,&quot;qface5&quot;)</p>
<p class="whs1">geompy.addToStudy(qface6,&quot;qface6&quot;)</p>
<p class="whs1">geompy.addToStudy(qface7,&quot;qface7&quot;)</p>
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">id_solid1 = geompy.addToStudy(solid1,&quot;Solid1&quot;)</p>
<p class="whs1">id_solid2 = geompy.addToStudy(solid2,&quot;Solid2&quot;)</p>
<p class="whs1">&nbsp;</p>
2005-11-24 20:34:00 +05:00
<p class="whs2"># display solids</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">gg.createAndDisplayGO(id_solid1)</p>
<p class="whs1">gg.setDisplayMode(id_solid1,
1)</p>
2005-11-24 20:34:00 +05:00
<p class="whs1">gg.createAndDisplayGO(id_solid2)</p>
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_solid2,
1)</span> </p>
2005-11-24 20:34:00 +05:00
<script type="text/javascript" language="javascript1.2">
<!--
if (window.writeIntopicBar)
writeIntopicBar(0);
//-->
</script>
</body>
</html>