Salome HOME
deprecated v7 import smesh, studyBuilder modification
authorcvw <cvw>
Tue, 18 Jun 2013 08:34:04 +0000 (08:34 +0000)
committercvw <cvw>
Tue, 18 Jun 2013 08:34:04 +0000 (08:34 +0000)
src/Tools/YamsPlug/YamsPlugDialog.ui
src/Tools/YamsPlug/monYamsPlugDialog.py

index 1afc115ac8ee389743ae1f2057a3549882f4049d..e34b7b7da1b09f05119bdf38cd8b4b4abb9a90de 100644 (file)
@@ -301,20 +301,17 @@ good quality elements.</string>
 The latter can be either the intrinsic size map (computed automatically
 and based on the surface properties, i.e. the local curvatures),
 or on a given size map (which is then combined to the intrinsic size map). 
 The latter can be either the intrinsic size map (computed automatically
 and based on the surface properties, i.e. the local curvatures),
 or on a given size map (which is then combined to the intrinsic size map). 
-One should use this option to coarse and enrich the mesh, when a regular mesh 
+One should use this option to coarse and enrich the mesh, when a regular mesh 
 for computation purposes is desired, i.e. a mesh with good aspect ratios or 
 good quality elements</string>
            </property>
            <property name="text">
 for computation purposes is desired, i.e. a mesh with good aspect ratios or 
 good quality elements</string>
            </property>
            <property name="text">
-            <string>Mesh for finite element computation : Coarsening and Enrichment  (1)</string>
+            <string>Mesh for finite element computation : Coarsening and Enrichment (1)</string>
            </property>
           </widget>
          </item>
            </property>
           </widget>
          </item>
-
         </layout>
         </layout>
-
        </item>
        </item>
-
       </layout>
 
       </widget>
       </layout>
 
       </widget>
index 6e6088c11fc9cc86b7f575dcac512bc86764747d..d8ec10244e0363a90a57134d75ce0dcb82512d41 100644 (file)
@@ -119,11 +119,12 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
     maFenetre=MonViewText(self,self.commande)
 
   def enregistreResultat(self):
     maFenetre=MonViewText(self,self.commande)
 
   def enregistreResultat(self):
-    import smesh
-    import SMESH
     import salome
     import salome
+    import SMESH
     from salome.kernel import studyedit
     from salome.kernel import studyedit
-
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
+    
     if not os.path.isfile(self.fichierOut):
       QMessageBox.warning(self, "Compute", "Result file "+self.fichierOut+" not found")
 
     if not os.path.isfile(self.fichierOut):
       QMessageBox.warning(self, "Compute", "Result file "+self.fichierOut+" not found")
 
@@ -144,11 +145,11 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
     smesh.SetName(outputMesh.GetMesh(), meshname)
     outputMesh.Compute() #no algorithms message for "Mesh_x" has been computed with warnings: -  global 1D algorithm is missing
 
     smesh.SetName(outputMesh.GetMesh(), meshname)
     outputMesh.Compute() #no algorithms message for "Mesh_x" has been computed with warnings: -  global 1D algorithm is missing
 
