mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-16 02:28:35 +05:00
194 lines
4.9 KiB
Plaintext
194 lines
4.9 KiB
Plaintext
/*!
|
|
|
|
\page tui_complex_objs_page Complex Objects
|
|
|
|
\anchor tui_creation_prism
|
|
<br><h2>Creation of a Prism</h2>
|
|
|
|
\code
|
|
import geompy
|
|
import salome
|
|
gg = salome.ImportComponentGUI("GEOM")
|
|
|
|
# create a vertex and a vector
|
|
p1 = geompy.MakeVertex( 0., 0., 0.)
|
|
p2 = geompy.MakeVertex( 100., 0., 0.)
|
|
p3 = geompy.MakeVertex( 100., 100., 0.)
|
|
p4 = geompy.MakeVertex( 0., 100., 0.)
|
|
p5 = geompy.MakeVertex( 0., 0., 60.)
|
|
p6 = geompy.MakeVertex(-100., 0., 0.)
|
|
p7 = geompy.MakeVertex(-100.,-100., 0.)
|
|
p8 = geompy.MakeVertex( 0.,-100., 0.)
|
|
|
|
# create a vector from the given components
|
|
vector = geompy.MakeVectorDXDYDZ(50., 50., 50.)
|
|
|
|
#create vectors from two points
|
|
vector1_arc1 = geompy.MakeVector(p1, p2)
|
|
vector2_arc1 = geompy.MakeVector(p1, p4)
|
|
vector1_arc2 = geompy.MakeVector(p1, p6)
|
|
vector2_arc2 = geompy.MakeVector(p1, p8)
|
|
|
|
# create arcs from three points
|
|
arc1 = geompy.MakeArc(p2, p3, p4)
|
|
arc2 = geompy.MakeArc(p6, p7, p8)
|
|
|
|
# create wires
|
|
wire1 = geompy.MakeWire([vector1_arc1, arc1, vector2_arc1])
|
|
wire2 = geompy.MakeWire([vector1_arc2, arc2, vector2_arc2])
|
|
|
|
# create faces
|
|
isPlanarWanted = 1
|
|
face1 = geompy.MakeFace(wire1, isPlanarWanted)
|
|
face2 = geompy.MakeFace(wire2, isPlanarWanted)
|
|
|
|
# create prisms
|
|
prism1 = geompy.MakePrism(face2, p1, p5)
|
|
prism2 = geompy.MakePrismVecH(face1, vector, 50)
|
|
prism3 = geompy.MakePrismVecH2Ways(face1, vector, 50)
|
|
|
|
# add objects in the study
|
|
id_face1 = geompy.addToStudy(face1,"Face1")
|
|
id_face2 = geompy.addToStudy(face2,"Face2")
|
|
id_prism1 = geompy.addToStudy(prism1,"Prism1")
|
|
id_prism2 = geompy.addToStudy(prism2,"Prism2")
|
|
id_prism3 = geompy.addToStudy(prism3,"Prism3")
|
|
|
|
# display cylinders
|
|
gg.createAndDisplayGO(id_face1)
|
|
gg.setDisplayMode(id_face1,1)
|
|
gg.createAndDisplayGO(id_face2)
|
|
gg.setDisplayMode(id_face2,1)
|
|
gg.createAndDisplayGO(id_prism1)
|
|
gg.setDisplayMode(id_prism1,1)
|
|
gg.createAndDisplayGO(id_prism2)
|
|
gg.setDisplayMode(id_prism2,1)
|
|
gg.createAndDisplayGO(id_prism3)
|
|
gg.setDisplayMode(id_prism3,1)
|
|
\endcode
|
|
|
|
\anchor tui_creation_revolution
|
|
<br><h2>Creation of a Revolution</h2>
|
|
|
|
\code
|
|
import geompy
|
|
import salome
|
|
gg = salome.ImportComponentGUI("GEOM")
|
|
|
|
# create a vertex and a vector
|
|
p1 = geompy.MakeVertex( 10., 10., 10.)
|
|
p2 = geompy.MakeVertex( 15., 15., 50.)
|
|
p3 = geompy.MakeVertex( 40., 40., 0.)
|
|
|
|
#create vectors from two points
|
|
vector1 = geompy.MakeVector(p1, p2)
|
|
vector2 = geompy.MakeVector(p1, p3)
|
|
|
|
# create a vector from the given components
|
|
vector3 = geompy.MakeVectorDXDYDZ(-20., -20., 100.)
|
|
|
|
# create a wire
|
|
wire = geompy.MakeWire([vector1, vector2])
|
|
|
|
# create a revolution
|
|
revolution = geompy.MakeRevolution(wire, vector3, 2.3)
|
|
|
|
# add objects in the study
|
|
id_vector3 = geompy.addToStudy(vector3,"Axis")
|
|
id_wire = geompy.addToStudy(wire,"Wire")
|
|
id_revolution = geompy.addToStudy(revolution,"Revolution")
|
|
|
|
# display the vector, the wire and the revolution
|
|
gg.createAndDisplayGO(id_vector3)
|
|
gg.createAndDisplayGO(id_wire)
|
|
gg.createAndDisplayGO(id_revolution)
|
|
gg.setDisplayMode(id_revolution,1)
|
|
\endcode
|
|
|
|
\anchor tui_creation_filling
|
|
<br><h2>Creation of a Filling</h2>
|
|
|
|
\code
|
|
import geompy
|
|
import salome
|
|
gg = salome.ImportComponentGUI("GEOM")
|
|
|
|
mindeg = 2
|
|
maxdeg = 5
|
|
tol3d = 0.0001
|
|
tol2d = 0.0001
|
|
nbiter = 5
|
|
|
|
# create a vertex and a vector
|
|
p1 = geompy.MakeVertex( -30., -30., 50.)
|
|
p2 = geompy.MakeVertex( -60., -60., 30.)
|
|
p3 = geompy.MakeVertex( -30., -30., 10.)
|
|
|
|
# create an arc from three points
|
|
arc = geompy.MakeArc(p1, p2, p3)
|
|
ShapeListCompound = []
|
|
i = 0
|
|
while i <= 3 :
|
|
S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
|
|
ShapeListCompound.append(S)
|
|
i = i + 1
|
|
|
|
compound = geompy.MakeCompound(ShapeListCompound)
|
|
|
|
# create a filling
|
|
filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)
|
|
|
|
# add objects in the study
|
|
id_compound = geompy.addToStudy(compound,"Compound")
|
|
id_filling = geompy.addToStudy(filling,"Filling")
|
|
|
|
# display the compound and the filling
|
|
gg.createAndDisplayGO(id_compound)
|
|
gg.createAndDisplayGO(id_filling)
|
|
gg.setDisplayMode(id_filling,1)
|
|
\endcode
|
|
|
|
\anchor tui_creation_pipe
|
|
<br><h2>Creation of a Pipe</h2>
|
|
|
|
\code
|
|
import geompy
|
|
import salome
|
|
gg = salome.ImportComponentGUI("GEOM")
|
|
|
|
# create vertices
|
|
p0 = geompy.MakeVertex(0. , 0. , 0. )
|
|
px = geompy.MakeVertex(100., 0. , 0. )
|
|
py = geompy.MakeVertex(0. , 100., 0. )
|
|
pz = geompy.MakeVertex(0. , 0. , 100.)
|
|
pxyz = geompy.MakeVertex(100., 100., 100.)
|
|
|
|
# create a vector from two points
|
|
vxy = geompy.MakeVector(px, py)
|
|
|
|
# create an arc from three points
|
|
arc = geompy.MakeArc(py, pz, px)
|
|
|
|
# create a wire
|
|
wire = geompy.MakeWire([vxy, arc])
|
|
|
|
# create an edge
|
|
edge = geompy.MakeEdge(p0, pxyz)
|
|
|
|
# create a pipe
|
|
pipe = geompy.MakePipe(wire, edge)
|
|
|
|
# add objects in the study
|
|
id_wire = geompy.addToStudy(wire,"Wire")
|
|
id_edge = geompy.addToStudy(edge,"Edge")
|
|
id_pipe = geompy.addToStudy(pipe,"Pipe")
|
|
|
|
# display the wire, the edge (path) and the pipe
|
|
gg.createAndDisplayGO(id_wire)
|
|
gg.createAndDisplayGO(id_edge)
|
|
gg.createAndDisplayGO(id_pipe)
|
|
gg.setDisplayMode(id_pipe,1)
|
|
\endcode
|
|
|
|
*/
|