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