]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Merge Python 3 porting.
authorrnv <rnv@opencascade.com>
Thu, 22 Jun 2017 14:55:49 +0000 (17:55 +0300)
committerrnv <rnv@opencascade.com>
Tue, 27 Jun 2017 16:30:58 +0000 (19:30 +0300)
41 files changed:
1  2 
doc/salome/examples/angle.py
doc/salome/examples/basic_properties.py
doc/salome/examples/blocks_operations_ex03.py
doc/salome/examples/bounding_box.py
doc/salome/examples/center_of_mass.py
doc/salome/examples/check_compound_of_blocks.py
doc/salome/examples/check_self_intersections.py
doc/salome/examples/check_self_intersections_fast.py
doc/salome/examples/check_shape.py
doc/salome/examples/fast_intersection.py
doc/salome/examples/free_boundaries.py
doc/salome/examples/free_faces.py
doc/salome/examples/inertia.py
doc/salome/examples/min_distance.py
doc/salome/examples/normal_face.py
doc/salome/examples/point_coordinates.py
doc/salome/examples/repairing_operations_ex01.py
doc/salome/examples/tolerance.py
doc/salome/examples/whatis.py
src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
src/GEOM_I/GEOM_Gen_i.cc
src/GEOM_PY/geomtools.py
src/GEOM_PY/sketcher.py
src/GEOM_PY/structelem/__init__.py
src/GEOM_PY/structelem/parts.py
src/GEOM_SWIG/BREPPluginBuilder.py
src/GEOM_SWIG/GEOM_ObjectInfo.py
src/GEOM_SWIG/GEOM_example.py
src/GEOM_SWIG/GEOM_example6.py
src/GEOM_SWIG/IGESPluginBuilder.py
src/GEOM_SWIG/PAL_MESH_028_geometry.py
src/GEOM_SWIG/STEPPluginBuilder.py
src/GEOM_SWIG/STLPluginBuilder.py
src/GEOM_SWIG/VTKPluginBuilder.py
src/GEOM_SWIG/geomBuilder.py
src/GEOM_SWIG/geompy.py
src/GEOM_SWIG/gsketcher.py
src/GEOM_SWIG_WITHIHM/CMakeLists.txt
src/Tools/t_shape/t_shape_builder.py
src/Tools/t_shape/t_shape_dialog.py
src/XAO_Swig/CMakeLists.txt

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 553a763e8d3a3911dbcb409ad2b222b48c69311e,15241bd0822eadfedf8deb77e169094b02297f9f..5c99e5876f4250cc0a94afdaa8a28316e1306663
@@@ -594,8 -599,8 +595,8 @@@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SAL
    // Prepare a file name to open
    TCollection_AsciiString aNameWithExt("");
    if (isMultiFile)
--    aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
-                                                    (getStudyServant()->URL())).c_str());
 -                                                   (Kernel_Utils::encode(theComponent->GetStudy()->URL()))).c_str());
++    aNameWithExt = TCollection_AsciiString( (char*)(SALOMEDS_Tool::GetNameFromPath( 
++                                         Kernel_Utils::encode(getStudyServant()->URL())).c_str()));
  #if OCC_VERSION_MAJOR > 6
    aNameWithExt += TCollection_AsciiString("_GEOM.cbf");
  #else
Simple merge
Simple merge
index cf5ef97aabee87e9e9b2794ea2a11adcb8cb65e5,648e6d9b49813e9c5ab2ebd45765f2a91097ab8d..04d12a1ff66ad060d619ff8e244e572043f2b377
@@@ -244,10 -252,11 +244,10 @@@ class StructuralElementManager
                      
                      # Create the part
                      try:
 -                        part = parts.__dict__[parttype](
 -                                        self._studyEditor.studyId, meshGroup,
 -                                        groupGeomObj, newparams)
 +                        part = parts.__dict__[parttype](meshGroup,
 +                                                        groupGeomObj, newparams)
                          element.addPart(part)
-                     except InvalidParameterError, e:
+                     except InvalidParameterError as e:
                          logger.error("Invalid parameter error: %s" % e)
                          raise
                      except:
