23288: [CEA 1626] Meshgems v2.3

This commit is contained in:
eap 2016-06-14 14:57:25 +03:00
parent aa58e0af13
commit 0f0bf7c728
6 changed files with 254 additions and 113 deletions

View File

@ -27,6 +27,7 @@ from MGCleanerPlugDialog_ui import Ui_MGCleanerPlugDialog
from MGCleanerMonViewText import MGCleanerMonViewText
from qtsalome import *
verbose = True
class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
"""
@ -41,7 +42,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
self.commande=""
self.num=1
self.__selectedMesh=None
# complex whith QResources: not used
# 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:
@ -66,8 +67,8 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
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 a rien par le clean
self.paramsFile= os.path.abspath(os.path.join(os.environ["HOME"],".MGCleaner.dat"))
self.LE_ParamsFile.setText(self.paramsFile)
self.LE_MeshFile.setText("")
@ -134,9 +135,9 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
try:
mydir=os.environ["SMESH_ROOT_DIR"]
except Exception:
QMessageBox.warning( self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
QMessageBox.warning(self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
return
maDoc=mydir+"/share/doc/salome/gui/SMESH/MGCleaner/index.html"
sgPyQt.helpContext(maDoc,"")
@ -230,38 +231,87 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
return
f.close()
def PBSaveHypPressed_risky(self):
"""
save hypothesis in Object Browser outside GEOM ou MESH
WARNING: at root of Object Browser is not politically correct
"""
import salome
if verbose: print("save hypothesis in Object Browser")
name = "MGCleaner"
#how ??? icon = "mesh_tree_hypo.png"
namei = "MGCleaner Parameters_%i" % self.num
datai = self.getResumeData(separator=" ; ")
myStudy = salome.myStudy
myBuilder = myStudy.NewBuilder()
#myStudy.IsStudyLocked()
myComponent = myStudy.FindComponent(name)
if myComponent == None:
print "myComponent not found, create"
myComponent = myBuilder.NewComponent(name)
AName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
AName.SetValue(name)
ACmt = myBuilder.FindOrCreateAttribute(myComponent, "AttributeComment")
ACmt.SetValue(name)
myObject = myBuilder.NewObject(myComponent)
AName = myBuilder.FindOrCreateAttribute(myObject, "AttributeName")
AName.SetValue(namei)
ACmt = myBuilder.FindOrCreateAttribute(myObject, "AttributeComment")
ACmt.SetValue(datai)
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
self.num += 1
if verbose: print("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai))
return True
def PBSaveHypPressed(self):
"""save hypothesis in Object Browser"""
"""
save hypothesis in Object Browser
bug: affichage ne marche pas si inclusion dans dans GEOM ou MESH depuis salome 730
"""
import salome
import SMESH
from salome.kernel import studyedit
from salome.smesh import smeshBuilder
#[PAL issue tracker:issue1871] Les nouveaux objets ne s'affichent pas dans SMESH
QMessageBox.warning(self, "Save", "waiting for fix: Object Browser will not display hypothesis")
if verbose: print("save hypothesis in Object Browser")
smesh = smeshBuilder.New(salome.myStudy)
maStudy=studyedit.getActiveStudy()
smesh.SetCurrentStudy(maStudy)
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" )
moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png")
#, comment = "HypothesisForRemeshing" )
monStudyBuilder=maStudy.NewBuilder()
monStudyBuilder.NewCommand()
newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
self.editor.setAttributeValue(newStudyIter, "AttributeName", "MGCleaner Parameters_"+str(self.num))
self.editor.setAttributeValue(newStudyIter, "AttributeComment", self.getResumeData(separator=" ; "))
name = "MGCleaner Parameters_%i" % self.num
self.editor.setAttributeValue(newStudyIter, "AttributeName", name)
data = self.getResumeData(separator=" ; ")
self.editor.setAttributeValue(newStudyIter, "AttributeComment", data)
"""
# example storing in notebook
import salome_notebook
notebook = salome_notebook.notebook
notebook.set("MGCleaner_%i" % self.num, data)
"""
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
self.num+=1
self.num += 1
if verbose: print("save %s in Object Browser done:\n%s" % (name, data))
return True
"""
import salome_pluginsmanager
print "salome_pluginsmanager.plugins",salome_pluginsmanager.plugins
print "salome_pluginsmanager.current_plugins_manager",salome_pluginsmanager.current_plugins_manager
"""
def SP_toStr(self, widget):
"""only for a QLineEdit widget"""
#cr, pos=widget.validator().validate(res, 0) #n.b. "1,3" is acceptable !locale!
@ -452,6 +502,10 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
mySObject, myEntry = guihelper.getSObjectSelected()
if CORBA.is_nil(mySObject) or mySObject==None:
QMessageBox.critical(self, "Mesh", "select an input mesh")
#self.LE_MeshSmesh.setText("")
#self.MeshIn=""
#self.LE_MeshFile.setText("")
#self.fichierIn=""
return
self.smeshStudyTool = SMeshStudyTools()
try:
@ -533,6 +587,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
if not self.CB_ComputedOverlapDistance.isChecked(): #computed default
self.commande+=" --overlap_distance " + self.SP_toStr(self.SP_OverlapDistance)
self.commande+=" --overlap_angle " + str(self.SP_OverlapAngle.value())
if verbose: print("INFO: MGCCleaner command:\n %s" % self.commande)
return True
def clean(self):
@ -559,7 +614,7 @@ __dialog=None
def getDialog():
"""
This function returns a singleton instance of the plugin dialog.
c est obligatoire pour faire un show sans parent...
It is mandatory in order to call show without a parent ...
"""
global __dialog
if __dialog is None:
@ -609,3 +664,4 @@ if __name__ == "__main__":
TEST_MGCleanerMonPlugDialog()
#TEST_standalone()
pass

View File

@ -19,9 +19,13 @@
#
# Modules Python
import string,types,os,sys
import os
import sys
import string
import types
import tempfile
import traceback
import pprint as PP #pretty print
from qtsalome import *
@ -29,6 +33,13 @@ from qtsalome import *
from MGCleanerViewText_ui import Ui_ViewExe
verbose = True
force = os.getenv("FORCE_DISTENE_LICENSE_FILE")
if force != None:
os.environ["DISTENE_LICENSE_FILE"] = force
os.environ["DLIM8VAR"] = "NOTHING"
class MGCleanerMonViewText(Ui_ViewExe, QDialog):
"""
Classe permettant la visualisation de texte
@ -46,48 +57,50 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog):
self.monExe.readyReadStandardOutput.connect( self.readFromStdOut )
self.monExe.readyReadStandardError.connect( self.readFromStdErr )
# Je n arrive pas a utiliser le setEnvironment du QProcess
# fonctionne hors Salome mais pas dans Salome ???
cmds=''
'''
try :
LICENCE_FILE=os.environ["DISTENE_LICENCE_FILE_FOR_MGCLEANER"]
except:
LICENCE_FILE=''
try :
PATH=os.environ["DISTENE_PATH_FOR_MGCLEANER"]
except:
PATH=''
if LICENCE_FILE != '':
cmds+='source '+LICENCE_FILE+'\n'
else:
cmds+="# $DISTENE_LICENCE_FILE_FOR_MGCLEANER NOT SET\n"
if PATH != '':
cmds+='export PATH='+PATH+':$PATH\n'
else:
cmds+="# $DISTENE_PATH_FOR_MGCLEANER NOT SET\n"
#cmds+='env\n'
cmds+='rm -f '+self.parent().fichierOut+'\n'
'''
cmds+=txt+'\n'
cmds+='echo END_OF_MGCleaner\n'
ext=''
""" for test set environment
env = QProcessEnvironment().systemEnvironment()
env.insert("HELLO", "bonjour") #Add an environment variable for debug
self.monExe.setProcessEnvironment(env)
if verbose:
PP.pprint([str(i) for i in sorted(self.monExe.processEnvironment().toStringList()) if 'DISTENE' in i])
"""
cmds = ''
ext = ''
if sys.platform == "win32":
cmds += 'delete %s\n' % self.parent().fichierOut
ext = '.bat'
else:
ext = '.sh'
nomFichier=tempfile.mktemp(suffix=ext,prefix="MGCleaner_")
f=open(nomFichier,'w')
f.write(cmds)
f.close()
cmds += '#!/bin/bash\n'
cmds += 'pwd\n'
#cmds += 'which mg-cleaner.exe\n'
cmds += 'echo "DISTENE_LICENSE_FILE="$DISTENE_LICENSE_FILE\n'
cmds += 'echo "DLIM8VAR="$DLIM8VAR\n'
cmds += 'rm -f %s\n' % self.parent().fichierOut
ext = '.bash'
maBidouille=nomFichier
self.monExe.start(maBidouille)
cmds += 'echo %s\n' % txt #to see what is compute command
cmds += txt+'\n'
cmds += 'echo "END_OF_MGCleaner"\n'
nomFichier = os.path.splitext(self.parent().fichierOut)[0] + ext
with open(nomFichier, 'w') as f:
f.write(cmds)
self.make_executable(nomFichier)
if verbose: print("INFO: MGCleaner launch script file: %s" % nomFichier)
self.monExe.start(nomFichier)
self.monExe.closeWriteChannel()
self.enregistreResultatsDone=False
self.show()
def make_executable(self, path):
mode = os.stat(path).st_mode
mode |= (mode & 0o444) >> 2 # copy R bits to X
os.chmod(path, mode)
def saveFile(self):
#recuperation du nom du fichier
savedir=os.environ['HOME']

