Salome HOME
Fix for bug PAL12858(EDF210 GEOM Preferences menu of GEOM: color of the wireframe?)
[modules/geom.git] / src / GEOM_SWIG / batchmode_geompy.py
index fb2c74e31543de18f64dd46f9928b006769534ac..52ccbdfff6afc2b063b51e1d9d196b182c55e529 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,10 +31,16 @@ 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 = None
@@ -46,19 +52,19 @@ CurvesOp = None
 PrimOp   = None
 ShapesOp = None
 HealOp   = None
-InsertOp = None 
-BoolOp   = None 
+InsertOp = None
+BoolOp   = None
 TrsfOp   = None
 LocalOp  = None
 MeasuOp  = None
 BlocksOp = None
-GroupOp  = 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()
@@ -73,7 +79,7 @@ def init_geom(theStudy):
        aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
        myBuilder.DefineComponentInstance(father,geom)
         pass
-        
+
     # -----------------------------------------------------------------------------
     # Assign Operations Interfaces
     # -----------------------------------------------------------------------------
@@ -89,7 +95,7 @@ def init_geom(theStudy):
     LocalOp  = geom.GetILocalOperations    (myStudyId)
     MeasuOp  = geom.GetIMeasureOperations  (myStudyId)
     BlocksOp = geom.GetIBlocksOperations   (myStudyId)
-    GroupOp  = geom.GetIGroupOperations   (myStudyId) 
+    GroupOp  = geom.GetIGroupOperations   (myStudyId)
     pass
 
 init_geom(myStudy)
@@ -478,18 +484,48 @@ def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
       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:
@@ -890,8 +926,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:
@@ -1105,11 +1145,21 @@ def 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: