From 4f6b15c8f61841d3d6b3a38e81f60f9b6619842c Mon Sep 17 00:00:00 2001 From: salome <> Date: Fri, 15 Apr 2005 14:58:35 +0000 Subject: [PATCH] Prise en compte des conditions aux limites sur des groupes geometriques. --- src/EFICASGUI/eficasCL.py | 84 ++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/src/EFICASGUI/eficasCL.py b/src/EFICASGUI/eficasCL.py index 7f874875..58e527af 100644 --- a/src/EFICASGUI/eficasCL.py +++ b/src/EFICASGUI/eficasCL.py @@ -9,6 +9,8 @@ dict_CL={} class CLinit: def __init__(self): + geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") + self.GroupOp = geom.GetIGroupOperations(salome.myStudyId) self.smesh=None self._d = SalomePyQt.SalomePyQt().getDesktop() self.get_maillages() @@ -26,34 +28,28 @@ class CLinit: if len(dict_CL) > 0: 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) + GEOMShape = salome.orb.string_to_object(monIOR) aShapeSO = salome.myStudy.FindObjectIOR(monIOR) attrName = aShapeSO.FindAttribute("AttributeName")[1] - anAttr = attrName._narrow(SALOMEDS.AttributeName) + 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) + GEOMShape = salome.orb.string_to_object(monIOR) aShapeSO = salome.myStudy.FindObjectIOR(monIOR) attrName = aShapeSO.FindAttribute("AttributeName")[1] - anAttr = attrName._narrow(SALOMEDS.AttributeName) + anAttr = attrName._narrow(SALOMEDS.AttributeName) Name = anAttr.Value() - #_CS_cbo: ajout de la determination de la dimension de la geometrie - #Mesh.CreateGroupFromGEOM(SMESH.FACE,Name,GEOMShape) - ShapeType = GEOMShape.GetShapeType() - print ShapeType - if str(ShapeType) is "EDGE": - print "--------------- EDGE existing Mesh" - Mesh.CreateGroupFromGEOM(SMESH.EDGE,Name,GEOMShape) - else: - print "--------------- FACE existing Mesh" - Mesh.CreateGroupFromGEOM(SMESH.FACE,Name,GEOMShape) + #_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] @@ -61,34 +57,27 @@ class CLinit: GEOMIor = dict_CL.keys()[indiceIOR] shape = salome.orb.string_to_object(GEOMIor) if self.smesh == None : - self.smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") - self.smesh.SetCurrentStudy(salome.myStudy) + 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) + 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) + GEOMShape = salome.orb.string_to_object(monIOR) aShapeSO = salome.myStudy.FindObjectIOR(monIOR) attrName = aShapeSO.FindAttribute("AttributeName")[1] - anAttr = attrName._narrow(SALOMEDS.AttributeName) + anAttr = attrName._narrow(SALOMEDS.AttributeName) Name = anAttr.Value() #_CS_cbo: ajout de la determination de la dimension de la geometrie - #newMesh.CreateGroupFromGEOM(SMESH.FACE,Name,GEOMShape) - ShapeType = GEOMShape.GetShapeType() - print ShapeType - if str(ShapeType) is "EDGE": - print "--------------- EDGE newMesh" - newMesh.CreateGroupFromGEOM(SMESH.EDGE,Name,GEOMShape) - else: - print "--------------- FACE newMesh" - newMesh.CreateGroupFromGEOM(SMESH.FACE,Name,GEOMShape) + type = self.getShapeType(GEOMShape) + newMesh.CreateGroupFromGEOM(type,Name,GEOMShape) del dict_CL[GEOMIor] def NomShape(self,numero): @@ -115,6 +104,35 @@ class CLinit: liste.append(Name) return liste + 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): self.Liste_maillages={} if self.smesh == None : -- 2.39.2