X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSalomeApp%2Fpluginsdemo%2Fxalome.py;h=c2d55be7d63cbf26d8010e87e90040fb7b0fcc66;hb=e7ede3527d1022d9df3cc38cd9d00d2eefb9f80f;hp=a2f5343d76afba007c5a11cf8f00196a533f8edc;hpb=91cc8846bfa36302f7ade6cb8aa380f03e90423e;p=modules%2Fgui.git diff --git a/src/SalomeApp/pluginsdemo/xalome.py b/src/SalomeApp/pluginsdemo/xalome.py index a2f5343d7..c2d55be7d 100644 --- a/src/SalomeApp/pluginsdemo/xalome.py +++ b/src/SalomeApp/pluginsdemo/xalome.py @@ -36,7 +36,7 @@ from salome.geom import geomtools # Helper functions to add/remove a geometrical shape in/from the study # ====================================================================== -def addToStudy(study,shape,shapeName,folderName=None): +def addToStudy(shape,shapeName,folderName=None): """ Add a GEOM shape in the study. It returns the associated entry that corresponds to the identifier of the entry in the study. This @@ -45,8 +45,7 @@ def addToStudy(study,shape,shapeName,folderName=None): created in the Geometry part of the study, and the shape study object is stored in this folder of the study. """ - studyId = study._get_StudyId() - geompy = geomtools.getGeompy(studyId) + geompy = geomtools.getGeompy() if folderName is None: # Insert the shape in the study by the standard way @@ -55,7 +54,7 @@ def addToStudy(study,shape,shapeName,folderName=None): # A folder name has been specified to embed this shape. Find # or create a folder with this name in the Geometry study, and # then store the shape in this folder. - studyEditor = getStudyEditor(studyId) + studyEditor = getStudyEditor() geomStudyFolder = studyEditor.findOrCreateComponent("GEOM") shapeStudyFolder = studyEditor.findOrCreateItem(geomStudyFolder,folderName) @@ -71,17 +70,16 @@ def addToStudy(study,shape,shapeName,folderName=None): return entry -def removeFromStudy(study,shapeStudyEntry): +def removeFromStudy(shapeStudyEntry): """ This removes the specified entry from the study. Note that this operation does not destroy the underlying GEOM object, neither erase the drawing in the viewer. The underlying GEOM object is returned (so that it can be destroyed) """ - studyId = study._get_StudyId() shape = IDToObject(shapeStudyEntry) studyObject = IDToSObject(shapeStudyEntry) - studyEditor = getStudyEditor(studyId) + studyEditor = getStudyEditor() studyEditor.removeItem(studyObject,True) return shape @@ -126,7 +124,7 @@ def eraseShape_version65(shapeStudyEntry): # Helper functions for a complete suppression of a shape from the # SALOME session. # ====================================================================== -def deleteShape(study,shapeStudyEntry): +def deleteShape(shapeStudyEntry): """ This completly deletes a geom shape. @@ -138,7 +136,7 @@ def deleteShape(study,shapeStudyEntry): 3. destroy the underlying geom object """ eraseShape(shapeStudyEntry) - shape = removeFromStudy(study, shapeStudyEntry) + shape = removeFromStudy(shapeStudyEntry) if shape is not None: shape.Destroy() @@ -162,11 +160,10 @@ def TEST_createAndDeleteShape(): """ import salome salome.salome_init() - study = salome.myStudy - studyId = salome.myStudyId + study = salome.myStudy from salome.geom import geomtools - geompy = geomtools.getGeompy(studyId) + geompy = geomtools.getGeompy() # -------------------------------------------------- # Create a first shape (GEOM object) @@ -178,7 +175,7 @@ def TEST_createAndDeleteShape(): # folder. A name must be specified. The register operation # (addToStudy) returns an identifier of the entry in the study. cylinderName = "cyl.r%s.l%s"%(radius,length) - cylinderStudyEntry = addToStudy(study, cylinder, cylinderName) + cylinderStudyEntry = addToStudy(cylinder, cylinderName) # Display the registered shape in a viewer displayShape(cylinderStudyEntry) @@ -188,7 +185,7 @@ def TEST_createAndDeleteShape(): radius = 10 sphere = geompy.MakeSphereR(radius) sphereName = "sph.r%s"%radius - sphereStudyEntry = addToStudy(study, sphere, sphereName) + sphereStudyEntry = addToStudy(sphere, sphereName) displayShape(sphereStudyEntry) # -------------------------------------------------- @@ -199,7 +196,7 @@ def TEST_createAndDeleteShape(): box = geompy.MakeBoxDXDYDZ(length,length,length) boxName = "box.l%s"%length folderName = "boxset" - boxStudyEntry = addToStudy(study, box, boxName, folderName) + boxStudyEntry = addToStudy(box, boxName, folderName) displayShape(boxStudyEntry,PreviewColor) # -------------------------------------------------- @@ -214,7 +211,7 @@ def TEST_createAndDeleteShape(): # SALOME session (erase from viewer, remove from study and finnaly # destroy the object). This is done by a simple call to # deleteShape(). - deleteShape(study,cylinderStudyEntry) + deleteShape(cylinderStudyEntry) # -------------------------------------------------- # At the end of the executioon of this test, you should have in