From dc5750418efa0eeab4ca33d83999c364544c4eaa Mon Sep 17 00:00:00 2001 From: salome <> Date: Fri, 3 Jun 2005 07:25:24 +0000 Subject: [PATCH] =?utf8?q?CL=20sur=20une=20g=C3=A9om=C3=A9trie=20"remontan?= =?utf8?q?te"?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/EFICASGUI/ChoixMaillage.ui | 83 ++++++++++++++++-------- src/EFICASGUI/EFICASGUI.py | 5 +- src/EFICASGUI/MonChoixMaillage.py | 28 +++++--- src/EFICASGUI/dataEficas.py | 9 ++- src/EFICASGUI/eficasCL.py | 102 +++++++++++++++++++++++++++--- src/EFICASGUI/eficasEtude.py | 8 ++- src/EFICASGUI/eficasSalome.py | 2 +- 7 files changed, 188 insertions(+), 49 deletions(-) diff --git a/src/EFICASGUI/ChoixMaillage.ui b/src/EFICASGUI/ChoixMaillage.ui index ad2e6e46..f7568004 100644 --- a/src/EFICASGUI/ChoixMaillage.ui +++ b/src/EFICASGUI/ChoixMaillage.ui @@ -9,7 +9,7 @@ 0 0 526 - 252 + 398 @@ -17,44 +17,60 @@ - TextLabel1 + TextLabel1_2 - 10 - 190 + 20 + 10 + 120 + 20 + + + + Géométrie traitée : + + + + + NomShape + + + + 140 + 10 191 - 40 + 21 - Nom du nouveau maillage + TextLabel2 - TextLabel2 + TextLabel2_2 20 - 70 + 50 181 31 - Maillage sélectionné + Shape selectionnée - Maillage + MainShape 210 - 70 + 50 281 90 @@ -62,34 +78,34 @@ - TextLabel1_2 + TextLabel2 20 - 10 - 120 - 20 + 160 + 181 + 31 - Géométrie traitée : + Maillage sélectionné - NomShape + TextLabel1 - 140 - 10 + 10 + 280 191 - 21 + 40 - TextLabel2 + Nom du nouveau maillage @@ -99,12 +115,25 @@ 210 - 200 + 290 280 24 + + + Maillage + + + + 210 + 160 + 281 + 90 + + + @@ -119,11 +148,15 @@ ChoixMaillage NouveauMesh_returnPressed() + + MainShape + clicked(QListBoxItem*) + ChoixMaillage + Geometrie_clicked(QListBoxItem*) + - - ChoixMaillage.ui.h - + Geometrie_clicked(QListBoxItem *) Maillage_clicked( QListBoxItem * ) NouveauMesh_returnPressed() diff --git a/src/EFICASGUI/EFICASGUI.py b/src/EFICASGUI/EFICASGUI.py index f437a742..2e123812 100644 --- a/src/EFICASGUI/EFICASGUI.py +++ b/src/EFICASGUI/EFICASGUI.py @@ -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 diff --git a/src/EFICASGUI/MonChoixMaillage.py b/src/EFICASGUI/MonChoixMaillage.py index d332efa2..50e88e38 100644 --- a/src/EFICASGUI/MonChoixMaillage.py +++ b/src/EFICASGUI/MonChoixMaillage.py @@ -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() diff --git a/src/EFICASGUI/dataEficas.py b/src/EFICASGUI/dataEficas.py index 0521c229..516552c7 100644 --- a/src/EFICASGUI/dataEficas.py +++ b/src/EFICASGUI/dataEficas.py @@ -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() diff --git a/src/EFICASGUI/eficasCL.py b/src/EFICASGUI/eficasCL.py index e8de5cfb..c2078ef6 100644 --- a/src/EFICASGUI/eficasCL.py +++ b/src/EFICASGUI/eficasCL.py @@ -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 : diff --git a/src/EFICASGUI/eficasEtude.py b/src/EFICASGUI/eficasEtude.py index d672bc5c..b8ad89c6 100644 --- a/src/EFICASGUI/eficasEtude.py +++ b/src/EFICASGUI/eficasEtude.py @@ -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", diff --git a/src/EFICASGUI/eficasSalome.py b/src/EFICASGUI/eficasSalome.py index 2d992026..d0c5650a 100644 --- a/src/EFICASGUI/eficasSalome.py +++ b/src/EFICASGUI/eficasSalome.py @@ -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 -- 2.39.2