Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
3D Sketcher
1 # 3D Sketcher
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 a 3D sketcher (wire) on the given points coordinates
11 sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,25, 10,20,100, 0,0,0 ])
12 
13 # add object in the study
14 id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1")
15 
16 # display the sketcher
17 gg.createAndDisplayGO(id_sketcher1)
18 
19 # Create a 3D sketcher (wire) with Sketcher3D interface
20 
21 # get the interface instance
22 sk = geompy.Sketcher3D()
23 
24 # add three points with absolute coordinates
25 # the first point will be the start point of sketcher
26 # two segments will be added by this command
27 sk.addPointsAbsolute(1,2,3, 7,0,0, 10,-3.5,-11)
28 
29 # add one segment, defined by two angles in "OXY" coordinate system and length
30 sk.addPointRadiusAnglesRelative(45, 0, 100, "OXY")
31 
32 # add three points with relative coordinates
33 # three segments will be added by this command
34 sk.addPointsRelative(20,0,0, 20,0,100, -40,0,-50)
35 
36 # set to close the sketcher
37 sk.close()
38 
39 # obtain the sketcher result
40 sketcher2 = sk.wire()
41 
42 # add object in the study
43 id_sketcher2 = geompy.addToStudy(sketcher2, "Sketcher2")
44 
45 # display the sketcher
46 gg.createAndDisplayGO(id_sketcher2)

Download this script