Salome HOME
Merge from V6_main 28/02/2013
[modules/geom.git] / doc / salome / examples / 3dsketcher.py
1 # 3D Sketcher
2
3 import geompy
4 import salome
5 gg = salome.ImportComponentGUI("GEOM")
6
7 # Create a 3D sketcher (wire) on the given points coordinates
8 sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,25, 10,20,100, 0,0,0 ])
9
10 # add object in the study
11 id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1")
12
13 # display the sketcher
14 gg.createAndDisplayGO(id_sketcher1)
15
16 # Create a 3D sketcher (wire) with Sketcher3D interface
17
18 # get the interface instance
19 sk = geompy.Sketcher3D()
20
21 # add three points with absolute coordinates
22 # the first point will be the start point of sketcher
23 # two segments will be added by this command
24 sk.addPointsAbsolute(1,2,3, 7,0,0, 10,-3.5,-11)
25
26 # add one segment, defined by two angles in "OXY" coordinate system and length
27 sk.addPointRadiusAnglesRelative(45, 0, 100, "OXY")
28
29 # add three points with relative coordinates
30 # three segments will be added by this command
31 sk.addPointsRelative(20,0,0, 20,0,100, -40,0,-50)
32
33 # set to close the sketcher
34 sk.close()
35
36 # obtain the sketcher result
37 sketcher2 = sk.wire()
38
39 # add object in the study
40 id_sketcher2 = geompy.addToStudy(sketcher2, "Sketcher2")
41
42 # display the sketcher
43 gg.createAndDisplayGO(id_sketcher2)