-    self.editor = studyedit.getStudyEditor()    # 
+    self.editor = studyedit.getStudyEditor()
     moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
     HypReMeshEntry = self.editor.findOrCreateItem(
         moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png") #, comment = "HypoForRemeshing" )
     moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
     HypReMeshEntry = self.editor.findOrCreateItem(
         moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png") #, comment = "HypoForRemeshing" )
-
+    
     monStudyBuilder=maStudy.NewBuilder()
     monStudyBuilder.NewCommand()
     newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
     monStudyBuilder=maStudy.NewBuilder()
     monStudyBuilder.NewCommand()
     newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
@@ -174,7 +175,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
     self.num+=1
     return True
 
     self.num+=1
     return True
 
-  def PBSavePressed(self,NomHypo=False):
+  def PBSavePressed(self):
     from datetime import datetime
     if not(self.PrepareLigneCommande()): return
     text = "# YAMS hypothesis parameters\n" 
     from datetime import datetime
     if not(self.PrepareLigneCommande()): return
     text = "# YAMS hypothesis parameters\n" 
@@ -198,12 +199,11 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
 
   def PBSaveHypPressed(self):
     """save hypothesis in Object Browser"""
 
   def PBSaveHypPressed(self):
     """save hypothesis in Object Browser"""
-    #QMessageBox.warning(self, "save Object Browser YAMS Hypothesis", "TODO")
-    
-    import smesh
-    import SMESH
     import salome
     import salome
+    import SMESH
     from salome.kernel import studyedit
     from salome.kernel import studyedit
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
 
     maStudy=studyedit.getActiveStudy()
     smesh.SetCurrentStudy(maStudy)
 
     maStudy=studyedit.getActiveStudy()
     smesh.SetCurrentStudy(maStudy)
@@ -284,9 +284,10 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
       try:
         tit,value=lig.split("=")
         if tit=="Optimisation":
       try:
         tit,value=lig.split("=")
         if tit=="Optimisation":
-          for RB in self.GBUnit.findChildren(QRadioButton,):
-            RB.setChecked(False)
-          for RB in self.GBUnit.findChildren(QRadioButton,):
+          #no need: exlusives QRadioButton
+          #for RB in self.GBOptim.findChildren(QRadioButton,):
+          #  RB.setChecked(False)
+          for RB in self.GBOptim.findChildren(QRadioButton,):
             if RB.text()==value :
               RB.setChecked(True)
               break
             if RB.text()==value :
               RB.setChecked(True)
               break
@@ -390,12 +391,13 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
     self.paramsFile=self.LE_ParamsFile.text()
 
   def PBMeshSmeshPressed(self):
     self.paramsFile=self.LE_ParamsFile.text()
 
   def PBMeshSmeshPressed(self):
+    from omniORB import CORBA
     import salome
     import salome
-    import smesh
     from salome.kernel import studyedit
     from salome.smesh.smeshstudytools import SMeshStudyTools
     from salome.gui import helper as guihelper
     from salome.kernel import studyedit
     from salome.smesh.smeshstudytools import SMeshStudyTools
     from salome.gui import helper as guihelper
-    from omniORB import CORBA
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New(salome.myStudy)
 
     mySObject, myEntry = guihelper.getSObjectSelected()
     if CORBA.is_nil(mySObject) or mySObject==None:
 
     mySObject, myEntry = guihelper.getSObjectSelected()
     if CORBA.is_nil(mySObject) or mySObject==None:
@@ -419,7 +421,6 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
 
   def prepareFichier(self):
     self.fichierIn="/tmp/ForYams_"+str(self.num)+".mesh"
 
   def prepareFichier(self):
     self.fichierIn="/tmp/ForYams_"+str(self.num)+".mesh"
-    import SMESH
     self.__selectedMesh.ExportGMF(self.__selectedMesh, self.fichierIn, True)
 
   def PrepareLigneCommande(self):
     self.__selectedMesh.ExportGMF(self.__selectedMesh, self.fichierIn, True)
 
   def PrepareLigneCommande(self):
@@ -471,13 +472,15 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
 
   def clean(self):
     self.RB_0.setChecked(True)
 
   def clean(self):
     self.RB_0.setChecked(True)
-    self.RB_G.setChecked(False)
-    self.RB_U.setChecked(False)
-    self.RB_S.setChecked(False)
-    self.RB_2.setChecked(False)
-    self.RB_1.setChecked(False)
-    self.RB_Absolute.setChecked(False)
+    #no need: exlusives QRadioButton
+    #self.RB_G.setChecked(False)
+    #self.RB_U.setChecked(False)
+    #self.RB_S.setChecked(False)
+    #self.RB_2.setChecked(False)
+    #self.RB_1.setChecked(False)
     self.RB_Relative.setChecked(True)
     self.RB_Relative.setChecked(True)
+    #no need: exlusives QRadioButton
+    #self.RB_Absolute.setChecked(False)
     self.SP_Tolerance.setProperty("text", "10.")
     self.SP_Geomapp.setProperty("value", 0.04)
     self.SP_Ridge.setProperty("value", 45.0)
     self.SP_Tolerance.setProperty("text", "10.")
     self.SP_Geomapp.setProperty("value", 0.04)
     self.SP_Ridge.setProperty("value", 45.0)
@@ -492,16 +495,16 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
 
 __dialog=None
 def getDialog():
 
 __dialog=None
 def getDialog():
-    """
-    This function returns a singleton instance of the plugin dialog.
-    c est obligatoire pour faire un show sans parent...
-    """
-    global __dialog
-    if __dialog is None:
-        __dialog = MonYamsPlugDialog()
-    #else :
-    #   __dialog.clean()
-    return __dialog
+  """
+  This function returns a singleton instance of the plugin dialog.
+  c est obligatoire pour faire un show sans parent...
+  """
+  global __dialog
+  if __dialog is None:
+    __dialog = MonYamsPlugDialog()
+  #else :
+  #   __dialog.clean()
+  return __dialog
 
 #
 # ==============================================================================
 
 #
 # ==============================================================================
@@ -509,7 +512,6 @@ def getDialog():
 # ==============================================================================
 #
 def TEST_MonYamsPlugDialog():
 # ==============================================================================
 #
 def TEST_MonYamsPlugDialog():
-  #print "TEST_YamsMonPlugDialog"
   import sys
   from PyQt4.QtGui import QApplication
   from PyQt4.QtCore import QObject, SIGNAL, SLOT
   import sys
   from PyQt4.QtGui import QApplication
   from PyQt4.QtCore import QObject, SIGNAL, SLOT