Salome HOME
Fix wrong comments indentation
[modules/smesh.git] / src / SMESH_SWIG / SMESH_test3.py
1 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3
4 #  This library is free software; you can redistribute it and/or 
5 #  modify it under the terms of the GNU Lesser General Public 
6 #  License as published by the Free Software Foundation; either 
7 #  version 2.1 of the License. 
8
9 #  This library is distributed in the hope that it will be useful, 
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 #  Lesser General Public License for more details. 
13
14 #  You should have received a copy of the GNU Lesser General Public 
15 #  License along with this library; if not, write to the Free Software 
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17
18 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 #
20 #
21 #
22 #  File   : SMESH_test3.py
23 #  Module : SMESH
24
25 #import salome
26 import math
27 import geompy
28
29 pi = math.pi
30
31 # ---------------------------------------------
32 xa = math.sin(pi/12)
33 ya = 0
34 za = math.cos(pi/12)
35
36 xb = 0
37 yb = math.sin(pi/18)
38 zb = math.cos(pi/18)
39
40 xc = math.cos(-pi/18)
41 yc = 0
42 zc = math.sin(-pi/18)
43
44 rc1 = 150
45 rc2 = 150
46 rc3 = 150
47 rc4 = 300
48
49 hc1 = 300
50 hc2 = 2*hc1
51 hc3 = 2*hc1
52 hc4 = 2*hc1
53
54 # ---------------------------------------------
55 point_0 = geompy.MakeVertex(0, 0, 0)
56 point_z = geompy.MakeVertex(0, 0, 1)
57
58 point_a = geompy.MakeVertex(xa, ya, za)
59 point_b = geompy.MakeVertex(xb, yb, zb)
60 point_c = geompy.MakeVertex(xc, yc, zc)
61
62 dir_z = geompy.MakeVector(point_0, point_z)
63 dir_a = geompy.MakeVector(point_0, point_a)
64 dir_b = geompy.MakeVector(point_0, point_b)
65 dir_c = geompy.MakeVector(point_0, point_c)
66
67 axe_z = dir_z
68 axe_a = dir_a
69 axe_b = dir_b
70 axe_c = dir_c
71
72 cyl_1 = geompy.MakeCylinder(point_0, dir_z, rc1, hc1)
73
74 cyl_t = geompy.MakeCylinder(point_0, dir_a, rc2, hc2)
75 cyl_a = geompy.MakeTranslation(cyl_t, 1.2*rc1, 0.1*rc1, -0.5*hc1)
76
77 cyl_t = geompy.MakeCylinder(point_0, dir_b, rc3, hc3)
78 cyl_b = geompy.MakeTranslation(cyl_t, -1.2*rc1, -0.1*rc1, -0.5*hc1)
79
80 cyl_t = geompy.MakeCylinder(point_0, dir_c, rc4, hc4)
81 cyl_t = geompy.MakeRotation(cyl_t, axe_c, pi/2)
82 cyl_c = geompy.MakeTranslation(cyl_t, -hc1, 0, 0)
83 cyl_d = geompy.MakeTranslation(cyl_t, -hc1, 0, 1.3*rc4)
84
85 inter_t = geompy.MakeBoolean(cyl_c,cyl_d, 1) # common
86
87 blob_t = geompy.MakeBoolean(cyl_1, cyl_a, 2) # cut
88 blob_t = geompy.MakeBoolean(blob_t, cyl_b, 2)
89
90 blob = geompy.MakeBoolean(blob_t, inter_t, 1) # common
91
92 idblob = geompy.addToStudy(blob,"blob")
93 #idc = geompy.addToStudy(cyl_c,"cyl_c")
94 #idd = geompy.addToStudy(cyl_d,"cyl_d")