mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-29 10:50:34 +05:00
more
This commit is contained in:
parent
60edc5d627
commit
293e0ad505
@ -98,9 +98,9 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
|||||||
self.connect(self.CB_ComputedToleranceDisplacement,SIGNAL("stateChanged(int)"),self.SP_ToleranceDisplacement.setDisabled)
|
self.connect(self.CB_ComputedToleranceDisplacement,SIGNAL("stateChanged(int)"),self.SP_ToleranceDisplacement.setDisabled)
|
||||||
self.connect(self.CB_ComputedResolutionLength,SIGNAL("stateChanged(int)"),self.SP_ResolutionLength.setDisabled)
|
self.connect(self.CB_ComputedResolutionLength,SIGNAL("stateChanged(int)"),self.SP_ResolutionLength.setDisabled)
|
||||||
self.connect(self.CB_ComputedOverlapDistance,SIGNAL("stateChanged(int)"),self.SP_OverlapDistance.setDisabled)
|
self.connect(self.CB_ComputedOverlapDistance,SIGNAL("stateChanged(int)"),self.SP_OverlapDistance.setDisabled)
|
||||||
|
|
||||||
def PBHelpPressed(self):
|
def PBHelpPressed(self):
|
||||||
try :
|
try:
|
||||||
mydir=os.environ["SMESH_ROOT_DIR"]
|
mydir=os.environ["SMESH_ROOT_DIR"]
|
||||||
except Exception:
|
except Exception:
|
||||||
QMessageBox.warning( self, "Help unavailable $SMESH_ROOT_DIR not found")
|
QMessageBox.warning( self, "Help unavailable $SMESH_ROOT_DIR not found")
|
||||||
@ -159,7 +159,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
|||||||
def PBSavePressed(self):
|
def PBSavePressed(self):
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
if not(self.PrepareLigneCommande()): return
|
if not(self.PrepareLigneCommande()): return
|
||||||
text = "# MGCleaner hypothesis parameters\n"
|
text = "# MGCleaner hypothesis parameters\n"
|
||||||
text += "# Params for mesh : " + self.LE_MeshSmesh.text() +"\n"
|
text += "# Params for mesh : " + self.LE_MeshSmesh.text() +"\n"
|
||||||
text += datetime.now().strftime("# Date : %d/%m/%y %H:%M:%S\n")
|
text += datetime.now().strftime("# Date : %d/%m/%y %H:%M:%S\n")
|
||||||
text += "# Command : "+self.commande+"\n"
|
text += "# Command : "+self.commande+"\n"
|
||||||
@ -202,6 +202,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
|||||||
hypoName = "HypoMGC_"+str(self.num)
|
hypoName = "HypoMGC_"+str(self.num)
|
||||||
aNameAttrib.SetValue(hypoName)
|
aNameAttrib.SetValue(hypoName)
|
||||||
aCommentAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeComment")
|
aCommentAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeComment")
|
||||||
|
#print "getResumeData",type(self.getResumeData(separator=" ; ")),self.getResumeData(separator=" ; ")
|
||||||
aCommentAttrib.SetValue(self.getResumeData(separator=" ; "))
|
aCommentAttrib.SetValue(self.getResumeData(separator=" ; "))
|
||||||
|
|
||||||
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
|
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
|
||||||
@ -217,21 +218,21 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
|||||||
CheckOrFix="fix2pass"
|
CheckOrFix="fix2pass"
|
||||||
else:
|
else:
|
||||||
CheckOrFix="check"
|
CheckOrFix="check"
|
||||||
text+="CheckOrFix=" + CheckOrFix+separator
|
text+="CheckOrFix="+CheckOrFix+separator
|
||||||
text+="PreserveTopology=" + str(self.CB_PreserveTopology.isChecked())+separator
|
text+="PreserveTopology="+str(self.CB_PreserveTopology.isChecked())+separator
|
||||||
text+="FillHoles=" + str(self.CB_FillHoles.isChecked())+separator
|
text+="FillHoles="+str(self.CB_FillHoles.isChecked())+separator
|
||||||
text+="MinHoleSize=" + str(self.SP_MinHoleSize.value())+separator
|
text+="MinHoleSize="+str(self.SP_MinHoleSize.value())+separator
|
||||||
text+="ComputedToleranceDisplacement=" + str(self.CB_ComputedToleranceDisplacement.isChecked())+separator
|
text+="ComputedToleranceDisplacement="+str(self.CB_ComputedToleranceDisplacement.isChecked())+separator
|
||||||
text+="ToleranceDisplacement=" + str(self.SP_ToleranceDisplacement.value())+separator
|
text+="ToleranceDisplacement="+str(self.SP_ToleranceDisplacement.value())+separator
|
||||||
text+="ComputedResolutionLength=" + str(self.CB_ComputedResolutionLength.isChecked())+separator
|
text+="ComputedResolutionLength="+str(self.CB_ComputedResolutionLength.isChecked())+separator
|
||||||
text+="ResolutionLength=" + str(self.SP_ResolutionLength.value())+separator
|
text+="ResolutionLength="+str(self.SP_ResolutionLength.value())+separator
|
||||||
text+="FoldingAngle=" + str(self.SP_FoldingAngle.value())+separator
|
text+="FoldingAngle="+str(self.SP_FoldingAngle.value())+separator
|
||||||
text+="RemeshPlanes=" + str(self.CB_RemeshPlanes.isChecked())+separator
|
text+="RemeshPlanes="+str(self.CB_RemeshPlanes.isChecked())+separator
|
||||||
text+="ComputedOverlapDistance=" + str(self.CB_ComputedOverlapDistance.isChecked())+separator
|
text+="ComputedOverlapDistance="+str(self.CB_ComputedOverlapDistance.isChecked())+separator
|
||||||
text+="OverlapDistance=" + str(self.SP_OverlapDistance.value())+separator
|
text+="OverlapDistance="+str(self.SP_OverlapDistance.value())+separator
|
||||||
text+="OverlapAngle=" + str(self.SP_OverlapAngle.value())+separator
|
text+="OverlapAngle="+str(self.SP_OverlapAngle.value())+separator
|
||||||
text+="Verbosity=" + str(self.SP_Verbosity.value())+separator
|
text+="Verbosity="+str(self.SP_Verbosity.value())+separator
|
||||||
return text
|
return str(text)
|
||||||
|
|
||||||
def loadResumeData(self, hypothesis, separator="\n"):
|
def loadResumeData(self, hypothesis, separator="\n"):
|
||||||
text=str(hypothesis)
|
text=str(hypothesis)
|
||||||
@ -409,7 +410,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
|||||||
#self.commande="mg-cleaner.exe --in " + self.fichierIn + " --out " + self.fichierOut + " --fix2pass"
|
#self.commande="mg-cleaner.exe --in " + self.fichierIn + " --out " + self.fichierOut + " --fix2pass"
|
||||||
#return True
|
#return True
|
||||||
#print "PrepareLigneCommande '"+self.fichierIn+"' '"+self.MeshIn+"'",self.__selectedMesh
|
#print "PrepareLigneCommande '"+self.fichierIn+"' '"+self.MeshIn+"'",self.__selectedMesh
|
||||||
if self.fichierIn=="" and self.MeshIn=="" :
|
if self.fichierIn=="" and self.MeshIn=="":
|
||||||
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
||||||
return False
|
return False
|
||||||
if self.__selectedMesh!=None: self.prepareFichier()
|
if self.__selectedMesh!=None: self.prepareFichier()
|
||||||
|
@ -188,7 +188,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Optimisation</string>
|
<string>Options</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<layout class="QHBoxLayout" name="RBLayoutopt">
|
<layout class="QHBoxLayout" name="RBLayoutopt">
|
||||||
|
@ -190,15 +190,27 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Optimisation</string>
|
<string>Optimisation</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QGroupBox" name="mesRB">
|
|
||||||
<property name="geometry">
|
<layout class="QHBoxLayout" name="RBLayoutopt">
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
<item>
|
||||||
<y>30</y>
|
<spacer name="horizontalSpacer_xx">
|
||||||
<width>611</width>
|
<property name="orientation">
|
||||||
<height>209</height>
|
<enum>Qt::Horizontal</enum>
|
||||||
</rect>
|
</property>
|
||||||
</property>
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
<layout class="QVBoxLayout" name="monRBLayout">
|
<layout class="QVBoxLayout" name="monRBLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="RB_0">
|
<widget class="QRadioButton" name="RB_0">
|
||||||
@ -324,8 +336,13 @@ good quality elements</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layout>
|
||||||
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QGroupBox" name="GBUnit">
|
<widget class="QGroupBox" name="GBUnit">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@ -567,7 +584,7 @@ If the Units parameter is absolute, the tolerance parameter is expressed in mode
|
|||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>If not set (ridge detection disabled), Yams will not try to detect any new ridge edge by its own mechanism :
|
<string>If not set (ridge detection disabled), Yams will not try to detect any new ridge edge by its own mechanism :
|
||||||
it will consider as ridge only the ridges given in the mesh.
|
it will consider as ridge only the ridges given in the mesh.
|
||||||
All non-ridge edges that would have been detected as ridge by the Ridge angle paramaeter
|
All non-ridge edges that would have been detected as ridge by the ridge angle parameter
|
||||||
(see below) will be considered as part of the same continuous patch.
|
(see below) will be considered as part of the same continuous patch.
|
||||||
This option should not be checked when all the known ridges of the mesh are given and
|
This option should not be checked when all the known ridges of the mesh are given and
|
||||||
when all other possible ridges are not geometric ridges to take into account.</string>
|
when all other possible ridges are not geometric ridges to take into account.</string>
|
||||||
@ -631,7 +648,7 @@ New created vertices are saved in the .mesh file under keyword section 'Vertices
|
|||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>140</y>
|
<y>140</y>
|
||||||
<width>750</width>
|
<width>750</width>
|
||||||
<height>280</height>
|
<height>270</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -915,21 +932,6 @@ Default is 3.</string>
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>The program requires roughly about 370 bytes per point. It is thus possible to estimate a priori
|
|
||||||
the required memory size to complete a job. As an example of memory space needed, a mesh
|
|
||||||
of 543,652 points (1,087,716 triangles) requires 182 Mbytes (about 351 bytes per point). Conversely,
|
|
||||||
a workstation having 512 Mbytes of memory can handle a mesh of about 2,750,000 points.
|
|
||||||
The memory needed for mesh modification is allocated dynamically at the beginning of the procedure
|
|
||||||
(data reading), based on the initial triangulation size. When the program reaches the amount of maximal
|
|
||||||
memory allowed, it will stop inserting points and, if possible, the current mesh will be saved as it is,
|
|
||||||
valid and conformal, provided the input mesh was valid and conformal.
|
|
||||||
Specify the memory if:
|
|
||||||
- the automatically allocated memory reveals insufficient when the user asked to enrich the given mesh.
|
|
||||||
- you want to limit the amount of memory used by the program.
|
|
||||||
If the input mesh size requires more memory than requested or if the allocated memory (user defined or not)
|
|
||||||
exceeds the machine capabilities, the tool will stop because of insufficient memory.</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100000</number>
|
<number>100000</number>
|
||||||
</property>
|
</property>
|
||||||
@ -946,18 +948,25 @@ exceeds the machine capabilities, the tool will stop because of insufficient mem
|
|||||||
<width>600</width>
|
<width>600</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<rect>
|
|
||||||
<x>130</x>
|
|
||||||
<y>700</y>
|
|
||||||
<width>600</width>
|
|
||||||
<height>30</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Memory size (in Mbytes)</string>
|
<string>Memory size (in Mbytes)</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The program requires roughly about 370 bytes per point. It is thus possible to estimate a priori
|
||||||
|
the required memory size to complete a job. As an example of memory space needed, a mesh
|
||||||
|
of 543,652 points (1,087,716 triangles) requires 182 Mbytes (about 351 bytes per point). Conversely,
|
||||||
|
a workstation having 512 Mbytes of memory can handle a mesh of about 2,750,000 points.
|
||||||
|
The memory needed for mesh modification is allocated dynamically at the beginning of the procedure
|
||||||
|
(data reading), based on the initial triangulation size. When the program reaches the amount of maximal
|
||||||
|
memory allowed, it will stop inserting points and, if possible, the current mesh will be saved as it is,
|
||||||
|
valid and conformal, provided the input mesh was valid and conformal.
|
||||||
|
Specify the memory if:
|
||||||
|
- the automatically allocated memory reveals insufficient when the user asked to enrich the given mesh.
|
||||||
|
- you want to limit the amount of memory used by the program.
|
||||||
|
If the input mesh size requires more memory than requested or if the allocated memory (user defined or not)
|
||||||
|
exceeds the machine capabilities, the tool will stop because of insufficient memory.</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -32,290 +32,417 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QWidget.__init__(self)
|
QWidget.__init__(self)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.connecterSignaux()
|
self.connecterSignaux()
|
||||||
self.fichierIn=""
|
self.fichierIn=""
|
||||||
self.fichierOut=""
|
self.fichierOut=""
|
||||||
self.MeshIn=""
|
self.MeshIn=""
|
||||||
self.num=1
|
self.commande=""
|
||||||
|
self.num=1
|
||||||
|
self.__selectedMesh=None
|
||||||
|
|
||||||
# complex whith QResources: not used
|
# complex whith QResources: not used
|
||||||
# The icon are supposed to be located in the $SMESH_ROOT_DIR/share/salome/resources/smesh folder,
|
# The icon are supposed to be located in the $SMESH_ROOT_DIR/share/salome/resources/smesh folder,
|
||||||
# other solution could be in the same folder than this python module file:
|
# other solution could be in the same folder than this python module file:
|
||||||
# iconfolder=os.path.dirname(os.path.abspath(__file__))
|
# iconfolder=os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
iconfolder=os.environ['SMESH_ROOT_DIR']+'/share/salome/resources/smesh'
|
self.iconfolder=os.environ["SMESH_ROOT_DIR"]+"/share/salome/resources/smesh"
|
||||||
#print "monYamsPlugDialog iconfolder",iconfolder
|
#print "monYamsPlugDialog iconfolder",iconfolder
|
||||||
icon = QIcon()
|
icon = QIcon()
|
||||||
icon.addFile(os.path.join(iconfolder,"select1.png"))
|
icon.addFile(os.path.join(self.iconfolder,"select1.png"))
|
||||||
self.PB_MeshSmesh.setIcon(icon)
|
self.PB_LoadHyp.setIcon(icon)
|
||||||
icon = QIcon()
|
self.PB_LoadHyp.setToolTip("hypothesis from Salome Object Browser")
|
||||||
icon.addFile(os.path.join(iconfolder,"open.png"))
|
self.PB_SaveHyp.setIcon(icon)
|
||||||
self.PB_ParamsFileExplorer.setIcon(icon)
|
self.PB_SaveHyp.setToolTip("hypothesis to Salome Object Browser")
|
||||||
|
self.PB_MeshSmesh.setIcon(icon)
|
||||||
|
self.PB_MeshSmesh.setToolTip("source mesh from Salome Object Browser")
|
||||||
|
icon = QIcon()
|
||||||
|
icon.addFile(os.path.join(self.iconfolder,"open.png"))
|
||||||
|
self.PB_ParamsFileExplorer.setIcon(icon)
|
||||||
|
self.PB_Load.setIcon(icon)
|
||||||
|
self.PB_Load.setToolTip("hypothesis from file")
|
||||||
|
self.PB_Save.setIcon(icon)
|
||||||
|
self.PB_Save.setToolTip("hypothesis to file")
|
||||||
|
self.PB_MeshFile.setIcon(icon)
|
||||||
|
self.PB_MeshFile.setToolTip("source mesh from a file in disk")
|
||||||
|
|
||||||
#Ces parametres ne sont pas remis à rien par le clean
|
#Ces parametres ne sont pas remis à rien par le clean
|
||||||
self.paramsFile= os.path.abspath(os.path.join(os.environ['HOME'],'.yams.dat'))
|
self.paramsFile= os.path.abspath(os.path.join(os.environ["HOME"],".yams.dat"))
|
||||||
self.LE_ParamsFile.setText(self.paramsFile)
|
self.LE_ParamsFile.setText(self.paramsFile)
|
||||||
self.LE_MeshFile.setText("")
|
self.LE_MeshFile.setText("")
|
||||||
self.LE_MeshSmesh.setText("")
|
self.LE_MeshSmesh.setText("")
|
||||||
|
self.resize(800, 600)
|
||||||
|
self.clean()
|
||||||
|
|
||||||
def connecterSignaux(self) :
|
def connecterSignaux(self) :
|
||||||
self.connect(self.PB_Cancel,SIGNAL("clicked()"),self.PBCancelPressed)
|
self.connect(self.PB_Cancel,SIGNAL("clicked()"),self.PBCancelPressed)
|
||||||
self.connect(self.PB_Default,SIGNAL("clicked()"),self.clean)
|
self.connect(self.PB_Default,SIGNAL("clicked()"),self.clean)
|
||||||
self.connect(self.PB_Help,SIGNAL("clicked()"),self.PBHelpPressed)
|
self.connect(self.PB_Help,SIGNAL("clicked()"),self.PBHelpPressed)
|
||||||
self.connect(self.PB_Load,SIGNAL("clicked()"),self.PBLoadPressed)
|
self.connect(self.PB_OK,SIGNAL("clicked()"),self.PBOKPressed)
|
||||||
self.connect(self.PB_OK,SIGNAL("clicked()"),self.PBOKPressed)
|
|
||||||
self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed)
|
self.connect(self.PB_Load,SIGNAL("clicked()"),self.PBLoadPressed)
|
||||||
self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed)
|
self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed)
|
||||||
self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed)
|
self.connect(self.PB_LoadHyp,SIGNAL("clicked()"),self.PBLoadHypPressed)
|
||||||
self.connect(self.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName)
|
self.connect(self.PB_SaveHyp,SIGNAL("clicked()"),self.PBSaveHypPressed)
|
||||||
self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged)
|
|
||||||
self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged)
|
self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed)
|
||||||
|
self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed)
|
||||||
|
self.connect(self.LE_MeshSmesh,SIGNAL("returnPressed()"),self.meshSmeshNameChanged)
|
||||||
|
self.connect(self.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName)
|
||||||
|
self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged)
|
||||||
|
self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged)
|
||||||
|
|
||||||
def PBHelpPressed(self):
|
def PBHelpPressed(self):
|
||||||
try :
|
try :
|
||||||
mydir=os.environ['SMESH_ROOT_DIR']
|
mydir=os.environ["SMESH_ROOT_DIR"]
|
||||||
except Exception:
|
except Exception:
|
||||||
QMessageBox.warning( self, "Help unavailable $SMESH_ROOT_DIR not found")
|
QMessageBox.warning( self, "Help unavailable $SMESH_ROOT_DIR not found")
|
||||||
maDoc=mydir+"/share/doc/salome/gui/SMESH/yams/_downloads/YamsWhitePaper_3.2.pdf"
|
maDoc=mydir+"/share/doc/salome/gui/SMESH/yams/_downloads/YamsWhitePaper_3.2.pdf"
|
||||||
command="xdg-open "+maDoc+";"
|
command="xdg-open "+maDoc+";"
|
||||||
subprocess.call(command, shell=True)
|
subprocess.call(command, shell=True)
|
||||||
|
|
||||||
|
|
||||||
def PBOKPressed(self):
|
def PBOKPressed(self):
|
||||||
if not(self.PrepareLigneCommande()) : return
|
if not(self.PrepareLigneCommande()) : return
|
||||||
self.PBSavePressed(NomHypo=True)
|
maFenetre=MonViewText(self,self.commande)
|
||||||
maFenetre=MonViewText(self,self.commande)
|
if os.path.isfile(self.fichierOut): self.enregistreResultat()
|
||||||
if os.path.isfile(self.fichierOut) :self.enregistreResultat()
|
|
||||||
|
|
||||||
def enregistreResultat(self):
|
def enregistreResultat(self):
|
||||||
import smesh
|
import smesh
|
||||||
import SMESH
|
import SMESH
|
||||||
import salome
|
import salome
|
||||||
from salome.kernel import studyedit
|
from salome.kernel import studyedit
|
||||||
|
|
||||||
maStudy=studyedit.getActiveStudy()
|
#print "enregistreResultat"
|
||||||
smesh.SetCurrentStudy(maStudy)
|
maStudy=studyedit.getActiveStudy()
|
||||||
(outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
|
smesh.SetCurrentStudy(maStudy)
|
||||||
meshname = 'yams'+str(self.num)
|
(outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
|
||||||
smesh.SetName(outputMesh.GetMesh(), meshname)
|
name=str(self.LE_MeshSmesh.text())
|
||||||
outputMesh.Compute()
|
if name=="":
|
||||||
|
#print "name new MESH",self.LE_MeshFile.text()
|
||||||
|
a=str(self.fichierIn)
|
||||||
|
name=os.path.basename(os.path.splitext(a)[0])
|
||||||
|
|
||||||
|
meshname = name+"_YAMS_"+str(self.num)
|
||||||
|
smesh.SetName(outputMesh.GetMesh(), meshname)
|
||||||
|
outputMesh.Compute() #no algorithms message for "Mesh_x" has been computed with warnings: - global 1D algorithm is missing
|
||||||
|
|
||||||
self.editor = studyedit.getStudyEditor() #
|
self.editor = studyedit.getStudyEditor() #
|
||||||
moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
|
moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
|
||||||
HypReMeshEntry = self.editor.findOrCreateItem( moduleEntry, name = 'HypoForRemesh',
|
HypReMeshEntry = self.editor.findOrCreateItem(
|
||||||
comment = 'HypoForRemeshing')
|
moduleEntry, name = "YAMS Hypotheses", icon="mesh_tree_algo.png") #, comment = "HypoForRemeshing" )
|
||||||
monStudyBuilder=maStudy.NewBuilder();
|
|
||||||
monStudyBuilder.NewCommand();
|
monStudyBuilder=maStudy.NewBuilder();
|
||||||
newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
|
monStudyBuilder.NewCommand();
|
||||||
aNameAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeName")
|
newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
|
||||||
hypoName = 'anHypo_Yams_'+str(self.num)
|
aNameAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeName")
|
||||||
aNameAttrib.SetValue(hypoName)
|
hypoName = "HypoYams_"+str(self.num)
|
||||||
aCommentAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeComment")
|
aNameAttrib.SetValue(hypoName)
|
||||||
aCommentAttrib.SetValue(str(self.commande))
|
aCommentAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeComment")
|
||||||
|
aCommentAttrib.SetValue(self.getResumeData(separator=" ; "))
|
||||||
SOMesh=maStudy.FindObjectByName(meshname ,"SMESH")[0]
|
|
||||||
newLink=monStudyBuilder.NewObject(SOMesh)
|
SOMesh=maStudy.FindObjectByName(meshname ,"SMESH")[0]
|
||||||
monStudyBuilder.Addreference(newLink, newStudyIter);
|
newLink=monStudyBuilder.NewObject(SOMesh)
|
||||||
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
|
monStudyBuilder.Addreference(newLink, newStudyIter)
|
||||||
self.num+=1
|
|
||||||
return True
|
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
|
||||||
|
self.num+=1
|
||||||
|
return True
|
||||||
|
|
||||||
def PBSavePressed(self,NomHypo=False):
|
def PBSavePressed(self,NomHypo=False):
|
||||||
if NomHypo : text = '# Params for Hypothese : anHypo_Yams_'+str(self.num - 1)+"\n"
|
from datetime import datetime
|
||||||
else : text = '# Save intermediate params \n'
|
if not(self.PrepareLigneCommande()): return
|
||||||
text += "# Params for mesh : " + self.LE_MeshSmesh.text() +'\n'
|
text = "# YAMS hypothesis parameters\n"
|
||||||
for RB in self.GBOptim.findChildren(QRadioButton,):
|
text += "# Params for mesh : " + self.LE_MeshSmesh.text() +"\n"
|
||||||
if RB.isChecked()==True:
|
text += datetime.now().strftime("# Date : %d/%m/%y %H:%M:%S\n")
|
||||||
text+="Optimisation ='"+RB.text()+"'\n"
|
text += "# Command : "+self.commande+"\n"
|
||||||
break
|
text += self.getResumeData(separator="\n")
|
||||||
for RB in self.GBUnit.findChildren(QRadioButton,):
|
text += "\n\n"
|
||||||
if RB.isChecked()==True:
|
|
||||||
text+="Units ='"+RB.text()+"'\n"
|
|
||||||
text+='Chordal_Tolerance_Deviation='+str(self.SP_Tolerance.value())+'\n'
|
|
||||||
|
|
||||||
text+='Ridge_Detection=' + str(self.CB_Ridge.isChecked())+'\n'
|
try:
|
||||||
text+='Split_Edge=' + str(self.CB_SplitEdge.isChecked())+'\n'
|
f=open(self.paramsFile,"a")
|
||||||
text+='Point_Smoothing=' + str(self.CB_Point.isChecked())+'\n'
|
except:
|
||||||
text+='Geometrical_Approximation='+ str(self.SP_Geomapp.value()) +'\n'
|
QMessageBox.warning(self, "File", "Unable to open "+self.paramsFile)
|
||||||
text+='Ridge_Angle=' + str(self.SP_Ridge.value()) +'\n'
|
return
|
||||||
text+='Maximum_Size=' + str(self.SP_MaxSize.value()) +'\n'
|
try:
|
||||||
text+='Minimum_Size=' + str(self.SP_MaxSize.value()) +'\n'
|
f.write(text)
|
||||||
text+='Mesh_Gradation=' + str(self.SP_Gradation.value())+'\n'
|
except:
|
||||||
|
QMessageBox.warning(self, "File", "Unable to write "+self.paramsFile)
|
||||||
|
return
|
||||||
|
f.close()
|
||||||
|
|
||||||
text+='Verbosity=' + str(self.SP_Verbosity.value())+'\n'
|
def PBSaveHypPressed(self):
|
||||||
text+='Memory=' + str(self.SP_Memory.value())+'\n'
|
"""save hypothesis in Object Browser"""
|
||||||
text+='\n\n'
|
#QMessageBox.warning(self, "save Object Browser YAMS Hypothesis", "TODO")
|
||||||
|
|
||||||
|
import smesh
|
||||||
|
import SMESH
|
||||||
|
import salome
|
||||||
|
from salome.kernel import studyedit
|
||||||
|
|
||||||
try :
|
maStudy=studyedit.getActiveStudy()
|
||||||
f=open(self.paramsFile,'a')
|
smesh.SetCurrentStudy(maStudy)
|
||||||
except :
|
|
||||||
QMessageBox.warning( self, "File", "Unable to open "+self.paramsFile)
|
self.editor = studyedit.getStudyEditor()
|
||||||
return
|
moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
|
||||||
try :
|
HypReMeshEntry = self.editor.findOrCreateItem(
|
||||||
f.write(text)
|
moduleEntry, name = "YAMS Hypotheses", icon="mesh_tree_algo.png") #, comment = "HypoForRemeshing" )
|
||||||
except :
|
|
||||||
QMessageBox.warning( self, "File", "Unable to write "+self.paramsFile)
|
monStudyBuilder=maStudy.NewBuilder()
|
||||||
return
|
monStudyBuilder.NewCommand()
|
||||||
f.close()
|
newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
|
||||||
|
aNameAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeName")
|
||||||
|
hypoName = "HypoYams_"+str(self.num)
|
||||||
|
aNameAttrib.SetValue(hypoName)
|
||||||
|
aCommentAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeComment")
|
||||||
|
#print "getResumeData",type(self.getResumeData(separator=" ; ")),self.getResumeData(separator=" ; ")
|
||||||
|
aCommentAttrib.SetValue(self.getResumeData(separator=" ; "))
|
||||||
|
|
||||||
|
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
|
||||||
|
self.num+=1
|
||||||
|
return True
|
||||||
|
|
||||||
|
def getResumeData(self, separator="\n"):
|
||||||
|
text=""
|
||||||
|
for RB in self.GBOptim.findChildren(QRadioButton,):
|
||||||
|
if RB.isChecked()==True:
|
||||||
|
text+="Optimisation="+RB.text()+separator
|
||||||
|
break
|
||||||
|
for RB in self.GBUnit.findChildren(QRadioButton,):
|
||||||
|
if RB.isChecked()==True:
|
||||||
|
text+="Units="+RB.text()+separator
|
||||||
|
text+="ChordalToleranceDeviation="+str(self.SP_Tolerance.value())+separator
|
||||||
|
text+="RidgeDetection="+str(self.CB_Ridge.isChecked())+separator
|
||||||
|
text+="SplitEdge="+str(self.CB_SplitEdge.isChecked())+separator
|
||||||
|
text+="PointSmoothing="+str(self.CB_Point.isChecked())+separator
|
||||||
|
text+="GeometricalApproximation="+str(self.SP_Geomapp.value())+separator
|
||||||
|
text+="RidgeAngle="+str(self.SP_Ridge.value())+separator
|
||||||
|
text+="MaximumSize="+str(self.SP_MaxSize.value())+separator
|
||||||
|
text+="MinimumSize="+str(self.SP_MinSize.value())+separator
|
||||||
|
text+="MeshGradation="+str(self.SP_Gradation.value())+separator
|
||||||
|
text+="Verbosity="+str(self.SP_Verbosity.value())+separator
|
||||||
|
text+="Memory="+str(self.SP_Memory.value())+separator
|
||||||
|
return str(text)
|
||||||
|
|
||||||
|
def loadResumeData(self, hypothesis, separator="\n"):
|
||||||
|
text=str(hypothesis)
|
||||||
|
self.clean()
|
||||||
|
for slig in reversed(text.split(separator)):
|
||||||
|
lig=slig.strip()
|
||||||
|
#print "load ResumeData",lig
|
||||||
|
if lig=="": continue #skip blanck lines
|
||||||
|
if lig[0]=="#": break
|
||||||
|
try:
|
||||||
|
tit,value=lig.split("=")
|
||||||
|
if tit=="Optimisation":
|
||||||
|
for RB in self.GBUnit.findChildren(QRadioButton,):
|
||||||
|
RB.setChecked(False)
|
||||||
|
for RB in self.GBUnit.findChildren(QRadioButton,):
|
||||||
|
if RB.text()==value :
|
||||||
|
RB.setChecked(True)
|
||||||
|
break
|
||||||
|
if tit=="ChordalToleranceDeviation": self.SP_Tolerance.setProperty("value", float(value))
|
||||||
|
if tit=="RidgeDetection": self.CB_Ridge.setChecked(value=="True")
|
||||||
|
if tit=="SplitEdge": self.CB_SplitEdge.setChecked(value=="True")
|
||||||
|
if tit=="PointSmoothing": self.CB_Point.setChecked(value=="True")
|
||||||
|
if tit=="GeometricalApproximation": self.SP_Geomapp.setProperty("value", float(value))
|
||||||
|
if tit=="RidgeAngle": self.SP_Ridge.setProperty("value", float(value))
|
||||||
|
if tit=="MaximumSize": self.SP_MaxSize.setProperty("value", float(value))
|
||||||
|
if tit=="MinimumSize": self.SP_MinSize.setProperty("value", float(value))
|
||||||
|
if tit=="MeshGradation": self.SP_Gradation.setProperty("value", float(value))
|
||||||
|
if tit=="Verbosity": self.SP_Verbosity.setProperty("value", int(float(value)))
|
||||||
|
if tit=="Memory": self.SP_Memory.setProperty("value", float(value))
|
||||||
|
except:
|
||||||
|
QMessageBox.warning(self, "load YAMS Hypothesis", "Problem on '"+lig+"'")
|
||||||
|
|
||||||
def PBLoadPressed(self):
|
def PBLoadPressed(self):
|
||||||
try :
|
"""load last hypothesis saved in tail of file"""
|
||||||
f=open(self.paramsFile,'r')
|
try:
|
||||||
except :
|
f=open(self.paramsFile,"r")
|
||||||
QMessageBox.warning( self, "File", "Unable to open "+self.paramsFile)
|
except:
|
||||||
return
|
QMessageBox.warning(self, "File", "Unable to open "+self.paramsFile)
|
||||||
try :
|
return
|
||||||
text=f.read()
|
try:
|
||||||
except :
|
text=f.read()
|
||||||
QMessageBox.warning( self, "File", "Unable to read "+self.paramsFile)
|
except:
|
||||||
return
|
QMessageBox.warning(self, "File", "Unable to read "+self.paramsFile)
|
||||||
f.close()
|
return
|
||||||
d={}
|
f.close()
|
||||||
exec text in d
|
self.loadResumeData(text, separator="\n")
|
||||||
for RB in self.GBOptim.findChildren(QRadioButton,):
|
|
||||||
if d['Optimisation']== RB.text():
|
|
||||||
RB.setChecked(True)
|
|
||||||
break
|
|
||||||
for RB in self.GBUnit.findChildren(QRadioButton,):
|
|
||||||
if d['Units']== RB.text():
|
|
||||||
RB.setChecked(True)
|
|
||||||
break
|
|
||||||
self.SP_Tolerance.setValue(d['Chordal_Tolerance_Deviation'])
|
|
||||||
|
|
||||||
self.CB_Ridge.setChecked(d['Ridge_Detection'])
|
|
||||||
self.CB_Point.setChecked(d['Point_Smoothing'])
|
|
||||||
self.CB_SplitEdge.setChecked(d['Split_Edge'])
|
|
||||||
self.SP_Geomapp.setValue(d['Geometrical_Approximation'])
|
|
||||||
self.SP_Ridge.setValue(d['Ridge_Angle'])
|
|
||||||
self.SP_MaxSize.setValue(d['Maximum_Size'])
|
|
||||||
self.SP_MinSize.setValue(d['Minimum_Size'])
|
|
||||||
self.SP_Gradation.setValue(d['Mesh_Gradation'])
|
|
||||||
|
|
||||||
self.SP_Verbosity.setValue(d['Verbosity'])
|
|
||||||
self.SP_Memory.setValue(d['Memory'])
|
|
||||||
|
|
||||||
|
def PBLoadHypPressed(self):
|
||||||
|
"""load hypothesis saved in Object Browser"""
|
||||||
|
#QMessageBox.warning(self, "load Object Browser YAMS hypothesis", "TODO")
|
||||||
|
import salome
|
||||||
|
from salome.kernel import studyedit
|
||||||
|
from salome.smesh.smeshstudytools import SMeshStudyTools
|
||||||
|
from salome.gui import helper as guihelper
|
||||||
|
from omniORB import CORBA
|
||||||
|
|
||||||
|
mySObject, myEntry = guihelper.getSObjectSelected()
|
||||||
|
if CORBA.is_nil(mySObject) or mySObject==None:
|
||||||
|
QMessageBox.critical(self, "Hypothese", "select an Object Browser YAMS hypothesis")
|
||||||
|
return
|
||||||
|
|
||||||
|
#for i in dir(mySObject): print "dir mySObject",i
|
||||||
|
#print "GetAllAttributes",mySObject.GetAllAttributes()
|
||||||
|
#print "GetComment",mySObject.GetComment()
|
||||||
|
#print "GetName",mySObject.GetName()
|
||||||
|
|
||||||
|
#could be renamed...
|
||||||
|
#if mySObject.GetFather().GetName()!="MGCleaner Hypotheses":
|
||||||
|
# QMessageBox.critical(self, "Hypothese", "not a child of MGCleaner Hypotheses")
|
||||||
|
# return
|
||||||
|
|
||||||
|
text=mySObject.GetComment()
|
||||||
|
|
||||||
|
#a verification
|
||||||
|
if "Optimisation=" not in text:
|
||||||
|
QMessageBox.critical(self, "Load Hypothese", "Object Browser selection not a YAMS Hypothesis")
|
||||||
|
return
|
||||||
|
self.loadResumeData(text, separator=" ; ")
|
||||||
|
return
|
||||||
|
|
||||||
def PBCancelPressed(self):
|
def PBCancelPressed(self):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def PBMeshFilePressed(self):
|
def PBMeshFilePressed(self):
|
||||||
fd = QFileDialog(self, "select an existing Mesh file", self.LE_MeshFile.text(), "Mesh-Files (*.mesh);;All Files (*)")
|
fd = QFileDialog(self, "select an existing Mesh file", self.LE_MeshFile.text(), "Mesh-Files (*.mesh);;All Files (*)")
|
||||||
if fd.exec_():
|
if fd.exec_():
|
||||||
infile = fd.selectedFiles()[0]
|
infile = fd.selectedFiles()[0]
|
||||||
self.LE_MeshFile.setText(infile)
|
self.LE_MeshFile.setText(infile)
|
||||||
self.fichierIn=infile.toLatin1()
|
self.fichierIn=infile.toLatin1()
|
||||||
|
self.MeshIn=""
|
||||||
|
self.LE_MeshSmesh.setText("")
|
||||||
|
|
||||||
def setParamsFileName(self):
|
def setParamsFileName(self):
|
||||||
fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)")
|
fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)")
|
||||||
if fd.exec_():
|
if fd.exec_():
|
||||||
infile = fd.selectedFiles()[0]
|
infile = fd.selectedFiles()[0]
|
||||||
self.LE_ParamsFile.setText(infile)
|
self.LE_ParamsFile.setText(infile)
|
||||||
self.paramsFile=infile.toLatin1()
|
self.paramsFile=infile.toLatin1()
|
||||||
|
|
||||||
|
|
||||||
def meshFileNameChanged(self):
|
def meshFileNameChanged(self):
|
||||||
self.fichierIn=self.LE_MeshFile.text()
|
self.fichierIn=str(self.LE_MeshFile.text())
|
||||||
if os.path.exists(self.fichierIn): return
|
#print "meshFileNameChanged", self.fichierIn
|
||||||
QMessageBox.warning( self, "Unknown File", "File doesn't exist")
|
if os.path.exists(self.fichierIn):
|
||||||
|
self.__selectedMesh=None
|
||||||
|
self.MeshIn=""
|
||||||
|
self.LE_MeshSmesh.setText("")
|
||||||
|
return
|
||||||
|
QMessageBox.warning( self, "Unknown File", "File doesn't exist")
|
||||||
|
|
||||||
|
def meshSmeshNameChanged(self):
|
||||||
|
"""only change by GUI mouse selection, otherwise clear"""
|
||||||
|
#self.MeshIn=str(self.LE_MeshSmesh.text())
|
||||||
|
#print "meshSmeshNameChanged", self.MeshIn
|
||||||
|
self.__selectedMesh = None
|
||||||
|
self.MeshIn=""
|
||||||
|
self.LE_MeshSmesh.setText("")
|
||||||
|
self.fichierIn=""
|
||||||
|
return
|
||||||
|
|
||||||
def paramsFileNameChanged(self):
|
def paramsFileNameChanged(self):
|
||||||
self.paramsFile=self.LE_ParamsFile.text()
|
self.paramsFile=self.LE_ParamsFile.text()
|
||||||
|
|
||||||
def PBMeshSmeshPressed(self):
|
def PBMeshSmeshPressed(self):
|
||||||
import salome
|
import salome
|
||||||
import smesh
|
import smesh
|
||||||
from salome.kernel import studyedit
|
from salome.kernel import studyedit
|
||||||
from salome.smesh.smeshstudytools import SMeshStudyTools
|
from salome.smesh.smeshstudytools import SMeshStudyTools
|
||||||
from salome.gui import helper as guihelper
|
from salome.gui import helper as guihelper
|
||||||
from omniORB import CORBA
|
from omniORB import CORBA
|
||||||
|
|
||||||
mySObject, myEntry = guihelper.getSObjectSelected()
|
mySObject, myEntry = guihelper.getSObjectSelected()
|
||||||
if CORBA.is_nil(mySObject) or mySObject==None:
|
if CORBA.is_nil(mySObject) or mySObject==None:
|
||||||
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
||||||
return
|
return
|
||||||
self.smeshStudyTool = SMeshStudyTools()
|
self.smeshStudyTool = SMeshStudyTools()
|
||||||
|
try:
|
||||||
self.__selectedMesh = self.smeshStudyTool.getMeshObjectFromSObject(mySObject)
|
self.__selectedMesh = self.smeshStudyTool.getMeshObjectFromSObject(mySObject)
|
||||||
if CORBA.is_nil(self.__selectedMesh):
|
except:
|
||||||
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
||||||
return
|
return
|
||||||
myName = mySObject.GetName()
|
if CORBA.is_nil(self.__selectedMesh):
|
||||||
self.MeshIn=myName
|
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
||||||
self.LE_MeshSmesh.setText(myName)
|
return
|
||||||
|
myName = mySObject.GetName()
|
||||||
|
#print "MeshSmeshNameChanged", myName
|
||||||
|
self.MeshIn=myName
|
||||||
|
self.LE_MeshSmesh.setText(myName)
|
||||||
|
self.LE_MeshFile.setText("")
|
||||||
|
self.fichierIn=""
|
||||||
|
|
||||||
def prepareFichier(self):
|
def prepareFichier(self):
|
||||||
self.fichierIn="/tmp/PourYam_"+str(self.num)+".mesh"
|
self.fichierIn="/tmp/ForYams_"+str(self.num)+".mesh"
|
||||||
import SMESH
|
import SMESH
|
||||||
self.__selectedMesh.ExportGMF(self.__selectedMesh,self.fichierIn, True)
|
self.__selectedMesh.ExportGMF(self.__selectedMesh, self.fichierIn, True)
|
||||||
|
|
||||||
def PrepareLigneCommande(self):
|
def PrepareLigneCommande(self):
|
||||||
self.commande="yams "
|
if self.fichierIn=="" and self.MeshIn=="":
|
||||||
verbosity=str(self.SP_Verbosity.value())
|
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
||||||
self.commande+="-v "+verbosity
|
return False
|
||||||
for obj in self.mesRB.children():
|
if self.__selectedMesh!=None: self.prepareFichier()
|
||||||
try :
|
if not (os.path.isfile(self.fichierIn)):
|
||||||
if obj.isChecked():
|
QMessageBox.critical(self, "File", "unable to read GMF Mesh in "+str(self.fichierIn))
|
||||||
self.style=obj.objectName().remove(0,3)
|
return False
|
||||||
self.style.replace("_","-")
|
|
||||||
break
|
self.commande="yams"
|
||||||
except :
|
verbosity=str(self.SP_Verbosity.value())
|
||||||
pass
|
self.commande+=" -v "+verbosity
|
||||||
self.commande+=" -O "+self.style.toLatin1()
|
for obj in self.GBOptim.findChildren(QRadioButton,):
|
||||||
if self.fichierIn=="" and self.MeshIn=="" :
|
try:
|
||||||
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
if obj.isChecked():
|
||||||
return False
|
self.style=obj.objectName().remove(0,3)
|
||||||
if self.MeshIn!="" : self.prepareFichier()
|
self.style.replace("_","-")
|
||||||
if not (os.path.isfile(self.fichierIn)):
|
break
|
||||||
QMessageBox.critical(self, "File", "unable to read GMF Mesh in "+str(self.fichierIn))
|
except:
|
||||||
return False
|
pass
|
||||||
|
self.commande+=" -O "+self.style.toLatin1()
|
||||||
|
|
||||||
deb=os.path.splitext(self.fichierIn)
|
deb=os.path.splitext(self.fichierIn)
|
||||||
self.fichierOut=deb[0]+'.d.meshb'
|
self.fichierOut=deb[0]+".d.meshb"
|
||||||
|
|
||||||
if self.RB_Absolute.isChecked()==True :
|
if self.RB_Absolute.isChecked()==True :
|
||||||
self.commande+=' -Dabsolute'
|
self.commande+=" -Dabsolute"
|
||||||
else :
|
else :
|
||||||
self.commande+=' -Drelative'
|
self.commande+=" -Drelative"
|
||||||
self.commande+=',tolerance=%f'%self.SP_Tolerance.value()
|
self.commande+=",tolerance=%f"%self.SP_Tolerance.value()
|
||||||
if self.CB_Ridge.isChecked()==False : self.commande+=',nr'
|
if self.CB_Ridge.isChecked()==False : self.commande+=",nr"
|
||||||
if self.CB_Point.isChecked()==False : self.commande+=',ns'
|
if self.CB_Point.isChecked()==False : self.commande+=",ns"
|
||||||
if self.SP_Geomapp.value()!=0.04 : self.commande+=',geomapp=%f'%self.SP_Geomapp.value()
|
if self.SP_Geomapp.value()!=0.04 : self.commande+=",geomapp=%f"%self.SP_Geomapp.value()
|
||||||
if self.SP_Ridge.value()!=45.0 : self.commande+=',ridge=%f'%self.SP_Ridge.value()
|
if self.SP_Ridge.value()!=45.0 : self.commande+=",ridge=%f"%self.SP_Ridge.value()
|
||||||
if self.SP_MaxSize.value()!=100 : self.commande+=',maxsize=%f'%self.SP_MaxSize.value()
|
if self.SP_MaxSize.value()!=100 : self.commande+=",maxsize=%f"%self.SP_MaxSize.value()
|
||||||
if self.SP_MinSize.value()!=5 : self.commande+=',minsize=%f'%self.SP_MinSize.value()
|
if self.SP_MinSize.value()!=5 : self.commande+=",minsize=%f"%self.SP_MinSize.value()
|
||||||
if self.SP_Gradation.value()!=1.3 : self.commande+=',gradation=%f'%self.SP_MaxSize.value()
|
if self.SP_Gradation.value()!=1.3 : self.commande+=",gradation=%f"%self.SP_MaxSize.value()
|
||||||
if self.CB_SplitEdge.isChecked()==True : self.commande+=',splitedge=1'
|
if self.CB_SplitEdge.isChecked()==True : self.commande+=",splitedge=1"
|
||||||
|
|
||||||
if self.SP_Verbosity.value()!=3 : self.commande+=' -v %d'%self.SP_Verbosity.value()
|
if self.SP_Verbosity.value()!=3 : self.commande+=" -v %d"%self.SP_Verbosity.value()
|
||||||
if self.SP_Memory.value()!=0 : self.commande+=' -m %d'%self.SP_Memory.value()
|
if self.SP_Memory.value()!=0 : self.commande+=" -m %d"%self.SP_Memory.value()
|
||||||
|
|
||||||
self.commande+=" "+self.fichierIn
|
self.commande+=" "+self.fichierIn
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
self.RB_0.setChecked(True)
|
self.RB_0.setChecked(True)
|
||||||
self.RB_G.setChecked(False)
|
self.RB_G.setChecked(False)
|
||||||
self.RB_U.setChecked(False)
|
self.RB_U.setChecked(False)
|
||||||
self.RB_S.setChecked(False)
|
self.RB_S.setChecked(False)
|
||||||
self.RB_2.setChecked(False)
|
self.RB_2.setChecked(False)
|
||||||
self.RB_1.setChecked(False)
|
self.RB_1.setChecked(False)
|
||||||
self.RB_Absolute.setChecked(False)
|
self.RB_Absolute.setChecked(False)
|
||||||
self.RB_Relative.setChecked(True)
|
self.RB_Relative.setChecked(True)
|
||||||
self.SP_Tolerance.setProperty("value", 0.1)
|
self.SP_Tolerance.setProperty("value", 0.1)
|
||||||
self.SP_Geomapp.setProperty("value", 0.04)
|
self.SP_Geomapp.setProperty("value", 0.04)
|
||||||
self.SP_Ridge.setProperty("value", 45.0)
|
self.SP_Ridge.setProperty("value", 45.0)
|
||||||
self.SP_Gradation.setProperty("value", 1.3)
|
self.SP_Gradation.setProperty("value", 1.3)
|
||||||
self.CB_Ridge.setChecked(True)
|
self.CB_Ridge.setChecked(True)
|
||||||
self.CB_Point.setChecked(True)
|
self.CB_Point.setChecked(True)
|
||||||
self.CB_SplitEdge.setChecked(False)
|
self.CB_SplitEdge.setChecked(False)
|
||||||
self.SP_MaxSize.setProperty("value", -2.0)
|
self.SP_MaxSize.setProperty("value", -2.0)
|
||||||
self.SP_MinSize.setProperty("value", -2.0)
|
self.SP_MinSize.setProperty("value", -2.0)
|
||||||
self.SP_Verbosity.setProperty("value", 3)
|
self.SP_Verbosity.setProperty("value", 3)
|
||||||
self.SP_Memory.setProperty("value", 0)
|
self.SP_Memory.setProperty("value", 0)
|
||||||
|
|
||||||
|
|
||||||
__dialog=None
|
__dialog=None
|
||||||
def getDialog():
|
def getDialog():
|
||||||
@ -330,3 +457,23 @@ def getDialog():
|
|||||||
# __dialog.clean()
|
# __dialog.clean()
|
||||||
return __dialog
|
return __dialog
|
||||||
|
|
||||||
|
#
|
||||||
|
# ==============================================================================
|
||||||
|
# Basic use cases and unit test functions
|
||||||
|
# ==============================================================================
|
||||||
|
#
|
||||||
|
def TEST_MonYamsPlugDialog():
|
||||||
|
#print "TEST_YamsMonPlugDialog"
|
||||||
|
import sys
|
||||||
|
from PyQt4.QtGui import QApplication
|
||||||
|
from PyQt4.QtCore import QObject, SIGNAL, SLOT
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
|
||||||
|
|
||||||
|
dlg=MonYamsPlugDialog()
|
||||||
|
dlg.show()
|
||||||
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
TEST_MonYamsPlugDialog()
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user