--- /dev/null
+# Form implementation generated from reading ui file 'ChoixMaillage.ui'
+#
+# Created: Tue Jan 25 11:28:46 2005
+# by: The PyQt User Interface Compiler (pyuic)
+#
+# WARNING! All changes made in this file will be lost!
+
+
+from qt import *
+Extracting Python code from ChoixMaillage.ui.h
+
+
+class ChoixMaillage(QDialog):
+ def __init__(self,parent = None,name = None,modal = 0,fl = 0):
+ QDialog.__init__(self,parent,name,modal,fl)
+
+ if name == None:
+ self.setName("ChoixMaillage")
+
+ self.resize(526,252)
+ self.setCaption(self.trUtf8("Choix du Maillage sur lequel s appliquent les condtions aux limites"))
+
+
+ self.TextLabel1 = QLabel(self,"TextLabel1")
+ self.TextLabel1.setGeometry(QRect(10,190,191,40))
+ self.TextLabel1.setText(self.trUtf8("Nom du nouveau maillage"))
+
+ self.TextLabel2 = QLabel(self,"TextLabel2")
+ self.TextLabel2.setGeometry(QRect(20,70,181,31))
+ self.TextLabel2.setText(self.trUtf8("Maillage sélectionné"))
+
+ self.Maillage = QListBox(self,"Maillage")
+ self.Maillage.setGeometry(QRect(210,70,281,90))
+
+ self.TextLabel1_2 = QLabel(self,"TextLabel1_2")
+ self.TextLabel1_2.setGeometry(QRect(20,10,120,20))
+ self.TextLabel1_2.setText(self.trUtf8("Géométrie traitée :"))
+
+ self.NomShape = QLabel(self,"NomShape")
+ self.NomShape.setGeometry(QRect(140,10,191,21))
+ self.NomShape.setText(self.trUtf8("TextLabel2"))
+
+ self.NouveauMesh = QLineEdit(self,"NouveauMesh")
+ self.NouveauMesh.setGeometry(QRect(210,200,280,24))
+
+ self.connect(self.Maillage,SIGNAL("clicked(QListBoxItem*)"),self.Maillage_clicked)
+ self.connect(self.NouveauMesh,SIGNAL("returnPressed()"),self.NouveauMesh_returnPressed)
+
+ def Maillage_clicked(self,a0):
+ print "ChoixMaillage.Maillage_clicked(QListBoxItem*): Not implemented yet"
+
+ def NouveauMesh_returnPressed(self):
+ print "ChoixMaillage.NouveauMesh_returnPressed(): Not implemented yet"
--- /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>252</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</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>190</y>
+ <width>191</width>
+ <height>40</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Nom du nouveau maillage</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>70</y>
+ <width>181</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Maillage sélectionné</string>
+ </property>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>Maillage</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>210</x>
+ <y>70</y>
+ <width>281</width>
+ <height>90</height>
+ </rect>
+ </property>
+ </widget>
+ <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="QLineEdit">
+ <property name="name">
+ <cstring>NouveauMesh</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>210</x>
+ <y>200</y>
+ <width>280</width>
+ <height>24</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>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">ChoixMaillage.ui.h</include>
+</includes>
+<slots>
+ <slot>Maillage_clicked( QListBoxItem * )</slot>
+ <slot>NouveauMesh_returnPressed()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
EFICASGUI.py \
salomedsgui.py \
SMESH_utils.py \
+eficasCL.py \
+ChoixMaillage.py \
+MonChoixMaillage.py \
eficasSalome.py
# _CS_gbo_151104 Ajout pour compatibilité ascendante entre versions de Eficas
--- /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.recupere_info()
+
+ self.NomShape.setText(self._nomShape)
+ for item in self._listeMesh:
+ self.Maillage.insertItem(item)
+ self.show()
+
+ def recupere_info(self):
+ self._nomShape = self._CL.NomShape(self._numero)
+ self._listeMesh= self._CL.Possibles(self._numero)
+
+ def Maillage_clicked(self,item) :
+ 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.traiteCL()
+ self.close()
+
# 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.2 2004/12/10 16:43:25 salome Exp $
+# $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/EFICASGUI/SMESH_utils.py,v 1.3 2004/12/10 18:55:02 salome Exp $
#=============================================================================
from omniORB import CORBA
import SALOMEDS
import GEOM
import SMESH
+from eficasCL import *
# initialise the ORB
orb = CORBA.ORB_init([''], CORBA.ORB_ID)
refList = []
subShapeIndexes = []
- print "################ len(entryList)=", len(entryList)
if len(entryList) > 0:
iorStringMain = getMainShapeName(myStudy, entryList[0])
if iorStringMain == None:
raise RuntimeException("L'ior CORBA n'est pas défini")
- print "################ iorStringMain=", iorStringMain
- myCL=smesh.GetOrCreateCL(str(iorStringMain))
+ #myCL=smesh.GetOrCreateCL(str(iorStringMain))
+ myCLinit=CLinit()
+ myCL=myCLinit.GetOrCreateCL(iorStringMain)
if len(entryList) > 0:
for idShape in entryList:
typenoeudorcell = 0
subShapeIndexes = getSMESHSubShapeIndexes(myStudy, entryList,typenoeudorcell)
labelGroupNo = []
+ print "d"
for val in subShapeIndexes:
labelGroupNo.append(val)
+ print "e"
return labelGroupNo
#--------------------------------------------------------------------------
--- /dev/null
+import salome
+import SALOMEDS
+import SMESH
+import SalomePyQt
+import MonChoixMaillage
+
+Tag_RefOnShape = 1
+dict_CL={}
+
+class CLinit:
+ def __init__(self):
+ self.smesh=None
+ self._d = SalomePyQt.SalomePyQt().getDesktop()
+ self.get_maillages()
+ self.listeDejaTraites= []
+ self.Liste_Shape = {}
+ self.correspondanceNomIOR = {}
+ self.name="CL"
+
+ def GetOrCreateCL(self,myShapeName):
+ if not (dict_CL.has_key(myShapeName)):
+ dict_CL[myShapeName] = CL()
+ return dict_CL[myShapeName]
+
+ def chercheAtraiter(self):
+ atraiter=-1
+ curseur=0
+ print dict_CL.keys()
+ print self.listeDejaTraites
+ while curseur < len(dict_CL):
+ GEOMIor=self.Liste_Shape[curseur]
+ if GEOMIor not in self.listeDejaTraites:
+ atraiter=curseur
+ break
+ curseur=curseur+1
+ return atraiter
+
+ def traiteCL(self):
+ # Récupere tous les Mesh
+ if self.Liste_Shape == {}:
+ self.Liste_Shape = dict_CL.keys()
+ atraiter=self.chercheAtraiter()
+ if atraiter >= 0:
+ Choix=MonChoixMaillage.MonChoixMaillage(self,atraiter,self._d)
+ salome.sg.updateObjBrowser(0)
+
+ def traiteMaillage(self,indiceIOR,NomMaillage):
+ MeshIOR = self.correspondanceNomIOR[str(NomMaillage)]
+ Mesh = salome.orb.string_to_object(MeshIOR)
+ GEOMIor =self.Liste_Shape[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()
+ Mesh.CreateGroupFromGEOM(SMESH.FACE,Name,GEOMShape)
+ self.listeDejaTraites.append(GEOMIor)
+
+
+ def traiteNewMaillage(self,indiceIOR,NomMaillage):
+ GEOMIor =self.Liste_Shape[indiceIOR]
+ print GEOMIor
+ print dict_CL[GEOMIor].CLOnNode.keys()
+ print dict_CL[GEOMIor].CLOnCell.keys()
+ shape = salome.orb.string_to_object(GEOMIor)
+ 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()
+ newMesh.CreateGroupFromGEOM(SMESH.FACE,Name,GEOMShape)
+ self.listeDejaTraites.append(GEOMIor)
+
+ def NomShape(self,numero):
+ GEOMIor=self.Liste_Shape[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):
+ GEOMIor=self.Liste_Shape[numero]
+ liste=[]
+ 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 get_maillages(self):
+ 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 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) :
+ if self.CLOnNode.has_key(CLName):
+ self.CLOnNode[CLName] = self.CLOnNode[CLName] + 1
+ else :
+ self.CLOnNode[CLName] = 1
+ if (nodeOrCell == 1) :
+ 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
+
+