Salome HOME
Revert "Synchronize adm files"
[modules/geom.git] / doc / salome / examples / basic_geom_objs_ex08.py
1 # Creation of a Plane
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI("GEOM")
9
10 # create vertices
11 p1 = geompy.MakeVertex(  0.,   0., 100.)
12 p2 = geompy.MakeVertex(100.,   0.,   0.)
13 p3 = geompy.MakeVertex(200., 200., 200.)
14 p4 = geompy.MakeVertex(100., 100.,   0.)
15 p5 = geompy.MakeVertex(0.  , 100.,   0.)
16
17 # create a vectors from the given components
18 vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
19 vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
20
21 # create a vector from two points
22 vector_arc = geompy.MakeVector(p2, p5)
23
24 # create an arc from three points
25 arc = geompy.MakeArc(p2, p4, p5)
26
27 # create a wire
28 wire = geompy.MakeWire([vector_arc, arc])
29
30 # create a face
31 isPlanarWanted = 1
32 face = geompy.MakeFace(wire, isPlanarWanted)
33 trimsize = 1000.
34
35 # create a Local Coordinate System
36
37 LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
38
39 # create a plane from a point, a vector and a trimsize
40 plane1 = geompy.MakePlane(p1, vector1, trimsize)
41
42 # create a plane from three points and a trimsize
43 plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
44
45 # create a plane from the given face
46 plane3 = geompy.MakePlaneFace(face, trimsize)
47
48 # create a plane from two vectors and a trimsize
49 plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
50
51 # create a plane with the Local Coordinate System and a trimsize
52 plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
53
54 # add objects in the study
55 id_face   = geompy.addToStudy(face,  "Face")
56 id_plane1 = geompy.addToStudy(plane1,"Plane1")
57 id_plane2 = geompy.addToStudy(plane2,"Plane2")
58 id_plane3 = geompy.addToStudy(plane3,"Plane3")
59 id_plane4 = geompy.addToStudy(plane4,"Plane4")
60 id_plane5 = geompy.addToStudy(plane5,"Plane5")
61
62 # display the points and the vectors
63 gg.createAndDisplayGO(id_face)
64 gg.createAndDisplayGO(id_plane1)
65 gg.createAndDisplayGO(id_plane2)
66 gg.createAndDisplayGO(id_plane3)
67 gg.createAndDisplayGO(id_plane4)
68 gg.createAndDisplayGO(id_plane5)
69 gg.setDisplayMode(id_plane1,1)
70 gg.setTransparency(id_plane1,0.5)
71 gg.setDisplayMode(id_plane2,1)
72 gg.setTransparency(id_plane2,0.5)
73 gg.setDisplayMode(id_plane3,1)
74 gg.setTransparency(id_plane3,0.5)
75 gg.setDisplayMode(id_plane4,1)
76 gg.setTransparency(id_plane4,0.5)
77 gg.setDisplayMode(id_plane5,1)
78 gg.setTransparency(id_plane5,0.5)