Salome HOME
PAL8379: add in geompy.py a function for filtering edges by length.
[modules/geom.git] / src / GEOM_SWIG / batchmode_geompy.py
1 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
2 #
3 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
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.
10 #
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.
15 #
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
19 #
20 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 #
22 #
23 #
24 #  File   : geompy.py
25 #  Author : Paul RASCLE, EDF
26 #  Module : GEOM
27 #  $Header$
28
29 from batchmode_salome import *
30 import GEOM
31
32 g=None
33 step = 0
34 while step < 50 and g == None:
35     g = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
36     step = step + 1
37     time.sleep(4)
38 geom = g._narrow( GEOM.GEOM_Gen )
39 myBuilder = myStudy.NewBuilder()
40
41 father = myStudy.FindComponent("GEOM")
42 if father is None:
43         father = myBuilder.NewComponent("GEOM")
44         A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName")
45         FName = A1._narrow(SALOMEDS.AttributeName)
46         FName.SetValue("Geometry")
47         A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap")
48         aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
49         aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
50         myBuilder.DefineComponentInstance(father,geom)
51
52 #     *  Get name for sub-shape aSubObj of shape aMainObj
53 #
54 def SubShapeName(aSubObj, aMainObj):
55     name = "SubShape"
56     print name
57     return name
58
59 #     *  Publish in study aShape with name aName
60 #
61 def addToStudy(aShape, aName):
62     try:
63         aSObject = geom.AddInStudy(myStudy, aShape, aName, None)
64     except:
65         print "addToStudy() failed"
66         return ""
67     return aShape.GetStudyEntry()
68
69 #     *  Publish in study aShape with name aName as sub-object of previously published aFather
70 #
71 def addToStudyInFather(aFather, aShape, aName):
72     try:
73         aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather)
74     except:
75         print "addToStudyInFather() failed"
76         return ""
77     return aShape.GetStudyEntry()
78
79 # -----------------------------------------------------------------------------
80 # enumeration ShapeType as a dictionary
81 # -----------------------------------------------------------------------------
82
83 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
84
85 # -----------------------------------------------------------------------------
86 # Get Operations Interfaces
87 # -----------------------------------------------------------------------------
88
89 BasicOp  = geom.GetIBasicOperations    (myStudyId)
90 CurvesOp = geom.GetICurvesOperations   (myStudyId)
91 PrimOp   = geom.GetI3DPrimOperations   (myStudyId)
92 ShapesOp = geom.GetIShapesOperations   (myStudyId)
93 HealOp   = geom.GetIHealingOperations  (myStudyId)
94 InsertOp = geom.GetIInsertOperations   (myStudyId)
95 BoolOp   = geom.GetIBooleanOperations  (myStudyId)
96 TrsfOp   = geom.GetITransformOperations(myStudyId)
97 LocalOp  = geom.GetILocalOperations    (myStudyId)
98 MeasuOp  = geom.GetIMeasureOperations  (myStudyId)
99 BlocksOp = geom.GetIBlocksOperations   (myStudyId)
100 GroupOp  = geom.GetIGroupOperations   (myStudyId)
101
102 # -----------------------------------------------------------------------------
103 # Basic primitives
104 # -----------------------------------------------------------------------------
105
106 def MakeVertex(theX, theY, theZ):
107     anObj = BasicOp.MakePointXYZ(theX, theY, theZ)
108     if BasicOp.IsDone() == 0:
109       print "MakePointXYZ : ", BasicOp.GetErrorCode()
110     return anObj
111
112 def MakeVertexWithRef(vertex,x,y,z):
113     anObj = BasicOp.MakePointWithReference(vertex,x,y,z)
114     if BasicOp.IsDone() == 0:
115       print "MakePointWithReference : ", BasicOp.GetErrorCode()
116     return anObj
117
118 def MakeVertexOnCurve(curve,par):
119     anObj = BasicOp.MakePointOnCurve(curve,par)
120     if BasicOp.IsDone() == 0:
121       print "MakePointOnCurve : ", BasicOp.GetErrorCode()
122     return anObj
123
124 def MakeVectorDXDYDZ(dx,dy,dz):
125     anObj = BasicOp.MakeVectorDXDYDZ(dx,dy,dz)
126     if BasicOp.IsDone() == 0:
127       print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode()
128     return anObj
129
130 def MakeVector(p1,p2):
131     anObj = BasicOp.MakeVectorTwoPnt(p1, p2)
132     if BasicOp.IsDone() == 0:
133       print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode()
134     return anObj
135
136 def MakeLine(p1, d1):
137     anObj = BasicOp.MakeLine(p1,d1)
138     if BasicOp.IsDone() == 0:
139       print "MakeLine : ", BasicOp.GetErrorCode()
140     return anObj
141
142 def MakeLineTwoPnt(p1, p2):
143     anObj = BasicOp.MakeLineTwoPnt(p1,p2)
144     if BasicOp.IsDone() == 0:
145       print "MakeLineTwoPnt : ", BasicOp.GetErrorCode()
146     return anObj
147
148 def MakePlane(p1,v1,trimsize):
149     anObj = BasicOp.MakePlanePntVec(p1,v1,trimsize)
150     if BasicOp.IsDone() == 0:
151       print "MakePlanePntVec : ", BasicOp.GetErrorCode()
152     return anObj
153
154 def MakePlaneThreePnt(p1,p2,p3,trimsize):
155     anObj = BasicOp.MakePlaneThreePnt(p1,p2,p3,trimsize)
156     if BasicOp.IsDone() == 0:
157       print "MakePlaneThreePnt : ", BasicOp.GetErrorCode()
158     return anObj
159
160 def MakePlaneFace(face,trimsize):
161     anObj = BasicOp.MakePlaneFace(face,trimsize)
162     if BasicOp.IsDone() == 0:
163       print "MakePlaneFace : ", BasicOp.GetErrorCode()
164     return anObj
165
166 def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
167     anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
168     if BasicOp.IsDone() == 0:
169       print "MakeMarker : ", BasicOp.GetErrorCode()
170     return anObj
171
172 # -----------------------------------------------------------------------------
173 # Curves
174 # -----------------------------------------------------------------------------
175
176 def MakeArc(p1,p2,p3):
177     anObj = CurvesOp.MakeArc(p1,p2,p3)
178     if CurvesOp.IsDone() == 0:
179       print "MakeArc : ", CurvesOp.GetErrorCode()
180     return anObj
181
182 def MakeCircle(p1,v1,radius):
183     anObj = CurvesOp.MakeCirclePntVecR(p1,v1,radius)
184     if CurvesOp.IsDone() == 0:
185       print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode()
186     return anObj
187
188 def MakeCircleThreePnt(p1,p2,p3):
189     anObj = CurvesOp.MakeCircleThreePnt(p1,p2,p3)
190     if CurvesOp.IsDone() == 0:
191       print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
192     return anObj
193
194 def MakeEllipse(p1,v1,radiusMaj,radiusMin):
195     anObj = CurvesOp.MakeEllipse(p1,v1,radiusMaj, radiusMin)
196     if CurvesOp.IsDone() == 0:
197       print "MakeEllipse : ", CurvesOp.GetErrorCode()
198     return anObj
199
200 def MakePolyline(ListShape):
201     anObj = CurvesOp.MakePolyline(ListShape)
202     if CurvesOp.IsDone() == 0:
203       print "MakePolyline : ", CurvesOp.GetErrorCode()
204     return anObj
205
206 def MakeBezier(ListShape):
207     anObj = CurvesOp.MakeSplineBezier(ListShape)
208     if CurvesOp.IsDone() == 0:
209       print "MakeSplineBezier : ", CurvesOp.GetErrorCode()
210     return anObj
211
212 def MakeInterpol(ListShape):
213     anObj = CurvesOp.MakeSplineInterpolation(ListShape)
214     if CurvesOp.IsDone() == 0:
215       print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode()
216     return anObj
217
218 # <WPL>: Nine double values, defining origin,
219 # OZ and OX directions of the working plane.
220 def MakeSketcher(Cmd, WPL = [0,0,0, 0,0,1, 1,0,0]):
221     anObj = CurvesOp.MakeSketcher(Cmd, WPL)
222     if CurvesOp.IsDone() == 0:
223       print "MakeSketcher : ", CurvesOp.GetErrorCode()
224     return anObj
225
226 # -----------------------------------------------------------------------------
227 # Create 3D Primitives
228 # -----------------------------------------------------------------------------
229
230 def MakeBox(x1,y1,z1,x2,y2,z2):
231     pnt1 = MakeVertex(x1,y1,z1)
232     pnt2 = MakeVertex(x2,y2,z2)
233     return MakeBoxTwoPnt(pnt1,pnt2)
234
235 def MakeBoxDXDYDZ(dx,dy,dz):
236     anObj = PrimOp.MakeBoxDXDYDZ(dx,dy,dz)
237     if PrimOp.IsDone() == 0:
238       print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode()
239     return anObj
240
241 def MakeBoxTwoPnt(point1, point2):
242     anObj = PrimOp.MakeBoxTwoPnt(point1, point2)
243     if PrimOp.IsDone() == 0:
244       print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode()
245     return anObj
246
247 def MakeCylinder(p1,v1,radius,height):
248     anObj = PrimOp.MakeCylinderPntVecRH(p1,v1,radius,height)
249     if PrimOp.IsDone() == 0:
250       print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode()
251     return anObj
252
253 def MakeCylinderRH(radius,height):
254     anObj = PrimOp.MakeCylinderRH(radius,height)
255     if PrimOp.IsDone() == 0:
256       print "MakeCylinderRH : ", PrimOp.GetErrorCode()
257     return anObj
258
259 def MakeSpherePntR(point,radius):
260     anObj = PrimOp.MakeSpherePntR(point,radius)
261     if PrimOp.IsDone() == 0:
262       print "MakeSpherePntR : ", PrimOp.GetErrorCode()
263     return anObj
264
265 def MakeSphere(x,y,z,radius):
266     point = MakeVertex(x,y,z)
267     anObj = MakeSpherePntR(point,radius)
268     return anObj
269
270 def MakeSphereR(radius):
271     anObj = PrimOp.MakeSphereR(radius)
272     if PrimOp.IsDone() == 0:
273       print "MakeSphereR : ", PrimOp.GetErrorCode()
274     return anObj
275
276 def MakeCone(p1,v1,radius1,radius2,height):
277     anObj = PrimOp.MakeConePntVecR1R2H(p1,v1,radius1,radius2,height)
278     if PrimOp.IsDone() == 0:
279       print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode()
280     return anObj
281
282 def MakeConeR1R2H(radius1,radius2,height):
283     anObj = PrimOp.MakeConeR1R2H(radius1,radius2,height)
284     if PrimOp.IsDone() == 0:
285       print "MakeConeR1R2H : ", PrimOp.GetErrorCode()
286     return anObj
287
288 def MakeTorus(p1,v1,major_radius,minor_radius):
289     anObj = PrimOp.MakeTorusPntVecRR(p1,v1,major_radius,minor_radius)
290     if PrimOp.IsDone() == 0:
291       print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode()
292     return anObj
293
294 def MakeTorusRR(major_radius,minor_radius):
295     anObj = PrimOp.MakeTorusRR(major_radius,minor_radius)
296     if PrimOp.IsDone() == 0:
297       print "MakeTorusRR : ", PrimOp.GetErrorCode()
298     return anObj
299
300 def MakePrism(baseShape,point1,point2):
301     anObj = PrimOp.MakePrismTwoPnt(baseShape,point1,point2)
302     if PrimOp.IsDone() == 0:
303       print "MakePrismTwoPnt : ", PrimOp.GetErrorCode()
304     return anObj
305
306 def MakePrismVecH(baseShape,vector,height):
307     anObj = PrimOp.MakePrismVecH(baseShape,vector,height)
308     if PrimOp.IsDone() == 0:
309       print "MakePrismVecH : ", PrimOp.GetErrorCode()
310     return anObj
311
312 def MakePipe(baseShape,pathShape):
313     anObj = PrimOp.MakePipe(baseShape,pathShape)
314     if PrimOp.IsDone() == 0:
315       print "MakePipe : ", PrimOp.GetErrorCode()
316     return anObj
317
318 def MakeRevolution(aShape,axis,angle):
319     anObj = PrimOp.MakeRevolutionAxisAngle(aShape,axis,angle)
320     if PrimOp.IsDone() == 0:
321       print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
322     return anObj
323
324 # -----------------------------------------------------------------------------
325 # Create base shapes
326 # -----------------------------------------------------------------------------
327
328 def MakeEdge(p1,p2):
329     anObj = ShapesOp.MakeEdge(p1,p2)
330     if ShapesOp.IsDone() == 0:
331       print "MakeEdge : ", ShapesOp.GetErrorCode()
332     return anObj
333
334 def MakeWire(ListShape):
335     anObj = ShapesOp.MakeWire(ListShape)
336     if ShapesOp.IsDone() == 0:
337       print "MakeWire : ", ShapesOp.GetErrorCode()
338     return anObj
339
340 def MakeFace(aShapeWire,WantPlanarFace):
341     anObj = ShapesOp.MakeFace(aShapeWire,WantPlanarFace)
342     if ShapesOp.IsDone() == 0:
343       print "MakeFace : ", ShapesOp.GetErrorCode()
344     return anObj
345
346 def MakeFaceWires(ListWires,WantPlanarFace):
347     anObj = ShapesOp.MakeFaceWires(ListWires,WantPlanarFace)
348     if ShapesOp.IsDone() == 0:
349       print "MakeFaceWires : ", ShapesOp.GetErrorCode()
350     return anObj
351
352 def MakeFaces(ListWires,WantPlanarFace):
353     anObj = MakeFaceWires(ListWires,WantPlanarFace)
354     return anObj
355
356 def MakeShell(ListOfShapes):
357     anObj = ShapesOp.MakeShell(ListOfShapes)
358     if ShapesOp.IsDone() == 0:
359         print "MakeShell : ", ShapesOp.GetErrorCode()
360     return anObj
361
362 def MakeSolid(ListOfShells):
363     anObj = ShapesOp.MakeSolidShells(ListOfShells)
364     if ShapesOp.IsDone() == 0:
365         print "MakeSolid : ", ShapesOp.GetErrorCode()
366     return anObj
367
368 def MakeCompound(ListShape):
369     anObj = ShapesOp.MakeCompound(ListShape)
370     if ShapesOp.IsDone() == 0:
371       print "MakeCompound : ", ShapesOp.GetErrorCode()
372     return anObj
373
374 def NumberOfFaces(theShape):
375     nb_faces = ShapesOp.NumberOfFaces(theShape)
376     if ShapesOp.IsDone() == 0:
377       print "NumberOfFaces : ", ShapesOp.GetErrorCode()
378     return nb_faces
379
380 def NumberOfEdges(theShape):
381     nb_edges = ShapesOp.NumberOfEdges(theShape)
382     if ShapesOp.IsDone() == 0:
383       print "NumberOfEdges : ", ShapesOp.GetErrorCode()
384     return nb_edges
385
386 def ChangeOrientation(Shape):
387     anObj = ShapesOp.ChangeOrientation(Shape)
388     if ShapesOp.IsDone() == 0:
389       print "ChangeOrientation : ", ShapesOp.GetErrorCode()
390     return anObj
391
392 def OrientationChange(Shape):
393     anObj = ChangeOrientation(Shape)
394     return anObj
395
396 def GetFreeFacesIDs(theShape):
397     anIDs = ShapesOp.GetFreeFacesIDs(theShape)
398     if ShapesOp.IsDone() == 0:
399       print "GetFreeFacesIDs : ", ShapesOp.GetErrorCode()
400     return anIDs
401
402 def GetSharedShapes(theShape1, theShape2, theShapeType):
403     aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
404     if ShapesOp.IsDone() == 0:
405       print "GetSharedShapes : ", ShapesOp.GetErrorCode()
406     return aList
407
408 def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
409     aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
410     if ShapesOp.IsDone() == 0:
411       print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
412     return aList
413
414 def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
415     aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
416     if ShapesOp.IsDone() == 0:
417       print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
418     return aList
419
420 def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
421     aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
422     if ShapesOp.IsDone() == 0:
423       print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
424     return aList
425
426 def GetInPlace(theShapeWhere, theShapeWhat):
427     anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
428     if ShapesOp.IsDone() == 0:
429       print "GetInPlace : ", ShapesOp.GetErrorCode()
430     return anObj
431
432 # -----------------------------------------------------------------------------
433 # Access to sub-shapes by their unique IDs inside the main shape.
434 # -----------------------------------------------------------------------------
435
436 # Obtain a composite sub-shape of <aShape>, composed from sub-shapes
437 # of <aShape>, selected by their unique IDs inside <aShape>
438 def GetSubShape(aShape, ListOfID):
439     anObj = geom.AddSubShape(aShape,ListOfID)
440     return anObj
441
442 # Obtain unique ID of sub-shape <aSubShape> inside <aShape>
443 def GetSubShapeID(aShape, aSubShape):
444     anID = LocalOp.GetSubShapeIndex(aShape, aSubShape)
445     if LocalOp.IsDone() == 0:
446       print "GetSubShapeIndex : ", LocalOp.GetErrorCode()
447     return anID
448
449 # -----------------------------------------------------------------------------
450 # Decompose objects
451 # -----------------------------------------------------------------------------
452
453 def SubShapeAll(aShape, aType):
454     ListObj = ShapesOp.MakeExplode(aShape,aType,0)
455     if ShapesOp.IsDone() == 0:
456       print "MakeExplode : ", ShapesOp.GetErrorCode()
457     return ListObj
458
459 def SubShapeAllIDs(aShape, aType):
460     ListObj = ShapesOp.SubShapeAllIDs(aShape,aType,0)
461     if ShapesOp.IsDone() == 0:
462       print "SubShapeAllIDs : ", ShapesOp.GetErrorCode()
463     return ListObj
464
465 def SubShapeAllSorted(aShape, aType):
466     ListObj = ShapesOp.MakeExplode(aShape,aType,1)
467     if ShapesOp.IsDone() == 0:
468       print "MakeExplode : ", ShapesOp.GetErrorCode()
469     return ListObj
470
471 def SubShapeAllSortedIDs(aShape, aType):
472     ListIDs = ShapesOp.SubShapeAllIDs(aShape,aType,1)
473     if ShapesOp.IsDone() == 0:
474       print "SubShapeAllSortedIDs : ", ShapesOp.GetErrorCode()
475     return ListObj
476
477 # Obtain a compound of sub-shapes of <aShape>,
478 # selected by they indices in list of all sub-shapes of type <aType>
479 def SubShape(aShape, aType, ListOfInd):
480     ListOfIDs = []
481     AllShapeList = SubShapeAll(aShape, aType)
482     for ind in ListOfInd:
483         ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1]))
484     anObj = GetSubShape(aShape, ListOfIDs)
485     return anObj
486
487 # Obtain a compound of sub-shapes of <aShape>,
488 # selected by they indices in sorted list of all sub-shapes of type <aType>
489 def SubShapeSorted(aShape, aType, ListOfInd):
490     ListOfIDs = []
491     AllShapeList = SubShapeAllSorted(aShape, aType)
492     for ind in ListOfInd:
493         ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1]))
494     anObj = GetSubShape(aShape, ListOfIDs)
495     return anObj
496
497 # -----------------------------------------------------------------------------
498 # Healing operations
499 # -----------------------------------------------------------------------------
500
501 def ProcessShape(Shape, Operators, Parameters, Values):
502     anObj = HealOp.ProcessShape(Shape, Operators, Parameters, Values)
503     if HealOp.IsDone() == 0:
504         print "ProcessShape : ", HealOp.GetErrorCode()
505     return anObj
506
507 def SuppressFaces(aShape,ListOfId):
508     anObj = HealOp.SuppressFaces(aShape,ListOfId)
509     if HealOp.IsDone() == 0:
510       print "SuppressFaces : ", HealOp.GetErrorCode()
511     return anObj
512
513 def MakeSewing(ListShape,precision):
514     comp = MakeCompound(ListShape)
515     anObj = Sew(comp,precision)
516     return anObj
517
518 def Sew(aShape,precision):
519     anObj = HealOp.Sew(aShape,precision)
520     if HealOp.IsDone() == 0:
521       print "Sew : ", HealOp.GetErrorCode()
522     return anObj
523
524 def SuppressInternalWires(aShape, Wires):
525     anObj = HealOp.RemoveIntWires(aShape, Wires)
526     if HealOp.IsDone() == 0:
527       print "SuppressInternalWires : ", HealOp.GetErrorCode()
528     return anObj
529
530 def SuppressHoles(aShape, ListOfId):
531     anObj = HealOp.FillHoles(aShape,ListOfId)
532     if HealOp.IsDone() == 0:
533       print "SuppressHoles : ", HealOp.GetErrorCode()
534     return anObj
535
536 def CloseContour(aShape, Wires, IsCommonVertex):
537     anObj = HealOp.CloseContour(aShape, Wires, IsCommonVertex)
538     if HealOp.IsDone() == 0:
539       print "CloseContour : ", HealOp.GetErrorCode()
540     return anObj
541
542 def DivideEdge(aShape, EdgeID, Value, IsByParameter):
543     anObj = HealOp.DivideEdge(aShape, EdgeID, Value, IsByParameter)
544     if HealOp.IsDone() == 0:
545       print "DivideEdge : ", HealOp.GetErrorCode()
546     return anObj
547
548 def GetFreeBoundary(Shape):
549     anObj = HealOp.GetFreeBoundary(Shape)
550     if HealOp.IsDone() == 0:
551       print "GetFreeBoundaries : ", HealOp.GetErrorCode()
552     return anObj
553
554 # -----------------------------------------------------------------------------
555 # Create advanced objects
556 # -----------------------------------------------------------------------------
557
558 def MakeCopy(aShape):
559     anObj = InsertOp.MakeCopy(aShape)
560     if InsertOp.IsDone() == 0:
561       print "MakeCopy : ", InsertOp.GetErrorCode()
562     return anObj
563
564 def MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter):
565     anObj = PrimOp.MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter)
566     if PrimOp.IsDone() == 0:
567       print "MakeFilling : ", PrimOp.GetErrorCode()
568     return anObj
569
570 def MakeGlueFaces(aShape,aTolerance):
571     anObj = ShapesOp.MakeGlueFaces(aShape,aTolerance)
572     if ShapesOp.IsDone() == 0:
573       print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
574     return anObj
575
576 # -----------------------------------------------------------------------------
577 # Boolean (Common, Cut, Fuse, Section)
578 # -----------------------------------------------------------------------------
579
580 def MakeBoolean(shape1,shape2,operation):
581     anObj = BoolOp.MakeBoolean(shape1,shape2,operation)
582     if BoolOp.IsDone() == 0:
583       print "MakeBoolean : ", BoolOp.GetErrorCode()
584     return anObj
585
586 def MakeCommon(s1, s2):
587     return MakeBoolean(s1, s2, 1)
588
589 def MakeCut(s1, s2):
590     return MakeBoolean(s1, s2, 2)
591
592 def MakeFuse(s1, s2):
593     return MakeBoolean(s1, s2, 3)
594
595 def MakeSection(s1, s2):
596     return MakeBoolean(s1, s2, 4)
597
598 def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
599                   Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
600     anObj = BoolOp.MakePartition(ListShapes, ListTools,
601                                  ListKeepInside, ListRemoveInside,
602                                  Limit, RemoveWebs, ListMaterials);
603     if BoolOp.IsDone() == 0:
604       print "MakePartition : ", BoolOp.GetErrorCode()
605     return anObj
606
607 def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
608               Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
609     anObj = MakePartition(ListShapes, ListTools,
610                           ListKeepInside, ListRemoveInside,
611                           Limit, RemoveWebs, ListMaterials);
612     return anObj
613
614 def MakeHalfPartition(theShape, thePlane):
615     anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
616     if BoolOp.IsDone() == 0:
617       print "MakeHalfPartition : ", BoolOp.GetErrorCode()
618     return anObj
619
620 # -----------------------------------------------------------------------------
621 # Transform objects
622 # -----------------------------------------------------------------------------
623
624 def MakeTranslationTwoPoints(aShape,point1,point2):
625     anObj = TrsfOp.TranslateTwoPointsCopy(aShape,point1,point2)
626     if TrsfOp.IsDone() == 0:
627       print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode()
628     return anObj
629
630 def MakeTranslation(aShape,dx,dy,dz):
631     anObj = TrsfOp.TranslateDXDYDZCopy(aShape,dx,dy,dz)
632     if TrsfOp.IsDone() == 0:
633       print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode()
634     return anObj
635
636 def MakeTranslationVector(theObject, theVector):
637     anObj = TrsfOp.TranslateVectorCopy(theObject, theVector)
638     if TrsfOp.IsDone() == 0:
639       print "TranslateVectorCopy : ", TrsfOp.GetErrorCode()
640     return anObj
641
642 def MakeRotation(aShape,axis,angle):
643     anObj = TrsfOp.RotateCopy(aShape,axis,angle)
644     if TrsfOp.IsDone() == 0:
645       print "RotateCopy : ", TrsfOp.GetErrorCode()
646     return anObj
647
648 def MakeScaleTransform(aShape,theCenterofScale,factor):
649     anObj = TrsfOp.ScaleShapeCopy(aShape,theCenterofScale,factor)
650     if TrsfOp.IsDone() == 0:
651       print "ScaleShapeCopy : ", TrsfOp.GetErrorCode()
652     return anObj
653
654 def MakeMirrorByPlane(aShape,aPlane):
655     anObj = TrsfOp.MirrorPlaneCopy(aShape,aPlane)
656     if TrsfOp.IsDone() == 0:
657       print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode()
658     return anObj
659
660 def MakeMirrorByAxis(theObject, theAxis):
661     anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis)
662     if TrsfOp.IsDone() == 0:
663       print "MirrorAxisCopy : ", TrsfOp.GetErrorCode()
664     return anObj
665
666 def MakeMirrorByPoint(theObject, thePoint):
667     anObj = TrsfOp.MirrorPointCopy(theObject, thePoint)
668     if TrsfOp.IsDone() == 0:
669       print "MirrorPointCopy : ", TrsfOp.GetErrorCode()
670     return anObj
671
672 def MakePosition(aShape,theStartLCS,theEndLCS):
673     anObj = TrsfOp.PositionShapeCopy(aShape,theStartLCS,theEndLCS)
674     if TrsfOp.IsDone() == 0:
675       print "PositionShapeCopy : ", TrsfOp.GetErrorCode()
676     return anObj
677
678 def MakeOffset(aShape, anOffset):
679     anObj = TrsfOp.OffsetShapeCopy(aShape, anOffset)
680     if TrsfOp.IsDone() == 0:
681       print "OffsetShapeCopy : ", TrsfOp.GetErrorCode()
682     return anObj
683
684 # -----------------------------------------------------------------------------
685 # Patterns
686 # -----------------------------------------------------------------------------
687
688 def MakeMultiTranslation1D(aShape,aDir,aStep,aNbTimes):
689     anObj = TrsfOp.MultiTranslate1D(aShape,aDir,aStep,aNbTimes)
690     if TrsfOp.IsDone() == 0:
691       print "MultiTranslate1D : ", TrsfOp.GetErrorCode()
692     return anObj
693
694 def MakeMultiTranslation2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2):
695     anObj = TrsfOp.MultiTranslate2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2)
696     if TrsfOp.IsDone() == 0:
697       print "MultiTranslate2D : ", TrsfOp.GetErrorCode()
698     return anObj
699
700 def MultiRotate1D(aShape,aVec,aNbTimes):
701     anObj = TrsfOp.MultiRotate1D(aShape,aVec,aNbTimes)
702     if TrsfOp.IsDone() == 0:
703       print "MultiRotate1D : ", TrsfOp.GetErrorCode()
704     return anObj
705
706 def MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2):
707     anObj = TrsfOp.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
708     if TrsfOp.IsDone() == 0:
709       print "MultiRotate2D : ", TrsfOp.GetErrorCode()
710     return anObj
711
712 def MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes):
713     aVec = MakeLine(aPoint,aDir)
714     anObj = MultiRotate1D(aShape,aVec,aNbTimes)
715     return anObj
716
717 def MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
718     aVec = MakeLine(aPoint,aDir)
719     anObj = MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
720     return anObj
721
722 # -----------------------------------------------------------------------------
723 # Local operations
724 # -----------------------------------------------------------------------------
725
726 def MakeFilletAll(aShape,radius):
727     anObj = LocalOp.MakeFilletAll(aShape,radius)
728     if LocalOp.IsDone() == 0:
729       print "MakeFilletAll : ", LocalOp.GetErrorCode()
730     return anObj
731
732 def MakeFillet(aShape,radius,aShapeType,ListShape):
733     anObj = None
734     if aShapeType == ShapeType["EDGE"]:
735         anObj = LocalOp.MakeFilletEdges(aShape,radius,ListShape)
736     else:
737         anObj = LocalOp.MakeFilletFaces(aShape,radius,ListShape)
738     if LocalOp.IsDone() == 0:
739       print "MakeFillet : ", LocalOp.GetErrorCode()
740     return anObj
741
742 def MakeChamferAll(aShape,d):
743     anObj = LocalOp.MakeChamferAll(aShape,d)
744     if LocalOp.IsDone() == 0:
745       print "MakeChamferAll : ", LocalOp.GetErrorCode()
746     return anObj
747
748 def MakeChamferEdge(aShape,d1,d2,face1,face2):
749     anObj = LocalOp.MakeChamferEdge(aShape,d1,d2,face1,face2)
750     if LocalOp.IsDone() == 0:
751       print "MakeChamferEdge : ", LocalOp.GetErrorCode()
752     return anObj
753
754 def MakeChamferFaces(aShape,d1,d2,ListShape):
755     anObj = LocalOp.MakeChamferFaces(aShape,d1,d2,ListShape)
756     if LocalOp.IsDone() == 0:
757       print "MakeChamferFaces : ", LocalOp.GetErrorCode()
758     return anObj
759
760 def MakeChamfer(aShape,d1,d2,aShapeType,ListShape):
761     anObj = None
762     if aShapeType == ShapeType["EDGE"]:
763         anObj = MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
764     else:
765         anObj = MakeChamferFaces(aShape,d1,d2,ListShape)
766     return anObj
767
768 def Archimede(aShape,weight,WaterDensity,MeshingDeflection):
769     anObj = LocalOp.MakeArchimede(aShape,weight,WaterDensity,MeshingDeflection)
770     if LocalOp.IsDone() == 0:
771       print "MakeArchimede : ", LocalOp.GetErrorCode()
772     return anObj
773
774 # -----------------------------------------------------------------------------
775 # Information objects
776 # -----------------------------------------------------------------------------
777
778 def PointCoordinates(Point):
779     aTuple = MeasuOp.PointCoordinates(Point)
780     if MeasuOp.IsDone() == 0:
781       print "PointCoordinates : ", MeasuOp.GetErrorCode()
782     return aTuple
783
784 def BasicProperties(Shape):
785     aTuple = MeasuOp.GetBasicProperties(Shape)
786     if MeasuOp.IsDone() == 0:
787       print "BasicProperties : ", MeasuOp.GetErrorCode()
788     return aTuple
789
790 def BoundingBox(Shape):
791     aTuple = MeasuOp.GetBoundingBox(Shape)
792     if MeasuOp.IsDone() == 0:
793       print "BoundingBox : ", MeasuOp.GetErrorCode()
794     return aTuple
795
796 def Inertia(Shape):
797     aTuple = MeasuOp.GetInertia(Shape)
798     if MeasuOp.IsDone() == 0:
799       print "Inertia : ", MeasuOp.GetErrorCode()
800     return aTuple
801
802 def MinDistance(Shape1, Shape2):
803     aTuple = MeasuOp.GetMinDistance(Shape1, Shape2)
804     if MeasuOp.IsDone() == 0:
805       print "MinDistance : ", MeasuOp.GetErrorCode()
806     return aTuple[0]
807
808 def Tolerance(Shape):
809     aTuple = MeasuOp.GetTolerance(Shape)
810     if MeasuOp.IsDone() == 0:
811       print "Tolerance : ", MeasuOp.GetErrorCode()
812     return aTuple
813
814 def WhatIs(Shape):
815     aDescr = MeasuOp.WhatIs(Shape)
816     if MeasuOp.IsDone() == 0:
817       print "WhatIs : ", MeasuOp.GetErrorCode()
818     return aDescr
819
820 def MakeCDG(aShape):
821     anObj = MeasuOp.GetCentreOfMass(aShape)
822     if MeasuOp.IsDone() == 0:
823       print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
824     return anObj
825
826 def CheckShape(aShape):
827     (IsValid, Status) = MeasuOp.CheckShape(aShape)
828     if MeasuOp.IsDone() == 0:
829       print "CheckShape : ", MeasuOp.GetErrorCode()
830     else:
831       if IsValid == 0:
832         print Status
833     return IsValid
834
835 # -----------------------------------------------------------------------------
836 # Import/Export objects
837 # -----------------------------------------------------------------------------
838
839 def Import(filename, formatname):
840     anObj = InsertOp.Import(filename, formatname)
841     if InsertOp.IsDone() == 0:
842       print "Import : ", InsertOp.GetErrorCode()
843     return anObj
844
845 def ImportBREP(theFileName):
846     return Import(theFileName, "BREP")
847
848 def ImportIGES(theFileName):
849     return Import(theFileName, "IGES")
850
851 def ImportSTEP(theFileName):
852     return Import(theFileName, "STEP")
853
854 def Export(aShape, filename, formatname):
855     InsertOp.Export(aShape, filename, formatname)
856     if InsertOp.IsDone() == 0:
857       print "Export : ", InsertOp.GetErrorCode()
858
859 def ExportBREP(theObject, theFileName):
860     return Export(theObject, theFileName, "BREP")
861
862 def ExportIGES(theObject, theFileName):
863     return Export(theObject, theFileName, "IGES")
864
865 def ExportSTEP(theObject, theFileName):
866     return Export(theObject, theFileName, "STEP")
867
868 # -----------------------------------------------------------------------------
869 # Block operations
870 # -----------------------------------------------------------------------------
871
872 def MakeQuad(E1, E2, E3, E4):
873     anObj = BlocksOp.MakeQuad(E1, E2, E3, E4)
874     if BlocksOp.IsDone() == 0:
875       print "MakeQuad : ", BlocksOp.GetErrorCode()
876     return anObj
877
878 def MakeQuad2Edges(E1, E2):
879     anObj = BlocksOp.MakeQuad2Edges(E1, E2)
880     if BlocksOp.IsDone() == 0:
881       print "MakeQuad2Edges : ", BlocksOp.GetErrorCode()
882     return anObj
883
884 def MakeQuad4Vertices(V1, V2, V3, V4):
885     anObj = BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
886     if BlocksOp.IsDone() == 0:
887       print "MakeQuad4Vertices : ", BlocksOp.GetErrorCode()
888     return anObj
889
890 def MakeHexa(F1, F2, F3, F4, F5, F6):
891     anObj = BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
892     if BlocksOp.IsDone() == 0:
893       print "MakeHexa : ", BlocksOp.GetErrorCode()
894     return anObj
895
896 def MakeHexa2Faces(F1, F2):
897     anObj = BlocksOp.MakeHexa2Faces(F1, F2)
898     if BlocksOp.IsDone() == 0:
899       print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
900     return anObj
901
902 def GetPoint(theShape, theX, theY, theZ, theEpsilon):
903     anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
904     if BlocksOp.IsDone() == 0:
905       print "GetPoint : ", BlocksOp.GetErrorCode()
906     return anObj
907
908 def GetEdge(theShape, thePoint1, thePoint2):
909     anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
910     if BlocksOp.IsDone() == 0:
911       print "GetEdge : ", BlocksOp.GetErrorCode()
912     return anObj
913
914 def GetEdgeNearPoint(theShape, thePoint):
915     anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint)
916     if BlocksOp.IsDone() == 0:
917       print "GetEdgeNearPoint : ", BlocksOp.GetErrorCode()
918     return anObj
919
920 def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
921     anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
922     if BlocksOp.IsDone() == 0:
923       print "GetFaceByPoints : ", BlocksOp.GetErrorCode()
924     return anObj
925
926 def GetFaceByEdges(theShape, theEdge1, theEdge2):
927     anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
928     if BlocksOp.IsDone() == 0:
929       print "GetFaceByEdges : ", BlocksOp.GetErrorCode()
930     return anObj
931
932 def GetOppositeFace(theBlock, theFace):
933     anObj = BlocksOp.GetOppositeFace(theBlock, theFace)
934     if BlocksOp.IsDone() == 0:
935       print "GetOppositeFace : ", BlocksOp.GetErrorCode()
936     return anObj
937
938 def GetFaceNearPoint(theShape, thePoint):
939     anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint)
940     if BlocksOp.IsDone() == 0:
941       print "GetFaceNearPoint : ", BlocksOp.GetErrorCode()
942     return anObj
943
944 def GetFaceByNormale(theBlock, theVector):
945     anObj = BlocksOp.GetFaceByNormale(theBlock, theVector)
946     if BlocksOp.IsDone() == 0:
947       print "GetFaceByNormale : ", BlocksOp.GetErrorCode()
948     return anObj
949
950 def CheckCompoundOfBlocks(theCompound):
951     (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound)
952     if BlocksOp.IsDone() == 0:
953       print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode()
954     else:
955       if IsValid == 0:
956         Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors)
957         print Descr
958     return IsValid
959
960 def RemoveExtraEdges(theShape):
961     anObj = BlocksOp.RemoveExtraEdges(theShape)
962     if BlocksOp.IsDone() == 0:
963       print "RemoveExtraEdges : ", BlocksOp.GetErrorCode()
964     return anObj
965
966 def CheckAndImprove(theShape):
967     anObj = BlocksOp.CheckAndImprove(theShape)
968     if BlocksOp.IsDone() == 0:
969       print "CheckAndImprove : ", BlocksOp.GetErrorCode()
970     return anObj
971
972 def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
973     aList = BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
974     if BlocksOp.IsDone() == 0:
975       print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
976     return aList
977
978 def GetBlockNearPoint(theCompound, thePoint):
979     anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
980     if BlocksOp.IsDone() == 0:
981       print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
982     return anObj
983
984 def GetBlockByParts(theCompound, theParts):
985     anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
986     if BlocksOp.IsDone() == 0:
987       print "GetBlockByParts : ", BlocksOp.GetErrorCode()
988     return anObj
989
990 def GetBlocksByParts(theCompound, theParts):
991     aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
992     if BlocksOp.IsDone() == 0:
993       print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
994     return aList
995
996 def MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes):
997     anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes)
998     if BlocksOp.IsDone() == 0:
999       print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode()
1000     return anObj
1001
1002 def MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU,
1003                                      DirFaceID1V, DirFaceID2V, NbTimesV):
1004     anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU,
1005                                                       DirFaceID1V, DirFaceID2V, NbTimesV)
1006     if BlocksOp.IsDone() == 0:
1007       print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode()
1008     return anObj
1009
1010 def Propagate(theShape):
1011     listChains = BlocksOp.Propagate(theShape)
1012     if BlocksOp.IsDone() == 0:
1013       print "Propagate : ", BlocksOp.GetErrorCode()
1014     return listChains
1015
1016 # -----------------------------------------------------------------------------
1017 # Group operations
1018 # -----------------------------------------------------------------------------
1019
1020 def CreateGroup(MainShape, ShapeType):
1021     anObj = GroupOp.CreateGroup(MainShape, ShapeType)
1022     if GroupOp.IsDone() == 0:
1023        print "CreateGroup : ", GroupOp.GetErrorCode()
1024     return anObj
1025
1026 def AddObject(Group, SubShapeID):
1027     GroupOp.AddObject(Group, SubShapeID)
1028     if GroupOp.IsDone() == 0:
1029       print "AddObject : ", GroupOp.GetErrorCode()
1030
1031 def RemoveObject(Group, SubShapeID):
1032     GroupOp.RemoveObject(Group, SubShapeID)
1033     if GroupOp.IsDone() == 0:
1034       print "RemoveObject : ", GroupOp.GetErrorCode()
1035
1036 def UnionList (theGroup, theSubShapes):
1037     GroupOp.UnionList(theGroup, theSubShapes)
1038     if GroupOp.IsDone() == 0:
1039       print "UnionList : ", GroupOp.GetErrorCode()
1040
1041 def DifferenceList (theGroup, theSubShapes):
1042     GroupOp.DifferenceList(theGroup, theSubShapes)
1043     if GroupOp.IsDone() == 0:
1044       print "DifferenceList : ", GroupOp.GetErrorCode()
1045
1046 def GetObjectIDs(Group):
1047     ListIDs = GroupOp.GetObjects(Group)
1048     if GroupOp.IsDone() == 0:
1049       print "GetObjectIDs : ", GroupOp.GetErrorCode()
1050     return ListIDs
1051
1052 def GetType(theGroup):
1053     aType = GroupOp.GetType(theGroup)
1054     if GroupOp.IsDone() == 0:
1055       print "GetType : ", GroupOp.GetErrorCode()
1056     return aType
1057
1058 def GetMainShape(theGroup):
1059     anObj = GroupOp.GetMainShape(theGroup)
1060     if GroupOp.IsDone() == 0:
1061       print "GetMainShape : ", GroupOp.GetErrorCode()
1062     return anObj
1063
1064 def GetEdgesByLength (theShape, min_length, max_length, include_min = 1, include_max = 1):
1065     """
1066     Create group of edges of theShape, whose length is in range [min_length, max_length].
1067     If include_min/max == 0, edges with length == min/max_length will not be included in result.
1068     """
1069
1070     edges = SubShapeAll(theShape, ShapeType["EDGE"])
1071     edges_in_range = []
1072     for edge in edges:
1073         Props = BasicProperties(edge)
1074         if min_length <= Props[0] and Props[0] <= max_length:
1075             if (not include_min) and (min_length == Props[0]):
1076                 skip = 1
1077             else:
1078                 if (not include_max) and (Props[0] == max_length):
1079                     skip = 1
1080                 else:
1081                     edges_in_range.append(edge)
1082
1083     if len(edges_in_range) <= 0:
1084         print "No edges found by given criteria"
1085         return 0
1086
1087     group_edges = CreateGroup(theShape, ShapeType["EDGE"])
1088     UnionList(group_edges, edges_in_range)
1089
1090     return group_edges
1091
1092 # Add Path to the system path
1093 #
1094 def addPath(Path):
1095     if (sys.path.count(Path) < 1):
1096         sys.path.append(Path)