Salome HOME
fb2ab3e15dff92f98c7e328ecbcd55bf333058ad
[modules/geom.git] / src / GEOM_SWIG / GEOM_ObjectInfo.py
1 #  -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2012  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 #
26 import salome
27 import geompy
28
29 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
30
31 # Create several objects
32 obj1 = geompy.MakeVertex(0.,0.,0.)
33 obj2 = geompy.MakeCircleR(150.)
34 obj3 = geompy.MakeBoxDXDYDZ(300.,400.,500.)
35 obj4 = geompy.MakeCylinderRH(100.,200.)
36 ShapeListCompound = []
37 ShapeListCompound.append(obj3)
38 ShapeListCompound.append(obj4)
39 obj5 = geompy.MakeCompound(ShapeListCompound)
40
41 obj1_entry = geompy.addToStudy(obj1, "Object1")
42 obj2_entry = geompy.addToStudy(obj2, "Object2")
43 obj3_entry = geompy.addToStudy(obj3, "Object3")
44 obj4_entry = geompy.addToStudy(obj4, "Object4")
45 obj5_entry = geompy.addToStudy(obj5, "Object5")
46
47 # Get information about objects
48 hasInfo = geom.hasObjectInfo()
49 print "Check if GEOM module provides information about its objects: ", hasInfo
50 if hasInfo == True:
51     print "Information about first  object: ", geom.getObjectInfo(salome.myStudyId, obj1_entry) 
52     print "Information about second object: ", geom.getObjectInfo(salome.myStudyId, obj2_entry)
53     print "Information about third  object: ", geom.getObjectInfo(salome.myStudyId, obj3_entry)
54     print "Information about fourth object: ", geom.getObjectInfo(salome.myStudyId, obj4_entry)
55     print "Information about fifth  object: ", geom.getObjectInfo(salome.myStudyId, obj5_entry)
56
57 salome.sg.updateObjBrowser(1)