# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
- """
- Paramètres géométriques du tuyau coudé sain:
+ """Paramètres géométriques du tuyau coudé sain:
+
angleCoude
r_cintr
l_tube_p1
epais
de
"""
- self.geomParams = dict(angleCoude = self.dico['angle'],
- r_cintr = self.dico['rCintr'],
- l_tube_p1 = self.dico['lTubeP1'],
- l_tube_p2 = self.dico['lTubeP2'],
- epais = self.dico['epais'],
+ self.geomParams = dict(angleCoude = self.dico['angle'], \
+ r_cintr = self.dico['rCintr'], \
+ l_tube_p1 = self.dico['lTubeP1'], \
+ l_tube_p2 = self.dico['lTubeP2'], \
+ epais = self.dico['epais'], \
de = self.dico['dext'])
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
- self.meshParams = dict(n_long_p1 = self.dico['nbAxeTubeP1'],
- n_ep = self.dico['nbEpaisseur'],
- n_long_coude = self.dico['nbAxeCoude'],
- n_circ_g = self.dico['nbCirconf'],
- n_circ_d = self.dico['nbCirconf'],
+ self.meshParams = dict(n_long_p1 = self.dico['nbAxeTubeP1'], \
+ n_ep = self.dico['nbEpaisseur'], \
+ n_long_coude = self.dico['nbAxeCoude'], \
+ n_circ_g = self.dico['nbCirconf'], \
+ n_circ_d = self.dico['nbCirconf'], \
n_long_p2 = self.dico['nbAxeTubeP2'])
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
- """
- paramètres de la fissure pour le tuyau coude
+ """paramètres de la fissure pour le tuyau coude
+
profondeur : 0 < profondeur <= épaisseur
rayonPipe : rayon du pipe correspondant au maillage rayonnant
lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut)
externe : True : fissure face externe, False : fissure face interne
"""
print("setParamShapeFissure", self.nomCas)
- self.shapeFissureParams = dict(profondeur = self.dico['profondeur'],
- rayonPipe = self.dico['rayonTore'],
- lenSegPipe = self.dico['lenSegPipe'],
- azimut = self.dico['azimut'],
- alpha = self.dico['posiAngul'],
- longueur = self.dico['longueur'],
- orientation = self.dico['orientation'],
- lgInfluence = self.dico['influence'],
- elliptique = self.dico['cbForceEllipse'],
+ self.shapeFissureParams = dict(profondeur = self.dico['profondeur'], \
+ rayonPipe = self.dico['rayonTore'], \
+ lenSegPipe = self.dico['lenSegPipe'], \
+ azimut = self.dico['azimut'], \
+ alpha = self.dico['posiAngul'], \
+ longueur = self.dico['longueur'], \
+ orientation = self.dico['orientation'], \
+ lgInfluence = self.dico['influence'], \
+ elliptique = self.dico['cbForceEllipse'], \
externe = self.dico['rbFissExt'])
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- """
- Paramètres du maillage de la fissure pour le tuyau coudé
+ """Paramètres du maillage de la fissure pour le tuyau coudé
+
Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe.
nbSegRad = nombre de couronnes
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = os.curdir,
- nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
- nbsegRad = self.dico['nbCouronnes'],
- nbsegCercle = self.dico['nbSecteurs'],
+ self.maillageFissureParams = dict(nomRep = os.curdir, \
+ nomFicSain = self.nomCas, \
+ nomFicFissure = 'fissure_' + self.nomCas, \
+ nbsegRad = self.dico['nbCouronnes'], \
+ nbsegCercle = self.dico['nbSecteurs'], \
areteFaceFissure = self.dico['aretesFaceFissure'])
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
self.referencesMaillageFissure = dict( \
- Entity_Quad_Pyramid = 0,
Entity_Quad_Quadrangle = 0, \
Entity_Quad_Hexa = 0, \
Entity_Node = 0, \
Entity_Quad_Edge = 0, \
Entity_Quad_Triangle = 0, \
Entity_Quad_Tetra = 0, \
+ Entity_Quad_Pyramid = 0, \
Entity_Quad_Penta = 0 \
)
# get context study, salomeGui
study = context.study
sg = context.sg
-
- import os
+
#import subprocess
#import tempfile
from qtsalome import QFileDialog, QMessageBox, QPalette, QColor, QDialog
from blocFissure.ihm.fissureCoude_ui import Ui_Dialog
-
+
class fissureCoudeDialog(QDialog):
-
+
def __init__(self):
QDialog.__init__(self)
# Set up the user interface from Designer.
self.ui = Ui_Dialog()
self.ui.setupUi(self)
-
+
self.blackPalette = self.ui.dsb_angle.palette()
self.redPalette = QPalette()
self.redPalette.setColor(QPalette.Text, QColor(255,0,0))
self.NOK = False
-
+
self.initDefaut()
self.initDialog(self.defaut)
self.ui.dsb_angle.setSpecialValueText("saisie_obligatoire")
self.ui.dsb_aretesFaceFissure.setSpecialValueText("automatique")
self.ui.dsb_influence.setSpecialValueText("automatique")
self.ui.lb_calcul.hide()
-
+
# Connect up the buttons.
self.ui.pb_valPrec.clicked.connect(self.readValPrec)
self.ui.pb_reset.clicked.connect(self.resetVal)
self.ui.pb_sauver.clicked.connect(self.sauver)
self.ui.buttonBox.accepted.disconnect(self.accept)
self.ui.buttonBox.accepted.connect(self.execute)
-
+
def initDefaut(self):
- self.defaut = dict(
- angle = -181.0,
- rCintr = 0.0,
- lTubeP1 = 0.0,
- lTubeP2 = 0.0,
- epais = 0.0,
- dext = 0.0,
- profondeur = 0.0,
- longueur = 0.0,
- azimut = -181.0,
- orientation = -1.0,
- posiAngul = -181.0,
- absCurv = 0.0,
- nbTranches = 7,
- nbCouronnes = 1,
- nbSecteurs = 3,
- cbOptDiscrSain = False,
- cbOptDiscrFiss = False,
- rbPosiAngul = True,
- rbFissExt = True,
- cbForceEllipse = False,
- nbAxeTubeP1 = 15,
- nbAxeTubeP2 = 15,
- nbAxeCoude = 10,
- nbCirconf = 20,
- nbEpaisseur = 3,
- rayonTore = 2.0,
- aretesFaceFissure = 0.0,
- influence = 0.0,
+ self.defaut = dict( \
+ angle = -181.0, \
+ rCintr = 0.0, \
+ lTubeP1 = 0.0, \
+ lTubeP2 = 0.0, \
+ epais = 0.0, \
+ dext = 0.0, \
+ profondeur = 0.0, \
+ longueur = 0.0, \
+ azimut = -181.0, \
+ orientation = -1.0, \
+ posiAngul = -181.0, \
+ absCurv = 0.0, \
+ nbTranches = 7, \
+ nbCouronnes = 1, \
+ nbSecteurs = 3, \
+ cbOptDiscrSain = False, \
+ cbOptDiscrFiss = False, \
+ rbPosiAngul = True, \
+ rbFissExt = True, \
+ cbForceEllipse = False, \
+ nbAxeTubeP1 = 15, \
+ nbAxeTubeP2 = 15, \
+ nbAxeCoude = 10, \
+ nbCirconf = 20, \
+ nbEpaisseur = 3, \
+ rayonTore = 2.0, \
+ aretesFaceFissure = 0.0, \
+ influence = 0.0, \
)
-
+
def initDialog(self, dico):
self.ui.dsb_angle.setValue(dico['angle'])
self.ui.dsb_rCintr.setValue(dico['rCintr'])
self.ui.cb_forceEllipse.setChecked(dico['cbForceEllipse'])
incomplet = self.testval(dico)
pass
-
+
def testval(self, dico):
incomplet = False
if dico['angle'] < -180.0:
incomplet = True
else:
self.ui.dsb_angle.setPalette(self.blackPalette)
-
+
if dico['rCintr'] == 0.0:
self.ui.dsb_rCintr.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_rCintr.setPalette(self.blackPalette)
-
- if dico['lTubeP1'] == 0.0:
+
+ if dico['lTubeP1'] == 0.0:
self.ui.dsb_lTubeP1.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_lTubeP1.setPalette(self.blackPalette)
-
- if dico['lTubeP2'] == 0.0:
+
+ if dico['lTubeP2'] == 0.0:
self.ui.dsb_lTubeP2.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_lTubeP2.setPalette(self.blackPalette)
-
- if dico['epais'] == 0.0:
+
+ if dico['epais'] == 0.0:
self.ui.dsb_epais.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_epais.setPalette(self.blackPalette)
-
- if dico['dext'] == 0.0:
+
+ if dico['dext'] == 0.0:
self.ui.dsb_dext.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_dext.setPalette(self.blackPalette)
-
- if dico['profondeur'] == 0.0:
+
+ if dico['profondeur'] == 0.0:
self.ui.dsb_profondeur.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_profondeur.setPalette(self.blackPalette)
-
- if dico['longueur'] == 0.0:
+
+ if dico['longueur'] == 0.0:
self.ui.dsb_longueur.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_longueur.setPalette(self.blackPalette)
-
- if dico['azimut'] < -180.0:
+
+ if dico['azimut'] < -180.0:
self.ui.dsb_azimut.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_azimut.setPalette(self.blackPalette)
-
- if dico['orientation'] < 0.0:
+
+ if dico['orientation'] < 0.0:
self.ui.dsb_orientation.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_orientation.setPalette(self.blackPalette)
-
- if dico['posiAngul'] < -180.0 and dico['rbPosiAngul'] == True:
+
+ if ( ( dico['posiAngul'] < -180.0 ) and dico['rbPosiAngul'] ):
self.ui.dsb_posiAngul.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_posiAngul.setPalette(self.blackPalette)
-
- if dico['absCurv'] == 0.0 and dico['rbPosiAngul'] == False:
+
+ if ( ( dico['absCurv'] == 0.0 ) and ( not dico['rbPosiAngul'] ) ):
self.ui.dsb_absCurv.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_absCurv.setPalette(self.blackPalette)
-
- if dico['nbTranches'] == 7:
+
+ if dico['nbTranches'] == 7:
self.ui.sb_nbTranches.setPalette(self.redPalette)
incomplet = True
else:
self.ui.sb_nbTranches.setPalette(self.blackPalette)
-
- if dico['nbCouronnes'] == 1:
+
+ if dico['nbCouronnes'] == 1:
self.ui.sb_nbCouronne.setPalette(self.redPalette)
incomplet = True
else:
self.ui.sb_nbCouronne.setPalette(self.blackPalette)
-
- if dico['nbSecteurs'] == 3:
+
+ if dico['nbSecteurs'] == 3:
self.ui.sb_nbSecteur.setPalette(self.redPalette)
incomplet = True
else:
self.ui.sb_nbSecteur.setPalette(self.blackPalette)
-
+
print("incomplet: ", incomplet)
return incomplet
-
+
def fileDefault(self):
filedef = os.path.expanduser( os.path.join(os.environ["HOME"],".config", "salome", "dialogFissureCoude.dic") )
print(filedef)
return filedef
-
+
def writeDefault(self, dico):
filedef = self.fileDefault()
with open(filedef, 'w') as f:
- f.write(str(dico))
-
+ f.write(str(dico))
+
def readValPrec(self):
filedef = self.fileDefault()
if os.path.exists(filedef):
with open(filedef, 'r') as f:
- txt = f.read()
+ txt = f.read()
dico = eval(txt)
print(dico)
self.initDialog(dico)
def resetVal(self):
#self.initDefaut()
self.initDialog(self.defaut)
-
+
def sauver(self):
print("sauver")
fileDiag = QFileDialog(self)
filedef = fileNames[0]
dico = self.creeDico()
with open(filedef, 'w') as f:
- f.write(str(dico))
-
+ f.write(str(dico))
+
def recharger(self):
print("recharger")
fileDiag = QFileDialog(self)
print(filedef)
if os.path.exists(filedef):
with open(filedef, 'r') as f:
- txt = f.read()
+ txt = f.read()
dico = eval(txt)
print(dico)
self.initDialog(dico)
-
+
def creeDico(self):
- dico = dict(
- angle = self.ui.dsb_angle.value(),
- rCintr = self.ui.dsb_rCintr.value(),
- lTubeP1 = self.ui.dsb_lTubeP1.value(),
- lTubeP2 = self.ui.dsb_lTubeP2.value(),
- epais = self.ui.dsb_epais.value(),
- dext = self.ui.dsb_dext.value(),
- profondeur = self.ui.dsb_profondeur.value(),
- longueur = self.ui.dsb_longueur.value(),
- azimut = self.ui.dsb_azimut.value(),
- orientation = self.ui.dsb_orientation.value(),
- posiAngul = self.ui.dsb_posiAngul.value(),
- absCurv = self.ui.dsb_absCurv.value(),
- nbTranches = self.ui.sb_nbTranches.value(),
- nbCouronnes = self.ui.sb_nbCouronne.value(),
- nbSecteurs = self.ui.sb_nbSecteur.value(),
- cbOptDiscrSain = self.ui.cb_optDiscrSain.isChecked(),
- cbOptDiscrFiss = self.ui.cb_optDiscrFiss.isChecked(),
- rbPosiAngul = self.ui.rb_posiAngul.isChecked(),
- rbFissExt = self.ui.rb_fissExt.isChecked(),
- cbForceEllipse = self.ui.cb_forceEllipse.isChecked(),
- nbAxeTubeP1 = self.ui.sb_nbAxeTubeP1.value(),
- nbAxeTubeP2 = self.ui.sb_nbAxeTubeP2.value(),
- nbAxeCoude = self.ui.sb_nbAxeCoude.value(),
- nbCirconf = self.ui.sb_nbCirconf.value(),
- nbEpaisseur = self.ui.sb_nbEpaisseur.value(),
- rayonTore = self.ui.dsb_rayonTore.value(),
- aretesFaceFissure = self.ui.dsb_aretesFaceFissure.value(),
- influence = self.ui.dsb_influence.value(),
+ dico = dict( \
+ angle = self.ui.dsb_angle.value(), \
+ rCintr = self.ui.dsb_rCintr.value(), \
+ lTubeP1 = self.ui.dsb_lTubeP1.value(), \
+ lTubeP2 = self.ui.dsb_lTubeP2.value(), \
+ epais = self.ui.dsb_epais.value(), \
+ dext = self.ui.dsb_dext.value(), \
+ profondeur = self.ui.dsb_profondeur.value(), \
+ longueur = self.ui.dsb_longueur.value(), \
+ azimut = self.ui.dsb_azimut.value(), \
+ orientation = self.ui.dsb_orientation.value(), \
+ posiAngul = self.ui.dsb_posiAngul.value(), \
+ absCurv = self.ui.dsb_absCurv.value(), \
+ nbTranches = self.ui.sb_nbTranches.value(), \
+ nbCouronnes = self.ui.sb_nbCouronne.value(), \
+ nbSecteurs = self.ui.sb_nbSecteur.value(), \
+ cbOptDiscrSain = self.ui.cb_optDiscrSain.isChecked(), \
+ cbOptDiscrFiss = self.ui.cb_optDiscrFiss.isChecked(), \
+ rbPosiAngul = self.ui.rb_posiAngul.isChecked(), \
+ rbFissExt = self.ui.rb_fissExt.isChecked(), \
+ cbForceEllipse = self.ui.cb_forceEllipse.isChecked(), \
+ nbAxeTubeP1 = self.ui.sb_nbAxeTubeP1.value(), \
+ nbAxeTubeP2 = self.ui.sb_nbAxeTubeP2.value(), \
+ nbAxeCoude = self.ui.sb_nbAxeCoude.value(), \
+ nbCirconf = self.ui.sb_nbCirconf.value(), \
+ nbEpaisseur = self.ui.sb_nbEpaisseur.value(), \
+ rayonTore = self.ui.dsb_rayonTore.value(), \
+ aretesFaceFissure = self.ui.dsb_aretesFaceFissure.value(), \
+ influence = self.ui.dsb_influence.value(), \
)
print(dico)
return dico
-
+
def checkValues(self):
return self.NOK
from blocFissure.gmu import geomsmesh
from blocFissure.gmu.casStandard import casStandard
from blocFissure.ihm.fissureCoude_ihm import fissureCoude_ihm
-
+
dico = self.creeDico()
NOK = self.testval(dico)
if not(NOK):
if dico['aretesFaceFissure'] == 0:
dico['aretesFaceFissure'] = (areteMinAngle + areteMinCirco)/2.0
print('aretesFaceFissure', dico['aretesFaceFissure'])
- if dico['rbPosiAngul'] == False:
+ if not dico['rbPosiAngul']:
rmoy = (dico['dext'] - dico['epais'])/2.0
eta = 1
- if dico['rbFissExt'] == False:
+ if not dico['rbFissExt']:
eta = -1
dico['posiAngul'] = (180.0/math.pi)*dico['absCurv']/(dico['rCintr']+(rmoy+eta*dico['epais']/2.0)*math.cos(math.pi*dico['azimut']/180.))
print('posiAngul' , dico['posiAngul'])
-
+
self.writeDefault(dico)
self.ui.lb_calcul.show()
probleme = fissureCoude_ihm(0)
probleme.executeProbleme()
self.NOK = NOK
self.accept()
-
- pass
# ----------------------------------------------------------------------------
-
+
window = fissureCoudeDialog()
# window.ui.dsb_tolerance.setValue(0.01)
retry = True
retry = window.checkValues()
else:
print("dialog rejected, exit")
- pass
-
+