Zcracks plugin adaptation to new Zcracks tool

This commit is contained in:
Paul RASCLE 2016-11-24 19:00:44 +01:00
parent a3b465189d
commit 1746a46194
32 changed files with 14504 additions and 31 deletions

View File

@ -17,19 +17,43 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
IF(SALOME_BUILD_DOC)
ADD_SUBDIRECTORY(doc)
ENDIF(SALOME_BUILD_DOC)
ADD_SUBDIRECTORY(casTests)
INCLUDE(UsePyQt)
# --- scripts ---
# scripts / static
SET(plugin_SCRIPTS
zcracks_plugin.py
__init__.py
ellipse.py
genereCrack.py
images_rc.py
main.py
output.py
rectangle.py
sphere.py
utilityFunctions.py
zcracks_plugin.py
Zset.py
)
SET(command_SCRIPTS
zcracksLaunch.py
)
# --- resources ---
# uic files / to be processed by pyuic
SET(_pyuic_files
zcracks.ui
)
# scripts / pyuic wrappings
PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS})
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/Zcracks)
SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/Zcracks)
SALOME_INSTALL_SCRIPTS("${command_SCRIPTS}" ${SALOME_INSTALL_BINS})

View File

@ -0,0 +1,140 @@
import os, tempfile, shutil
import utilityFunctions as uF
from output import message
def medToGeo(medFile, geoFile, tmpdir, opt=[], verbose=0):
medLoc=os.path.dirname(medFile)
medName=os.path.basename(medFile)
inpFile=os.path.join(tmpdir,'import.inp')
zfile = open(inpFile,'w')
zfile.write('****mesher\n')
zfile.write(' ***mesh %s\n' %(geoFile.replace('.geo','')+'.geo'))
zfile.write(' **import med %s\n' %medName)
for x in opt:
zfile.write(x+'\n')
zfile.write('****return\n')
zfile.close()
commande='cd %s; Zrun -m %s' %(medLoc,inpFile)
if verbose!=0: commande+=' >> %s' %os.path.join(tmpdir,'log.msg')
res=os.system(commande)
return(res)
#os.remove(inpFile)
def geoToMed(medFile, geoFile, tmpdir, opt=[], verbose=0):
medLoc=os.path.dirname(medFile)
medName=os.path.basename(medFile)
inpFile=os.path.join(tmpdir,'export.inp')
zfile = open(inpFile,'w')
zfile.write('****mesher\n')
zfile.write(' ***mesh\n')
zfile.write(' **open %s\n' %geoFile)
for x in opt:
zfile.write(x+'\n')
zfile.write(' **export med %s\n' %medName)
zfile.write('****return\n')
zfile.close()
commande='cd %s; Zrun -m %s' %(medLoc,inpFile)
if verbose!=0: commande+=' >> %s' %os.path.join(tmpdir,'log.msg')
res=os.system(commande)
#print ' -------- '
#print res
#print ' -------- '
return(res)
def launchZcrack(minS, maxS,
saneN, crackN, crackedN,
grad, quad, extrL,
nbLay, nbIter,
Gvol, Gfac, Gedg, Gnod,
surfOpt, tmpdir, cas2D, refine, verbose=0, ):
zfile = open(os.path.join(tmpdir,'insert.z7p'),'w')
zfile.write(' #include <Zcracks_base.z7p> \n')
zfile.write(' int main()\n{\n')
zfile.write(' init_var();\n')
if cas2D==True:
zfile.write(' if_2D=1;\n')
zfile.write(' thickness.resize(1);\n')
zfile.write(' thickness[0]=-1.;\n')
zfile.write(' format="geo";\n')
zfile.write(' gradation=%e;\n' %grad)
zfile.write(' min_size= %e;\n' %minS)
zfile.write(' max_size=%e;\n' %maxS)
zfile.write(' nb_velem=%d;\n' %(nbLay*2))
zfile.write(' nb_iter=%d;\n' %nbIter)
zfile.write(' sane_name="%s";\n' %saneN.replace('.geo',''))
#zfile.write(' crack_name="%s";\n' %crackN.replace('.geo',''))
zfile.write(' convert_surface("%s");\n' %crackN.replace('.geo',''))
zfile.write(' cracked_name="%s";\n' %crackedN.replace('.geo',''))
if Gfac!='': zfile.write(' faset_names="%s";\n' %(Gfac[0] if type(Gfac)==list else Gfac))
if Gnod!='': zfile.write(' nset_names="%s";\n' %(Gnod[0] if type(Gnod)==list else Gnod))
if Gvol!='': zfile.write(' elset_names="%s";\n' %(Gvol[0] if type(Gvol)==list else Gvol))
if Gedg!='': zfile.write(' liset_names="%s";\n' %(Gedg[0] if type(Gedg)==list else Gedg))
if surfOpt!='':
zfile.write(' yams_options="%s";\n' %surfOpt)
if refine: zfile.write(' if_must_refine=1;\n')
if extrL<=1.E-12:
zfile.write(' if_must_define_elset=0;\n')
else:
zfile.write(' if_must_define_elset=1;\n')
if extrL==[]:
zfile.write(' elset_radius=%e;\n' %maxS)
else:
zfile.write(' elset_radius=%e;\n' %extrL)
zfile.write(' nice_cut(20.0);\n}\n\n')
zfile.close()
commande='Zrun -zp %s' %(os.path.join(tmpdir,'insert.z7p'))
if verbose!=0: commande+=' >> %s' %os.path.join(tmpdir,'log.msg')
res=os.system(commande)
#print ' -------- '
#print res
#print ' -------- '
return(res)
def insertCrack(data, names, tmpdir='./zcracks_temp', verbose=0):
saneN=names['saneGeoName']
crackN=names['crackGeoName']
crackedN=names['crackedGeoName']
minS=data['minSize'][0]
maxS=data['maxSize'][0]
extrL=data['extractLength'][0]
grad = data['gradation'][0] if 'gradation' in data.keys() else 1.3
quad = data['quad'] if 'quad' in data.keys() else False
cas2D = data['is2D'] if 'is2D' in data.keys() else False
refine = data['refine'] if 'refine' in data.keys() else False
nbLay = data['layers'][0] if 'layers' in data.keys() else 5
nbIter = data['iterations'][0] if 'iterations' in data.keys() else 2
Gvol = data['grVol'] if 'grVol' in data.keys() else ''
Gfac = data['grFace'] if 'grFace' in data.keys() else ''
Gedg = data['grEdge'] if 'grEdge' in data.keys() else ''
Gnod = data['grNodes'] if 'grNodes' in data.keys() else ''
surfOpt = data['surfopt'] if 'surfopt' in data.keys() else ''
if not os.path.isdir(tmpdir): os.mkdir(tmpdir)
curDir=os.getcwd()
os.chdir(tmpdir)
res=launchZcrack(minS, maxS, saneN, crackN, crackedN,grad, quad, extrL,
nbLay, nbIter,Gvol, Gfac, Gedg, Gnod,surfOpt, tmpdir, cas2D, refine, verbose)
os.chdir(curDir)
return(res)
#def TUI(data, names, tmpdir='./zcracks_temp', verbose=0)

View File

@ -0,0 +1,76 @@
import sys, os, shutil, pickle, tempfile
import main, genereCrack, Zset
import utilityFunctions as uF
#commande="/bin/bash -c ""source $HOME/zebulon/Z8.6.6_NEW/do_config_bash"""
#os.system(commande)
def IHM():
try:
from PyQt5.QtWidgets import QApplication
except:
from PyQt4.QtGui import QApplication
app = QApplication(sys.argv)
myapp = main.ShipHolderApplication()
myapp.show()
sys.exit(app.exec_())
def SCRIPT(dataFile=None, data=None, dim=3, names=None):
if dim!=3 and dim!=2:
print 'ERROR'
return(False)
if dataFile==None and data==None:
print 'One of dataFile or data is mandatory'
return(False)
if data==None: data=pickle.load(open(dataFile,'r'))
print data
tmpdir=tempfile.mkdtemp()
uF.removeFromSessionPath('LD_LIBRARY_PATH', 'Meshgems-2111')
if names==None: names={'saneGeoName':'salome_sane', 'crackGeoName':'salome_crack', 'crackedGeoName':'salome_cracked'}
crackedMed=data['crackedName']
crackMed=os.path.join(tmpdir,'crackMed.med')
saneMed=data['saneName']
saneGeo=os.path.join(tmpdir,names['saneGeoName']+'.geo')
crackGeo=os.path.join(tmpdir,names['crackGeoName']+'.geo')
crackedGeo=os.path.join(tmpdir,names['crackedGeoName']+'.geo')
for f in [crackMed, crackedMed, saneGeo, crackGeo, crackedGeo]:
if os.path.isfile(f): os.remove(f)
print crackMed
genereCrack.main(data, crackMed)
goOn=os.path.isfile(crackMed)
if goOn: Zset.medToGeo(crackMed, crackGeo, tmpdir)
goOn=os.path.isfile(crackGeo)
if dim==3:
if goOn: Zset.medToGeo(saneMed,saneGeo, tmpdir)
elif dim==2:
if goOn: Zset.medToGeo(saneMed,saneGeo, tmpdir, opt=[' **to_3d'])
goOn=os.path.isfile(saneGeo)
if goOn: Zset.insertCrack(data, names, tmpdir)
goOn=os.path.isfile(crackedGeo)
if goOn: Zset.geoToMed(crackedMed, crackedGeo, tmpdir)
goOn=os.path.isfile(crackedMed)
if goOn: maxAR=uF.extendElsets(crackedMed)
shutil.rmtree(tmpdir)
return([os.path.isfile(crackedMed), maxAR])

View File

@ -0,0 +1,32 @@
# Copyright (C) 2012-2016 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# --- scripts ---
# scripts / static
SET(plugin_SCRIPTS
__init__.py
genereCube.py
launchCas.py
launchManuel.py
)
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/Zcracks/casTests)

View File

@ -0,0 +1,197 @@
# -*- coding: utf-8 -*-
###
### This file is generated automatically by SALOME v7.7.0 with dump python functionality
###
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
###
### GEOM component
###
#L = 1.
#N = 20 #Nombre d elements sur un cote
def cube3D(L, N, outFile):
N=int(N)
from salome.geom import geomBuilder
geompy = geomBuilder.New(theStudy)
eps=L*1.e-6
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
cube = geompy.MakeBoxDXDYDZ(L, L, L)
geompy.TranslateDXDYDZ(cube, -L/2., -L/2., -L/2.)
epais=1./(2.*N)
larg=L*1.1
boxX = geompy.MakeBoxDXDYDZ(epais, larg, larg)
geompy.TranslateDXDYDZ(boxX, -epais/2., -larg/2., -larg/2.)
boxXM = geompy.TranslateDXDYDZ(boxX, -L/2., 0., 0., theCopy=True)
boxXP = geompy.TranslateDXDYDZ(boxX, L/2., 0., 0., theCopy=True)
boxY = geompy.MakeBoxDXDYDZ(larg, epais, larg)
geompy.TranslateDXDYDZ(boxY, -larg/2., -epais/2., -larg/2.)
boxYM = geompy.TranslateDXDYDZ(boxY, 0., -L/2., 0., theCopy=True)
boxYP = geompy.TranslateDXDYDZ(boxY, 0., L/2., 0., theCopy=True)
boxZ = geompy.MakeBoxDXDYDZ(larg, larg, epais)
geompy.TranslateDXDYDZ(boxZ, -larg/2., -larg/2., -epais/2.)
boxZM = geompy.TranslateDXDYDZ(boxZ, 0., 0., -L/2., theCopy=True)
boxZP = geompy.TranslateDXDYDZ(boxZ, 0., 0., L/2., theCopy=True)
box = geompy.MakeBoxDXDYDZ(larg, larg, larg)
boxXPLUS = geompy.TranslateDXDYDZ(box, 0., -larg/2., -larg/2., theCopy=True)
boxXMOIN = geompy.TranslateDXDYDZ(box, -larg, -larg/2., -larg/2., theCopy=True)
boxYPLUS = geompy.TranslateDXDYDZ(box, -larg/2., 0., -larg/2., theCopy=True)
boxYMOIN = geompy.TranslateDXDYDZ(box, -larg/2., -larg, -larg/2., theCopy=True)
boxZPLUS = geompy.TranslateDXDYDZ(box, -larg/2., -larg/2., 0., theCopy=True)
boxZMOIN = geompy.TranslateDXDYDZ(box, -larg/2., -larg/2., -larg, theCopy=True)
from salome.smesh import smeshBuilder
import SMESH
smesh = smeshBuilder.New(theStudy)
Nb_Segments_1 = smesh.CreateHypothesis('NumberOfSegments')
Nb_Segments_1.SetNumberOfSegments( N )
Length_From_Edges_1 = smesh.CreateHypothesis('LengthFromEdges')
Regular_1D = smesh.CreateHypothesis('Regular_1D')
NETGEN_2D_ONLY = smesh.CreateHypothesis('NETGEN_2D_ONLY', 'NETGENEngine')
Hexa_3D = smesh.CreateHypothesis('Hexa_3D')
Maillage_1 = smesh.Mesh(cube)
status = Maillage_1.AddHypothesis(Nb_Segments_1)
status = Maillage_1.AddHypothesis(Regular_1D)
Quadrangle_2D = Maillage_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
status = Maillage_1.AddHypothesis(Hexa_3D)
isDone = Maillage_1.Compute()
geometries = [boxXPLUS, boxXMOIN, boxYPLUS, boxYMOIN, boxZPLUS, boxZMOIN]
noms = ['VOLXP', 'VOLXM', 'VOLYP', 'VOLYM', 'VOLZP', 'VOLZM']
for cont, geo in enumerate(geometries):
aCriteria = smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined, geo)
aFilter_1 = smesh.GetFilterFromCriteria([aCriteria])
aFilter_1.SetMesh(Maillage_1.GetMesh())
VOLUME_temp = Maillage_1.GroupOnFilter( SMESH.VOLUME, noms[cont], aFilter_1 )
nbAdded, Maillage_1, Group = Maillage_1.MakeBoundaryElements( SMESH.BND_2DFROM3D, '', '', 0, [ VOLUME_temp ])
geometries = [boxX, boxXM, boxXP,
boxY, boxYM, boxYP,
boxZ, boxZM, boxZP]
noms = ['FACEX', 'FACEXM', 'FACEXP',
'FACEY', 'FACEYM', 'FACEYP',
'FACEZ', 'FACEZM', 'FACEZP']
for cont, geo in enumerate(geometries):
aCriteria = smesh.GetCriterion(SMESH.FACE,SMESH.FT_BelongToGeom,SMESH.FT_Undefined, geo)
aFilter_1 = smesh.GetFilterFromCriteria([aCriteria])
aFilter_1.SetMesh(Maillage_1.GetMesh())
FACE_temp = Maillage_1.GroupOnFilter( SMESH.FACE, noms[cont], aFilter_1 )
Maillage_1.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1)
#if salome.sg.hasDesktop():
#salome.sg.updateObjBrowser(1)
def cube2D(L, N, outFile):
N=int(N)
from salome.geom import geomBuilder
geompy = geomBuilder.New(theStudy)
eps=L*1.e-6
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
face = geompy.MakeFaceHW(L, L, 1)
epais=1./(2.*N)
larg=L*1.1
boxX = geompy.MakeBoxDXDYDZ(epais, larg, epais)
geompy.TranslateDXDYDZ(boxX, -epais/2., -larg/2., -epais/2.)
boxXM = geompy.TranslateDXDYDZ(boxX, -L/2., 0., 0., theCopy=True)
boxXP = geompy.TranslateDXDYDZ(boxX, L/2., 0., 0., theCopy=True)
boxY = geompy.MakeBoxDXDYDZ(larg, epais, epais)
geompy.TranslateDXDYDZ(boxY, -larg/2., -epais/2., -epais/2.)
boxYM = geompy.TranslateDXDYDZ(boxY, 0., -L/2., 0., theCopy=True)
boxYP = geompy.TranslateDXDYDZ(boxY, 0., L/2., 0., theCopy=True)
box = geompy.MakeBoxDXDYDZ(larg, larg, epais)
boxXPLUS = geompy.TranslateDXDYDZ(box, 0., -larg/2., -epais/2., theCopy=True)
boxXMOIN = geompy.TranslateDXDYDZ(box, -larg, -larg/2., -epais/2., theCopy=True)
boxYPLUS = geompy.TranslateDXDYDZ(box, -larg/2., 0., -epais/2., theCopy=True)
boxYMOIN = geompy.TranslateDXDYDZ(box, -larg/2., -larg, -epais/2., theCopy=True)
from salome.smesh import smeshBuilder
import SMESH
smesh = smeshBuilder.New(theStudy)
Nb_Segments_1 = smesh.CreateHypothesis('NumberOfSegments')
Nb_Segments_1.SetNumberOfSegments( N )
Length_From_Edges_1 = smesh.CreateHypothesis('LengthFromEdges')
Regular_1D = smesh.CreateHypothesis('Regular_1D')
NETGEN_2D_ONLY = smesh.CreateHypothesis('NETGEN_2D_ONLY', 'NETGENEngine')
Maillage_1 = smesh.Mesh(face)
status = Maillage_1.AddHypothesis(Nb_Segments_1)
status = Maillage_1.AddHypothesis(Regular_1D)
Quadrangle_2D = Maillage_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
isDone = Maillage_1.Compute()
geometries = [boxXPLUS, boxXMOIN, boxYPLUS, boxYMOIN]
noms = ['FACEXP', 'FACEXM', 'FACEYP', 'FACEYM']
for cont, geo in enumerate(geometries):
aCriteria = smesh.GetCriterion(SMESH.FACE,SMESH.FT_BelongToGeom,SMESH.FT_Undefined, geo)
aFilter_1 = smesh.GetFilterFromCriteria([aCriteria])
aFilter_1.SetMesh(Maillage_1.GetMesh())
FACE_temp = Maillage_1.GroupOnFilter( SMESH.FACE, noms[cont], aFilter_1 )
nbAdded, Maillage_1, Group = Maillage_1.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ FACE_temp ])
geometries = [boxX, boxXM, boxXP, boxY, boxYM, boxYP]
noms = ['EDGEX', 'EDGEXM', 'EDGEXP', 'EDGEY', 'EDGEYM', 'EDGEYP']
for cont, geo in enumerate(geometries):
aCriteria = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_BelongToGeom,SMESH.FT_Undefined, geo)
aFilter_1 = smesh.GetFilterFromCriteria([aCriteria])
aFilter_1.SetMesh(Maillage_1.GetMesh())
EDGE_temp = Maillage_1.GroupOnFilter( SMESH.EDGE, noms[cont], aFilter_1 )
Maillage_1.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1)
#if salome.sg.hasDesktop():
#salome.sg.updateObjBrowser(1)

