Salome HOME
Merge from V5_1_main 14/05/2010
[modules/geom.git] / src / GEOM_SWIG / GEOM_ObjectInfo.py
1 #  -*- coding: iso-8859-1 -*-
2 #  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
22 #  File   : GEOM_ObjectInfo.py
23 #  Author : Michael ZORIN
24 #  Module : GEOM
25 #  $Header: 
26 #
27 import salome
28 import geompy
29
30 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
31
32 # Create several objects
33 obj1 = geompy.MakeVertex(0.,0.,0.)
34 obj2 = geompy.MakeCircleR(150.)
35 obj3 = geompy.MakeBoxDXDYDZ(300.,400.,500.)
36 obj4 = geompy.MakeCylinderRH(100.,200.)
37 ShapeListCompound = []
38 ShapeListCompound.append(obj3)
39 ShapeListCompound.append(obj4)
40 obj5 = geompy.MakeCompound(ShapeListCompound)
41
42 obj1_entry = geompy.addToStudy(obj1, "Object1")
43 obj2_entry = geompy.addToStudy(obj2, "Object2")
44 obj3_entry = geompy.addToStudy(obj3, "Object3")
45 obj4_entry = geompy.addToStudy(obj4, "Object4")
46 obj5_entry = geompy.addToStudy(obj5, "Object5")
47
48 # Get information about objects
49 hasInfo = geom.hasObjectInfo()
50 print "Check if GEOM module provides information about its objects: ", hasInfo
51 if hasInfo == True:
52     print "Information about first  object: ", geom.getObjectInfo(salome.myStudyId, obj1_entry) 
53     print "Information about second object: ", geom.getObjectInfo(salome.myStudyId, obj2_entry)
54     print "Information about third  object: ", geom.getObjectInfo(salome.myStudyId, obj3_entry)
55     print "Information about fourth object: ", geom.getObjectInfo(salome.myStudyId, obj4_entry)
56     print "Information about fifth  object: ", geom.getObjectInfo(salome.myStudyId, obj5_entry)
57
58 salome.sg.updateObjBrowser(1)