Salome HOME
Implementation of gluing faces by given list (for PAL13191).
[modules/geom.git] / src / GEOM_SWIG / batchmode_geompy.py
index 93e695b96a44c0c345a531132a08fbe4e4d978ad..0f91c8c9dcf4b9e4210e32176a133cf95ea46771 100644 (file)
@@ -17,7 +17,7 @@
 #  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 #
 #
@@ -31,15 +31,45 @@ import GEOM
 
 g=None
 step = 0
-while step < 50 and g == None:
+sleeping_time = 0.01
+sleeping_time_max = 1.0
+while 1:
     g = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
+    if g is not None: break
     step = step + 1
-    time.sleep(4)
+    if step > 100: break
+    time.sleep(sleeping_time)
+    sleeping_time = max(sleeping_time_max, 2*sleeping_time)
+    pass
 geom = g._narrow( GEOM.GEOM_Gen )
-myBuilder = myStudy.NewBuilder()
 
-father = myStudy.FindComponent("GEOM")
-if father is None:
+myBuilder = None
+myStudyId = 0
+father    = None
+
+BasicOp  = None
+CurvesOp = None
+PrimOp   = None
+ShapesOp = None
+HealOp   = None
+InsertOp = None
+BoolOp   = None
+TrsfOp   = None
+LocalOp  = None
+MeasuOp  = None
+BlocksOp = None
+GroupOp  = None
+
+def init_geom(theStudy):
+
+    global myStudy, myBuilder, myStudyId, BasicOp, CurvesOp, PrimOp, ShapesOp, HealOp
+    global InsertOp, BoolOp, TrsfOp, LocalOp, MeasuOp, BlocksOp, GroupOp, father
+
+    myStudy = theStudy
+    myStudyId = myStudy._get_StudyId()
+    myBuilder = myStudy.NewBuilder()
+    father = myStudy.FindComponent("GEOM")
+    if father is None:
         father = myBuilder.NewComponent("GEOM")
         A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName")
         FName = A1._narrow(SALOMEDS.AttributeName)
@@ -48,20 +78,37 @@ if father is None:
        aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
        aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
        myBuilder.DefineComponentInstance(father,geom)
-
-# -----------------------------------------------------------------------------
-# add To Study
-# -----------------------------------------------------------------------------
-
+        pass
+
+    # -----------------------------------------------------------------------------
+    # Assign Operations Interfaces
+    # -----------------------------------------------------------------------------
+
+    BasicOp  = geom.GetIBasicOperations    (myStudyId)
+    CurvesOp = geom.GetICurvesOperations   (myStudyId)
+    PrimOp   = geom.GetI3DPrimOperations   (myStudyId)
+    ShapesOp = geom.GetIShapesOperations   (myStudyId)
+    HealOp   = geom.GetIHealingOperations  (myStudyId)
+    InsertOp = geom.GetIInsertOperations   (myStudyId)
+    BoolOp   = geom.GetIBooleanOperations  (myStudyId)
+    TrsfOp   = geom.GetITransformOperations(myStudyId)
+    LocalOp  = geom.GetILocalOperations    (myStudyId)
+    MeasuOp  = geom.GetIMeasureOperations  (myStudyId)
+    BlocksOp = geom.GetIBlocksOperations   (myStudyId)
+    GroupOp  = geom.GetIGroupOperations   (myStudyId)
+    pass
+
+init_geom(myStudy)
+
+#     *  Get name for sub-shape aSubObj of shape aMainObj
+#
 def SubShapeName(aSubObj, aMainObj):
     name = "SubShape"
     print name
     return name
 
-# -----------------------------------------------------------------------------
-# Operations
-# -----------------------------------------------------------------------------
-
+#     *  Publish in study aShape with name aName
+#
 def addToStudy(aShape, aName):
     try:
         aSObject = geom.AddInStudy(myStudy, aShape, aName, None)
@@ -70,11 +117,11 @@ def addToStudy(aShape, aName):
         return ""
     return aShape.GetStudyEntry()
 
+#     *  Publish in study aShape with name aName as sub-object of previously published aFather
+#
 def addToStudyInFather(aFather, aShape, aName):
     try:
-#        myBuilder.NewCommand()
         aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather)
-#        myBuilder.CommitCommand()
     except:
         print "addToStudyInFather() failed"
         return ""
@@ -86,29 +133,12 @@ def addToStudyInFather(aFather, aShape, aName):
 
 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
 
