<x>0</x>
<y>0</y>
<width>631</width>
- <height>490</height>
+ <height>560</height>
</rect>
</property>
<property name="windowTitle">
<property name="toolTip">
<string><html><head/><body><p>Insertion d'un maillage de fissure dans un maillage hexaédrique sain.</p><p>Le maillage sain est fourni sous forme de fichier Med.</p><p>La face de fissure est décrite par une géométrie dans un fichier brep.</p><p>La ou les arêtes de fond de fissure sont données par leurs index dans la face de fissure.</p><p>La procédure identfie des mailles saines à enlever et remailler, construit un maillage régulier rayonnant autour de la ligne de fond de fissure, reconstitue les faces externes en triangles, complète la zone à remailler en tétraèdres.</p></body></html></string>
</property>
- <layout class="QGridLayout" name="gridLayout_11">
- <item row="0" column="0" colspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>maillage sain et géometries de fissure</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QPushButton" name="pb_maillage">
- <property name="toolTip">
- <string><html><head/><body><p>sélection du fichier med du maillage sain (hexaèdres)</p></body></html></string>
- </property>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
<property name="text">
- <string>maillage sain</string>
+ <string>index edges fond fissure</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="le_fondfiss">
+ <property name="toolTip">
+ <string><html><head/><body><p>Index des edges décrivant le fond de fissure, dans la face de fissure.</p><p>Sous forme d'une liste Python.</p><p>Exemples :<span style=" color:#00ffff;"/><span style=" font-style:italic; color:#00ffff;">[5,9]</span> ou <span style=" font-style:italic; color:#00ffff;">[3]</span></p><p>(on peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)</p></body></html></string>
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="le_maillage">
<property name="toolTip">
</property>
</widget>
</item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>index edges fond fissure</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="le_fondfiss">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="pb_maillage">
<property name="toolTip">
- <string><html><head/><body><p>Index des edges décrivant le fond de fissure, dans la face de fissure.</p><p>Sous forme d'une liste Python.</p><p>Exemples :<span style=" color:#00ffff;"/><span style=" font-style:italic; color:#00ffff;">[5,9]</span> ou <span style=" font-style:italic; color:#00ffff;">[3]</span></p><p>(on peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)</p></body></html></string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <string><html><head/><body><p>sélection du fichier med du maillage sain (hexaèdres)</p></body></html></string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
+ <property name="text">
+ <string>maillage sain</string>
</property>
- </spacer>
+ </widget>
</item>
</layout>
</item>
<zorder></zorder>
</widget>
</item>
- <item row="1" column="0" colspan="2">
+ <item>
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="toolTip">
<string><html><head/><body><p>La zone remaillée contiendra toutes les mailles du maillage sain à une distance de la face de fissure inférieure à cette valeur.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
</widget>
</item>
</layout>
<property name="toolTip">
<string><html><head/><body><p>Pour faciliter la détermination de la zone à remailler, il faut des points sur la face de fissure, suffisament resserrés, en relation avec la taille des mailles du maillage sain.</p><p>Ces points sont obtenus par pré maillage de la face de fissure, en triangles. On donne la taille min et max des triangles.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="toolTip">
<string><html><head/><body><p>Pour faciliter la détermination de la zone à remailler, il faut des points sur la face de fissure, suffisament resserrés, en relation avec la taille des mailles du maillage sain.</p><p>Ces points sont obtenus par pré maillage de la face de fissure, en triangles. On donne la taille min et max des triangles.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="toolTip">
<string><html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>Rayon du pipe.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="toolTip">
<string><html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>Longueur des mailles le long de la ligne de fond de fissure.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="toolTip">
<string><html><head/><body><p>Faces externes de la zone à remailler.</p><p>Mailage en triangles : valeur cible des arêtes.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
</item>
</layout>
</item>
- <item row="2" column="1">
+ <item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
- <item row="3" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer_7">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="lb_calcul">
+ <property name="font">
+ <font>
+ <pointsize>24</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>--- Calcul en cours ---</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_8">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QPushButton" name="pb_reset">
+ <property name="toolTip">
+ <string>réinitialisation de tous les paramètres à leur valeur par défaut</string>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pb_valPrec">
+ <property name="toolTip">
+ <string>réinitialisation de tous les paramètres à leur valeur de la précédente éxécution</string>
+ </property>
+ <property name="text">
+ <string>Précédent</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pb_recharger">
+ <property name="toolTip">
+ <string>réinitialisation des paramètres à partir d'un fichier préalablement sauvegardé</string>
+ </property>
+ <property name="text">
+ <string>Recharger</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pb_sauver">
+ <property name="toolTip">
+ <string>sauvegarde des paramètres dans un fichier à choisir</string>
+ </property>
+ <property name="text">
+ <string>Sauver</string>
+ </property>
+ </widget>
+ </item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
--- /dev/null
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2006-2015 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# if you already have plugins defined in a salome_plugins.py file, add this file at the end.
+# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
+
+import sys, traceback
+import math
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.gmu import geomsmesh
+from blocFissure.gmu.casStandard import casStandard
+
+def fissureGeneraleDlg(context):
+ # get context study, studyId, salomeGui
+ study = context.study
+ studyId = context.studyId
+ sg = context.sg
+
+ import os
+ #import subprocess
+ #import tempfile
+ from PyQt4 import QtCore
+ from PyQt4 import QtGui
+ from PyQt4.QtGui import QFileDialog
+ from PyQt4.QtGui import QMessageBox
+ from PyQt4.QtGui import QPalette
+ from PyQt4.QtGui import QColor
+ from fissureGenerale_ui import Ui_Dialog
+
+ class fissureGeneraleDialog(QtGui.QDialog):
+
+ def __init__(self):
+ QtGui.QDialog.__init__(self)
+ # Set up the user interface from Designer.
+ self.ui = Ui_Dialog()
+ self.ui.setupUi(self)
+
+ self.blackPalette = self.ui.dsb_influence.palette()
+ self.redPalette = QPalette()
+ self.redPalette.setColor(QPalette.Text, QColor(255,0,0))
+ self.NOK = False
+
+ self.initDefaut()
+ self.initDialog(self.defaut)
+ self.ui.lb_calcul.hide()
+
+ # Connect up the buttons.
+ self.connect(self.ui.pb_valPrec, QtCore.SIGNAL("clicked()"),
+ self.readValPrec)
+ self.connect(self.ui.pb_reset, QtCore.SIGNAL("clicked()"),
+ self.resetVal)
+ self.connect(self.ui.pb_recharger, QtCore.SIGNAL("clicked()"),
+ self.recharger)
+ self.connect(self.ui.pb_sauver, QtCore.SIGNAL("clicked()"),
+ self.sauver)
+ self.connect(self.ui.pb_maillage, QtCore.SIGNAL("clicked()"),
+ self.selectMaillage)
+ self.connect(self.ui.pb_facefiss, QtCore.SIGNAL("clicked()"),
+ self.selectFacefiss)
+ self.disconnect(self.ui.bb_OkCancel, QtCore.SIGNAL("accepted()"), self.accept)
+ self.connect(self.ui.bb_OkCancel, QtCore.SIGNAL("accepted()"),
+ self.execute)
+
+ def initDefaut(self):
+ self.defaut = dict(
+ nomCas = 'angleCube',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"),
+ edgeFissIds = [4],
+ lgInfluence = 20,
+ meshBrep = (5,10),
+ rayonPipe = 5,
+ lenSegPipe = 2.5,
+ nbSegRad = 5,
+ nbSegCercle = 32,
+ areteFaceFissure = 10)
+
+
+ def initDialog(self, dico):
+ self.ui.le_maillage.setText(dico['maillageSain'])
+ self.ui.le_facefiss.setText(dico['brepFaceFissure'])
+ self.ui.le_fondfiss.setText(str(dico['edgeFissIds']))
+ self.ui.dsb_influence.setValue(dico['lgInfluence'])
+ self.ui.dsb_meshBrepMin.setValue(dico['meshBrep'][0])
+ self.ui.dsb_meshBrepMax.setValue(dico['meshBrep'][1])
+ self.ui.dsb_rayonPipe.setValue(dico['rayonPipe'])
+ self.ui.dsb_lenSegPipe.setValue(dico['lenSegPipe'])
+ self.ui.sb_couronnes.setValue(dico['nbSegRad'])
+ self.ui.sb_secteurs.setValue(dico['nbSegCercle'])
+ self.ui.dsb_areteFaceFissure.setValue(dico['areteFaceFissure'])
+ incomplet = self.testval(dico)
+ pass
+
+ def testval(self, dico):
+ incomplet = False
+ if not os.path.lexists(dico['maillageSain']):
+ self.ui.le_maillage.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.le_maillage.setPalette(self.blackPalette)
+ if not os.path.lexists(dico['brepFaceFissure']):
+ self.ui.le_facefiss.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.le_facefiss.setPalette(self.blackPalette)
+ edgeFissIdsOK=True
+ try:
+ l = dico['edgeFissIds']
+ for i in l:
+ if not isinstance(i, int):
+ print"not isinstance(i, int)"
+ incomplet = True
+ edgeFissIdsOK=False
+ break
+ except:
+ print "except eval"
+ incomplet = True
+ edgeFissIdsOK=False
+ if edgeFissIdsOK:
+ self.ui.le_fondfiss.setPalette(self.blackPalette)
+ else:
+ self.ui.le_fondfiss.setPalette(self.redPalette)
+ if dico['meshBrep'][0] == 0:
+ self.ui.dsb_meshBrepMin.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_meshBrepMin.setPalette(self.blackPalette)
+ if dico['meshBrep'][1] == 0:
+ self.ui.dsb_meshBrepMax.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_meshBrepMax.setPalette(self.blackPalette)
+ if dico['rayonPipe'] == 0:
+ self.ui.dsb_rayonPipe.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_rayonPipe.setPalette(self.blackPalette)
+ if dico['lenSegPipe'] == 0:
+ self.ui.dsb_lenSegPipe.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_lenSegPipe.setPalette(self.blackPalette)
+ if dico['areteFaceFissure'] == 0:
+ self.ui.dsb_areteFaceFissure.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_areteFaceFissure.setPalette(self.blackPalette)
+
+ print "incomplet: ", incomplet
+ return incomplet
+
+ def fileDefault(self):
+ filedef = os.path.expanduser("~/.config/salome/dialogFissureGenerale.dic")
+ print filedef
+ return filedef
+
+ def writeDefault(self, dico):
+ filedef = self.fileDefault()
+ f = open(filedef, 'w')
+ f.write(str(dico))
+ f.close()
+
+ def readValPrec(self):
+ filedef = self.fileDefault()
+ if os.path.exists(filedef):
+ f = open(filedef, 'r')
+ 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)
+ fileDiag.setFileMode(QFileDialog.AnyFile)
+ fileDiag.setNameFilter("Parametres *.dic (*.dic)")
+ fileDiag.setViewMode(QFileDialog.List)
+ if fileDiag.exec_() :
+ fileNames = fileDiag.selectedFiles()
+ filedef = fileNames[0]
+ dico = self.creeDico()
+ f = open(filedef, 'w')
+ f.write(str(dico))
+ f.close()
+
+ def recharger(self):
+ print "recharger"
+ fileDiag = QFileDialog(self)
+ fileDiag.setFileMode(QFileDialog.ExistingFile)
+ fileDiag.setNameFilter("Parametres *.dic (*.dic)")
+ fileDiag.setViewMode(QFileDialog.Detail)
+ if fileDiag.exec_() :
+ fileNames = fileDiag.selectedFiles()
+ filedef = fileNames[0]
+ print filedef
+ if os.path.exists(filedef):
+ f = open(filedef, 'r')
+ txt = f.read()
+ dico = eval(txt)
+ print dico
+ self.initDialog(dico)
+
+ def selectMaillage(self):
+ fileDiag = QFileDialog(self)
+ fileDiag.setFileMode(QFileDialog.ExistingFile)
+ fileDiag.setNameFilter("Maillage *.med (*.med)")
+ fileDiag.setViewMode(QFileDialog.Detail)
+ if fileDiag.exec_() :
+ fileNames = fileDiag.selectedFiles()
+ filedef = fileNames[0]
+ print filedef
+ self.ui.le_maillage.setText(filedef)
+
+ def selectFacefiss(self):
+ fileDiag = QFileDialog(self)
+ fileDiag.setFileMode(QFileDialog.ExistingFile)
+ fileDiag.setNameFilter("Face fissure *.brep (*.brep)")
+ fileDiag.setViewMode(QFileDialog.Detail)
+ if fileDiag.exec_() :
+ fileNames = fileDiag.selectedFiles()
+ filedef = fileNames[0]
+ print filedef
+ self.ui.le_facefiss.setText(filedef)
+
+ def creeDico(self):
+ dico = dict(
+ maillageSain = str(self.ui.le_maillage.text()),
+ brepFaceFissure = str(self.ui.le_facefiss.text()),
+ edgeFissIds = eval(str(self.ui.le_fondfiss.text())),
+ lgInfluence = self.ui.dsb_influence.value(),
+ meshBrep = [self.ui.dsb_meshBrepMin.value(),self.ui.dsb_meshBrepMax.value()],
+ rayonPipe = self.ui.dsb_rayonPipe.value(),
+ lenSegPipe = self.ui.dsb_lenSegPipe.value(),
+ nbSegRad = self.ui.sb_couronnes.value(),
+ nbSegCercle = self.ui.sb_secteurs.value(),
+ areteFaceFissure = self.ui.dsb_areteFaceFissure.value()
+ )
+ print dico
+ return dico
+
+ def checkValues(self):
+ return self.NOK
+
+ def execute(self):
+ dico = self.creeDico()
+ NOK = self.testval(dico)
+ if not(NOK):
+ self.writeDefault(dico)
+ self.ui.lb_calcul.show()
+ execInstance = casStandard(dico)
+ self.NOK = NOK
+ self.accept()
+
+ pass
+
+# ----------------------------------------------------------------------------
+
+ window = fissureGeneraleDialog()
+ retry = True
+ while(retry):
+ retry = False
+ window.exec_()
+ result = window.result()
+ if result:
+ # dialog accepted
+ print "dialog accepted, check"
+ retry = window.checkValues()
+ else:
+ print "dialog rejected, exit"
+ pass
+