View File

@ -0,0 +1,277 @@
from Zcracks import genereCrack, Zset
from Zcracks import utilityFunctions as uF
import genereCube
from math import sqrt
if False:
import Zcracks
from Zcracks import casTests
from Zcracks.casTests import launchCas
launchCas.LAUNCH(['10'])
import os, shutil
import tempfile
import string
#tmpdir = "/local00/home/B27118/projets/Zcracks/Zcracks/casTests/tmpdir"
#if not os.path.isdir(tmpdir): os.mkdir(tmpdir)
tmpdir=tempfile.mktemp(prefix='tmpZcracks')
print "tmpdir=", tmpdir
meshgemsdir=os.environ('MESHGEMSHOME')
if len(meshgemsdir) > 0:
meshgems=string.split(meshgemsdir,os.sep)[-1]
uF.removeFromSessionPath('LD_LIBRARY_PATH', meshgems)
def LAUNCH(listCas=[]):
if type(listCas)!=list: listCas=[listCas]
N=20
L=1.
te=L/N
offset=te/2.
genereCube.cube3D(L, N, os.path.join(tmpdir,'cube3D.med'))
genereCube.cube2D(L, N, os.path.join(tmpdir,'cube2D.med'))
crack={}
synthese={}
# -------- #
# CAS 2D #
# -------- #
data={'minSize':[te/10.], 'maxSize':[te], 'extractLength':[2.*te], 'is2D':True, 'crack':crack,
'grEdge':['EDGEXP EDGEXM EDGEYP EDGEYM']}
cas='1'
crack['actif']='Ellipse'
crack[crack['actif']]={'Rayon':[L/2.], 'Centre':[L/2., offset, 0.], 'Normale':[0., 1., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
cas='2'
crack['actif']='Ellipse'
crack[crack['actif']]={'Rayon':[L], 'Centre':[L/2., 0., 0.], 'Normale':[1., 1., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
cas='3'
crack['actif']='Ellipse'
crack[crack['actif']]={'Rayon':[L*sqrt(2.)], 'Centre':[-L/2., L/2., 0.], 'Normale':[1., 1., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
cas='4'
crack['actif']='Ellipse'
crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[0., offset, 0.], 'Normale':[0., 1., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
data['grFace']=['FACEXM FACEXP']
cas='5'
crack['actif']='Ellipse'; crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[0., offset, 0.], 'Normale':[0., 1., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
cas='6'
crack['actif']='Ellipse'
crack[crack['actif']]={'Rayon':[L/8.], 'Centre':[-L/16., offset, 0.], 'Normale':[0., 1., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
data['grFace']=['']
cas='7'
crack['actif']='Sphere'
crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[0., 0., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
cas='8'
crack['actif']='Sphere'
crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[L/2., 0., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
data['grFace']=['FACEXM FACEXP']
cas='9'
crack['actif']='Sphere'
crack['Sphere']={'Rayon':[L/4.], 'Centre':[0., 0., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute2D(data, cas)
# -------- #
# CAS 3D #
# -------- #
data['grEdge']=['']
data['grFace']=['FACEXP FACEXM FACEYP FACEYM FACEZP FACEZM']
data['is2D']=False
cas='10'
crack['actif']='Rectangle'
crack[crack['actif']]={'Centre':[L/2., offset, 0.], 'Normale':[0., 1., 0.], 'Direction':[1., 0., 0.], 'Longueur':[L/2.], 'Largeur':[L]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
cas='11'
crack['actif']='Sphere'
crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[0., 0., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
cas='12'
crack['actif']='Ellipse'
crack[crack['actif']]={'Centre':[L/4., L/4., L/4.], 'Normale':[1., 1., 1.], 'Rayon':[L]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
cas='13'
crack['actif']='Sphere'
crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[L/2., 0., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
cas='14'
crack['actif']='Ellipse'
crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[L/2., offset, 0.], 'Normale':[0., 1., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
cas='15'
crack['actif']='Rectangle'
crack[crack['actif']]={'Centre':[L/2., 0., 0.], 'Normale':[0., 1., 0.], 'Direction':[-1., 0., 0.],
'Longueur':[L/2.], 'Largeur':[L], 'Rayon entaille':[te*1.5]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
cas='16'
crack['actif']='Rectangle'
crack[crack['actif']]={'Centre':[L/2., offset, 0.], 'Normale':[0., 1., 0.], 'Direction':[1., 0., 0.],
'Longueur':[L/2.], 'Largeur':[L/4.], 'Rayon':[2.*te]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
cas='17'
crack['actif']='Rectangle'
crack[crack['actif']]={'Centre':[0., offset, 0.], 'Normale':[0., 1., 0.], 'Direction':[1., 0., 0.],
'Longueur':[L/4.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
cas='18'
crack['actif']='Rectangle'
crack[crack['actif']]={'Centre':[0., 0., 0.], 'Normale':[1., 1., 0.], 'Direction':[1., -1., 0.],
'Longueur':[L], 'Angle':[180.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
data['grVol']=['VOLYP VOLYM']
cas='19'
crack['actif']='Rectangle'
crack[crack['actif']]={'Centre':[0., 0., 0.], 'Normale':[0., 1., 0.], 'Direction':[1., 0., 0.],
'Longueur':[L], 'Angle':[180.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
data['grVol']=['VOLXP VOLXM']
cas='20'
crack['actif']='Sphere'
crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[0., 0., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
data['grVol']=['VOLYP VOLYM']
cas='21'
crack['actif']='Ellipse'
crack[crack['actif']]={'Rayon':[L/4.], 'Centre':[L/2., offset, 0.], 'Normale':[0., 1., 0.]}
if cas in listCas or listCas==[]:
synthese[cas]=execute3D(data, cas)
OK=[]
NOOK=[]
for s in synthese.keys():
if synthese[s]:
OK.append(s)
else:
NOOK.append(s)
print 'OK:'
print OK
print ' '
print 'NOOK:'
print NOOK
print ' '
return(synthese)
def execute3D(data, cas):
names={'saneGeoName':'cube3D', 'crackGeoName':'crack'+cas, 'crackedGeoName':'cracked'+cas}
crackMed=os.path.join(tmpdir,'crack'+cas+'.med')
crackedMed=os.path.join(tmpdir,'cracked'+cas+'.med')
saneGeo=os.path.join(tmpdir,names['saneGeoName'],'.geo')
crackGeo=os.path.join(tmpdir,names['crackGeoName'],'.geo')
crackedGeo=os.path.join(tmpdir,names['crackedGeoName'],'.geo')
for f in [crackMed, crackedMed, saneGeo, crackGeo, crackedGeo]:
if os.path.isfile(f): os.remove(f)
genereCrack.main(data, crackMed)
Zset.medToGeo(os.path.join(tmpdir,names['saneGeoName']),names['saneGeoName'], tmpdir)
Zset.medToGeo(crackMed, names['crackGeoName'], tmpdir)
Zset.insertCrack(data, names, tmpdir)
shutil.copy(os.path.join(tmpdir,'_mesh_out_to_ghs3d.mesh'),os.path.join(tmpdir,'mesh'+cas+'.mesh'))
shutil.copy(os.path.join(tmpdir,'insert.z7p'),os.path.join(tmpdir,'insert'+cas+'.z7p'))
Zset.geoToMed(crackedMed, names['crackedGeoName'], tmpdir)
if os.path.isfile(crackedMed):
uF.extendElsets(crackedMed)
maxAR=uF.getMaxAspectRatio(tmpdir)
return(maxAR<30. and maxAR>=1.)
else:
return(False)
def execute2D(data, cas):
names={'saneGeoName':'cube2D', 'crackGeoName':'crack'+cas, 'crackedGeoName':'cracked'+cas}
crackMed=os.path.join(tmpdir,'crack'+cas+'.med')
crackedMed=os.path.join(tmpdir,'cracked'+cas+'.med')
saneGeo=os.path.join(tmpdir,names['saneGeoName'],'.geo')
crackGeo=os.path.join(tmpdir,names['crackGeoName'],'.geo')
crackedGeo=os.path.join(tmpdir,names['crackedGeoName'],'.geo')
for f in [crackMed, crackedMed, saneGeo, crackGeo, crackedGeo]:
if os.path.isfile(f): os.remove(f)
genereCrack.main(data, crackMed)
Zset.medToGeo(os.path.join(tmpdir,names['saneGeoName']),names['saneGeoName'], tmpdir, opt=[' **to_3d'])
Zset.medToGeo(crackMed, names['crackGeoName'], tmpdir)
Zset.insertCrack(data, names, tmpdir)
shutil.copy(os.path.join(tmpdir,'_mesh_out_.mesh'),os.path.join(tmpdir,'mesh'+cas+'.mesh'))
shutil.copy(os.path.join(tmpdir,'insert.z7p'),os.path.join(tmpdir,'insert'+cas+'.z7p'))
Zset.geoToMed(crackedMed, names['crackedGeoName'], tmpdir)
if os.path.isfile(crackedMed):
uF.extendElsets(crackedMed)
maxAR=uF.getMaxAspectRatio(tmpdir)
return(maxAR<30. and maxAR>=1.)
else:
return(False)

View File

@ -0,0 +1,27 @@
import os, tempfile
directory=tempfile.mktemp(prefix='tmpZcracks')
print "directory=", tmpdir
# Tous les cas
listCas=['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21']
# Cas sans les aretes ou faces sur la fissure :
listCas=['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','20']
synthese={}
for cas in listCas:
result=os.path.join(directory,'cracked'+cas+'.geo')
if os.path.isfile(result): os.remove(result)
try:
os.remove(os.path.join(directory,'cracked'+cas+'.geo'))
except:
pass
os.system('cd '+directory+';Zrun -zp insert'+cas+'.z7p')
synthese[cas]= os.path.isfile(result)
print synthese

View File

@ -0,0 +1,202 @@
# -*- coding: utf-8 -*-
###
### This file is generated automatically by SALOME v7.7.1 with dump python functionality
###
import sys, numpy
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
import utilityFunctions as uF
from output import message
#ellipse.generate(data_demi_grand_axe, data_centre, data_normale,data_direction, data_demi_petit_axe, data_angle, rayon_entaille,extension, outFile)
#if True:
#data_demi_grand_axe = 2.
#data_centre = [0., 0., 0.]
#data_normale = [1., 0., 0.]
#data_direction = [0., 1., 0.]
#data_demi_petit_axe = 1.
#data_angle=180.
#rayon_entaille=0.1
#extension=0.1
#outFile='/home/I60976/00_PROJETS/2015_INTEGRATION_ZCRACKS/zcracks_salome/test.med'
def generate(data_demi_grand_axe, data_centre, data_normale,
data_direction, data_demi_petit_axe, data_angle,
rayon_entaille, extension, outFile):
Vnormale, Vdirection, Vortho = uF.calcCoordVectors(data_normale, data_direction)
Vcentre = numpy.array(data_centre)
geompy = geomBuilder.New(theStudy)
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
CENTRE = geompy.MakeVertex(Vcentre[0], Vcentre[1], Vcentre[2])
NORMALE = geompy.MakeVectorDXDYDZ(Vnormale[0], Vnormale[1], Vnormale[2])
DIRECTION = geompy.MakeVectorDXDYDZ(Vdirection[0], Vdirection[1], Vdirection[2])
DIRECTION_op = geompy.MakeVectorDXDYDZ(-Vdirection[0], -Vdirection[1], -Vdirection[2])
V3 = geompy.MakeVectorDXDYDZ(Vortho[0], Vortho[1], Vortho[2])
V3_op = geompy.MakeVectorDXDYDZ(-Vortho[0], -Vortho[1], -Vortho[2])
if data_demi_grand_axe >= data_demi_petit_axe:
ELLIPSE = geompy.MakeEllipse(CENTRE, NORMALE, data_demi_grand_axe, data_demi_petit_axe, DIRECTION)
else:
ELLIPSE = geompy.MakeEllipse(CENTRE, NORMALE, data_demi_petit_axe, data_demi_grand_axe, V3)
if rayon_entaille<1.e-12:
FELLIPSE = geompy.MakeFaceWires([ELLIPSE], 1)
dim=2
else:
dim=3
VP1=Vcentre+Vdirection*(data_demi_grand_axe-rayon_entaille)+Vnormale*rayon_entaille
VP2=Vcentre+Vdirection*(data_demi_grand_axe)
VP3=Vcentre+Vdirection*(data_demi_grand_axe-rayon_entaille)-Vnormale*rayon_entaille
PE1=geompy.MakeVertex(VP1[0], VP1[1], VP1[2])
PE2=geompy.MakeVertex(VP2[0], VP2[1], VP2[2])
PE3=geompy.MakeVertex(VP3[0], VP3[1], VP3[2])
ARC = geompy.MakeArc(PE1, PE2, PE3)
TUYAU = geompy.MakePipe(ARC, ELLIPSE)
subShapesList=geompy.GetFreeBoundary(TUYAU)[1]
entailleFace1 = geompy.MakeFaceWires([subShapesList[0]], 1)
entailleFace2 = geompy.MakeFaceWires([subShapesList[1]], 1)
FELLIPSE = geompy.MakeShell([TUYAU, entailleFace1, entailleFace2])
edgesIDs = geompy.SubShapeAllIDs(FELLIPSE, geompy.ShapeType["EDGE"])
edges = geompy.CreateGroup(FELLIPSE, geompy.ShapeType["EDGE"])
geompy.UnionIDs(edges, edgesIDs)
geompy.addToStudy( FELLIPSE, 'FELLIPSE' )
geompy.addToStudyInFather( FELLIPSE , edges, 'edges' )
hauteur=numpy.max([data_demi_grand_axe,data_demi_petit_axe])*1.1
eps=1.E-05
bool_boite=True
extrusion=numpy.max([1.,rayon_entaille])*1.1
if ( (data_angle>(eps)) and (data_angle<(180.-eps)) ):
rayon2=hauteur*numpy.tan(data_angle*numpy.pi/180./2.)
B1=geompy.MakeTranslationVectorDistance(CENTRE,DIRECTION,hauteur)
B2=geompy.MakeTranslationVectorDistance(B1,V3,rayon2)
geompy.TranslateVectorDistance(B1,V3_op,rayon2, False)
LB01 = geompy.MakeLineTwoPnt(CENTRE, B1)
LB02 = geompy.MakeLineTwoPnt(CENTRE, B2)
LB12 = geompy.MakeLineTwoPnt(B1, B2)
plan_BOITE = geompy.MakeFaceWires([LB01, LB02, LB12], True)
BOITE = geompy.MakePrismVecH2Ways(plan_BOITE, NORMALE, extrusion)
FACE_FISSURE = geompy.MakeCommonList([FELLIPSE, BOITE])
elif ( (data_angle>=(180.-eps)) and (data_angle<=(180.+eps)) ):
VP1=Vcentre+Vortho*hauteur
VP2=Vcentre-Vortho*hauteur
VP3=Vcentre-Vortho*hauteur+Vdirection*hauteur
VP4=Vcentre+Vortho*hauteur+Vdirection*hauteur
Sommet_1 = geompy.MakeVertex(VP1[0], VP1[1], VP1[2])
Sommet_2 = geompy.MakeVertex(VP2[0], VP2[1], VP2[2])
Sommet_3 = geompy.MakeVertex(VP3[0], VP3[1], VP3[2])
Sommet_4 = geompy.MakeVertex(VP4[0], VP4[1], VP4[2])
Ligne_1 = geompy.MakeLineTwoPnt(Sommet_1, Sommet_2)
Ligne_2 = geompy.MakeLineTwoPnt(Sommet_2, Sommet_3)
Ligne_3 = geompy.MakeLineTwoPnt(Sommet_3, Sommet_4)
Ligne_4 = geompy.MakeLineTwoPnt(Sommet_4, Sommet_1)
Contour_1 = geompy.MakeWire([Ligne_1, Ligne_2, Ligne_3, Ligne_4], 1e-07)
Face_1 = geompy.MakeFaceWires([Contour_1], 1)
BOITE = geompy.MakePrismVecH2Ways(Face_1, NORMALE, extrusion)
FACE_FISSURE = geompy.MakeCommonList([FELLIPSE, BOITE])
elif ( (data_angle>(180.+eps)) and (data_angle<(360.-eps)) ):
rayon2=hauteur*numpy.tan((360.-data_angle)*numpy.pi/180./2.)
B1=geompy.MakeTranslationVectorDistance(CENTRE,DIRECTION_op,hauteur)
B2=geompy.MakeTranslationVectorDistance(B1,V3,rayon2)
geompy.TranslateVectorDistance(B1,V3_op,rayon2, False)
LB01 = geompy.MakeLineTwoPnt(CENTRE, B1)
LB02 = geompy.MakeLineTwoPnt(CENTRE, B2)
LB12 = geompy.MakeLineTwoPnt(B1, B2)
plan_BOITE = geompy.MakeFaceWires([LB01, LB02, LB12], True)
extrusion=numpy.max([1.,rayon_entaille])*1.1
BOITE = geompy.MakePrismVecH2Ways(plan_BOITE, NORMALE, extrusion)
FACE_FISSURE = geompy.MakeCutList(FELLIPSE, [BOITE])
elif ( (data_angle<=(eps)) or (data_angle>=(360.-eps)) ):
bool_boite=False
FACE_FISSURE = FELLIPSE
else:
message('E','Angle non prevu')
if bool_boite:
#geompy.addToStudy( BOITE, 'BOITE' )
newEdgesIDs = geompy.SubShapeAllIDs(FACE_FISSURE, geompy.ShapeType["EDGE"])
newEdges = geompy.CreateGroup(FACE_FISSURE, geompy.ShapeType["EDGE"])
geompy.UnionIDs(newEdges, newEdgesIDs)
[oldEdges] = geompy.RestoreGivenSubShapes(FACE_FISSURE, [FELLIPSE, edges], GEOM.FSM_GetInPlace, True, False)
toExtrude = geompy.CutListOfGroups([newEdges], [oldEdges])
if extension>1.e-12:
extrusion = geompy.MakePrismVecH(toExtrude, DIRECTION_op, extension)
try:
FACE_FISSURE = geompy.MakeFuseList([FACE_FISSURE, extrusion], False, True)
except:
FACE_FISSURE = geompy.MakeFuseList([FACE_FISSURE, extrusion], False, False)
#geompy.addToStudy( FACE_FISSURE, 'FACE_FISSURE' )
#geompy.addToStudy( FACE_FISSURE, 'FACE_FISSURE' )
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
A=numpy.pi/(30.)
minAxes=numpy.min([data_demi_grand_axe,data_demi_petit_axe])
maxAxes=numpy.max([data_demi_grand_axe,data_demi_petit_axe])
R=minAxes**2/maxAxes
if rayon_entaille>1.e-12:
R=numpy.min([R,rayon_entaille])
A=numpy.pi/(15.)
chordal, minSize = uF.calcElemSize(A, R)
maxSize=maxAxes/5.
Maillage=uF.meshCrack(FACE_FISSURE, minSize, maxSize, chordal, dim)
try:
Maillage.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1)
smesh.SetName(Maillage.GetMesh(), 'MAILLAGE_FISSURE')
except:
print 'ExportToMEDX() failed. Invalid file name?'
## Set names of Mesh objects
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)

View File

@ -0,0 +1,235 @@
import os, shutil
import sphere, ellipse, rectangle
import utilityFunctions as uF
from output import message
def main(data, outFile):
activeCrack=data['crack']['actif']
crack=data['crack'][activeCrack]
res=False
if activeCrack == 'Ellipse':
res=generateEllipse(crack, outFile)
elif activeCrack == 'Rectangle':
res=generateRectangle(crack, outFile)
elif activeCrack == 'Sphere':
res=generateSphere(crack, outFile)
elif activeCrack == 'Custom':
res=generateCustom(crack, outFile)
return(res)
def generateEllipse(crack, outFile):
res=True
test=uF.testStrictRange(crack['Rayon'])
if not test:
message('E','Bad Rayon',goOn=True)
res=False
demiGrandAxe=crack['Rayon'][0]
if 'Rayon 2' not in crack.keys(): crack['Rayon 2']=[]
if len(crack['Rayon 2'])==0:
demiPetitAxe=demiGrandAxe
else:
test=uF.testStrictRange(crack['Rayon 2'])
if not test:
message('E','Bad Rayon 2',goOn=True)
res=False
demiPetitAxe=crack['Rayon 2'][0]
test=uF.test3dVector(crack['Centre'])
if not test:
message('E','Invalid Centre',goOn=True)
res=False
centre=crack['Centre']
test=uF.test3dVector(crack['Normale'])
if not test:
message('E','Invalid Normale',goOn=True)
res=False
normale=crack['Normale']
if 'Direction' not in crack.keys(): crack['Direction']=[]
if len(crack['Direction'])==0:
if normale==[1.,0.,0.]:
direction=[0.,1.,0.]
else:
direction=[1.,0.,0.]
else:
test=uF.test3dVector(crack['Direction'])
if not test:
message('E','Invalid Direction',goOn=True)
res=False
direction=crack['Direction']
test=(direction!=normale)
if not test:
message('E','Normale and Direction are equals',goOn=True)
res=False
if 'Angle' not in crack.keys(): crack['Angle']=[]
if len(crack['Angle'])==0:
angle=0.0
else:
test=uF.testRange(crack['Angle'], inf=0.0, sup=360.)
if not test:
message('E','Angle not valid or out of range 0 to 360',goOn=True)
res=False
angle=crack['Angle'][0]
if 'Rayon entaille' not in crack.keys(): crack['Rayon entaille']=[]
if len(crack['Rayon entaille'])==0:
rayon_entaille=0.0
else:
test=uF.testStrictRange(crack['Rayon entaille'], inf=0.0)
if not test:
message('E','rayon entaille not valid or negative',goOn=True)
res=False
rayon_entaille=crack['Rayon entaille'][0]
if 'Extension' not in crack.keys(): crack['Extension']=[]
if len(crack['Extension'])==0:
extension=0.0
else:
test=uF.testStrictRange(crack['Extension'], inf=0.0)
if not test:
message('E','extension not valid or negative',goOn=True)
res=False
extension=crack['Extension'][0]
if res:
ellipse.generate(demiGrandAxe, centre, normale,
direction, demiPetitAxe, angle,
rayon_entaille, extension, outFile)
return(True)
else:
return(False)
def generateRectangle(crack, outFile):
res=True
test=uF.testStrictRange(crack['Longueur'])
if not test:
message('E','Bad Longueur',goOn=True)
res=False
longueur=crack['Longueur'][0]
if 'Largeur' not in crack.keys(): crack['Largeur']=[]
if len(crack['Largeur'])==0:
largeur=longueur
else:
test=uF.testStrictRange(crack['Largeur'])
if not test:
message('E','Bad Largeur',goOn=True)
res=False
largeur=crack['Largeur'][0]
test=uF.test3dVector(crack['Centre'])
if not test:
message('E','Invalid Centre',goOn=True)
res=False
centre=crack['Centre']
test=uF.test3dVector(crack['Normale'])
if not test:
message('E','Invalid Normale',goOn=True)
res=False
normale=crack['Normale']
test=uF.test3dVector(crack['Direction'])
if not test:
message('E','Invalid Direction',goOn=True)
res=False
direction=crack['Direction']
if 'Angle' not in crack.keys(): crack['Angle']=[]
if len(crack['Angle'])==0:
angle=0.0
else:
test=uF.testRange(crack['Angle'], inf=0.0, sup=360.)
if not test:
message('E','Angle not valid or out of range 0 to 360',goOn=True)
res=False
angle=crack['Angle'][0]
if 'Rayon' not in crack.keys(): crack['Rayon']=[]
if len(crack['Rayon'])==0:
rayon=0.0
else:
test=uF.testRange(crack['Rayon'], inf=0.0)
if not test:
message('E','Rayon not valid',goOn=True)
res=False
rayon=crack['Rayon'][0]
if 'Rayon entaille' not in crack.keys(): crack['Rayon entaille']=[]
if len(crack['Rayon entaille'])==0:
rayon_entaille=0.0
else:
test=uF.testStrictRange(crack['Rayon entaille'], inf=0.0)
if not test:
message('E','rayon entaille not valid or negative',goOn=True)
res=False
rayon_entaille=crack['Rayon entaille'][0]
if res:
rectangle.generate(longueur,largeur,centre,
normale,direction,angle,
rayon,rayon_entaille,outFile)
return(True)
else:
return(False)
def generateSphere(crack, outFile):
res=True
test=uF.testStrictRange(crack['Rayon'])
if not test:
message('E','Bad Rayon',goOn=True)
res=False
rayon=crack['Rayon'][0]
test=uF.test3dVector(crack['Centre'])
if not test:
message('E','Invalid Centre',goOn=True)
res=False
centre=crack['Centre']
if res:
sphere.generate(rayon,centre,outFile)
return(True)
else:
return(False)
def generateCustom(crack, outFile):
res=True
test=os.path.isfile(crack['med file'])
if not test:
message('E','crack med file missing',goOn=True)
res=False
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
([Maillage_1], status) = smesh.CreateMeshesFromMED(crack['med file'])
isCrack=False
for group in Maillage_1.GetGroups():
if [group.GetType(), group.GetName()]==[SMESH.NODE, 'crack']: isCrack=True
if isCrack:
shutil.copy(crack['med file'],outFile)
else:
Group_1 = Maillage_1.CreateEmptyGroup( SMESH.NODE, 'crack' )
nbAdd = Group_1.AddFrom( Maillage_1.GetMesh() )
Maillage_1.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1)
return(True)

View File

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="newPrefix">
<file>images/schema_shpere.png</file>
<file>images/schema_ellipse.png</file>
<file>images/schema_rectangle.png</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,614 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="Sphere.svg"
inkscape:export-filename="/home/I60976/00_PROJETS/2015_INTEGRATION_ZCRACKS/zcracks_salome/zcracks/schema_shpere.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120">
<defs
id="defs4">
<linearGradient
id="linearGradient5382">
<stop
style="stop-color:#fafafa;stop-opacity:1;"
offset="0"
id="stop5384" />
<stop
style="stop-color:#c8c8c8;stop-opacity:1;"
offset="1"
id="stop5386" />
</linearGradient>
<linearGradient
id="linearGradient3936"
osb:paint="solid">
<stop
style="stop-color:#c8c8c8;stop-opacity:1;"
offset="0"
id="stop3938" />
</linearGradient>
<marker
inkscape:stockid="TriangleOutM"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutM"
style="overflow:visible">
<path
id="path3769"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
transform="scale(0.4)" />
</marker>
<marker
inkscape:stockid="Arrow1Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Mend"
style="overflow:visible;">
<path
id="path3632"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
transform="scale(0.4) rotate(180) translate(10,0)" />
</marker>
<marker
inkscape:stockid="TriangleOutL"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutL"
style="overflow:visible">
<path
id="path3766"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
transform="scale(0.8)" />
</marker>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
<inkscape:perspective
id="perspective3606"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4086"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4132"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4535"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4557"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4603"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4634"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4665"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4706"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4739"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4770"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4803"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4901"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4901-5"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4936"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4966"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5738"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5917"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5942"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5973"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2986"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3805"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3830"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3854"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3879"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3901"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3932"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3954"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3991"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4022"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4055"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4101"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4166"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4196"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4277"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4299"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4321"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4352"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4375"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4406"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4433"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4457"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4479"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4501"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4525"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4565"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4592"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5382"
id="linearGradient5390"
x1="-87.023003"
y1="396.36218"
x2="199.02299"
y2="396.36218"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="378.27599"
inkscape:cy="705.2372"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="984"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
showguides="true"
inkscape:guide-bbox="true">
<inkscape:grid
type="xygrid"
id="grid2816"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.1px"
spacingy="0.1px" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<flowRoot
xml:space="preserve"
id="flowRoot4106"
style="fill:black;stroke:none;stroke-opacity:1;stroke-width:1px;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:40px"><flowRegion
id="flowRegion4108"><rect
id="rect4110"
width="53.92857"
height="46.785713"
x="532.14288"
y="124.50504" /></flowRegion><flowPara
id="flowPara4112" /></flowRoot> <path
sodipodi:type="arc"
style="fill:url(#linearGradient5390);fill-opacity:1;stroke:#000000;stroke-width:1.27201962;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3148"
sodipodi:cx="56"
sodipodi:cy="396.36218"
sodipodi:rx="142.38699"
sodipodi:ry="88"
d="m 198.38699,396.36218 a 142.38699,88 0 1 1 -284.773983,0 142.38699,88 0 1 1 284.773983,0 z"
transform="matrix(0.61803397,0,0,1,461.3901,32)" />
<path
transform="matrix(0.28092452,0,0,1,480.26823,32)"
style="fill:none;stroke:#000000;stroke-width:1.88671005;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m -86.386993,396.36218 c -3e-6,-48.60105 64.074131,-82 142.386989,-88 l 7e-6,0"
id="path5392"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
sodipodi:type="arc"
style="fill:none;stroke:#000000;stroke-width:1.88671005;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path5396"
sodipodi:cx="56"
sodipodi:cy="396.36218"
sodipodi:rx="142.38699"
sodipodi:ry="88"
d="m 56.000004,484.36218 a 142.38699,88 0 1 1 -10e-7,-176"
transform="matrix(0,-0.28092452,1,0,99.637821,444.09396)"
sodipodi:start="1.5707963"
sodipodi:end="4.712389"
sodipodi:open="true" />
<path
sodipodi:open="true"
sodipodi:end="7.8539816"
sodipodi:start="4.712389"
transform="matrix(0,-0.28092452,1,0,99.637821,444.09396)"
d="m 56.000003,308.36218 a 142.38699,88 0 0 1 2e-6,176"
sodipodi:ry="88"
sodipodi:rx="142.38699"
sodipodi:cy="396.36218"
sodipodi:cx="56"
id="path5418"
style="fill:none;stroke:#969696;stroke-width:1.88671011000000011;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:5.66013033000000032, 5.66013033000000032;stroke-dashoffset:0"
sodipodi:type="arc" />
<path
sodipodi:type="arc"
style="fill:#007801;fill-opacity:1;stroke:none"
id="path5420"
sodipodi:cx="496"
sodipodi:cy="428.36218"
sodipodi:rx="8"
sodipodi:ry="8"
d="m 504,428.36218 a 8,8 0 1 1 -16,0 8,8 0 1 1 16,0 z"
transform="matrix(0.5,0,0,0.5,248,214.18109)" />
<flowRoot
xml:space="preserve"
id="flowRoot4114-1-4-2-7-6"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
transform="translate(-48.5625,356.46369)"
inkscape:export-filename="/home/I60976/00_PROJETS/2015_INTEGRATION_ZCRACKS/zcracks_salome/zcracks/schema_ellipse.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120"><flowRegion
id="flowRegion4116-2-6-0-3-7"><rect
id="rect4118-6-0-0-2-5"
width="199.28572"
height="108.21429"
x="528.57141"
y="35.933609" /></flowRegion><flowPara
id="flowPara4120-1-8-4-3-3"
style="font-size:12px;fill:#007800;fill-opacity:1"><flowSpan
style="font-weight:bold"
id="flowSpan3257-5">Centre</flowSpan></flowPara></flowRoot> <path
style="fill:none;stroke:#007800;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 502,406.36218 -6,22"
id="path4793-9-6"
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
inkscape:export-filename="/home/I60976/00_PROJETS/2015_INTEGRATION_ZCRACKS/zcracks_salome/zcracks/schema_ellipse.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#0000ff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 495.99998,428.36218 83,0"
id="path3596-2"
inkscape:export-filename="/home/I60976/00_PROJETS/2015_INTEGRATION_ZCRACKS/zcracks_salome/zcracks/schema_ellipse.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120" />
<path
inkscape:connector-curvature="0"
id="path4074-9"
d="m 584,428.36218 -6.92,4 0,-8 6.92,4 z"
style="fill:#0000ff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.8pt;marker-start:none"
inkscape:export-filename="/home/I60976/00_PROJETS/2015_INTEGRATION_ZCRACKS/zcracks_salome/zcracks/schema_ellipse.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120" />
<flowRoot
xml:space="preserve"
id="flowRoot4114-1-12"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
transform="translate(8.4375,375.46369)"
inkscape:export-filename="/home/I60976/00_PROJETS/2015_INTEGRATION_ZCRACKS/zcracks_salome/zcracks/schema_ellipse.png"
inkscape:export-xdpi="120"
inkscape:export-ydpi="120"><flowRegion
id="flowRegion4116-2-70"><rect
id="rect4118-6-93"
width="199.28572"
height="108.21429"
x="528.57141"
y="35.933609" /></flowRegion><flowPara
id="flowPara4120-1-6"
style="font-size:12px;font-weight:bold;fill:#0000ff;fill-opacity:1">Rayon</flowPara></flowRoot> <path
sodipodi:nodetypes="ccc"
inkscape:connector-curvature="0"
id="path5627"
d="m 536,428.36218 c 10e-6,48.60105 -17.99999,82 -39.99999,88 l 0,0"
style="fill:none;stroke:#000000;stroke-width:0.99999994;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.99999994;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 456,428.36218 c -10e-6,48.60105 17.99999,82 39.99999,88 l 0,0"
id="path5629"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
sodipodi:nodetypes="ccc"
inkscape:connector-curvature="0"
id="path5631"
d="m 535.99999,428.36218 c 0,-48.60105 -17.99999,-82 -39.99999,-88 l 0,0"
style="fill:none;stroke:#000000;stroke-width:0.99999994;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,514 @@
import sys, pickle, tempfile, shutil
from os import path, getpid, environ, remove, system
try:
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
except:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import utilityFunctions as uF
import genereCrack, Zset, output, zcracks_ui
from output import message, init
from zcracks_ui import Ui_Zui
# ---------------------
# FONCTIONS ANNEXES
# ---------------------
uF.removeFromSessionPath('LD_LIBRARY_PATH', 'Meshgems-2111')
def stringToFloat(string, typ=float):
if str(string).replace(' ','')=='':
out=[]
else:
out=map(typ, str(string).split())
return(out)
def addExtension(string, extension):
cond=True
strLen=len(string)
if strLen<1:
out=None
else:
start=0
lastPt=0
while cond:
res=string.find('.',start)
if res==-1:
cond=False
else:
lastPt=res
start=res+1
if strLen<=(lastPt+1+5) and lastPt!=0:
out=string[:(lastPt+1)]+extension.replace('.','')
else:
out=string+'.'+extension.replace('.','')
return(out)
# ----------------------------
# DEFINITION DE LA CLASSE
# ----------------------------
class ShipHolderApplication(QGroupBox):
def __init__(self, parent=None):
super (ShipHolderApplication, self).__init__(parent)
self.salomeVers=path.normpath(environ['ROOT_SALOME'])
self.salomeVers=path.split(self.salomeVers)[-1].split('V')[-1]
self.createWidgets()
self.data=dict()
self.GroupToLoad=None
self.ui.widget.setVisible(False)
self.tmpdir=tempfile.mkdtemp()
self.saneGeoName=path.join(self.tmpdir,'salome_sane.geo')
self.crackGeoName=path.join(self.tmpdir,'salome_crack.geo')
self.crackMedName=path.join(self.tmpdir,'salome_crack.med')
self.crackedGeoName=path.join(self.tmpdir,'cracked.geo')
global log
init(self.tmpdir)
self.verbose=1
#self.connect(self.ui.CBQuad, SIGNAL("toggled(bool)"),self.pressQuad)
#self.connect(self.ui.btReset, SIGNAL("clicked()"),self.pressReset)
#self.connect(self.ui.btCancel, SIGNAL("clicked()"),self.pressCancel)
#self.connect(self.ui.btApply, SIGNAL("clicked()"),self.pressApply)
#self.connect(self.ui.btApplyClose, SIGNAL("clicked()"),self.pressApplyClose)
#self.connect(self.ui.btLoad, SIGNAL("clicked()"),self.pressCharger)
#self.connect(self.ui.btSave, SIGNAL("clicked()"),self.pressSauver)
#self.connect(self.ui.btLoadCracked, SIGNAL("clicked()"),self.pressLoadCracked)
#self.connect(self.ui.btLoadSane, SIGNAL("clicked()"),self.pressLoadSane)
#self.connect(self.ui.btGrVol, SIGNAL("clicked()"),self.pressLoadGroupVOL)
#self.connect(self.ui.btGrFace, SIGNAL("clicked()"),self.pressLoadGroupFACE)
#self.connect(self.ui.btGrEdge, SIGNAL("clicked()"),self.pressLoadGroupEDGE)
#self.connect(self.ui.btGrNode, SIGNAL("clicked()"),self.pressLoadGroupNODE)
#self.connect(self.ui.btGrAll, SIGNAL("clicked()"),self.pressLoadGroupALL)
#self.connect(self.ui.btVisu, SIGNAL("clicked()"),self.pressVisu)
#self.connect(self.ui.CBAdvanced, SIGNAL("toggled(bool)"),self.pressAdvanced)
self.ui.CBQuad.toggled.connect(self.pressQuad)
self.ui.btReset.clicked.connect(self.pressReset)
self.ui.btCancel.clicked.connect(self.pressCancel)
self.ui.btApply.clicked.connect(self.pressApply)
self.ui.btApplyClose.clicked.connect(self.pressApplyClose)
self.ui.btLoad.clicked.connect(self.pressCharger)
self.ui.btSave.clicked.connect(self.pressSauver)
self.ui.btLoadCracked.clicked.connect(self.pressLoadCracked)
self.ui.btLoadSane.clicked.connect(self.pressLoadSane)
self.ui.btGrVol.clicked.connect(self.pressLoadGroupVOL)
self.ui.btGrFace.clicked.connect(self.pressLoadGroupFACE)
self.ui.btGrEdge.clicked.connect(self.pressLoadGroupEDGE)
self.ui.btGrNode.clicked.connect(self.pressLoadGroupNODE)
self.ui.btGrAll.clicked.connect(self.pressLoadGroupALL)
self.ui.btVisu.clicked.connect(self.pressVisu)
self.ui.CBAdvanced.toggled.connect(self.pressAdvanced)
self.lineEditTypes=[str, str, float,
float, float, str,
str, str, str,
float, int, int,
str]
self.lineEditNames=['crackedName','saneName','minSize',
'maxSize','extractLength','grVol',
'grFace','grEdge','grNodes',
'gradation','iterations','layers',
'surfopt']
self.lineEditObjects=[self.ui.valCrackedName,self.ui.valSaneName,self.ui.valMinSize,
self.ui.valMaxSize,self.ui.valExtractLength,self.ui.valGrVol,
self.ui.valGrFace,self.ui.valGrEdge,self.ui.valGrNode,
self.ui.valGradation,self.ui.valIterations,self.ui.valLayers,
self.ui.valSurfopt]
def createWidgets(self):
self.ui = Ui_Zui()
self.ui.setupUi(self)
# -----------------------------------
# FONCTIONS D'ACTIONS DES BOUTONS
# -----------------------------------
def pressQuad(self):
if self.ui.CBQuad.isChecked():
self.ui.CBBarsoum.setEnabled(True)
self.ui.valGradation.setText(QString('2.3'))
else:
self.ui.valGradation.setText(QString('1.3'))
self.ui.CBBarsoum.setChecked(False)
self.ui.CBBarsoum.setEnabled(False)
def pressReset(self):
for val in self.lineEditObjects:
val.clear()
self.ui.CBQuad.setChecked(False)
self.ui.CBBarsoum.setChecked(False)
nbOnglet=self.ui.tabWidget.count()
for iongl in range(nbOnglet):
onglet=self.ui.tabWidget.widget(iongl)
tab=onglet.findChildren(QTableWidget)[0]
for irow in range(tab.rowCount()):
if tab.item(irow,0) != None:
tab.item(irow,0).setText(QString(''))
self.ui.valGradation.setText(QString('1.3'))
self.ui.valLayers.setText(QString('5'))
self.ui.valIterations.setText(QString('2'))
self.ui.CBIs2D.setChecked(False)
self.ui.CBRefine.setChecked(False)
def pressApply(self):
message('M','\n\n -------------')
message('M',' Nouveau cas ')
message('M',' -------------')
message('M','Getting parameters and checking ...')
self.getParameters()
test=uF.check(self.data)
self.cleanTmpFiles()
if test:
message('M','Parameters checked and ready to go')
else:
message('E','Parameters checking failled',goOn=True)
return()
message('M','\nGenerating crack ...')
res=genereCrack.main(self.data, self.crackMedName)
if res:
message('M','Crack generated successfully')
else:
message('E','Crack generation failed',goOn=True)
return()
if self.ui.CBIs2D.isChecked():
res=Zset.medToGeo(self.data['saneName'],self.saneGeoName, self.tmpdir, verbose=self.verbose, opt=[' **to_3d'])
else:
res=Zset.medToGeo(self.data['saneName'],self.saneGeoName, self.tmpdir, verbose=self.verbose)
if res!=0:
message('E','medToGeo sane failed',goOn=True)
return()
#opt=['**elset crack *function 1.;','**elset elset0 *function 1.;']
res=Zset.medToGeo(self.crackMedName,self.crackGeoName, self.tmpdir, verbose=self.verbose)
if res!=0:
message('E','medToGeo crack failed',goOn=True)
return()
names={'saneGeoName':self.saneGeoName, 'crackGeoName':self.crackGeoName, 'crackedGeoName':self.crackedGeoName}
message('M','\nInserting crack ...')
res=Zset.insertCrack(self.data, names, self.tmpdir, verbose=self.verbose)
if res!=0:
message('E','Crack insertion failed',goOn=True)
return()
else:
message('M','Crack inserted successfully')
if self.ui.CBQuad.isChecked() and self.ui.CBBarsoum.isChecked():
message('M','\nSaving cracked mesh in quadratic with Barsoum elements...')
opt=[' **lin_to_quad',' **crack_3d_quarter_nodes',' *liset FRONT0']
res=Zset.geoToMed(self.data['crackedName'], names['crackedGeoName'], self.tmpdir, opt=opt, verbose=self.verbose)
elif self.ui.CBQuad.isChecked() and not self.ui.CBBarsoum.isChecked():
message('M','\nSaving cracked mesh in quadratic...')
opt=[' **lin_to_quad']
res=Zset.geoToMed(self.data['crackedName'], names['crackedGeoName'], self.tmpdir, opt=opt, verbose=self.verbose)
else:
message('M','\nSaving cracked mesh...')
res=Zset.geoToMed(self.data['crackedName'], names['crackedGeoName'], self.tmpdir, verbose=self.verbose)
uF.extendElsets(self.data['crackedName'])
if res==0:
message('M','Cracked mesh ready at : %s' %(self.data['crackedName']))
message('M','Maximal aspect ratio is %f' %(uF.getMaxAspectRatio(self.tmpdir)))
#message('M','medit %s/_mesh_out_to_ghs3d.mesh' %(self.tmpdir))
message('M','\n ----------------')
message('M',' Fin cas OK ')
message('M',' ----------------')
def pressApplyClose(self):
self.pressApply()
self.pressCancel()
def pressLoadCracked(self):
fileDiag = QFileDialog(self)
fileDiag.setFileMode(QFileDialog.AnyFile)
fileDiag.setNameFilters(["Parametres *.med (*.*med)","All files (*)"])
fileDiag.setViewMode(QFileDialog.List)
if fileDiag.exec_() :
fileNames = fileDiag.selectedFiles()
filedef = fileNames[0]
filedef = addExtension(str(filedef), 'med')
self.ui.valCrackedName.setText(QString(filedef))
def pressLoadSane(self):
fileDiag = QFileDialog(self)
fileDiag.setFileMode(QFileDialog.AnyFile)
fileDiag.setNameFilters(["Parametres *.med (*.*med)","All files (*)"])
fileDiag.setViewMode(QFileDialog.List)
if fileDiag.exec_() :
fileNames = fileDiag.selectedFiles()
filedef = fileNames[0]
self.ui.valSaneName.setText(QString(filedef))
def pressCharger(self):
fileDiag = QFileDialog(self)
fileDiag.setFileMode(QFileDialog.AnyFile)
fileDiag.setNameFilters(["Parametres *.dic (*.dic)","All files (*)"])
fileDiag.setViewMode(QFileDialog.List)
if fileDiag.exec_() :
fileNames = fileDiag.selectedFiles()
filedef = fileNames[0]
if not path.isfile(str(filedef)):
message('E','Invalid dic file')
self.data=pickle.load(open(str(filedef),'r'))
message('M','\nLoading parameters from %s' %str(filedef))
for cont, obj in enumerate(self.lineEditObjects):
if self.lineEditTypes[cont] in [float, int]:
obj.setText(QString(self.data['TXT'+self.lineEditNames[cont]]))
else:
obj.setText(QString(self.data[self.lineEditNames[cont]]))
self.ui.CBQuad.setChecked(True if 'quad' in self.data.keys() and self.data['quad'] else False)
self.ui.CBBarsoum.setChecked(True if 'barsoum' in self.data.keys() and self.data['barsoum'] else False)
self.ui.CBIs2D.setChecked(True if 'is2D' in self.data.keys() and self.data['is2D'] else False)
self.ui.CBRefine.setChecked(True if 'refine' in self.data.keys() and self.data['refine'] else False)
#if self.data['quad']: self.ui.CBQuad.setChecked(True)
#if self.data['barsoum']: self.ui.CBBarsoum.setChecked(True)
#if self.data['is2D']: self.ui.CBIs2D.setChecked(True)
#if self.data['refine']: self.ui.CBRefine.setChecked(True)
self.setTableParameters()
def pressSauver(self):
fileDiag = QFileDialog(self)
fileDiag.setFileMode(QFileDialog.AnyFile)
fileDiag.setNameFilters(["Parametres *.dic (*.dic)","All files (*)"])
fileDiag.setViewMode(QFileDialog.List)
if fileDiag.exec_() :
self.getParameters()
fileNames = fileDiag.selectedFiles()
filedef = fileNames[0]
pickle.dump(self.data, open(addExtension(str(filedef), 'dic'),'w'))
message('M','Saving parameters in %s' %addExtension(str(filedef), 'dic'))
def pressLoadGroupVOL(self):
try:
self.GroupToLoad='VOL'
self.loadGroups()
except:
message('E','Groups loading impossible',goOn=True)
def pressLoadGroupFACE(self):
try:
self.GroupToLoad='FACE'
self.loadGroups()
except:
message('E','Groups loading impossible',goOn=True)
def pressLoadGroupEDGE(self):
try:
self.GroupToLoad='EDGE'
self.loadGroups()
except:
message('E','Groups loading impossible',goOn=True)
def pressLoadGroupNODE(self):
try:
self.GroupToLoad='NODE'
self.loadGroups()
except:
message('E','Groups loading impossible',goOn=True)
def pressLoadGroupALL(self):
try:
self.GroupToLoad='ALL'
self.loadGroups()
except:
message('E','Groups loading impossible',goOn=True)
def pressAdvanced(self):
if self.ui.CBAdvanced.isChecked():
self.ui.widget.setVisible(True)
else:
self.ui.widget.setVisible(False)
def pressVisu(self):
meshFile1=path.join(self.tmpdir,'_mesh_out_to_ghs3d.mesh')
meshFile2=path.join(self.tmpdir,'_mesh_out_.mesh')
test1=path.isfile(meshFile1)
test2=path.isfile(meshFile2)
medit=path.join('$Z7PATH/PUBLIC/lib-Linux_64/Zmesh/bin/medit')
if not test1:
if not test2:
message('A','No mesh file to visualize')
else:
print medit+' %s' %meshFile2
system(medit+' %s' %meshFile2)
else:
print medit+' %s' %meshFile1
system(medit+' %s' %meshFile1)
return()
def pressCancel(self):
message('M','exiting Zcracks')
try:
shutil.rmtree(self.tmpdir)
except:
message('E','Impossible to delete %s' %self.tmpdir,goOn=True)
pass
exit()
# ---------------------------------
# FONCTIONS ANNEXES A LA CLASSE
# ---------------------------------
def getParameters(self):
for cont, name in enumerate(self.lineEditNames):
value=str(self.lineEditObjects[cont].text())
#print name
if self.lineEditTypes[cont] == float:
self.data['TXT'+name]=value
self.data[name]= stringToFloat(value)
elif self.lineEditTypes[cont] == int:
self.data['TXT'+name]=value
self.data[name]= stringToFloat(value, typ=int)
else:
self.data[name]=value
self.data['quad']=self.ui.CBQuad.isChecked()
self.data['barsoum']=self.ui.CBBarsoum.isChecked()
self.data['TXTcrack']=self.getTableParameters()
self.data['crack']=self.getTableParameters(str2float=True)
self.data['is2D']=self.ui.CBIs2D.isChecked()
self.data['refine']=self.ui.CBRefine.isChecked()
def getTableParameters(self, str2float=False):
nbOnglet=self.ui.tabWidget.count()
out=dict()
iOngletActif=self.ui.tabWidget.currentIndex()
ongletActif=False
for iongl in range(nbOnglet):
crack=dict()
onglet=self.ui.tabWidget.widget(iongl)
tab=onglet.findChildren(QTableWidget)[0]
for irow in range(tab.rowCount()):
label=tab.verticalHeaderItem(irow).text()
if tab.item(irow,0) is None:
crack[str(label)]=''
elif 'med file' in str(label):
crack[str(label)]=str(tab.item(irow,0).text())
else:
value=tab.item(irow,0).text()
if str2float:
crack[str(label)]=stringToFloat(value)
else:
crack[str(label)]=str(value)
out[str(self.ui.tabWidget.tabText(iongl))]=crack
if iongl==iOngletActif:
ongletActif=str(self.ui.tabWidget.tabText(iongl))
out['actif']=ongletActif
return(out)
def setTableParameters(self):
nbOnglet=self.ui.tabWidget.count()
#iOngletActif=self.ui.tabWidget.currentIndex()
for iongl in range(nbOnglet):
onglet=self.ui.tabWidget.widget(iongl)
tab=onglet.findChildren(QTableWidget)[0]
for irow in range(tab.rowCount()):
label=tab.verticalHeaderItem(irow).text()
if tab.item(irow,0) == None:
item = QTableWidgetItem()
tab.setItem(irow, 0, item)
tab.item(irow,0).setText(QString(self.data['TXTcrack'][str(self.ui.tabWidget.tabText(iongl))][str(label)]))
if str(self.ui.tabWidget.tabText(iongl)) == self.data['TXTcrack']['actif']:
self.ui.tabWidget.setCurrentWidget(onglet)
def loadGroups(self):
saneFile=str(self.ui.valSaneName.text())
message('I','Loading Sane mesh...')
if not path.isfile(saneFile):
message('E','Sane mesh med file is not valid')
else:
import SMESH, salome
#salome.salome_init()
theStudy = salome.myStudy
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
([objetSain], status) = smesh.CreateMeshesFromMED(saneFile)
groupsVOL, groupsFAC, groupsEDG, groupsNOD = '', '', '', ''
nGr=0
for group in objetSain.GetGroups():
if (self.GroupToLoad in ['VOL','ALL']) and (group.GetType()==SMESH.VOLUME):
groupsVOL+=group.GetName().replace(' ','')+" "
nGr+=1
if (self.GroupToLoad in ['FACE','ALL']) and (group.GetType()==SMESH.FACE):
groupsFAC+=group.GetName().replace(' ','')+" "
nGr+=1
if (self.GroupToLoad in ['EDGE','ALL']) and (group.GetType()==SMESH.EDGE):
groupsEDG+=group.GetName().replace(' ','')+" "
nGr+=1
if (self.GroupToLoad in ['NODE','ALL']) and (group.GetType()==SMESH.NODE):
groupsNOD+=group.GetName().replace(' ','')+" "
nGr+=1
if groupsVOL!='': self.ui.valGrVol.setText(groupsVOL)
if groupsFAC!='': self.ui.valGrFace.setText(groupsFAC)
if groupsEDG!='': self.ui.valGrEdge.setText(groupsEDG)
if groupsNOD!='': self.ui.valGrNode.setText(groupsNOD)
message('I','%d group(s) found' %nGr)
def cleanTmpFiles(self):
for f in [self.saneGeoName, self.crackGeoName, self.crackMedName, self.crackedGeoName]:
try:
remove(f)
except:
pass
# ---------------------------------
# LANCEMENT DE LA BOITE DE DIAG
# ---------------------------------

View File

@ -0,0 +1,53 @@
from subprocess import Popen
from os import remove, getpid, path
def init(tmpdir):
global log
log=output(tmpdir)
log.initialise()
def message(typ, message, goOn=False):
global log
log.message(typ,message,goOn)
class output():
def __init__(self, tmpDir, tmpFile='Messages.txt'):
self.tmpFile=path.join(tmpDir,tmpFile)
def initialise(self):
try:
remove(self.tmpFile)
except:
pass
f = open(self.tmpFile,'w')
f.write('\n ------------------------------\n')
f.write(' | BIENVENU DANS L\'INTERFACE |\n')
f.write(' | ZCRACKS DE SALOME |\n')
f.write(' | VERSION ALPHA |\n')
f.write(' ------------------------------\n\n')
f.close()
pid=getpid()
fenName='Zcracks message log'
proc = Popen(['xterm -T "%s" -e "tail -s 0.05 -f %s --pid=%d"' %(fenName,self.tmpFile,pid)], shell=True)
return()
def message(self, typ, message='', goOn=False):
fileName=self.tmpFile
f = open(fileName,'a')
if typ=='E':
f.write('ERROR: '+message+'\n')
#print 'ERROR: '+message
if not goOn:
exit()
elif typ in ['A','W']:
#print ARNING: '+message
f.write('WARNING: '+message+'\n')
elif typ in ['M','I']:
#print 'INFO: '+message
f.write(message+'\n')
f.close()

View File

@ -0,0 +1,6 @@
pyuic4 zcracks.ui -o zcracks_ui.py
pyrcc4 images.qrc -o images_rc.py
#pyuic5 zcracks.ui -o zcracks_ui.py
#pyrcc5 images.qrc -o images_rc.py

View File

@ -0,0 +1,226 @@
# -*- coding: utf-8 -*-
###
### This file is generated automatically by SALOME v7.7.1 with dump python functionality
###
import sys, numpy
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
import utilityFunctions as uF
from output import message
#import GEOM_Gen.ild
#rectangle.generate(data_longueur,data_largeur,data_centre,data_normale,data_direction,data_angle,data_rayon,rayon_entaille,extension,outFile)
def generate(data_longueur,data_largeur,data_centre,
data_normale,data_direction,data_angle,
data_rayon,rayon_entaille,outFile):
#data_longueur = 2.
#data_largeur = 1.
#data_centre = [0., 0., 0.]
#data_normale = [1., 2., 0.]
#data_direction = [0., 1., 5.]
#rayon_entaille=0.1
#data_angle=180.
#data_rayon=0.1
#extension=0.1
#epsilon=numpy.max([data_longueur,data_largeur])*1.e-8
Brayon = data_rayon>1e-12
Bentaille = rayon_entaille>1e-12
A=numpy.pi/(15.)
maxSize=numpy.min([data_longueur,data_largeur])/4.
if Bentaille:
dim=3
if Brayon:
R=numpy.min([data_rayon,rayon_entaille])
chordal, minSize = uF.calcElemSize(A, R)
else:
chordal, minSize = uF.calcElemSize(A, rayon_entaille)
else:
dim=2
if Brayon:
chordal, minSize = uF.calcElemSize(A, data_rayon)
else:
minSize=numpy.min([data_longueur,data_largeur])/10.
maxSize=minSize
chordal=1.
Vnormale, Vdirection, Vortho = uF.calcCoordVectors(data_normale, data_direction)
Vcentre = numpy.array(data_centre)
geompy = geomBuilder.New(theStudy)
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
CENTRE = geompy.MakeVertex(Vcentre[0], Vcentre[1], Vcentre[2])
NORMALE = geompy.MakeVectorDXDYDZ(Vnormale[0], Vnormale[1], Vnormale[2])
DIRECTION = geompy.MakeVectorDXDYDZ(Vdirection[0], Vdirection[1], Vdirection[2])
DIRECTION_op = geompy.MakeVectorDXDYDZ(-Vdirection[0], -Vdirection[1], -Vdirection[2])
V3 = geompy.MakeVectorDXDYDZ(Vortho[0], Vortho[1], Vortho[2])
V3_op = geompy.MakeVectorDXDYDZ(-Vortho[0], -Vortho[1], -Vortho[2])
VP1=Vcentre+Vdirection*data_longueur+Vortho*data_largeur
VP2=Vcentre-Vdirection*data_longueur+Vortho*data_largeur
VP3=Vcentre-Vdirection*data_longueur-Vortho*data_largeur
VP4=Vcentre+Vdirection*data_longueur-Vortho*data_largeur
Sommet_1 = geompy.MakeVertex(VP1[0], VP1[1], VP1[2])
Sommet_2 = geompy.MakeVertex(VP2[0], VP2[1], VP2[2])
Sommet_3 = geompy.MakeVertex(VP3[0], VP3[1], VP3[2])
Sommet_4 = geompy.MakeVertex(VP4[0], VP4[1], VP4[2])
Ligne_1 = geompy.MakeLineTwoPnt(Sommet_1, Sommet_2)
Ligne_2 = geompy.MakeLineTwoPnt(Sommet_2, Sommet_3)
Ligne_3 = geompy.MakeLineTwoPnt(Sommet_3, Sommet_4)
Ligne_4 = geompy.MakeLineTwoPnt(Sommet_4, Sommet_1)
Contour_1 = geompy.MakeWire([Ligne_1, Ligne_2, Ligne_3, Ligne_4], 1e-07)
if Brayon or Bentaille:
vertexOfRect=geompy.SubShapeAllIDs(Contour_1, geompy.ShapeType["VERTEX"])
Contour_1 = geompy.MakeFillet1D(Contour_1, data_rayon + rayon_entaille, vertexOfRect)
if not Bentaille:
RECTANGLE = geompy.MakeFaceWires([Contour_1], 1)
else:
VP1=Vcentre+Vdirection*(data_longueur-rayon_entaille)+Vnormale*rayon_entaille
VP2=Vcentre+Vdirection*(data_longueur)
VP3=Vcentre+Vdirection*(data_longueur-rayon_entaille)-Vnormale*rayon_entaille
PE1=geompy.MakeVertex(VP1[0], VP1[1], VP1[2])
PE2=geompy.MakeVertex(VP2[0], VP2[1], VP2[2])
PE3=geompy.MakeVertex(VP3[0], VP3[1], VP3[2])
ARC = geompy.MakeArc(PE1, PE2, PE3)
TUYAU = geompy.MakePipe(ARC, Contour_1)
subShapesList=geompy.GetFreeBoundary(TUYAU)[1]
entailleFace1 = geompy.MakeFaceWires([subShapesList[0]], 1)
entailleFace2 = geompy.MakeFaceWires([subShapesList[1]], 1)
RECTANGLE = geompy.MakeShell([TUYAU, entailleFace1, entailleFace2])
#edgesIDs = geompy.SubShapeAllIDs(RECTANGLE, geompy.ShapeType["EDGE"])
#edges = geompy.CreateGroup(RECTANGLE, geompy.ShapeType["EDGE"])
#geompy.UnionIDs(edges, edgesIDs)
#geompy.addToStudy( RECTANGLE, 'RECTANGLE' )
#geompy.addToStudyInFather( RECTANGLE , edges, 'edges' )
hauteur=data_longueur*1.1
eps=1.E-05
bool_boite=True
extrusion=numpy.max([1.,rayon_entaille])*1.1
if ( (data_angle>(eps)) and (data_angle<(180.-eps)) ):
rayon2=hauteur*numpy.tan(data_angle*numpy.pi/180./2.)
B1=geompy.MakeTranslationVectorDistance(CENTRE,DIRECTION,hauteur)
B2=geompy.MakeTranslationVectorDistance(B1,V3,rayon2)
geompy.TranslateVectorDistance(B1,V3_op,rayon2, False)
LB01 = geompy.MakeLineTwoPnt(CENTRE, B1)
LB02 = geompy.MakeLineTwoPnt(CENTRE, B2)
LB12 = geompy.MakeLineTwoPnt(B1, B2)
plan_BOITE = geompy.MakeFaceWires([LB01, LB02, LB12], True)
extrusion=numpy.max([1.,rayon_entaille])*1.1
BOITE = geompy.MakePrismVecH2Ways(plan_BOITE, NORMALE, extrusion)
FACE_FISSURE = geompy.MakeCommonList([RECTANGLE, BOITE])
elif ( (data_angle>=(180.-eps)) and (data_angle<=(180.+eps)) ):
VP1=Vcentre+Vortho*data_largeur*1.1
VP2=Vcentre-Vortho*data_largeur*1.1
VP3=Vcentre-Vortho*data_largeur*1.1+Vdirection*data_longueur*1.1
VP4=Vcentre+Vortho*data_largeur*1.1+Vdirection*data_longueur*1.1
Sommet_5 = geompy.MakeVertex(VP1[0], VP1[1], VP1[2])
Sommet_6 = geompy.MakeVertex(VP2[0], VP2[1], VP2[2])
Sommet_7 = geompy.MakeVertex(VP3[0], VP3[1], VP3[2])
Sommet_8 = geompy.MakeVertex(VP4[0], VP4[1], VP4[2])
Ligne_5 = geompy.MakeLineTwoPnt(Sommet_5, Sommet_6)
Ligne_6 = geompy.MakeLineTwoPnt(Sommet_6, Sommet_7)
Ligne_7 = geompy.MakeLineTwoPnt(Sommet_7, Sommet_8)
Ligne_8 = geompy.MakeLineTwoPnt(Sommet_8, Sommet_5)
Contour_2 = geompy.MakeWire([Ligne_5, Ligne_6, Ligne_7, Ligne_8], 1e-07)
Face_2 = geompy.MakeFaceWires([Contour_2], 1)
BOITE = geompy.MakePrismVecH2Ways(Face_2, NORMALE, extrusion)
FACE_FISSURE = geompy.MakeCommonList([RECTANGLE, BOITE])
#geompy.addToStudy( RECTANGLE, 'RECTANGLE' )
#geompy.addToStudy( BOITE, 'BOITE' )
#geompy.addToStudy( FACE_FISSURE, 'FACE_FISSURE' )
elif ( (data_angle>(180.+eps)) and (data_angle<(360.-eps)) ):
rayon2=hauteur*numpy.tan((360.-data_angle)*numpy.pi/180./2.)
B1=geompy.MakeTranslationVectorDistance(CENTRE,DIRECTION_op,hauteur)
B2=geompy.MakeTranslationVectorDistance(B1,V3,rayon2)
geompy.TranslateVectorDistance(B1,V3_op,rayon2, False)
LB01 = geompy.MakeLineTwoPnt(CENTRE, B1)
LB02 = geompy.MakeLineTwoPnt(CENTRE, B2)
LB12 = geompy.MakeLineTwoPnt(B1, B2)
plan_BOITE = geompy.MakeFaceWires([LB01, LB02, LB12], True)
extrusion=numpy.max([1.,rayon_entaille])*1.1
BOITE = geompy.MakePrismVecH2Ways(plan_BOITE, NORMALE, extrusion)
FACE_FISSURE = geompy.MakeCutList(RECTANGLE, [BOITE])
elif ( (data_angle<=(eps)) or (data_angle>=(360.-eps)) ):
bool_boite=False
FACE_FISSURE = RECTANGLE
else:
message('E','Angle non prevu')
#if bool_boite:
#newEdgesIDs = geompy.SubShapeAllIDs(FACE_FISSURE, geompy.ShapeType["EDGE"])
#newEdges = geompy.CreateGroup(FACE_FISSURE, geompy.ShapeType["EDGE"])
#geompy.UnionIDs(newEdges, newEdgesIDs)
#[oldEdges] = geompy.RestoreGivenSubShapes(FACE_FISSURE, [RECTANGLE, edges], GEOM.FSM_GetInPlace, True, False)
#toExtrude = geompy.CutListOfGroups([newEdges], [oldEdges])
#if extension>1.e-12:
#extrusion = geompy.MakePrismVecH(toExtrude, DIRECTION_op, extension)
#try:
#FACE_FISSURE = geompy.MakeFuseList([FACE_FISSURE, extrusion], False, True)
#except:
#FACE_FISSURE = geompy.MakeFuseList([FACE_FISSURE, extrusion], False, False)
#geompy.addToStudy( FACE_FISSURE, 'FACE_FISSURE' )
#
# SMESH component
#
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
Maillage=uF.meshCrack(FACE_FISSURE, minSize, maxSize, chordal, dim)
try:
Maillage.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1)
smesh.SetName(Maillage.GetMesh(), 'MAILLAGE_FISSURE')
except:
print 'ExportToMEDX() failed. Invalid file name?'
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)

View File

@ -0,0 +1,70 @@
# -*- coding: utf-8 -*-
###
### This file is generated automatically by SALOME v7.7.1 with dump python functionality
###
import sys, numpy
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
import utilityFunctions as uF
from output import message
#import GEOM_Gen.ild
def generate(data_rayon,data_centre,outFile):
#data_rayon = 0.1
#data_centre = [1., 1., 01.]
geompy = geomBuilder.New(theStudy)
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
SPHERE = geompy.MakeSphereR(data_rayon)
geompy.TranslateDXDYDZ(SPHERE, data_centre[0], data_centre[1], data_centre[2])
[FACE_FISSURE] = geompy.ExtractShapes(SPHERE, geompy.ShapeType["FACE"], True)
#
# SMESH component
#
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
A=numpy.pi/(20.)
chordal, minSize = uF.calcElemSize(A, data_rayon)
maxSize=data_rayon/3.
Maillage=uF.meshCrack(FACE_FISSURE, minSize, maxSize, chordal, dim=3)
try:
Maillage.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1)
smesh.SetName(Maillage.GetMesh(), 'MAILLAGE_FISSURE')
except:
print 'ExportToMEDX() failed. Invalid file name?'
## Set names of Mesh objects
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)

View File

@ -0,0 +1,485 @@
#import sys
#sys.path.append('/home/I60976/00_PROJETS/2015_INTEGRATION_ZCRACKS/zcracks_salome/zcracks')
import numpy, subprocess, sys
from os import remove, getpid, path, environ
from output import message
def calcCoordVectors(normalIN, directionIN):
V3TEMP=numpy.cross(normalIN,directionIN)
directionTEMP=numpy.cross(V3TEMP,normalIN)
normalOUT=numpy.array(normalIN)/numpy.linalg.norm(normalIN)
directionOUT=numpy.array(directionTEMP)/numpy.linalg.norm(directionTEMP)
V3OUT=numpy.array(V3TEMP)/numpy.linalg.norm(V3TEMP)
return(normalOUT, directionOUT, V3OUT)
def testStrictRange(x, inf=0.0, sup=False):
test=False
c1=(type(x)==list)
if c1:
c2=(len(x)==1)
if c2:
c3=(type(x[0])==type(inf))
if c3:
c4=(x[0]>inf)
c5=True
if sup!=False:
c5=(x[0]<sup)
if c4 and c5:
test=True
return(test)
def test3dVector(x):
test=False
c1=(type(x)==list)
if c1:
c2=(len(x)==3)
if c2:
c3=(type(x[0])==float)
c4=(type(x[1])==float)
c5=(type(x[2])==float)
if c3 and c4 and c5:
test=True
return(test)
def testRange(x, inf=0.0, sup=False):
test=False
c1=(type(x)==list)
if c1:
c2=(len(x)==1)
if c2:
c3=(type(x[0])==type(inf))
if c3:
c4=(x[0]>=inf)
c5=True
if sup!=False:
c5=(x[0]<=sup)
if c4 and c5:
test=True
return(test)
def check(data):
OK=True
test=False
c1=(data['crackedName']!='')
if c1:
test=True
if not test:
message('E','Invalid Cracked name',goOn=True)
OK=False
test=False
c1=path.isfile(data['saneName'])
if c1:
c2=(data['saneName']!=data['crackedName'])
if c2:
test=True
else:
message('E','sane mesh and cracked mesh are identical',goOn=True)
OK=False
if not test:
message('E','Bad sane mesh file',goOn=True)
OK=False
test=testStrictRange(data['minSize'])
if not test:
message('E','invalid min size',goOn=True)
OK=False
test=testStrictRange(data['maxSize'])
if not test:
message('E','invalid max size',goOn=True)
OK=False
if OK:
test=(data['maxSize'][0]>=data['minSize'][0])
if not test:
message('E','min size greater than max size',goOn=True)
OK=False
test=testStrictRange(data['extractLength'])
if not test:
message('E','invalid extract length',goOn=True)
OK=False
test=testRange(data['gradation'], inf=1.0)
if not test:
message('E','invalid Gradation',goOn=True)
OK=False
test=testRange(data['layers'], inf=1)
if not test:
message('E','invalid layers',goOn=True)
OK=False
test=testRange(data['iterations'], inf=1)
if not test:
message('E','invalid iterations',goOn=True)
OK=False
return(OK)
def calcElemSize(A, R):
x=R*(1.-numpy.cos(A/2.))
h=R*numpy.sin(A/2.)
return(x, h)
def meshCrack(geomObject, minSize, maxSize, chordal, dim):
import salome
salome.salome_init()
theStudy = salome.myStudy
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
Maillage = smesh.Mesh(geomObject)
if dim==3:
MG_CADSurf = Maillage.Triangle(algo=smeshBuilder.MG_CADSurf)
MG_CADSurf_Parameters = MG_CADSurf.Parameters()
MG_CADSurf_Parameters.SetPhysicalMesh( 0 )
MG_CADSurf_Parameters.SetGeometricMesh( 1 )
MG_CADSurf_Parameters.SetMinSize( minSize )
MG_CADSurf_Parameters.SetMaxSize( maxSize )
MG_CADSurf_Parameters.SetChordalError( chordal )
elif dim==2:
Regular_1D = Maillage.Segment()
Adaptive = Regular_1D.Adaptive(minSize,maxSize,chordal)
NETGEN_2D_ONLY = Maillage.Triangle(algo=smeshBuilder.NETGEN_2D)
else:
message('E',"error in mesh dimension",goOn=True)
isDone = Maillage.Compute()
#crack1 = Maillage.CreateEmptyGroup( SMESH.NODE, 'crack' )
#nbAdd = crack1.AddFrom( Maillage.GetMesh() )
#crack2 = Maillage.CreateEmptyGroup( SMESH.NODE, 'surface' )
#nbAdd = crack2.AddFrom( Maillage.GetMesh() )
return(Maillage)
def extendElsets(meshFile, outFile=None):
if outFile==None: outFile=meshFile
if not path.isfile(meshFile):
message('E','Mesh med file is not valid')
return('error')
import SMESH, salome
#salome.salome_init()
theStudy = salome.myStudy
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
([mesh], status) = smesh.CreateMeshesFromMED(meshFile)
mesh=cleanGroups(mesh)
# Node color status
nodeList=mesh.GetNodesId()
volElemList=mesh.GetElementsByType(SMESH.VOLUME)
surfElemList=mesh.GetElementsByType(SMESH.FACE)
edgeElemList=mesh.GetElementsByType(SMESH.EDGE)
colorList=[-1]*len(nodeList)
case2D=True
for group in mesh.GetGroups():
if group.GetType()==SMESH.VOLUME and group.GetName()[:5]=='sides' : case2D=False
sides=[]
for group in mesh.GetGroups():
if case2D:
if group.GetType()==SMESH.FACE and group.GetName()[:5]=='sides':
sides.append(group)
else:
if group.GetType()==SMESH.VOLUME and group.GetName()[:5]=='sides':
sides.append(group)
sortedSides=[None]*len(sides)
for group in sides:
N=group.GetName().replace('sides','').replace('_bset','').replace(' ','')
N=int(N)
sortedSides[N]=group
elems=group.GetIDs()
for elemId in elems:
for elemNodeId in mesh.GetElemNodes(elemId) :
colorList[elemNodeId-1]=N
#print colorList
crackOnly=True
for iN in range(len(sides)/2):
side0=sortedSides[2*iN]
side1=sortedSides[2*iN+1]
elemsOfside0=side0.GetIDs()
elemsOfside1=side1.GetIDs()
NodesOfside0=[]
NodesOfside1=[]
for elem in elemsOfside0: NodesOfside0+=mesh.GetElemNodes(elem)
for elem in elemsOfside1: NodesOfside1+=mesh.GetElemNodes(elem)
front=set(NodesOfside0).intersection(set(NodesOfside1))
if len(front)==0: crackOnly=False
if crackOnly:
mesh.ExportMED(outFile, 0, SMESH.MED_V2_2, 1, None ,1)
return('crack')
# Propagates color using elem connectivity
# Always propagates max color
#elemToTreat=volElemList
#while len(elemToTreat)>0 :
#print len(elemToTreat)
#for elemId in elemToTreat:
#minColor=sys.maxint
#maxColor=-sys.maxint
#for elemNodeId in mesh.GetElemNodes(elemId) :
#nodeColor=colorList[elemNodeId-1]
#if nodeColor<minColor : minColor=nodeColor
#if nodeColor>maxColor : maxColor=nodeColor
#if minColor!=maxColor :
#elemToTreat.remove(elemId)
#for elemNodeId in mesh.GetElemNodes(elemId) :
#colorList[elemNodeId-1]=maxColor
ifChanged=True
if case2D:
elemList=[surfElemList,edgeElemList]
grElemList=[[],[]]
else:
elemList=[volElemList,surfElemList,edgeElemList]
grElemList=[[],[],[]]
while ifChanged :
ifChanged=False
for elemId in elemList[0]:
minColor=sys.maxint
maxColor=-sys.maxint
for elemNodeId in mesh.GetElemNodes(elemId) :
nodeColor=colorList[elemNodeId-1]
if nodeColor<minColor : minColor=nodeColor
if nodeColor>maxColor : maxColor=nodeColor
if minColor!=maxColor :
ifChanged = True
for elemNodeId in mesh.GetElemNodes(elemId) :
colorList[elemNodeId-1]=maxColor
for l in grElemList:
for x in range(len(sides)):
l.append([])
for N, el in enumerate(elemList):
for elemId in el:
elemNodesId=mesh.GetElemNodes(elemId)
elemColor=colorList[elemNodesId[0]-1]
if elemColor>=0:
grElemList[N][elemColor].append(elemId)
#for elemId in surfElemList:
#elemNodesId=mesh.GetElemNodes(elemId)
#elemColor=colorList[elemNodesId[0]-1]
#if elemColor>=0:
#selem[elemColor].append(elemId)
for n in range(len(sides)):
if case2D:
mesh.MakeGroupByIds('Extended_side%d' %n ,SMESH.FACE,grElemList[0][n])
mesh.MakeGroupByIds('Extended_side%d' %n ,SMESH.EDGE,grElemList[1][n])
else:
mesh.MakeGroupByIds('Extended_side%d' %n ,SMESH.VOLUME,grElemList[0][n])
mesh.MakeGroupByIds('Extended_side%d' %n ,SMESH.FACE,grElemList[1][n])
mesh.MakeGroupByIds('Extended_side%d' %n ,SMESH.EDGE,grElemList[2][n])
if outFile==None: outFile=meshFile
mesh.ExportMED(outFile, 0, SMESH.MED_V2_2, 1, None ,1)
return(True)
def cleanGroups(mesh):
import SMESH
for group in mesh.GetGroups():
if '_bset' in group.GetName():
group.SetName(group.GetName().replace('_bset',''))
if group.GetType()==SMESH.NODE:
if group.GetName() in ['SURFACE','lip','SFRONT_NODES','FRONT']: mesh.RemoveGroup(group)
#elif group.GetType()==SMESH.EDGE:
elif group.GetType()==SMESH.FACE:
if group.GetName() in ['SURFACE','Nlip']:
mesh.RemoveGroup(group)
elif group.GetType()==SMESH.VOLUME:
if (group.GetName() in ['ELSET0','AUTO']) or (group.GetName()[:4] in ['SIDE']) :
mesh.RemoveGroup(group)
return(mesh)
def getMaxAspectRatio(tmpdir):
logFile=path.join(tmpdir,'MESHING_OUTPUT')
print logFile
if not path.isfile(logFile): return(-1)
import re
f = open(logFile, "r")
for line in f:
if re.search("WORST ELEMENT QUALITY", line): maxAR=line
f.close()
for r in [' ','WORSTELEMENTQUALITY','\n']: maxAR=maxAR.replace(r,'')
return(float(maxAR))
#def extendElsets(meshFile):
#if not path.isfile(meshFile):
#message('E','Mesh med file is not valid')
#return(-1)
#import SMESH, salome
##salome.salome_init()
#theStudy = salome.myStudy
#from salome.smesh import smeshBuilder
#smesh = smeshBuilder.New(theStudy)
#([mesh], status) = smesh.CreateMeshesFromMED(meshFile)
## Node color status
#nodeList=mesh.GetNodesId()
#colorList=[0]*len(nodeList)
## Init using SIDE0 SIDE1
#for group in mesh.GetGroups():
#if group.GetType()==SMESH.FACE :
#color=0
#if group.GetName()[0:4]=='SIDE0' :
#color=1
#elif group.GetName()[0:4]=='SIDE1' :
#color=2
#else : continue
## Get faces
#faces=group.GetIDs()
## Set faces nodes to given color
#for face_id in faces :
#for face_node_id in mesh.GetElemNodes(face_id) :
#colorList[face_node_id-1]=color
## Propagates color using elem connectivity
## Always propagates max color
#volElemList=mesh.GetElementsByType(SMESH.VOLUME)
#ifChanged=True
#while ifChanged :
#ifChanged=False
#minColor=100
#maxColor=0
#for elemId in volElemList:
#for elemNodeId in mesh.GetElemNodes(elemId) :
#nodeColor=colorList[elemNodeId-1]
#if nodeColor<minColor : minColor=nodeColor
#if nodeColor>maxColor : maxColor=nodeColor
#if minColor!=maxColor :
#ifChanged = True
#for elemNodeId in mesh.GetElemNodes(elemId) :
#colorList[elemNodeId-1]=maxColor
#velem0 = []
#velem1 = []
#for elemId in volElemList:
#elemNodesId=mesh.GetElemNodes(elemId)
#elemColor=colorList[elemNodesId[0]-1]
#if(elemColor==1) : velem0.append(elemId)
#if(elemColor==2) : velem1.append(elemId)
#mesh.MakeGroupByIds('SIDE_co',SMESH.VOLUME,velem0)
#mesh.MakeGroupByIds('SIDE_ext',SMESH.VOLUME,velem1)
#surfElemList=mesh.GetElementsByType(SMESH.FACE)
#selem0 = []
#selem1 = []
#nbelem0=0
#nbelem1=0
#for elemId in surfElemList:
#elemNodesId=mesh.GetElemNodes(elemId)
#elemColor=colorList[elemNodesId[0]-1]
#if(elemColor==1) : selem0.append(elemId)
#if(elemColor==2) : selem1.append(elemId)
#mesh.MakeGroupByIds('SIDE_co',SMESH.FACE,selem0)
#mesh.MakeGroupByIds('SIDE_ext',SMESH.FACE,selem1)
#maxAR=0.
#for elem in volElemList:
#maxAR=max(mesh.GetAspectRatio(elem),maxAR)
#for elem in surfElemList:
#maxAR=max(mesh.GetAspectRatio(elem),maxAR)
#mesh.ExportMED(meshFile, 0, SMESH.MED_V2_2, 1, None ,1)
#return(maxAR)
def removeFromSessionPath(envVar, patern):
if type(patern) is not list: patern=[patern]
if type(envVar) is not list: envVar=[envVar]
for env in envVar:
path=environ[env]
listPath=path.split(':')
for p in listPath:
for pat in patern:
if pat in p:
path=path.replace(p,'')
path.replace('::',':')
environ[env]=path
#def isPlane(geomObject, eps=1.e-9):
#import salome
#salome.salome_init()
#theStudy = salome.myStudy
#import salome_notebook
#notebook = salome_notebook.NoteBook(theStudy)
#import GEOM
#from salome.geom import geomBuilder
#geompy = geomBuilder.New(theStudy)
#Vs=geompy.SubShapeAll(geomObject, geompy.ShapeType["VERTEX"])
#if len(Vs)<=3:
#return(True)
#elif len(Vs)>3:
#P0=numpy.array(geompy.GetPosition(Vs[0])[:3])
#P1=numpy.array(geompy.GetPosition(Vs[1])[:3])
#P2=numpy.array(geompy.GetPosition(Vs[2])[:3])
#V01=P1-P0
#V02=P2-P0
#V12=P2-P1
#norm01=numpy.linalg.norm(V01)
#norm02=numpy.linalg.norm(V02)
#norm12=numpy.linalg.norm(V12)
#if (norm01<eps) or (norm02<eps) or (norm12<eps):
#print 'error'
#return(False)
#else:
#N=numpy.cross(V01,V02)
#N=N/numpy.linalg.norm(N)
#maxDist=0.
#for P in Vs[3:]:
#Pi=numpy.array(geompy.GetPosition(P)[:3])
#V=Pi-P0
#d=numpy.dot(V,N)
#maxDist=numpy.max([maxDist,numpy.abs(d)])
#else:
#print 'error'
#return(False)
#return(maxDist<eps)

View File

View File

@ -0,0 +1,2 @@
OTHER_FILES +=
FORMS += zcracks.ui

View File

@ -0,0 +1,160 @@
<!DOCTYPE QtCreatorProject>
<qtcreator>
<data>
<variable>RunConfiguration0-BaseEnvironmentBase</variable>
<value type="int">2</value>
</data>
<data>
<variable>RunConfiguration0-CommandLineArguments</variable>
<valuelist type="QVariantList"/>
</data>
<data>
<variable>RunConfiguration0-ProFile</variable>
<value type="QString">zcracks.pro</value>
</data>
<data>
<variable>RunConfiguration0-RunConfiguration.name</variable>
<value type="QString">zcracks</value>
</data>
<data>
<variable>RunConfiguration0-UseDyldImageSuffix</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UseTerminal</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserEnvironmentChanges</variable>
<valuelist type="QVariantList"/>
</data>
<data>
<variable>RunConfiguration0-UserSetName</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserSetWorkingDirectory</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserWorkingDirectory</variable>
<value type="QString"></value>
</data>
<data>
<variable>RunConfiguration0-type</variable>
<value type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
</data>
<data>
<variable>activeRunConfiguration</variable>
<value type="int">0</value>
</data>
<data>
<variable>activebuildconfiguration</variable>
<value type="QString">Debug</value>
</data>
<data>
<variable>buildConfiguration-Debug</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<value key="QtVersionId" type="int">0</value>
<value key="ToolChain" type="int">0</value>
<value key="buildConfiguration" type="int">2</value>
</valuemap>
</data>
<data>
<variable>buildConfiguration-Release</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
<value key="QtVersionId" type="int">0</value>
<value key="buildConfiguration" type="int">0</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Debug-buildstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Debug-buildstep1</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Debug-cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<value key="cleanConfig" type="bool">true</value>
<valuelist key="makeargs" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-buildstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-buildstep1</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data>
<variable>buildconfigurations</variable>
<valuelist type="QVariantList">
<value type="QString">Debug</value>
<value type="QString">Release</value>
</valuelist>
</data>
<data>
<variable>buildstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
<value key="mkspec" type="QString"></value>
</valuemap>
</data>
<data>
<variable>buildstep1</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
</valuemap>
</data>
<data>
<variable>buildsteps</variable>
<valuelist type="QVariantList">
<value type="QString">trolltech.qt4projectmanager.qmake</value>
<value type="QString">trolltech.qt4projectmanager.make</value>
</valuelist>
</data>
<data>
<variable>cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
<value key="clean" type="bool">true</value>
</valuemap>
</data>
<data>
<variable>cleansteps</variable>
<valuelist type="QVariantList">
<value type="QString">trolltech.qt4projectmanager.make</value>
</valuelist>
</data>
<data>
<variable>defaultFileEncoding</variable>
<value type="QByteArray">System</value>
</data>
<data>
<variable>project</variable>
<valuemap type="QVariantMap"/>
</data>
</qtcreator>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Zcracks
Zcracks.IHM()

View File

@ -18,21 +18,14 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import SalomePyQt
sgPyQt = SalomePyQt.SalomePyQt()
import eficasSalome
class EficasForZcracks(eficasSalome.MyEficas):
"""
"""
def __init__(self, fichier = None, version = None):
eficasSalome.MyEficas.__init__(self, sgPyQt.getDesktop(),
"ZCRACKS",
fichier, version = version)
#sgPyQt.createView(custom_appli.widgetname, self)
import os
def ZcracksLct(context):
window=EficasForZcracks()
window.show()
import os,subprocess
command = ". ${ZCRACKSHOME}/salome_do_config.sh ; "
command += 'zcracksLaunch.py &'
if command is not "":
try:
subprocess.check_call(command, executable = '/bin/bash', shell = True, bufsize=-1)
except Exception, e:
print "Error: ",e

View File

@ -0,0 +1,738 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'zcracks.ui'
#
# Created: Wed Oct 19 07:56:41 2016
# by: PyQt4 UI code generator 4.9.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Zui(object):
def setupUi(self, Zui):
Zui.setObjectName(_fromUtf8("Zui"))
Zui.resize(709, 540)
Zui.setMinimumSize(QtCore.QSize(709, 540))
Zui.setMaximumSize(QtCore.QSize(709, 540))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
Zui.setPalette(palette)
Zui.setTitle(_fromUtf8(""))
self.horizontalLayoutWidget = QtGui.QWidget(Zui)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(3, 497, 301, 37))
self.horizontalLayoutWidget.setObjectName(_fromUtf8("horizontalLayoutWidget"))
self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.btReset = QtGui.QPushButton(self.horizontalLayoutWidget)
self.btReset.setMinimumSize(QtCore.QSize(85, 35))
self.btReset.setMaximumSize(QtCore.QSize(85, 35))
self.btReset.setObjectName(_fromUtf8("btReset"))
self.horizontalLayout.addWidget(self.btReset)
self.btSave = QtGui.QPushButton(self.horizontalLayoutWidget)
self.btSave.setMinimumSize(QtCore.QSize(85, 35))
self.btSave.setMaximumSize(QtCore.QSize(85, 35))
self.btSave.setObjectName(_fromUtf8("btSave"))
self.horizontalLayout.addWidget(self.btSave)
self.btLoad = QtGui.QPushButton(self.horizontalLayoutWidget)
self.btLoad.setMinimumSize(QtCore.QSize(85, 35))
self.btLoad.setMaximumSize(QtCore.QSize(85, 35))
self.btLoad.setObjectName(_fromUtf8("btLoad"))
self.horizontalLayout.addWidget(self.btLoad)
self.horizontalLayoutWidget_2 = QtGui.QWidget(Zui)
self.horizontalLayoutWidget_2.setGeometry(QtCore.QRect(344, 490, 360, 51))
self.horizontalLayoutWidget_2.setObjectName(_fromUtf8("horizontalLayoutWidget_2"))
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.horizontalLayoutWidget_2)
self.horizontalLayout_2.setMargin(0)
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.btCancel = QtGui.QPushButton(self.horizontalLayoutWidget_2)
self.btCancel.setMinimumSize(QtCore.QSize(100, 35))
self.btCancel.setMaximumSize(QtCore.QSize(100, 35))
self.btCancel.setObjectName(_fromUtf8("btCancel"))
self.horizontalLayout_2.addWidget(self.btCancel)
self.btApply = QtGui.QPushButton(self.horizontalLayoutWidget_2)
self.btApply.setMinimumSize(QtCore.QSize(100, 35))
self.btApply.setMaximumSize(QtCore.QSize(100, 35))
self.btApply.setObjectName(_fromUtf8("btApply"))
self.horizontalLayout_2.addWidget(self.btApply)
self.btApplyClose = QtGui.QPushButton(self.horizontalLayoutWidget_2)
self.btApplyClose.setMinimumSize(QtCore.QSize(130, 35))
self.btApplyClose.setMaximumSize(QtCore.QSize(130, 35))
self.btApplyClose.setObjectName(_fromUtf8("btApplyClose"))
self.horizontalLayout_2.addWidget(self.btApplyClose)
self.frame = QtGui.QFrame(Zui)
self.frame.setGeometry(QtCore.QRect(3, 6, 309, 255))
self.frame.setFrameShape(QtGui.QFrame.Panel)
self.frame.setFrameShadow(QtGui.QFrame.Raised)
self.frame.setLineWidth(2)
self.frame.setMidLineWidth(0)
self.frame.setObjectName(_fromUtf8("frame"))
self.gridLayoutWidget = QtGui.QWidget(self.frame)
self.gridLayoutWidget.setGeometry(QtCore.QRect(-2, 21, 311, 81))
self.gridLayoutWidget.setObjectName(_fromUtf8("gridLayoutWidget"))
self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget)
self.gridLayout.setSpacing(6)
self.gridLayout.setContentsMargins(10, 0, 10, 0)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.txtCrackedName = QtGui.QLabel(self.gridLayoutWidget)
self.txtCrackedName.setMinimumSize(QtCore.QSize(112, 0))
self.txtCrackedName.setMaximumSize(QtCore.QSize(76, 16777215))
self.txtCrackedName.setStatusTip(_fromUtf8(""))
self.txtCrackedName.setWhatsThis(_fromUtf8(""))
self.txtCrackedName.setAccessibleName(_fromUtf8(""))
self.txtCrackedName.setAccessibleDescription(_fromUtf8(""))
self.txtCrackedName.setObjectName(_fromUtf8("txtCrackedName"))
self.gridLayout.addWidget(self.txtCrackedName, 0, 0, 1, 1)
self.valCrackedName = QtGui.QLineEdit(self.gridLayoutWidget)
self.valCrackedName.setMinimumSize(QtCore.QSize(118, 0))
self.valCrackedName.setAutoFillBackground(True)
self.valCrackedName.setObjectName(_fromUtf8("valCrackedName"))
self.gridLayout.addWidget(self.valCrackedName, 0, 1, 1, 1)
self.txtSaneName = QtGui.QLabel(self.gridLayoutWidget)
self.txtSaneName.setMaximumSize(QtCore.QSize(100, 16777215))
self.txtSaneName.setObjectName(_fromUtf8("txtSaneName"))
self.gridLayout.addWidget(self.txtSaneName, 1, 0, 1, 1)
self.valSaneName = QtGui.QLineEdit(self.gridLayoutWidget)
self.valSaneName.setToolTip(_fromUtf8("file adress (ex: /home/A123456/cuve.med)"))
self.valSaneName.setAutoFillBackground(True)
self.valSaneName.setInputMask(_fromUtf8(""))
self.valSaneName.setText(_fromUtf8(""))
self.valSaneName.setObjectName(_fromUtf8("valSaneName"))
self.gridLayout.addWidget(self.valSaneName, 1, 1, 1, 1)
self.btLoadCracked = QtGui.QPushButton(self.gridLayoutWidget)
self.btLoadCracked.setMinimumSize(QtCore.QSize(28, 28))
self.btLoadCracked.setMaximumSize(QtCore.QSize(28, 28))
self.btLoadCracked.setObjectName(_fromUtf8("btLoadCracked"))
self.gridLayout.addWidget(self.btLoadCracked, 0, 2, 1, 1)
self.btLoadSane = QtGui.QPushButton(self.gridLayoutWidget)
self.btLoadSane.setMinimumSize(QtCore.QSize(28, 28))
self.btLoadSane.setMaximumSize(QtCore.QSize(28, 28))
self.btLoadSane.setObjectName(_fromUtf8("btLoadSane"))
self.gridLayout.addWidget(self.btLoadSane, 1, 2, 1, 1)
self.cracked_name_2 = QtGui.QLabel(self.frame)
self.cracked_name_2.setGeometry(QtCore.QRect(0, 0, 311, 28))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(118, 118, 117))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(118, 118, 117))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText, brush)
brush = QtGui.QBrush(QtGui.QColor(118, 118, 117))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
self.cracked_name_2.setPalette(palette)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.cracked_name_2.setFont(font)
self.cracked_name_2.setAlignment(QtCore.Qt.AlignCenter)
self.cracked_name_2.setObjectName(_fromUtf8("cracked_name_2"))
self.gridLayoutWidget_3 = QtGui.QWidget(self.frame)
self.gridLayoutWidget_3.setGeometry(QtCore.QRect(-2, 102, 311, 161))
self.gridLayoutWidget_3.setObjectName(_fromUtf8("gridLayoutWidget_3"))
self.gridLayout_3 = QtGui.QGridLayout(self.gridLayoutWidget_3)
self.gridLayout_3.setContentsMargins(10, 0, 10, 0)
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
self.txtMaxSize = QtGui.QLabel(self.gridLayoutWidget_3)
self.txtMaxSize.setObjectName(_fromUtf8("txtMaxSize"))
self.gridLayout_3.addWidget(self.txtMaxSize, 1, 0, 1, 1)
self.txtExtractLength = QtGui.QLabel(self.gridLayoutWidget_3)
self.txtExtractLength.setObjectName(_fromUtf8("txtExtractLength"))
self.gridLayout_3.addWidget(self.txtExtractLength, 2, 0, 1, 1)
self.valMinSize = QtGui.QLineEdit(self.gridLayoutWidget_3)
self.valMinSize.setAutoFillBackground(True)
self.valMinSize.setObjectName(_fromUtf8("valMinSize"))
self.gridLayout_3.addWidget(self.valMinSize, 0, 1, 1, 1)
self.valMaxSize = QtGui.QLineEdit(self.gridLayoutWidget_3)
self.valMaxSize.setAutoFillBackground(True)
self.valMaxSize.setObjectName(_fromUtf8("valMaxSize"))
self.gridLayout_3.addWidget(self.valMaxSize, 1, 1, 1, 1)
self.valExtractLength = QtGui.QLineEdit(self.gridLayoutWidget_3)
self.valExtractLength.setAutoFillBackground(True)
self.valExtractLength.setObjectName(_fromUtf8("valExtractLength"))
self.gridLayout_3.addWidget(self.valExtractLength, 2, 1, 1, 1)
self.CBQuad = QtGui.QCheckBox(self.gridLayoutWidget_3)
self.CBQuad.setObjectName(_fromUtf8("CBQuad"))
self.gridLayout_3.addWidget(self.CBQuad, 3, 0, 1, 1)
self.CBBarsoum = QtGui.QCheckBox(self.gridLayoutWidget_3)
self.CBBarsoum.setEnabled(False)
self.CBBarsoum.setObjectName(_fromUtf8("CBBarsoum"))
self.gridLayout_3.addWidget(self.CBBarsoum, 3, 1, 1, 1)
self.txtMinSize = QtGui.QLabel(self.gridLayoutWidget_3)
self.txtMinSize.setObjectName(_fromUtf8("txtMinSize"))
self.gridLayout_3.addWidget(self.txtMinSize, 0, 0, 1, 1)
self.frame_2 = QtGui.QFrame(Zui)
self.frame_2.setGeometry(QtCore.QRect(2, 265, 309, 226))
self.frame_2.setFrameShape(QtGui.QFrame.Panel)
self.frame_2.setFrameShadow(QtGui.QFrame.Raised)
self.frame_2.setLineWidth(2)
self.frame_2.setMidLineWidth(0)
self.frame_2.setObjectName(_fromUtf8("frame_2"))
self.labelCrackedName = QtGui.QLabel(self.frame_2)
self.labelCrackedName.setGeometry(QtCore.QRect(-1, 0, 311, 28))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.labelCrackedName.setFont(font)
self.labelCrackedName.setAlignment(QtCore.Qt.AlignCenter)
self.labelCrackedName.setObjectName(_fromUtf8("labelCrackedName"))
self.gridLayoutWidget_2 = QtGui.QWidget(self.frame_2)
self.gridLayoutWidget_2.setGeometry(QtCore.QRect(0, 14, 311, 220))
self.gridLayoutWidget_2.setObjectName(_fromUtf8("gridLayoutWidget_2"))
self.gridLayout_2 = QtGui.QGridLayout(self.gridLayoutWidget_2)
self.gridLayout_2.setMargin(10)
self.gridLayout_2.setSpacing(10)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.txtGrVol = QtGui.QLabel(self.gridLayoutWidget_2)
self.txtGrVol.setObjectName(_fromUtf8("txtGrVol"))
self.gridLayout_2.addWidget(self.txtGrVol, 0, 0, 1, 1)
self.valGrVol = QtGui.QLineEdit(self.gridLayoutWidget_2)
self.valGrVol.setAutoFillBackground(True)
self.valGrVol.setObjectName(_fromUtf8("valGrVol"))
self.gridLayout_2.addWidget(self.valGrVol, 0, 1, 1, 1)
self.txtGrFace = QtGui.QLabel(self.gridLayoutWidget_2)
self.txtGrFace.setToolTip(_fromUtf8("Groups of faces to keep"))
self.txtGrFace.setObjectName(_fromUtf8("txtGrFace"))
self.gridLayout_2.addWidget(self.txtGrFace, 1, 0, 1, 1)
self.valGrFace = QtGui.QLineEdit(self.gridLayoutWidget_2)
self.valGrFace.setToolTip(_fromUtf8("groups separated by a space (ex: Gr1 Gr2 Gr3)"))
self.valGrFace.setAutoFillBackground(True)
self.valGrFace.setInputMask(_fromUtf8(""))
self.valGrFace.setText(_fromUtf8(""))
self.valGrFace.setObjectName(_fromUtf8("valGrFace"))
self.gridLayout_2.addWidget(self.valGrFace, 1, 1, 1, 1)
self.txtGrEdge = QtGui.QLabel(self.gridLayoutWidget_2)
self.txtGrEdge.setObjectName(_fromUtf8("txtGrEdge"))
self.gridLayout_2.addWidget(self.txtGrEdge, 2, 0, 1, 1)
self.valGrEdge = QtGui.QLineEdit(self.gridLayoutWidget_2)
self.valGrEdge.setAutoFillBackground(True)
self.valGrEdge.setObjectName(_fromUtf8("valGrEdge"))
self.gridLayout_2.addWidget(self.valGrEdge, 2, 1, 1, 1)
self.txtGrNode = QtGui.QLabel(self.gridLayoutWidget_2)
self.txtGrNode.setObjectName(_fromUtf8("txtGrNode"))
self.gridLayout_2.addWidget(self.txtGrNode, 3, 0, 1, 1)
self.valGrNode = QtGui.QLineEdit(self.gridLayoutWidget_2)
self.valGrNode.setAutoFillBackground(True)
self.valGrNode.setObjectName(_fromUtf8("valGrNode"))
self.gridLayout_2.addWidget(self.valGrNode, 3, 1, 1, 1)
self.btGrVol = QtGui.QPushButton(self.gridLayoutWidget_2)
self.btGrVol.setMaximumSize(QtCore.QSize(40, 28))
self.btGrVol.setObjectName(_fromUtf8("btGrVol"))
self.gridLayout_2.addWidget(self.btGrVol, 0, 2, 1, 1)
self.btGrFace = QtGui.QPushButton(self.gridLayoutWidget_2)
self.btGrFace.setMaximumSize(QtCore.QSize(40, 28))
self.btGrFace.setObjectName(_fromUtf8("btGrFace"))
self.gridLayout_2.addWidget(self.btGrFace, 1, 2, 1, 1)
self.btGrEdge = QtGui.QPushButton(self.gridLayoutWidget_2)
self.btGrEdge.setMaximumSize(QtCore.QSize(40, 28))
self.btGrEdge.setObjectName(_fromUtf8("btGrEdge"))
self.gridLayout_2.addWidget(self.btGrEdge, 2, 2, 1, 1)
self.btGrNode = QtGui.QPushButton(self.gridLayoutWidget_2)
self.btGrNode.setMaximumSize(QtCore.QSize(40, 28))
self.btGrNode.setObjectName(_fromUtf8("btGrNode"))
self.gridLayout_2.addWidget(self.btGrNode, 3, 2, 1, 1)
self.btGrAll = QtGui.QPushButton(self.gridLayoutWidget_2)
self.btGrAll.setMaximumSize(QtCore.QSize(80, 28))
self.btGrAll.setObjectName(_fromUtf8("btGrAll"))
self.gridLayout_2.addWidget(self.btGrAll, 4, 1, 1, 1)
self.frame_3 = QtGui.QFrame(Zui)
self.frame_3.setGeometry(QtCore.QRect(317, 6, 388, 333))
self.frame_3.setFrameShape(QtGui.QFrame.Panel)
self.frame_3.setFrameShadow(QtGui.QFrame.Raised)
self.frame_3.setLineWidth(2)
self.frame_3.setMidLineWidth(0)
self.frame_3.setObjectName(_fromUtf8("frame_3"))
self.tabWidget = QtGui.QTabWidget(self.frame_3)
self.tabWidget.setGeometry(QtCore.QRect(4, 23, 378, 306))
self.tabWidget.setMinimumSize(QtCore.QSize(0, 270))
self.tabWidget.setMaximumSize(QtCore.QSize(16777215, 331))
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
self.ongletEllipse = QtGui.QWidget()
self.ongletEllipse.setObjectName(_fromUtf8("ongletEllipse"))
self.tabEllipse = QtGui.QTableWidget(self.ongletEllipse)
self.tabEllipse.setGeometry(QtCore.QRect(0, 0, 375, 271))
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.tabEllipse.sizePolicy().hasHeightForWidth())
self.tabEllipse.setSizePolicy(sizePolicy)
self.tabEllipse.setMaximumSize(QtCore.QSize(16777215, 301))
self.tabEllipse.setBaseSize(QtCore.QSize(0, 0))
font = QtGui.QFont()
font.setUnderline(False)
self.tabEllipse.setFont(font)
self.tabEllipse.setMouseTracking(False)
self.tabEllipse.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
self.tabEllipse.setAutoFillBackground(False)
self.tabEllipse.setObjectName(_fromUtf8("tabEllipse"))
self.tabEllipse.setColumnCount(1)
self.tabEllipse.setRowCount(8)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setItalic(False)
font.setWeight(75)
item.setFont(font)
self.tabEllipse.setVerticalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabEllipse.setVerticalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabEllipse.setVerticalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setVerticalHeaderItem(3, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setVerticalHeaderItem(4, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setVerticalHeaderItem(5, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setVerticalHeaderItem(6, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setVerticalHeaderItem(7, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.NoBrush)
item.setBackground(brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.NoBrush)
item.setForeground(brush)
self.tabEllipse.setItem(0, 0, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabEllipse.setItem(1, 0, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabEllipse.setItem(2, 0, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setItem(3, 0, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setItem(4, 0, item)
item = QtGui.QTableWidgetItem()
self.tabEllipse.setItem(5, 0, item)
self.infoEllipse = QtGui.QLabel(self.ongletEllipse)
self.infoEllipse.setGeometry(QtCore.QRect(330, 0, 40, 25))
self.infoEllipse.setAlignment(QtCore.Qt.AlignCenter)
self.infoEllipse.setObjectName(_fromUtf8("infoEllipse"))
self.tabWidget.addTab(self.ongletEllipse, _fromUtf8(""))
self.ongletRectangle = QtGui.QWidget()
self.ongletRectangle.setObjectName(_fromUtf8("ongletRectangle"))
self.tabRectangle = QtGui.QTableWidget(self.ongletRectangle)
self.tabRectangle.setGeometry(QtCore.QRect(0, 0, 375, 271))
self.tabRectangle.setMaximumSize(QtCore.QSize(16777215, 301))
self.tabRectangle.setObjectName(_fromUtf8("tabRectangle"))
self.tabRectangle.setColumnCount(1)
self.tabRectangle.setRowCount(8)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabRectangle.setVerticalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabRectangle.setVerticalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabRectangle.setVerticalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabRectangle.setVerticalHeaderItem(3, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setVerticalHeaderItem(4, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setVerticalHeaderItem(5, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setVerticalHeaderItem(6, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setVerticalHeaderItem(7, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setItem(3, 0, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setItem(4, 0, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setItem(5, 0, item)
item = QtGui.QTableWidgetItem()
self.tabRectangle.setItem(6, 0, item)
self.infoRectangle = QtGui.QLabel(self.ongletRectangle)
self.infoRectangle.setGeometry(QtCore.QRect(330, 0, 40, 25))
self.infoRectangle.setAlignment(QtCore.Qt.AlignCenter)
self.infoRectangle.setObjectName(_fromUtf8("infoRectangle"))
self.tabWidget.addTab(self.ongletRectangle, _fromUtf8(""))
self.ongletSphere = QtGui.QWidget()
self.ongletSphere.setObjectName(_fromUtf8("ongletSphere"))
self.tabSphere = QtGui.QTableWidget(self.ongletSphere)
self.tabSphere.setGeometry(QtCore.QRect(0, 0, 375, 272))
self.tabSphere.setMaximumSize(QtCore.QSize(16777215, 301))
self.tabSphere.setObjectName(_fromUtf8("tabSphere"))
self.tabSphere.setColumnCount(1)
self.tabSphere.setRowCount(2)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabSphere.setVerticalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabSphere.setVerticalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.tabSphere.setHorizontalHeaderItem(0, item)
self.infoSphere = QtGui.QLabel(self.ongletSphere)
self.infoSphere.setGeometry(QtCore.QRect(330, 0, 40, 25))
self.infoSphere.setAlignment(QtCore.Qt.AlignCenter)
self.infoSphere.setObjectName(_fromUtf8("infoSphere"))
self.tabWidget.addTab(self.ongletSphere, _fromUtf8(""))
self.ongletPerso = QtGui.QWidget()
self.ongletPerso.setObjectName(_fromUtf8("ongletPerso"))
self.tabPerso = QtGui.QTableWidget(self.ongletPerso)
self.tabPerso.setGeometry(QtCore.QRect(0, 0, 375, 271))
self.tabPerso.setMaximumSize(QtCore.QSize(16777215, 301))
self.tabPerso.setObjectName(_fromUtf8("tabPerso"))
self.tabPerso.setColumnCount(1)
self.tabPerso.setRowCount(1)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
item.setFont(font)
self.tabPerso.setVerticalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
font = QtGui.QFont()
font.setBold(False)
font.setWeight(50)
item.setFont(font)
self.tabPerso.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tabPerso.setItem(0, 0, item)
self.infoCustom = QtGui.QLabel(self.ongletPerso)
self.infoCustom.setGeometry(QtCore.QRect(330, 0, 40, 25))
self.infoCustom.setAlignment(QtCore.Qt.AlignCenter)
self.infoCustom.setObjectName(_fromUtf8("infoCustom"))
self.tabWidget.addTab(self.ongletPerso, _fromUtf8(""))
self.labelCrackName = QtGui.QLabel(self.frame_3)
self.labelCrackName.setGeometry(QtCore.QRect(0, 0, 381, 28))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.labelCrackName.setFont(font)
self.labelCrackName.setAlignment(QtCore.Qt.AlignCenter)
self.labelCrackName.setObjectName(_fromUtf8("labelCrackName"))
self.frame_4 = QtGui.QFrame(Zui)
self.frame_4.setEnabled(True)
self.frame_4.setGeometry(QtCore.QRect(317, 344, 388, 147))
self.frame_4.setFrameShape(QtGui.QFrame.Panel)
self.frame_4.setFrameShadow(QtGui.QFrame.Raised)
self.frame_4.setLineWidth(2)
self.frame_4.setMidLineWidth(0)
self.frame_4.setObjectName(_fromUtf8("frame_4"))
self.CBAdvanced = QtGui.QCheckBox(self.frame_4)
self.CBAdvanced.setGeometry(QtCore.QRect(6, 2, 171, 23))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.CBAdvanced.setFont(font)
self.CBAdvanced.setObjectName(_fromUtf8("CBAdvanced"))
self.widget = QtGui.QWidget(self.frame_4)
self.widget.setGeometry(QtCore.QRect(0, 24, 427, 106))
self.widget.setObjectName(_fromUtf8("widget"))
self.gridLayoutWidget_9 = QtGui.QWidget(self.widget)
self.gridLayoutWidget_9.setGeometry(QtCore.QRect(1, 35, 381, 40))
self.gridLayoutWidget_9.setObjectName(_fromUtf8("gridLayoutWidget_9"))
self.gridLayout_9 = QtGui.QGridLayout(self.gridLayoutWidget_9)
self.gridLayout_9.setContentsMargins(10, 0, 10, 0)
self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9"))
self.btVisu = QtGui.QPushButton(self.gridLayoutWidget_9)
self.btVisu.setMinimumSize(QtCore.QSize(85, 28))
self.btVisu.setMaximumSize(QtCore.QSize(85, 28))
self.btVisu.setObjectName(_fromUtf8("btVisu"))
self.gridLayout_9.addWidget(self.btVisu, 0, 0, 1, 1)
self.txtSurfopt = QtGui.QLabel(self.gridLayoutWidget_9)
self.txtSurfopt.setMinimumSize(QtCore.QSize(67, 28))
self.txtSurfopt.setMaximumSize(QtCore.QSize(16777215, 28))
self.txtSurfopt.setObjectName(_fromUtf8("txtSurfopt"))
self.gridLayout_9.addWidget(self.txtSurfopt, 0, 1, 1, 1)
self.valSurfopt = QtGui.QLineEdit(self.gridLayoutWidget_9)
self.valSurfopt.setMinimumSize(QtCore.QSize(0, 28))
self.valSurfopt.setMaximumSize(QtCore.QSize(16777215, 28))
self.valSurfopt.setAutoFillBackground(True)
self.valSurfopt.setText(_fromUtf8(""))
self.valSurfopt.setObjectName(_fromUtf8("valSurfopt"))
self.gridLayout_9.addWidget(self.valSurfopt, 0, 2, 1, 1)
self.CBIs2D = QtGui.QCheckBox(self.widget)
self.CBIs2D.setGeometry(QtCore.QRect(0, 80, 81, 26))
self.CBIs2D.setObjectName(_fromUtf8("CBIs2D"))
self.CBRefine = QtGui.QCheckBox(self.widget)
self.CBRefine.setGeometry(QtCore.QRect(90, 80, 92, 26))
self.CBRefine.setObjectName(_fromUtf8("CBRefine"))
self.gridLayoutWidget_8 = QtGui.QWidget(self.widget)
self.gridLayoutWidget_8.setGeometry(QtCore.QRect(2, 6, 381, 30))
self.gridLayoutWidget_8.setObjectName(_fromUtf8("gridLayoutWidget_8"))
self.gridLayout_8 = QtGui.QGridLayout(self.gridLayoutWidget_8)
self.gridLayout_8.setContentsMargins(10, 0, 10, 0)
self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8"))
self.txtGradation = QtGui.QLabel(self.gridLayoutWidget_8)
self.txtGradation.setMinimumSize(QtCore.QSize(0, 28))
self.txtGradation.setObjectName(_fromUtf8("txtGradation"))
self.gridLayout_8.addWidget(self.txtGradation, 0, 0, 1, 1)
self.valGradation = QtGui.QLineEdit(self.gridLayoutWidget_8)
self.valGradation.setMinimumSize(QtCore.QSize(40, 28))
self.valGradation.setAutoFillBackground(True)
self.valGradation.setObjectName(_fromUtf8("valGradation"))
self.gridLayout_8.addWidget(self.valGradation, 0, 1, 1, 1)
self.txtLayers = QtGui.QLabel(self.gridLayoutWidget_8)
self.txtLayers.setMinimumSize(QtCore.QSize(50, 28))
self.txtLayers.setObjectName(_fromUtf8("txtLayers"))
self.gridLayout_8.addWidget(self.txtLayers, 0, 2, 1, 1)
self.txtIterations = QtGui.QLabel(self.gridLayoutWidget_8)
self.txtIterations.setMinimumSize(QtCore.QSize(69, 0))
self.txtIterations.setMaximumSize(QtCore.QSize(16777215, 28))
self.txtIterations.setObjectName(_fromUtf8("txtIterations"))
self.gridLayout_8.addWidget(self.txtIterations, 0, 4, 1, 1)
self.valLayers = QtGui.QLineEdit(self.gridLayoutWidget_8)
self.valLayers.setMinimumSize(QtCore.QSize(30, 28))
self.valLayers.setMaximumSize(QtCore.QSize(35, 16777215))
self.valLayers.setAutoFillBackground(True)
self.valLayers.setObjectName(_fromUtf8("valLayers"))
self.gridLayout_8.addWidget(self.valLayers, 0, 3, 1, 1)
self.valIterations = QtGui.QLineEdit(self.gridLayoutWidget_8)
self.valIterations.setMinimumSize(QtCore.QSize(30, 28))
self.valIterations.setMaximumSize(QtCore.QSize(30, 28))
self.valIterations.setAutoFillBackground(True)
self.valIterations.setObjectName(_fromUtf8("valIterations"))
self.gridLayout_8.addWidget(self.valIterations, 0, 5, 1, 1)
self.retranslateUi(Zui)
self.tabWidget.setCurrentIndex(2)
QtCore.QMetaObject.connectSlotsByName(Zui)
def retranslateUi(self, Zui):
Zui.setWindowTitle(_translate("Zui", "Zcracks interface - version dev", None))
self.btReset.setToolTip(_translate("Zui", "Clear all paramters", None))
self.btReset.setText(_translate("Zui", "Reset", None))
self.btSave.setToolTip(_translate("Zui", "Save parameters in a file", None))
self.btSave.setText(_translate("Zui", "Save", None))
self.btLoad.setToolTip(_translate("Zui", "Load all parameters from a file", None))
self.btLoad.setText(_translate("Zui", "Load", None))
self.btCancel.setToolTip(_translate("Zui", "Exit Zcracks", None))
self.btCancel.setText(_translate("Zui", "Cancel", None))
self.btApply.setToolTip(_translate("Zui", "Launch crack insertion", None))
self.btApply.setText(_translate("Zui", "Apply", None))
self.btApplyClose.setToolTip(_translate("Zui", "Launch crack insertion and quit", None))
self.btApplyClose.setText(_translate("Zui", "Apply and close", None))
self.txtCrackedName.setToolTip(_translate("Zui", "Name of the resulting cracked mesh", None))
self.txtCrackedName.setText(_translate("Zui", "Cracked name", None))
self.valCrackedName.setToolTip(_translate("Zui", "file adress (ex: /home/A123456/cracked.med)", None))
self.txtSaneName.setToolTip(_translate("Zui", "Name of the sane mesh", None))
self.txtSaneName.setText(_translate("Zui", "Sane mesh", None))
self.btLoadCracked.setText(_translate("Zui", "...", None))
self.btLoadSane.setText(_translate("Zui", "...", None))
self.cracked_name_2.setToolTip(_translate("Zui", "General parameters", None))
self.cracked_name_2.setText(_translate("Zui", "Mesh parameters", None))
self.txtMaxSize.setToolTip(_translate("Zui", "Maximum mesh size", None))
self.txtMaxSize.setText(_translate("Zui", "Maximum size", None))
self.txtExtractLength.setToolTip(_translate("Zui", "Extraction length (optionnal)", None))
self.txtExtractLength.setText(_translate("Zui", "Extraction length", None))
self.valMinSize.setToolTip(_translate("Zui", "float (ex: 1.E-04)", None))
self.valMaxSize.setToolTip(_translate("Zui", "float (ex: 1.E-03)", None))
self.valExtractLength.setToolTip(_translate("Zui", "float (ex: 1.E-04)", None))
self.CBQuad.setToolTip(_translate("Zui", "Quadratic cracked mesh", None))
self.CBQuad.setText(_translate("Zui", "Quadratic", None))
self.CBBarsoum.setToolTip(_translate("Zui", "Use Barsoum (quarter nodes) elements at crack front", None))
self.CBBarsoum.setText(_translate("Zui", "Barsoum", None))
self.txtMinSize.setToolTip(_translate("Zui", "Minimum mesh size", None))
self.txtMinSize.setText(_translate("Zui", "Minimum size", None))
self.labelCrackedName.setToolTip(_translate("Zui", "Groups to save (limit list to vital groups)", None))
self.labelCrackedName.setText(_translate("Zui", "Groups", None))
self.txtGrVol.setToolTip(_translate("Zui", "Groups of volumes to keep", None))
self.txtGrVol.setText(_translate("Zui", "Volumes", None))
self.valGrVol.setToolTip(_translate("Zui", "groups separated by a space (ex: Gr1 Gr2 Gr3)", None))
self.txtGrFace.setText(_translate("Zui", "Faces", None))
self.txtGrEdge.setToolTip(_translate("Zui", "Groups of edges to keep", None))
self.txtGrEdge.setText(_translate("Zui", "Edges", None))
self.valGrEdge.setToolTip(_translate("Zui", "groups separated by a space (ex: Gr1 Gr2 Gr3)", None))
self.txtGrNode.setToolTip(_translate("Zui", "Groups of nodes to keep", None))
self.txtGrNode.setText(_translate("Zui", "Nodes", None))
self.valGrNode.setToolTip(_translate("Zui", "groups separated by a space (ex: Gr1 Gr2 Gr3)", None))
self.btGrVol.setText(_translate("Zui", "Load", None))
self.btGrFace.setText(_translate("Zui", "Load", None))
self.btGrEdge.setText(_translate("Zui", "Load", None))
self.btGrNode.setText(_translate("Zui", "Load", None))
self.btGrAll.setText(_translate("Zui", "Load all", None))
item = self.tabEllipse.verticalHeaderItem(0)
item.setText(_translate("Zui", "Centre", None))
item = self.tabEllipse.verticalHeaderItem(1)
item.setText(_translate("Zui", "Normale", None))
item = self.tabEllipse.verticalHeaderItem(2)
item.setText(_translate("Zui", "Rayon", None))
item = self.tabEllipse.verticalHeaderItem(3)
item.setText(_translate("Zui", "Direction", None))
item = self.tabEllipse.verticalHeaderItem(4)
item.setText(_translate("Zui", "Rayon 2", None))
item = self.tabEllipse.verticalHeaderItem(5)
item.setText(_translate("Zui", "Angle", None))
item = self.tabEllipse.verticalHeaderItem(6)
item.setText(_translate("Zui", "Rayon entaille", None))
item = self.tabEllipse.verticalHeaderItem(7)
item.setText(_translate("Zui", "Extension", None))
item = self.tabEllipse.horizontalHeaderItem(0)
item.setText(_translate("Zui", "Valeur", None))
__sortingEnabled = self.tabEllipse.isSortingEnabled()
self.tabEllipse.setSortingEnabled(False)
self.tabEllipse.setSortingEnabled(__sortingEnabled)
self.infoEllipse.setToolTip(_translate("Zui", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Fissure de forme elliptique :</span></p><p><img src=\":/newPrefix/images/schema_ellipse.png\"/><br/></p><p><span style=\" font-weight:600; text-decoration: underline;\">Centre</span> : Coordonnées du centre de l\'ellipse (ex: 0 0 1)</p><p><span style=\" font-weight:600; text-decoration: underline;\">Normale</span> : Coordonnées du vecteur normal à l\'ellipse (ex: 1 0 0)</p><p><span style=\" font-weight:600; text-decoration: underline;\">Rayon</span> : Rayon de l\'ellipse le long du vecteur direction (ex: 1.0e1)</p><p><span style=\" text-decoration: underline;\">Direction</span> : Coordonnées du vecteur direction de l\'ellipse (ex: 0 1 0). Nécessaire pour une ellipse</p><p><span style=\" text-decoration: underline;\">Rayon 2</span> : Rayon de l\'ellipse le long du vecteur orthogonal à normale et direction (ex: 1.0e1). Si vide égal à Rayon</p><p><span style=\" text-decoration: underline;\">Angle</span> : Angle en degrés pour une ellipse tronquée (ex: 180.). Si vide, l\'ellipse n\'est pas tronquée</p><p><span style=\" text-decoration: underline;\">Rayon entaille</span> : Rayon du fond d\'entaille. (ex: 1.0e1). Si vide, la fissure est plane sans entaille</p><p><span style=\" text-decoration: underline;\">Extension</span> : Longueur d\'extension de l\'ellipse tronquée dans le long de la direction opposée à Direction (ex: 1.0)</p><p><span style=\" font-weight:600; font-style:italic;\">Gras : Informations obligatoires</span></p></body></html>", None))
self.infoEllipse.setText(_translate("Zui", "?", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.ongletEllipse), _translate("Zui", "Ellipse", None))
item = self.tabRectangle.verticalHeaderItem(0)
item.setText(_translate("Zui", "Centre", None))
item = self.tabRectangle.verticalHeaderItem(1)
item.setText(_translate("Zui", "Normale", None))
item = self.tabRectangle.verticalHeaderItem(2)
item.setText(_translate("Zui", "Longueur", None))
item = self.tabRectangle.verticalHeaderItem(3)
item.setText(_translate("Zui", "Direction", None))
item = self.tabRectangle.verticalHeaderItem(4)
item.setText(_translate("Zui", "Largeur", None))
item = self.tabRectangle.verticalHeaderItem(5)
item.setText(_translate("Zui", "Rayon", None))
item = self.tabRectangle.verticalHeaderItem(6)
item.setText(_translate("Zui", "Angle", None))
item = self.tabRectangle.verticalHeaderItem(7)
item.setText(_translate("Zui", "Rayon entaille", None))
item = self.tabRectangle.horizontalHeaderItem(0)
item.setText(_translate("Zui", "Valeur", None))
__sortingEnabled = self.tabRectangle.isSortingEnabled()
self.tabRectangle.setSortingEnabled(False)
self.tabRectangle.setSortingEnabled(__sortingEnabled)
self.infoRectangle.setToolTip(_translate("Zui", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Fissure de forme rectangulaire :</span></p><p><img src=\":/newPrefix/images/schema_rectangle.png\"/><br/></p><p><span style=\" font-weight:600; text-decoration: underline;\">Centre</span> : Coordonnées du centre du rectangle (ex: 0 0 1)</p><p><span style=\" font-weight:600; text-decoration: underline;\">Normale</span> : Coordonnées du vecteur normal au rectangle (ex: 1 0 0)</p><p><span style=\" font-weight:600; text-decoration: underline;\">Longueur</span> : Demie longueur du rectangle le long du vecteur direction (ex: 1.0e1)</p><p><span style=\" font-weight:600; text-decoration: underline;\">Direction</span> : Coordonnées du vecteur direction du rectangle (ex: 0 1 0)</p><p><span style=\" text-decoration: underline;\">Largeur</span> : Demie largeur du rectangle le long du vecteur orthogonal à normale et direction (ex: 1.0e1). Si vide, égal à Longueur</p><p><span style=\" text-decoration: underline;\">Rayon </span>: Rayon du congé aux angles du rectangle (ex: 1.0e1). Si vide, pas de congé</p><p><span style=\" text-decoration: underline;\">Angle</span> : Angle en degrés pour un rectangle tronqué (ex: 180.). Si vide, le rectangle n\'est pas tronquée</p><p><span style=\" text-decoration: underline;\">Rayon entaille</span> : Rayon du fond d\'entaille. (ex: 1.0e1). Si vide, la fissure est plane sans entaille</p><p><span style=\" font-weight:600; font-style:italic;\">Gras : Informations obligatoires</span></p></body></html>", None))
self.infoRectangle.setText(_translate("Zui", "?", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.ongletRectangle), _translate("Zui", "Rectangle", None))
item = self.tabSphere.verticalHeaderItem(0)
item.setText(_translate("Zui", "Centre", None))
item = self.tabSphere.verticalHeaderItem(1)
item.setText(_translate("Zui", "Rayon", None))
item = self.tabSphere.horizontalHeaderItem(0)
item.setText(_translate("Zui", "Valeur", None))
self.infoSphere.setToolTip(_translate("Zui", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Fissure de forme spherique :</span></p><p><img src=\":/newPrefix/images/schema_shpere.png\"/><br/></p><p><span style=\" font-weight:600; text-decoration: underline;\">Centre</span> : Coordonnées du centre de la sphere (ex: 0 0 1)</p><p><span style=\" font-weight:600; text-decoration: underline;\">Rayon</span> : Rayon de la sphere (ex: 1.0e1)</p><p><span style=\" font-weight:600; font-style:italic;\">Gras : Informations obligatoires</span></p></body></html>", None))
self.infoSphere.setText(_translate("Zui", "?", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.ongletSphere), _translate("Zui", "Sphere", None))
item = self.tabPerso.verticalHeaderItem(0)
item.setText(_translate("Zui", "med file", None))
item = self.tabPerso.horizontalHeaderItem(0)
item.setText(_translate("Zui", "File", None))
__sortingEnabled = self.tabPerso.isSortingEnabled()
self.tabPerso.setSortingEnabled(False)
self.tabPerso.setSortingEnabled(__sortingEnabled)
self.infoCustom.setToolTip(_translate("Zui", "<html><head/><body><p><span style=\" font-weight:600; text-decoration: underline;\">Fissure de forme personnalisée :</span></p><p><span style=\" font-weight:600; text-decoration: underline;\">Med file</span> : Adresse du maillage décrivant la fissure (ex: $HOME/PROJETX/fissure3.med)</p><p><span style=\" font-style:italic;\">Le maillage de la fissure doit être une surface composée de tétrahèdres linéaires uniquement.</span></p><p><span style=\" font-weight:600; font-style:italic;\">Gras : Informations obligatoires</span></p></body></html>", None))
self.infoCustom.setText(_translate("Zui", "?", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.ongletPerso), _translate("Zui", "Custom", None))
self.labelCrackName.setToolTip(_translate("Zui", "Crack automatic generation", None))
self.labelCrackName.setText(_translate("Zui", "Crack", None))
self.CBAdvanced.setToolTip(_translate("Zui", "Advanced options (Use with caution)", None))
self.CBAdvanced.setText(_translate("Zui", "Advanced options", None))
self.btVisu.setToolTip(_translate("Zui", "Load all parameters from a file", None))
self.btVisu.setText(_translate("Zui", "Quick View", None))
self.txtSurfopt.setToolTip(_translate("Zui", "SURFOPT options", None))
self.txtSurfopt.setText(_translate("Zui", "SURFOPT", None))
self.valSurfopt.setToolTip(_translate("Zui", "string", None))
self.CBIs2D.setToolTip(_translate("Zui", "Check if sane mesh is a surface", None))
self.CBIs2D.setText(_translate("Zui", "2D case", None))
self.CBRefine.setToolTip(_translate("Zui", "Check to refine sane mesh before crack insertion", None))
self.CBRefine.setText(_translate("Zui", "Pre refine", None))
self.txtGradation.setToolTip(_translate("Zui", "Mesh increase parameter", None))
self.txtGradation.setText(_translate("Zui", "Gradation", None))
self.valGradation.setToolTip(_translate("Zui", "float (ex: 1.3)", None))
self.valGradation.setText(_translate("Zui", "1.3", None))
self.txtLayers.setToolTip(_translate("Zui", "Constant size layers number", None))
self.txtLayers.setText(_translate("Zui", "Layers", None))
self.txtIterations.setToolTip(_translate("Zui", "Remeshing iterations number", None))
self.txtIterations.setText(_translate("Zui", "Iterations", None))
self.valLayers.setToolTip(_translate("Zui", "integer (ex: 5)", None))
self.valLayers.setText(_translate("Zui", "5", None))
self.valIterations.setToolTip(_translate("Zui", "integer (ex: 2)", None))
self.valIterations.setText(_translate("Zui", "2", None))
import images_rc

View File

@ -17,9 +17,10 @@
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# Author : Guillaume Boulant (EDF)
# Author : Guillaume Boulant (EDF)
#
import salome_pluginsmanager
import os
try:
from spadderPlugin import runSpadderPlugin
@ -75,15 +76,16 @@ except:
salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable')
pass
# ZCracks plugin requires the module EFICAS to be installed
# thus it is first tested if this module is available before
# adding the plugin to salome_pluginsmanager
# ZCracks plugin requires the Zcracks tool
try:
import eficasSalome
from zcracks_plugin import ZcracksLct
salome_pluginsmanager.AddFunction('Run Zcrack',
'Run Zcrack',
ZcracksLct)
zcracksHome=os.environ['ZCRACKSHOME']
if len(zcracksHome) > 1:
#print 'ZCRACKSHOME ', zcracksHome
from Zcracks.zcracks_plugin import ZcracksLct
salome_pluginsmanager.AddFunction('Run Zcrack',
'Run Zcrack',
ZcracksLct)
except:
#print 'probleme zcracks'
salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable')
pass