mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-25 08:50:36 +05:00
1071 lines
24 KiB
HTML
Executable File
1071 lines
24 KiB
HTML
Executable File
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
<title>Transformation 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; }
|
|
-->
|
|
</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("Geometry module\nTUI Scripts\nTransformation\nTransformation Operations");
|
|
addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");
|
|
|
|
}
|
|
if (window.writeBtnStyle)
|
|
writeBtnStyle();
|
|
|
|
if (window.writeIntopicBar)
|
|
writeIntopicBar(1);
|
|
|
|
if (window.setRelStartPage)
|
|
{
|
|
setRelStartPage("geom.htm");
|
|
|
|
autoSync(1);
|
|
sendSyncInfo();
|
|
sendAveInfoOut();
|
|
}
|
|
}
|
|
else
|
|
if (window.gbIE4)
|
|
document.location.reload();
|
|
//-->
|
|
</script>
|
|
<h1>Transformation Operations</h1>
|
|
|
|
<h3><a name=bookmark>Translation</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a vertex and a vector</p>
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(10,
|
|
40, 0)</p>
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(
|
|
0, 0, 50)</p>
|
|
|
|
<p class="whs1">p3 = geompy.MakeVertex(50,
|
|
80, 0)</p>
|
|
|
|
<p class="whs1">v = geompy.MakeVector(p1,
|
|
p2)</p>
|
|
|
|
<p class="whs1">vt = geompy.MakeVector(p1,
|
|
p3)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a cylinder</p>
|
|
|
|
<p class="whs1">height = 35</p>
|
|
|
|
<p class="whs1">radius1 = 20</p>
|
|
|
|
<p class="whs1">cylinder = geompy.MakeCylinder(p1,
|
|
v, radius1, height)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># translate the given object along the vector, specified by its end
|
|
points</p>
|
|
|
|
<p># (all three functions produce the same result)</p>
|
|
|
|
<p class="whs1">translation1 = geompy.MakeTranslationTwoPoints(cylinder,
|
|
p1, p3)</p>
|
|
|
|
<p class="whs1">translation2 = geompy.MakeTranslation(cylinder,
|
|
40, 40, 0)</p>
|
|
|
|
<p class="whs1">translation3 = geompy.MakeTranslationVector(cylinder,
|
|
vt)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_cylinder = geompy.addToStudy(cylinder,
|
|
"Cylinder")</p>
|
|
|
|
<p class="whs1">id_translation1 =
|
|
geompy.addToStudy(translation1, "Translation1")</p>
|
|
|
|
<p class="whs1">id_translation2 =
|
|
geompy.addToStudy(translation2, "Translation2")</p>
|
|
|
|
<p class="whs1">id_translation3 =
|
|
geompy.addToStudy(translation3, "Translation3")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the results</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_cylinder)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_cylinder,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_translation1)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_translation1,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_translation2)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_translation2,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_translation3)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_translation3,1)</span>
|
|
</p>
|
|
|
|
<h3><a name=bookmark1>Rotation</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">import math</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a vertex and a vector</p>
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(10,
|
|
40, 0)</p>
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(
|
|
0, 0, 50)</p>
|
|
|
|
<p class="whs1">p3 = geompy.MakeVertex(10,
|
|
50,-20)</p>
|
|
|
|
<p class="whs1">p4 = geompy.MakeVertex(10,
|
|
50, 60)</p>
|
|
|
|
<p class="whs1">v = geompy.MakeVector(p1,
|
|
p2)</p>
|
|
|
|
<p class="whs1">vr = geompy.MakeVector(p3,
|
|
p4)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a cylinder</p>
|
|
|
|
<p class="whs1">height = 35</p>
|
|
|
|
<p class="whs1">radius1 = 20</p>
|
|
|
|
<p class="whs1">cylinder = geompy.MakeCylinder(p1,
|
|
v, radius1, height)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># rotate the given object around the given axis by the given angle</p>
|
|
|
|
<p class="whs1">rotation = geompy.MakeRotation(cylinder,
|
|
vr, math.pi)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_vr = geompy.addToStudy(vr,
|
|
"Rotation axis")</p>
|
|
|
|
<p class="whs1">id_cylinder = geompy.addToStudy(cylinder,
|
|
"Cylinder")</p>
|
|
|
|
<p class="whs1">id_rotation = geompy.addToStudy(rotation,
|
|
"Rotation")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the results</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_vr)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_cylinder)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_cylinder,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_rotation)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_rotation,1)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<h3><a name=bookmark4>Modify Location</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">import math</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a vertex and a vector</p>
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(10,
|
|
40, 0)</p>
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(
|
|
0, 0, 50)</p>
|
|
|
|
<p class="whs1">v = geompy.MakeVector(p1,
|
|
p2)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a cylinder</p>
|
|
|
|
<p class="whs1">height = 35</p>
|
|
|
|
<p class="whs1">radius1 = 20</p>
|
|
|
|
<p class="whs1">cylinder = geompy.MakeCylinder(p1,
|
|
v, radius1, height)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create local coordinate systems</p>
|
|
|
|
<p class="whs1">cs1 = geompy.MakeMarker(
|
|
0, 0, 0, 1,0,0, 0,1,0)</p>
|
|
|
|
<p class="whs1">cs2 = geompy.MakeMarker(30,40,40,
|
|
1,0,0, 0,1,0)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># modify the location of the given object</p>
|
|
|
|
<p class="whs1">position = geompy.MakePosition(cylinder,
|
|
cs1, cs2)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_cs1 = geompy.addToStudy(cs1,
|
|
"Coordinate system 1")</p>
|
|
|
|
<p class="whs1">id_cs2 = geompy.addToStudy(cs2,
|
|
"Coordinate system 2")</p>
|
|
|
|
<p class="whs1">id_cylinder = geompy.addToStudy(cylinder,
|
|
"Cylinder")</p>
|
|
|
|
<p class="whs1">id_position = geompy.addToStudy(position,
|
|
"Position")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p># display the results</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_cylinder)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_cylinder,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_position)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_position,1)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<h3><a name=bookmark5>Mirror Image</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a box</p>
|
|
|
|
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
|
|
200, 200)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an object, symmetrical to the given one relatively the given
|
|
plane</p>
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(
|
|
0, 25, 0)</p>
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(
|
|
5, 25, 0)</p>
|
|
|
|
<p class="whs1">p3 = geompy.MakeVertex(
|
|
0,-30, 40)</p>
|
|
|
|
<p class="whs1">plane = geompy.MakePlaneThreePnt(p1,
|
|
p2, p3, 1000.)</p>
|
|
|
|
<p class="whs1">mirror1 = geompy.MakeMirrorByPlane(box,
|
|
plane)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an object, symmetrical to the given one relatively the given
|
|
axis</p>
|
|
|
|
<p class="whs1">p4 = geompy.MakeVertex(
|
|
210, 210, -20)</p>
|
|
|
|
<p class="whs1">p5 = geompy.MakeVertex(
|
|
210, 210, 220)</p>
|
|
|
|
<p class="whs1">axis = geompy.MakeVector(p4,
|
|
p5)</p>
|
|
|
|
<p class="whs1">mirror2 = geompy.MakeMirrorByAxis(box,
|
|
axis)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an object, symmetrical to the given one relatively the given
|
|
point</p>
|
|
|
|
<p class="whs1">mirror3 = geompy.MakeMirrorByPoint(box,
|
|
p4)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_box = geompy.addToStudy(box,
|
|
"Box")</p>
|
|
|
|
<p class="whs1">id_plane = geompy.addToStudy(plane,
|
|
"Plane")</p>
|
|
|
|
<p class="whs1">id_mirror1 = geompy.addToStudy(mirror1,
|
|
"Mirror plane")</p>
|
|
|
|
<p class="whs1">id_axis = geompy.addToStudy(axis,
|
|
"Axis")</p>
|
|
|
|
<p class="whs1">id_mirror2 = geompy.addToStudy(mirror2,
|
|
"Mirror axis")</p>
|
|
|
|
<p class="whs1">id_p4 = geompy.addToStudy(p4,
|
|
"Point")</p>
|
|
|
|
<p class="whs1">id_mirror3 = geompy.addToStudy(mirror3,
|
|
"Mirror point")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># 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_plane)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_mirror1)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_mirror1,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_axis)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_mirror2)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_mirror2,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p4)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_mirror3)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_mirror3,1)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<h3><a name=bookmark6>Scale Transform </a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a box and a sphere</p>
|
|
|
|
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
|
|
200, 200)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># scale the given object by the factor</p>
|
|
|
|
<p class="whs1">p0 = geompy.MakeVertex(100,
|
|
100, 100)</p>
|
|
|
|
<p class="whs1">factor = 0.5</p>
|
|
|
|
<p class="whs1">scale = geompy.MakeScaleTransform(box,
|
|
p0, factor)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_box = geompy.addToStudy(box,
|
|
"Box")</p>
|
|
|
|
<p class="whs1">id_scale = geompy.addToStudy(scale,
|
|
"Scale")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># 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_scale)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_scale,1)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<h3><a name=bookmark7>Offset Surface</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a box and a sphere</p>
|
|
|
|
<p class="whs1">box = geompy.MakeBox(20,
|
|
20, 20, 200, 200, 200)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a new object as offset of the given object</p>
|
|
|
|
<p class="whs1">offset = geompy.MakeOffset(box,
|
|
70.)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_box = geompy.addToStudy(box,
|
|
"Box")</p>
|
|
|
|
<p class="whs1">id_offset = geompy.addToStudy(offset,
|
|
"Offset")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p># display the results</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_box)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_box,1)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_offset)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<h3><a name=bookmark8>Multi Translation</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create vertices and vectors</p>
|
|
|
|
<p class="whs1">p0 =
|
|
geompy.MakeVertex( 0., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">px =
|
|
geompy.MakeVertex(20., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">py =
|
|
geompy.MakeVertex( 0., 20., 0.)</p>
|
|
|
|
<p class="whs1">pz =
|
|
geompy.MakeVertex( 0., 0.,
|
|
20.)</p>
|
|
|
|
<p class="whs1">pxy = geompy.MakeVertex(
|
|
50., 0., 0.)</p>
|
|
|
|
<p class="whs1">pxyz = geompy.MakeVertex(
|
|
50., 50., 50.)</p>
|
|
|
|
<p class="whs1">vz =
|
|
geompy.MakeVector(p0, pz)</p>
|
|
|
|
<p class="whs1">vxy = geompy.MakeVector(px,
|
|
py)</p>
|
|
|
|
<p class="whs1">vtr1d = geompy.MakeVector(p0,
|
|
pxyz)</p>
|
|
|
|
<p class="whs1">vtr2d = geompy.MakeVector(p0,
|
|
pxy)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an arc</p>
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(py,
|
|
pz, px)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a wire</p>
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vxy,
|
|
arc])</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a planar face</p>
|
|
|
|
<p class="whs1">face = geompy.MakeFace(wire,
|
|
1)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a prism</p>
|
|
|
|
<p class="whs1">prism = geompy.MakePrismVecH(face,
|
|
vz, 20.0)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># translate the given object along the given vector a given number of
|
|
times</p>
|
|
|
|
<p class="whs1">tr1d = geompy.MakeMultiTranslation1D(prism,
|
|
vtr1d, 20, 4)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># consequently apply two specified translations to the object a given
|
|
number of times</p>
|
|
|
|
<p class="whs1">tr2d = geompy.MakeMultiTranslation2D(prism,
|
|
vtr1d, 20, 4, vtr2d, 80, 3)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_prism = geompy.addToStudy(prism,"Prism")</p>
|
|
|
|
<p class="whs1">id_tr1d = geompy.addToStudy(tr1d,"Translation
|
|
1D")</p>
|
|
|
|
<p class="whs1">id_tr2d = geompy.addToStudy(tr2d,"Translation
|
|
2D")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the prism and the results of fillet operation</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_prism)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_prism,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_tr1d)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_tr1d,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_tr2d)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_tr2d,1)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<h3><a name=bookmark9>Multi Rotation</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create vertices and vectors</p>
|
|
|
|
<p class="whs1">p0 =
|
|
geompy.MakeVertex( 0., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">px =
|
|
geompy.MakeVertex(20., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">py =
|
|
geompy.MakeVertex( 0., 20., 0.)</p>
|
|
|
|
<p class="whs1">pz =
|
|
geompy.MakeVertex( 0., 0.,
|
|
20.)</p>
|
|
|
|
<p class="whs1">pxyz = geompy.MakeVertex(
|
|
50., 50., 10.)</p>
|
|
|
|
<p class="whs1">vz =
|
|
geompy.MakeVector(p0, pz)</p>
|
|
|
|
<p class="whs1">vxy = geompy.MakeVector(px,
|
|
py)</p>
|
|
|
|
<p class="whs1">vrot1d = geompy.MakeVector(p0,
|
|
pxyz)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an arc</p>
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(py,
|
|
pz, px)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a wire</p>
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vxy,
|
|
arc])</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a planar face</p>
|
|
|
|
<p class="whs1">face = geompy.MakeFace(wire,
|
|
1)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a prism</p>
|
|
|
|
<p class="whs1">prism = geompy.MakePrismVecH(face,
|
|
vz, 20.0)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># rotate the given object around the given axis by the given angle a
|
|
given number of times</p>
|
|
|
|
<p class="whs1">rot1d = geompy.MultiRotate1D(prism,
|
|
vrot1d, 4)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># rotate the given object around the given axis by the given angle a
|
|
given number of times</p>
|
|
|
|
<p># and multi-translate the result of each rotation</p>
|
|
|
|
<p class="whs1">rot2d = geompy.MultiRotate2D(prism,
|
|
vrot1d, 60, 4, 50, 5)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_prism = geompy.addToStudy(prism,"Prism")</p>
|
|
|
|
<p class="whs1">id_rot1d = geompy.addToStudy(rot1d,"Rotation
|
|
1D")</p>
|
|
|
|
<p class="whs1">id_rot2d = geompy.addToStudy(rot2d,"Rotation
|
|
2D")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the prism and the results of fillet operation</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_prism)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_prism,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_rot1d)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_rot1d,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_rot2d)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_rot2d,1)
|
|
</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<h3><a name=bookmark2>Fillet</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p class="whs1">radius =
|
|
10.</p>
|
|
|
|
<p class="whs1">ShapeTypeEdge = geompy.ShapeType["EDGE"]</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p># create vertices and vectors</p>
|
|
|
|
<p class="whs1">p0 =
|
|
geompy.MakeVertex( 0.,
|
|
0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">px =
|
|
geompy.MakeVertex(100., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">py =
|
|
geompy.MakeVertex( 0.,
|
|
100., 0.)</p>
|
|
|
|
<p class="whs1">pz =
|
|
geompy.MakeVertex( 0.,
|
|
0.,
|
|
100.)</p>
|
|
|
|
<p class="whs1">vz =
|
|
geompy.MakeVector(p0, pz)</p>
|
|
|
|
<p class="whs1">vxy = geompy.MakeVector(px,
|
|
py)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an arc</p>
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(py,
|
|
pz, px)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a wire</p>
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vxy,
|
|
arc])</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a planar face</p>
|
|
|
|
<p class="whs1">face = geompy.MakeFace(wire,
|
|
1)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a prism</p>
|
|
|
|
<p class="whs1">prism = geompy.MakePrismVecH(face,
|
|
vz, 100.0)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># get the list of IDs (IDList) for the fillet</p>
|
|
|
|
<p class="whs1">prism_edges = geompy.SubShapeAllSorted(prism,
|
|
ShapeTypeEdge)</p>
|
|
|
|
<p class="whs1">IDlist_e = []</p>
|
|
|
|
<p class="whs1">IDlist_e.append(geompy.GetSubShapeID(prism,
|
|
prism_edges[0]))</p>
|
|
|
|
<p class="whs1">IDlist_e.append(geompy.GetSubShapeID(prism,
|
|
prism_edges[1]))</p>
|
|
|
|
<p class="whs1">IDlist_e.append(geompy.GetSubShapeID(prism,
|
|
prism_edges[2]))</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># make a fillet on the specified edges of the given shape</p>
|
|
|
|
<p class="whs1">fillet = geompy.MakeFillet(prism,
|
|
radius, ShapeTypeEdge, IDlist_e)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># make a fillet on all edges of the given shape</p>
|
|
|
|
<p class="whs1">filletall = geompy.MakeFilletAll(prism,
|
|
radius)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_prism = geompy.addToStudy(prism,"Prism")</p>
|
|
|
|
<p class="whs1">id_fillet = geompy.addToStudy(fillet,"Fillet")</p>
|
|
|
|
<p class="whs1">id_filletall = geompy.addToStudy(filletall,"Fillet
|
|
all")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the prism and the results of fillet operation</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_prism)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_prism,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_fillet)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_fillet,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_filletall)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_filletall,1)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<h3><a name=bookmark3>Chamfer</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p class="whs1">d1 = 10.</p>
|
|
|
|
<p class="whs1">d2 = 10.</p>
|
|
|
|
<p class="whs1">ShapeTypeFace = geompy.ShapeType["FACE"]</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create vertices and vectors</p>
|
|
|
|
<p class="whs1">p0 =
|
|
geompy.MakeVertex( 0.,
|
|
0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">px =
|
|
geompy.MakeVertex(100., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">py =
|
|
geompy.MakeVertex( 0.,
|
|
100., 0.)</p>
|
|
|
|
<p class="whs1">pz =
|
|
geompy.MakeVertex( 0.,
|
|
0.,
|
|
100.)</p>
|
|
|
|
<p class="whs1">vz =
|
|
geompy.MakeVector(p0, pz)</p>
|
|
|
|
<p class="whs1">vxy = geompy.MakeVector(px,
|
|
py)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an arc</p>
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(py,
|
|
pz, px)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a wire</p>
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vxy,
|
|
arc])</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a planar face</p>
|
|
|
|
<p class="whs1">face = geompy.MakeFace(wire,
|
|
1)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a prism</p>
|
|
|
|
<p class="whs1">prism = geompy.MakePrismVecH(face,
|
|
vz, 100.0)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># get the list of IDs (IDList) for the chamfer</p>
|
|
|
|
<p class="whs1">prism_faces = geompy.SubShapeAllSorted(prism,
|
|
ShapeTypeFace)</p>
|
|
|
|
<p class="whs1">f_ind_1 = geompy.GetSubShapeID(prism,
|
|
prism_faces[0])</p>
|
|
|
|
<p class="whs1">f_ind_2 = geompy.GetSubShapeID(prism,
|
|
prism_faces[1])</p>
|
|
|
|
<p class="whs1">IDlist_f = [f_ind_1,
|
|
f_ind_2]</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># perform a chamfer on the edges common to the specified faces</p>
|
|
|
|
<p class="whs1">chamfer_e = geompy.MakeChamferEdge(prism,
|
|
d1, d2, f_ind_1, f_ind_2)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># perform a chamfer on all edges of the specified faces</p>
|
|
|
|
<p class="whs1">chamfer_f = geompy.MakeChamferFaces(prism,
|
|
d1, d2, IDlist_f)</p>
|
|
|
|
<p class="whs1">chamfer_f1 = geompy.MakeChamfer(prism,
|
|
d1, d2, ShapeTypeFace, IDlist_f)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># perform a symmetric chamfer on all edges of the given shape</p>
|
|
|
|
<p class="whs1">chamfer_all = geompy.MakeChamferAll(prism,
|
|
d1)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_prism = geompy.addToStudy(prism,"Prism")</p>
|
|
|
|
<p class="whs1">id_chamfer_e = geompy.addToStudy(chamfer_e,"Chamfer
|
|
edge")</p>
|
|
|
|
<p class="whs1">id_chamfer_f = geompy.addToStudy(chamfer_f,"Chamfer
|
|
faces")</p>
|
|
|
|
<p class="whs1">id_chamfer_f1 = geompy.addToStudy(chamfer_f1,"Chamfer
|
|
faces 1")</p>
|
|
|
|
<p class="whs1">id_chamfer_all = geompy.addToStudy(chamfer_all,"Chamfer
|
|
all")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the prism and the results of chamfer operation</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_prism)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_prism,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_chamfer_e)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_chamfer_e,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_chamfer_f)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_chamfer_f,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_chamfer_f1)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_chamfer_f1,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_chamfer_all)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_chamfer_all,1)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<p> </p>
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
<!--
|
|
if (window.writeIntopicBar)
|
|
writeIntopicBar(0);
|
|
//-->
|
|
</script>
|
|
</body>
|
|
</html>
|