Salome HOME
c6b10ab482a50b0ce87955d451b040a5aa763b9d
[modules/geom.git] / src / GEOM_SWIG / GEOM_ObjectInfo.py
1 #! /usr/bin/python
2 #  -*- coding: iso-8859-1 -*-
3 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
4 #
5 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
7
8 #  This library is free software; you can redistribute it and/or 
9 #  modify it under the terms of the GNU Lesser General Public 
10 #  License as published by the Free Software Foundation; either 
11 #  version 2.1 of the License. 
12
13 #  This library is distributed in the hope that it will be useful, 
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
16 #  Lesser General Public License for more details. 
17
18 #  You should have received a copy of the GNU Lesser General Public 
19 #  License along with this library; if not, write to the Free Software 
20 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
21
22 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #
24 #
25 #
26 #  File   : GEOM_ObjectInfo.py
27 #  Author : Michael ZORIN
28 #  Module : GEOM
29 #  $Header: 
30
31 import salome
32 import geompy
33
34 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
35
36 # Create several objects
37 obj1 = geompy.MakeVertex(0.,0.,0.)
38 obj2 = geompy.MakeCircleR(150.)
39 obj3 = geompy.MakeBoxDXDYDZ(300.,400.,500.)
40 obj4 = geompy.MakeCylinderRH(100.,200.)
41 ShapeListCompound = []
42 ShapeListCompound.append(obj3)
43 ShapeListCompound.append(obj4)
44 obj5 = geompy.MakeCompound(ShapeListCompound)
45
46 obj1_entry = geompy.addToStudy(obj1, "Object1")
47 obj2_entry = geompy.addToStudy(obj2, "Object2")
48 obj3_entry = geompy.addToStudy(obj3, "Object3")
49 obj4_entry = geompy.addToStudy(obj4, "Object4")
50 obj5_entry = geompy.addToStudy(obj5, "Object5")
51
52 # Get information about objects
53 hasInfo = geom.hasObjectInfo()
54 print "Check if GEOM module provides information about its objects: ", hasInfo
55 if hasInfo == True:
56     print "Information about first  object: ", geom.getObjectInfo(salome.myStudyId, obj1_entry) 
57     print "Information about second object: ", geom.getObjectInfo(salome.myStudyId, obj2_entry)
58     print "Information about third  object: ", geom.getObjectInfo(salome.myStudyId, obj3_entry)
59     print "Information about fourth object: ", geom.getObjectInfo(salome.myStudyId, obj4_entry)
60     print "Information about fifth  object: ", geom.getObjectInfo(salome.myStudyId, obj5_entry)
61
62 salome.sg.updateObjBrowser(1)