1 # Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 import SHAPERSTUDY_ORB__POA
25 from SHAPERSTUDY_utils import getEngine
29 # converter from the integer values to idl shape_type enumerations
31 0:GEOM.COMPOUND, 1:GEOM.COMPSOLID, 2:GEOM.SOLID,
32 3:GEOM.SHELL, 4:GEOM.FACE, 5:GEOM.WIRE,
33 6:GEOM.EDGE, 7:GEOM.VERTEX, 8:GEOM.SHAPE, 9:GEOM.FLAT}
36 class SHAPERSTUDY_Object(SHAPERSTUDY_ORB__POA.SHAPER_Object):
38 Construct an instance of SHAPERSTUDY Object.
40 def __init__ ( self, *args):
45 def GetShapeType( self ):
47 Get a GEOM.shape_type of the object value.
51 global __shape_types__
52 return __shape_types__[self.data.type()];
54 def IsMainShape( self ):
56 Returns True if this object is not a sub-shape of another object.
60 def GetSubShapeIndices( self ):
62 Get a list of ID's of sub-shapes in the main shape.
66 def GetMainShape( self ):
68 Get a main shape object to which this object is a sub-shape.
74 Get the TopoDS_Shape, for colocated case only.
75 Called by GEOM_Client to get TopoDS_Shape pointer
79 return self.data.shape()
81 def GetShapeStream( self ):
83 Get geometric shape of the object as a byte stream in BRep format
87 return self.data.shapeStream().encode()
89 def SetShapeByStream(self, theStream):
91 Sets geometric shape content of the object as a byte stream in BRep format
94 self.data.updateShape(theStream)
96 self.data = StudyData_Swig.StudyData_Object(theStream)
99 Methods from BaseObject
103 Get name of the object associated with this object.
105 return self.SO.GetName()
107 def SetEntry( self, theInternalEntry ):
109 Sets internal (unique) entry of the object in the component's data tree.
111 self.entry = theInternalEntry
113 def GetEntry( self ):
115 Get internal (unique) entry of the object in the component's data tree.
121 Get internal type of operation created this object.
122 In SMESH is used to find out if an object is GROUP (type == 37)
124 # 1 corresponds to the Import feature (GEOMImpl_Types.hxx )
129 Get value of a modification counter of the object
132 return self.data.getTick()
135 def GetStudyEntry( self ):
137 Get a Study entry where this object was published.
139 return self.SO.GetID()
143 Return true if geom object represents a shape.
144 For example, method return false for GEOM_MARKER
148 def IsSame( self, other ):
150 Return true if passed object is identical to this object
152 return self.GetType() == other.GetType() and self.GetEntry() == other.GetEntry()
156 Return the engine creating this object
160 def SetSO( self, theSO ):
162 Sets SObject of this object (when it is published)
168 Returns SObject of this object
172 def IsParametrical(self):
174 Returns true if the current object has connection to a parametrical model
175 which can be modified by parameters change.