mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-16 02:28:35 +05:00
82 lines
2.1 KiB
Plaintext
82 lines
2.1 KiB
Plaintext
|
/*!
|
||
|
|
||
|
\page tui_basic_operations_page Basic Operations
|
||
|
|
||
|
\anchor tui_partition
|
||
|
<br><h2>Partition</h2>
|
||
|
|
||
|
\code
|
||
|
import geompy
|
||
|
import salome
|
||
|
gg = salome.ImportComponentGUI("GEOM")
|
||
|
|
||
|
# create a vertex and a vector
|
||
|
p0 = geompy.MakeVertex( 0., 0., 0.)
|
||
|
p200 = geompy.MakeVertex(200., 200., 200.)
|
||
|
pz = geompy.MakeVertex( 0., 0., 100.)
|
||
|
|
||
|
# create a vector
|
||
|
vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.)
|
||
|
|
||
|
# create a box from two points
|
||
|
box = geompy.MakeBoxTwoPnt(p0, p200)
|
||
|
|
||
|
# create a plane
|
||
|
trimsize = 500.
|
||
|
plane = geompy.MakePlane(pz, vxyz, trimsize)
|
||
|
|
||
|
# create partition objects
|
||
|
partition1 = geompy.MakePartition([box], [plane])
|
||
|
partition2 = geompy.Partition([box], [plane])
|
||
|
partition3 = geompy.MakeHalfPartition(box, plane)
|
||
|
|
||
|
# add objects in the study
|
||
|
id_box = geompy.addToStudy(box,"Box")
|
||
|
id_plane = geompy.addToStudy(plane,"Plane")
|
||
|
id_partition1 = geompy.addToStudy(partition1,"MakePartition")
|
||
|
id_partition2 = geompy.addToStudy(partition2,"Partition")
|
||
|
id_partition3 = geompy.addToStudy(partition3,"MakeHalfPartition")
|
||
|
|
||
|
# display the partition objects and the plane
|
||
|
gg.createAndDisplayGO(id_box)
|
||
|
gg.setDisplayMode(id_box,1)
|
||
|
gg.createAndDisplayGO(id_plane)
|
||
|
gg.setDisplayMode(id_plane,1)
|
||
|
gg.createAndDisplayGO(id_partition1)
|
||
|
gg.createAndDisplayGO(id_partition2)
|
||
|
gg.createAndDisplayGO(id_partition3)
|
||
|
\endcode
|
||
|
|
||
|
\anchor tui_archimede
|
||
|
<br><h2>Archimede</h2>
|
||
|
|
||
|
\code
|
||
|
import geompy
|
||
|
import salome
|
||
|
gg = salome.ImportComponentGUI("GEOM")
|
||
|
|
||
|
# create a vertex and a vector
|
||
|
p0 = geompy.MakeVertex( 0., 0., 0.)
|
||
|
p200 = geompy.MakeVertex(200., 200., 200.)
|
||
|
|
||
|
# create a box from two points
|
||
|
box = geompy.MakeBoxTwoPnt(p0, p200)
|
||
|
|
||
|
# perform an Archimede operation on the selected shape with selected parameters
|
||
|
weight = 1000000.
|
||
|
waterdensity = 1.
|
||
|
meshingdeflection = 0.01
|
||
|
archimede = geompy.Archimede(box, weight, waterdensity, meshingdeflection)
|
||
|
|
||
|
# add objects in the study
|
||
|
id_box = geompy.addToStudy(box,"Box")
|
||
|
id_archimede = geompy.addToStudy(archimede,"Archimede")
|
||
|
|
||
|
# display the box and the result of Archimede operation
|
||
|
gg.createAndDisplayGO(id_box)
|
||
|
gg.setDisplayMode(id_box,1)
|
||
|
gg.createAndDisplayGO(id_archimede)
|
||
|
gg.setDisplayMode(id_archimede,1)
|
||
|
\endcode
|
||
|
|
||
|
*/
|