Salome HOME
bos #29468: Advanced geometry features: distance Edge-Edge & Face-Face
[modules/geom.git] / doc / salome / examples / advanced_geom_objs_ex01.py
1 # Creation of PipeTShape
2
3 import salome
4 salome.salome_init_without_session()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
8 gg = salome.ImportComponentGUI("GEOM")
9
10 # create PipeTShape object
11 pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0)
12
13 # add object in the study
14 id_pipetshape = geompy.addToStudy(pipetshape[0],"PipeTShape")
15 # add groups in the study
16 for g in pipetshape[1:]:
17     geompy.addToStudyInFather(pipetshape[0], g, g.GetName())
18     
19 # Create junction vertices
20 P1 = geompy.MakeVertex(0.0, 0.0, 0.0)
21 P2 = geompy.MakeVertex(400.0, 0.0, 0.0)
22 P3 = geompy.MakeVertex(200.0, 0.0, 200.0)
23
24 # create PipeTShape object with position
25 pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3)
26
27 # add object in the study
28 id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_position")
29 # add groups in the study
30 for g in pipetshape_position[1:]:
31     geompy.addToStudyInFather(pipetshape_position[0], g, g.GetName())
32
33 # create PipeTShape object with left thickness reduction
34 pipetshape_thr = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0,
35                                        theRL=60, theWL=20, theLtransL=40, theLthinL=20)
36
37 # add object in the study
38 id_pipetshape_thr = geompy.addToStudy(pipetshape_thr[0],"PipeTShape_left_thickness_reduction")
39 # add groups in the study
40 for g in pipetshape_thr[1:]:
41     geompy.addToStudyInFather(pipetshape_thr[0], g, g.GetName())
42
43 # create PipeTShape with chamfer object
44 pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0)
45
46 # add object in the study
47 id_pipetshapechamfer = geompy.addToStudy(pipetshapechamfer[0],"PipeTShapeChamfer")
48 # add groups in the study
49 for g in pipetshapechamfer[1:]:
50     geompy.addToStudyInFather(pipetshapechamfer[0], g, g.GetName())
51
52 # create PipeTShape with chamfer object with position
53 pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3)
54
55 # add object in the study
56 id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0],"PipeTShapeChamfer_position")
57 # add groups in the study
58 for g in pipetshapechamfer_position[1:]:
59     geompy.addToStudyInFather(pipetshapechamfer_position[0], g, g.GetName())
60
61 # create PipeTShape with chamfer object with left and right thickness reductions
62 pipetshapechamfer_thr = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0,
63                                                      theRL=60, theWL=20, theLtransL=40, theLthinL=20,
64                                                      theRR=40, theWR=10, theLtransR=60, theLthinR=30)
65
66 # add object in the study
67 id_pipetshapechamfer_thr = geompy.addToStudy(pipetshapechamfer_thr[0],"PipeTShapeChamfer_two_thickness_reductions")
68 # add groups in the study
69 for g in pipetshapechamfer_thr[1:]:
70     geompy.addToStudyInFather(pipetshapechamfer_thr[0], g, g.GetName())
71
72 # create PipeTShape with fillet object
73 pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0)
74
75 # add object in the study
76 id_pipetshapefillet = geompy.addToStudy(pipetshapefillet[0],"PipeTShapeFillet")
77 # add groups in the study
78 for g in pipetshapefillet[1:]:
79     geompy.addToStudyInFather(pipetshapefillet[0], g, g.GetName())
80
81 # create PipeTShape with fillet object with position
82 pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3)
83
84 # add object in the study
85 id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"PipeTShapeFillet_position")
86 # add groups in the study
87 for g in pipetshapefillet_position[1:]:
88     geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName())
89
90 # create PipeTShape with fillet object with three thickness reductions
91 pipetshapefillet_thr = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0,
92                                                    5.0, True, None, None, None,
93                                                    60, 20, 40, 20,
94                                                    40, 10, 60, 30,
95                                                    20, 10, 30, 30)
96
97 # add object in the study
98 id_pipetshapefillet_thr = geompy.addToStudy(pipetshapefillet_thr[0],"PipeTShapeFillet_three_thickness_reductions")
99 # add groups in the study
100 for g in pipetshapefillet_thr[1:]:
101     geompy.addToStudyInFather(pipetshapefillet_thr[0], g, g.GetName())
102
103
104 # display pipetshapes
105 gg.createAndDisplayGO(id_pipetshape)
106 gg.createAndDisplayGO(id_pipetshape_position)
107 gg.createAndDisplayGO(id_pipetshape_thr)
108 gg.createAndDisplayGO(id_pipetshapechamfer)
109 gg.createAndDisplayGO(id_pipetshapechamfer_position)
110 gg.createAndDisplayGO(id_pipetshapechamfer_thr)
111 gg.createAndDisplayGO(id_pipetshapefillet)
112 gg.createAndDisplayGO(id_pipetshapefillet_position)
113 gg.createAndDisplayGO(id_pipetshapefillet_thr)