@@@ -434,8 -452,8 +434,9 @@@ class StructuralElement
          different parts of the structural element, and add them to the study.
          """
          gg = salome.ImportComponentGUI("GEOM")
 -        geompy = getGeompy(self._studyEditor.studyId)
++
 +        geompy = getGeompy()
-         for part in self._parts.itervalues():
+         for part in self._parts.values():
              # Build the structural element part
              logger.debug("Building %s" % part)
              try:
index 01b665042fff834f28e292d3b797b3a3eeafef9b,61cdd7d04f67e07a4b0d8d699ecc678eb54854c1..d2f46a9b808d3ed273905c9edc2da254bf7cfa31
@@@ -450,10 -454,10 +450,10 @@@ class CircularBeam(Beam)
  
      """
  
 -    def __init__(self, studyId, groupName, groupGeomObj, parameters,
 +    def __init__(self, groupName, groupGeomObj, parameters,
                   name = Beam.DEFAULT_NAME, color = None):
          if color is None:
-             if parameters.has_key("R1"): # variable section
+             if "R1" in parameters: # variable section
                  color = LIGHT_RED
              else:                       # constant section
                  color = RED
@@@ -562,10 -566,10 +562,10 @@@ class RectangularBeam(Beam)
  
      """
  
 -    def __init__(self, studyId, groupName, groupGeomObj, parameters,
 +    def __init__(self, groupName, groupGeomObj, parameters,
                   name = Beam.DEFAULT_NAME, color = None):
          if color is None:
-             if parameters.has_key("HY1") or parameters.has_key("H1"):
+             if "HY1" in parameters or "H1" in parameters:
                  color = LIGHT_BLUE # variable section
              else:                  # constant section
                  color = BLUE
Simple merge
index 84c40fdd25ad78e50920cd7a165cc8aa062a7d6f,3e74aa8876d2aa431de2acd4d306c2e39abd3deb..9a686cb60e6a333ebaf0acb24b6e32374a5a2882
@@@ -47,12 -47,12 +47,12 @@@ obj5_entry = geompy.addToStudy(obj5, "O
  
  # Get information about objects
  hasInfo = geompy.hasObjectInfo()
- print "Check if GEOM module provides information about its objects: ", hasInfo
+ print("Check if GEOM module provides information about its objects: ", hasInfo)
  if hasInfo == True:
-     print "Information about first  object: ", geompy.getObjectInfo(obj1_entry)
-     print "Information about second object: ", geompy.getObjectInfo(obj2_entry)
-     print "Information about third  object: ", geompy.getObjectInfo(obj3_entry)
-     print "Information about fourth object: ", geompy.getObjectInfo(obj4_entry)
-     print "Information about fifth  object: ", geompy.getObjectInfo(obj5_entry)
 -    print("Information about first  object: ", geompy.getObjectInfo(salome.myStudyId, obj1_entry))
 -    print("Information about second object: ", geompy.getObjectInfo(salome.myStudyId, obj2_entry))
 -    print("Information about third  object: ", geompy.getObjectInfo(salome.myStudyId, obj3_entry))
 -    print("Information about fourth object: ", geompy.getObjectInfo(salome.myStudyId, obj4_entry))
 -    print("Information about fifth  object: ", geompy.getObjectInfo(salome.myStudyId, obj5_entry))
++    print("Information about first  object: ", geompy.getObjectInfo(obj1_entry))
++    print("Information about second object: ", geompy.getObjectInfo(obj2_entry))
++    print("Information about third  object: ", geompy.getObjectInfo(obj3_entry))
++    print("Information about fourth object: ", geompy.getObjectInfo(obj4_entry))
++    print("Information about fifth  object: ", geompy.getObjectInfo(obj5_entry))
  
 -salome.sg.updateObjBrowser(True)
 +salome.sg.updateObjBrowser()
Simple merge
Simple merge
Simple merge
index 45dbbd78ed11df2b5662f7b429125fc6923be724,2e57573b8632ae168672dfe7eeafcc2db4dbe364..6139da415da788795b3b618f7d0c12880af4cad2
@@@ -80,11 -80,11 +80,11 @@@ theFilenameToSave = theHomePath + "/Pyr
  if os.access(theFilenameToSave, os.F_OK):
      if os.access(theFilenameToSave, os.W_OK):
          os.remove(theFilenameToSave)
 -        salome.myStudyManager.SaveAs(theFilenameToSave, salome.myStudy, 0)
 +        salome.myStudy.SaveAs(theFilenameToSave, 0, 0)
      else:
-         print "You have no enough permissions to overwrite HDF file: ",theFilenameToSave
+         print("You have no enough permissions to overwrite HDF file: ",theFilenameToSave)
  else:
 -    salome.myStudyManager.SaveAs(theFilenameToSave, salome.myStudy, 0)
 +    salome.myStudy.SaveAs(theFilenameToSave, 0, 0)
      
  
 -salome.sg.updateObjBrowser(True)
 +salome.sg.updateObjBrowser()
Simple merge
Simple merge
Simple merge
index 934a62219ec587c1901fbd6f29edc57ae62c5e2f,8d5bda38ef7de8bb1a9dafcdf97acafa206696ef..afb8509e1e4dc93de6f04f3a905b7c501006dd63
@@@ -649,9 -729,10 +729,9 @@@ class geomBuilder(GEOM._objref_GEOM_Gen
              #print "-------- geomBuilder __init__ --- ", created, self
              if not created:
                created = True
-               GEOM._objref_GEOM_Gen.__init__(self)
+               GEOM._objref_GEOM_Gen.__init__(self, *args)
                self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
                self.myBuilder = None
 -              self.myStudyId = 0
                self.father    = None
  
                self.BasicOp  = None
              """
              # Example: see GEOM_TestAll.py
              try:
 -                aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
 +                aSObject = self.AddInStudy(aShape, aName, None)
                  if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
                  if doRestoreSubShapes:
 -                    self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
 +                    self.RestoreSubShapesSO(aSObject, theArgs,
                                              theFindMethod, theInheritFirstArg, True )
              except:
-                 print "addToStudy() failed"
+                 print("addToStudy() failed")
                  return ""
              return aShape.GetStudyEntry()
  
              """
              # Example: see GEOM_TestAll.py
              try:
 -                aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather)
 +                aSObject = self.AddInStudy(aShape, aName, aFather)
                  if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
              except:
-                 print "addToStudyInFather() failed"
+                 print("addToStudyInFather() failed")
                  return ""
              return aShape.GetStudyEntry()
  
              if include_min: left_str  = " <= "
              if include_max: right_str  = " <= "
  
-             self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
-                                     + left_str + "length" + right_str + `max_length`)
+             self.addToStudyInFather(shape, group_edges, "Group of edges with " + repr(min_length)
+                                     + left_str + "length" + right_str + repr(max_length))
  
 -            sg.updateObjBrowser(True)
 +            sg.updateObjBrowser()
  
              return group_edges
  
Simple merge
Simple merge
Simple merge
index a627958146884c171994b0faf220fcb7746b4ff3,8a77a8b099c8bbda88a73ccc076a831f47108add..c1830cf30c336977dc5e90bc4c8fb8d3f576d46c
@@@ -99,9 -101,10 +99,9 @@@ def demidisk(r1, a1, roty=0, solid_thic
    else:
      return v, l, arc1, part1
  
 -def pointsProjetes(study, vref, face):
 -  #geompy = geomBuilder.New(study)
 +def pointsProjetes(vref, face):
    vface = geompy.ExtractShapes(face, geompy.ShapeType["VERTEX"], True)
-   vord = range(len(vref))
+   vord = list(range(len(vref)))
    plan = geompy.MakePlaneThreePnt(vref[0], vref[1], vref[-1], 10000)
    vproj = [ geompy.MakeProjection(vert, plan) for vert in vface ]
    for i,v in enumerate(vproj):
        vord[dist[0][1]] = vface[i]
    return vord
  
 -def arcsProjetes(study, vf, face):
 -  #geompy = geomBuilder.New(study)
 +def arcsProjetes(vf, face):
    lface = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
-   lord = range(3)
+   lord = list(range(3))
    ends = [vf[1], vf[6], vf[7], vf[3]]
    for i in range(3):
      for lf in lface:
@@@ -393,10 -399,10 +393,10 @@@ def test_t_shape_builder()
          h1 = r1 * 2.0
          h2 = h1
          try:
 -          res = build_shape(theStudy, r1, r2, h1, h2, thickness)
 +          res = build_shape(r1, r2, h1, h2, thickness)
            geompy.addToStudy(res, "res_%f_%f_%f"%(r1,r2, thickness))
          except:
-           print "problem with res_%f_%f_%f"%(r1,r2, thickness)
+           print("problem with res_%f_%f_%f"%(r1,r2, thickness))
    
  if __name__=="__main__":
    """For testing purpose"""
Simple merge
Simple merge