geom/src/GEOM_SWIG/GEOM_ObjectInfo.py

59 lines
2.2 KiB
Python
Raw Normal View History

2012-08-09 07:58:02 +00:00
# -*- coding: iso-8859-1 -*-
2016-03-15 15:26:56 +03:00
# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2009-02-13 12:16:39 +00:00
#
2012-08-09 07:58:02 +00:00
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
2014-02-18 10:44:41 +04:00
# version 2.1 of the License, or (at your option) any later version.
2009-02-13 12:16:39 +00:00
#
2012-08-09 07:58:02 +00:00
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
2009-02-13 12:16:39 +00:00
#
2012-08-09 07:58:02 +00:00
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2009-02-13 12:16:39 +00:00
#
2012-08-09 07:58:02 +00:00
# GEOM GEOM_SWIG : binding of C++ implementation with Python
2009-02-13 12:16:39 +00:00
# File : GEOM_ObjectInfo.py
# Author : Michael ZORIN
# Module : GEOM
2012-08-09 07:58:02 +00:00
#
2009-02-13 12:16:39 +00:00
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
2017-06-13 12:57:14 +03:00
geompy = geomBuilder.New()
2009-02-13 12:16:39 +00:00
# Create several objects
obj1 = geompy.MakeVertex(0.,0.,0.)
obj2 = geompy.MakeCircleR(150.)
obj3 = geompy.MakeBoxDXDYDZ(300.,400.,500.)
obj4 = geompy.MakeCylinderRH(100.,200.)
ShapeListCompound = []
ShapeListCompound.append(obj3)
ShapeListCompound.append(obj4)
obj5 = geompy.MakeCompound(ShapeListCompound)
obj1_entry = geompy.addToStudy(obj1, "Object1")
obj2_entry = geompy.addToStudy(obj2, "Object2")
obj3_entry = geompy.addToStudy(obj3, "Object3")
obj4_entry = geompy.addToStudy(obj4, "Object4")
obj5_entry = geompy.addToStudy(obj5, "Object5")
# Get information about objects
hasInfo = geompy.hasObjectInfo()
2017-02-10 17:07:24 +01:00
print("Check if GEOM module provides information about its objects: ", hasInfo)
2009-02-13 12:16:39 +00:00
if hasInfo == True:
2017-06-22 17:55:49 +03:00
print("Information about first object: ", geompy.getObjectInfo(obj1_entry))
print("Information about second object: ", geompy.getObjectInfo(obj2_entry))
print("Information about third object: ", geompy.getObjectInfo(obj3_entry))
print("Information about fourth object: ", geompy.getObjectInfo(obj4_entry))
print("Information about fifth object: ", geompy.getObjectInfo(obj5_entry))
2009-02-13 12:16:39 +00:00
2017-06-13 12:57:14 +03:00
salome.sg.updateObjBrowser()