+# Copyright (C) 2016-2020 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
+#
+
import os, shutil
-import sphere, ellipse, rectangle
-import utilityFunctions as uF
-from output import message
+from . import sphere, ellipse, rectangle
+from . import utilityFunctions as uF
+from .output import message
def main(data, outFile):
activeCrack=data['crack']['actif']
res=False
demiGrandAxe=crack['Rayon'][0]
- if 'Rayon 2' not in crack.keys(): crack['Rayon 2']=[]
+ if 'Rayon 2' not in list(crack.keys()): crack['Rayon 2']=[]
if len(crack['Rayon 2'])==0:
demiPetitAxe=demiGrandAxe
else:
res=False
normale=crack['Normale']
- if 'Direction' not in crack.keys(): crack['Direction']=[]
+ if 'Direction' not in list(crack.keys()): crack['Direction']=[]
if len(crack['Direction'])==0:
if normale==[1.,0.,0.]:
direction=[0.,1.,0.]
message('E','Normale and Direction are equals',goOn=True)
res=False
- if 'Angle' not in crack.keys(): crack['Angle']=[]
+ if 'Angle' not in list(crack.keys()): crack['Angle']=[]
if len(crack['Angle'])==0:
angle=0.0
else:
res=False
angle=crack['Angle'][0]
- if 'Rayon entaille' not in crack.keys(): crack['Rayon entaille']=[]
+ if 'Rayon entaille' not in list(crack.keys()): crack['Rayon entaille']=[]
if len(crack['Rayon entaille'])==0:
rayon_entaille=0.0
else:
res=False
rayon_entaille=crack['Rayon entaille'][0]
- if 'Extension' not in crack.keys(): crack['Extension']=[]
+ if 'Extension' not in list(crack.keys()): crack['Extension']=[]
if len(crack['Extension'])==0:
extension=0.0
else:
res=False
longueur=crack['Longueur'][0]
- if 'Largeur' not in crack.keys(): crack['Largeur']=[]
+ if 'Largeur' not in list(crack.keys()): crack['Largeur']=[]
if len(crack['Largeur'])==0:
largeur=longueur
else:
res=False
direction=crack['Direction']
- if 'Angle' not in crack.keys(): crack['Angle']=[]
+ if 'Angle' not in list(crack.keys()): crack['Angle']=[]
if len(crack['Angle'])==0:
angle=0.0
else:
res=False
angle=crack['Angle'][0]
- if 'Rayon' not in crack.keys(): crack['Rayon']=[]
+ if 'Rayon' not in list(crack.keys()): crack['Rayon']=[]
if len(crack['Rayon'])==0:
rayon=0.0
else:
res=False
rayon=crack['Rayon'][0]
- if 'Rayon entaille' not in crack.keys(): crack['Rayon entaille']=[]
+ if 'Rayon entaille' not in list(crack.keys()): crack['Rayon entaille']=[]
if len(crack['Rayon entaille'])==0:
rayon_entaille=0.0
else:
import salome
salome.salome_init()
- theStudy = salome.myStudy
import salome_notebook
- notebook = salome_notebook.NoteBook(theStudy)
+ notebook = salome_notebook.NoteBook()
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
- smesh = smeshBuilder.New(theStudy)
+ smesh = smeshBuilder.New()
([Maillage_1], status) = smesh.CreateMeshesFromMED(crack['med file'])
isCrack=False
for group in Maillage_1.GetGroups():
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)
+ Maillage_1.ExportMED(outFile)
return(True)