]> SALOME platform Git repositories - modules/eficas.git/commitdiff
Salome HOME
CL sur une géométrie "remontante"
authorsalome <>
Fri, 3 Jun 2005 07:25:24 +0000 (07:25 +0000)
committersalome <>
Fri, 3 Jun 2005 07:25:24 +0000 (07:25 +0000)
src/EFICASGUI/ChoixMaillage.ui
src/EFICASGUI/EFICASGUI.py
src/EFICASGUI/MonChoixMaillage.py
src/EFICASGUI/dataEficas.py
src/EFICASGUI/eficasCL.py
src/EFICASGUI/eficasEtude.py
src/EFICASGUI/eficasSalome.py

index ad2e6e46b05df964a199d6864a7c5ed0bd80b29d..f7568004f619725a29dcd1fb20bc3816209575ca 100644 (file)
@@ -9,7 +9,7 @@
             <x>0</x>
             <y>0</y>
             <width>526</width>
-            <height>252</height>
+            <height>398</height>
         </rect>
     </property>
     <property name="caption">
     </property>
     <widget class="QLabel">
         <property name="name">
-            <cstring>TextLabel1</cstring>
+            <cstring>TextLabel1_2</cstring>
         </property>
         <property name="geometry">
             <rect>
-                <x>10</x>
-                <y>190</y>
+                <x>20</x>
+                <y>10</y>
+                <width>120</width>
+                <height>20</height>
+            </rect>
+        </property>
+        <property name="text">
+            <string>Géométrie traitée :</string>
+        </property>
+    </widget>
+    <widget class="QLabel">
+        <property name="name">
+            <cstring>NomShape</cstring>
+        </property>
+        <property name="geometry">
+            <rect>
+                <x>140</x>
+                <y>10</y>
                 <width>191</width>
-                <height>40</height>
+                <height>21</height>
             </rect>
         </property>
         <property name="text">
-            <string>Nom du nouveau maillage</string>
+            <string>TextLabel2</string>
         </property>
     </widget>
     <widget class="QLabel">
         <property name="name">
-            <cstring>TextLabel2</cstring>
+            <cstring>TextLabel2_2</cstring>
         </property>
         <property name="geometry">
             <rect>
                 <x>20</x>
-                <y>70</y>
+                <y>50</y>
                 <width>181</width>
                 <height>31</height>
             </rect>
         </property>
         <property name="text">
-            <string>Maillage sélectionné</string>
+            <string>Shape selectionnée</string>
         </property>
     </widget>
     <widget class="QListBox">
         <property name="name">
-            <cstring>Maillage</cstring>
+            <cstring>MainShape</cstring>
         </property>
         <property name="geometry">
             <rect>
                 <x>210</x>
-                <y>70</y>
+                <y>50</y>
                 <width>281</width>
                 <height>90</height>
             </rect>
     </widget>
     <widget class="QLabel">
         <property name="name">
-            <cstring>TextLabel1_2</cstring>
+            <cstring>TextLabel2</cstring>
         </property>
         <property name="geometry">
             <rect>
                 <x>20</x>
-                <y>10</y>
-                <width>120</width>
-                <height>20</height>
+                <y>160</y>
+                <width>181</width>
+                <height>31</height>
             </rect>
         </property>
         <property name="text">
-            <string>Géométrie traitée :</string>
+            <string>Maillage sélectionné</string>
         </property>
     </widget>
     <widget class="QLabel">
         <property name="name">
-            <cstring>NomShape</cstring>
+            <cstring>TextLabel1</cstring>
         </property>
         <property name="geometry">
             <rect>
-                <x>140</x>
-                <y>10</y>
+                <x>10</x>
+                <y>280</y>
                 <width>191</width>
-                <height>21</height>
+                <height>40</height>
             </rect>
         </property>
         <property name="text">
-            <string>TextLabel2</string>
+            <string>Nom du nouveau maillage</string>
         </property>
     </widget>
     <widget class="QLineEdit">
         <property name="geometry">
             <rect>
                 <x>210</x>
-                <y>200</y>
+                <y>290</y>
                 <width>280</width>
                 <height>24</height>
             </rect>
         </property>
     </widget>
+    <widget class="QListBox">
+        <property name="name">
+            <cstring>Maillage</cstring>
+        </property>
+        <property name="geometry">
+            <rect>
+                <x>210</x>
+                <y>160</y>
+                <width>281</width>
+                <height>90</height>
+            </rect>
+        </property>
+    </widget>
 </widget>
 <connections>
     <connection>
         <receiver>ChoixMaillage</receiver>
         <slot>NouveauMesh_returnPressed()</slot>
     </connection>
