Salome HOME
26b7019d67bdfc94a1fc1e0840c70f56ab475844
[modules/geom.git] / src / GEOM_SWIG / GEOM_ObjectInfo.py
1 #  -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2023  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, or (at your option) any later version.
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++ implementation with Python
22 #  File   : GEOM_ObjectInfo.py
23 #  Author : Michael ZORIN
24 #  Module : GEOM
25 #
26 import salome
27 salome.salome_init()
28 import GEOM
29 from salome.geom import geomBuilder
30 geompy = geomBuilder.New()
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 = geompy.hasObjectInfo()
50 print("Check if GEOM module provides information about its objects: ", hasInfo)
51 if hasInfo == True:
52     print("Information about first  object: ", geompy.getObjectInfo(obj1_entry))
53     print("Information about second object: ", geompy.getObjectInfo(obj2_entry))
54     print("Information about third  object: ", geompy.getObjectInfo(obj3_entry))
55     print("Information about fourth object: ", geompy.getObjectInfo(obj4_entry))
56     print("Information about fifth  object: ", geompy.getObjectInfo(obj5_entry))
57
58 salome.sg.updateObjBrowser()