]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM_SWIG/GEOM_Partition1.py
Salome HOME
Merge with PAL/SALOME 2.1.0d
[modules/geom.git] / src / GEOM_SWIG / GEOM_Partition1.py
1 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
2 #
3 #  Copyright (C) 2003  CEA/DEN, EDF R&D
4 #
5 #
6 #
7 #  File   : GEOM_Partition1.py
8 #  Module : GEOM
9
10 #%Make geometry (like CEA script (A1)) using Partition algorithm%
11 # appel:
12 # import alveole_3D_01_GEOM
13 # reload(alveole_3D_01_GEOM)
14
15 # -- Rayon de la bariere
16
17 barier_height = 7.0
18 barier_radius = 5.6 / 2 # Rayon de la bariere
19 colis_radius = 1.0 / 2  # Rayon du colis
20 colis_step = 2.0        # Distance s\89parant deux colis
21 cc_width = 0.11         # Epaisseur du complement de colisage
22
23 # --
24
25 cc_radius = colis_radius + cc_width
26 from math import sqrt
27 colis_center = sqrt(2.0)*colis_step/2
28
29 # --
30
31 import geompy
32 geom = geompy.geom
33
34 boolean_common  = 1
35 boolean_cut     = 2
36 boolean_fuse    = 3
37 boolean_section = 4
38
39 # --
40
41 pnt0 = geompy.MakeVertex(0.,0.,0.)
42 vecz = geompy.MakeVectorDXDYDZ(0.,0.,1.)
43
44 barier = geompy.MakeCylinder(
45     pnt0,
46     vecz,
47     barier_radius,
48     barier_height)
49
50 # --
51
52 colis = geompy.MakeCylinder(pnt0, vecz, colis_radius, barier_height)
53
54 cc = geompy.MakeCylinder(pnt0, vecz, cc_radius, barier_height)
55
56 colis_cc = geompy.MakeCompound([colis, cc])
57
58 colis_cc = geompy.MakeTranslation(colis_cc, colis_center, 0.0, 0.0)
59
60 colis_cc_multi = geompy.MultiRotate1D(colis_cc, vecz, 4)
61
62 # --
63
64 alveole = geompy.MakePartition([colis_cc_multi, barier])
65
66 geompy.addToStudy(alveole, "alveole before explode")
67
68 subshapes = geompy.SubShapeAll(alveole, geompy.ShapeType["SHAPE"])
69
70 ## there are 9 subshapes
71
72 comp1 = geompy.MakeCompound([subshapes[0], subshapes[1]]);
73 comp2 = geompy.MakeCompound([subshapes[2], subshapes[3]]);
74 comp3 = geompy.MakeCompound([subshapes[4], subshapes[5]]);
75 comp4 = geompy.MakeCompound([subshapes[6], subshapes[7]]);
76
77 compGOs = []
78 compGOs.append(comp1);
79 compGOs.append(comp2);
80 compGOs.append(comp3);
81 compGOs.append(comp4);
82 comp = geompy.MakeCompound(compGOs);
83
84 alveole = geompy.MakeCompound([comp, subshapes[8]]);
85
86 geompy.addToStudy(alveole, "alveole")