6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI("GEOM")
11 ShapeTypeFace = geompy.ShapeType["FACE"]
13 # create vertices and vectors
14 p0 = geompy.MakeVertex( 0., 0., 0.)
15 px = geompy.MakeVertex(100., 0., 0.)
16 py = geompy.MakeVertex( 0., 100., 0.)
17 pz = geompy.MakeVertex( 0., 0., 100.)
18 vz = geompy.MakeVector(p0, pz)
19 vxy = geompy.MakeVector(px, py)
22 arc = geompy.MakeArc(py, pz, px)
25 wire = geompy.MakeWire([vxy, arc])
27 # create a planar face
28 face = geompy.MakeFace(wire, 1)
31 prism = geompy.MakePrismVecH(face, vz, 100.0)
33 # get the list of IDs (IDList) for the chamfer
34 prism_faces = geompy.SubShapeAllSortedCentres(prism, ShapeTypeFace)
35 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
36 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
37 IDlist_f = [f_ind_1, f_ind_2]
39 # perform a chamfer on the edges common to the specified faces
40 chamfer_e = geompy.MakeChamferEdge(prism, d1, d2, f_ind_1, f_ind_2)
42 # perform a chamfer on all edges of the specified faces
43 chamfer_f = geompy.MakeChamferFaces(prism, d1, d2, IDlist_f)
44 chamfer_f1 = geompy.MakeChamfer(prism, d1, d2, ShapeTypeFace, IDlist_f)
46 # perform a symmetric chamfer on all edges of the given shape
47 chamfer_all = geompy.MakeChamferAll(prism, d1)
49 # add objects in the study
50 id_prism = geompy.addToStudy(prism,"Prism")
51 id_chamfer_e = geompy.addToStudy(chamfer_e,"Chamfer edge")
52 id_chamfer_f = geompy.addToStudy(chamfer_f,"Chamfer faces")
53 id_chamfer_f1 = geompy.addToStudy(chamfer_f1,"Chamfer faces 1")
54 id_chamfer_all = geompy.addToStudy(chamfer_all,"Chamfer all")
56 # display the prism and the results of chamfer operation
57 gg.createAndDisplayGO(id_prism)
58 gg.setDisplayMode(id_prism,1)
59 gg.createAndDisplayGO(id_chamfer_e)
60 gg.setDisplayMode(id_chamfer_e,1)
61 gg.createAndDisplayGO(id_chamfer_f)
62 gg.setDisplayMode(id_chamfer_f,1)
63 gg.createAndDisplayGO(id_chamfer_f1)
64 gg.setDisplayMode(id_chamfer_f1,1)
65 gg.createAndDisplayGO(id_chamfer_all)
66 gg.setDisplayMode(id_chamfer_all,1)