-# -----------------------------------------------------------------------------
-# Get Operations Interfaces
-# -----------------------------------------------------------------------------
-
-BasicOp  = geom.GetIBasicOperations    (myStudyId)
-CurvesOp = geom.GetICurvesOperations   (myStudyId)
-PrimOp   = geom.GetI3DPrimOperations   (myStudyId)
-ShapesOp = geom.GetIShapesOperations   (myStudyId)
-HealOp   = geom.GetIHealingOperations  (myStudyId)
-InsertOp = geom.GetIInsertOperations   (myStudyId)
-BoolOp   = geom.GetIBooleanOperations  (myStudyId)
-TrsfOp   = geom.GetITransformOperations(myStudyId)
-LocalOp  = geom.GetILocalOperations    (myStudyId)
-MeasuOp  = geom.GetIMeasureOperations  (myStudyId)
-BlocksOp = geom.GetIBlocksOperations   (myStudyId)
-GroupOp  = geom.GetIGroupOperations   (myStudyId)
-
 # -----------------------------------------------------------------------------
 # Basic primitives
 # -----------------------------------------------------------------------------
 
-def MakeVertex(x,y,z):
-    anObj = BasicOp.MakePointXYZ(x,y,z)
+def MakeVertex(theX, theY, theZ):
+    anObj = BasicOp.MakePointXYZ(theX, theY, theZ)
     if BasicOp.IsDone() == 0:
       print "MakePointXYZ : ", BasicOp.GetErrorCode()
     return anObj
@@ -173,6 +203,30 @@ def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
       print "MakeMarker : ", BasicOp.GetErrorCode()
     return anObj
 
+def MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec):
+    """
+     *  Create a local coordinate system.
+     *  \param theOrigin Point of coordinate system origin.
+     *  \param theXVec Vector of X direction
+     *  \param theYVec Vector of Y direction
+     *  \return New GEOM_Object, containing the created coordinate system.
+    """
+    O = PointCoordinates( theOrigin )
+    OXOY = []
+    for vec in [ theXVec, theYVec ]:
+        v1, v2 = SubShapeAll( vec, ShapeType["VERTEX"] )
+        p1 = PointCoordinates( v1 )
+        p2 = PointCoordinates( v2 )
+        for i in range( 0, 3 ):
+             OXOY.append( p2[i] - p1[i] )
+    #
+    anObj = BasicOp.MakeMarker( O[0], O[1], O[2],
+                                OXOY[0], OXOY[1], OXOY[2],
+                                OXOY[3], OXOY[4], OXOY[5], )
+    if BasicOp.IsDone() == 0:
+      print "MakeMarker : ", BasicOp.GetErrorCode()
+    return anObj
+
 # -----------------------------------------------------------------------------
 # Curves
 # -----------------------------------------------------------------------------
@@ -227,6 +281,21 @@ def MakeSketcher(Cmd, WPL = [0,0,0, 0,0,1, 1,0,0]):
       print "MakeSketcher : ", CurvesOp.GetErrorCode()
     return anObj
 
+def MakeSketcherOnPlane(theCommand, theWorkingPlane):
+    """
+     *  Create a sketcher (wire or face), following the textual description,
+     *  passed through \a theCommand argument. \n
+     *  For format of the description string see the previous method.\n
+     *  \param theCommand String, defining the sketcher in local
+     *                    coordinates of the working plane.
+     *  \param theWorkingPlane Planar Face of the working plane.
+     *  \return New GEOM_Object, containing the created wire.
+    """
+    anObj = CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
+    if CurvesOp.IsDone() == 0:
+      print "MakeSketcher : ", CurvesOp.GetErrorCode()
+    return anObj
+
 # -----------------------------------------------------------------------------
 # Create 3D Primitives
 # -----------------------------------------------------------------------------
@@ -375,6 +444,18 @@ def MakeCompound(ListShape):
       print "MakeCompound : ", ShapesOp.GetErrorCode()
     return anObj
 
+def NumberOfFaces(theShape):
+    nb_faces = ShapesOp.NumberOfFaces(theShape)
+    if ShapesOp.IsDone() == 0:
+      print "NumberOfFaces : ", ShapesOp.GetErrorCode()
+    return nb_faces
+
+def NumberOfEdges(theShape):
+    nb_edges = ShapesOp.NumberOfEdges(theShape)
+    if ShapesOp.IsDone() == 0:
+      print "NumberOfEdges : ", ShapesOp.GetErrorCode()
+    return nb_edges
+
 def ChangeOrientation(Shape):
     anObj = ShapesOp.ChangeOrientation(Shape)
     if ShapesOp.IsDone() == 0:
@@ -385,6 +466,72 @@ def OrientationChange(Shape):
     anObj = ChangeOrientation(Shape)
     return anObj
 