View File

@ -34,11 +34,14 @@ def MGCleanerLct(context):
#prior test to avoid unnecessary user GUI work with ending crash
try :
os.environ['DISTENE_LICENCE_FILE_FOR_MGCLEANER']
os.environ['DISTENE_LICENSE_FILE']
except:
QMessageBox.warning(None,"Products","Distene's product MeshGem Cleaner is not installed.\nrequired environment variable:\nDISTENE_LICENCE_FILE_FOR_MGCLEANER='/.../dlim8.var.sh'")
QMessageBox.warning(None, "Products", """\
Distene's product MeshGem Cleaner is not installed.
required environment variable:
DISTENE_LICENSE_FILE='.../dlim8.var.sh'""")
return
import MGCleanerMonPlugDialog
window=MGCleanerMonPlugDialog.getDialog()
window = MGCleanerMonPlugDialog.getDialog()
window.show()

View File

@ -18,17 +18,26 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# Modules Python
import string,types,os, sys
import traceback
import os
import sys
import string
import types
import tempfile
import traceback
import pprint as PP #pretty print
from qtsalome import *
# Import des panels
from ViewText_ui import Ui_ViewExe
verbose = True
force = os.getenv("FORCE_DISTENE_LICENSE_FILE")
if force != None:
os.environ["DISTENE_LICENSE_FILE"] = force
os.environ["DLIM8VAR"] = "NOTHING"
class MonViewText(Ui_ViewExe, QDialog):
"""
Classe permettant la visualisation de texte
@ -45,33 +54,40 @@ class MonViewText(Ui_ViewExe, QDialog):
self.monExe.readyReadStandardOutput.connect( self.readFromStdOut )
self.monExe.readyReadStandardError.connect( self.readFromStdErr )
# Je n arrive pas a utiliser le setEnvironment du QProcess
# fonctionne hors Salome mais pas dans Salome ???
cmds=''
#cmds+='#! /usr/bin/env python\n'
#cmds+='# -*- coding: utf-8 -*-\n'
cmds+=txt+'\n'
cmds+='echo "END_OF_Yams"\n'
if os.path.exists(self.parent().fichierOut):
os.remove(self.parent().fichierOut)
ext=''
cmds = ''
ext = ''
if sys.platform == "win32":
ext = '.bat'
cmds += 'delete %s\n' % self.parent().fichierOut
else:
ext = '.sh'
cmds += '#!/bin/bash\n'
cmds += 'pwd\n'
#cmds += 'which mg-surfopt.exe\n'
cmds += 'echo "DISTENE_LICENSE_FILE="$DISTENE_LICENSE_FILE\n'
cmds += 'echo "DLIM8VAR="$DLIM8VAR\n'
cmds += 'rm -f %s\n' % self.parent().fichierOut
ext = '.bash'
nomFichier=tempfile.mktemp(suffix=ext,prefix='Yams_')
f=open(nomFichier,'w')
f.write(cmds)
f.close()
maBidouille=nomFichier
self.monExe.start(maBidouille)
cmds += 'echo %s\n' % txt #to see what is compute command
cmds += txt+'\n'
cmds += 'echo "END_OF_MGSurfOpt"\n'
nomFichier = os.path.splitext(self.parent().fichierOut)[0] + ext
with open(nomFichier, 'w') as f:
f.write(cmds)
self.make_executable(nomFichier)
if verbose: print("INFO: MGSurfOpt launch script file: %s" % nomFichier)
self.monExe.start(nomFichier)
self.monExe.closeWriteChannel()
self.enregistreResultatsDone=False
self.show()
def make_executable(self, path):
mode = os.stat(path).st_mode
mode |= (mode & 0o444) >> 2 # copy R bits to X
os.chmod(path, mode)
def saveFile(self):
#recuperation du nom du fichier
savedir=os.environ['HOME']
@ -94,7 +110,7 @@ class MonViewText(Ui_ViewExe, QDialog):
a=self.monExe.readAllStandardOutput()
aa=unicode(a.data(),len(a))
self.TB_Exe.append(aa)
if "END_OF_Yams" in aa:
if "END_OF_MGSurfOpt" in aa:
self.parent().enregistreResultat()
self.enregistreResultatsDone=True
#self.theClose()

View File

@ -27,6 +27,8 @@ from YamsPlugDialog_ui import Ui_YamsPlugDialog
from monViewText import MonViewText
from qtsalome import *
verbose = True
class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
"""
"""
@ -47,7 +49,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
# iconfolder=os.path.dirname(os.path.abspath(__file__))
self.iconfolder=os.environ["SMESH_ROOT_DIR"]+"/share/salome/resources/smesh"
#print "monYamsPlugDialog iconfolder",iconfolder
#print "MGSurfOptPlugDialog iconfolder",iconfolder
icon = QIcon()
icon.addFile(os.path.join(self.iconfolder,"select1.png"))
self.PB_LoadHyp.setIcon(icon)
@ -66,12 +68,12 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
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"))
#Ces parametres ne sont pas remis a rien par le clean
self.paramsFile= os.path.abspath(os.path.join(os.environ["HOME"],".MGSurfOpt.dat"))
self.LE_ParamsFile.setText(self.paramsFile)
self.LE_MeshFile.setText("")
self.LE_MeshSmesh.setText("")
v1=QDoubleValidator(self)
v1.setBottom(0.)
#v1.setTop(1000.) #per thousand... only if relative
@ -103,7 +105,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
def PBHelpPressed(self):
import SalomePyQt
sgPyQt = SalomePyQt.SalomePyQt()
try :
try:
mydir=os.environ["SMESH_ROOT_DIR"]
except Exception:
QMessageBox.warning(self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
@ -146,7 +148,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
else:
initialMeshObject=maStudy.FindObjectByName(name ,"SMESH")[0]
meshname = name+"_YAMS_"+str(self.num)
meshname = name+"_MGSO_"+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
@ -158,7 +160,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
monStudyBuilder=maStudy.NewBuilder()
monStudyBuilder.NewCommand()
newStudyIter=monStudyBuilder.NewObject(HypReMeshEntry)
self.editor.setAttributeValue(newStudyIter, "AttributeName", "YAMS Parameters_"+str(self.num))
self.editor.setAttributeValue(newStudyIter, "AttributeName", "MGSurfOpt Parameters_"+str(self.num))
self.editor.setAttributeValue(newStudyIter, "AttributeComment", self.getResumeData(separator=" ; "))
SOMesh=maStudy.FindObjectByName(meshname ,"SMESH")[0]
@ -183,7 +185,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
def PBSavePressed(self):
from datetime import datetime
if not(self.PrepareLigneCommande()): return
text = "# YAMS hypothesis parameters\n"
text = "# MGSurfOpt 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"
@ -202,30 +204,78 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
return
f.close()
def PBSaveHypPressed_risky(self):
"""
save hypothesis in Object Browser outside GEOM ou MESH
WARNING: at root of Object Browser is not politically correct
"""
import salome
if verbose: print("save hypothesis in Object Browser")
name = "MGSurfOpt"
#how ??? icon = "mesh_tree_hypo.png"
namei = "MGSurfOpt Parameters_%i" % self.num
datai = self.getResumeData(separator=" ; ")
myStudy = salome.myStudy
myBuilder = myStudy.NewBuilder()
#myStudy.IsStudyLocked()
myComponent = myStudy.FindComponent(name)
if myComponent == None:
print "myComponent not found, create"
myComponent = myBuilder.NewComponent(name)
AName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
AName.SetValue(name)
ACmt = myBuilder.FindOrCreateAttribute(myComponent, "AttributeComment")
ACmt.SetValue(name)
myObject = myBuilder.NewObject(myComponent)
AName = myBuilder.FindOrCreateAttribute(myObject, "AttributeName")
AName.SetValue(namei)
ACmt = myBuilder.FindOrCreateAttribute(myObject, "AttributeComment")
ACmt.SetValue(datai)
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
self.num += 1
if verbose: print("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai))
return True
def PBSaveHypPressed(self):
"""save hypothesis in Object Browser"""
"""
save hypothesis in Object Browser
bug: affichage ne marche pas si inclusion dans dans GEOM ou MESH depuis salome 730
"""
import salome
import SMESH
from salome.kernel import studyedit
from salome.smesh import smeshBuilder
#[PAL issue tracker:issue1871] Les nouveaux objets ne s'affichent pas dans SMESH
QMessageBox.warning(self, "Save", "waiting for fix: Object Browser will not display hypothesis")
if verbose: print("save hypothesis in Object Browser")
smesh = smeshBuilder.New(salome.myStudy)
maStudy=studyedit.getActiveStudy()
smesh.SetCurrentStudy(maStudy)
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" )
moduleEntry, name = "Plugins Hypotheses", icon="mesh_tree_hypo.png")
#, comment = "HypothesisForRemeshing" )
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=" ; "))
name = "MGSurfOpt Parameters_%i" % self.num
self.editor.setAttributeValue(newStudyIter, "AttributeName", name)
data = self.getResumeData(separator=" ; ")
self.editor.setAttributeValue(newStudyIter, "AttributeComment", data)
if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(0)
self.num+=1
self.num += 1
if verbose: print("save %s in Object Browser done:\n%s" % (name, data))
return True
def SP_toStr(self, widget):
@ -315,7 +365,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
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+"'")
QMessageBox.warning(self, "load MGSurfOpt Hypothesis", "Problem on '"+lig+"'")
def PBLoadPressed(self):
"""load last hypothesis saved in tail of file"""
@ -334,7 +384,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
def PBLoadHypPressed(self):
"""load hypothesis saved in Object Browser"""
#QMessageBox.warning(self, "load Object Browser YAMS hypothesis", "TODO")
#QMessageBox.warning(self, "load Object Browser MGSurfOpt hypothesis", "TODO")
import salome
from salome.kernel import studyedit
from salome.smesh.smeshstudytools import SMeshStudyTools
@ -343,14 +393,14 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
mySObject, myEntry = guihelper.getSObjectSelected()
if CORBA.is_nil(mySObject) or mySObject==None:
QMessageBox.critical(self, "Hypothese", "select an Object Browser YAMS hypothesis")
QMessageBox.critical(self, "Hypothese", "select an Object Browser MGSurfOpt hypothesis")
return
text=mySObject.GetComment()
#a verification
if "Optimisation=" not in text:
QMessageBox.critical(self, "Load Hypothese", "Object Browser selection not a YAMS Hypothesis")
QMessageBox.critical(self, "Load Hypothese", "Object Browser selection not a MGSurfOptHypothesis")
return
self.loadResumeData(text, separator=" ; ")
return
@ -406,11 +456,11 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
mySObject, myEntry = guihelper.getSObjectSelected()
if CORBA.is_nil(mySObject) or mySObject==None:
#QMessageBox.critical(self, "Mesh", "select an input mesh")
self.LE_MeshSmesh.setText("")
self.MeshIn=""
self.LE_MeshFile.setText("")
self.fichierIn=""
QMessageBox.critical(self, "Mesh", "select an input mesh")
#self.LE_MeshSmesh.setText("")
#self.MeshIn=""
#self.LE_MeshFile.setText("")
#self.fichierIn=""
return
self.smeshStudyTool = SMeshStudyTools()
try:
@ -518,7 +568,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
self.SP_MinSize.setProperty("value", 5)
self.SP_Verbosity.setProperty("value", 3)
self.SP_Memory.setProperty("value", 0)
self.PBMeshSmeshPressed()
#self.PBMeshSmeshPressed() #do not that! problem if done in load surfopt hypo from object browser
self.TWOptions.setCurrentIndex(0) # Reset current active tab to the first tab
__dialog=None
@ -530,8 +580,8 @@ def getDialog():
global __dialog
if __dialog is None:
__dialog = MonYamsPlugDialog()
else :
__dialog.clean()
#else :
# __dialog.clean()
return __dialog
#

9
src/Tools/YamsPlug/yamsplug_plugin.py Normal file → Executable file
View File

@ -34,10 +34,13 @@ def YamsLct(context):
#prior test to avoid unnecessary user GUI work with ending crash
try :
os.environ['DISTENE_LICENCE_FILE_FOR_YAMS']
os.environ['DISTENE_LICENSE_FILE']
except:
QMessageBox.warning(None,"Products","Distene's product Yams is not installed.\nrequired environment variable:\nDISTENE_LICENCE_FILE_FOR_YAMS='/.../dlim8.var.sh'")
QMessageBox.warning(None,"Products","""\
Distene's product MeshGem SurfOpt (formerly Yams) is not installed.
required environment variable:
DISTENE_LICENSE_FILE='.../dlim8.var.sh'""")
return
import monYamsPlugDialog
window=monYamsPlugDialog.getDialog()
window = monYamsPlugDialog.getDialog()
window.show()