salomegeom
6.5.0

Functions  
def  geompyDC.geompyDC.CreateGroup 
Creates a new group which will store subshapes of theMainShape.  
def  geompyDC.geompyDC.AddObject 
Adds a subobject with ID theSubShapeId to the group.  
def  geompyDC.geompyDC.RemoveObject 
Removes a subobject with ID theSubShapeId from the group.  
def  geompyDC.geompyDC.UnionList 
Adds to the group all the given shapes.  
def  geompyDC.geompyDC.UnionIDs 
Adds to the group all the given shapes.  
def  geompyDC.geompyDC.DifferenceList 
Removes from the group all the given shapes.  
def  geompyDC.geompyDC.DifferenceIDs 
Removes from the group all the given shapes.  
def  geompyDC.geompyDC.GetObjectIDs 
Returns a list of subobjects ID stored in the group.  
def  geompyDC.geompyDC.GetType 
Returns a type of subobjects stored in the group.  
def  geompyDC.geompyDC.ShapeIdToType 
Convert a type of geom object from id to string value.  
def  geompyDC.geompyDC.GetMainShape 
Returns a main shape associated with the group.  
def  geompyDC.geompyDC.GetEdgesByLength 
Create group of edges of theShape, whose length is in range [min_length, max_length].  
def  geompyDC.geompyDC.SelectEdges 
Create group of edges of selected shape, whose length is in range [min_length, max_length]. 
def geompyDC.geompyDC.AddObject  (  self,  
theGroup,  
theSubShapeID  
) 
Adds a subobject with ID theSubShapeId to the group.
theGroup  is a GEOM group to which the new subshape is added 
theSubShapeID  is a subshape ID in the main object. 
Example
Adds a subobject with ID theSubShapeId to the group Parameters: theGroup is a GEOM group to which the new subshape is added theSubShapeID is a subshape ID in the main object. Note: Use method GetSubShapeID() to get an unique ID of the subshape
Definition at line 7954 of file geompyDC.py.
07954 07955 def AddObject(self,theGroup, theSubShapeID): 07956 """ 07957 Adds a subobject with ID theSubShapeId to the group 07958 07959 Parameters: 07960 theGroup is a GEOM group to which the new subshape is added 07961 theSubShapeID is a subshape ID in the main object. 07962 07963 Note: 07964 Use method GetSubShapeID() to get an unique ID of the subshape 07965 """ 07966 # Example: see GEOM_TestOthers.py 07967 self.GroupOp.AddObject(theGroup, theSubShapeID) 07968 if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT": 07969 RaiseIfFailed("AddObject", self.GroupOp) 07970 pass 07971 pass
def geompyDC.geompyDC.CreateGroup  (  self,  
theMainShape,  
theShapeType  
) 
Creates a new group which will store subshapes of theMainShape.
theMainShape  is a GEOM object on which the group is selected 
theShapeType  defines a shape type of the group (see GEOM::shape_type) 
Example 1
Example 2
Creates a new group which will store subshapes of theMainShape Parameters: theMainShape is a GEOM object on which the group is selected theShapeType defines a shape type of the group:"COMPOUND", "COMPSOLID", "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX", "SHAPE". Returns: a newly created GEOM group Example of usage: group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
Definition at line 7927 of file geompyDC.py.
07927 07928 def CreateGroup(self,theMainShape, theShapeType): 07929 """ 07930 Creates a new group which will store subshapes of theMainShape 07931 07932 Parameters: 07933 theMainShape is a GEOM object on which the group is selected 07934 theShapeType defines a shape type of the group:"COMPOUND", "COMPSOLID", 07935 "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX", "SHAPE". 07936 07937 Returns: 07938 a newly created GEOM group 07939 07940 Example of usage: 07941 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"]) 07942 07943 """ 07944 # Example: see GEOM_TestOthers.py 07945 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType) 07946 RaiseIfFailed("CreateGroup", self.GroupOp) 07947 return anObj
def geompyDC.geompyDC.DifferenceIDs  (  self,  
theGroup,  
theSubShapes  
) 
Removes from the group all the given shapes.
No errors, if some shapes are not included.
theGroup  is a GEOM group from which the subshapes are removed. 
theSubShapes  is a list of indices of subshapes to be removed. 
Example
Removes from the group all the given shapes. No errors, if some shapes are not included. Parameters: theGroup is a GEOM group from which the subshapes are removed. theSubShapes is a list of indices of subshapes to be removed.
Definition at line 8053 of file geompyDC.py.
08053 08054 def DifferenceIDs(self,theGroup, theSubShapes): 08055 """ 08056 Removes from the group all the given shapes. No errors, if some shapes are not included. 08057 08058 Parameters: 08059 theGroup is a GEOM group from which the subshapes are removed. 08060 theSubShapes is a list of indices of subshapes to be removed. 08061 """ 08062 # Example: see GEOM_TestOthers.py 08063 self.GroupOp.DifferenceIDs(theGroup, theSubShapes) 08064 RaiseIfFailed("DifferenceIDs", self.GroupOp) 08065 pass
def geompyDC.geompyDC.DifferenceList  (  self,  
theGroup,  
theSubShapes  
) 
Removes from the group all the given shapes.
No errors, if some shapes are not included.
theGroup  is a GEOM group from which the subshapes are removed. 
theSubShapes  is a list of subshapes to be removed. 
Example
Removes from the group all the given shapes. No errors, if some shapes are not included. Parameters: theGroup is a GEOM group from which the subshapes are removed. theSubShapes is a list of subshapes to be removed.
Definition at line 8035 of file geompyDC.py.
08035 08036 def DifferenceList (self,theGroup, theSubShapes): 08037 """ 08038 Removes from the group all the given shapes. No errors, if some shapes are not included. 08039 08040 Parameters: 08041 theGroup is a GEOM group from which the subshapes are removed. 08042 theSubShapes is a list of subshapes to be removed. 08043 """ 08044 # Example: see GEOM_TestOthers.py 08045 self.GroupOp.DifferenceList(theGroup, theSubShapes) 08046 RaiseIfFailed("DifferenceList", self.GroupOp) 08047 pass
def geompyDC.geompyDC.GetEdgesByLength  (  self,  
theShape,  
min_length,  
max_length,  
include_min = 1 , 

include_max = 1 

) 
Create group of edges of theShape, whose length is in range [min_length, max_length].
If include_min/max == 0, edges with length == min/max_length will not be included in result.
theShape  given shape (see GEOM.GEOM_Object) 
min_length  minimum length of edges of theShape 
max_length  maximum length of edges of theShape 
include_max  indicating if edges with length == max_length should be included in result, 1yes, 0no (default=1) 
include_min  indicating if edges with length == min_length should be included in result, 1yes, 0no (default=1) 
Create group of edges of theShape, whose length is in range [min_length, max_length]. If include_min/max == 0, edges with length == min/max_length will not be included in result. Parameters: theShape given shape min_length minimum length of edges of theShape max_length maximum length of edges of theShape include_max indicating if edges with length == max_length should be included in result, 1yes, 0no (default=1) include_min indicating if edges with length == min_length should be included in result, 1yes, 0no (default=1) Returns: a newly created GEOM group of edges.
Definition at line 8241 of file geompyDC.py.
08241 08242 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1): 08243 """ 08244 Create group of edges of theShape, whose length is in range [min_length, max_length]. 08245 If include_min/max == 0, edges with length == min/max_length will not be included in result. 08246 08247 Parameters: 08248 theShape given shape 08249 min_length minimum length of edges of theShape 08250 max_length maximum length of edges of theShape 08251 include_max indicating if edges with length == max_length should be included in result, 1yes, 0no (default=1) 08252 include_min indicating if edges with length == min_length should be included in result, 1yes, 0no (default=1) 08253 08254 Returns: 08255 a newly created GEOM group of edges. 08256 """ 08257 edges = self.SubShapeAll(theShape, ShapeType["EDGE"]) 08258 edges_in_range = [] 08259 for edge in edges: 08260 Props = self.BasicProperties(edge) 08261 if min_length <= Props[0] and Props[0] <= max_length: 08262 if (not include_min) and (min_length == Props[0]): 08263 skip = 1 08264 else: 08265 if (not include_max) and (Props[0] == max_length): 08266 skip = 1 08267 else: 08268 edges_in_range.append(edge) 08269 08270 if len(edges_in_range) <= 0: 08271 print "No edges found by given criteria" 08272 return 0 08273 08274 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"]) 08275 self.UnionList(group_edges, edges_in_range) 08276 08277 return group_edges
def geompyDC.geompyDC.GetMainShape  (  self,  
theGroup  
) 
Returns a main shape associated with the group.
theGroup  is a GEOM group for which a main shape object is requested 
Example
Returns a main shape associated with the group Parameters: theGroup is a GEOM group for which a main shape object is requested Returns: a GEOM object which is a main shape for theGroup Example of usage: BoxCopy = geompy.GetMainShape(CreateGroup)
Definition at line 8215 of file geompyDC.py.
08215 08216 def GetMainShape(self,theGroup): 08217 """ 08218 Returns a main shape associated with the group 08219 08220 Parameters: 08221 theGroup is a GEOM group for which a main shape object is requested 08222 08223 Returns: 08224 a GEOM object which is a main shape for theGroup 08225 08226 Example of usage: BoxCopy = geompy.GetMainShape(CreateGroup) 08227 """ 08228 # Example: see GEOM_TestOthers.py 08229 anObj = self.GroupOp.GetMainShape(theGroup) 08230 RaiseIfFailed("GetMainShape", self.GroupOp) 08231 return anObj
def geompyDC.geompyDC.GetObjectIDs  (  self,  
theGroup  
) 
Returns a list of subobjects ID stored in the group.
theGroup  is a GEOM group for which a list of IDs is requested 
Example
Returns a list of subobjects ID stored in the group Parameters: theGroup is a GEOM group for which a list of IDs is requested
Definition at line 8070 of file geompyDC.py.
08070 08071 def GetObjectIDs(self,theGroup): 08072 """ 08073 Returns a list of subobjects ID stored in the group 08074 08075 Parameters: 08076 theGroup is a GEOM group for which a list of IDs is requested 08077 """ 08078 # Example: see GEOM_TestOthers.py 08079 ListIDs = self.GroupOp.GetObjects(theGroup) 08080 RaiseIfFailed("GetObjects", self.GroupOp) 08081 return ListIDs
def geompyDC.geompyDC.GetType  (  self,  
theGroup  
) 
Returns a type of subobjects stored in the group.
theGroup  is a GEOM group which type is returned. 
Example
Returns a type of subobjects stored in the group Parameters: theGroup is a GEOM group which type is returned.
Definition at line 8086 of file geompyDC.py.
08086 08087 def GetType(self,theGroup): 08088 """ 08089 Returns a type of subobjects stored in the group 08090 08091 Parameters: 08092 theGroup is a GEOM group which type is returned. 08093 """ 08094 # Example: see GEOM_TestOthers.py 08095 aType = self.GroupOp.GetType(theGroup) 08096 RaiseIfFailed("GetType", self.GroupOp) 08097 return aType
def geompyDC.geompyDC.RemoveObject  (  self,  
theGroup,  
theSubShapeID  
) 
Removes a subobject with ID theSubShapeId from the group.
theGroup  is a GEOM group from which the new subshape is removed 
theSubShapeID  is a subshape ID in the main object. 
Example
Removes a subobject with ID theSubShapeId from the group Parameters: theGroup is a GEOM group from which the new subshape is removed theSubShapeID is a subshape ID in the main object. Note: Use method GetSubShapeID() to get an unique ID of the subshape
Definition at line 7978 of file geompyDC.py.
07978 07979 def RemoveObject(self,theGroup, theSubShapeID): 07980 """ 07981 Removes a subobject with ID theSubShapeId from the group 07982 07983 Parameters: 07984 theGroup is a GEOM group from which the new subshape is removed 07985 theSubShapeID is a subshape ID in the main object. 07986 07987 Note: 07988 Use method GetSubShapeID() to get an unique ID of the subshape 07989 """ 07990 # Example: see GEOM_TestOthers.py 07991 self.GroupOp.RemoveObject(theGroup, theSubShapeID) 07992 RaiseIfFailed("RemoveObject", self.GroupOp) 07993 pass
def geompyDC.geompyDC.SelectEdges  (  self,  
min_length,  
max_length,  
include_min = 1 , 

include_max = 1 

) 
Create group of edges of selected shape, whose length is in range [min_length, max_length].
If include_min/max == 0, edges with length == min/max_length will not be included in result.
min_length  minimum length of edges of selected shape 
max_length  maximum length of edges of selected shape 
include_max  indicating if edges with length == max_length should be included in result, 1yes, 0no (default=1) 
include_min  indicating if edges with length == min_length should be included in result, 1yes, 0no (default=1) 
Create group of edges of selected shape, whose length is in range [min_length, max_length]. If include_min/max == 0, edges with length == min/max_length will not be included in result. Parameters: min_length minimum length of edges of selected shape max_length maximum length of edges of selected shape include_max indicating if edges with length == max_length should be included in result, 1yes, 0no (default=1) include_min indicating if edges with length == min_length should be included in result, 1yes, 0no (default=1) Returns: a newly created GEOM group of edges.
Definition at line 8286 of file geompyDC.py.
08286 08287 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1): 08288 """ 08289 Create group of edges of selected shape, whose length is in range [min_length, max_length]. 08290 If include_min/max == 0, edges with length == min/max_length will not be included in result. 08291 08292 Parameters: 08293 min_length minimum length of edges of selected shape 08294 max_length maximum length of edges of selected shape 08295 include_max indicating if edges with length == max_length should be included in result, 1yes, 0no (default=1) 08296 include_min indicating if edges with length == min_length should be included in result, 1yes, 0no (default=1) 08297 08298 Returns: 08299 a newly created GEOM group of edges. 08300 """ 08301 nb_selected = sg.SelectedCount() 08302 if nb_selected < 1: 08303 print "Select a shape before calling this function, please." 08304 return 0 08305 if nb_selected > 1: 08306 print "Only one shape must be selected" 08307 return 0 08308 08309 id_shape = sg.getSelected(0) 08310 shape = IDToObject( id_shape ) 08311 08312 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max) 08313 08314 left_str = " < " 08315 right_str = " < " 08316 if include_min: left_str = " <= " 08317 if include_max: right_str = " <= " 08318 08319 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length` 08320 + left_str + "length" + right_str + `max_length`) 08321 08322 sg.updateObjBrowser(1) 08323 08324 return group_edges
def geompyDC.geompyDC.ShapeIdToType  (  self,  
theId  
) 
Convert a type of geom object from id to string value.
theId  is a GEOM obect type id. 
Convert a type of geom object from id to string value Parameters: theId is a GEOM obect type id. Returns: type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
Definition at line 8102 of file geompyDC.py.
08102 08103 def ShapeIdToType(self, theId): 08104 """ 08105 Convert a type of geom object from id to string value 08106 08107 Parameters: 08108 theId is a GEOM obect type id. 08109 08110 Returns: 08111 type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... ) 08112 """ 08113 if theId == 0: 08114 return "COPY" 08115 if theId == 1: 08116 return "IMPORT" 08117 if theId == 2: 08118 return "POINT" 08119 if theId == 3: 08120 return "VECTOR" 08121 if theId == 4: 08122 return "PLANE" 08123 if theId == 5: 08124 return "LINE" 08125 if theId == 6: 08126 return "TORUS" 08127 if theId == 7: 08128 return "BOX" 08129 if theId == 8: 08130 return "CYLINDER" 08131 if theId == 9: 08132 return "CONE" 08133 if theId == 10: 08134 return "SPHERE" 08135 if theId == 11: 08136 return "PRISM" 08137 if theId == 12: 08138 return "REVOLUTION" 08139 if theId == 13: 08140 return "BOOLEAN" 08141 if theId == 14: 08142 return "PARTITION" 08143 if theId == 15: 08144 return "POLYLINE" 08145 if theId == 16: 08146 return "CIRCLE" 08147 if theId == 17: 08148 return "SPLINE" 08149 if theId == 18: 08150 return "ELLIPSE" 08151 if theId == 19: 08152 return "CIRC_ARC" 08153 if theId == 20: 08154 return "FILLET" 08155 if theId == 21: 08156 return "CHAMFER" 08157 if theId == 22: 08158 return "EDGE" 08159 if theId == 23: 08160 return "WIRE" 08161 if theId == 24: 08162 return "FACE" 08163 if theId == 25: 08164 return "SHELL" 08165 if theId == 26: 08166 return "SOLID" 08167 if theId == 27: 08168 return "COMPOUND" 08169 if theId == 28: 08170 return "SUBSHAPE" 08171 if theId == 29: 08172 return "PIPE" 08173 if theId == 30: 08174 return "ARCHIMEDE" 08175 if theId == 31: 08176 return "FILLING" 08177 if theId == 32: 08178 return "EXPLODE" 08179 if theId == 33: 08180 return "GLUED" 08181 if theId == 34: 08182 return "SKETCHER" 08183 if theId == 35: 08184 return "CDG" 08185 if theId == 36: 08186 return "FREE_BOUNDS" 08187 if theId == 37: 08188 return "GROUP" 08189 if theId == 38: 08190 return "BLOCK" 08191 if theId == 39: 08192 return "MARKER" 08193 if theId == 40: 08194 return "THRUSECTIONS" 08195 if theId == 41: 08196 return "COMPOUNDFILTER" 08197 if theId == 42: 08198 return "SHAPES_ON_SHAPE" 08199 if theId == 43: 08200 return "ELLIPSE_ARC" 08201 if theId == 44: 08202 return "3DSKETCHER" 08203 if theId == 45: 08204 return "FILLET_2D" 08205 if theId == 46: 08206 return "FILLET_1D" 08207 if theId == 201: 08208 return "PIPETSHAPE" 08209 return "Shape Id not exist."
def geompyDC.geompyDC.UnionIDs  (  self,  
theGroup,  
theSubShapes  
) 
Adds to the group all the given shapes.
No errors, if some shapes are alredy included.
theGroup  is a GEOM group to which the new subshapes are added. 
theSubShapes  is a list of indices of subshapes to be added. 
Example
Adds to the group all the given shapes. No errors, if some shapes are alredy included. Parameters: theGroup is a GEOM group to which the new subshapes are added. theSubShapes is a list of indices of subshapes to be added.
Definition at line 8017 of file geompyDC.py.
08017 08018 def UnionIDs(self,theGroup, theSubShapes): 08019 """ 08020 Adds to the group all the given shapes. No errors, if some shapes are alredy included. 08021 08022 Parameters: 08023 theGroup is a GEOM group to which the new subshapes are added. 08024 theSubShapes is a list of indices of subshapes to be added. 08025 """ 08026 # Example: see GEOM_TestOthers.py 08027 self.GroupOp.UnionIDs(theGroup, theSubShapes) 08028 RaiseIfFailed("UnionIDs", self.GroupOp) 08029 pass
def geompyDC.geompyDC.UnionList  (  self,  
theGroup,  
theSubShapes  
) 
Adds to the group all the given shapes.
No errors, if some shapes are alredy included.
theGroup  is a GEOM group to which the new subshapes are added. 
theSubShapes  is a list of subshapes to be added. 
Example
Adds to the group all the given shapes. No errors, if some shapes are alredy included. Parameters: theGroup is a GEOM group to which the new subshapes are added. theSubShapes is a list of subshapes to be added.
Definition at line 7999 of file geompyDC.py.
07999 08000 def UnionList (self,theGroup, theSubShapes): 08001 """ 08002 Adds to the group all the given shapes. No errors, if some shapes are alredy included. 08003 08004 Parameters: 08005 theGroup is a GEOM group to which the new subshapes are added. 08006 theSubShapes is a list of subshapes to be added. 08007 """ 08008 # Example: see GEOM_TestOthers.py 08009 self.GroupOp.UnionList(theGroup, theSubShapes) 08010 RaiseIfFailed("UnionList", self.GroupOp) 08011 pass