+    <connection>
+        <sender>MainShape</sender>
+        <signal>clicked(QListBoxItem*)</signal>
+        <receiver>ChoixMaillage</receiver>
+        <slot>Geometrie_clicked(QListBoxItem*)</slot>
+    </connection>
 </connections>
-<includes>
-    <include location="local" impldecl="in implementation">ChoixMaillage.ui.h</include>
-</includes>
 <slots>
+    <slot>Geometrie_clicked(QListBoxItem *)</slot>
     <slot>Maillage_clicked( QListBoxItem * )</slot>
     <slot>NouveauMesh_returnPressed()</slot>
 </slots>
index f437a7423d709fb127f1eed70d56af2e303062d8..2e1238125cd5fcb0b598af87113e8457f51b698e 100644 (file)
@@ -14,11 +14,12 @@ studyId=None
 
 import notifqt
 #import Tkinter
-#root=Tkinter.Tk()
 #root.withdraw()
 
 def g():
    print "lastWindowClosed()"
+   import Tkinter
+   root=Tkinter.Tk()
    root.destroy()
 
 qt.QObject.connect(qt.qApp,qt.SIGNAL("lastWindowClosed()"),g)
@@ -123,7 +124,7 @@ def runEficasFichier(ws):
          code = "ASTER" 
       else :
          boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_HOMARD",a[0])
-        code = "HOMARD"
+        code = "HOMARD"
    eficasSalome.runEficas(ws,code,attr)
 
 # Partie applicative
index d332efa2064414249f0b2218f008a328128539ee..50e88e38352ab31d399affabd78ac2028f5cfe77 100644 (file)
@@ -16,25 +16,37 @@ class MonChoixMaillage(ChoixMaillage.ChoixMaillage):
       ChoixMaillage.ChoixMaillage.__init__(self,parent,name,modal,fl)
       self._CL=CL
       self._numero=monNum
-      self.recupere_info()
+      self._GeomChoisie=None
 
-      self.NomShape.setText(self._nomShape)
-      for item in self._listeMesh:
-          self.Maillage.insertItem(item)
+      self.NomShape.setText(self._CL.NomShape(self._numero))
+      self.recupere_mainId()
       self.show()
 
-   def recupere_info(self):
-      self._nomShape  = self._CL.NomShape(self._numero)
-      self._listeMesh= self._CL.Possibles(self._numero)
+   def Geometrie_clicked(self,item):
+       self.Maillage.clear()
+       if item == None :
+          return
+       self._GeomChoisie=item.text()
+       self._listeMesh= self._CL.Possibles(self._numero,self._GeomChoisie)
+       for item in self._listeMesh:
+           self.Maillage.insertItem(item)
+
+   def recupere_mainId(self):
+      self._listeGeom= self._CL.MainShapes(self._numero)
+      self.MainShape.clear()
+      for item in self._listeGeom :
+          self.MainShape.insertItem(item)
 
    def Maillage_clicked(self,item) :
+      if item == None :
+         return
       self._CL.traiteMaillage(self._numero,item.text())
       self._CL.traiteCL()
       self.close()
 
 
    def NouveauMesh_returnPressed(self):
-      self._CL.traiteNewMaillage(self._numero,str(self.NouveauMesh.text()))
+      self._CL.traiteNewMaillage(self._numero,self._GeomChoisie,str(self.NouveauMesh.text()))
       self._CL.traiteCL()
       self.close()
 
