+++ /dev/null
-<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
-<class>ChoixMaillage</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>ChoixMaillage</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>526</width>
- <height>398</height>
- </rect>
- </property>
- <property name="caption">
- <string>Choix du Maillage sur lequel s appliquent les condtions aux limites</string>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>TextLabel1_2</cstring>
- </property>
- <property name="geometry">
- <rect>
- <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>21</height>
- </rect>
- </property>
- <property name="text">
- <string>TextLabel2</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>TextLabel2_2</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>20</x>
- <y>50</y>
- <width>181</width>
- <height>31</height>
- </rect>
- </property>
- <property name="text">
- <string>Shape selectionnée</string>
- </property>
- </widget>
- <widget class="QListBox">
- <property name="name">
- <cstring>MainShape</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>210</x>
- <y>50</y>
- <width>281</width>
- <height>90</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>TextLabel2</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>20</x>
- <y>160</y>
- <width>181</width>
- <height>31</height>
- </rect>
- </property>
- <property name="text">
- <string>Maillage sélectionné</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>TextLabel1</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>280</y>
- <width>191</width>
- <height>40</height>
- </rect>
- </property>
- <property name="text">
- <string>Nom du nouveau maillage</string>
- </property>
- </widget>
- <widget class="QLineEdit">
- <property name="name">
- <cstring>NouveauMesh</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>210</x>
- <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>
- <sender>Maillage</sender>
- <signal>clicked(QListBoxItem*)</signal>
- <receiver>ChoixMaillage</receiver>
- <slot>Maillage_clicked(QListBoxItem*)</slot>
- </connection>
- <connection>
- <sender>NouveauMesh</sender>
- <signal>returnPressed()</signal>
- <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>
-<slots>
- <slot>Geometrie_clicked(QListBoxItem *)</slot>
- <slot>Maillage_clicked( QListBoxItem * )</slot>
- <slot>NouveauMesh_returnPressed()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+++ /dev/null
-
-import salome
-import salomedsgui
-aGuiDS=salomedsgui.guiDS()
-
-# -----------------------------------------------------------------------------
-
-import ChoixMaillage
-
-
-class MonChoixMaillage(ChoixMaillage.ChoixMaillage):
- """
- adaptation de la classe generee par pyuic.
- """
- def __init__(self,CL,monNum,parent = None,name = None,modal = 0,fl = 0,):
- ChoixMaillage.ChoixMaillage.__init__(self,parent,name,modal,fl)
- self._CL=CL
- self._numero=monNum
- self._GeomChoisie=None
-
- self.NomShape.setText(self._CL.NomShape(self._numero))
- self.recupere_mainId()
- self.show()
-
- 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,self._GeomChoisie,str(self.NouveauMesh.text()))
- self._CL.traiteCL()
- self.close()
-
+++ /dev/null
-#=============================================================================
-# File : SMESH_utils.py
-# Created : jeu fév 20 18:53:34 CET 2003
-# Author : Paul RASCLE, EDF
-# Project : SALOME
-# Copyright : EDF 2003
-# $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/EFICASGUI/SMESH_utils.py,v 1.7 2005/09/30 17:41:46 salome Exp $
-#=============================================================================
-
-from omniORB import CORBA
-import LifeCycleCORBA
-import SALOMEDS
-import GEOM
-import SMESH
-from eficasCL import *
-
-# initialise the ORB
-orb = CORBA.ORB_init([''], CORBA.ORB_ID)
-
-# create an LifeCycleCORBA instance
-lcc = LifeCycleCORBA.LifeCycleCORBA(orb)
-
-geom = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-smesh = lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-
- #--------------------------------------------------------------------------
-
-def entryToIor(myStudy,entry):
- """
- Retourne une référence ior de l'entry passée en argument.
- """
- ior = None
- iorString = entryToIorString(myStudy,entry)
- if iorString != None:
- ior = orb.string_to_object(iorString)
- return ior
-
-def iorStringToIor(iorString):
- """
- retourne une référence ior de l'iorString passée en argument
- """
- ior = orb.string_to_object(iorString)
- return ior
-
-def entryToIorString(myStudy,entry):
- """
- Retourne la sérialisation de l'ior de l'entry passée en
- argument. Il s'agit de l'attribut AttributeIOR associé à l'entry
- dans l'arbre d'étude.
- """
- myBuilder = myStudy.NewBuilder()
- iorString = None
- SO = None
- try:
- SO = myStudy.FindObjectID(entry)
- except:
- print "invalid entry: ",entry
- SO = None
- if SO != None:
-
- boo,iorso = myBuilder.FindAttribute(SO,"AttributeIOR")
- if boo == 0:
- print "no IOR attribute on study object: ", entry
- else:
- iorString = iorso.Value()
- return iorString
-
-
- #--------------------------------------------------------------------------
-
-def singleEntryToName(myStudy,entry):
- """
- Retourne le nom l'entry passée en argument. Il s'agit de
- l'attribut AttributeName associé à l'entry dans l'arbre d'étude.
- """
- myBuilder = myStudy.NewBuilder()
- name =[]
- SO = None
- try:
- SO = myStudy.FindObjectID(entry)
- except:
- print "invalid entry: ",entry
- SO = None
- if SO != None:
- boo,nameso = myBuilder.FindAttribute(SO,"AttributeName")
- if boo == 0:
- print "no Name attribute on study object: ", entry
- else:
- name.append(nameso.Value())
- return name
-
-def entryListToName(myStudy,entryList):
- """
- Récupération de la liste des noms à partir d'une liste d'entry.
- """
- myBuilder = myStudy.NewBuilder()
- name =[]
- SO = None
- for entry in entryList:
- try:
- SO = myStudy.FindObjectID(entry)
- except:
- print "invalid entry: ",entry
- SO = None
- if SO != None:
- boo,nameso = myBuilder.FindAttribute(SO,"AttributeName")
- if boo == 0:
- print "no Name attribute on study object: ", entry
- else:
- name.append(nameso.Value())
- return name
-
-def entryToName(myStudy,entryList):
- """
- Cette méthode sert juste à assurer la compatibilité avec le
- logiciel Eficas. Eficas (panelsSalome.py) fait appel à entryToList
- en passant une entryList en argument.
- """
- return entryListToName(myStudy,entryList)
-
-
- #--------------------------------------------------------------------------
-def getMainShape(anObject):
- """
- Cette méthode retourne une référence ior de l'objet principal qui
- contient l'entry passée en argument.
- """
- try :
- subShape=anObject._narrow(GEOM.GEOM_Object)
- objMain = subShape.GetMainShape()
- IORobjMain = orb.object_to_string(objMain)
- except :
- IORobjMain= None
- return IORobjMain
-
-def getShapeContenante(myStudy,entry):
- try :
- anObject=entryToIor(myStudy,entry)
- Shape=anObject._narrow(GEOM.GEOM_Object)
- ShapeIor=orb.object_to_string(Shape)
- except :
- print "pb avec l IOR: pas un objet"
- return None
-
- MainShapeIOR=ShapeIor
- while anObject != None :
- iorStringMain = getMainShape(anObject)
- if iorStringMain == None :
- break
- if ( MainShapeIOR != iorStringMain ):
- anObject = orb.string_to_object(iorStringMain)
- if anObject :
- MainShapeIOR=iorStringMain
- else :
- anObject = None
-
- return MainShapeIOR
-
- #--------------------------------------------------------------------------
-
-def getSMESHSubShapeIndexes(myStudy, entryList, typenoeudorcell = 0):
- # typenoeudorcell = 0 on traite des noeuds
- # typenoeudorcell = 1 on traite des faces
-
- refList = []
- iorStringMain = None
- myCLinit=CLinit()
-
- if len(entryList) > 0:
- for idShape in entryList:
- try:
- anObject=entryToIor(myStudy,idShape)
- if not anObject: # l'objet n'a pas encore chargé
- strContainer, strComponentName = "FactoryServer", "GEOM"
- myComponent = salome.lcc.FindOrLoadComponent( strContainer, strComponentName )
- SCom=myStudy.FindComponent( strComponentName )
- myBuilder = myStudy.NewBuilder()
- myBuilder.LoadWith( SCom , myComponent )
- anObject=entryToIor(myStudy,idShape)
-
- Shape=anObject._narrow(GEOM.GEOM_Object)
- iorStringMain=orb.object_to_string(Shape)
- except :
- print "pb avec l IOR: pas un objet"
-
- myCL=myCLinit.GetOrCreateCL(iorStringMain)
- refShape = singleEntryToName(myStudy,idShape)
- if refShape != None:
- for Shape in refShape:
- refList.append(Shape)
- IORShape = entryToIor(myStudy,idShape)
- myCL.SetIdAsCL(orb.object_to_string(IORShape),typenoeudorcell)
-
- return refList
-
- #--------------------------------------------------------------------------
-
-def getAsterGroupNo(myStudy,entryList):
- ## CS_pbruno OK ici on a l'entry ( entryList ) d'un objet geom sur lequel on applique une condition au limite sur face
- ## CS_pbruno begin : cette partie ( temporaire avt nettoyage du code ) rempli les information indispensable pour la boite de dialogue
-
- #print "CS_pbruno getAsterGroupNo (myStudy=%s,entryList=%s)"%(myStudy,entryList)
- import meshdialogImp
- from EficasStudy import study
-
- newShapeEntry = entryList[0]
-
- #print 'CS_pbruno getAsterGroupNo : newShapeEntry', newShapeEntry
- #print 'CS_pbruno getAsterGroupNo : mainShapeEntry', meshdialogImp.mainShapeEntry
- if not meshdialogImp.mainShapeEntry: #on détermine d'abord la géométrie principale
- meshdialogImp.mainShapeEntry = study.getMainShapeEntry( newShapeEntry )
-
- # toutes les nouvelles sous-géométries doivent appartenir à la même géométrie principale
- if meshdialogImp.mainShapeEntry:
- same= study.sameMainShape( meshdialogImp.mainShapeEntry, newShapeEntry )
- if same:
- meshdialogImp.groupeNoEntries.append( newShapeEntry )
- #print 'CS_pbruno getAsterGroupNo : groupeNoEntries', str( meshdialogImp.groupeNoEntries )
- ## CS_pbruno end
-
-
- typenoeudorcell = 0
- subShapeIndexes = getSMESHSubShapeIndexes(myStudy, entryList,typenoeudorcell)
- labelGroupNo = []
- if subShapeIndexes == None :
- print "*************************************"
- print "Pb au chargement de Geom --> pas d IOR"
- print "*************************************"
- return
- for val in subShapeIndexes:
- labelGroupNo.append(val)
- return labelGroupNo
-
- #--------------------------------------------------------------------------
-
-def getAsterGroupMa(myStudy,entryList):
- ## CS_pbruno OK ici on a l'entry ( entryList ) d'un objet geom sur lequel on applique une condition au limite sur face
- ## CS_pbruno begin : cette partie ( temporaire avt nettoyage du code ) rempli les information indispensable pour la boite de dialogue
-
- #print "CS_pbruno getAsterGroupMa (myStudy=%s,entryList=%s)"%(myStudy,entryList)
- import meshdialogImp
- from EficasStudy import study
-
- newShapeEntry = entryList[0]
-
- #print 'CS_pbruno getAsterGroupMa : newShapeEntry', newShapeEntry
- #print 'CS_pbruno getAsterGroupMa : mainShapeEntry', meshdialogImp.mainShapeEntry
-
- if not meshdialogImp.mainShapeEntry: #on détermine d'abord la géométrie principale
- meshdialogImp.mainShapeEntry = study.getMainShapeEntry( newShapeEntry )
-
- # toutes les nouvelles sous-géométries doivent appartenir à la même géométrie principale
- if meshdialogImp.mainShapeEntry:
- same= study.sameMainShape( meshdialogImp.mainShapeEntry, newShapeEntry )
- if same:
- meshdialogImp.groupeMaEntries.append( newShapeEntry )
- #print 'CS_pbruno getAsterGroupMa : groupeMaEntries', str( meshdialogImp.groupeMaEntries )
- ## CS_pbruno end
-
-
- typenoeudorcell = 1
- subShapeIndexes = getSMESHSubShapeIndexes(myStudy, entryList,typenoeudorcell)
- labelGroupMa = []
- if subShapeIndexes == None :
- print "*************************************"
- print "Pb au chargement de Geom --> pas d IOR"
- print "*************************************"
- return
- for val in subShapeIndexes:
- labelGroupMa.append(val)
- return labelGroupMa
-
- #--------------------------------------------------------------------------
-
-def VisuGroupe(myStudy,GroupesListe):
- import salomedsgui
- aGuiDS=salomedsgui.guiDS()
- aGuiDS.ClearSelection()
- aGuiDS.DisplayByNameInGeom(GroupesListe)
-
-def getSubGeometry(myStudy, list):
- IORMainShape = entryToIorString(myStudy,list[1])
-
- SO = myStudy.FindObjectIOR(IORMainShape)
- childIt = myStudy.NewChildIterator(SO)
- childIt.InitEx(1)
- childListe = []
- while childIt.More():
- childSO = childIt.Value()
- childListe.append(childSO.GetName())
- childIt.Next()
- return childListe
-
-def getSubGeometryIorAndName(myStudy, list):
- """
- retourne un dictionnaire avec clé = IOR
- valeur = name
- """
- dico = {}
- IORMainShape = entryToIorString(myStudy,list[1])
-
- SO = myStudy.FindObjectIOR(IORMainShape)
- childIt = myStudy.NewChildIterator(SO)
- childIt.InitEx(1)
- while childIt.More():
- childSO = childIt.Value()
- if childSO.GetIOR() != '':
- dico[childSO.GetIOR()] = childSO.GetName()
- childIt.Next()
- return dico
+++ /dev/null
-import sys,os
-
-eficas_root=os.environ["EFICAS_ROOT"]
-
-sys.path[:0]=[os.path.join(eficas_root,'Aster'),
- os.path.join(eficas_root,'Homard'),
- eficas_root,
-# os.path.join(eficas_root,'Editeur'),
- ]
-
-# Modules Python
-import Tkinter
-import sys
-
-# Modules Eficas
-#import import_code
-from Editeur import splash
-from Editeur import eficas
-
-# _CS_gbo Gestion du versionning entre eficas 1.7 et 1.8 (différence
-# en ce qui concerne la session).
-try:
- from Editeur import session
-except:
- session=None
-
-def init(top,code="ASTER",fichier=None,studyId=None):
- splash.init_splash(top,code=code,titre="Lancement d'EFICAS pour %s" %code)
- splash._splash.configure(text="Chargement d'EFICAS en cours.\n Veuillez patienter ...")
- # Enregistrement dans l étude
- import eficasEtude
- MaRef=eficasEtude.Eficas_In_Study(code,studyId=studyId)
-
- #import eficas
- class MyEficas(eficas.EFICAS):
- def quit(self):
- eficas.EFICAS.quit(self)
- self.top.destroy()
-
- def contexte(self):
- self.salome=MaRef
-
- # _CS_gbo Gestion du versionning 1.7 et 1.8
- if session is not None:
- if fichier != None :
- options=session.parse(sys.argv+[fichier])
- else :
- options=session.parse(sys.argv)
-
- moi=MyEficas(top,code=code)
- moi.contexte()
-
-def initNovice(code="ASTER",fichier=None,studyId=None):
- # Enregistrement dans l étude
- import eficasEtude
- MaRef=eficasEtude.Eficas_In_Study(code,studyId=studyId)
-
- #import eficas
- class MyEficas(appli.Appli):
- #def exit(self, event=None):
- #appli.Appli.exit(self, event=None)
-
- def contexte(self):
- self.salome=MaRef
-
- moi=MyEficas()
- mainwindow.MainWindow(moi)
- moi.contexte()
\ No newline at end of file
+++ /dev/null
-import salome
-import SALOMEDS
-import SMESH
-import GEOM
-import SalomePyQt
-##import MonChoixMaillage
-import string
-import EFICASGUI
-
-
-import meshdialogImp
-
-
-
-Tag_RefOnShape = 1
-dict_CL={}
-
-class CLinit:
- def __init__(self):
- geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
- #self.GroupOp = geom.GetIGroupOperations(salome.myStudyId)
- self.GroupOp = geom.GetIGroupOperations(EFICASGUI.currentStudyId)
- self.smesh=None
- self.geomcompID=None
- self._d = SalomePyQt.SalomePyQt().getDesktop()
- self.correspondanceNomIOR = {}
- self.correspondanceNomIORshape = {}
- self.dict_listedep={}
-
- def clean(self):
- dict_CL={}
-
- def GetOrCreateCL(self,myShapeName):
- if not (dict_CL.has_key(myShapeName)):
- dict_CL[myShapeName] = CL()
- return dict_CL[myShapeName]
-
-
- def traiteCL(self):
- self.get_geoms()
- self.get_maillages()
- # Récupere tous les Mesh
- if len(dict_CL) > 0:
- Dialog = meshdialogImp.MeshDialogImpl( self._d )
- dict_CL.clear()
- ##Choix=MonChoixMaillage.MonChoixMaillage(self,0,self._d)
-
- salome.sg.updateObjBrowser(0)
-
-
- def traiteMaillage(self,indiceIOR,NomMaillage):
- MeshIOR = self.correspondanceNomIOR[str(NomMaillage)]
- Mesh = salome.orb.string_to_object(MeshIOR)
- GEOMIor = dict_CL.keys()[indiceIOR]
- for monIOR in dict_CL[GEOMIor].CLOnNode.keys():
- GEOMShape = salome.orb.string_to_object(monIOR)
- aShapeSO = salome.myStudy.FindObjectIOR(monIOR)
- attrName = aShapeSO.FindAttribute("AttributeName")[1]
- anAttr = attrName._narrow(SALOMEDS.AttributeName)
- Name = anAttr.Value()
- Mesh.CreateGroupFromGEOM(SMESH.NODE,Name,GEOMShape)
- for monIOR in dict_CL[GEOMIor].CLOnCell.keys():
- GEOMShape = salome.orb.string_to_object(monIOR)
- aShapeSO = salome.myStudy.FindObjectIOR(monIOR)
- attrName = aShapeSO.FindAttribute("AttributeName")[1]
- anAttr = attrName._narrow(SALOMEDS.AttributeName)
- Name = anAttr.Value()
- #_CS_cbo: ajout de la determination de la dimension de la geometrie
- type = self.getShapeType(GEOMShape)
- Mesh.CreateGroupFromGEOM(type,Name,GEOMShape)
- del dict_CL[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)
- assert (self.smesh)
- newMesh = self.smesh.CreateMesh(shape)
- self.SetName(salome.ObjectToID(newMesh),NomMaillage)
- for monIOR in dict_CL[GEOMIor].CLOnNode.keys():
- GEOMShape = salome.orb.string_to_object(monIOR)
- aShapeSO = salome.myStudy.FindObjectIOR(monIOR)
- attrName = aShapeSO.FindAttribute("AttributeName")[1]
- anAttr = attrName._narrow(SALOMEDS.AttributeName)
- Name = anAttr.Value()
- newMesh.CreateGroupFromGEOM(SMESH.NODE,Name,GEOMShape)
- for monIOR in dict_CL[GEOMIor].CLOnCell.keys():
- GEOMShape = salome.orb.string_to_object(monIOR)
- aShapeSO = salome.myStudy.FindObjectIOR(monIOR)
- attrName = aShapeSO.FindAttribute("AttributeName")[1]
- anAttr = attrName._narrow(SALOMEDS.AttributeName)
- Name = anAttr.Value()
- #_CS_cbo: ajout de la determination de la dimension de la geometrie
- type = self.getShapeType(GEOMShape)
- newMesh.CreateGroupFromGEOM(type,Name,GEOMShape)
- del dict_CL[GEOMIor]
-
- def NomShape(self,numero):
- GEOMIor = dict_CL.keys()[numero]
- aShapeSO = salome.myStudy.FindObjectIOR(GEOMIor)
- attrName = aShapeSO.FindAttribute("AttributeName")[1]
- anAttr = attrName._narrow(SALOMEDS.AttributeName)
- Name = anAttr.Value()
- return Name
-
-# NodeorCell = 0 on traite des noeuds
-# NodeorCell = 1 on traite des mailles
-
- 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]:
- aMeshSO = salome.myStudy.FindObjectIOR(MeshIor)
- attrName = aMeshSO.FindAttribute("AttributeName")[1]
- anAttr = attrName._narrow(SALOMEDS.AttributeName)
- Name = anAttr.Value()
- self.correspondanceNomIOR[Name] = MeshIor
- 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:
- 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.
-
- Le type de geometrie determine le type de mailles.
- Voir le dictionnnaire ShapeType dans geompy.py pour les correspondances type - numero.
- """
- type = []
- tgeo = str(GEOMShape.GetShapeType())
- if tgeo == "VERTEX":
- type = SMESH.NODE
- elif tgeo == "EDGE":
- type = SMESH.EDGE
- elif tgeo == "FACE":
- type = SMESH.FACE
- elif tgeo == "SOLID":
- type = SMESH.VOLUME
- elif tgeo == "COMPOUND":
- tgeo = self.GroupOp.GetType(GEOMShape)
- if tgeo == 7:
- type = SMESH.NODE
- elif tgeo == 6:
- type = SMESH.EDGE
- elif tgeo == 4:
- type = SMESH.FACE
- elif tgeo == 2:
- type = SMESH.VOLUME
- return type
-
- def get_maillages(self):
- salome.myStudy = salome.myStudyManager.GetStudyByID( EFICASGUI.currentStudyId )
-
-
- self.Liste_maillages={}
- if self.smesh == None :
- self.smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
- self.smesh.SetCurrentStudy(salome.myStudy)
- stringIOR=salome.orb.object_to_string(self.smesh)
-
- SO_smesh=salome.myStudy.FindObjectIOR(stringIOR)
- if SO_smesh != None:
- ChildIterator = salome.myStudy.NewChildIterator(SO_smesh)
- while ChildIterator.More() :
- aSObj = ChildIterator.Value()
- ChildIterator.Next()
- anAttr =aSObj.FindAttribute("AttributeName")[1]
- anAttr = anAttr._narrow(SALOMEDS.AttributeName)
- Name = anAttr.Value()
- if (Name != "Hypotheses" and Name != "Algorithms"):
- res, Ref = aSObj.FindSubObject( Tag_RefOnShape )
- if res == 1 :
- ok,MyShapeSO = Ref.ReferencedObject()
- if ok :
- IORAttr = MyShapeSO.FindAttribute("AttributeIOR")[1]
- anAttr = IORAttr._narrow(SALOMEDS.AttributeIOR)
- GEOMShapeIOR = anAttr.Value()
-
- IORAttr2 = aSObj.FindAttribute("AttributeIOR")[1]
- anAttr2 = IORAttr2._narrow(SALOMEDS.AttributeIOR)
- MeshIOR = anAttr2.Value()
-
- if GEOMShapeIOR in self.Liste_maillages.keys():
- self.Liste_maillages[GEOMShapeIOR].append(MeshIOR)
- 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):
- sobj = salome.myStudy.FindObjectIOR(GEOMIor)
- #print "_______________________________________________________"
- #print "Cherchemain", sobj.GetID()
- #print "_______________________________________________________"
- if sobj == None :
- print "objet nul dans chercheMain"
- return
-
- # Recherche du composant GEOM
- if self.geomcompID == None:
- self.geomcompID = sobj.GetFatherComponent().GetID()
-
- # On cherche les dépendances et
- # on ajoute l objet lui-même à la liste
- # Attention le FindDependance ne donne pas la liste des objets
- # avec cette référence
- #
-
- MonEntry= sobj.GetID()
- if not(self.dict_listedep.has_key(MonEntry)) :
- self.dict_listedep[MonEntry]=[]
- self.ChercheRef(MonEntry,sobj.GetFatherComponent())
- #self.dict_listedep[MonEntry].append(sobj)
-
- ListeAtraiter=[]
- for sobj in self.dict_listedep[MonEntry] :
-
- # 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 :
- ListeAtraiter.append(current)
-
- for sobj in ListeAtraiter:
- current=sobj
- #while ( current.GetFather().GetID() != self.geomcompID):
- while ( current.GetID() != self.geomcompID):
- MainID=current.GetID()
- current=current.GetFather()
- 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)
-
- def ChercheRef(self,entry,geomSobj):
- #print "ChercheRef", entry,geomSobj.GetID()
- aIter=salome.myStudy.NewChildIterator(geomSobj)
- while aIter.More() :
- aIterSObj = aIter.Value()
- aIterID=aIterSObj.GetID()
- aIter.Next()
-
- bool,obj=aIterSObj.ReferencedObject()
- entrycomp=""
- if not bool :
- entrycomp=aIterID
- else :
- # Attention bug sur ReferencedObject
- if aIterID.find(entry) != 0:
- entrycomp=obj.GetID()
- if entry == entrycomp :
- self.dict_listedep[entry].append(aIterSObj)
- self.ChercheRef(entry,aIterSObj)
-
-
- def SetName(self,Entry, Name):
- SO = salome.myStudy.FindObjectID( Entry )
- if SO != None :
- myStudyBuilder = salome.myStudy.NewBuilder()
- aName = myStudyBuilder.FindOrCreateAttribute(SO, "AttributeName")
- aName.SetValue(Name)
-
-class CL:
-
- def __init__(self):
- self.CLOnCell={}
- self.CLOnNode={}
-
-# nodeOrCell = 0 on traite des noeuds
-# nodeOrCell = 1 on traite des faces
-
- def SetIdAsCL(self,CLName,nodeOrCell):
- if (nodeOrCell == 0) :
- print "NOEUD"
- if self.CLOnNode.has_key(CLName):
- self.CLOnNode[CLName] = self.CLOnNode[CLName] + 1
- else :
- self.CLOnNode[CLName] = 1
- if (nodeOrCell == 1) :
- print "MAILLE"
- if self.CLOnCell.has_key(CLName):
- self.CLOnCell[CLName] = self.CLOnCell[CLName] + 1
- else :
- self.CLOnCell[CLName] = 1
-
- def UnSetIdAsCL(self,CLName,nodeOrCell):
- if (nodeOrCell == 0) :
- if self.CLOnNode.has_key(CLName):
- self.CLOnNode[CLName] = self.CLOnNode[CLName] - 1
- if (nodeOrCell == 1) :
- if self.CLOnCell.has_key(CLName):
- self.CLOnCell[CLName] = self.CLOnCell[CLName] - 1
-
-
+++ /dev/null
-#=============================================================================
-# File : EficasEtude.py
-# Created : mar fév 25 09:48:34 CET 2003
-# 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.4 2005/06/22 18:50:13 salome Exp $
-#=============================================================================
-
-import salome
-import re
-from tkFileDialog import asksaveasfilename
-
-import salomedsgui
-aGuiDS=salomedsgui.guiDS()
-
-#--------------------------------------------------------------------------
-
-class Eficas_In_Study:
-
- def __init__(self,code,studyId=None):
- print "#######################################################"
- print "#######################################################"
- print "#######################################################"
- print "_CS_GBO_ : Eficas_In_Study:init: studyId = ", studyId
- print "#######################################################"
- print "#######################################################"
- import SMESH_utils
- self.aGuiDS=salomedsgui.guiDS(studyId=studyId)
- self.enregistre()
- self.code=code
- self.liste_deja_la=[]
-
- def enregistre(self):
- self.fatherId=self.aGuiDS.enregistre("Eficas")
- salome.sg.updateObjBrowser(0)
-
- def rangeInStudy(self,fichier, suf=""):
- if fichier not in self.liste_deja_la :
- self.liste_deja_la.append(fichier)
- Nom=re.split("/",fichier)[-1]
-
- self.commId=self.aGuiDS.createItemInStudy(self.fatherId,Nom)
- if self.commId != None:
- self.aGuiDS.setExternalFileAttribute(self.commId,"FICHIER_EFICAS_"+self.code+suf,fichier)
- salome.sg.updateObjBrowser(0)
- print "(((((((((((((((((((((((((((((((((((((("
- print "fin range in study"
-
- def creeConfigTxt(self,fichier,dico):
- sauvegarde = asksaveasfilename(title="fichier config.txt",
- defaultextension='.txt',
- initialdir = fichier)
- f=open(sauvegarde,'w+')
- for unite in dico.keys():
- print unite
- type=dico[unite][0]
- fic=dico[unite][1:]
- ligne="fort."+str(unite)+" "+type+" "+fic
- f.write(ligne)
- f.close()
- self.rangeInStudy(sauvegarde)
- print "==============================="
- print "fin crreConfigTxt"
-
+++ /dev/null
-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
-<class>MeshDialog</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>MeshDialog</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>458</width>
- <height>316</height>
- </rect>
- </property>
- <property name="caption">
- <string>SALOME - Application Conditions aux limites</string>
- </property>
- <property name="sizeGripEnabled">
- <bool>true</bool>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QGroupBox">
- <property name="name">
- <cstring>groupBox2</cstring>
- </property>
- <property name="title">
- <string>Salome-Mesh</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QRadioButton" row="0" column="0">
- <property name="name">
- <cstring>rbNewMesh</cstring>
- </property>
- <property name="text">
- <string>Créer Maillage</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QListBox" row="1" column="1">
- <item>
- <property name="text">
- <string>New Item</string>
- </property>
- </item>
- <property name="name">
- <cstring>lbMeshes</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>32767</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>WheelFocus</enum>
- </property>
- <property name="columnMode">
- <enum>FixedNumber</enum>
- </property>
- <property name="rowMode">
- <enum>Variable</enum>
- </property>
- </widget>
- <widget class="QRadioButton" row="0" column="1">
- <property name="name">
- <cstring>rbUpdateMesh</cstring>
- </property>
- <property name="text">
- <string>Mise à jours Maillage</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>Layout1</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <property name="spacing">
- <number>6</number>
- </property>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonHelp</cstring>
- </property>
- <property name="text">
- <string>&Help</string>
- </property>
- <property name="accel">
- <string>F1</string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- </widget>
- <spacer>
- <property name="name">
- <cstring>Horizontal Spacing2</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>143</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonOk</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>&OK</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- <property name="toggleButton">
- <bool>false</bool>
- </property>
- <property name="on">
- <bool>false</bool>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonCancel</cstring>
- </property>
- <property name="text">
- <string>&Cancel</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- </widget>
- </hbox>
- </widget>
- </vbox>
-</widget>
-<connections>
- <connection>
- <sender>buttonOk</sender>
- <signal>clicked()</signal>
- <receiver>MeshDialog</receiver>
- <slot>accept()</slot>
- </connection>
- <connection>
- <sender>buttonCancel</sender>
- <signal>clicked()</signal>
- <receiver>MeshDialog</receiver>
- <slot>reject()</slot>
- </connection>
- <connection>
- <sender>rbNewMesh</sender>
- <signal>clicked()</signal>
- <receiver>rbUpdateMesh</receiver>
- <slot>toggle()</slot>
- </connection>
- <connection>
- <sender>rbUpdateMesh</sender>
- <signal>clicked()</signal>
- <receiver>rbNewMesh</receiver>
- <slot>toggle()</slot>
- </connection>
- <connection>
- <sender>rbNewMesh</sender>
- <signal>toggled(bool)</signal>
- <receiver>lbMeshes</receiver>
- <slot>clearSelection()</slot>
- </connection>
- <connection>
- <sender>rbNewMesh</sender>
- <signal>toggled(bool)</signal>
- <receiver>lbMeshes</receiver>
- <slot>setDisabled(bool)</slot>
- </connection>
- <connection>
- <sender>rbNewMesh</sender>
- <signal>toggled(bool)</signal>
- <receiver>buttonOk</receiver>
- <slot>setEnabled(bool)</slot>
- </connection>
- <connection>
- <sender>lbMeshes</sender>
- <signal>highlighted(int)</signal>
- <receiver>MeshDialog</receiver>
- <slot>enableOK()</slot>
- </connection>
-</connections>
-<slots>
- <slot>enableOK()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+++ /dev/null
-# -*- coding: iso-8859-1 -*-
-from qt import *
-from meshdialog import MeshDialog
-from EficasStudy import study, SMesh
-
-
-
-#CS_pbruno c'est à partir de ces données que la boite de dialogue est crée ( paramètres obligatoires )
-mainShapeEntry = ''
-groupeMaEntries = []
-groupeNoEntries = []
-
-
-
-# CS_pbruno message à placer dans un module approprié( EficasMsg.py àcréer )
-warning = 'Attention!'
-msg1 = "erreur création maillage dans Salome"
-msg2 = "erreur mise à jours maillage dans Salome"
-
-msg3 = "géométrie principale indéterminée"
-msg4 = "liste des sous-géométries indéterminée"
-
-
-class MeshDialogImpl( MeshDialog ):
- def __init__(self, parent = None,name = None,modal = 0,fl = 0):
- MeshDialog.__init__(self,parent,name,modal,fl)
- self.meshEntries = {}
- if not mainShapeEntry:
- QMessageBox.warning( self, warning, msg3 )
- else:
- self.__fillLbMeshes( mainShapeEntry )
- if not ( groupeMaEntries or groupeNoEntries ):
- QMessageBox.warning( self, warning, msg4 )
- self.show()
-
-
- def enableOK( self):
- self.buttonOk.setEnabled( 1 )
-
-
- def accept( self ):
- global mainShapeEntry, groupeMaEntries, groupeNoEntries
-
- if self.rbNewMesh.isChecked(): # l'utilisateur choisi de crée un nouveau maillage
- self.__createSalomeMesh( mainShapeEntry, groupeMaEntries, groupeNoEntries )
- else: # l'utilisateur choisi un maillage existant
- self.__updateSalomeMesh( groupeMaEntries, groupeNoEntries )
- self.close()
-
- # réinit obligatoire des variables globales pour prochaine utilisation
- mainShapeEntry = ''
- groupeMaEntries = []
- groupeNoEntries = []
-
-
-
-
-
- def __fillLbMeshes( self, mainShapeEntryIn ):
- """
- Rempli la liste des maillages possibles à modifier ( ceux référencant
- la géométrie principale indiquée en paramètre d'entrée )
- """
- self.lbMeshes.clear()
- meshEntries = study.getAllMeshReferencingMainShape( mainShapeEntryIn )
-
- if meshEntries: # il existe au moins un maillage dans l'arbre d'étude Salome référençant la géométrie principale
- for aMeshEntry in meshEntries:
- aMeshName = study.getNameAttribute( aMeshEntry )
- self.lbMeshes.insertItem( aMeshName )
- self.meshEntries[ aMeshName ] = aMeshEntry
- else: # pas de maillages, il faudra obligatoirment en crée une nouvelle
- self.rbUpdateMesh.setEnabled(0)
- self.lbMeshes.setEnabled(0)
-
-
- def __meshUniqueName( self, nameIn ):
- """
- Contrôle si objet du composant 'Mesh' possède déjà le nom fourni en paramètre
- retourne le même nom si ce n'est pas le cas, le même nom avec un suffixe sinon
- """
- uniqueName = nameIn
- suffix = 0
- strSuffix = ''
-
- while study.hasName( SMesh, uniqueName + strSuffix ):
- suffix += 1
- strSuffix = str( suffix )
-
- uniqueName = uniqueName + strSuffix
-
- return uniqueName
-
-
-
- def __createSalomeMesh( self, mainShapeEntryIn, groupeMaEntriesIn, groupeNoEntriesIn ):
- """
- Fonction de création d'un nouveau maillage dans Salome
- """
- ok = False
- try:
- mainShapeName = study.getNameAttribute( mainShapeEntryIn )
- newMeshName = str( mainShapeName ) + '_Mesh'
- newMeshName = self.__meshUniqueName( newMeshName )
- study.createMesh( newMeshName, mainShapeEntryIn, groupeMaEntriesIn, groupeNoEntriesIn )
- study.refresh()
- ok = True
- except:
- QMessageBox.warning( self, warning, msg1 )
- return ok
-
-
- def __updateSalomeMesh( self, groupeMaEntriesIn, groupeNoEntriesIn ):
- """
- Fonction de mise à jours d'un maillage existant( séléctionné par l'utilisateur ds la listBox ) dans Salome
- """
- ok = False
- try:
- item = self.lbMeshes.selectedItem()
- selectedMeshName = str( item.text() )
- meshEntry = self.meshEntries[ selectedMeshName ]
- study.updateMesh( meshEntry, groupeMaEntriesIn, groupeNoEntriesIn )
- study.refresh()
- ok = True
- except:
- QMessageBox.warning( self, warning, msg2 )
- return ok
-
-
-
-