1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
25 # File : GEOM_example4.py
36 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
37 myBuilder = salome.myStudy.NewBuilder()
38 #from geompy import gg
40 #smeshgui = salome.ImportComponentGUI("SMESH")
41 #smeshgui.Init(salome.myStudyId);
43 ShapeTypeCompSolid = 1
53 # ---------------------------------------------
71 # ---------------------------------------------
72 point_0 = geompy.MakeVertex(0, 0, 0)
73 point_z = geompy.MakeVertex(0, 0, 1)
75 point_a = geompy.MakeVertex(xa, ya, za)
76 point_b = geompy.MakeVertex(xb, yb, zb)
77 point_c = geompy.MakeVertex(xc, yc, zc)
79 dir_z = geompy.MakeVector(point_0,point_z)
80 dir_a = geompy.MakeVector(point_0,point_a)
81 dir_b = geompy.MakeVector(point_0,point_b)
82 dir_c = geompy.MakeVector(point_0,point_c)
84 cyl_1 = geompy.MakeCylinder(point_0, dir_z, rc1, hc1)
87 cyl_t = geompy.MakeCylinder(point_0, dir_a, rc2, hc2)
88 cyl_a = geompy.MakeTranslation(cyl_t, 1.2*rc1, 0.1*rc1, -0.5*hc1)
91 cyl_t = geompy.MakeCylinder(point_0, dir_b, rc3, hc3)
92 cyl_b = geompy.MakeTranslation(cyl_t, -1.2*rc1, -0.1*rc1, -0.5*hc1)
95 cyl_t = geompy.MakeCylinder(point_0, dir_c, rc4, hc4)
96 cyl_t = geompy.MakeRotation(cyl_t, dir_c, pi/2)
97 cyl_c = geompy.MakeTranslation(cyl_t, -hc1, 0, 0)
98 cyl_d = geompy.MakeTranslation(cyl_t, -hc1, 0, 1.3*rc4)
100 inter_t = geompy.MakeBoolean(cyl_c,cyl_d, 1) # common
102 blob_t = geompy.MakeBoolean(cyl_1, cyl_a, 2) # cut
103 blob_t = geompy.MakeBoolean(blob_t, cyl_b, 2)
105 blob = geompy.MakeBoolean(blob_t, inter_t, 1) # common
107 idblob = geompy.addToStudy(blob,"blob")
108 #idc = geompy.addToStudy(cyl_c,"cyl_c")
109 #idd = geompy.addToStudy(cyl_d,"cyl_d")