index 0521c22906204552f5e581dfac7ed3c5603ecd0e..516552c7c9a893425ebb8b5b0b68929f033ba16d 100644 (file)
@@ -10,11 +10,13 @@ sys.path[:0]=[os.path.join(eficas_root,'Aster'),
 
 # Modules Python
 import Tkinter
+import sys
 
 # Modules Eficas
 #import import_code
 from Editeur import splash
 from Editeur import eficas
+from Editeur import session
 
 
 def init(top,code="ASTER",fichier=None):
@@ -33,6 +35,9 @@ def init(top,code="ASTER",fichier=None):
         def contexte(self):
             self.salome=MaRef
 
-    print code
-    moi=MyEficas(top,code=code,fichier=fichier)
+    if fichier != None :
+       options=session.parse(sys.argv+[fichier])
+    else :
+       options=session.parse(sys.argv)
+    moi=MyEficas(top,code=code)
     moi.contexte()
index e8de5cfb54dc0b60134268d8983a1a2e87a508d2..c2078ef60e3c43a10ebe3d77cc4e2ad68a7783ed 100644 (file)
@@ -1,6 +1,7 @@
 import salome
 import SALOMEDS
 import SMESH
+import GEOM
 import SalomePyQt
 import MonChoixMaillage
 
@@ -12,10 +13,12 @@ class CLinit:
        geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
        self.GroupOp  = geom.GetIGroupOperations(salome.myStudyId)
        self.smesh=None
+       self.geomcompID=None
        self._d = SalomePyQt.SalomePyQt().getDesktop()
-       self.get_maillages()
        self.correspondanceNomIOR = {}
+       self.correspondanceNomIORshape = {}
        self.name="CL"
+       print "fin init"
 
     def GetOrCreateCL(self,myShapeName):
        if not (dict_CL.has_key(myShapeName)):
@@ -24,6 +27,11 @@ class CLinit:
 
 
     def traiteCL(self):
+       print "traiteCL"
+       self.get_geoms()
+       print "self.get_geoms"
+       self.get_maillages()
+       print "self.get_maillages"
        # Récupere tous les Mesh
        if len(dict_CL) > 0:
           Choix=MonChoixMaillage.MonChoixMaillage(self,0,self._d)
@@ -48,14 +56,16 @@ class CLinit:
            anAttr = attrName._narrow(SALOMEDS.AttributeName)
            Name = anAttr.Value()
            #_CS_cbo: ajout de la determination de la dimension de la geometrie
-           type = self.getShapeType(GEOMShape)
+           #type = self.getShapeType(GEOMShape)
+          type = SMESH.NODE
            Mesh.CreateGroupFromGEOM(type,Name,GEOMShape)           
        del dict_CL[GEOMIor]
            
 
-    def traiteNewMaillage(self,indiceIOR,NomMaillage):
-       GEOMIor = dict_CL.keys()[indiceIOR]
-       shape = salome.orb.string_to_object(GEOMIor)
+    def traiteNewMaillage(self,numero,indiceIOR,NomMaillage):
+       GEOMIor=dict_CL.keys()[numero]
+       GEOMShapeIor=self.correspondanceNomIORshape[str(indiceIOR)]
+       shape = salome.orb.string_to_object(GEOMShapeIor)
        if self.smesh == None :
            self.smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
            self.smesh.SetCurrentStudy(salome.myStudy)
@@ -76,7 +86,8 @@ class CLinit:
            anAttr = attrName._narrow(SALOMEDS.AttributeName)
            Name = anAttr.Value()
            #_CS_cbo: ajout de la determination de la dimension de la geometrie
-           type = self.getShapeType(GEOMShape)
+           #type = self.getShapeType(GEOMShape)
+          type = SMESH.NODE
            newMesh.CreateGroupFromGEOM(type,Name,GEOMShape)
        del dict_CL[GEOMIor]
 
@@ -91,8 +102,8 @@ class CLinit:
 # NodeorCell = 0 on traite des noeuds
 # NodeorCell = 1 on traite des mailles
 
-    def Possibles(self,numero):
-       GEOMIor = dict_CL.keys()[numero]
+    def Possibles(self,numero,GeomChoisie):
+       GEOMIor=self.correspondanceNomIORshape[str(GeomChoisie)]
        liste=[]
        if GEOMIor in self.Liste_maillages.keys():
         for MeshIor in self.Liste_maillages[GEOMIor]:
@@ -104,6 +115,26 @@ class CLinit:
            liste.append(Name)
        return liste
 
+
+    def MainShapes(self,numero):
+       GEOMIor = dict_CL.keys()[numero]
+       listeNoms=[]
+       for MainID in  self.Liste_geoms[GEOMIor]:
+           aSO = salome.myStudy.FindObjectID(MainID)
+          if aSO==None:
+             print "pb dans MainShapes"
+             return listeNoms
+          attrName  = aSO.FindAttribute("AttributeName")[1]
+          anAttr = attrName._narrow(SALOMEDS.AttributeName)
+          Name = anAttr.Value()
+          listeNoms.append(Name)
+          IORAttr = aSO.FindAttribute("AttributeIOR")[1]
+          anAttr  = IORAttr._narrow(SALOMEDS.AttributeIOR)
+          GEOMShapeIOR  = anAttr.Value()
+          self.correspondanceNomIORshape[Name]=GEOMShapeIOR
+       return listeNoms
+
+
     def getShapeType(self,GEOMShape):
        """
        Determination du type de geometrie pour les conditions aux limites.
@@ -139,8 +170,10 @@ class CLinit:
          self.smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
         self.smesh.SetCurrentStudy(salome.myStudy)
        stringIOR=salome.orb.object_to_string(self.smesh)
+       print stringIOR
        SO_smesh=salome.myStudy.FindObjectIOR(stringIOR)
        if SO_smesh != None:
+         print salome.myStudy
          ChildIterator = salome.myStudy.NewChildIterator(SO_smesh)
         while ChildIterator.More() :
            aSObj = ChildIterator.Value()
@@ -166,6 +199,59 @@ class CLinit:
                    else :
                     self.Liste_maillages[GEOMShapeIOR]=[MeshIOR]
 
+    def get_geoms(self):
+       self.Liste_geoms={}
+       for GeomCLIOR in dict_CL.keys():
+          self.Liste_geoms[GeomCLIOR]=[]
+         self.chercheMain(GeomCLIOR,GeomCLIOR)
+
+    def chercheMain(self,GEOMIor,GeomCLIOR):
+        print "debut chercheMain pour "
+       print GEOMIor
+       print GeomCLIOR
+
+
+        sobj = salome.myStudy.FindObjectIOR(GEOMIor)
+       if sobj == None :
+          print "objet nul dans chercheMain"
+          return
+
+       # On cherche les dépendances et
+       # on ajoute l objet lui-même à la liste
+        Listedep=salome.myStudy.FindDependances(sobj)
+       Listedep.append(sobj)
+
+        ListeAtraiter=[]
+       for sobj in Listedep :
+          # tant que l objet est une reference
+          # on cherche son pere
+          current=sobj
+          boo,iorso = sobj.FindAttribute("AttributeIOR")
+          while ( boo==0 ) :
+             current=current.GetFather()
+             boo,iorso = current.FindAttribute("AttributeIOR")
+          iorString = iorso.Value()
+           shapeobj=salome.orb.string_to_object(iorString)
+          Shape=shapeobj._narrow(GEOM.GEOM_Object)
+          if Shape != None :
+             if self.geomcompID == None:
+                self.geomcompID = current.GetFatherComponent().GetID()
+             ListeAtraiter.append(current)
+
+       for sobj in ListeAtraiter:
+          current=sobj
+          while ( current.GetFather().GetID() != self.geomcompID):
+             current=current.GetFather()
+          MainID=current.GetID()
+          if (MainID not in self.Liste_geoms[GeomCLIOR]):
+             self.Liste_geoms[GeomCLIOR].append(MainID)
+             Attr = current.FindAttribute("AttributeIOR")[1]
+             if (Attr != None):
+                MainIORAttr  = Attr._narrow(SALOMEDS.AttributeIOR)
+                MainIor = MainIORAttr.Value()
+                self.chercheMain(MainIor,GeomCLIOR)
+        print "fin chercheMain"
+
     def SetName(self,Entry, Name):
        SO = salome.myStudy.FindObjectID( Entry )
        if SO != None :
index d672bc5c62a22fbcecc648741fa05200b73b86d2..b8ad89c65a1c9285f2251a2e36cc90633abb93ab 100644 (file)
@@ -4,7 +4,7 @@
 # Author    : Pascale NOYRET, EDF
 # Project   : SALOME
 # Copyright : EDF 2003
-#  $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/EFICASGUI/eficasEtude.py,v 1.1.1.1 2004/09/28 09:41:16 salome Exp $
+#  $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/EFICASGUI/eficasEtude.py,v 1.2 2005/01/06 11:12:12 salome Exp $
 #=============================================================================
 
 import salome
@@ -33,9 +33,11 @@ class Eficas_In_Study:
                self.liste_deja_la.append(fichier)
                 Nom=re.split("/",fichier)[-1]
 
+
                 self.commId=aGuiDS.createItemInStudy(self.fatherId,Nom)
-                aGuiDS.setExternalFileAttribute(self.commId,"FICHIER_EFICAS_"+self.code+suf,fichier)
-                salome.sg.updateObjBrowser(0)
+               if self.commId != None:
+                   aGuiDS.setExternalFileAttribute(self.commId,"FICHIER_EFICAS_"+self.code+suf,fichier)
+                   salome.sg.updateObjBrowser(0)
 
       def creeConfigTxt(self,fichier,dico):
            sauvegarde = asksaveasfilename(title="fichier config.txt",
index 2d9920262bda74be99f8363e708b19272bffa362..d0c5650a1cc9acdb3d9b96987f94c9ca8a83620c 100644 (file)
@@ -10,7 +10,7 @@ sys._exit=sys.exit
 def exit(ier):
    print "appel de exit: ",ier
 
-sys.exit=exit
+#sys.exit=exit
 # Fin remplacement
 
 initialised=0