merge from BR_pluginMGCleaner tag mergeto_v7_main_17jun13
@ -15,7 +15,7 @@ You usually don't have to set this parameter but you can choose to limit the amo
|
|||||||
|
|
||||||
- **File**
|
- **File**
|
||||||
|
|
||||||
You can change the file used to store the remeshing hypothesis. see paragraph :ref:`hypothesis-label` for further informations.
|
You can change the file used to store remeshing hypotheses. see paragraph :ref:`hypothesis-label` for further informations.
|
||||||
|
|
||||||
.. image:: images/Generic.png
|
.. image:: images/Generic.png
|
||||||
:align: center
|
:align: center
|
||||||
|
@ -12,7 +12,7 @@ RSTFILES = lct.rst \
|
|||||||
Generics_params.rst \
|
Generics_params.rst \
|
||||||
Advanced_params.rst
|
Advanced_params.rst
|
||||||
|
|
||||||
EXTRA_DIST += $(RSTFILES) images
|
EXTRA_DIST += $(RSTFILES) images files
|
||||||
|
|
||||||
# You can set these variables from the command line.
|
# You can set these variables from the command line.
|
||||||
SPHINXOPTS =
|
SPHINXOPTS =
|
||||||
|
@ -61,7 +61,7 @@ This is the main remeshing Option. Yams always does quality improvement. It is
|
|||||||
|
|
||||||
- **Mesh for finite element computation : Coarsening**
|
- **Mesh for finite element computation : Coarsening**
|
||||||
|
|
||||||
The given surface triangulation is modfied in accordance to a size map. The latter is the intrinsic size map (computed automatically and based on the surface properties, i.e. the local curvatures). One should use this option to coarsen the mesh, when a regular mesh for computation purposes is desired, i.e. a mesh with good aspect ratios or good quality elements.
|
The given surface triangulation is modified in accordance to a size map. The latter is the intrinsic size map (computed automatically and based on the surface properties, i.e. the local curvatures). One should use this option to coarsen the mesh, when a regular mesh for computation purposes is desired, i.e. a mesh with good aspect ratios or good quality elements.
|
||||||
|
|
||||||
It is equivalent to Yams's batch option -1.
|
It is equivalent to Yams's batch option -1.
|
||||||
|
|
||||||
|
@ -4,17 +4,23 @@
|
|||||||
How to save Yams Parameters
|
How to save Yams Parameters
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
As Yams hypothesis are not meshing hypothesis for Salome (but hypothesis for yams), parameters
|
Yams hypothesis is not meshing hypothesis for Salome, but hypothesis for yams.
|
||||||
are stored in a special file. Default file is $HOME/.yams.dat. It is strongly recommended that you
|
The current set of parameters is automatically written in the salome study object browser when you run computation.
|
||||||
change this name if you want to preserve the way you obtain a mesh : This file is never cleaned.
|
|
||||||
All sets of parameters are logged in it.
|
|
||||||
|
|
||||||
|
Theses parameters could also be stored in a special file.
|
||||||
|
Default file is $HOME/.yams.dat.
|
||||||
|
This ASCII file is appended, and never cleaned.
|
||||||
|
|
||||||
- To save the current setting, click on "Save Params" pushbutton.
|
In frame "Plug-in Generic Options":
|
||||||
- A set of parameters is automatically written in the .yams.dat file when you run computation.
|
|
||||||
- Restoring the default settings can be done by pushing "Default Params".
|
|
||||||
- "Loading Params" will reload the last set of parameters
|
|
||||||
|
|
||||||
|
- To save the current setting in this file, click on "Save" pushbutton.
|
||||||
|
- To load the last set of parameters saved, click on "Load" pushbutton.
|
||||||
|
|
||||||
|
At the bottom of the dialog window:
|
||||||
|
|
||||||
|
- To save a current setting in the study object browser, click on "Save" pushbutton.
|
||||||
|
- To load a current setting from the study object browser, click on "Load" pushbutton.
|
||||||
|
- To load the default setting, click on "Default" pushbutton. .
|
||||||
|
|
||||||
|
|
||||||
**example of .yams.dat**
|
**example of .yams.dat**
|
||||||
@ -22,39 +28,25 @@ All sets of parameters are logged in it.
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
# Save intermediate params
|
# YAMS hypothesis parameters
|
||||||
# Params for mesh :
|
|
||||||
Optimisation ='Quality improvement Only (0)'
|
|
||||||
Units ='Relative'
|
|
||||||
Chordal_Tolerance_Deviation=1.0
|
|
||||||
Ridge_Detection=True
|
|
||||||
Split_Edge=False
|
|
||||||
Point_Smoothing=True
|
|
||||||
Geometrical_Approximation=0.04
|
|
||||||
Ridge_Angle=45.0
|
|
||||||
Maximum_Size=-2.0
|
|
||||||
Minimum_Size=-2.0
|
|
||||||
Mesh_Gradation=1.3
|
|
||||||
Verbosity=3
|
|
||||||
Memory=0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Params for Hypothese : monHypo_Yams_0
|
|
||||||
# Params for mesh : Mesh_1
|
# Params for mesh : Mesh_1
|
||||||
Optimisation ='Quality improvement Only (0)'
|
# Date : 23/05/13 14:23:18
|
||||||
Units ='Relative'
|
# Command : yams -v 3 -O 0 -Drelative,tolerance=0.100000,maxsize=0.010000,minsize=0.000000 /tmp/ForYams_1.mesh
|
||||||
Chordal_Tolerance_Deviation=1.0
|
Optimisation=Quality improvement Only (0)
|
||||||
Ridge_Detection=True
|
Units=Relative
|
||||||
Split_Edge=False
|
ChordalToleranceDeviation=0.1
|
||||||
Point_Smoothing=True
|
RidgeDetection=True
|
||||||
Geometrical_Approximation=0.04
|
SplitEdge=False
|
||||||
Ridge_Angle=45.0
|
PointSmoothing=True
|
||||||
Maximum_Size=-2.0
|
GeometricalApproximation=0.04
|
||||||
Minimum_Size=-2.0
|
RidgeAngle=45.0
|
||||||
Mesh_Gradation=1.3
|
MaximumSize=0.01
|
||||||
|
MinimumSize=0.0
|
||||||
|
MeshGradation=1.3
|
||||||
Verbosity=3
|
Verbosity=3
|
||||||
Memory=0
|
Memory=0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BIN
src/Tools/YamsPlug/doc/files/YamsWhitePaper_3.2.pdf
Normal file
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 63 KiB |
@ -11,6 +11,8 @@ Mesh module for remeshing 2D Surface.
|
|||||||
Yams plug-in uses Distene commercial software Yams, which is an **automatic surface remeshing tool**.
|
Yams plug-in uses Distene commercial software Yams, which is an **automatic surface remeshing tool**.
|
||||||
This plug_in offers only the most common functionnalities of the tool.
|
This plug_in offers only the most common functionnalities of the tool.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
for a complete documentation, see :download:`Yams whitepaper <files/YamsWhitePaper_3.2.pdf>`.
|
||||||
|
|
||||||
Contents:
|
Contents:
|
||||||
|
|
||||||
@ -19,8 +21,8 @@ Contents:
|
|||||||
|
|
||||||
lct.rst
|
lct.rst
|
||||||
Mandatory_params.rst
|
Mandatory_params.rst
|
||||||
Generics_params.rst
|
|
||||||
Advanced_params.rst
|
Advanced_params.rst
|
||||||
|
Generics_params.rst
|
||||||
editHypo.rst
|
editHypo.rst
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Running Yams Plug-in
|
Running Yams Plug-in
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
Yamms plug-in can be invoked via SMESH Plugin item in Mesh menu bar
|
Yams plug-in can be invoked via SMESH Plugin item in Mesh menu bar
|
||||||
|
|
||||||
.. image:: images/AppelYams.png
|
.. image:: images/AppelYams.png
|
||||||
:align: center
|
:align: center
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -*- coding: iso-8859-1 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2007-2013 EDF R&D
|
# Copyright (C) 2007-2013 EDF R&D
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
@ -28,45 +28,59 @@ from PyQt4.QtCore import *
|
|||||||
|
|
||||||
# Import des panels
|
# Import des panels
|
||||||
|
|
||||||
# ------------------------------- #
|
|
||||||
from ViewText import Ui_ViewExe
|
from ViewText import Ui_ViewExe
|
||||||
class MonViewText(Ui_ViewExe,QDialog):
|
|
||||||
# ------------------------------- #
|
class MonViewText(Ui_ViewExe, QDialog):
|
||||||
"""
|
"""
|
||||||
Classe permettant la visualisation de texte
|
Classe permettant la visualisation de texte
|
||||||
"""
|
"""
|
||||||
def __init__(self,parent,txt):
|
def __init__(self, parent, txt):
|
||||||
QDialog.__init__(self,parent)
|
QDialog.__init__(self,parent)
|
||||||
self.pere=parent
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.resize( QSize(600,600).expandedTo(self.minimumSizeHint()) )
|
self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) )
|
||||||
self.connect( self.PB_Ok,SIGNAL("clicked()"), self, SLOT("close()") )
|
#self.connect( self.PB_Ok,SIGNAL("clicked()"), self, SLOT("close()") )
|
||||||
|
self.connect( self.PB_Ok,SIGNAL("clicked()"), self.theClose )
|
||||||
self.connect( self.PB_Save,SIGNAL("clicked()"), self.saveFile )
|
self.connect( self.PB_Save,SIGNAL("clicked()"), self.saveFile )
|
||||||
self.monExe=QProcess(self)
|
self.monExe=QProcess(self)
|
||||||
|
|
||||||
|
|
||||||
self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut )
|
self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut )
|
||||||
self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr )
|
self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr )
|
||||||
self.connect(self.monExe, SIGNAL("finished(int )"), self.exeFinished )
|
|
||||||
|
|
||||||
# Je n arrive pas a utiliser le setEnvironment du QProcess
|
# Je n arrive pas a utiliser le setEnvironment du QProcess
|
||||||
# fonctionne hors Salome mais pas dans Salome ???
|
# fonctionne hors Salome mais pas dans Salome ???
|
||||||
LICENCE=os.environ['DISTENE_LICENCE_FILE_FOR_YAMS']
|
cmds=''
|
||||||
txt='export DISTENE_LICENSE_FILE='+LICENCE+';'+ txt
|
try :
|
||||||
|
LICENCE_FILE=os.environ["DISTENE_LICENCE_FILE_FOR_YAMS"]
|
||||||
|
except:
|
||||||
|
LICENCE_FILE=''
|
||||||
|
try :
|
||||||
|
PATH=os.environ["DISTENE_PATH_FOR_YAMS"]
|
||||||
|
except:
|
||||||
|
PATH=''
|
||||||
|
if LICENCE_FILE != '':
|
||||||
|
cmds+='source '+LICENCE_FILE+'\n'
|
||||||
|
else:
|
||||||
|
cmds+="# $DISTENE_LICENCE_FILE_FOR_YAMS NOT SET\n"
|
||||||
|
if PATH != '':
|
||||||
|
cmds+='export PATH='+PATH+':$PATH\n'
|
||||||
|
else:
|
||||||
|
cmds+="# $DISTENE_PATH_FOR_YAMS NOT SET\n"
|
||||||
|
#cmds+='env\n'
|
||||||
|
cmds+='rm -f '+self.parent().fichierOut+'\n'
|
||||||
|
cmds+=txt+'\n'
|
||||||
|
cmds+='echo END_OF_Yams\n'
|
||||||
pid=self.monExe.pid()
|
pid=self.monExe.pid()
|
||||||
nomFichier='/tmp/yam_'+str(pid)+'.py'
|
nomFichier='/tmp/Yams_'+str(pid)+'.sh'
|
||||||
f=open(nomFichier,'w')
|
f=open(nomFichier,'w')
|
||||||
f.write(txt)
|
f.write(cmds)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
maBidouille='sh ' + nomFichier
|
maBidouille='sh ' + nomFichier
|
||||||
self.monExe.start(maBidouille)
|
self.monExe.start(maBidouille)
|
||||||
self.monExe.closeWriteChannel()
|
self.monExe.closeWriteChannel()
|
||||||
|
self.enregistreResultatsDone=False
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def exeFinished(self):
|
|
||||||
self.pere.enregistreResultat()
|
|
||||||
|
|
||||||
def saveFile(self):
|
def saveFile(self):
|
||||||
#recuperation du nom du fichier
|
#recuperation du nom du fichier
|
||||||
savedir=os.environ['HOME']
|
savedir=os.environ['HOME']
|
||||||
@ -84,8 +98,19 @@ class MonViewText(Ui_ViewExe,QDialog):
|
|||||||
|
|
||||||
def readFromStdErr(self):
|
def readFromStdErr(self):
|
||||||
a=self.monExe.readAllStandardError()
|
a=self.monExe.readAllStandardError()
|
||||||
self.TB_Exe.append(QString.fromUtf8(a.data(),len(a))) ;
|
self.TB_Exe.append(QString.fromUtf8(a.data(),len(a)))
|
||||||
|
|
||||||
def readFromStdOut(self) :
|
def readFromStdOut(self) :
|
||||||
a=self.monExe.readAllStandardOutput()
|
a=self.monExe.readAllStandardOutput()
|
||||||
self.TB_Exe.append(QString.fromUtf8(a.data(),len(a))) ;
|
aa=QString.fromUtf8(a.data(),len(a))
|
||||||
|
self.TB_Exe.append(aa)
|
||||||
|
if "END_OF_Yams" in aa:
|
||||||
|
self.parent().enregistreResultat()
|
||||||
|
self.enregistreResultatsDone=True
|
||||||
|
#self.theClose()
|
||||||
|
|
||||||
|
def theClose(self):
|
||||||
|
if not self.enregistreResultatsDone:
|
||||||
|
self.parent().enregistreResultat()
|
||||||
|
self.enregistreResultatsDone=True
|
||||||
|
self.close()
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
|
||||||
# Modules Python
|
# Modules Python
|
||||||
# Modules Eficas
|
# Modules Eficas
|
||||||
|
|
||||||
@ -37,44 +38,168 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
self.fichierIn=""
|
self.fichierIn=""
|
||||||
self.fichierOut=""
|
self.fichierOut=""
|
||||||
self.MeshIn=""
|
self.MeshIn=""
|
||||||
|
self.commande=""
|
||||||
self.num=1
|
self.num=1
|
||||||
|
self.__selectedMesh=None
|
||||||
|
|
||||||
# Ces parametres ne sont pas remis à rien par le clean
|
# complex whith QResources: not used
|
||||||
self.paramsFile= os.path.abspath(os.path.join(os.environ['HOME'],'.yams.dat'))
|
# 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:
|
||||||
|
# iconfolder=os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
self.iconfolder=os.environ["SMESH_ROOT_DIR"]+"/share/salome/resources/smesh"
|
||||||
|
#print "monYamsPlugDialog iconfolder",iconfolder
|
||||||
|
icon = QIcon()
|
||||||
|
icon.addFile(os.path.join(self.iconfolder,"select1.png"))
|
||||||
|
self.PB_LoadHyp.setIcon(icon)
|
||||||
|
self.PB_LoadHyp.setToolTip("hypothesis from Salome Object Browser")
|
||||||
|
self.PB_SaveHyp.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
|
||||||
|
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("")
|
||||||
|
|
||||||
|
v1=QDoubleValidator(self)
|
||||||
|
v1.setBottom(0.)
|
||||||
|
#v1.setTop(1000.) #per thousand... only if relative
|
||||||
|
v1.setDecimals(2)
|
||||||
|
self.SP_Tolerance.setValidator(v1)
|
||||||
|
self.SP_Tolerance.titleForWarning="Chordal Tolerance"
|
||||||
|
|
||||||
|
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_Load,SIGNAL("clicked()"),self.PBLoadPressed)
|
||||||
self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed)
|
self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed)
|
||||||
|
self.connect(self.PB_LoadHyp,SIGNAL("clicked()"),self.PBLoadHypPressed)
|
||||||
|
self.connect(self.PB_SaveHyp,SIGNAL("clicked()"),self.PBSaveHypPressed)
|
||||||
|
|
||||||
self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed)
|
self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed)
|
||||||
self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed)
|
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.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName)
|
||||||
self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged)
|
self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged)
|
||||||
self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged)
|
self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged)
|
||||||
|
|
||||||
|
|
||||||
def PBHelpPressed(self):
|
def PBHelpPressed(self):
|
||||||
try :
|
try :
|
||||||
maDoc=os.environ['DISTENE_YAMS_DOC_PDF']
|
mydir=os.environ["SMESH_ROOT_DIR"]
|
||||||
except Exception:
|
except Exception:
|
||||||
QMessageBox.warning( self, "Help unavailable", str(maDoc) + " not found")
|
QMessageBox.warning(self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
|
||||||
|
return
|
||||||
|
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()):
|
||||||
self.PBSavePressed(NomHypo=True)
|
#warning done yet
|
||||||
|
#QMessageBox.warning(self, "Compute", "Command not found")
|
||||||
|
return
|
||||||
maFenetre=MonViewText(self,self.commande)
|
maFenetre=MonViewText(self,self.commande)
|
||||||
|
|
||||||
def enregistreResultat(self):
|
def enregistreResultat(self):
|
||||||
if not(os.path.isfile(self.fichierOut)) : return
|
import smesh
|
||||||
|
import SMESH
|
||||||
|
import salome
|
||||||
|
from salome.kernel import studyedit
|
||||||
|
|
||||||
|
if not os.path.isfile(self.fichierOut):
|
||||||
|
QMessageBox.warning(self, "Compute", "Result file "+self.fichierOut+" not found")
|
||||||
|
|
||||||
|
maStudy=studyedit.getActiveStudy()
|
||||||
|
smesh.SetCurrentStudy(maStudy)
|
||||||
|
(outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
|
||||||
|
name=str(self.LE_MeshSmesh.text())
|
||||||
|
initialMeshFile=None
|
||||||
|
initialMeshObject=None
|
||||||
|
if name=="":
|
||||||
|
a=str(self.fichierIn)
|
||||||
|
name=os.path.basename(os.path.splitext(a)[0])
|
||||||
|
initialMeshFile=a
|
||||||
|
else:
|
||||||
|
initialMeshObject=maStudy.FindObjectByName(name ,"SMESH")[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() #
|
||||||
|
moduleEntry=self.editor.findOrCreateComponent("SMESH","SMESH")
|
||||||
|
HypReMeshEntry = self.editor.findOrCreateItem(
|
||||||
|
moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png") #, comment = "HypoForRemeshing" )
|
||||||
|
|
||||||
|
monStudyBuilder=maStudy.NewBuilder()
|
||||||
|
monStudyBuilder.NewCommand()
|
||||||
|
newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
|
||||||
|
self.editor.setAttributeValue(newStudyIter, "AttributeName", "YAMS Parameters_"+str(self.num))
|
||||||
|
self.editor.setAttributeValue(newStudyIter, "AttributeComment", self.getResumeData(separator=" ; "))
|
||||||
|
|
||||||
|
SOMesh=maStudy.FindObjectByName(meshname ,"SMESH")[0]
|
||||||
|
|
||||||
|
if initialMeshFile!=None:
|
||||||
|
newStudyFileName=monStudyBuilder.NewObject(SOMesh)
|
||||||
|
self.editor.setAttributeValue(newStudyFileName, "AttributeName", "meshFile")
|
||||||
|
self.editor.setAttributeValue(newStudyFileName, "AttributeExternalFileDef", initialMeshFile)
|
||||||
|
self.editor.setAttributeValue(newStudyFileName, "AttributeComment", initialMeshFile)
|
||||||
|
|
||||||
|
if initialMeshObject!=None:
|
||||||
|
newLink=monStudyBuilder.NewObject(SOMesh)
|
||||||
|
monStudyBuilder.Addreference(newLink, initialMeshObject)
|
||||||
|
|
||||||
|
newLink=monStudyBuilder.NewObject(SOMesh)
|
||||||
|
monStudyBuilder.Addreference(newLink, newStudyIter)
|
||||||
|
|
||||||
|
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
|
||||||
|
self.num+=1
|
||||||
|
return True
|
||||||
|
|
||||||
|
def PBSavePressed(self,NomHypo=False):
|
||||||
|
from datetime import datetime
|
||||||
|
if not(self.PrepareLigneCommande()): return
|
||||||
|
text = "# YAMS hypothesis parameters\n"
|
||||||
|
text += "# Params for mesh : " + self.LE_MeshSmesh.text() +"\n"
|
||||||
|
text += datetime.now().strftime("# Date : %d/%m/%y %H:%M:%S\n")
|
||||||
|
text += "# Command : "+self.commande+"\n"
|
||||||
|
text += self.getResumeData(separator="\n")
|
||||||
|
text += "\n\n"
|
||||||
|
|
||||||
|
try:
|
||||||
|
f=open(self.paramsFile,"a")
|
||||||
|
except:
|
||||||
|
QMessageBox.warning(self, "File", "Unable to open "+self.paramsFile)
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
f.write(text)
|
||||||
|
except:
|
||||||
|
QMessageBox.warning(self, "File", "Unable to write "+self.paramsFile)
|
||||||
|
return
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
def PBSaveHypPressed(self):
|
||||||
|
"""save hypothesis in Object Browser"""
|
||||||
|
#QMessageBox.warning(self, "save Object Browser YAMS Hypothesis", "TODO")
|
||||||
|
|
||||||
import smesh
|
import smesh
|
||||||
import SMESH
|
import SMESH
|
||||||
import salome
|
import salome
|
||||||
@ -82,106 +207,147 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
|
|
||||||
maStudy=studyedit.getActiveStudy()
|
maStudy=studyedit.getActiveStudy()
|
||||||
smesh.SetCurrentStudy(maStudy)
|
smesh.SetCurrentStudy(maStudy)
|
||||||
(outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
|
|
||||||
meshname = 'yams'+str(self.num)
|
|
||||||
smesh.SetName(outputMesh.GetMesh(), meshname)
|
|
||||||
outputMesh.Compute()
|
|
||||||
|
|
||||||
|
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 = 'HypoForRemshing')
|
moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.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 = 'monHypo_Yams_'+str(self.num)
|
self.editor.setAttributeValue(newStudyIter, "AttributeName", "YAMS Parameters_"+str(self.num))
|
||||||
aNameAttrib.SetValue(hypoName)
|
self.editor.setAttributeValue(newStudyIter, "AttributeComment", self.getResumeData(separator=" ; "))
|
||||||
aCommentAttrib=monStudyBuilder.FindOrCreateAttribute(newStudyIter,"AttributeComment")
|
|
||||||
aCommentAttrib.SetValue(str(self.commande))
|
|
||||||
|
|
||||||
SOMesh=maStudy.FindObjectByName(meshname ,"SMESH")[0]
|
|
||||||
newLink=monStudyBuilder.NewObject(SOMesh)
|
|
||||||
monStudyBuilder.Addreference(newLink, newStudyIter);
|
|
||||||
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
|
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
|
||||||
self.num+=1
|
self.num+=1
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def PBSavePressed(self,NomHypo=False):
|
def SP_toStr(self, widget):
|
||||||
if NomHypo : text = '# Params for Hypothese : monHypo_Yams_'+str(self.num - 1)+"\n"
|
"""only for a QLineEdit widget"""
|
||||||
else : text = '# Save intermediate params \n'
|
#cr, pos=widget.validator().validate(res, 0) #n.b. "1,3" is acceptable !locale!
|
||||||
text += "# Params for mesh : " + self.LE_MeshSmesh.text() +'\n'
|
try:
|
||||||
|
val=float(widget.text())
|
||||||
|
except:
|
||||||
|
QMessageBox.warning(self, widget.titleForWarning, "float value is incorrect: '"+widget.text()+"'")
|
||||||
|
res=str(widget.validator().bottom())
|
||||||
|
widget.setProperty("text", res)
|
||||||
|
return res
|
||||||
|
valtest=widget.validator().bottom()
|
||||||
|
if valtest!=None:
|
||||||
|
if val<valtest:
|
||||||
|
QMessageBox.warning(self, widget.titleForWarning, "float value is under minimum: "+str(val)+" < "+str(valtest))
|
||||||
|
res=str(valtest)
|
||||||
|
widget.setProperty("text", res)
|
||||||
|
return res
|
||||||
|
valtest=widget.validator().top()
|
||||||
|
if valtest!=None:
|
||||||
|
if val>valtest:
|
||||||
|
QMessageBox.warning(self, widget.titleForWarning, "float value is over maximum: "+str(val)+" > "+str(valtest))
|
||||||
|
res=str(valtest)
|
||||||
|
widget.setProperty("text", res)
|
||||||
|
return res
|
||||||
|
return str(val)
|
||||||
|
|
||||||
|
def getResumeData(self, separator="\n"):
|
||||||
|
text=""
|
||||||
for RB in self.GBOptim.findChildren(QRadioButton,):
|
for RB in self.GBOptim.findChildren(QRadioButton,):
|
||||||
if RB.isChecked()==True:
|
if RB.isChecked()==True:
|
||||||
text+="Optimisation ='"+RB.text()+"'\n"
|
text+="Optimisation="+RB.text()+separator
|
||||||
break
|
break
|
||||||
|
if self.RB_Absolute.isChecked():
|
||||||
|
text+="Units=absolute"+separator
|
||||||
|
else:
|
||||||
|
text+="Units=relative"+separator
|
||||||
|
v=self.SP_toStr(self.SP_Tolerance)
|
||||||
|
text+="ChordalToleranceDeviation="+v+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,):
|
for RB in self.GBUnit.findChildren(QRadioButton,):
|
||||||
if RB.isChecked()==True:
|
RB.setChecked(False)
|
||||||
text+="Units ='"+RB.text()+"'\n"
|
for RB in self.GBUnit.findChildren(QRadioButton,):
|
||||||
text+='Chordal_Tolerance_Deviation='+str(self.SP_Tolerance.value())+'\n'
|
if RB.text()==value :
|
||||||
|
RB.setChecked(True)
|
||||||
text+='Ridge_Detection=' + str(self.CB_Ridge.isChecked())+'\n'
|
break
|
||||||
text+='Split_Edge=' + str(self.CB_SplitEdge.isChecked())+'\n'
|
if tit=="Units":
|
||||||
text+='Point_Smoothing=' + str(self.CB_Point.isChecked())+'\n'
|
if value=="absolute":
|
||||||
text+='Geometrical_Approximation='+ str(self.SP_Geomapp.value()) +'\n'
|
self.RB_Absolute.setChecked(True)
|
||||||
text+='Ridge_Angle=' + str(self.SP_Ridge.value()) +'\n'
|
self.RB_Relative.setChecked(False)
|
||||||
text+='Maximum_Size=' + str(self.SP_MaxSize.value()) +'\n'
|
else:
|
||||||
text+='Minimum_Size=' + str(self.SP_MaxSize.value()) +'\n'
|
self.RB_Absolute.setChecked(False)
|
||||||
text+='Mesh_Gradation=' + str(self.SP_Gradation.value())+'\n'
|
self.RB_Relative.setChecked(True)
|
||||||
|
if tit=="ChordalToleranceDeviation": self.SP_Tolerance.setProperty("text", float(value))
|
||||||
text+='Verbosity=' + str(self.SP_Verbosity.value())+'\n'
|
if tit=="RidgeDetection": self.CB_Ridge.setChecked(value=="True")
|
||||||
text+='Memory=' + str(self.SP_Memory.value())+'\n'
|
if tit=="SplitEdge": self.CB_SplitEdge.setChecked(value=="True")
|
||||||
text+='\n\n'
|
if tit=="PointSmoothing": self.CB_Point.setChecked(value=="True")
|
||||||
|
if tit=="GeometricalApproximation": self.SP_Geomapp.setProperty("value", float(value))
|
||||||
try :
|
if tit=="RidgeAngle": self.SP_Ridge.setProperty("value", float(value))
|
||||||
f=open(self.paramsFile,'a')
|
if tit=="MaximumSize": self.SP_MaxSize.setProperty("value", float(value))
|
||||||
except :
|
if tit=="MinimumSize": self.SP_MinSize.setProperty("value", float(value))
|
||||||
QMessageBox.warning( self, "File", "Unable to open "+self.paramsFile)
|
if tit=="MeshGradation": self.SP_Gradation.setProperty("value", float(value))
|
||||||
return
|
if tit=="Verbosity": self.SP_Verbosity.setProperty("value", int(float(value)))
|
||||||
try :
|
if tit=="Memory": self.SP_Memory.setProperty("value", float(value))
|
||||||
f.write(text)
|
except:
|
||||||
except :
|
QMessageBox.warning(self, "load YAMS Hypothesis", "Problem on '"+lig+"'")
|
||||||
QMessageBox.warning( self, "File", "Unable to write "+self.paramsFile)
|
|
||||||
return
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
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:
|
||||||
|
QMessageBox.warning(self, "File", "Unable to open "+self.paramsFile)
|
||||||
return
|
return
|
||||||
try :
|
try:
|
||||||
text=f.read()
|
text=f.read()
|
||||||
except :
|
except:
|
||||||
QMessageBox.warning( self, "File", "Unable to read "+self.paramsFile)
|
QMessageBox.warning(self, "File", "Unable to read "+self.paramsFile)
|
||||||
return
|
return
|
||||||
f.close()
|
f.close()
|
||||||
d={}
|
self.loadResumeData(text, separator="\n")
|
||||||
exec text in d
|
|
||||||
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'])
|
def PBLoadHypPressed(self):
|
||||||
self.CB_Point.setChecked(d['Point_Smoothing'])
|
"""load hypothesis saved in Object Browser"""
|
||||||
self.CB_SplitEdge.setChecked(d['Split_Edge'])
|
#QMessageBox.warning(self, "load Object Browser YAMS hypothesis", "TODO")
|
||||||
self.SP_Geomapp.setValue(d['Geometrical_Approximation'])
|
import salome
|
||||||
self.SP_Ridge.setValue(d['Ridge_Angle'])
|
from salome.kernel import studyedit
|
||||||
self.SP_MaxSize.setValue(d['Maximum_Size'])
|
from salome.smesh.smeshstudytools import SMeshStudyTools
|
||||||
self.SP_MinSize.setValue(d['Minimum_Size'])
|
from salome.gui import helper as guihelper
|
||||||
self.SP_Gradation.setValue(d['Mesh_Gradation'])
|
from omniORB import CORBA
|
||||||
|
|
||||||
self.SP_Verbosity.setValue(d['Verbosity'])
|
mySObject, myEntry = guihelper.getSObjectSelected()
|
||||||
self.SP_Memory.setValue(d['Memory'])
|
if CORBA.is_nil(mySObject) or mySObject==None:
|
||||||
|
QMessageBox.critical(self, "Hypothese", "select an Object Browser YAMS hypothesis")
|
||||||
|
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()
|
||||||
@ -192,6 +358,8 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
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 (*)")
|
||||||
@ -200,11 +368,23 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
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, "Mesh file", "File doesn't exist")
|
||||||
|
|
||||||
|
def meshSmeshNameChanged(self):
|
||||||
|
"""only change by GUI mouse selection, otherwise clear"""
|
||||||
|
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()
|
||||||
@ -222,59 +402,69 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
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)
|
||||||
|
except:
|
||||||
|
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
||||||
|
return
|
||||||
if CORBA.is_nil(self.__selectedMesh):
|
if CORBA.is_nil(self.__selectedMesh):
|
||||||
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
QMessageBox.critical(self, "Mesh", "select an input mesh")
|
||||||
return
|
return
|
||||||
myName = mySObject.GetName()
|
myName = mySObject.GetName()
|
||||||
|
#print "MeshSmeshNameChanged", myName
|
||||||
self.MeshIn=myName
|
self.MeshIn=myName
|
||||||
self.LE_MeshSmesh.setText(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())
|
|
||||||
self.commande+="-v "+verbosity
|
|
||||||
for obj in self.mesRB.children():
|
|
||||||
try :
|
|
||||||
if obj.isChecked():
|
|
||||||
self.style=obj.objectName().remove(0,3)
|
|
||||||
self.style.replace("_","-")
|
|
||||||
break
|
|
||||||
except :
|
|
||||||
pass
|
|
||||||
self.commande+=" -O "+self.style.toLatin1()
|
|
||||||
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.MeshIn!="" : self.prepareFichier()
|
if self.__selectedMesh!=None: self.prepareFichier()
|
||||||
if not (os.path.isfile(self.fichierIn)):
|
if not (os.path.isfile(self.fichierIn)):
|
||||||
QMessageBox.critical(self, "File", "unable to read GMF Mesh in "+str(self.fichierIn))
|
QMessageBox.critical(self, "File", "unable to read GMF Mesh in "+str(self.fichierIn))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
self.commande="yams"
|
||||||
|
verbosity=str(self.SP_Verbosity.value())
|
||||||
|
self.commande+=" -v "+verbosity
|
||||||
|
for obj in self.GBOptim.findChildren(QRadioButton,):
|
||||||
|
try:
|
||||||
|
if obj.isChecked():
|
||||||
|
self.style=obj.objectName().remove(0,3)
|
||||||
|
self.style.replace("_","-")
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
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()
|
|
||||||
if self.CB_Ridge.isChecked()==False : self.commande+=',-nr'
|
|
||||||
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_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_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.CB_SplitEdge.isChecked()==True : self.commande+=',splitedge=1'
|
|
||||||
|
|
||||||
if self.SP_Verbosity.value()!=3 : self.commande+=' -v %d'%self.SP_Verbosity.value()
|
v=self.SP_toStr(self.SP_Tolerance)
|
||||||
if self.SP_Memory.value()!=0 : self.commande+=' -m %d'%self.SP_Memory.value()
|
self.commande+=",tolerance="+v
|
||||||
|
if self.CB_Ridge.isChecked()==False : self.commande+=",-nr"
|
||||||
|
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_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_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.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_Memory.value()!=0 : self.commande+=" -m %d"%self.SP_Memory.value()
|
||||||
|
|
||||||
self.commande+=" "+self.fichierIn
|
self.commande+=" "+self.fichierIn
|
||||||
return True
|
return True
|
||||||
@ -288,7 +478,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
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("text", "10.")
|
||||||
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)
|
||||||
@ -300,7 +490,6 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
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():
|
||||||
"""
|
"""
|
||||||
@ -314,3 +503,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
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2006-2013 EDF R&D
|
# Copyright (C) 2006-2013 EDF R&D
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
@ -34,10 +35,11 @@ def YamsLct(context):
|
|||||||
from PyQt4.QtGui import QFileDialog
|
from PyQt4.QtGui import QFileDialog
|
||||||
from PyQt4.QtGui import QMessageBox
|
from PyQt4.QtGui import QMessageBox
|
||||||
|
|
||||||
|
#prior test to avoid unnecessary user GUI work with ending crash
|
||||||
try :
|
try :
|
||||||
os.environ['DISTENE_LICENCE_FILE_FOR_YAMS']
|
os.environ['DISTENE_LICENCE_FILE_FOR_YAMS']
|
||||||
except:
|
except:
|
||||||
QMessageBox.warning(None,"Products","Distene's products are not installed")
|
QMessageBox.warning(None,"Products","Distene's product Yams is not installed.\nrequired environment variable:\nDISTENE_LICENCE_FILE_FOR_YAMS='/.../dlim8.var.sh'")
|
||||||
return
|
return
|
||||||
import monYamsPlugDialog
|
import monYamsPlugDialog
|
||||||
window=monYamsPlugDialog.getDialog()
|
window=monYamsPlugDialog.getDialog()
|
||||||
|