+def GetFreeFacesIDs(theShape):
+    anIDs = ShapesOp.GetFreeFacesIDs(theShape)
+    if ShapesOp.IsDone() == 0:
+      print "GetFreeFacesIDs : ", ShapesOp.GetErrorCode()
+    return anIDs
+
+def GetSharedShapes(theShape1, theShape2, theShapeType):
+    aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
+    if ShapesOp.IsDone() == 0:
+      print "GetSharedShapes : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
+    aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
+    if ShapesOp.IsDone() == 0:
+      print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState):
+    aList = ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
+    if ShapesOp.IsDone() == 0:
+        print "GetShapesOnPlaneIDs : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
+    aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
+    if ShapesOp.IsDone() == 0:
+      print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState):
+    aList = ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
+    if ShapesOp.IsDone() == 0:
+        print "GetShapesOnCylinderIDs : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
+    aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
+    if ShapesOp.IsDone() == 0:
+      print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState):
+    aList = ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
+    if ShapesOp.IsDone() == 0:
+        print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
+    aList = ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
+    if ShapesOp.IsDone() == 0:
+      print "GetShapesOnQuadrangle : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
+    aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
+    if ShapesOp.IsDone() == 0:
+        print "GetShapesOnQuadrangleIDs : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetInPlace(theShapeWhere, theShapeWhat):
+    anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
+    if ShapesOp.IsDone() == 0:
+      print "GetInPlace : ", ShapesOp.GetErrorCode()
+    return anObj
+
 # -----------------------------------------------------------------------------
 # Access to sub-shapes by their unique IDs inside the main shape.
 # -----------------------------------------------------------------------------
@@ -412,12 +559,24 @@ def SubShapeAll(aShape, aType):
       print "MakeExplode : ", ShapesOp.GetErrorCode()
     return ListObj
 
-def SubShapeAllSorted(aShape,aType):
+def SubShapeAllIDs(aShape, aType):
+    ListObj = ShapesOp.SubShapeAllIDs(aShape,aType,0)
+    if ShapesOp.IsDone() == 0:
+      print "SubShapeAllIDs : ", ShapesOp.GetErrorCode()
+    return ListObj
+
+def SubShapeAllSorted(aShape, aType):
     ListObj = ShapesOp.MakeExplode(aShape,aType,1)
     if ShapesOp.IsDone() == 0:
       print "MakeExplode : ", ShapesOp.GetErrorCode()
     return ListObj
 
+def SubShapeAllSortedIDs(aShape, aType):
+    ListIDs = ShapesOp.SubShapeAllIDs(aShape,aType,1)
+    if ShapesOp.IsDone() == 0:
+      print "SubShapeAllSortedIDs : ", ShapesOp.GetErrorCode()
+    return ListObj
+
 # Obtain a compound of sub-shapes of <aShape>,
 # selected by they indices in list of all sub-shapes of type <aType>
 def SubShape(aShape, aType, ListOfInd):
@@ -555,6 +714,12 @@ def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
                           Limit, RemoveWebs, ListMaterials);
     return anObj
 
+def MakeHalfPartition(theShape, thePlane):
+    anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
+    if BoolOp.IsDone() == 0:
+      print "MakeHalfPartition : ", BoolOp.GetErrorCode()
+    return anObj
+
 # -----------------------------------------------------------------------------
 # Transform objects
 # -----------------------------------------------------------------------------
@@ -571,12 +736,24 @@ def MakeTranslation(aShape,dx,dy,dz):
       print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode()
     return anObj
 
+def MakeTranslationVector(theObject, theVector):
+    anObj = TrsfOp.TranslateVectorCopy(theObject, theVector)
+    if TrsfOp.IsDone() == 0:
+      print "TranslateVectorCopy : ", TrsfOp.GetErrorCode()
+    return anObj
+
 def MakeRotation(aShape,axis,angle):
     anObj = TrsfOp.RotateCopy(aShape,axis,angle)
     if TrsfOp.IsDone() == 0:
       print "RotateCopy : ", TrsfOp.GetErrorCode()
     return anObj
 
+def MakeRotationThreePoints(aShape, centpoint, point1, point2):
+    anObj = TrsfOp.RotateThreePointsCopy(aShape, centpoint, point1, point2)
+    if TrsfOp.IsDone() == 0:
+      print "RotateThreePointsCopy : ", TrsfOp.GetErrorCode()
+    return anObj
+
 def MakeScaleTransform(aShape,theCenterofScale,factor):
     anObj = TrsfOp.ScaleShapeCopy(aShape,theCenterofScale,factor)
     if TrsfOp.IsDone() == 0:
@@ -589,6 +766,18 @@ def MakeMirrorByPlane(aShape,aPlane):
       print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode()
     return anObj
 
+def MakeMirrorByAxis(theObject, theAxis):
+    anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis)
+    if TrsfOp.IsDone() == 0:
+      print "MirrorAxisCopy : ", TrsfOp.GetErrorCode()
+    return anObj
+
+def MakeMirrorByPoint(theObject, thePoint):
+    anObj = TrsfOp.MirrorPointCopy(theObject, thePoint)
+    if TrsfOp.IsDone() == 0:
+      print "MirrorPointCopy : ", TrsfOp.GetErrorCode()
+    return anObj
+
 def MakePosition(aShape,theStartLCS,theEndLCS):
     anObj = TrsfOp.PositionShapeCopy(aShape,theStartLCS,theEndLCS)
     if TrsfOp.IsDone() == 0:
@@ -743,8 +932,12 @@ def MakeCDG(aShape):
       print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
     return anObj
 
-def CheckShape(aShape):
-    (IsValid, Status) = MeasuOp.CheckShape(aShape)
+def CheckShape(theShape, theIsCheckGeom = 0):
+    if theIsCheckGeom:
+        (IsValid, Status) = MeasuOp.CheckShapeWithGeometry(theShape)
+    else:
+        (IsValid, Status) = MeasuOp.CheckShape(theShape)
+
     if MeasuOp.IsDone() == 0:
       print "CheckShape : ", MeasuOp.GetErrorCode()
     else:
@@ -762,11 +955,29 @@ def Import(filename, formatname):
       print "Import : ", InsertOp.GetErrorCode()
     return anObj
 
+def ImportBREP(theFileName):
+    return Import(theFileName, "BREP")
+
+def ImportIGES(theFileName):
+    return Import(theFileName, "IGES")
+
+def ImportSTEP(theFileName):
+    return Import(theFileName, "STEP")
+
 def Export(aShape, filename, formatname):
     InsertOp.Export(aShape, filename, formatname)
     if InsertOp.IsDone() == 0:
       print "Export : ", InsertOp.GetErrorCode()
 
+def ExportBREP(theObject, theFileName):
+    return Export(theObject, theFileName, "BREP")
+
+def ExportIGES(theObject, theFileName):
+    return Export(theObject, theFileName, "IGES")
+
+def ExportSTEP(theObject, theFileName):
+    return Export(theObject, theFileName, "STEP")
+
 # -----------------------------------------------------------------------------
 # Block operations
 # -----------------------------------------------------------------------------
@@ -801,6 +1012,100 @@ def MakeHexa2Faces(F1, F2):
       print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
     return anObj
 
+def GetPoint(theShape, theX, theY, theZ, theEpsilon):
+    anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
+    if BlocksOp.IsDone() == 0:
+      print "GetPoint : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetEdge(theShape, thePoint1, thePoint2):
+    anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
+    if BlocksOp.IsDone() == 0:
+      print "GetEdge : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetEdgeNearPoint(theShape, thePoint):
+    anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint)
+    if BlocksOp.IsDone() == 0:
+      print "GetEdgeNearPoint : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
+    anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
+    if BlocksOp.IsDone() == 0:
+      print "GetFaceByPoints : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetFaceByEdges(theShape, theEdge1, theEdge2):
+    anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
+    if BlocksOp.IsDone() == 0:
+      print "GetFaceByEdges : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetOppositeFace(theBlock, theFace):
+    anObj = BlocksOp.GetOppositeFace(theBlock, theFace)
+    if BlocksOp.IsDone() == 0:
+      print "GetOppositeFace : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetFaceNearPoint(theShape, thePoint):
+    anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint)
+    if BlocksOp.IsDone() == 0:
+      print "GetFaceNearPoint : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetFaceByNormale(theBlock, theVector):
+    anObj = BlocksOp.GetFaceByNormale(theBlock, theVector)
+    if BlocksOp.IsDone() == 0:
+      print "GetFaceByNormale : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def CheckCompoundOfBlocks(theCompound):
+    (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound)
+    if BlocksOp.IsDone() == 0:
+      print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode()
+    else:
+      if IsValid == 0:
+        Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors)
+        print Descr
+    return IsValid
+
+def RemoveExtraEdges(theShape):
+    anObj = BlocksOp.RemoveExtraEdges(theShape)
+    if BlocksOp.IsDone() == 0:
+      print "RemoveExtraEdges : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def CheckAndImprove(theShape):
+    anObj = BlocksOp.CheckAndImprove(theShape)
+    if BlocksOp.IsDone() == 0:
+      print "CheckAndImprove : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
+    aList = BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
+    if BlocksOp.IsDone() == 0:
+      print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
+    return aList
+
+def GetBlockNearPoint(theCompound, thePoint):
+    anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
+    if BlocksOp.IsDone() == 0:
+      print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetBlockByParts(theCompound, theParts):
+    anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
+    if BlocksOp.IsDone() == 0:
+      print "GetBlockByParts : ", BlocksOp.GetErrorCode()
+    return anObj
+
+def GetBlocksByParts(theCompound, theParts):
+    aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
+    if BlocksOp.IsDone() == 0:
+      print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
+    return aList
+
 def MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes):
     anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes)
     if BlocksOp.IsDone() == 0:
@@ -815,21 +1120,11 @@ def MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU,
       print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode()
     return anObj
 
-def MakeBlockExplode(Compound, MinNbFaces, MaxNbFaces):
-    aList = BlocksOp.ExplodeCompoundOfBlocks(Compound, MinNbFaces, MaxNbFaces)
+def Propagate(theShape):
+    listChains = BlocksOp.Propagate(theShape)
     if BlocksOp.IsDone() == 0:
-      print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
-    return aList
-
-def CheckCompoundOfBlocks(Compound):
-    (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(Compound)
-    if BlocksOp.IsDone() == 0:
-      print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode()
-    else:
-      if IsValid == 0:
-        Descr = BlocksOp.PrintBCErrors(Compound, BCErrors)
-        print Descr
-    return IsValid
+      print "Propagate : ", BlocksOp.GetErrorCode()
+    return listChains
 
 # -----------------------------------------------------------------------------
 # Group operations
@@ -851,12 +1146,74 @@ def RemoveObject(Group, SubShapeID):
     if GroupOp.IsDone() == 0:
       print "RemoveObject : ", GroupOp.GetErrorCode()
 
+def UnionList (theGroup, theSubShapes):
+    GroupOp.UnionList(theGroup, theSubShapes)
+    if GroupOp.IsDone() == 0:
+      print "UnionList : ", GroupOp.GetErrorCode()
+
+def UnionIDs(theGroup, theSubShapes):
+    GroupOp.UnionIDs(theGroup, theSubShapes)
+    if GroupOp.IsDone() == 0:
+        print "UnionIDs : ", GroupOp.GetErrorCode()
+
+def DifferenceList (theGroup, theSubShapes):
+    GroupOp.DifferenceList(theGroup, theSubShapes)
+    if GroupOp.IsDone() == 0:
+      print "DifferenceList : ", GroupOp.GetErrorCode()
+
+def DifferenceIDs(theGroup, theSubShapes):
+    GroupOp.DifferenceIDs(theGroup, theSubShapes)
+    if GroupOp.IsDone() == 0:
+        print "DifferenceIDs : ", GroupOp.GetErrorCode()
+
 def GetObjectIDs(Group):
     ListIDs = GroupOp.GetObjects(Group)
     if GroupOp.IsDone() == 0:
       print "GetObjectIDs : ", GroupOp.GetErrorCode()
     return ListIDs
 
+def GetType(theGroup):
+    aType = GroupOp.GetType(theGroup)
+    if GroupOp.IsDone() == 0:
+      print "GetType : ", GroupOp.GetErrorCode()
+    return aType
+
+def GetMainShape(theGroup):
+    anObj = GroupOp.GetMainShape(theGroup)
+    if GroupOp.IsDone() == 0:
+      print "GetMainShape : ", GroupOp.GetErrorCode()
+    return anObj
+
+def GetEdgesByLength (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.
+    """
+
+    edges = SubShapeAll(theShape, ShapeType["EDGE"])
+    edges_in_range = []
+    for edge in edges:
+        Props = BasicProperties(edge)
+       if min_length <= Props[0] and Props[0] <= max_length:
+           if (not include_min) and (min_length == Props[0]):
+               skip = 1
+            else:
+               if (not include_max) and (Props[0] == max_length):
+                   skip = 1
+                else:
+                   edges_in_range.append(edge)
+
+    if len(edges_in_range) <= 0:
+        print "No edges found by given criteria"
+       return 0
+
+    group_edges = CreateGroup(theShape, ShapeType["EDGE"])
+    UnionList(group_edges, edges_in_range)
+
+    return group_edges
+
+# Add Path to the system path
+#
 def addPath(Path):
     if (sys.path.count(Path) < 1):
        sys.path.append(Path)